Skip to navigation

Elite on the BBC Micro and NES

Keyboard: RDKEY

[Elite-A, Parasite]

Name: RDKEY [Show more] Type: Subroutine Category: Keyboard Summary: Scan the keyboard for key presses by sending a scan_10in command to the I/O processor
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * check_keys calls RDKEY * DK4 calls RDKEY * DK4_FLIGHT calls RDKEY * PAS1 calls RDKEY * PAUSE2 calls RDKEY * TITLE calls RDKEY

Returns: X If a key is being pressed, X contains the internal key number, otherwise it contains 0 A Contains the same as X
.RDKEY LDA #&8C \ Send command &8C to the I/O processor: JSR tube_write \ \ =scan_10in() \ \ which will scan the keyboard JSR tube_read \ Set A to the response from the I/O processor, which \ will either be the internal key number of the key \ being pressed, or 0 if no key is being pressed TAX \ Copy the response into X RTS \ Return from the subroutine