![]() |
Routines |
| Prev: 26796 | Up: Map | Next: 26856 |
|
|
||||
| RemoveSprites | 26797 | LD A,(30747) | Return if *ActiveSpriteBlocks is zero (no sprite blocks on the screen). | |
| 26800 | AND A | |||
| 26801 | 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).
|
||||
| 26802 | LD HL,(30748) | Load *SpriteBackgroundBuffer_Pointer into HL. | ||
| 26805 | LD B,A | Set a counter in B of the number of character blocks needed to clear all the sprites. | ||
| 26806 | LD C,0 | Set a "clear" value (0) in C. | ||
| RemoveSingleSpriteBlock_Loop | 26808 | DEC HL | Load DE with the attribute buffer address of the sprite block. | |
| 26809 | LD D,(HL) | |||
| 26810 | DEC HL | |||
| 26811 | LD E,(HL) | |||
| 26812 | DEC HL | Fetch the background attribute value. | ||
| 26813 | LD A,(HL) | |||
| 26814 | LD (DE),A | Write the background attribute value to the attribute buffer address held in DE. | ||
| 26815 | DEC HL | Move to next buffer entry. | ||
|
Convert the attribute address to the corresponding screen buffer address.
|
||||
| 26816 | LD A,D | Taking the attribute buffer high byte, subtract 17. | ||
| 26817 | SUB 17 | |||
| 26819 | OR %00000111 | Adjust for the screen buffer memory layout. | ||
| 26821 | LD D,A | Write this back into D. | ||
| 26822 | EX DE,HL | Exchange the DE and HL registers. | ||
| 26823 | LD (HL),C | Write C to *HL. | ||
| 26824 | DEC H | Decrease H by one. | ||
| 26825 | LD A,(DE) | A=*DE. | ||
| 26826 | LD (HL),A | Write A to *HL. | ||
| 26827 | DEC DE | Decrease DE by one. | ||
| 26828 | DEC H | Decrease H by one. | ||
| 26829 | LD (HL),C | Write C to *HL. | ||
| 26830 | DEC H | Decrease H by one. | ||
| 26831 | LD A,(DE) | A=*DE. | ||
| 26832 | LD (HL),A | Write A to *HL. | ||
| 26833 | DEC DE | Decrease DE by one. | ||
| 26834 | DEC H | Decrease H by one. | ||
| 26835 | LD (HL),C | Write C to *HL. | ||
| 26836 | DEC H | Decrease H by one. | ||
| 26837 | LD A,(DE) | A=*DE. | ||
| 26838 | LD (HL),A | Write A to *HL. | ||
| 26839 | DEC DE | Decrease DE by one. | ||
| 26840 | DEC H | Decrease H by one. | ||
| 26841 | LD (HL),C | Write C to *HL. | ||
| 26842 | DEC H | Decrease H by one. | ||
| 26843 | LD A,(DE) | A=*DE. | ||
| 26844 | LD (HL),A | Write A to *HL. | ||
| 26845 | EX DE,HL | Exchange the DE and HL registers. | ||
| 26846 | 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!
|
||||
| 26848 | LD (30748),HL | Update the buffer position at *SpriteBackgroundBuffer_Pointer. | ||
| 26851 | XOR A | Mark that no sprite blocks are now active at *ActiveSpriteBlocks. | ||
| 26852 | LD (30747),A | |||
| 26855 | RET | Return. | ||
| Prev: 26796 | Up: Map | Next: 26856 |