Purpose Wait using _getkey until a key is pressed, then return from subroutine.
Code
routine:
	call _getkey	;gets key press to a
	cp $00		;was $00 returned?
	jr z,routine	;if it's zero try again
	ret		;must not have been zero...
			; so return
	
Error Two errors. First, _getkey will not return to your program until a key is pressed. You can just jump to the routine like a pause that will continue if any key was pressed. If [ON] was pressed, it will return $00 and gives ERROR 06 BREAK and give you the option to exit to the homescreen. The second error is with the cp $00. Remember back to our logical operators, or arg1 will return any bits set in either arg1 or a. So, if you or a, it will return any bits set in a or a...itself! So if a does not have any bits set, it will leave a as zero and set the Zero Flag. Or a is also only one byte so it is faster than the two byte cp $00 or cp 0. This little change is only to speed up the cp $00 part of the above code, but we don't even need it if we are going just jump to the routine and not worry if zero was returned.
Fixed Code
routine:
	jp _getkey	;wait until a key is
			; pressed and store
			; that scancode in a
			; then return