![]() |
Routines |
| Prev: BFE3 | Up: Map | Next: C0E6 |
|
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 | C032 | PUSH IX | Stash IX on the stack. | |||||
| C034 | LD B,$06 | B=06. | ||||||
| UpdateStarLayer_Loop | C036 | CALL ResetSprites | Call ResetSprites. | |||||
| C039 | LD ($CCBC),A | Update the star flags. | ||||||
| C03C | PUSH BC | Stash BC on the stack. | ||||||
| C03D | PUSH IX | Stash IX on the stack. | ||||||
| C03F | LD HL,($C0E8) | Fetch the word at C0E8 into HL. | ||||||
| C042 | BIT 0,(HL) | Jump to UpdateStarLayer_Erased if bit 0 of the byte at the address in HL is clear. | ||||||
| C044 | JR Z,UpdateStarLayer_Erased | |||||||
| C046 | LD BC,$0006 | BC=06. | ||||||
| C049 | LD HL,($C0E6) | Fetch the word at StarVariables into HL. | ||||||
| C04C | ADD HL,BC | HL gains BC. | ||||||
| C04D | LD DE,($C0E8) | Fetch the word at C0E8 into DE. | ||||||
| C051 | LD A,(DE) | Read DE. | ||||||
| C052 | AND %11111110 | Keep the bits of A that are set in FE. | ||||||
| C054 | ADD A,(HL) | Add the byte at HL to A. | ||||||
| C055 | LD ($A1D3),A | Update the sprite positions. | ||||||
| C058 | INC HL | Advance HL. | ||||||
| C059 | INC DE | Advance DE. | ||||||
| C05A | LD A,(DE) | Read DE. | ||||||
| C05B | ADD A,(HL) | Add the byte at HL to A. | ||||||
| C05C | LD ($A1D4),A | The star's vertical position. | ||||||
| C05F | LD A,($CCBC) | The star flags. | ||||||
| C062 | OR %00000001 | Set the bits of A that are set in 01. | ||||||
| C064 | LD ($CCBC),A | Update the star flags. | ||||||
| C067 | JR UpdateStarLayer_Update2 | Jump to UpdateStarLayer_Update2. | ||||||
| UpdateStarLayer_Erased | C069 | JR UpdateStarLayer_Draw | Jump to UpdateStarLayer_Draw. | |||||
| UpdateStarLayer_Update2 | C06B | LD A,($A1D3) | The sprite positions. | |||||
| C06E | AND %00000001 | Keep the bits of A that are set in 01. | ||||||
| C070 | ADD A,(IX+$01) | Add the byte at offset 01 of IX to A. | ||||||
| C073 | LD (IX+$00),A | Write A to offset 00 of IX. | ||||||
| C076 | LD A,($A1D3) | The sprite positions. | ||||||
| C079 | AND %11111110 | Keep the bits of A that are set in FE. | ||||||
| C07B | LD ($A1D3),A | Update the sprite positions. | ||||||
| C07E | CALL FetchObjectFrameTable | Call FetchObjectFrameTable. | ||||||
| C081 | CALL ClipFirstSprite | Call ClipFirstSprite. | ||||||
| C084 | CALL SelectEraseSprite | Call SelectEraseSprite. | ||||||
| UpdateStarLayer_Draw | C087 | EXX | Switch to the alternate registers. | |||||
| C088 | CALL CheckStarPosition | Call CheckStarPosition. | ||||||
| C08B | JR NZ,UpdateStarLayer_Visible | Jump to UpdateStarLayer_Visible if the zero flag is clear. | ||||||
| C08D | LD HL,($C0E8) | Fetch the word at C0E8 into HL. | ||||||
| C090 | RES 0,(HL) | Reset bit 0 of the byte at the address in HL. | ||||||
| C092 | JR UpdateStarLayer_Update | Jump to UpdateStarLayer_Update. | ||||||
| UpdateStarLayer_Visible | C094 | LD HL,($C0E8) | Fetch the word at C0E8 into HL. | |||||
| C097 | SET 0,(HL) | Set bit 0 of the byte at the address in HL. | ||||||
| C099 | LD A,($A1D5) | The star's horizontal position. | ||||||
| C09C | AND %00000001 | Keep the bits of A that are set in 01. | ||||||
| C09E | ADD A,(IX+$01) | Add the byte at offset 01 of IX to A. | ||||||
| C0A1 | LD (IX+$00),A | Write A to offset 00 of IX. | ||||||
| C0A4 | LD A,($A1D5) | The star's horizontal position. | ||||||
| C0A7 | AND %11111110 | Keep the bits of A that are set in FE. | ||||||
| C0A9 | LD ($A1D5),A | The star's horizontal position. | ||||||
| C0AC | CALL FetchObjectFrameTable | Call FetchObjectFrameTable. | ||||||
| C0AF | CALL ClipSecondSprite | Call ClipSecondSprite. | ||||||
| C0B2 | CALL SelectDrawSprite | Call SelectDrawSprite. | ||||||
| UpdateStarLayer_Update | C0B5 | LD A,($CCBC) | The star flags. | |||||
| C0B8 | AND A | Jump to UpdateStarLayer_Next if A is zero. | ||||||
| C0B9 | JR Z,UpdateStarLayer_Next | |||||||
| C0BB | CALL DrawSprites | Call DrawSprites. | ||||||
| C0BE | LD HL,($A1D5) | Fetch the word at A1D5 into HL. | ||||||
| C0C1 | CALL AttributeAddress | Call AttributeAddress. | ||||||
| C0C4 | LD (HL),$47 | Store 47 at the address in HL. | ||||||
| UpdateStarLayer_Next | C0C6 | LD DE,($C0E8) | Fetch the word at C0E8 into DE. | |||||
| C0CA | INC DE | Advance DE. | ||||||
| C0CB | INC DE | Advance DE. | ||||||
| C0CC | LD ($C0E8),DE | The address of the next star's position. | ||||||
| C0D0 | POP IX | Bring IX back off the stack. | ||||||
| C0D2 | POP BC | Bring BC back off the stack. | ||||||
| C0D3 | DEC B | Step B back. | ||||||
| C0D4 | JP NZ,UpdateStarLayer_Loop | Jump to UpdateStarLayer_Loop if the zero flag is clear. | ||||||
| C0D7 | POP IX | Bring IX back off the stack. | ||||||
| C0D9 | INC IX | Advance IX. | ||||||
| C0DB | INC IX | Advance IX. | ||||||
| C0DD | LD HL,($C0E6) | Fetch the word at StarVariables into HL. | ||||||
| C0E0 | INC HL | Advance HL. | ||||||
| C0E1 | INC HL | Advance HL. | ||||||
| C0E2 | LD ($C0E6),HL | The address of the next star's offset. | ||||||
| C0E5 | RET | Return. | ||||||
| Prev: BFE3 | Up: Map | Next: C0E6 |