![]() |
Routines |
| Prev: B5E3 | Up: Map | Next: B5FF |
|
Used by the routines at play_audio_until_keypress, await_restart, wait_key_poll, menu_loop, check_for_start_game, interface_ii, reverse_if2_bits, cursor, cursor_second_row, keyboard, keyboard_forward, keyboard_jump, keyboard_pickup, finished_input, handle_pause, debounce_space_press, wait_for_space and debounce_space_release.
The IN does the selecting on its own: IN A,($FE) puts A on the top half of the address bus, so each 0 bit in A selects one half-row, and A=0 reads all eight at once -- which is how the "press any key" waits call it. Callers also pass $7E, $99, $BD and so on to read several rows in one go. The CPL turns the Spectrum's active-low keys the right way up, and the AND keeps the five that mean anything.
The OUT before it is not needed for the read. It writes A to port A*256+$FD, which nothing on a 48K Spectrum answers because address line 0 is high. A 128K machine's paging port would decode it whenever A has bit 7 clear, and 0, $7E and $7F are all among the values callers pass.
|
||||||||||
| read_port | B5F7 | OUT ($FD),A | not what selects the row: see above | |||||||
| B5F9 | IN A,($FE) | reads port A*256+$FE | ||||||||
| B5FB | CPL | set bits now mean pressed keys; keep the five | ||||||||
| B5FC | AND $1F | |||||||||
| B5FE | RET | |||||||||
| Prev: B5E3 | Up: Map | Next: B5FF |