home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0020 - 0029 / ibm0020-0029 / ibm0028.tar / ibm0028 / GRLF-C-2.ZIP / GFUNC / DOSABS.ASM < prev    next >
Encoding:
Assembly Source File  |  1990-05-30  |  2.9 KB  |  122 lines

  1.         page    58,132
  2.  
  3. ; dosabs.asm
  4. ; contains: dosabsread(), dosabswrite()
  5. ;
  6. ;
  7.  
  8.         include    model.h
  9.         include    prologue.h
  10.         name    dosabs
  11.         pseg    dosabs
  12.  
  13. ;==>--    int dosabsread(drive,sectors,startlsector,buffer)
  14. ;
  15. ;;    ARGUMENTS:
  16. ;      (int)        drive        - Drive Number, 0=A: 1=B: etc
  17. ;      (unsigned)    sectors        - Number of sectors to read
  18. ;      (unsigned)    startlector    - Beginning logical sector number
  19. ;      (char *)    buffer        - Pointer to buffer
  20. ;
  21. ;;    DESCRIPTION:
  22. ;      This function calls interrupt 0x25
  23. ;
  24. ;;    RETURNS:
  25. ;
  26. ;        0x00    Successful
  27. ;        0x80    Attachment failed to respond
  28. ;        0x40    Seek operation failed
  29. ;        0x20    Controller failed
  30. ;        0x10    Data Error (bad CRC)
  31. ;        0x08    Direct memory access (DMA) failure
  32. ;        0x04    Requested sector not found.
  33. ;        0x03    Write protect fault.
  34. ;        0x02    Bad address mark
  35. ;        0x01    Bad Command
  36. ;
  37. ;;    AUTHOR:
  38. ;     ""   25-MAR-1987  10:47:25.06
  39. ;      Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
  40. ;    MODIFICATIONS:
  41. ;     "" Tue 08-Nov-1988 12:36:17
  42. ;      Modified RETURNS: section of comment to be correct, also added
  43. ;      code to pop ds before leaving function in the large data models.
  44. ;      (SAR #86 & #95)
  45. ;;;
  46.     cproc    dosabsread,,dosabsre
  47.     mov    al,parm1_        ;al=drive
  48.     mov    cx,parm2_        ;cx=number of sectors to read
  49.     mov    dx,parm3_        ;dx=beginning logical sector #
  50.     if    _LDATA
  51.      push    ds
  52.      lds    bx,parm4_
  53.     else
  54.      mov    bx,parm4_
  55.     endif
  56.     int    25h            ;do abs disk read
  57.     pop    cx
  58.     mov    ah,0            ;clear ah
  59.     jc    drex            ;if error return code in AX
  60.     xor    al,al            ;else clear al (return 0 in ax)
  61. drex:
  62.     if    _LDATA
  63.      pop    ds
  64.     endif
  65.     cproce
  66.  
  67. ;==>--    int dosabswrite(drive,sectors,startlsector,buffer)
  68. ;
  69. ;;    ARGUMENTS:
  70. ;      (int)        drive        - Drive Number, 0=A: 1=B: etc
  71. ;      (unsigned)    sectors        - Number of sectors to write
  72. ;      (unsigned)    startlector    - Beginning logical sector number
  73. ;      (char *)    buffer        - Pointer to buffer
  74. ;
  75. ;;    DESCRIPTION:
  76. ;      This function calls interrupt 0x26
  77. ;
  78. ;;    RETURNS:
  79. ;
  80. ;        0x00    Successful
  81. ;        0x80    Attachment failed to respond
  82. ;        0x40    Seek operation failed
  83. ;        0x20    Controller failed
  84. ;        0x10    Data Error (bad CRC)
  85. ;        0x08    Direct memory access (DMA) failure
  86. ;        0x04    Requested sector not found.
  87. ;        0x03    Write protect fault.
  88. ;        0x02    Bad address mark
  89. ;        0x01    Bad Command
  90. ;
  91. ;;    AUTHOR:
  92. ;     ""   25-MAR-1987  11:01:09.20
  93. ;      Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
  94. ;    MODIFICATIONS:
  95. ;     "" Tue 08-Nov-1988 12:36:17
  96. ;      Modified RETURNS: section of comment to be correct, also added
  97. ;      code to pop ds before leaving function in large data model.
  98. ;      (SAR #86 & #95)
  99. ;;;
  100.     cproc    dosabswrite,,dosabswr
  101.     mov    al,parm1_        ;al=drive
  102.     mov    cx,parm2_        ;cx=number of sectors to read
  103.     mov    dx,parm3_        ;dx=beginning logical sector #
  104.     if    _LDATA
  105.      push    ds
  106.      lds    bx,parm4_
  107.     else
  108.      mov    bx,parm4_
  109.     endif
  110.     int    26h            ;do abs disk write
  111.     pop    cx
  112.     mov    ah,0            ;clear ah
  113.     jc    dwex            ;if error return code in AX
  114.     xor    al,al            ;else clear al (return 0 in ax)
  115. dwex:
  116.     if    _LDATA
  117.      pop    ds
  118.     endif
  119.     cproce
  120.     endps
  121.     end
  122.