| Routines

EAD9: Get the ASCII code of the last key pressed

Used by the routines at 6177, 7996, EAB2, F0BE and F1E3. Returns with the zero flag set if no key with an ASCII code in the range 0x30-0x7F was pressed. Otherwise returns with A holding the ASCII code of the last key pressed.
EAD9 | LD HL,$5C3B | Point HL at the system variable FLAGS
EADC | BIT 5,(HL) | Check the keypress flag
EADE | RES 5,(HL) | Reset the flag ready for the next keypress
EAE0 | RET Z | Return if no key was pressed
EAE1 | LD A,($5C08) | Collect the ASCII code of the key last pressed
EAE4 | CP $30 | Is the ASCII code < 0x30 ('0')?
EAE6 | JR C,$EAEB | Jump if so
EAE8 | CP $80 | Is the ASCII code < 0x80?
EAEA | RET C | Return if so
EAEB | XOR A | Set the zero flag to indicate that no (relevant) key was pressed
EAEC | RET |