![]() |
Routines |
| Prev: BFB8 | Up: Map | Next: C032 |
|
Used by the routine at ScrollWorld.
Moves and draws the stars in the sky, in three layers of six stars. Only does anything when the ship is in one of the four zones at the top of the planet. The stars in the nearer layers move faster than the ones in the further layers when the screen scrolls, and are bigger. This is a best reading of the code.
|
||||
| UpdateStars | BFE3 | LD A,($CE58) | The map row. | |
| BFE6 | CP $04 | Return if A is 04 or more. | ||
| BFE8 | RET NC | |||
| BFE9 | LD BC,$0006 | BC=06. | ||
| BFEC | LD HL,$C184 | The star offsets. | ||
| BFEF | LD DE,$C18A | The second star offset. | ||
| BFF2 | LDIR | Copy BC bytes from HL to DE. | ||
| BFF4 | LD B,$03 | B=03. | ||
| BFF6 | LD IX,$C184 | The star offsets. | ||
| UpdateStars_Loop | BFFA | LD HL,($CCBA) | Fetch the word at VerticalSpeed into HL. | |
| BFFD | CALL ScaleScrollSpeed | Call ScaleScrollSpeed. | ||
| C000 | LD A,H | A=H. | ||
| C001 | ADD A,(IX+$00) | Add the byte at offset 00 of IX to A. | ||
| C004 | LD (IX+$00),A | Write A to offset 00 of IX. | ||
| C007 | LD H,L | H=L. | ||
| C008 | INC IX | Advance IX. | ||
| C00A | CALL ScaleScrollSpeed | Call ScaleScrollSpeed. | ||
| C00D | LD A,H | A=H. | ||
| C00E | ADD A,(IX+$00) | Add the byte at offset 00 of IX to A. | ||
| C011 | LD (IX+$00),A | Write A to offset 00 of IX. | ||
| C014 | INC IX | Advance IX. | ||
| C016 | DJNZ UpdateStars_Loop | Decrease B and jump to UpdateStars_Loop until none remain. | ||
| UpdateStars_Draw | C018 | LD HL,$C0EA | The star positions. | |
| C01B | LD ($C0E8),HL | The address of the star's position. | ||
| C01E | LD IX,$C1A3 | The star layer types. | ||
| C022 | LD HL,$C184 | The star offsets. | ||
| C025 | LD ($C0E6),HL | The address of the star's offset. | ||
| C028 | LD B,$03 | B=03. | ||
| UpdateStars_Layer | C02A | PUSH BC | Stash BC on the stack. | |
| C02B | CALL UpdateStarLayer | Call UpdateStarLayer. | ||
| C02E | POP BC | Bring BC back off the stack. | ||
| C02F | DJNZ UpdateStars_Layer | Decrease B and jump to UpdateStars_Layer until none remain. | ||
| C031 | RET | Return. | ||
| Prev: BFB8 | Up: Map | Next: C032 |