Skip to navigation

Elite on the BBC Micro and NES

Keyboard: YESNO

[BBC Master version]

Name: YESNO [Show more] Type: Subroutine Category: Keyboard Summary: Wait until either "Y" or "N" is pressed
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * SVE calls YESNO

Returns: C flag Set if "Y" was pressed, clear if "N" was pressed
.YESNO JSR t \ Scan the keyboard until a key is pressed, returning \ the ASCII code in A and X CMP #'Y' \ If "Y" was pressed, return from the subroutine with BEQ PL6 \ the C flag set (as the CMP sets the C flag, and PL6 \ contains an RTS) CMP #'N' \ If "N" was not pressed, loop back to keep scanning BNE YESNO \ for key presses CLC \ Clear the C flag RTS \ Return from the subroutine