Metropoli BBS
VIEWER: eg3.asm MODE: TEXT (ASCII)
;***************************************************************************
; EG3.ASM
;               This program will display all the environment varaibles
;
;
; DOS32 assembly language example program
;***************************************************************************

.386
.model flat
.stack 200h
.code


TheStart:                               ; Program starts execution here


        mov     ax,0EE02h               ; Get DOS32 address info
        int     31h                     ; EDI -> Environment segment



;
;  Display the environment.
;

Plot_char_loop:
        mov     dl,[edi]                ; read char from environment
        inc     edi
        cmp     dl, 0
        je string_ended                 ; If char zero the string has ended.

          mov    ah,02h                 ; Set AH to video service func
          int    21h                    ; Plot the character.
          jmp Plot_char_loop            ; and continue loop.

      string_ended:

                cmp     byte ptr [edi+1],0     ; If the next char is zero then
                jz     Exit_program            ; evnironmet has ended.
                mov     dl,10                  ; Else only string has ended
                mov     ah,2
                int     21h                    ; and print carrage return.
                mov     dl,13
                mov     ah,2
                int     21h
                jmp Plot_char_loop

Exit_program:


    mov  ax,4c00h                         ; stop the program
    int  21h


END TheStart
[ RETURN TO DIRECTORY ]