home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 5 / ctrom5b.zip / ctrom5b / PROGRAM / DIVERSEN / DOS32V3B / EXAMPLES / EG4.ASM < prev    next >
Assembly Source File  |  1995-02-05  |  2KB  |  87 lines

  1. ;**************************************************************************
  2. ;  EG4.ASM
  3. ;
  4. ;  This example program will display the current directory
  5. ;
  6. ; By Adam Seychell
  7. ;**************************************************************************
  8. .386
  9. .model  flat
  10. .stack 200h
  11. .code
  12.  
  13. ASCIIZ_path     db  '*.*',0         ; String for search path
  14. PSP_Address     DD  0
  15.  
  16.  
  17. Start32:                        ; first intruction executed here
  18.  
  19.   ;
  20.   ;  Call the DOS's "Find first" service
  21.   ;
  22.         mov     edx,offset ASCIIZ_path
  23.         mov     cx,00000b
  24.         mov     ah,4Eh
  25.         int     21h
  26.         jc exit
  27.               ; The file info is put in the DTA buffer which is initally set
  28.               ; to offset 80h in the PSP segment
  29.  
  30.  
  31.         mov     ax,0EE02h            ; Get DOS32 address information
  32.         int     31h
  33.         mov     PSP_Address,esi      ; Save the PSP pointer.
  34.  
  35. ;--------------------------- file display loop ---------------------------
  36. Find_next_loop:
  37.         mov     edi,PSP_Address
  38.         add     edi,80h+1Eh
  39.  
  40.  
  41.          ; Print ASCIIZ string that was stored in the DTA buffer.
  42.      ;
  43.       str_loop:
  44.                 mov     al,[edi]              ; get char from DTA
  45.                 cmp     al,0                  ; if zero the string has ended
  46.             jz string_end
  47.                 call Print_Char               ; plot it
  48.                 inc edi                       ; get next char
  49.                 jmp str_loop                  ; loop around
  50.  
  51. string_end:
  52.  ;
  53.  ; Finished printing the ASCIIZ file name.   Now to carrage return
  54.  ;
  55.        mov al,10
  56.        call Print_Char
  57.        mov al,13
  58.        call Print_Char
  59.  
  60. ;
  61. ;    Loop around and keep on calling DOS's "Find Next" service until there
  62. ; are no more files left.
  63. ;
  64.        mov  ah,4Fh
  65.        int  21h
  66.        jnc Find_next_loop
  67.  
  68. exit:
  69.         mov     ah,4ch
  70.         int     21h
  71.  
  72.  
  73.  
  74.  
  75.  ;
  76.  ; A procedure to send character to the screen.
  77.  ;
  78. Print_Char PROC
  79.         mov     bh,0
  80.         mov     ah,0Eh
  81.         int     10h
  82.         ret
  83. Print_Char ENDP
  84.  
  85.  
  86. END Start32
  87.