home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS 1992 June / SIMTEL_0692.cdr / msdos / dirutl / dskparm.arc / ABSREAD.ASM next >
Assembly Source File  |  1986-09-24  |  1KB  |  64 lines

  1.     page    ,132
  2.  
  3. ; --    absread -- absolute track and sector read
  4. ;    Version 1.1  December 30, 1985
  5. ;    Glenn F. Roberts
  6. ;    calling convention:
  7. ;        absread(drive, nsect, sector, &buffer);
  8. ;    where:
  9. ;        drive = drive no. (A=0, B=1 ...)
  10. ;        nsect = number of sectors to read
  11. ;        sector = beginning logical sector number
  12. ;        buffer = array to hold data
  13. ;    returns:
  14. ;        0    Normal return, no error
  15. ;        1    Write protect violation
  16. ;        2    Unknown unit
  17. ;        3    Drive not ready
  18. ;        4    Unknown command
  19. ;        5    CRC error
  20. ;        6    Bad drive request structure length
  21. ;        7    Seek error
  22. ;        8    Unknown media
  23. ;        9    Sector not found
  24. ;        10    Printer out of paper
  25. ;        11    Write fault
  26. ;        12    Read fault
  27. ;        13    General disk failure
  28.  
  29. _text    SEGMENT BYTE PUBLIC 'CODE'
  30.     ASSUME    CS:_text
  31.  
  32.     PUBLIC    _absread
  33.  
  34. _absread PROC    NEAR
  35.     PUSH    BP        ; setup stack addressing
  36.     MOV    BP,SP
  37.     PUSH    DI
  38.     PUSH    SI
  39.  
  40.     MOV    AX,[BP+4]    ; AX = drive number
  41.     MOV    CX,[BP+6]    ; CX = number of sectors
  42.     MOV    DX,[BP+8]    ; DX = starting record
  43.     MOV     BX,[BP+10]    ; DS:BX = buffer address
  44.  
  45.     INT    025H        ; request absolute read
  46.     INC    SP
  47.     INC    SP        ; fix the stack
  48.  
  49.     JC    ERROR        ; if error then return code
  50.     XOR    AX,AX        ; else show normal return = 0
  51.     JMP    SHORT DONE    ; and then exit
  52.  
  53. ERROR:    MOV    AH,0        ; error - zero high byte
  54.     INC    AL        ; and increment error no.
  55.  
  56. DONE:    POP    SI        ; restore registers
  57.     POP    DI
  58.     POP    BP
  59.     RET            ; and return
  60. _absread ENDP
  61.  
  62. _text    ENDS
  63.     END
  64.