Prev: B0B4 Up: Map Next: B103
B0D9: Read Cursor Keys
Used by the routine at ReadControls.
Reads the cursor keys, which are the keys 05 (left), 06 (down), 07 (up), 08 (right) and 00. The code does not work properly: for up, right and 00 the test is the wrong way round, so the bits are set when the keys are not being pressed.
ReadCursorKeys B0D9 LD C,$00 Clear the controls.
B0DB LD A,$F7 Read from the keyboard;
Port Number Bit
0 1 2 3 4
F7 1 2 3 4 5
B0DD CALL ReadKeys
B0E0 BIT 4,A Jump if the key 05 (left) is not pressed.
B0E2 JR Z,ReadCursorKeys_Digits
B0E4 SET 1,C Set the bit for turning left.
ReadCursorKeys_Digits B0E6 LD A,$EF Read from the keyboard;
Port Number Bit
0 1 2 3 4
EF 0 9 8 7 6
B0E8 CALL ReadKeys
B0EB BIT 4,A Jump if the key 06 (down) is not pressed.
B0ED JR Z,ReadCursorKeys_CheckUp
B0EF SET 6,C Set the bit for the action key.
ReadCursorKeys_CheckUp B0F1 BIT 3,A Jump if the key 07 (up) is pressed.
B0F3 JR NZ,ReadCursorKeys_CheckRight
B0F5 SET 2,C Set the bit for moving forward.
ReadCursorKeys_CheckRight B0F7 BIT 2,A Jump if the key 08 (right) is pressed.
B0F9 JR NZ,ReadCursorKeys_CheckFire
B0FB SET 0,C Set the bit for turning right.
ReadCursorKeys_CheckFire B0FD BIT 0,A Jump if the key 00 is pressed.
B0FF JR NZ,FinishJoystickControls
B101 SET 3,C Set the bit for firing the second weapon.
Prev: B0B4 Up: Map Next: B103