home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
utils
/
miscutil.zip
/
TBWINDOW.ZIP
/
RECOLOR.ASM
< prev
next >
Wrap
Assembly Source File
|
1987-05-27
|
5KB
|
75 lines
title RECOLOR
page 60,132
oldattr equ [bp + 0Eh] ; OLDATTR%
newattr equ [bp + 0Ah] ; NEWATTR%
snochk equ [bp + 06h] ; SNOCHK%
program segment
assume cs:program ; begin program segment
push bp ; save for basic
mov bp,sp ; establish stack
push es ; save for return
push ds ; save for return
mov ax,0040h ; dos segment
mov es,ax ; to es
mov si,0001 ; start on odd for attr
mov dx,es:[0063h] ; point to status reg
add dx,06h ; " " " "
mov ax,0b800h ; assume color
mov bx,es:[0010h] ; get the byte
and bx,30h ; get ready
cmp bx,30h ; compare it
jnz SetScrn ; yup, it's color
mov ah,0b0h ; nope, change it
SetScrn: lds di,oldattr ; get old attribute
mov cx,ds:[di] ; to CX
lds di,newattr ; get new attribute
mov bx,ds:[di] ; to BX
mov bh,cl ; put old in BH,new in BL
lds di,SnoChk ; point to SNOCHK%
mov cx,ds:[di] ; get it
jcxz Snow ; do Snow checking
mov ds,ax ; point to screen
mov cx,07d0h ; do whole screen
mov di,0002 ; use for increment
cld ; clear direction flags
ChngColor: mov al,[si] ; get screen attribute
cmp al,bh ; compare it
jnz ColorOK ; don't bother changing
mov [si],bl ; put the new attribute
ColorOK: add si,di ; increment screen pointer
loop ChngColor ; do until CX=0
jmp endit ; done
Snow: mov ds,ax ; point to screen
mov cx,07d0h ; do whole screen
mov di,0002 ; use for increment
cld ; clear direction flags
ChngColor1: cli ; disable interrupts
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
mov al,[si] ; get screen attribute
cmp al,bh ; compare it
jnz ColorOK1 ; don't bother changing
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
mov [si],bl ; put the new attribute
ColorOK1: sti ; enable interrupts
add si,di ; increment screen pointer
loop ChngColor1 ; do it until CX=0
endit: pop ds ; restore DS
pop es ; restore ES
pop bp ; back to basic
program ends
end