Prev: 45236 Up: Map Next: 45315
45273: Read Cursor Keys
Used by the routine at ReadControls.
Reads the cursor keys, which are the keys 5 (left), 6 (down), 7 (up), 8 (right) and 0. The code does not work properly: for up, right and 0 the test is the wrong way round, so the bits are set when the keys are not being pressed.
ReadCursorKeys 45273 LD C,0 Clear the controls.
45275 LD A,247 Read from the keyboard;
Port Number Bit
0 1 2 3 4
247 1 2 3 4 5
45277 CALL ReadKeys
45280 BIT 4,A Jump if the key 5 (left) is not pressed.
45282 JR Z,ReadCursorKeys_Digits
45284 SET 1,C Set the bit for turning left.
ReadCursorKeys_Digits 45286 LD A,239 Read from the keyboard;
Port Number Bit
0 1 2 3 4
239 0 9 8 7 6
45288 CALL ReadKeys
45291 BIT 4,A Jump if the key 6 (down) is not pressed.
45293 JR Z,ReadCursorKeys_CheckUp
45295 SET 6,C Set the bit for the action key.
ReadCursorKeys_CheckUp 45297 BIT 3,A Jump if the key 7 (up) is pressed.
45299 JR NZ,ReadCursorKeys_CheckRight
45301 SET 2,C Set the bit for moving forward.
ReadCursorKeys_CheckRight 45303 BIT 2,A Jump if the key 8 (right) is pressed.
45305 JR NZ,ReadCursorKeys_CheckFire
45307 SET 0,C Set the bit for turning right.
ReadCursorKeys_CheckFire 45309 BIT 0,A Jump if the key 0 is pressed.
45311 JR NZ,FinishJoystickControls
45313 SET 3,C Set the bit for firing the second weapon.
Prev: 45236 Up: Map Next: 45315