;*** whilem and wendm macros--to emulate a while loop

whilem  macro   op1, cond, op2, start, fin
        local   label1
start:  cmp     op1,op2
        j&cond  label1
        jmp     fin
label1:
        endm

wendm   macro  start, fin
        jmp    start
fin:
        endm

stk     segment stack
        dw      64 dup(?)
stk     ends

code    segment
        assume  cs:code
main    proc    far
        push    ds
        sub     ax,ax
        push    ax

        mov     al,0
        whilem  al, ne, 0dh, L1, L2  ;get/echo char's until <CR>
           mov     ah,1              ;get next character
           int     21h
           mov     ah,2              ;display it
           mov     dl,al
           int     21h
        wendm   L1, L2

        ret
main    endp
code    ends
        end     main