Skip to navigation

Elite on the BBC Micro and NES

Version analysis of PAUSE2

This code appears in the following versions (click to see it in the source code):

Code variations between these versions are shown below.

Name: PAUSE2 Type: Subroutine Category: Keyboard Summary: Wait until a key is pressed, ignoring any existing key press

Code variation 1 of 4A variation in the comments only

Tap on a block to expand it, and tap it again to revert.

Returns: X The internal key number of the key that was pressed
Returns: X The ASCII code of the key that was pressed
.PAUSE2

Code variation 2 of 4Specific to an individual platform

Tap on a block to expand it, and tap it again to revert.

JSR RDKEY \ Scan the keyboard for a key press and return the \ internal key number in X (or 0 for no key press)
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

Code variation 3 of 4Specific to an individual platform

Tap on a block to expand it, and tap it again to revert.

JSR RDKEY \ Any pre-existing key press is now gone, so we can \ start scanning the keyboard again, returning the \ internal key number in X (or 0 for no key press)
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

Code variation 4 of 4A variation in the labels only

This variation is blank in the Disc (docked) and 6502 Second Processor versions.

.newyearseve
 RTS                    \ Return from the subroutine