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

  1. ;***************************************************************************
  2. ; EG3.ASM
  3. ;               This program will display all the environment varaibles
  4. ;
  5. ;***************************************************************************
  6.  
  7. .386
  8. .model flat
  9. .stack 200h
  10. .code
  11.  
  12.  
  13. TheStart:                               ; Program starts execution here
  14.  
  15.  
  16.         mov     ax,0EE02h               ; Get DOS32 address info
  17.         int     31h                     ; EDI -> Environment segment
  18.  
  19.         mov     bh,0
  20.  
  21.  
  22. ;
  23. ;  Display the environment.
  24. ;
  25.  
  26. Plot_char_loop:
  27.         mov     al,[edi]              ; read char from environment
  28.         inc     edi
  29.         cmp     al, 0
  30.         jz string_ended               ; If char zero the string has ended.
  31.  
  32.           mov    ah,0eh                 ; Set AH to video service func
  33.           int    10h                    ; Plot the character.
  34.           jmp Plot_char_loop            ; and continue loop.
  35.  
  36.       string_ended:
  37.  
  38.                 cmp     byte ptr gs:[edi+1],0  ; If the next char is zero then
  39.                 jz     Envir_Ended             ; evnironmet has ended.
  40.                 mov     al,10                  ; Else only string has ended
  41.                 int     10h                    ; and do a carrage return.
  42.                 mov     al,13
  43.                 int     10h
  44.                 jmp Plot_char_loop
  45.  
  46. Envir_Ended:
  47.  
  48.  
  49.     mov  ax,4c00h                         ; stop the program
  50.     int  21h
  51.  
  52.  
  53. END TheStart
  54.