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

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