Hello Denis, here I go, messing with one of your progs again :-)
I can't find a way to detect 43 or 50 lines, but assuming 132x50
does not cause any problems here. In mode3 anyway.
I'm not real happy with any color changing routine I've tried yet,
but this is ok.
;-=] SLOTCLR.ASM [=- Public Domain 1997 by Denis Boyles (1:153/290)
;
;Arrowsoft Assembler (MASM v3.0) | VAL Linker (.COM) | MS-DOS v6.20
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; This program will clear the mode 3 DOS screen in a kinda slot
; machine fashion. That is, each character is "rolled" down to a space
; character, kinda like how the slots roll.
;
; Things to do: 1) Make it video mode/card independent.
;
;Hacked to change color attribute, handle 132x50 mode3, change extended
scii,
;and catch characters less than 32, by B Block, 6-97
PRG SEGMENT
ASSUME CS:PRG
ORG 100h
;-=] main [=---------------------------------------------------------------
; Clears the mode 2 or 3 text screen using a "slot machine" method.
; That is, decreasing the ASCII values in memory until they become spaces.
main PROC
mov AX,0B800h ;Setup DS to point to the color text
mov DS,AX ;RAM segment.
M0:
xor DX,DX ;zero out DX as space counter
xor SI,SI ;zero out SI as offset index
mov CX,6600 ;we'll loop 80x25 times checking
; 132x50
M1:
; test DX,1 ;let the colors linger?
; jz M2
cmp byte ptr [si+1],7 ;is background color black?
jbe M2 ; (don't allow bright background)
dec byte ptr [si+1]
; dec DX ;which effect? jmp or dec/fall through
jmp short M3
M2:
cmp byte ptr [SI],127 ;is the current byte an extended
scii?
ja M6 ;yes, get it closer to the target
har.
cmp byte ptr [SI],' ' ;is the current byte a space?
je M4
jb M5 ;inc characters < space
dec byte ptr [SI] ;decrement ASCII value
;and move on to the next character
M3:
add SI,02h ;increment offset by 2,skipping color
loop M1 ;and loop back up to M1 for one screen
call WaitRetrace ;pause between pages to show effect
jmp short M0 ;keep looping until screen all spaces
M4:
inc DX ;increment out space counter
cmp DX,6600 ;has a screen of spaces been counted?
jne M3 ;no.
;yes, then screen clear, quit program
int 20h ;back to DOS
M5:
inc byte ptr [SI] ;increment ASCII value
jmp short M3
M6:
xor Byte ptr [SI], 128
jmp short M3
main ENDP
;-=] WaitRetrace [=--------------------------------------------------------
; This waits for a complete vertical retrace of the screen before returning
; to the caller. This is two fold; it provides a "delay" and makes it CPU
; independent.
WaitRetrace PROC
mov DX,03DAh ;DX = CGA Status Port to read from
WR0: ;flush out current retrace
in AL,DX ;input status byte from port
test AL,8 ;test retrace bit
jnz WR0 ;keep looping while 1 to flush
WR1: ;wait for retrace start
in AL,DX
test AL,8
jz WR1 ;keep looping while retrace is 0
ret
WaitRetrace ENDP
PRG ENDS
END main
;===cut===
Kind regards, Barry
--- Terminate 4.00/Pro
---------------
* Origin: EBO-BBS A'dam +31-20-6002828 (2:280/901.42)
|