![]() |
Routines |
| Prev: 49123 | Up: Map | Next: 49382 |
|
Used by the routine at UpdateStars.
Erases and draws the six stars of one layer, from the positions in the table at StarPositions. A star is only drawn when it is on the screen, as decided by CheckStarPosition. Its attribute is set to bright white.
|
||||||||
| UpdateStarLayer | 49202 | PUSH IX | Stash IX on the stack. | |||||
| 49204 | LD B,6 | B=6. | ||||||
| UpdateStarLayer_Loop | 49206 | CALL ResetSprites | Call ResetSprites. | |||||
| 49209 | LD (52412),A | Update the star flags. | ||||||
| 49212 | PUSH BC | Stash BC on the stack. | ||||||
| 49213 | PUSH IX | Stash IX on the stack. | ||||||
| 49215 | LD HL,(49384) | Fetch the word at 49384 into HL. | ||||||
| 49218 | BIT 0,(HL) | Jump to UpdateStarLayer_Erased if bit 0 of the byte at the address in HL is clear. | ||||||
| 49220 | JR Z,UpdateStarLayer_Erased | |||||||
| 49222 | LD BC,6 | BC=6. | ||||||
| 49225 | LD HL,(49382) | Fetch the word at StarVariables into HL. | ||||||
| 49228 | ADD HL,BC | HL gains BC. | ||||||
| 49229 | LD DE,(49384) | Fetch the word at 49384 into DE. | ||||||
| 49233 | LD A,(DE) | Read DE. | ||||||
| 49234 | AND %11111110 | Keep the bits of A that are set in 254. | ||||||
| 49236 | ADD A,(HL) | Add the byte at HL to A. | ||||||
| 49237 | LD (41427),A | Update the sprite positions. | ||||||
| 49240 | INC HL | Advance HL. | ||||||
| 49241 | INC DE | Advance DE. | ||||||
| 49242 | LD A,(DE) | Read DE. | ||||||
| 49243 | ADD A,(HL) | Add the byte at HL to A. | ||||||
| 49244 | LD (41428),A | The star's vertical position. | ||||||
| 49247 | LD A,(52412) | The star flags. | ||||||
| 49250 | OR %00000001 | Set the bits of A that are set in 1. | ||||||
| 49252 | LD (52412),A | Update the star flags. | ||||||
| 49255 | JR UpdateStarLayer_Update2 | Jump to UpdateStarLayer_Update2. | ||||||
| UpdateStarLayer_Erased | 49257 | JR UpdateStarLayer_Draw | Jump to UpdateStarLayer_Draw. | |||||
| UpdateStarLayer_Update2 | 49259 | LD A,(41427) | The sprite positions. | |||||
| 49262 | AND %00000001 | Keep the bits of A that are set in 1. | ||||||
| 49264 | ADD A,(IX+1) | Add the byte at offset 1 of IX to A. | ||||||
| 49267 | LD (IX+0),A | Write A to offset 0 of IX. | ||||||
| 49270 | LD A,(41427) | The sprite positions. | ||||||
| 49273 | AND %11111110 | Keep the bits of A that are set in 254. | ||||||
| 49275 | LD (41427),A | Update the sprite positions. | ||||||
| 49278 | CALL FetchObjectFrameTable | Call FetchObjectFrameTable. | ||||||
| 49281 | CALL ClipFirstSprite | Call ClipFirstSprite. | ||||||
| 49284 | CALL SelectEraseSprite | Call SelectEraseSprite. | ||||||
| UpdateStarLayer_Draw | 49287 | EXX | Switch to the alternate registers. | |||||
| 49288 | CALL CheckStarPosition | Call CheckStarPosition. | ||||||
| 49291 | JR NZ,UpdateStarLayer_Visible | Jump to UpdateStarLayer_Visible if the zero flag is clear. | ||||||
| 49293 | LD HL,(49384) | Fetch the word at 49384 into HL. | ||||||
| 49296 | RES 0,(HL) | Reset bit 0 of the byte at the address in HL. | ||||||
| 49298 | JR UpdateStarLayer_Update | Jump to UpdateStarLayer_Update. | ||||||
| UpdateStarLayer_Visible | 49300 | LD HL,(49384) | Fetch the word at 49384 into HL. | |||||
| 49303 | SET 0,(HL) | Set bit 0 of the byte at the address in HL. | ||||||
| 49305 | LD A,(41429) | The star's horizontal position. | ||||||
| 49308 | AND %00000001 | Keep the bits of A that are set in 1. | ||||||
| 49310 | ADD A,(IX+1) | Add the byte at offset 1 of IX to A. | ||||||
| 49313 | LD (IX+0),A | Write A to offset 0 of IX. | ||||||
| 49316 | LD A,(41429) | The star's horizontal position. | ||||||
| 49319 | AND %11111110 | Keep the bits of A that are set in 254. | ||||||
| 49321 | LD (41429),A | The star's horizontal position. | ||||||
| 49324 | CALL FetchObjectFrameTable | Call FetchObjectFrameTable. | ||||||
| 49327 | CALL ClipSecondSprite | Call ClipSecondSprite. | ||||||
| 49330 | CALL SelectDrawSprite | Call SelectDrawSprite. | ||||||
| UpdateStarLayer_Update | 49333 | LD A,(52412) | The star flags. | |||||
| 49336 | AND A | Jump to UpdateStarLayer_Next if A is zero. | ||||||
| 49337 | JR Z,UpdateStarLayer_Next | |||||||
| 49339 | CALL DrawSprites | Call DrawSprites. | ||||||
| 49342 | LD HL,(41429) | Fetch the word at 41429 into HL. | ||||||
| 49345 | CALL AttributeAddress | Call AttributeAddress. | ||||||
| 49348 | LD (HL),71 | Store 71 at the address in HL. | ||||||
| UpdateStarLayer_Next | 49350 | LD DE,(49384) | Fetch the word at 49384 into DE. | |||||
| 49354 | INC DE | Advance DE. | ||||||
| 49355 | INC DE | Advance DE. | ||||||
| 49356 | LD (49384),DE | The address of the next star's position. | ||||||
| 49360 | POP IX | Bring IX back off the stack. | ||||||
| 49362 | POP BC | Bring BC back off the stack. | ||||||
| 49363 | DEC B | Step B back. | ||||||
| 49364 | JP NZ,UpdateStarLayer_Loop | Jump to UpdateStarLayer_Loop if the zero flag is clear. | ||||||
| 49367 | POP IX | Bring IX back off the stack. | ||||||
| 49369 | INC IX | Advance IX. | ||||||
| 49371 | INC IX | Advance IX. | ||||||
| 49373 | LD HL,(49382) | Fetch the word at StarVariables into HL. | ||||||
| 49376 | INC HL | Advance HL. | ||||||
| 49377 | INC HL | Advance HL. | ||||||
| 49378 | LD (49382),HL | The address of the next star's offset. | ||||||
| 49381 | RET | Return. | ||||||
| Prev: 49123 | Up: Map | Next: 49382 |