[net.micro.pc] CLS

Mfarber@UDel-Relay@sri-unix.UUCP (08/26/83)

This program clears the screen from DOS.  It will do it from any
graphics or alpha mode.  In the graphics modes, the DOS 2.00 CLS will
fill the screen with bars; this doesn't.

-Manny

; This program clears the screen from DOS.  To clear the screen,
; it defines a window the size of the whole screen and then
; scrolls that window to clear its contents.

; After linking, use EXE2BIN CLEAR.EXE CLEAR.COM
; to convert it to a .COM file.

clear	segment
	assume cs:clear
	mov ah,15		; get current video state data
	int 10h
	mov bl,bh		; save video page
	xor cx,cx		; set upper-left-corner
	mov dl,ah		; set lower-left-corner
	dec dl			; (adjust)
	mov dh,24
	mov bh,7		; normal attr
	cmp al,4		; graphics screen?
	jb c1			; no
	cmp al,7
	je c1			; no
	mov bh,cl		; yes-use attr 0
c1:	mov al,cl		; scroll length 0-clear window
	mov ah,6		; scroll page to clear the screen
	int 10h
	mov ah,2		; reposition cursor
        mov bh,bl		; (restore video page)
	mov dx,cx		; upper-left-corner (CX=0 from scroll)
	int 10h
	int 20h			; return to DOS
clear	ends
	end

[CLEAR.ASM has been added to the Info-IBMPC library. -Ed.]