;BLANK2   € 1989   by John Filsak
;A program to blank the screen until a key is pressed.
;This version gives a visual and audible warning every 15 minutes.
;To remove the bleep, delete   7,   from Mess5 before assembly.
;This listing has been prepared for the Maxam II assembler.
;Other assemblers may require a few changes, particularly
;in the way hex numbers are written.

	org &100

	secs equ 64504
	mins equ 64503

;opening messages
	ld de,mess1
	call pr
	ld de,mess2
	call pr
	ld de,mess3
	call pr
	ld de,mess4
	call pr
	ld de,mess6
	call pr
	ld de,mess7
	call pr

;await keypress
	ld c,6
	ld e,&fd
	call 5

;blank screen
	ld de,op1
	call pr

;The main business...
start	ld hl,mins
	ld (hl),0	;set minutes to zero

loop1	call stat	;get console status
	jp nz,rest	;finish if key pressed
	ld hl,mins
	ld a,(hl)	;check time
	cp &15		;have 15 minutes passed?  **Change &15 to some other
			;figure between &1 and &59 to alter interval
        jp nz,loop1	;no - loop again
	ld de,mess5	;yes - flash message
	call pr

	ld hl,secs	;set seconds to zero
	ld (hl),0

loop2	call stat	;get console status
	jp nz,rest	;finish if key pressed
	ld hl,secs
	ld a,(hl)	;check time
	cp &20		;have 20 seconds passed?  **Change &20 to some other
			;figure between &1 and &59 to alter interval
        jp nz,loop2	;no - loop again
	ld de,op1	;yes - clear screen
	call pr
	jp start

;restore screen display
rest	ld de,op2
        call pr
	ret

;SUBROUTINES
;===========
;print to screen
pr	ld c,9
	call 5
	ret

;get console status
stat	ld e,&ff
	ld c,6
	call 5
	cp 0
	ret

;Screen messages, etc
op1	defb 27,'E',27,'0$'
op2	defb 27,'E',27,'H',27,'e',27,'1$'
mess1	defb 27,'E',27,'f',27,'HBLANK2   €1989   by John Filsak',10,10,10,13,'$'
mess2	defb 'Press a key to blank the screen entirely.',10,10,13,'$'
mess3	defb 'A further keypress will restore the screen ',10,13,'and return you to CP/M.$'
mess4	defb 10,10,13,'A warning will be sounded every 15 minutes',10,13,'as a reminder that the program is running.$'
mess5	defb 7,27,'Y,<WARNING!!  Computer switched on!!$'
mess6	defb 10,10,10,10,10,10,13,'$'
mess7	defb 27,'rWarning:',27,'u if you make use of the system clock,',10,13,'you will need to reset it when this program',10,13,'has finished.$'
                                                                                                          