Prev: 28111 Up: Map Next: 28483
28408: Handler: Ship Movement
Used by the routine at Handler_Shield.
Handler_ShipMovement 28408 LD H,80 Set H to 80 (screen buffer base).
28410 LD A,(26355) Jump to ShipMovement_CheckKempston if *Flag_ActiveDemoMode is active.
28413 OR A
28414 JR Z,ShipMovement_CheckKempston
28416 LD A,(26356) A=*Movement_DemoMode.
28419 JR Ship_DemoMovement Jump to Ship_DemoMovement.
Check if the control method is the Kempston joystick?
ShipMovement_CheckKempston 28421 DI Disable interrupts.
The control method is Kempston joystick, so test for "left" or "right" being pressed.
28422 LD A,(26358) Jump to ShipMovement_CheckAGF if *ControlMethod is not the Kempston joystick.
28425 CP 2
28427 JR NZ,ShipMovement_CheckAGF
28429 IN A,(31) A=read from the Kempston joystick port.
28431 AND %00000011 Keep only bits 0-1 ("right" and "left").
28433 CP 2 Jump to Handler_MoveShip_Left if "left" is being pressed.
28435 JR Z,Handler_MoveShip_Left
28437 CP 1 Jump to Handler_MoveShip_Right if "right" is being pressed.
28439 JP Z,Handler_MoveShip_Right
28442 JR Ship_NoMovement Jump to Ship_NoMovement.
Check if the control method is the AGF joystick?
ShipMovement_CheckAGF 28444 CP 1 Jump to ShipMovement_CheckKeyboard if *ControlMethod is not the AGF joystick.
28446 JR NZ,ShipMovement_CheckKeyboard
The control method is the AGF joystick, so test for "left" being pressed.
28448 LD A,247 Read from the keyboard;
Port Number Bit
0 1 2 3 4
247 1 2 3 4 5
28450 IN A,(254)
28452 BIT 4,A Jump to Handler_MoveShip_Left if "left" ("5") is being pressed.
28454 JR Z,Handler_MoveShip_Left
Now test for "right" being pressed.
28456 LD A,239 Read from the keyboard;
Port Number Bit
0 1 2 3 4
239 0 9 8 7 6
28458 IN A,(254)
28460 BIT 2,A Jump to Handler_MoveShip_Right if "right" ("8") is being pressed.
28462 JP Z,Handler_MoveShip_Right
28465 JR Ship_NoMovement Jump to Ship_NoMovement.
Else, the only control option left is the keyboard.
ShipMovement_CheckKeyboard 28467 LD A,254 Read from the keyboard;
Port Number Bit
0 1 2 3 4
254 SHIFT Z X C V
28469 IN A,(254)
The demo mode handler also lands here, and just checks the bits of the given random number rather than actual key presses.
Ship_DemoMovement 28471 BIT 0,A Jump to Handler_MoveShip_Left if "SHIFT" is being pressed.
28473 JR Z,Handler_MoveShip_Left
28475 BIT 1,A Jump to Handler_MoveShip_Right if "Z" is being pressed.
28477 JP Z,Handler_MoveShip_Right
Handle when there's been no movement.
Ship_NoMovement 28480 POP AF Restore the player position from the stack.
28481 JR Handler_UpdateShipPosition Jump to Handler_UpdateShipPosition.
Prev: 28111 Up: Map Next: 28483