home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
utils
/
miscutil.zip
/
TBWINDOW.ZIP
/
QPRINTC.ASM
< prev
next >
Wrap
Assembly Source File
|
1987-06-05
|
6KB
|
111 lines
title QPRINTC
page 60,132
Attr equ [bp + 06h] ; ATTR%
SnoChk equ [bp + 0Ah] ; SNOCHK%
StrDat equ [bp + 0Eh] ; STRDAT$
ColL equ [bp + 12h] ; COLL%
ColR equ [bp + 16h] ; COLR%
Row equ [bp + 1Ah] ; ROW%
program segment ; begin program segment
assume cs:program ; parameters on stack
push bp ; save registers for return
mov bp,sp ; establish addressibility of stack
push ds ; save cause we will manipulate
push es ; ditto
les di, StrDat ; load length address
mov cx, es:[di] ; load length into cx
and cx, 7FFFh ; and off high byte
jcxz GetOut ; quit if empty string
push cx
mov dx, ds:[0] ; get the beginning of the string segment from ds:[0]
push dx ; push data segment onto stack
pop ds ; make ds point to string segment
mov si, es:[di + 2] ; get offset into string segment from es:[di + 2]
push ds ; save address of string to write to screen
push si ;
Scr_Check: mov ah, 15 ; function to get current video state
int 10h ; video bios call
mov dx, 0B000h ; assume mono
push dx
pop es
mov dx, 03BAh ; address of 6845 chip for mono
cmp al, 7 ; is it mono?
jz Store_Screen ; it sure is!
mov dx, 0B800h ; no - it must be color
push dx
pop es
mov dx, 03DAh ; address of 6845 chip for CGA
Store_Screen: push es ; push es onto stack - screen segment
lds di, ColL ; get the address of the left column
mov bx, ds:[di] ; BX has the left column
lds di, ColR ; get the address of the right column
mov cx, ds:[di] ; CX has the left column
add bx,cx ; total them
lds di, StrDat ; point to string data
mov cx, ds:[di] ; get length again
and cx, 7FFFh ; and off high bit
shr bx, 1 ; divide by 2
shr cx, 1 ; " " "
sub bx,cx ; subtract length of string
dec bx ; convert into 0-79
shl bx, 1 ; multiply by 2 to accomodate attributes
lds si, Row ; get the address of the line
mov ax, ds:[si] ; get line (1-25)
dec ax ; convert to 0-24
CalcScrnOff: mov cl, 05 ; Times 160 bytes per line
shl ax, cl ; First x 32
mov cx, ax ; Temp Hold
shl ax, 1
shl ax, 1 ; x 128
add cx, ax ; X128 + X32 = X160
add bx, cx ; Add column
lds si, Attr ; get the address of the attribute
mov ax, ds:[si] ; load attribute into ax
pop es ; ditto
lds si, SnoChk ; Snow Check if not 0
mov cx, ds:[si] ; to CX
jcxz Snow
pop si ; ditto
pop ds ; ditto
pop cx ; get length back
mov di, bx ; move over to line/column
cld ; Clear direction flags
NoSnow1: movsb ; AX has attribute to spread
mov es:[di], al ; Put attribute
inc di
loop NoSnow1
GetOut: jmp endit
Snow: pop si ; get length back
pop ds ; ditto
pop cx ; ditto
mov di, bx ; move over to line/column
cld ; Clear direction flags
cli
Snow1: push ax
WaitLo1: in al, dx ; get status
shr al, 1 ; is it low?
jc WaitLo1 ; wait until it is
WaitHi1: in al, dx ; get status
shr al, 1 ; is it high?
jnc WaitHi1 ; wait until it is
movsb
WaitLo2: in al, dx ; get status
shr al, 1 ; is it low?
jc WaitLo2 ; wait until it is
WaitHi2: in al, dx ; get status
shr al, 1 ; is it high?
jnc WaitHi2 ; wait until it is
pop ax
mov es:[di], al ; move attribute byte
inc di
loop Snow1 ; go until all bytes moved
sti
Endit: pop es ; pop and restore all the registers
pop ds
pop bp
program ends ; end program segment
end