Prev: 6DCF Up: Map Next: 6F43
6EF8: Handler: Ship Movement
Used by the routine at Handler_Shield.
Handler_ShipMovement 6EF8 LD H,$50 Set H to 50 (screen buffer base).
6EFA LD A,($66F3) Jump to ShipMovement_CheckKempston if *Flag_ActiveDemoMode is active.
6EFD OR A
6EFE JR Z,ShipMovement_CheckKempston
6F00 LD A,($66F4) A=*Movement_DemoMode.
6F03 JR Ship_DemoMovement Jump to Ship_DemoMovement.
Check if the control method is the Kempston joystick?
ShipMovement_CheckKempston 6F05 DI Disable interrupts.
The control method is Kempston joystick, so test for "left" or "right" being pressed.
6F06 LD A,($66F6) Jump to ShipMovement_CheckAGF if *ControlMethod is not the Kempston joystick.
6F09 CP $02
6F0B JR NZ,ShipMovement_CheckAGF
6F0D IN A,($1F) A=read from the Kempston joystick port.
6F0F AND %00000011 Keep only bits 0-1 ("right" and "left").
6F11 CP $02 Jump to Handler_MoveShip_Left if "left" is being pressed.
6F13 JR Z,Handler_MoveShip_Left
6F15 CP $01 Jump to Handler_MoveShip_Right if "right" is being pressed.
6F17 JP Z,Handler_MoveShip_Right
6F1A JR Ship_NoMovement Jump to Ship_NoMovement.
Check if the control method is the AGF joystick?
ShipMovement_CheckAGF 6F1C CP $01 Jump to ShipMovement_CheckKeyboard if *ControlMethod is not the AGF joystick.
6F1E JR NZ,ShipMovement_CheckKeyboard
The control method is the AGF joystick, so test for "left" being pressed.
6F20 LD A,$F7 Read from the keyboard;
Port Number Bit
0 1 2 3 4
F7 1 2 3 4 5
6F22 IN A,($FE)
6F24 BIT 4,A Jump to Handler_MoveShip_Left if "left" ("5") is being pressed.
6F26 JR Z,Handler_MoveShip_Left
Now test for "right" being pressed.
6F28 LD A,$EF Read from the keyboard;
Port Number Bit
0 1 2 3 4
EF 0 9 8 7 6
6F2A IN A,($FE)
6F2C BIT 2,A Jump to Handler_MoveShip_Right if "right" ("8") is being pressed.
6F2E JP Z,Handler_MoveShip_Right
6F31 JR Ship_NoMovement Jump to Ship_NoMovement.
Else, the only control option left is the keyboard.
ShipMovement_CheckKeyboard 6F33 LD A,$FE Read from the keyboard;
Port Number Bit
0 1 2 3 4
FE SHIFT Z X C V
6F35 IN A,($FE)
The demo mode handler also lands here, and just checks the bits of the given random number rather than actual key presses.
Ship_DemoMovement 6F37 BIT 0,A Jump to Handler_MoveShip_Left if "SHIFT" is being pressed.
6F39 JR Z,Handler_MoveShip_Left
6F3B BIT 1,A Jump to Handler_MoveShip_Right if "Z" is being pressed.
6F3D JP Z,Handler_MoveShip_Right
Handle when there's been no movement.
Ship_NoMovement 6F40 POP AF Restore the player position from the stack.
6F41 JR Handler_UpdateShipPosition Jump to Handler_UpdateShipPosition.
Prev: 6DCF Up: Map Next: 6F43