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

  1.  
  2.     name     tryunix
  3.     page     55,132
  4.     title     'tryunix'
  5.  
  6. ;
  7. ;  Example of File Searching Using 
  8. ;  the "Unix-like" Functions 4EH and 4FH
  9. ;
  10.  
  11. cseg    segment    para public 'CODE'
  12.     
  13.     assume     cs:cseg,ds:cseg,es:cseg,ss:cseg
  14.  
  15.     org    100h
  16.  
  17. start    proc    far
  18.  
  19.     mov      dx,offset mybuff          ;set DTA to working
  20.     mov      ah,1ah                  ;buffer for DOS
  21.         int      21h
  22.         mov      dx,offset fname           ;Search for First
  23.         mov      cx,0                    ;normal file attributes
  24.         mov      ah,4eh
  25.         int      21h
  26.         jc       exit                      ;no match found, quit
  27.  
  28. display:  
  29.     mov      dx,offset crlf        ;send carriage return/
  30.     mov      cx,2            ;line feed sequence
  31.     mov      bx,1
  32.         mov      ah,40h
  33.         int      21h
  34.     mov      cx,0            ;cx will be length 
  35.         mov      si,offset mybuff+30    ; of filename
  36.  
  37. display1: 
  38.     lodsb                ;count characters in 
  39.     or       al,al            ;filename until null    
  40.     je       display2        ;byte is encountered
  41.     inc      cx  
  42.         jmp      display1
  43.  
  44. display2: 
  45.     mov      dx,offset mybuff+30       ;offset of filename
  46.         mov      bx,1                    ;handle 1 = std output
  47.         mov      ah,40h                  ;function 40h = Write
  48.         int      21h
  49.  
  50. nextfile: 
  51.     mov      ah,4fh                    ;Search for Next
  52.         int      21h
  53.         jnc      display                   ;match found, display
  54.  
  55. exit:     mov      ah,0                      ;return to DOS
  56.         int      21h
  57.  
  58. crlf    db       0dh,0ah    
  59.  
  60. fname     db       '*.ASM',0                ;ASCIIZ file spec to
  61.                                         ;be matched
  62.  
  63. mybuff    db       64 dup (0)                ;working buffer for DOS
  64.  
  65. start     endp
  66.  
  67. cseg     ends
  68.  
  69.     end     start
  70.