Prev: 51483 Up: Map Next: 51577
51540: Read Kempston Joystick
Used by the routine at ReadControls.
Reads the controls from a Kempston joystick.
Output
C The controls
Read the port and map each bit to a control.
ReadKempstonJoystick 51540 IN A,(31) Read port 31.
51542 LD C,0 Set C to 0.
51544 BIT 0,A Set bit 1 of C if bit 0 of A is set.
51546 JR Z,ReadKempstonJoystick_TestLeft
51548 SET 1,C
ReadKempstonJoystick_TestLeft 51550 BIT 1,A Set bit 0 of C if bit 1 of A is set.
51552 JR Z,ReadKempstonJoystick_TestDown
51554 SET 0,C
ReadKempstonJoystick_TestDown 51556 BIT 2,A Set bit 4 of C if bit 2 of A is set.
51558 JR Z,ReadKempstonJoystick_TestUp
51560 SET 4,C
ReadKempstonJoystick_TestUp 51562 BIT 3,A Set bit 2 of C if bit 3 of A is set.
51564 JR Z,ReadKempstonJoystick_TestFire
51566 SET 2,C
ReadKempstonJoystick_TestFire 51568 BIT 4,A Set bit 3 of C if bit 4 of A is set.
51570 JR Z,ReadKempstonJoystick_Finish
51572 SET 3,C
ReadKempstonJoystick_Finish 51574 JP ReadControls_Finish Jump to ReadControls_Finish.
View the equivalent code in;
Prev: 51483 Up: Map Next: 51577