Prev: 49080 Up: Map Next: 49202
49123: Update Stars
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 49123 LD A,(52824) The map row.
49126 CP 4 Return if A is 4 or more.
49128 RET NC
49129 LD BC,6 BC=6.
49132 LD HL,49540 The star offsets.
49135 LD DE,49546 The second star offset.
49138 LDIR Copy BC bytes from HL to DE.
49140 LD B,3 B=3.
49142 LD IX,49540 The star offsets.
UpdateStars_Loop 49146 LD HL,(52410) Fetch the word at VerticalSpeed into HL.
49149 CALL ScaleScrollSpeed Call ScaleScrollSpeed.
49152 LD A,H A=H.
49153 ADD A,(IX+0) Add the byte at offset 0 of IX to A.
49156 LD (IX+0),A Write A to offset 0 of IX.
49159 LD H,L H=L.
49160 INC IX Advance IX.
49162 CALL ScaleScrollSpeed Call ScaleScrollSpeed.
49165 LD A,H A=H.
49166 ADD A,(IX+0) Add the byte at offset 0 of IX to A.
49169 LD (IX+0),A Write A to offset 0 of IX.
49172 INC IX Advance IX.
49174 DJNZ UpdateStars_Loop Decrease B and jump to UpdateStars_Loop until none remain.
UpdateStars_Draw 49176 LD HL,49386 The star positions.
49179 LD (49384),HL The address of the star's position.
49182 LD IX,49571 The star layer types.
49186 LD HL,49540 The star offsets.
49189 LD (49382),HL The address of the star's offset.
49192 LD B,3 B=3.
UpdateStars_Layer 49194 PUSH BC Stash BC on the stack.
49195 CALL UpdateStarLayer Call UpdateStarLayer.
49198 POP BC Bring BC back off the stack.
49199 DJNZ UpdateStars_Layer Decrease B and jump to UpdateStars_Layer until none remain.
49201 RET Return.
Prev: 49080 Up: Map Next: 49202