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 / DOSXABS.ASM < prev    next >
Encoding:
Assembly Source File  |  1990-05-30  |  4.4 KB  |  173 lines

  1.         page    58,132
  2.  
  3. ;/*
  4. ;** dosxabs.asm
  5. ;** contains: dosrdabs(), doswrabs()
  6. ;*/
  7.         ifndef    _LCODE
  8.          include model.h
  9.         endif
  10.         include prologue.h
  11.         name    pntspool
  12.  
  13.  
  14. DOSABSREAD    equ    025h            ;DOS Absolute read software Int
  15. DOSABSWRITE    equ    026h            ;DOS Absolute write software Int
  16.  
  17.  
  18.  
  19. DOSXABSPACKET     struc
  20.     FirstSector    dd    ?        ;32 bit first sector number
  21.     Count        dw    ?        ;Number of sectors to I/O
  22.     Buffer        dd    ?        ;32 bit pointer to buffer
  23. DOSXABSPACKET     ends
  24.  
  25.  
  26.         dseg    ddosxabs
  27. packet        DOSXABSPACKET <0,0,0>
  28.         endds
  29.  
  30.  
  31.         pseg    cdosxabs
  32.  
  33. ;/*
  34. ;**  int
  35. ;** dosrdabs(int drive,int count,long firstsector,void *buffer)
  36. ;**
  37. ;** ARGUMENT(s)
  38. ;**  drive        -    Drive # (0==A:, 1==B: etc.)
  39. ;**  count        -    number of sectors to read
  40. ;**  firstsector    -    starting sector of read (0 based)
  41. ;**  buffer        -    pointer to buffer to receive data read from
  42. ;**                disk.
  43. ;**
  44. ;** DESCRIPTION
  45. ;**  Performs extended dos absolute read.  This function requires DOS 4.0 or
  46. ;**  higher.  This function is not supported by versions prior to version 4.
  47. ;**
  48. ;**  WARNING:  Before calling this function to removable media, the media in
  49. ;**  the drive must be established correctly.  This can be done by calling
  50. ;**  the Greenleaf function dosgetdir() for the drive.
  51. ;**
  52. ;**
  53. ;** RETURNS
  54. ;**  0 if successful else one of the following error codes:
  55. ;**
  56. ;**    0x80    -    Attachment failed to respond
  57. ;**    0x40    -    SEEK operation failed
  58. ;**    0x08    -    Bad CRC on diskette read
  59. ;**    0x04    -    Requested sector not found
  60. ;**    0x02    -    Error other than types listed above
  61. ;**
  62. ;** AUTHOR
  63. ;**  ""   Thu 01-Dec-1988    15:37:09
  64. ;**   Copyright (C)1988-1990 Greenleaf Software Inc. All Rights Reserved.
  65. ;**
  66. ;** MODIFICATIONS
  67. ;**
  68. ;*/
  69.         cproc    dosrdabs
  70.         if    _LDATA
  71.          push    es
  72.          les    bx,parm5_        ;ES:BX point to buffer
  73.          mov    word ptr packet.Buffer,bx
  74.          mov    word ptr packet.Buffer+2,es
  75.          pop    es
  76.         else
  77.          mov    bx,parm5_        ;BX points to buffer
  78.          mov    word ptr packet.Buffer,bx
  79.          mov    word ptr packet.Buffer+2,ds
  80.         endif
  81.         mov    ax,parm2_        ;AX = count of sectors to read
  82.         mov    packet.Count,ax     ;and save in packet
  83.         mov    ax,parm3_        ;AX = low order part of long
  84.         mov    word ptr packet.FirstSector,ax
  85.         mov    ax,parm4_        ;AX = high order part of long
  86.         mov    word ptr packet.FirstSector+2,ax
  87.         mov    al,parm1_        ;AL = drive #
  88.         mov    cx,-1            ;Indicate extended
  89.         lea    bx,packet
  90.         int    DOSABSREAD        ;make request
  91.         pop    cx            ;clean stack
  92.         mov    bx,0
  93.         xchg    bx,ax
  94.         jnc    dosxrex
  95.         mov    al,bh            ;put error in AL
  96. dosxrex:
  97.         cproce
  98.  
  99.  
  100. ;/*
  101. ;**  int
  102. ;** doswrabs(int drive,int count,long firstsector,void *buffer)
  103. ;**
  104. ;** ARGUMENT(s)
  105. ;**  drive        -    Drive # (0==A:, 1==B: etc.)
  106. ;**  count        -    number of sectors to write
  107. ;**  firstsector    -    starting sector of write (0 based)
  108. ;**  buffer        -    pointer to buffer containing data to be
  109. ;**                written to disk.
  110. ;**
  111. ;** DESCRIPTION
  112. ;**  Performs extended dos absolute write.  This function requires DOS 4.0 or
  113. ;**  higher.  This function is not supported by versions prior to version 4.
  114. ;**
  115. ;**
  116. ;**  WARNING:  Before calling this function to removable media, the media in
  117. ;**  the drive must be established correctly.  This can be done by calling
  118. ;**  the Greenleaf function dosgetdir() for the drive.
  119. ;**
  120. ;**
  121. ;** RETURNS
  122. ;**  0 if successful else one of the following error codes:
  123. ;**
  124. ;**    0x80    -    Attachment failed to respond
  125. ;**    0x40    -    SEEK operation failed
  126. ;**    0x08    -    Bad CRC on diskette read
  127. ;**    0x04    -    Requested sector not found
  128. ;**    0x03    -    Write attempt on write-protected media
  129. ;**    0x02    -    Error other than types listed above
  130. ;**
  131. ;** AUTHOR
  132. ;**  "" Thu 01-Dec-1988 16:06:25
  133. ;**   Copyright (C)1988-1990 Greenleaf Software Inc. All Rights Reserved.
  134. ;**
  135. ;** MODIFICATIONS
  136. ;**
  137. ;*/
  138.         cproc    doswrabs
  139.         if    _LDATA
  140.          push    es
  141.          les    bx,parm5_        ;ES:BX point to buffer
  142.          mov    word ptr packet.Buffer,bx
  143.          mov    word ptr packet.Buffer+2,es
  144.          pop    es
  145.         else
  146.          mov    bx,parm5_        ;BX points to buffer
  147.          mov    word ptr packet.Buffer,bx
  148.          mov    word ptr packet.Buffer+2,ds
  149.         endif
  150.         mov    ax,parm2_        ;AX = count of sectors to write
  151.         mov    packet.Count,ax     ;and save in packet
  152.         mov    ax,parm3_        ;AX = low order part of long
  153.         mov    word ptr packet.FirstSector,ax
  154.         mov    ax,parm4_        ;AX = high order part of long
  155.         mov    word ptr packet.FirstSector+2,ax
  156.         mov    al,parm1_        ;AL = drive #
  157.         mov    cx,-1            ;Indicate extended
  158.         lea    bx,packet
  159.         int    DOSABSWRITE        ;make request
  160.         pop    cx            ;clean stack
  161.         mov    bx,0
  162.         xchg    bx,ax
  163.         jnc    dosxwex
  164.         mov    al,bh            ;put error in AL
  165. dosxwex:
  166.         cproce
  167.  
  168.  
  169.  
  170.  
  171.         endps
  172.         end
  173.