Prev: A51C Up: Map Next: A59C
A58C: Keyscan all
This tests for any key press.
Used by the routine at escaped.
Output
F NZ if a key was pressed, Z otherwise.
keyscan_all A58C LD BC,$FEFE Set B to $FE (initial keyboard half-row selector) and C to $FE (keyboard port number)
Start loop
keyscan_all_0 A58F IN A,(C) Read the port
A591 CPL Complement the value returned to change it from active-low
A592 AND $1F Discard any non-key flags
A594 RET NZ Return with Z clear if any key was pressed
A595 RLC B Rotate the half-row selector ($FE -> $FD -> $FB -> .. -> $7F)
A597 JP C,keyscan_all_0 ...loop until the zero bit shifts out (eight iterations)
A59A XOR A No keys were pressed - return with Z set
A59B RET
Prev: A51C Up: Map Next: A59C