Prev: 9B0C Up: Map Next: 9BCB
9BC3: Read the keyboard
Used by the routines at play_tune_until_key and read_control_method.
Reads the half-rows A selects; returns the keys down as set bits 0-4. Every keyboard read in the game first writes A to port $FD; on a 48K Spectrum nothing answers that port, and why it is done is not yet worked out. On a 128K the same OUT is a write to the paging port whenever A's bit 7 is clear: the menu's test for B (menu_keys) writes $7F, which pages RAM bank 7 in at the top of memory and locks the paging, and the game then crashes on the menu's first pass (watched in SkoolKit's 128K memory for the reference pages). It must be run in 48 mode.
Input
A The half-rows to read (0 bits select)
Output
A The keys down, a bit each
F NZ if any
read_keyboard 9BC3 OUT ($FD),A
9BC5 IN A,($FE)
9BC7 CPL
9BC8 AND $1F
9BCA RET
Prev: 9B0C Up: Map Next: 9BCB