Prev: 67CC Up: Map Next: 67FD
67D8: Get input from the Kempston joystick if it's in use
Used by the routine at 673A. Returns with the zero flag set if there was no joystick input. Otherwise returns to the caller of 673A with the zero flag reset and the ASCII code of the equivalent keypress in A.
67D8 LD HL,$5C3B Prepare HL in case we return to 673A
67DB LD A,($681F) A=0x6B ('k') if the Kempston joystick is being used, 0x00 otherwise
67DE AND A Is the Kempston joystick being used?
67DF RET Z Return if not
67E0 IN A,($1F) Collect input from the joystick
67E2 AND $1F Check bits 0-4
67E4 RET Z Return with the zero flag set if there was no input
67E5 POP HL Drop the return address from the stack so we return straight to the caller of 673A
67E6 LD L,A L=input from the joystick
67E7 BIT 4,L
67E9 LD A,$66 0x66='f' (fire catapult)
67EB RET NZ Return if the fire button was pressed
67EC LD A,$51 0x51='Q' (up)
67EE BIT 3,L
67F0 RET NZ Return if the joystick was moved up
67F1 DEC A A=0x50: 'P' (right)
67F2 BIT 0,L
67F4 RET NZ Return if the joystick was moved right
67F5 DEC A A=0x4F: 'O' (left)
67F6 BIT 1,L
67F8 RET NZ Return if the joystick was moved left
67F9 LD A,$41 0x41='A' (down)
67FB AND A Reset the zero flag
67FC RET
Prev: 67CC Up: Map Next: 67FD