BBS: Inland Empire Archive Date: 11-11-92 (00:52) Number: 399 From: MARK BUTLER Refer#: NONE To: ALL Recvd: NO Subj: Screenblank 1/2 Conf: (2) Quik_Bas
Hi all, there's been a thread lately about screen blanking techniques
so I played around with some ASM code I saw on 80XXX and came up with
this. When you call 'ScreenBlank' from within QB/QBX it will clear
the screen, turn off the cursor and wait for a keypress before
returning. You will need to save the current screen before calling
ScreenBlank and restore it afterwards. Maybe some of you ASM Wizards
could write a screen save/restore right into ScreenBlank?
==========================8< Cut Here 8<=============================
'** QB/QBX code to demonstrate ScreenBlank.
'** A call to ScreenBlank will blank the screen, shut the
'** the cursor off and wait for a keypress to return.
'** M-H-B
'**
DEFINT A-Z
DECLARE SUB ScreenBlank ()
COLOR 7, 1
CLS
FOR i = 1 TO 13 '*** throw some crapola
FOR ch = 33 TO 176 '*** around on the screen
PRINT CHR$(ch);
NEXT ch
NEXT i
PCOPY 0, 1 '*** save the screen
DO UNTIL LEN(INKEY$): LOOP '*** wait for a keypress
ScreenBlank '*** now call ScreenBlank
'*** ScreenBlank will check for
'*** a keypress before returning
PCOPY 1, 0 '*** copy the old screen back
==========================8< Cut Here 8<=============================
TITLE Scrnblnk.asm
page ,132
Comment~
=======
This is a modification of a bit of code I saw on the 80XXX echo.
Originally it would blank the screen by writing blank spaces to all
25 lines in 80 x 25 text mode and then return. I thought this would be
perfect as a callable screen blanker in QB/QBX if it would wait for a
keypress before returning so I added the code for a 'KeyPress' call.
Note: this routine is for _color_ 80 x 25 text mode, note the change
below that must be made for use with monochrome. ***
QB/QBX declaration -> DECLARE SUB ScreenBlank ()
=======~
.model medium,basic
.code
public ScreenBlank
ScreenBlank proc far
push es ; Save registers
push di
push cx
push ax
mov ax,0b800h ; *** Make this B000h for mono
mov es,ax
xor di,di ; Zero DI
mov ax,0720h
mov cx,2000 ; 2000 Spaces to clear
rep stosw ; Load spaces into all areas
call Cursoff ; shut off the cursor
pop ax
pop cx
pop di
pop es
call KeyPress
retf 0
ScreenBlank endp
cursoff:
mov ah,01h
mov ch,20h
int 10h
retn
KeyPress: ; wait for a keypress
mov ah,08h
int 21h
cmp al,00h
jne KeyWasHit
int 21h
KeyWasHit:
mov ah,4ch
retn
end
>>> continued to the next message
--- PPoint 1.35
* Origin: Terminal Oasis, Portland OR (1:105/330.5)

Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET