TIP: Click on subject to list as thread! ANSI
echo: 80xxx
to: BARRY BLOCK
from: DENIS BOYLES
date: 1997-05-30 12:44:00
subject: Clearing Screens

 Hi Barry!
 BB> Hello all, I asked for a timer routine with better resolution than
 BB> 1/18 sec. In the meantime I rewrote the program and renamed it to
 A couple of thoughts. You could program the timer itself to a faster
 resolution than 1/18 for the duration of your program. The only catch is 
hat
 your system time will go warp speed! :)
 Another thought is to use one of the BIOS services in the CASETTE 
 interrupt. There's a couple of millisecond timer functions that use the RTC
 and are available on 286+ machines.
 One function is a WAIT one, that will wait the specified number of
 milliseconds. The other is a WATCHDOG timer that will set a flag in the
 BIOS DATA segment when the time is up.
 Look under interrupt 15h (CASETTE) for the WAIT / WATCHDOG TIMER functions.
 (they might be microsecond counters or milli, can't remember)
 BB> something more appropriate. Anyone want to share a screen clearing
 BB> routine? 
 
 Sure! When I come up with something :) ...
                          * * * time passes * * *
 ...ok, I've got something, that wasn't too long now was it. :)
===========================================================================
;-=] SLOTCLR.ASM [=- Public Domain 1997 by Denis Boyles
;
;Arrowsoft Assembler (MASM v3.0) | VAL Linker (.COM) | MS-DOS v6.20
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; This program will clear the default 80x25 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) I assumed that characters < space will not be on the
;                  screen. So I suppose that could be added and checked for.
;
;               2) Add color support? The color attributes are not changed,
;                  only the ASCII codes. Therefore they retain whatever
;                  attributes were there to start with.
;
;               3) Make it video mode/card independent.
PRG SEGMENT
    ASSUME CS:PRG
    ORG 100h
;-=] main [=---------------------------------------------------------------
;   Clears the 80x25 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,2000                    ;we'll loop 80x25 times checking
M1:
    cmp     byte ptr [SI],' '          ;is the current byte a space?
    jne     M4                         ;no, then assume above and check.
M2:
    inc     DX                         ;otherwise increment out space counter
    cmp     DX,2000                    ;have 2000 spaces been counted?
    je      M5                         ;yes, then screen clear, quit program
M3:                                    ;no then...
    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     M0                         ;keep looping until screen all spaces
M4:
    dec     byte ptr [SI]              ;decrement ASCII value
    jmp     M3                         ;and move on to the next character
M5:
    ret                                ;back to DOS
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
===========================================================================
 Cheers,
   Denis Boyles
___ Blue Wave/QWK v2.12
--- Maximus/2 3.01
---------------
* Origin: Frog Hollow Port Moody BC 604-469-0264/0284 (1:153/290)

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™.