Prev: B5C4 Up: Map Next: B5FF
B5F7: Read Keyboard Port
Reads some rows of the keyboard. The row selector is also written to port FD (with the selector as the high byte of the address), which does nothing on a 48K Spectrum and is not part of any sound; the keyboard is read with the same selector straight afterwards.
Input
A Row selector (a bit which is reset selects the row)
Output
A Keys pressed, in bits 0 to 4 (a bit is set when a key is pressed)
F Zero flag set if no key is pressed
Write the selector, then read the keys.
ReadKeyboardPort B5F7 OUT ($FD),A Put the half-row selector on the high byte of the address bus.
B5F9 IN A,($FE) Read the rows of the keyboard.
B5FB CPL Invert the bits so that the pressed keys are set.
B5FC AND %00011111 Keep only bits 0 to 4.
B5FE RET Return.
View the equivalent code in;
Prev: B5C4 Up: Map Next: B5FF