home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS 1992 June / SIMTEL_0692.cdr / msdos / batutl / bigecho.arc / BIGECHO.ASM < prev    next >
Encoding:
Assembly Source File  |  1987-10-15  |  3.0 KB  |  109 lines

  1. CR    EQU    0DH
  2. LF    EQU    0AH
  3.  
  4. ;Additional comments (hastily), reformatting, and small patching by 
  5. ;David Kirschbaum
  6. ;Toad Hall
  7. ;kirsch@braggvax.ARPA
  8.  
  9. Cseg segment
  10.     assume CS:Cseg , DS:Cseg
  11.     org 100H
  12.  
  13. Enter:    jmp Begin
  14. ;---------------------------
  15.     db CR,'BIGECHO, Vers. 1.0 copyright by R.M.Wilson and B. Simon, 1986'
  16.     db CR,LF
  17.     db 'Usage: BIGECHO message /FB',CR,LF
  18.     db "Here 'message' is a string of at most 10 characters,"
  19.     db ' F and B are characters',CR,LF
  20.     db 'for the foreground and background'
  21.     db ' (defaults to blank and solid, i.e. / [ ).',26
  22.  
  23. foreback db    0DBH,20H    ;foreground/background chars (default)
  24. hold    db    80 dup(0)    ;Will hold the 8 bytes describing each
  25.                 ; of 10 characters.
  26. ;---------------------------
  27. Begin:
  28.     mov    si,80H        ;First, get characters for use
  29.                 ; as fore and background.
  30.     lodsb            ;snarf cmd line length
  31.     or    al,al        ;anything there?
  32.     jne    Lod1        ; yep, go for it
  33.     ret            ; nope, just return to DOS
  34.  
  35. Lod1:
  36.     lodsb            ;snarf each cmd line char
  37.     cmp    al,CR        ;msg end yet?
  38.     je    Over1        ; yep
  39.     cmp    al,'/'        ;look for switch char (fg/bg values)
  40.     jne    Lod1        ; no switch, keep looping
  41. ;TH    lodsb            ;snarf foreground value
  42. ;TH    mov    foreback,al    ;stow it
  43. ;TH    lodsb            ;snarf background value
  44.     lodsw            ;TH snarf foreground, possible background
  45.     mov    foreback,al    ;stow foreground
  46.     cmp    al,CR        ;just foreground?
  47.     je    Over1        ; yep
  48.     mov    foreback[1],al    ;save background also
  49. Over1:    mov    si,0FA6EH    ;Point DS:si to table in ROM with dot
  50.     mov    ax,0F000H    ;patterns for ASCII characters 0
  51.                 ; through 127.
  52.     mov    DS,ax
  53.     mov    di,offset hold    ;target=80H buffer
  54.     mov    bx,82H
  55.  
  56. Form:    mov    al,CS:[bx]    ;Load byte of cmd line message.
  57.     cmp    al,CR        ;end of msg?
  58.     je    Go_on        ; yep, skip
  59.     cmp    al,'/'        ;switch char for foreground/background?
  60.     je    Go_on        ; yep, skip to there
  61.     xor    ah,ah        ;assume no parms, clear msb
  62.     shl    ax,1        ;*2
  63.     shl    ax,1        ;*4
  64.     shl    ax,1        ;*8 for char matrix
  65.     push    si        ;save ROM table offset
  66.     add    si,ax        ;bump to the char desired
  67.     mov    cx,8        ;8 chars in the screen matrix
  68.     rep    movsb        ;Get 8 bytes from ROM.
  69.     pop    si        ;from ROM
  70.     inc    bx        ;bump counter
  71.     cmp    bx,8CH        ;maxed out cmd line? (max 10 chars)
  72.     jl    Form        ; nope, loop for next cmd line char
  73.  
  74. ;finished cmd line or hit switch char
  75. Go_on:    push    CS
  76.     pop    DS        ;DS=CS
  77.  
  78. Output:
  79.     mov    ah,2        ;We'll be using Service 2 of DOS.
  80.     xor    bp,bp        ;vertical counter
  81. Loop1:    mov    si, offset hold    ;char buffer
  82.     add    si,bp        ;vertical offset
  83.     mov    cx,10        ;10 chars
  84. Loop2:
  85.     lodsb            ;snarf the next msg char
  86.     mov    bl,80H        ;offset into msg buffer
  87. Loop3:
  88.     push    ax        ;save the char a sec
  89.     mov    dl,foreback[1]    ;assume background
  90.     and    al,bl        ;? blank background ?
  91.     jz    Over4        ; yep
  92.     mov    dl,foreback[0]    ;make it forground
  93. Over4:    int    21H        ;print the char
  94.     ror    bl,1
  95.     pop    ax
  96.     cmp    bl,80H
  97.     jne    Loop3
  98.     add    si,7        ;space between chars
  99.     loop    Loop2        ;for 10 cmd line chars
  100.  
  101. ;vertical chars
  102.     inc    bp        ;vertical rows
  103.     cmp    bp,8        ;big chars 8 rows high?
  104.     jl    Loop1        ; not yet
  105.     ret            ;to DOS or calling program
  106. ;-----------------------------------------------
  107. Cseg    ends
  108.     end    Enter
  109.