Given that a previous call to Int 21H Function 11H has been successful, returns the next matching filename (if any).
Call with:
AH = 12H
DS:DX = segment:offset of file control block
Returns:
If function successful (matching filename found)
AL = 00H
and buffer at current disk transfer area (DTA) address set up as an unopened normal FCB or extended FCB, depending on which type of FCB was originally input to Int 21H Function 11H
If function unsuccessful (no more matching filenames found)
AL = FFH
Notes:
This function assumes that the FCB used as input has been properly initialized by a previous call to Int 21H Function 11H (and possible subsequent calls to Int 21H Function 12H) and that the filename or extension being searched for contained at least one wildcard character.
As with Int 21H Function 11H, it is important to use Int 21H Function 1AH to set the DTA to a buffer of adequate size before calling this function.
[2.0+] Int 21H Functions 4EH and 4FH, which allow full access to the hierarchical directory structure, should be used in preference to this function.
Example:
Assuming a previous successful call to function 11H, search for the next file with the extension .COM in the current directory. If the DTA has not been changed since the previous search, another call to Function 1AH is not necessary.
buff db 37 dup (0) ; receives search result
my_fcb db 0 ; drive = default
db '????????' ; wildcard filename
db 'COM' ; extension = COM
db 25 dup (0) ; remainder of FCB
.
.
.
; set DTA address
mov ah,1ah ; function number
mov dx,seg buff ; buffer address
mov ds,dx
mov dx,offset buff
int 21h ; transfer to MS-DOS
; search for next match
mov ah,12h ; function number
mov dx,seg myfcb ; address of FCB
mov ds,dx
mov dx,offset myfcb
int 21h ; transfer to MS-DOS
or al,al ; check status
jnz error ; jump if no match
.
.
.