This code appears in the following versions (click to see it in the source code):
Code variations between these versions are shown below.
Name: TT217 Type: Subroutine Category: Keyboard Summary: Scan the keyboard until a key is pressed
Scan the keyboard until a key is pressed, and return the key's ASCII code. If, on entry, a key is already being held down, then wait until that key is released first (so this routine detects the first key down event following the subroutine call).
Returns: X The ASCII code of the key that was pressed A Contains the same as X Y Y is preserved
Other entry points: out Contains an RTS
t As TT217 but don't preserve Y, set it to YSAV instead
.TT217 STY YSAV \ Store Y in temporary storage, so we can restore it \ later .t
This variation is blank in the Electron version.
Tap on a block to expand it, and tap it again to revert.
This variation is blank in the Electron version.
Tap on a block to expand it, and tap it again to revert.
BEQ t2 \ Keep looping up to t2 until a key is pressed
This variation is blank in the Master and Electron versions.
Tap on a block to expand it, and tap it again to revert.
LDY YSAV \ Restore the original value of Y we stored above
TAX \ Copy A into X .out RTS \ Return from the subroutine