home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / dos_ency / section5 / fxn0fh.asm < prev    next >
Encoding:
Assembly Source File  |  1988-08-11  |  1.9 KB  |  36 lines

  1.         ;************************************************************;
  2.         ;                                                            ;
  3.         ;        Function 0FH: Open File, FCB-based                  ;
  4.         ;                                                            ;
  5.         ;        int FCB_open(uXFCB,recsize)                         ;
  6.         ;            char *uXFCB;                                    ;
  7.         ;            int recsize;                                    ;
  8.         ;                                                            ;
  9.         ;        Returns 0 if file opened OK, otherwise returns -1.  ;
  10.         ;                                                            ;
  11.         ;        Note: uXFCB must have the drive and filename        ;
  12.         ;        fields (bytes 07H through 12H) and the extension    ;
  13.         ;        flag (byte 00H) set before the call to FCB_open     ;
  14.         ;        (see Function 29H).                                 ;
  15.         ;                                                            ;
  16.         ;************************************************************;
  17.  
  18. cProc   FCB_open,PUBLIC,ds
  19. parmDP  puXFCB
  20. parmW   recsize
  21. cBegin
  22.         loadDP  ds,dx,puXFCB    ; Pointer to unopened extended FCB.
  23.         mov     ah,0fh          ; Ask MS-DOS to open an existing file.
  24.         int     21h
  25.         add     dx,7            ; Advance pointer to start of regular
  26.                                 ; FCB.
  27.         mov     bx,dx           ; BX = FCB pointer.
  28.         mov     dx,recsize      ; Get record size parameter.
  29.         mov     [bx+0eh],dx     ; Store record size in FCB.
  30.         xor     dx,dx
  31.         mov     [bx+20h],dl     ; Set current-record
  32.         mov     [bx+21h],dx     ; and relative-record
  33.         mov     [bx+23h],dx     ; fields to 0.
  34.         cbw                     ; Set return value to 0 or -1.
  35. cEnd
  36.