![]() |
Routines |
| Prev: A626 | Up: Map | Next: A6AE |
|
Used by the routine at MoveRobotHorizontally.
Fires a pellet, which is the second weapon of the robot. It is cheaper than a spark, as it only costs half a unit of energy.
|
||||||||||
| FireWeaponB | A656 | RES 3,A | Clear the flag that says that the second weapon has been fired... | |||||||
| A658 | LD ($9625),A | ...and store the controls. | ||||||||
| A65B | LD HL,$96A0 | Point HL at the first of the three entities that are used for shots. | ||||||||
| A65E | LD DE,$0010 | Each entity is 10 bytes long. | ||||||||
| A661 | LD BC,$0080 | Set the cost of the shot to 80... | ||||||||
| A664 | LD ($963F),BC | ...and store it. | ||||||||
| A668 | LD BC,$0330 | Use three entities, and use type 30 for the sprite. | ||||||||
| A66B | LD A,$07 | Use the lowest three bits of the type of the robot... | ||||||||
| A66D | LD ($A68A),A | ...to choose the sprite of the shot (this changes the mask used by the instruction at A689). | ||||||||
|
This entry point is used by the routine at FireWeaponA.
This entry point finds an entity that is not in use and starts a shot there.
|
||||||||||
| FireWeapon_Find | A670 | LD A,(HL) | Fetch the type of the entity. | |||||||
| A671 | AND A | Jump if it is not in use. | ||||||||
| A672 | JR Z,FireWeapon_Start | |||||||||
| A674 | ADD HL,DE | Move on to the next entity. | ||||||||
| A675 | DJNZ FireWeapon_Find | Loop back until all of them have been tried. | ||||||||
| A677 | RET | Return, as all are in use. | ||||||||
| FireWeapon_Start | A678 | PUSH HL | Save the address of the entity... | |||||||
| A679 | PUSH DE | ...and the size of an entity. | ||||||||
| A67A | LD DE,($963F) | Fetch the cost of the shot. | ||||||||
| A67E | CALL UseEnergy | Take it off the energy of the battery using UseEnergy. | ||||||||
| A681 | POP DE | Restore the size of an entity... | ||||||||
| A682 | POP HL | ...and the address of the entity. | ||||||||
| A683 | RET C | Return if there was not enough energy. | ||||||||
| A684 | LD A,(IX+$00) | Fetch the type of the robot... | ||||||||
| A687 | RRCA | ...divide it by two... | ||||||||
| A688 | LD B,A | ...and keep it in B. | ||||||||
| A689 | AND $07 | Keep the bits that choose the sprite (the mask is changed by the code above, from 07 to 03 for the first weapon)... | ||||||||
| A68B | OR C | ...and use them with the first sprite of the shot... | ||||||||
| A68C | LD (HL),A | ...as the type of the shot. | ||||||||
| A68D | INC HL | Move on to the X fraction of the shot. | ||||||||
| A68E | LD A,(IX+$01) | Copy the X fraction of the robot to the shot. | ||||||||
| A691 | LD (HL),A | |||||||||
| A692 | INC HL | Move on to the X cell of the shot. | ||||||||
| A693 | LD A,(IX+$02) | Copy the X cell of the robot to the shot. | ||||||||
| A696 | LD (HL),A | |||||||||
| A697 | INC HL | Move on to the Y fraction of the shot. | ||||||||
| A698 | LD A,(IX+$03) | Copy the Y fraction of the robot to the shot. | ||||||||
| A69B | LD (HL),A | |||||||||
| A69C | INC HL | Move on to the Y cell of the shot. | ||||||||
| A69D | LD A,(IX+$04) | Copy the Y cell of the robot to the shot. | ||||||||
| A6A0 | LD (HL),A | |||||||||
| A6A1 | INC HL | Move on to the byte that holds the direction and the range. | ||||||||
| A6A2 | INC HL | |||||||||
| A6A3 | INC HL | |||||||||
| A6A4 | LD A,B | Fetch the type of the robot, divided by two. | ||||||||
| A6A5 | RRCA | Divide it by two again... | ||||||||
| A6A6 | AND $03 | ...and keep the direction... | ||||||||
| A6A8 | OR $60 | ...together with the range of six cells. | ||||||||
| A6AA | LD (HL),A | Store them. | ||||||||
| A6AB | JP PlayNoiseSound | Jump to PlayNoiseSound. | ||||||||
| Prev: A626 | Up: Map | Next: A6AE |