home *** CD-ROM | disk | FTP | other *** search
- name trycpm
- page 55,132
- title 'trycpm'
-
- ;
- ; Example of File Searching Using
- ; the "CP/M-like" Functions 11H and 12H
- ;
-
- cseg segment para public 'CODE'
-
- assume cs:cseg,ds:cseg,es:cseg,ss:cseg
-
- org 100h
-
- start proc far
-
- mov dx,offset mybuff ;set DTA to working
- mov ah,1ah ;buffer for DOS
- int 21h
- mov dx,offset myfcb ;Search for First
- mov ah,11h
- int 21h
- or al,al ;any matches at all?
- jnz exit ;no, quit
-
- display:
- mov dx,offset crlf ;send carriage return/
- mov cx,2 ;line feed sequence
- mov bx,1 ;to standard output
- mov ah,40h
- int 21h
- mov dx,offset mybuff+1 ;display name of
- mov cx,11 ;matching file
- mov bx,1 ;on standard output
- mov ah,40h
- int 21h
-
- nextfile:
- mov dx,offset myfcb ;Search for Next
- mov ah,12h
- int 21h
- or al,al ;any more matches?
- jz display ;yes, display filename
-
- exit: mov ah,0 ;return to DOS
- int 21h
-
- crlf db 0dh,0ah ;carriage return/
- ;line feed string
-
- myfcb db 0 ;drive = "current"
- db 8 dup ('?') ;filename = wildcard
- db 'ASM' ;extension = "ASM"
- db 25 dup (0) ;remainder of FCB = zero
-
- mybuff db 64 dup (0) ;working buffer for DOS
-
- start endp
-
- cseg ends
-
- end start