Prev: 41679 Up: Map Next: 41738
41717: Clear Sprite Caches
Write 0 over the cached sprite bytes (*IX+9 to *IX+15) of each of the 24 actor slots, so that every actor is redrawn from scratch and no stale image is XORed off the redrawn screen. Bytes 0-8 are the actor itself and bytes 16-23 are state specific to its type, so they are left alone.
Start at byte 9 of the first slot, 24585.
ClearSpriteCaches 41717 LD HL,24585 HL=24585.
41720 LD BC,1816 Set B to 7 cache bytes per slot and C to 24 slots.
41723 LD DE,17 DE=0017.
Clear the seven cache bytes of each slot in turn.
ClearSpriteCaches_Loop 41726 PUSH BC Stash BC on the stack.
ClearSpriteCaches_WriteByte 41727 LD (HL),0 Write 0 to the current cache byte.
41729 INC HL Move onto the next cache byte.
41730 DJNZ ClearSpriteCaches_WriteByte Decrease the inner counter by one and loop back to ClearSpriteCaches_WriteByte until this slot is clear.
41732 ADD HL,DE Skip the rest of the slot.
41733 POP BC Restore BC from the stack.
41734 DEC C Decrease C by one.
41735 JR NZ,ClearSpriteCaches_Loop Jump back to ClearSpriteCaches_Loop until C is zero.
41737 RET Return.
Prev: 41679 Up: Map Next: 41738