home *** CD-ROM | disk | FTP | other *** search
/ Turbo Toolbox / Turbo_Toolbox.iso / tasm / ofopenr.asm < prev    next >
Assembly Source File  |  1988-08-28  |  1KB  |  52 lines

  1.  
  2. ;    FILENAME: OFOPENR.ASM
  3. ;    Copyright (c) 1988 by Borland International, Inc.
  4. ;
  5. ;    Description: This module implements the routine FileOpenR. FileOpenR
  6. ;    opens a file for reading.
  7. ;
  8. ;    ASSEMBLY INSTRUCTIONS: To assemble this module use the following 
  9. ;    TASM command line. 
  10. ;        TASM ofopenr
  11.  
  12. include globals.inc
  13.  
  14. _TEXT   segment
  15.  
  16.     FileOpenR proc
  17.  
  18.     ;    Input 
  19.     ;        bx - file record offset
  20.     ;        cx - buffer size
  21.     ;        dx - offset of filespec
  22.     ;    Output (of INT 21h, Function 3Dh)
  23.     ;        cf - set if error occurred
  24.     ;        ax - error code
  25.     ;            1 - if function number invalid (file-sharing must be loaded)
  26.     ;            2 - if file not found
  27.     ;            3 - if path not found of file doesn't exist
  28.     ;            4 - if no handle available
  29.     ;            5 - if access denied
  30.     ;          0Ch - if file access code invalid
  31.     ;    Registers modified
  32.     ;        ax
  33.  
  34.     mov     WORD PTR [bx+0], 0  ;set status
  35.     mov     [bx+2], cx          ;save size
  36.     call    FileAlloc           ;allocate buffer
  37.     jc      filopn1             ;jump if error
  38.     mov     ax, 3d00h           ;function and access
  39.     int     21h                 ;execute
  40.     mov     [bx+8], ax          ;save handle
  41.     jnc     filopn1
  42.     call    FileFree            ;deallocate
  43.     stc
  44. filopn1:
  45.     ret
  46.     FileOpenR endp
  47.  
  48. _TEXT    ends
  49.  
  50. end
  51.