Prev: 29117 Up: Map Next: 29178
29118: Get the ASCII code of the last key pressed
Used by the routines at 24175, 29178, 62178, 62483 and 63166. Returns with the zero flag set if no key of interest was pressed. Otherwise returns with A holding the ASCII code of the last key pressed.
29118 LD A,(32748) A=0 if we're using the keyboard, 1 if using Kempston
29121 AND A Are we using the keyboard?
29122 JR Z,29154 Jump if so
29124 IN A,(31)
29126 AND 31 Any input from the joystick?
29128 JR Z,29154 Jump if not
29130 LD L,80 80='P' (RIGHT)
29132 RRCA
29133 JR C,29151 Jump if the joystick was moved right
29135 DEC L L=79='O' (LEFT)
29136 RRCA
29137 JR C,29151 Jump if the joystick was moved left
29139 LD L,65 65='A' (DOWN)
29141 RRCA
29142 JR C,29151 Jump if the joystick was moved down
29144 LD L,81 81='Q' (UP)
29146 RRCA
29147 JR C,29151 Jump if the joystick was moved up
29149 LD L,102 102='f' (fire)
29151 LD A,L Pass the appropriate character code to A
29152 AND A Reset the zero flag (we have input)
29153 RET
This entry point is used by the startup routines at 20896, 21152 and 21664.
29154 LD HL,23611 Point HL at the system variable FLAGS
29157 BIT 5,(HL) Check the keypress flag
29159 RES 5,(HL) Reset the flag ready for the next keypress
29161 RET Z Return if no key was pressed
29162 LD A,(23560) Collect the ASCII code of the key last pressed
29165 CP 13 Was it ENTER?
29167 JR Z,29173 Jump if so
29169 CP 32 Was it a control character?
29171 JR C,29176 Jump if so
29173 CP 128 Was it an extended character?
29175 RET C Return if not
This entry point is used by the routine at 29118.
29176 XOR A Set the zero flag to indicate that no (relevant) key was pressed
29177 RET
Prev: 29117 Up: Map Next: 29178