![]() |
Routines |
| Prev: 40820 | Up: Map | Next: 40863 |
|
Used by the routines at RemoveEntity and DisplayEntity.
Gets everything ready to draw (or erase) the sprite at the position which was last recorded by StoreEntity. Sprites are drawn using the exclusive OR operation, so drawing a sprite for a second time erases it.
The number of rows to draw is written to Old_Sprite_Row_Count, and the shifting routine at DrawOldSpriteRow_Aligned is set up to move the sprite along by the position MOD 8 pixels.
|
||||||||||||
| PrepDraw23 | 40832 | CALL GetSpriteA | Fetch the address of the old sprite with GetSpriteA. | |||||||||
| PrepDraw23_NoFetch | 40835 | LD HL,(24086) | HL=Previous_X_Position (the saved X position in L and the saved Y position in H). | |||||||||
| 40838 | LD A,L | Fetch the X position. | ||||||||||
| 40839 | DEC A | Decrease A by one. | ||||||||||
| 40840 | RLCA | Multiply by 2. | ||||||||||
| 40841 | AND %00001110 | Keep only bits 1-3. | ||||||||||
| 40843 | CP 14 | Jump to PrepDraw23_Shift if this is not the maximum offset. | ||||||||||
| 40845 | JR NZ,PrepDraw23_Shift | |||||||||||
| 40847 | LD A,232 | Use the offset which jumps to the code for sprites which are aligned to a character cell. | ||||||||||
|
Self modifying code; this updates the operand of the JR command at 40677.
|
||||||||||||
| PrepDraw23_Shift | 40849 | LD (40677),A | Write the offset to 40677. | |||||||||
| 40852 | CALL ScreenAddress | Call ScreenAddress to get the screen address of the position. | ||||||||||
| 40855 | LD A,(DE) | Fetch the number of rows in the sprite (the first byte of the sprite data). | ||||||||||
| 40856 | LD (24088),A | Write the number of rows to Old_Sprite_Row_Count. | ||||||||||
|
This entry point is used by the routine at PrepDraw2.
|
||||||||||||
| PrepDraw23_Finish | 40859 | LD C,0 | C=0. | |||||||||
| 40861 | INC DE | Move past the height byte. | ||||||||||
| 40862 | RET | Return. | ||||||||||
|
View the equivalent code in;
|
||||||||||||
| Prev: 40820 | Up: Map | Next: 40863 |