

Task

Clear the screen, output something on the display, and then restore the screen to the preserved state that it was in before the task was carried out.

There is no requirement to change the font or kerning in this task, however character decorations and attributes are expected to be preserved.   If the implementer decides to change the font or kerning during the display of the temporary screen, then these settings need to be restored prior to exit.




		org	$3000
 
txt_output:	equ	$bb5a
scr_clear:	equ	$bc14
wait_char:	equ	$bb06
scr_get_loc:	equ	$bc0b
scr_set_off:	equ	$bc05
 
		push	bc
		push	de
		push	hl
		push	af
 
		call	scr_get_loc ; save this value just in case the
		push	hl          ;   original screen has been scrolled vertically
 
		ld	hl,$c000 ; copy screen to block 1
		ld	de,$4000
		ld	bc,$4000
		ldir
 
		call	scr_clear
		ld	hl,text
 
print:		ld	a,(hl)
		cp	0
		jr	z,key
		call	txt_output
		inc	hl
		jr	print
 
key:		call	wait_char
		pop	hl
		call	scr_set_off
		ld	hl,$4000 ; restore screen
		ld	de,$c000
		ld	bc,$4000
		ldir
		pop	af
		pop	hl
		pop	de
		pop	bc
		ret
 
text:		defm	"This is some text. Please press a key.\0"