Prev: 30243 Up: Map Next: 30317
30266: XOR Sprite Loop
Used by the routines at DisplayEntity, RemoveEntity and DrawEntity.
Draws the old sprite and the new sprite one row at a time, using the row counters in C and C' (in the normal and the shadow register sets). When the counters are used up, any rows remaining in OldSprite_RowsRemaining and ActorSprite_RowsRemaining are drawn.
XORSpriteLoop 30266 LD A,C Fetch the row counter.
30267 AND A Is it zero?
30268 JR Z,XORSpriteLoop_Swap Jump to XORSpriteLoop_Swap if there are no rows to draw.
30270 DEC C Decrease the row counter by one.
30271 CALL DrawOldSpriteRow Draw a row of the old sprite using DrawOldSpriteRow.
30274 EXX Switch to the shadow registers.
30275 LD A,C Fetch the row counter.
30276 AND A Is it zero?
30277 JR Z,XORSpriteLoop_Next Jump to XORSpriteLoop_Next if there are no rows to draw.
XORSpriteLoop_Actor 30279 DEC C Decrease the row counter by one.
30280 CALL DrawActorSpriteRow Draw a row of the actor sprite using DrawActorSpriteRow.
XORSpriteLoop_Next 30283 EXX Switch to the normal registers.
30284 JR XORSpriteLoop Jump to XORSpriteLoop.
XORSpriteLoop_Swap 30286 EXX Switch to the shadow registers.
30287 LD A,C Fetch the row counter.
30288 AND A Is it zero?
30289 JR NZ,XORSpriteLoop_Actor Jump to XORSpriteLoop_Actor if there are more rows to draw.
This entry point is used by the routine at DisplayEntity.
XORSpriteLoop_Restore 30291 EXX Switch to the normal registers.
This entry point is used by the routine at DisplayEntity.
Fetch the number of rows left over from the old sprite and the new sprite. If there are none then the drawing is finished.
XORSpriteLoop_Remaining 30292 LD A,(24345) Fetch the sprite rows remaining and keep the old sprite rows remaining in C.
30295 LD C,A
30296 LD A,(24346) Fetch the actor sprite rows remaining (ActorSprite_RowsRemaining).
30299 OR C Combine the counters.
30300 RET Z Return if there are no rows left to draw.
30301 XOR A Set A to 0.
30302 LD (24345),A Update the old sprite rows remaining (OldSprite_RowsRemaining).
30305 EXX Switch to the shadow registers.
30306 LD A,(24346) Fetch the actor sprite rows remaining (ActorSprite_RowsRemaining) and keep it in C.
30309 LD C,A
30310 XOR A Set A to 0.
This entry point is used by the routine at DisplayEntity.
XORSpriteLoop_Continue 30311 LD (24346),A Update the actor sprite rows remaining (ActorSprite_RowsRemaining).
30314 EXX Switch to the normal registers.
30315 JR XORSpriteLoop Jump to XORSpriteLoop.
View the equivalent code in;
Prev: 30243 Up: Map Next: 30317