![]() |
Routines |
| Prev: 9994 | Up: Map | Next: 9AE2 |
|
Drift the Saturn toward the scroll position and aim it at Jetman.
|
||||||||
| Handler_Saturn | 9A2F | LD HL,$5E5E | HL=AlienCount. | |||||
| 9A32 | INC (HL) | Increase AlienCount by one. | ||||||
|
Steer the horizontal speed toward the scroll position.
|
||||||||
| 9A33 | LD H,(IX+$03) | Fetch the high byte of the world X. | ||||||
| 9A36 | LD L,(IX+$02) | Fetch the low byte of the world X. | ||||||
| 9A39 | LD DE,($607A) | Fetch Jetman_Position. | ||||||
| 9A3D | AND A | Subtract the scroll position. | ||||||
| 9A3E | SBC HL,DE | |||||||
| 9A40 | BIT 4,H | Jump to Handler_Saturn_DriftRight if the alien is left of the scroll. | ||||||
| 9A42 | JP NZ,Handler_Saturn_DriftRight | |||||||
|
Speed the alien up towards the left, up to a limit.
|
||||||||
| 9A45 | LD C,$00 | C=00. | ||||||
| 9A47 | LD A,(IX+$05) | Jump to Handler_Saturn_Decelerate if the horizontal speed is positive. | ||||||
| 9A4A | AND A | |||||||
| 9A4B | JP P,Handler_Saturn_Decelerate | |||||||
| 9A4E | CP $B1 | Jump to Handler_Saturn_WriteSpeed if the speed is already below B1. | ||||||
| 9A50 | JR C,Handler_Saturn_WriteSpeed | |||||||
| Handler_Saturn_Decelerate | 9A52 | SUB $02 | Subtract 02 from the speed. | |||||
| Handler_Saturn_WriteSpeed | 9A54 | LD (IX+$05),A | Write the speed back. | |||||
|
Pick a target height from Jetman's position and steer the vertical thrust toward it.
|
||||||||
| 9A57 | LD A,($6078) | Fetch the Jetman type from Jetman_Slot. | ||||||
| 9A5A | CP $11 | Jump to Handler_Saturn_FetchJetmanY if Jetman is on foot. | ||||||
| 9A5C | JR C,Handler_Saturn_FetchJetmanY | |||||||
| 9A5E | LD A,$68 | A=68. | ||||||
| 9A60 | JR Handler_Saturn_CompareY | Jump to Handler_Saturn_CompareY. | ||||||
| Handler_Saturn_FetchJetmanY | 9A62 | LD A,($607C) | Fetch Jetman_Y. | |||||
|
Compare with the alien's Y position and, if the alien is above the target, increase the downward thrust, up to a limit.
|
||||||||
| Handler_Saturn_CompareY | 9A65 | SUB (IX+$04) | Subtract the alien's Y position. | |||||
| 9A68 | JP M,Handler_Saturn_ApplyUpThrust | Jump to Handler_Saturn_ApplyUpThrust if the alien is below the target. | ||||||
| 9A6B | LD A,(IX+$06) | Jump to Handler_Saturn_AddThrust if the vertical thrust is negative. | ||||||
| 9A6E | AND A | |||||||
| 9A6F | JP M,Handler_Saturn_AddThrust | |||||||
| 9A72 | CP $40 | Jump to Handler_Saturn_ApplyThrust if the thrust is already at least 40. | ||||||
| 9A74 | JR NC,Handler_Saturn_ApplyThrust | |||||||
| Handler_Saturn_AddThrust | 9A76 | ADD A,$02 | Add 02 to the thrust. | |||||
|
Apply the thrust to the Y position, bouncing off the play-area edges.
|
||||||||
| Handler_Saturn_ApplyThrust | 9A78 | LD (IX+$06),A | Write the thrust back. | |||||
| 9A7B | SRA A | Divide it by 10. | ||||||
| 9A7D | SRA A | |||||||
| 9A7F | SRA A | |||||||
| 9A81 | SRA A | |||||||
| 9A83 | ADD A,(IX+$04) | Add it to the alien's Y position. | ||||||
| 9A86 | CP $38 | Jump to Handler_Saturn_BounceTop if the alien is above the play area. | ||||||
| 9A88 | JR C,Handler_Saturn_BounceTop | |||||||
| 9A8A | CP $B0 | Jump to Handler_Saturn_BounceGround if the alien has hit the ground line. | ||||||
| 9A8C | JR NC,Handler_Saturn_BounceGround | |||||||
| 9A8E | LD (IX+$04),A | Write the Y position back. | ||||||
|
Pick the animation frame and colour.
|
||||||||
| Handler_Saturn_Animate | 9A91 | INC (IX+$11) | Increase the animation timer. | |||||
| 9A94 | LD A,(IX+$11) | Fetch the animation timer. | ||||||
| 9A97 | AND %00001111 | Keep only bits 0-3. | ||||||
|
Sprite IDs begin at CC ("Saturn: Frame 1").
|
||||||||
| 9A99 | ADD A,$CC | Add CC for these frames. | ||||||
| 9A9B | LD (IX+$00),A | Write it to the actor type. | ||||||
|
Alternate the colour using bit 0 of GameTimer.
|
||||||||
| 9A9E | LD A,($5E42) | Fetch GameTimer. | ||||||
| 9AA1 | AND %00000001 | Keep only bit 0. | ||||||
| 9AA3 | ADD A,$45 | Add 45 for the colour. | ||||||
| 9AA5 | LD (IX+$07),A | Write it to the actor colour. | ||||||
| 9AA8 | JP PlaceSpawnedAlien_Age | Jump to PlaceSpawnedAlien_Age. | ||||||
|
When the alien is left of the scroll, drift right.
|
||||||||
| Handler_Saturn_DriftRight | 9AAB | LD C,$80 | C=80. | |||||
| 9AAD | LD A,(IX+$05) | Jump to Handler_Saturn_AddSpeed if the horizontal speed is negative. | ||||||
| 9AB0 | AND A | |||||||
| 9AB1 | JP M,Handler_Saturn_AddSpeed | |||||||
| 9AB4 | CP $50 | Jump to Handler_Saturn_WriteSpeed if the speed is already at least 50. | ||||||
| 9AB6 | JR NC,Handler_Saturn_WriteSpeed | |||||||
| Handler_Saturn_AddSpeed | 9AB8 | ADD A,$02 | Add 02 to the speed. | |||||
| 9ABA | JR Handler_Saturn_WriteSpeed | Jump to Handler_Saturn_WriteSpeed. | ||||||
|
When the alien is below the target, apply upward thrust.
|
||||||||
| Handler_Saturn_ApplyUpThrust | 9ABC | LD A,(IX+$06) | Jump to Handler_Saturn_SubtractThrust if the vertical thrust is positive. | |||||
| 9ABF | AND A | |||||||
| 9AC0 | JP P,Handler_Saturn_SubtractThrust | |||||||
| 9AC3 | CP $C1 | Jump to Handler_Saturn_ApplyThrust if the thrust is already below C1. | ||||||
| 9AC5 | JR C,Handler_Saturn_ApplyThrust | |||||||
| Handler_Saturn_SubtractThrust | 9AC7 | SUB $02 | Subtract 02 from the thrust. | |||||
| 9AC9 | JR Handler_Saturn_ApplyThrust | Jump to Handler_Saturn_ApplyThrust. | ||||||
|
Bounce off the top of the play area.
|
||||||||
| Handler_Saturn_BounceTop | 9ACB | LD A,(IX+$06) | Jump to Handler_Saturn_Animate if the vertical thrust is positive. | |||||
| 9ACE | AND A | |||||||
| 9ACF | JP P,Handler_Saturn_Animate | |||||||
| Handler_Saturn_NegateThrust | 9AD2 | NEG | Negate the thrust. | |||||
| 9AD4 | LD (IX+$06),A | Write it back. | ||||||
| 9AD7 | JR Handler_Saturn_Animate | Jump to Handler_Saturn_Animate. | ||||||
|
Bounce off the ground line.
|
||||||||
| Handler_Saturn_BounceGround | 9AD9 | LD A,(IX+$06) | Jump to Handler_Saturn_Animate if the vertical thrust is negative. | |||||
| 9ADC | AND A | |||||||
| 9ADD | JP M,Handler_Saturn_Animate | |||||||
| 9AE0 | JR Handler_Saturn_NegateThrust | Jump to Handler_Saturn_NegateThrust. | ||||||
| Prev: 9994 | Up: Map | Next: 9AE2 |