home *** CD-ROM | disk | FTP | other *** search
- ; RSECM: Routine to read disk sectors directly using the DOS interrupt.
- ; Designed to be called from Microsoft C, using the medium model.
- ; int rsecm(char *data,unsigned drive,unsigned sector,unsigned numsec);
- ; The error value returned has the ROM BIOS error code in the low byte, and the
- ; critical error handler code in the high byte. Bit 0 is 1 on error.
- ; Assemble with the /MX option for lower case: masm /MX rsecm;
- ; See Norton Page 251.
- .MODEL MEDIUM
- .CODE
- PUBLIC _rsecm
- _rsecm PROC
- PUSH BP ; Save old BP
- MOV BP,SP
- PUSH DI ; C requires DI and SI to be saved
- PUSH SI ; (and DS and SS)
- MOV BX,[BP+6] ; Data address
- MOV AX,[BP+8] ; Drive
- MOV DX,[BP+10] ; Sector number
- MOV CX,[BP+12] ; Number of sectors
- INT 25H ; DOS absolute disk read interrupt
- JNB OK ; Carry clear?
- MOV BL,AH ; Return with ROM BIOS error value
- MOV BH,AL ; Return with critical error handler code
- OR BL,1 ; Ensure an error is signalled
- MOV AX,BX
- JMP FIN
- OK: MOV AX,0 ; Signal no error
- FIN: POPF ; Discard extra word on stack
- POP SI ; Restore DI and SI
- POP DI
- POP BP ; Restore BP
- RET ; C removes parameters on stack itself
- _rsecm ENDP
- END
-