Prev: 9F4A Up: Map Next: 9F74
9F56: Remove Entity
Removes the image of an entity that was saved by StoreEntity, by drawing it again (sprites are XORed onto the screen).
Input
IX The entity
Before After
remove-entity-before remove-entity-after
RemoveEntity 9F56 CALL PrepDraw23 Prepare the old sprite with PrepDraw23.
RemoveEntity_Prepared 9F59 EXX Switch to the shadow registers.
9F5A XOR A A=00.
9F5B LD C,A Keep zero as the number of rows of the new sprite in C.
9F5C LD ($5E19),A Update the number of new sprite rows in New_Sprite_Row_Count.
9F5F LD A,($5E18) Fetch the number of old sprite rows from Old_Sprite_Row_Count.
9F62 LD ($5E11),A Update the sprite height in SpriteHeight.
Work out the width of the sprite in bytes. The code uses L from the shadow registers, which holds whatever an earlier routine left there.
9F65 LD A,L A=L.
9F66 AND %00000111 Keep only bits 0-2.
9F68 LD A,$02 A=02.
9F6A JR Z,RemoveEntity_Width Jump to RemoveEntity_Width if bits 0-2 were zero.
9F6C INC A A=03.
RemoveEntity_Width 9F6D LD ($5E10),A Write the width to SpriteWidth.
9F70 EXX Switch to the normal registers.
9F71 JP XORSpriteLoop Jump to XORSpriteLoop to draw the sprites onto the screen.
View the equivalent code in;
Prev: 9F4A Up: Map Next: 9F74