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

  1.         ;************************************************************;
  2.         ;                                                            ;
  3.         ;       Function 11H: Find First File, FCB-based             ;
  4.         ;                                                            ;
  5.         ;       int FCB_first(puXFCB,attrib)                         ;
  6.         ;           char *puXFCB;                                    ;
  7.         ;           char  attrib;                                    ;
  8.         ;                                                            ;
  9.         ;       Returns 0 if match found, otherwise returns -1.      ;
  10.         ;                                                            ;
  11.         ;       Note: The FCB must have the drive and                ;
  12.         ;       filename fields (bytes 07H through 12H) and          ;
  13.         ;       the extension flag (byte 00H) set before             ;
  14.         ;       the call to FCB_first (see Function 29H).            ;
  15.         ;                                                            ;
  16.         ;************************************************************;
  17.  
  18. cProc   FCB_first,PUBLIC,ds
  19. parmDP  puXFCB
  20. parmB   attrib
  21. cBegin
  22.         loadDP  ds,dx,puXFCB    ; Pointer to unopened extended FCB.
  23.         mov     bx,dx           ; BX points at FCB, too.
  24.         mov     al,attrib       ; Get search attribute.
  25.         mov     [bx+6],al       ; Put attribute into extended FCB
  26.                                 ; area.
  27.         mov     byte ptr [bx],0ffh ; Set flag for extended FCB.
  28.         mov     ah,11h          ; Ask MS-DOS to find 1st matching
  29.                                 ; file in current directory.
  30.         int     21h             ; If match found, directory entry can
  31.                                 ; be found at DTA address.
  32.         cbw                     ; Set return value to 0 or -1.
  33. cEnd
  34.