![]() |
Routines |
Prev: 68AC | Up: Map | Next: 68E8 |
|
||||
RemoveSprites | 68AD | LD A,($781B) | Return if *ActiveSpriteBlocks is zero (no sprite blocks on the screen). | |
68B0 | AND A | |||
68B1 | RET Z | |||
Whilst this routine is clearing sprites, the data is stored per character block, e.g. a kangaroo may span 3 character blocks - and data is stored individually for each of those three blocks, so the count is +3 for a kangaroo (when it is covering those three blocks).
|
||||
68B2 | LD HL,($781C) | Load *SpriteBackgroundBuffer_Pointer into HL. | ||
68B5 | LD B,A | Set a counter in B of the number of character blocks needed to clear all the sprites. | ||
68B6 | LD C,$00 | Set a "clear" value (00) in C. | ||
RemoveSingleSpriteBlock_Loop | 68B8 | DEC HL | Load DE with the attribute buffer address of the sprite block. | |
68B9 | LD D,(HL) | |||
68BA | DEC HL | |||
68BB | LD E,(HL) | |||
68BC | DEC HL | Fetch the background attribute value. | ||
68BD | LD A,(HL) | |||
68BE | LD (DE),A | Write the background attribute value to the attribute buffer address held in DE. | ||
68BF | DEC HL | Move to next buffer entry. | ||
Convert the attribute address to the corresponding screen buffer address.
|
||||
68C0 | LD A,D | Taking the attribute buffer high byte, subtract 11. | ||
68C1 | SUB $11 | |||
68C3 | OR %00000111 | Adjust for the screen buffer memory layout. | ||
68C5 | LD D,A | Write this back into D. | ||
68C6 | EX DE,HL | Exchange the DE and HL registers. | ||
68C7 | LD (HL),C | Write C to *HL. | ||
68C8 | DEC H | Decrease H by one. | ||
68C9 | LD A,(DE) | A=*DE. | ||
68CA | LD (HL),A | Write A to *HL. | ||
68CB | DEC DE | Decrease DE by one. | ||
68CC | DEC H | Decrease H by one. | ||
68CD | LD (HL),C | Write C to *HL. | ||
68CE | DEC H | Decrease H by one. | ||
68CF | LD A,(DE) | A=*DE. | ||
68D0 | LD (HL),A | Write A to *HL. | ||
68D1 | DEC DE | Decrease DE by one. | ||
68D2 | DEC H | Decrease H by one. | ||
68D3 | LD (HL),C | Write C to *HL. | ||
68D4 | DEC H | Decrease H by one. | ||
68D5 | LD A,(DE) | A=*DE. | ||
68D6 | LD (HL),A | Write A to *HL. | ||
68D7 | DEC DE | Decrease DE by one. | ||
68D8 | DEC H | Decrease H by one. | ||
68D9 | LD (HL),C | Write C to *HL. | ||
68DA | DEC H | Decrease H by one. | ||
68DB | LD A,(DE) | A=*DE. | ||
68DC | LD (HL),A | Write A to *HL. | ||
68DD | EX DE,HL | Exchange the DE and HL registers. | ||
68DE | DJNZ RemoveSingleSpriteBlock_Loop | Decrease the sprite block counter by one and loop back to RemoveSingleSpriteBlock_Loop until all the sprite blocks have been reverted to backgrounds. | ||
All sprite blocks are now reverted!
|
||||
68E0 | LD ($781C),HL | Update the buffer position at *SpriteBackgroundBuffer_Pointer. | ||
68E3 | XOR A | Mark that no sprite blocks are now active at *ActiveSpriteBlocks. | ||
68E4 | LD ($781B),A | |||
68E7 | RET | Return. |
Prev: 68AC | Up: Map | Next: 68E8 |