![]() |
Routines |
| Prev: 9E96 | Up: Map | Next: 9ECE |
|
XORs the old sprite and the new sprite onto the screen one row at a time, working up from the bottom row. The row counters are in C and C' (in the normal and the shadow register sets), and each register set holds the screen address in HL and the sprite data address in DE for one of the two sprites. When the counters run out, any rows left over in Old_Sprite_Row_Count and New_Sprite_Row_Count are drawn.
Drawing a sprite a second time erases it, so the old sprite is removed from where it was and the new sprite is drawn where it is now.
|
||||
| XORSpriteLoop | 9E9B | LD A,C | Fetch the number of rows of the old sprite that are left. | |
| 9E9C | AND A | Jump to XORSpriteLoop_Swap if there are no rows of the old sprite left to draw. | ||
| 9E9D | JR Z,XORSpriteLoop_Swap | |||
| 9E9F | DEC C | Decrease the row counter by one. | ||
| 9EA0 | CALL DrawOldSpriteRow | Call DrawOldSpriteRow to draw the old sprite row. | ||
| 9EA3 | EXX | Switch to the shadow registers. | ||
| 9EA4 | LD A,C | Fetch the number of rows of the new sprite that are left. | ||
| 9EA5 | AND A | Jump to XORSpriteLoop_Next if there are no rows of the new sprite left to draw. | ||
| 9EA6 | JR Z,XORSpriteLoop_Next | |||
| XORSpriteLoop_Actor | 9EA8 | DEC C | Decrease the row counter by one. | |
| 9EA9 | CALL DrawActorSpriteRow | Call DrawActorSpriteRow to draw the new sprite row. | ||
| XORSpriteLoop_Next | 9EAC | EXX | Switch to the normal registers. | |
| 9EAD | JR XORSpriteLoop | Jump to XORSpriteLoop to draw the sprites onto the screen. | ||
| XORSpriteLoop_Swap | 9EAF | EXX | Switch to the shadow registers. | |
| 9EB0 | LD A,C | Fetch the number of rows of the new sprite that are left. | ||
| 9EB1 | AND A | Jump to XORSpriteLoop_Actor if there are more rows of the new sprite to draw. | ||
| 9EB2 | JR NZ,XORSpriteLoop_Actor | |||
|
This entry point is used by the routine at DisplayEntity.
|
||||
| XORSpriteLoop_Restore | 9EB4 | 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 | 9EB5 | LD A,($5E18) | Fetch the number of old sprite rows from Old_Sprite_Row_Count and keep it in C. | |
| 9EB8 | LD C,A | |||
| 9EB9 | LD A,($5E19) | Fetch the number of new sprite rows from New_Sprite_Row_Count. | ||
| 9EBC | OR C | Return if there are no rows left to draw. | ||
| 9EBD | RET Z | |||
| 9EBE | XOR A | A=00. | ||
| 9EBF | LD ($5E18),A | Update the number of old sprite rows in Old_Sprite_Row_Count. | ||
| 9EC2 | EXX | Switch to the shadow registers. | ||
| 9EC3 | LD A,($5E19) | Fetch the number of new sprite rows from New_Sprite_Row_Count and keep it in C. | ||
| 9EC6 | LD C,A | |||
| 9EC7 | XOR A | A=00. | ||
|
This entry point is used by the routine at DisplayEntity.
|
||||
| XORSpriteLoop_Continue | 9EC8 | LD ($5E19),A | Update the number of new sprite rows in New_Sprite_Row_Count. | |
| 9ECB | EXX | Switch to the normal registers. | ||
| 9ECC | JR XORSpriteLoop | Jump to XORSpriteLoop to draw the sprites onto the screen. | ||
|
View the equivalent code in;
|
||||
| Prev: 9E96 | Up: Map | Next: 9ECE |