Skip to navigation

Elite on the BBC Micro and NES

Keyboard: PAUSE2

[BBC Master version]

Name: PAUSE2 [Show more] Type: Subroutine Category: Keyboard Summary: Wait until a key is pressed, ignoring any existing key press
Context: See this subroutine in context in the source code Variations: See code variations for this subroutine in the different versions References: This subroutine is called as follows: * JMTB calls PAUSE2

Returns: X The ASCII code of the key that was pressed
.PAUSE2 JSR RDKEY \ Scan the keyboard for a key press and return the \ ASCII code of the key pressed in X (or 0 for no key \ press) BNE PAUSE2 \ If a key was already being held down when we entered \ this routine, keep looping back up to PAUSE2, until \ the key is released JSR RDKEY \ Any pre-existing key press is now gone, so we can \ start scanning the keyboard again, returning the \ ASCII code of the key pressed in X (or 0 for no key \ press) BEQ PAUSE2 \ Keep looping up to PAUSE2 until a key is pressed .newyearseve RTS \ Return from the subroutine