![]() |
Routines |
| Prev: 43441 | Up: Map | Next: 43587 |
|
The update routine for the remote control robot (objects 124 to 127). The pads at HandleRemoteControlArrow and HandleRemoteControlBlock leave a command in RemoteControlCommand: bit 7 says a robot is listening, and bits 0 to 5 hold the command. The first robot to be updated claims bit 7 of RemoteControlCommand and bit 7 of IX+16. When a command arrives it sets bit 6 instead and follows the pad until it is released.
|
||||||||
|
See whether this robot is listening or following.
|
||||||||
| HandleRemoteControlRobot | 43463 | CALL SetPixelAdjustments | Call SetPixelAdjustments. | |||||
| 43466 | LD HL,23362 | Point HL at RemoteControlCommand. | ||||||
| 43469 | LD A,(HL) | Fetch the command. | ||||||
| 43470 | AND %10000000 | Keep bit 7. | ||||||
| 43472 | JR Z,HandleRemoteControlRobot_BecomeListener | Jump to HandleRemoteControlRobot_BecomeListener if no robot is listening. | ||||||
| 43474 | LD A,(IX+16) | Fetch the state of this robot. | ||||||
| 43477 | AND %11000000 | Keep bits 6 and 7. | ||||||
| 43479 | JR Z,HandleRemoteControlRobot_Move | Jump to HandleRemoteControlRobot_Move if this robot is neither. | ||||||
| 43481 | BIT 7,(IX+16) | Jump to HandleRemoteControlRobot_Listening if this robot is listening. | ||||||
| 43485 | JR NZ,HandleRemoteControlRobot_Listening | |||||||
|
This robot is following the pad.
|
||||||||
| 43487 | LD A,(HL) | Fetch the command. | ||||||
| 43488 | AND %00111111 | Keep bits 0 to 5. | ||||||
| 43490 | JR NZ,HandleRemoteControlRobot_CarryOutCommand | Jump to HandleRemoteControlRobot_CarryOutCommand if there is a command. | ||||||
| 43492 | RES 7,(HL) | Reset bit 7 of RemoteControlCommand. | ||||||
| 43494 | RES 6,(IX+16) | Reset bit 6 of the state. | ||||||
| 43498 | XOR A | Write 0. | ||||||
| 43499 | LD (IX+9),A | Stop the speed along the x axis. | ||||||
| 43502 | LD (IX+10),A | Stop the speed along the y axis. | ||||||
|
Move the robot and redraw it if it is moving.
|
||||||||
| HandleRemoteControlRobot_Move | 43505 | CALL ApplyGravityAndMove | Call ApplyGravityAndMove. | |||||
| 43508 | CALL TestObjectMoving | Return if the robot is not moving. | ||||||
| 43511 | RET Z | |||||||
| 43512 | CALL PlaySoundFromHeight | Call PlaySoundFromHeight. | ||||||
| 43515 | JP SetWipeAndDrawFlags | Jump to SetWipeAndDrawFlags. | ||||||
|
Make this robot the listener.
|
||||||||
| HandleRemoteControlRobot_BecomeListener | 43518 | SET 7,(HL) | Set bit 7 of RemoteControlCommand. | |||||
| 43520 | SET 7,(IX+16) | Set bit 7 of the state. | ||||||
| 43524 | JR HandleRemoteControlRobot_Move | Jump to HandleRemoteControlRobot_Move. | ||||||
|
This robot is listening.
|
||||||||
| HandleRemoteControlRobot_Listening | 43526 | LD A,(HL) | Fetch the command. | |||||
| 43527 | AND %01111111 | Keep bits 0 to 6. | ||||||
| 43529 | JR Z,HandleRemoteControlRobot_Move | Jump to HandleRemoteControlRobot_Move if there is no command. | ||||||
| 43531 | LD A,(IX+16) | Fetch the state of this robot. | ||||||
| 43534 | AND %00111111 | Keep bits 0 to 5. | ||||||
| 43536 | OR %01000000 | Set bit 6. | ||||||
| 43538 | LD (IX+16),A | Store the state. | ||||||
|
Carry out a command from RemoteControlRobotSpeeds.
|
||||||||
| HandleRemoteControlRobot_CarryOutCommand | 43541 | LD A,(HL) | Fetch the command. | |||||
| 43542 | LD (HL),128 | Set RemoteControlCommand to 128. | ||||||
| 43544 | DEC A | Take one off the command. | ||||||
| 43545 | RLCA | Double it. | ||||||
| 43546 | AND %01111110 | Keep bits 1 to 6. | ||||||
| 43548 | LD HL,43587 | Point HL at RemoteControlRobotSpeeds. | ||||||
| 43551 | CALL AddAToHL | Call AddAToHL. | ||||||
| 43554 | LD A,(HL) | Fetch the speed along the x axis. | ||||||
| 43555 | INC HL | Move on to the speed along the y axis. | ||||||
| 43556 | LD (IX+9),A | Set the speed along the x axis. | ||||||
| 43559 | LD A,(HL) | Fetch the speed along the y axis. | ||||||
| 43560 | DEC HL | Move HL back. | ||||||
| 43561 | LD (IX+10),A | Set the speed along the y axis. | ||||||
| 43564 | CALL NextSpriteNumber | Call NextSpriteNumber. | ||||||
| 43567 | LD A,(IX+9) | Jump to HandleRemoteControlRobot_PlaySound if the robot is not moving. | ||||||
| 43570 | OR (IX+10) | |||||||
| 43573 | JR Z,HandleRemoteControlRobot_PlaySound | |||||||
| 43575 | CALL ApplyGravityAndMove | Call ApplyGravityAndMove. | ||||||
| HandleRemoteControlRobot_PlaySound | 43578 | LD HL,46761 | Point HL at MovingSoundLengths. | |||||
| 43581 | CALL PlayMovingSound | Call PlayMovingSound. | ||||||
| 43584 | JP SetWipeAndDrawFlags | Jump to SetWipeAndDrawFlags. | ||||||
| Prev: 43441 | Up: Map | Next: 43587 |