Prev: 71BD Up: Map Next: 71FA
71BE: Get the ASCII code of the last key pressed
Used by the routines at 5E6F, 71FA, F2E2, F413 and F6BE. 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.
71BE LD A,($7FEC) A=0 if we're using the keyboard, 1 if using Kempston
71C1 AND A Are we using the keyboard?
71C2 JR Z,$71E2 Jump if so
71C4 IN A,($1F)
71C6 AND $1F Any input from the joystick?
71C8 JR Z,$71E2 Jump if not
71CA LD L,$50 0x50='P' (RIGHT)
71CC RRCA
71CD JR C,$71DF Jump if the joystick was moved right
71CF DEC L L=0x4F='O' (LEFT)
71D0 RRCA
71D1 JR C,$71DF Jump if the joystick was moved left
71D3 LD L,$41 0x41='A' (DOWN)
71D5 RRCA
71D6 JR C,$71DF Jump if the joystick was moved down
71D8 LD L,$51 0x51='Q' (UP)
71DA RRCA
71DB JR C,$71DF Jump if the joystick was moved up
71DD LD L,$66 0x66='f' (fire)
71DF LD A,L Pass the appropriate character code to A
71E0 AND A Reset the zero flag (we have input)
71E1 RET
This entry point is used by the startup routines at 51A0, 52A0 and 54A0.
71E2 LD HL,$5C3B Point HL at the system variable FLAGS
71E5 BIT 5,(HL) Check the keypress flag
71E7 RES 5,(HL) Reset the flag ready for the next keypress
71E9 RET Z Return if no key was pressed
71EA LD A,($5C08) Collect the ASCII code of the key last pressed
71ED CP $0D Was it ENTER?
71EF JR Z,$71F5 Jump if so
71F1 CP $20 Was it a control character?
71F3 JR C,$71F8 Jump if so
71F5 CP $80 Was it an extended character?
71F7 RET C Return if not
This entry point is used by the routine at 71BE.
71F8 XOR A Set the zero flag to indicate that no (relevant) key was pressed
71F9 RET
Prev: 71BD Up: Map Next: 71FA