Skip to navigation

Elite on the BBC Micro

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
Returns:

Code variation 1 of 3A variation in the comments only

Tap on a version to expand it, and tap it again to show to all variations.

Docked, 6502SP

Master

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

Code variation 2 of 3Specific to an individual platform

Tap on a version to expand it, and tap it again to show to all variations.

Docked, 6502SP

Master

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 3Specific to an individual platform

Tap on a version to expand it, and tap it again to show to all variations.

Docked, 6502SP

Master

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

 RTS                    \ Return from the subroutine

RSS Feed