Terminal control/Preserve screen: Difference between revisions

Content added Content deleted
m ({{omit from|GUISS}})
Line 71: Line 71:
sleep 5 # Wait five seconds
sleep 5 # Wait five seconds
tput rmcup # Restore the display</lang>
tput rmcup # Restore the display</lang>

=={{header|Z80 Assembly}}==

Using the Amstrad CPC firmware:

<lang z80> 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"</lang>


{{omit from|GUISS}}
{{omit from|GUISS}}