Prev: A2CF Up: Map Next: A30A
A2F5: Clear Sprite Caches
Write 00 over the cached sprite bytes (*IX+09 to *IX+0F) of each of the 18 actor slots, so that every actor is redrawn from scratch and no stale image is XORed off the redrawn screen. Bytes 00-08 are the actor itself and bytes 10-17 are state specific to its type, so they are left alone.
Start at byte 09 of the first slot, 6009.
ClearSpriteCaches A2F5 LD HL,$6009 HL=6009.
A2F8 LD BC,$0718 Set B to 07 cache bytes per slot and C to 18 slots.
A2FB LD DE,$0011 DE=0011.
Clear the seven cache bytes of each slot in turn.
ClearSpriteCaches_Loop A2FE PUSH BC Stash BC on the stack.
ClearSpriteCaches_WriteByte A2FF LD (HL),$00 Write 00 to the current cache byte.
A301 INC HL Move onto the next cache byte.
A302 DJNZ ClearSpriteCaches_WriteByte Decrease the inner counter by one and loop back to ClearSpriteCaches_WriteByte until this slot is clear.
A304 ADD HL,DE Skip the rest of the slot.
A305 POP BC Restore BC from the stack.
A306 DEC C Decrease C by one.
A307 JR NZ,ClearSpriteCaches_Loop Jump back to ClearSpriteCaches_Loop until C is zero.
A309 RET Return.
Prev: A2CF Up: Map Next: A30A