Prev: D0F2 Up: Map Next: D150
D12B: Read Kempston Joystick
Used by the routine at ReadControls.
Reads a Kempston joystick from port 1F.
Output
C The controls
Read the joystick, and start with no controls.
ReadKempstonJoystick D12B IN A,($1F) Read the joystick from port 1F.
D12D LD C,$00 Clear the controls.
Set bit 1 if the joystick is pushed right.
D12F BIT 0,A Set bit 1 if the joystick is pushed right.
D131 JR Z,ReadKempstonJoystick_TestLeft
D133 SET 1,C
Set bit 0 if the joystick is pushed left.
ReadKempstonJoystick_TestLeft D135 BIT 1,A Set bit 0 if the joystick is pushed left.
D137 JR Z,ReadKempstonJoystick_TestDown
D139 SET 0,C
Set bit 4 if the joystick is pushed down.
ReadKempstonJoystick_TestDown D13B BIT 2,A Set bit 4 if the joystick is pushed down.
D13D JR Z,ReadKempstonJoystick_TestUp
D13F SET 4,C
Set bit 2 if the joystick is pushed up.
ReadKempstonJoystick_TestUp D141 BIT 3,A Set bit 2 if the joystick is pushed up.
D143 JR Z,ReadKempstonJoystick_TestFire
D145 SET 2,C
Set bit 3 if the fire button is pressed.
ReadKempstonJoystick_TestFire D147 BIT 4,A Set bit 3 if the fire button is pressed.
D149 JR Z,ReadKempstonJoystick_Finish
D14B SET 3,C
ReadKempstonJoystick_Finish D14D JP ReadControls_Rotate Jump to ReadControls_Rotate.
View the equivalent code in;
Prev: D0F2 Up: Map Next: D150