Prev: 45173 Up: Map Next: 45236
45189: Read Interface 2
Reads the Sinclair interface 2 joysticks. The keys 6 to 0 are one joystick and the keys 1 to 5 are the other; both are used at once.
ReadInterface2 45189 LD A,239 Read from the keyboard;
Port Number Bit
0 1 2 3 4
239 0 9 8 7 6
45191 CALL ReadKeys
45194 LD C,A Keep the keys in C.
45195 LD A,247 Read from the keyboard;
Port Number Bit
0 1 2 3 4
247 1 2 3 4 5
45197 CALL ReadKeys
45200 OR C Combine the keys of both.
45201 LD C,0 Clear the controls.
45203 BIT 0,A Jump if the first key is not pressed (0 or 1).
45205 JR Z,ReadInterface2_Key2
45207 SET 3,C Set the bit for firing the second weapon.
ReadInterface2_Key2 45209 BIT 1,A Jump if the second key is not pressed (9 or 2).
45211 JR Z,ReadInterface2_Key3
45213 SET 2,C Set the bit for moving forward.
ReadInterface2_Key3 45215 BIT 2,A Jump if the third key is not pressed (8 or 3).
45217 JR Z,ReadInterface2_Key4
45219 SET 6,C Set the bit for the action key.
ReadInterface2_Key4 45221 BIT 3,A Jump if the fourth key is not pressed (7 or 4).
45223 JR Z,ReadInterface2_Key5
45225 SET 0,C Set the bit for turning right.
ReadInterface2_Key5 45227 BIT 4,A Jump if the fifth key is not pressed (6 or 5).
45229 JR Z,ReadInterface2_Finish
45231 SET 1,C Set the bit for turning left.
ReadInterface2_Finish 45233 JP FinishJoystickControls Jump to finish.
Prev: 45173 Up: Map Next: 45236