![]() |
Routines |
| Prev: 9ECA | Up: Map | Next: 9F5E |
|
Advance the moon rover animation from Jetman_Position, then colour the cab and flash the HUD tile chosen by Handler_Missile.
|
||||||||
| Handler_RoverFrames | 9EDC | LD A,($607A) | Fetch Jetman_Position. | |||||
| 9EDF | SUB (IX+$02) | Subtract the rover world X. | ||||||
| 9EE2 | NEG | Negate the difference. | ||||||
|
The rover has eight frames of animation.
|
||||||||
| 9EE4 | AND %00000111 | Keep only bits 0-2. | ||||||
|
Sprite IDs begin at 22 ("Lunar Rover: Right Frame 1").
|
||||||||
| 9EE6 | ADD A,$22 | Add 22 for the rover frames. | ||||||
| 9EE8 | LD (IX+$00),A | Write it to the actor type. | ||||||
| 9EEB | CALL DrawActorSprite | Call DrawActorSprite. | ||||||
|
While PlayerInactive is set, count it up and tint the rover from it.
|
||||||||
| Handler_RoverFrames_TestInactive | 9EEE | LD A,($5E6C) | Fetch PlayerInactive. | |||||
| 9EF1 | AND A | Jump to Handler_RoverFrames_Address if it is zero. | ||||||
| 9EF2 | JR Z,Handler_RoverFrames_Address | |||||||
| 9EF4 | INC A | Increase PlayerInactive by one. | ||||||
| 9EF5 | LD ($5E6C),A | Write it back. | ||||||
| 9EF8 | JR Handler_RoverFrames_Tint | Jump to Handler_RoverFrames_Tint. | ||||||
|
Fill attribute cells at the rover's position when SpriteWidth is not zero.
|
||||||||
| Handler_RoverFrames_Address | 9EFA | LD L,(IX+$01) | Fetch the rover screen column. | |||||
| 9EFD | LD H,(IX+$04) | Fetch the rover Y. | ||||||
| 9F00 | CALL AttributeAddress | Call AttributeAddress. | ||||||
| 9F03 | LD A,($5E57) | Fetch SpriteWidth. | ||||||
| 9F06 | AND A | Jump to Handler_RoverFrames_MissileBanner if it is zero. | ||||||
| 9F07 | JR Z,Handler_RoverFrames_MissileBanner | |||||||
|
Fill two rows of the rover's attribute cells with INK:WHITE, PAPER:BLACK (BRIGHT), then the two rows above them with INK:CYAN, PAPER:BLACK (BRIGHT). Cells that are empty are left alone.
|
||||||||
| 9F09 | LD B,A | Set the number of columns to fill in B from SpriteWidth. | ||||||
| 9F0A | LD C,$02 | Set the number of rows to fill in C to 02. | ||||||
| 9F0C | LD D,$47 | Set the fill attribute in D to INK:WHITE, PAPER:BLACK (BRIGHT). | ||||||
| 9F0E | CALL FillAttributeRow | Call FillAttributeRow to fill the first two rows. | ||||||
|
FillAttributeRow leaves HL one row above the last row it filled, so the next call carries on from there.
|
||||||||
| 9F11 | LD D,$45 | Set the fill attribute in D to INK:CYAN, PAPER:BLACK (BRIGHT). | ||||||
| 9F13 | LD C,$02 | Set the number of rows to fill in C to 02. | ||||||
| 9F15 | CALL FillAttributeRow | Call FillAttributeRow to fill the next two rows up. | ||||||
|
Flash one of the two HUD tiles, chosen by Handler_Missile.
|
||||||||
| Handler_RoverFrames_MissileBanner | 9F18 | CALL Handler_Missile | Call Handler_Missile. | |||||
| 9F1B | JR NC,Handler_RoverFrames_ClearBanner | Jump to Handler_RoverFrames_ClearBanner if Handler_Missile returned no carry. | ||||||
|
The carry is set, so flash the first tile (5861) and set the second tile (5863) to a steady colour.
|
||||||||
| 9F1D | CALL FlashAttribute | Call FlashAttribute to fetch the flashing attribute. | ||||||
| 9F20 | LD HL,$5861 | Point HL at the first HUD tile (5861). | ||||||
| 9F23 | CALL Handler_Colour2x2 | Call Handler_Colour2x2 to colour the tile with A. | ||||||
| 9F26 | LD HL,$5863 | Point HL at the second HUD tile (5863). | ||||||
| 9F29 | LD A,$42 | Set the steady attribute in A to INK:RED, PAPER:BLACK (BRIGHT). | ||||||
| 9F2B | JP Handler_Colour2x2 | Jump to Handler_Colour2x2 to colour the tile with A. | ||||||
|
There is no carry, so flash the second tile (5863) and set the first tile (5861) to a steady colour.
|
||||||||
| Handler_RoverFrames_ClearBanner | 9F2E | CALL FlashAttribute | Call FlashAttribute to fetch the flashing attribute. | |||||
| 9F31 | LD HL,$5863 | Point HL at the second HUD tile (5863). | ||||||
| 9F34 | CALL Handler_Colour2x2 | Call Handler_Colour2x2 to colour the tile with A. | ||||||
| 9F37 | LD HL,$5861 | Point HL at the first HUD tile (5861). | ||||||
| 9F3A | LD A,$42 | Set the steady attribute in A to INK:RED, PAPER:BLACK (BRIGHT). | ||||||
| 9F3C | JP Handler_Colour2x2 | Jump to Handler_Colour2x2 to colour the tile with A. | ||||||
|
Tint the rover from the frame value in A.
|
||||||||
| Handler_RoverFrames_Tint | 9F3F | CP $30 | Compare A against 30. | |||||
| 9F41 | JP NC,Handler_Missile_FallingDebris | Jump to Handler_Missile_FallingDebris if it is at least 30. | ||||||
|
Use bits 1-3 of the value as the INK colour, stepping through the colours as it counts up.
|
||||||||
| 9F44 | RRCA | Rotate it right once. | ||||||
| 9F45 | AND %00000111 | Keep only bits 0-2. | ||||||
| 9F47 | JR NZ,Handler_RoverFrames_WriteColour | Jump to Handler_RoverFrames_WriteColour if the result is not zero. | ||||||
|
The PAPER is black, so INK 00 would make the rover black on black and invisible. Use INK 01 (blue) as the lowest colour instead.
|
||||||||
| 9F49 | INC A | Increase it to 01. | ||||||
| Handler_RoverFrames_WriteColour | 9F4A | OR %01000000 | Set bit 6. | |||||
| 9F4C | LD (IX+$07),A | Write it to the rover colour. | ||||||
| 9F4F | CALL ColouriseSprite | Call ColouriseSprite. | ||||||
|
Play a tone derived from the rover colour.
|
||||||||
| 9F52 | LD A,(IX+$07) | Fetch the rover colour. | ||||||
| 9F55 | CPL | Invert the bits. | ||||||
| 9F56 | AND %01111111 | Keep only bits 0-6. | ||||||
| 9F58 | LD C,A | Copy the tone into C. | ||||||
| 9F59 | LD D,$20 | D=20. | ||||||
| 9F5B | JP PlayInvertedTone | Jump to PlayInvertedTone. | ||||||
| Prev: 9ECA | Up: Map | Next: 9F5E |