Prev: D0B7 Up: Map Next: D0E3
D0DB: Read Keyboard Port
Reads the keyboard half-rows selected by A. A zero bit selects a half-row, and more than one half-row can be read at once. The keys that are pressed come back as set bits 0 to 4.
Input
A The half-rows to read, with a zero bit for each half-row
Output
A The keys pressed, in bits 0 to 4
F The zero flag is set if no key is pressed
Write the selector to port FD which has no effect on a 48K Spectrum, then read port FE.
ReadKeyboardPort D0DB OUT ($FD),A Write the selector to port FD.
D0DD IN A,($FE) Read the keyboard.
D0DF CPL Make a one bit for each key which is pressed.
D0E0 AND %00011111 Keep the five bits for the keys.
D0E2 RET Return.
View the equivalent code in;
Prev: D0B7 Up: Map Next: D0E3