Prev: 7623 Up: Map Next: 766D
763A: 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 763A LD A,C Fetch the row counter.
763B AND A Is it zero?
763C JR Z,XORSpriteLoop_Swap Jump to XORSpriteLoop_Swap if there are no rows to draw.
763E DEC C Decrease the row counter by one.
763F CALL DrawOldSpriteRow Draw a row of the old sprite using DrawOldSpriteRow.
7642 EXX Switch to the shadow registers.
7643 LD A,C Fetch the row counter.
7644 AND A Is it zero?
7645 JR Z,XORSpriteLoop_Next Jump to XORSpriteLoop_Next if there are no rows to draw.
XORSpriteLoop_Actor 7647 DEC C Decrease the row counter by one.
7648 CALL DrawActorSpriteRow Draw a row of the actor sprite using DrawActorSpriteRow.
XORSpriteLoop_Next 764B EXX Switch to the normal registers.
764C JR XORSpriteLoop Jump to XORSpriteLoop.
XORSpriteLoop_Swap 764E EXX Switch to the shadow registers.
764F LD A,C Fetch the row counter.
7650 AND A Is it zero?
7651 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 7653 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 7654 LD A,($5F19) Fetch the sprite rows remaining and keep the old sprite rows remaining in C.
7657 LD C,A
7658 LD A,($5F1A) Fetch the actor sprite rows remaining (ActorSprite_RowsRemaining).
765B OR C Combine the counters.
765C RET Z Return if there are no rows left to draw.
765D XOR A Set A to 00.
765E LD ($5F19),A Update the old sprite rows remaining (OldSprite_RowsRemaining).
7661 EXX Switch to the shadow registers.
7662 LD A,($5F1A) Fetch the actor sprite rows remaining (ActorSprite_RowsRemaining) and keep it in C.
7665 LD C,A
7666 XOR A Set A to 00.
This entry point is used by the routine at DisplayEntity.
XORSpriteLoop_Continue 7667 LD ($5F1A),A Update the actor sprite rows remaining (ActorSprite_RowsRemaining).
766A EXX Switch to the normal registers.
766B JR XORSpriteLoop Jump to XORSpriteLoop.
View the equivalent code in;
Prev: 7623 Up: Map Next: 766D