The zeropage address 197 ($C5 in hexadecimal, official name LSTX) holds what was the most recent keyboard code before the last keyboard scan was performed using the SCNKEY routine. If multiple keys are pressed, this address will contain the highest keyboard code.
The most recent keyboard code is available at address 203.
Each time SCNKEY scans the keyboard, it places the resulting keyboard code in address 203, but before doing this, the previous keyboard code already present in 203, is saved to address 197. This is part of the mechanism that detects the "moment" where a key is pressed down, ensuring that the resulting character is only printed once on the screen, rather than several times for as long as the key is being pressed.
Examples[edit | edit source]
This example was presented in Loadstar #5, as an alternate "space-optimized" method of checking if a key is pressed. It was compared to using GET, and checking all four character possibliies that could arise from pressing a single key.