home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 123.img / TASM.ZIP / OFILEFIL.ASM < prev    next >
Assembly Source File  |  1989-05-02  |  1KB  |  61 lines

  1.  
  2. ;    FILENAME: OFILEFIL.ASM
  3. ;    Copyright (c) 1988, 1989 by Borland International, Inc.
  4. ;
  5. ;    Description: This module implements the routine FileFill. FileFill
  6. ;    fills a read buffer. 
  7. ;
  8. ;    ASSEMBLY INSTRUCTIONS: To assemble this module use the following 
  9. ;    TASM command line. 
  10. ;        TASM ofilefil
  11.  
  12. include globals.inc
  13.  
  14.  
  15. _TEXT   segment
  16.  
  17.     FileFill proc
  18.  
  19.     ;    Input 
  20.     ;        bx - file record offset
  21.     ;        cx - buffer size
  22.     ;        dx - offset of filespec
  23.     ;    Output (of INT 21h, Function 3Fh)
  24.     ;        cf - set if error occurred
  25.     ;        ax - error code
  26.     ;            0 - if EOF and 0 bytes are read
  27.     ;            5 - if access denied
  28.     ;            6 - if handle invalid or not open
  29.     ;    Registers modified
  30.     ;        ax
  31.  
  32.     push    cx
  33.     push    dx
  34.     push    bx
  35.     push    ds
  36.     mov     ax, [bx+8]      ;file handle
  37.     mov     cx, [bx+2]      ;buffer size
  38.     sub     dx, dx          ;start of segment
  39.     mov     [bx+4], dx      ;set data offset
  40.     mov     ds, [bx+6]      ;buffer segment
  41.     mov     bx, ax
  42.     mov     ah, 3fh         ;function
  43.     int     21h             ;execute
  44.     pop     ds
  45.     pop     bx
  46.     mov     [bx+10], ax     ;save bytes read
  47.     jc      filfil1
  48.     or      ax, ax          ;check if no bytes
  49.     jnz     filfil1
  50.     stc
  51. filfil1:
  52.     pop     dx
  53.     pop     cx
  54.     ret
  55.     FileFill endp
  56.  
  57. _TEXT    ends
  58.  
  59. end
  60.