Prev: 9F9F Up: Map Next: 9FFB
9FCA: Display Entity
Used by the routine at HandlerKnight.
Erases the sprite from the position recorded by StoreEntity and draws it at the new position held by the entity. The old and the new sprite are processed together so that the screen lines which they share are updated in step.
Input
IX The entity
DisplayEntity 9FCA CALL PrepDraw2 Prepare the new sprite with PrepDraw2.
9FCD EXX Switch to the shadow registers.
9FCE CALL PrepDraw23 Prepare the old sprite with PrepDraw23.
Compare the vertical position of the old sprite with the new one.
DisplayEntity_Compare 9FD1 LD A,($5E17) Fetch the previous Y position from Previous_Y_Position.
9FD4 SUB (IX+$04) Subtract the new vertical position.
9FD7 JP Z,XORSpriteLoop_Remaining Jump to XORSpriteLoop_Remaining if they are the same.
9FDA JP M,DisplayEntity_NewLower Jump to DisplayEntity_NewLower if the new sprite is lower down the screen.
The old sprite is lower down. Draw the rows of it which the new sprite does not cover first.
9FDD LD C,A Fetch the number of rows.
9FDE LD A,($5E18) Fetch the number of old sprite rows from Old_Sprite_Row_Count.
9FE1 CP C Jump to XORSpriteLoop_Remaining if the sprites do not overlap.
9FE2 JP C,XORSpriteLoop_Remaining
9FE5 SUB C Subtract the rows which are about to be drawn.
9FE6 LD ($5E18),A Write the number of rows remaining to Old_Sprite_Row_Count.
9FE9 JP XORSpriteLoop Jump to XORSpriteLoop to draw the sprites onto the screen.
The new sprite is lower down. Draw the rows of it which the old sprite does not cover first.
DisplayEntity_NewLower 9FEC EXX Switch to the shadow registers.
9FED NEG Make the number of rows positive.
9FEF LD C,A Fetch the number of rows.
9FF0 LD A,($5E19) Fetch the number of new sprite rows from New_Sprite_Row_Count.
9FF3 CP C Jump to XORSpriteLoop_Restore if the sprites do not overlap.
9FF4 JP C,XORSpriteLoop_Restore
9FF7 SUB C Subtract the rows which are about to be drawn.
9FF8 JP XORSpriteLoop_Continue Jump to XORSpriteLoop_Continue to write the number of rows remaining to New_Sprite_Row_Count.
View the equivalent code in;
Prev: 9F9F Up: Map Next: 9FFB