TIP: Click on subject to list as thread! ANSI
echo: 80xxx
to: MERVYN BALDWIN
from: BARRY BLOCK
date: 1997-05-29 23:43:00
subject: fade

Hello Mervyn,
===cut===
;FADE. From PC magV4#12p296. (UK Edition)
;Translated from DEBUG script to A86.
;Fades VGA screen. Recover by setting mode.
;posted by Mervyn Baldwin (vyn@abaldwin.demon.co.uk) 28-May-97
;added keypress check and restore mode3 by Barry Block 29-May-97
;removed delay loops and added fade in.        B Block 29-May-97
mov dx,offset buf    ;to hold reg values
call init_buf
mov dx,offset buf2   ;to save reg values
call init_buf
mov cx,40h
L1:
push cx
mov cx,0C0h          ;192 color registers?
mov si,offset buf
L2:
cmp b[si],0
je >L3
dec b[si]
L3:
inc si
loop L2
call set_regs
pop cx
loop L1
L4:
mov ah,1             ;check for keypress
int 16h
jz L4
mov ax,0C00h         ;clear keybuffer
int 21h
mov cx,40h           ;fade in screen
L5:
push cx
mov cx,0C0h
mov di,offset buf
mov si,offset buf2   ;copied original data
L6:
lodsb
cmp al,b[di]
je >L7
inc b[di]
L7:
inc di
loop L6
call set_regs
pop cx
loop L5
L8:
int 20h              ;exit to dos
init_buf:            ;dx points to buffer
mov ax,1017h         ;read block colour regs
xor bx,bx            ;1st. reg to read
mov cx,40h           ;regs to read
int 10h
ret
set_regs:
mov ax,1012h         ;set block colour regs
xor bx,bx            ;1st. reg to set
mov cx,40h           ;regs to set
mov dx,offset buf    ;of stored values
int 10h
ret
data segment
org 256 + 256
buf   db  3000h dup (?)
buf2  db  3000h dup (?)
===cut===
Wow! I had no idea the buffer was this big. It took hours for me to find
out what the problem was when this did not restore the screen correctly.
192 color registers * 64 something registers.
I have a lot to learn about vga.
Kind regards, Barry
---------------
* Origin: EBO-BBS A'dam +31-20-6002828 (2:280/901.42)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.