home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / caway349.zip / BIN / SHOWEVAR.ASM < prev    next >
Assembly Source File  |  1996-06-17  |  975b  |  43 lines

  1. .model small
  2. STDOUT  EQU 1
  3. .stack 100h
  4. .data
  5. crlf    DB    13,10
  6.     DW    4000 DUP (0)    ; bulk up size by 8K to make large enough for modifications
  7. .code
  8. start:
  9.     mov    ds,es:[2ch]    ; ds -> e-var block (es -> PSP on entry)
  10.     xor    si,si        ; init offset in block
  11.     mov    bx,STDOUT
  12.  
  13. loop2:
  14.     mov    al,ds:[si]    ; get first char of string
  15.     or    al,al        ; see if null (no more strings)
  16.     je    done
  17.  
  18. loop1:
  19.     mov    dx,si        ; ds:dx -> string to print
  20.     mov    cx,1
  21.     mov    ah,40h        ; write to device
  22.     int    21h
  23.     inc    si            ; move to next char in string
  24.     mov    al,ds:[si]    ; print remaining chars in string one at a time
  25.     or    al,al        ; see if null (end of string)
  26.     jne    loop1        ; nope
  27.  
  28.     push    ds        ; save ds -> e-var block
  29.     mov    ax,DGROUP
  30.     mov    ds,ax
  31.     mov    dx,OFFSET DGROUP:crlf    ; write CR/LF pair after string end
  32.     mov    cl,2
  33.     mov    ah,40h        ; write to device
  34.     int    21h
  35.     pop    ds            ; restore ds -> e-var block
  36.     inc    si
  37.     jmp    SHORT loop2
  38.  
  39. done:
  40.     mov    ax,4c00h    ; terminate with zero return code
  41.     int    21h
  42. end start
  43.