Right now, i've got some code (basically, a pause function):
Code: Select all
;##########################
;#WAIT2ND
;#Wait for the 2nd key to be pressed.
;# If 2nd is currently held, we first
;# wait for it to be released then
;# check if it has been pressed again.
;# Also, displays the gbuf
;#Explanation: b starts off at 2 (see
;# inc b). If 2nd is pressed, we jump to
;# loop2, so the djnz will always drop b
;# to 1, never 0, until we release 2nd.
;# this is so that the player doesn't
;# accidentally skip a message
;##########################
wait2nd:
call drawgbuf
ld b,1
jr w2_loop2
w2_loop:
ld b,0
w2_loop2:
inc b
ld a,$BF ;group 7
out (1),a
in a,(1)
cp 223 ;2nd
jr nz,w2_loop ;if 2nd isn't pressed, repeat loop
djnz w2_loop2
ret
Code: Select all
wait2ndReleased:
ld a,$BF ;group 7
out (1),a
w2R_loop:
in a,(1)
cp 223 ;2nd
jr z,w2R_loop
ret
So i've got two questions, the first being whether it'd be worthwhile to throw in a halt or two in the w2r routine, the second about clearing the key port before reading from it.
Thanks.