Skip to navigation


Keyboard: PAUSE2

[BBC Micro disc version, Docked]

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 internal key number of the key that was pressed
.PAUSE2 JSR RDKEY \ Scan the keyboard for a key press and return the \ internal key number in A and 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 \ internal key number in A and X (or 0 for no key press) BEQ PAUSE2 \ Keep looping up to PAUSE2 until a key is pressed RTS \ Return from the subroutine