Prev: B731 Up: Map Next: B833
B752: Launch Shot
Used by the routine at CheckSpecialShot.
Launches a shot, from the first free slot out of the four at ShotSlots. It faces the way the ship is facing and starts at the ship. Three kinds of shot can be launched: an ordinary one, a chasing shot if the ship has part 08 and the weapon toggle at WeaponToggle is one, and a special shot if bit 2 of the toggle is set.
LaunchShot B752 LD IX,$B37A The shot slots.
B756 LD A,$04 A=04.
LaunchShot_Slot B758 EX AF,AF' Switch to the alternate accumulator and flags.
B759 BIT 7,(IX+$16) Jump to LaunchShot_Check if bit 7 of offset 16 of IX is set.
B75D JR NZ,LaunchShot_Check
B75F LD A,(IX+$0B) Read offset 0B of IX.
B762 AND A Jump to LaunchShot_Free if A is zero.
B763 JR Z,LaunchShot_Free
LaunchShot_Check B765 LD A,(IX+$00) Read offset 00 of IX.
B768 INC A Advance A.
B769 JR NZ,LaunchShot_Next Jump to LaunchShot_Next if the zero flag is clear.
LaunchShot_Free B76B CALL FreeObjectSlot Call FreeObjectSlot.
B76E LD A,($C8FD) The ship's facing.
B771 LD (IX+$00),A Write A to offset 00 of IX.
B774 LD (IX+$0B),$99 Store 99 at offset 0B of IX.
B778 CALL StartShotAtShip Call StartShotAtShip.
B77B LD A,($B730) The weapon toggle.
B77E BIT 2,A Jump to LaunchShot_Special if bit 2 of A is set.
B780 JP NZ,LaunchShot_Special
B783 DEC A Step A back.
B784 JP Z,LaunchShot_Chasing Jump to LaunchShot_Chasing if the zero flag is set.
LaunchShot_Ordinary B787 CALL MoveObject Call MoveObject.
B78A LD (IX+$09),$00 Store 00 at offset 09 of IX.
B78E BIT 7,(IX+$15) Return if bit 7 of offset 15 of IX is set.
B792 RET NZ
B793 JP PlayShotSound Jump to PlayShotSound.
LaunchShot_Next B796 LD BC,$0018 BC=18.
B799 ADD IX,BC IX gains BC.
B79B EX AF,AF' Switch to the alternate accumulator and flags.
B79C DEC A Step A back.
B79D JR NZ,LaunchShot_Slot Jump to LaunchShot_Slot if the zero flag is clear.
B79F RET Return.
LaunchShot_Chasing B7A0 LD A,($F5F5) The eighth part, which makes a chasing shot.
B7A3 AND A Jump to LaunchShot_Ordinary if A is zero.
B7A4 JP Z,LaunchShot_Ordinary
B7A7 LD A,(IX+$07) Read offset 07 of IX.
B7AA CP $08 Jump to LaunchShot_Speed if A is 08.
B7AC JR Z,LaunchShot_Speed
B7AE LD (IX+$07),$20 Store 20 at offset 07 of IX.
LaunchShot_Speed B7B2 LD A,(IX+$09) Read offset 09 of IX.
B7B5 SUB $03 Subtract 03 from A.
B7B7 LD (IX+$09),A Write A to offset 09 of IX.
B7BA LD (IX+$08),$00 Store 00 at offset 08 of IX.
B7BE LD (IX+$0A),$00 Store 00 at offset 0A of IX.
B7C2 CALL MoveObject Call MoveObject.
B7C5 LD (IX+$09),$00 Store 00 at offset 09 of IX.
B7C9 LD (IX+$10),$27 Store 27 at offset 10 of IX.
B7CD LD A,(IX+$07) Read offset 07 of IX.
B7D0 LD (IX+$07),$08 Store 08 at offset 07 of IX.
B7D4 CP $20 Jump to LaunchShot_Set if A is 20.
B7D6 JR Z,LaunchShot_Set
B7D8 LD (IX+$07),$F8 Store F8 at offset 07 of IX.
LaunchShot_Set B7DC LD (IX+$00),$00 Store 00 at offset 00 of IX.
B7E0 LD (IX+$0D),$DD Store DD at offset 0D of IX.
B7E4 LD (IX+$15),$7F Store 7F at offset 15 of IX.
B7E8 LD (IX+$16),$80 Store 80 at offset 16 of IX.
B7EC CALL ClearShot Call ClearShot.
B7EF LD (IX+$17),$F0 Store F0 at offset 17 of IX.
B7F3 JP PlayShotSound Jump to PlayShotSound.
LaunchShot_Special B7F6 LD A,$80 A=80.
B7F8 LD (IX+$15),A Write A to offset 15 of IX.
B7FB LD ($B832),A A special shot has been launched.
B7FE LD (IX+$0D),$43 Store 43 at offset 0D of IX.
B802 LD A,($5C38) The ship row.
B805 ADD A,$09 Add 09 to A.
B807 LD (IX+$0C),A Write A to offset 0C of IX.
B80A LD A,(IX+$09) Read offset 09 of IX.
B80D ADD A,$09 Add 09 to A.
B80F LD (IX+$09),A Write A to offset 09 of IX.
B812 LD A,(IX+$07) Read offset 07 of IX.
B815 ADD A,$08 Add 08 to A.
B817 AND %00100000 Keep the bits of A that are set in 20.
B819 LD (IX+$07),A Write A to offset 07 of IX.
B81C LD (IX+$12),$F8 Store F8 at offset 12 of IX.
B820 LD (IX+$0B),$60 Store 60 at offset 0B of IX.
B824 JP Z,LaunchShot_Ordinary Jump to LaunchShot_Ordinary if the zero flag is set.
B827 LD (IX+$12),$08 Store 08 at offset 12 of IX.
B82B LD (IX+$0B),$90 Store 90 at offset 0B of IX.
B82F JP LaunchShot_Ordinary Jump to LaunchShot_Ordinary.
B832 NOP Do nothing.
Prev: B731 Up: Map Next: B833