home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PROGRAMS / UTILS / DOS_HELP / ADVMSDOS.ZIP / SCH-CPM.ASM < prev    next >
Encoding:
Assembly Source File  |  1986-06-19  |  1.6 KB  |  64 lines

  1.     name     trycpm
  2.     page     55,132
  3.     title     'trycpm'
  4.  
  5. ;
  6. ;  Example of File Searching Using 
  7. ;  the "CP/M-like" Functions 11H and 12H
  8. ;
  9.  
  10. cseg    segment    para public 'CODE'
  11.     
  12.     assume     cs:cseg,ds:cseg,es:cseg,ss:cseg
  13.     
  14.     org    100h
  15.  
  16. start    proc    far
  17.  
  18.     mov      dx,offset mybuff    ;set DTA to working
  19.     mov      ah,1ah                  ;buffer for DOS
  20.         int      21h
  21.         mov      dx,offset myfcb            ;Search for First
  22.         mov      ah,11h
  23.         int      21h
  24.         or       al,al                     ;any matches at all?
  25.         jnz      exit                    ;no, quit
  26.  
  27. display:  
  28.     mov      dx,offset crlf        ;send carriage return/
  29.         mov      cx,2            ;line feed sequence
  30.         mov      bx,1            ;to standard output     
  31.         mov      ah,40h
  32.     int      21h        
  33.     mov      dx,offset mybuff+1       ;display name of
  34.         mov      cx,11                   ;matching file
  35.         mov      bx,1                    ;on standard output
  36.         mov      ah,40h
  37.         int      21h
  38.  
  39. nextfile: 
  40.     mov    dx,offset myfcb          ;Search for Next
  41.     mov      ah,12h
  42.         int      21h
  43.         or       al,al                     ;any more matches?
  44.         jz       display                 ;yes, display filename
  45.  
  46. exit:      mov      ah,0                     ;return to DOS
  47.         int      21h
  48.  
  49. crlf    db       0dh,0ah            ;carriage return/
  50.                     ;line feed string    
  51.  
  52. myfcb     db       0                         ;drive = "current" 
  53.         db       8 dup ('?')             ;filename = wildcard 
  54.         db       'ASM'                   ;extension = "ASM"
  55.         db       25 dup (0)              ;remainder of FCB = zero
  56.  
  57. mybuff     db       64 dup (0)                ;working buffer for DOS
  58.  
  59. start    endp
  60.  
  61. cseg    ends
  62.  
  63.     end start
  64.