Prev: 82A5 Up: Map Next: 832E
82A6: Check for player input
Used by the routines at 940C and CD41.
82A6 LD HL,$832E 832E is the last player input.
82A9 LD D,$00 Default to "up" / "not jumping".
82AB LD A,($82A3) Get the control type.
82AE CP $01 Is it keyboard?
82B0 JR NZ,$82EB Jump forward if not.
Check for keyboard input
82B2 LD BC,$FBFE Check for Q-T on the keyboard.
82B5 IN A,(C)
82B7 BIT 0,A Was 'Q' pressed?
82B9 JR NZ,$82BE Skip if not.
82BB LD (HL),D Set input to "up" and move forward.
82BC JR $82DE
82BE LD BC,$FDFE Check for A-G on the keyboard.
82C1 INC D Change flag to "down".
82C2 IN A,(C) Read the keyboard.
82C4 BIT 0,A Was 'A' pressed?
82C6 JR NZ,$82CB Skip if not.
82C8 LD (HL),D Set input to "down" and move forward.
82C9 JR $82DE
82CB LD BC,$DFFE Check for P-Y on the keyboard.
82CE INC D Change flag to "left".
82CF IN A,(C) Read the keyboard.
82D1 BIT 1,A Was 'O' pressed?
82D3 JR NZ,$82D8 Skip if not.
82D5 LD (HL),D Set input to "left" and move forward.
82D6 JR $82DE
82D8 BIT 0,A Was 'P' pressed?
82DA JR NZ,$82DE Skip if not.
82DC INC D Set input to "right".
82DD LD (HL),D
82DE LD BC,$7FFE Read SPACE-B
82E1 IN A,(C) Read the keyboard.
82E3 AND $1F Were any keys pressed?
82E5 XOR $1F
82E7 RET Z Return if not.
82E8 SET 7,(HL) Set the "jump" bit and return.
82EA RET
Check for joystick input
82EB CP $02 Is the input Kempston?
82ED JR NZ,$830D Jump forward if not.
82EF IN A,($1F) Read the Kempston interface
82F1 BIT 3,A Was the joystick moved up?
82F3 JR Z,$82F8 Skip if not.
82F5 LD (HL),D Set input to "up" and move forward to check the fire button.
82F6 JR $8307
82F8 INC D Change flag to "down"
82F9 BIT 2,A Was the joystick moved down?
82FB JR NZ,$82F5 Set this input if so.
82FD INC D Change flag to "left"
82FE BIT 1,A Was the joystick moved left?
8300 JR NZ,$82F5 Set this input if so.
8302 INC D Change flag to "right"
8303 BIT 0,A Was the joystick moved right?
8305 JR NZ,$82F5 Set this input if so.
8307 BIT 4,A Was the fire button pressed?
8309 RET Z Return if not.
830A SET 7,(HL) Set the "jump" bit and return.
830C RET
Check for Sinclair joystick input
830D LD BC,$F7FE Read 1-5 on the keyboard
8310 IN A,(C)
8312 BIT 3,A Was '4' pressed?
8314 JR NZ,$8319 Skip if not.
8316 LD (HL),D Set input to "up" and move forward.
8317 JR $8328
8319 INC D Change state to "down".
831A BIT 2,A Was '3' pressed?
831C JR Z,$8316 Set this input if so.
831E INC D Change state to "left".
831F BIT 0,A Was '1' pressed?
8321 JR Z,$8316 Set this input if so.
8323 INC D Change state to "right".
8324 BIT 1,A Was '2' pressed?
8326 JR Z,$8316 Set this input if so.
8328 BIT 4,A Was '5' pressed?
832A RET NZ Return if not.
832B SET 7,(HL) Set the "jump" bit and return.
832D RET
Prev: 82A5 Up: Map Next: 832E