Prev: 26572 Up: Map Next: 26621
26584: Get input from the Kempston joystick if it's in use
Used by the routine at 26426. Returns with the zero flag set if there was no joystick input. Otherwise returns to the caller of 26426 with the zero flag reset and the ASCII code of the equivalent keypress in A.
26584 LD HL,23611 Prepare HL in case we return to 26426
26587 LD A,(26655) A=107 ('k') if the Kempston joystick is being used, 0 otherwise
26590 AND A Is the Kempston joystick being used?
26591 RET Z Return if not
26592 IN A,(31) Collect input from the joystick
26594 AND 31 Check bits 0-4
26596 RET Z Return with the zero flag set if there was no input
26597 POP HL Drop the return address from the stack so we return straight to the caller of 26426
26598 LD L,A L=input from the joystick
26599 BIT 4,L
26601 LD A,102 102='f' (fire catapult)
26603 RET NZ Return if the fire button was pressed
26604 LD A,81 81='Q' (up)
26606 BIT 3,L
26608 RET NZ Return if the joystick was moved up
26609 DEC A A=80: 'P' (right)
26610 BIT 0,L
26612 RET NZ Return if the joystick was moved right
26613 DEC A A=79: 'O' (left)
26614 BIT 1,L
26616 RET NZ Return if the joystick was moved left
26617 LD A,65 65='A' (down)
26619 AND A Reset the zero flag
26620 RET
Prev: 26572 Up: Map Next: 26621