Prev: 9F74 Up: Map Next: 9F9F
9F80: Prepare Draw 2/ 3 Byte Sprite
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 08 pixels.
Output
C 00
DE The address of the first row of sprite data to draw
HL The screen address of the bottom row of the sprite
PrepDraw23 9F80 CALL GetSpriteA Fetch the address of the old sprite with GetSpriteA.
PrepDraw23_NoFetch 9F83 LD HL,($5E16) HL=Previous_X_Position (the saved X position in L and the saved Y position in H).
9F86 LD A,L Fetch the X position.
9F87 DEC A Decrease A by one.
9F88 RLCA Multiply by 02.
9F89 AND %00001110 Keep only bits 1-3.
9F8B CP $0E Jump to PrepDraw23_Shift if this is not the maximum offset.
9F8D JR NZ,PrepDraw23_Shift
9F8F LD A,$E8 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 9EE5.
PrepDraw23_Shift 9F91 LD ($9EE5),A Write the offset to 9EE5.
9F94 CALL ScreenAddress Call ScreenAddress to get the screen address of the position.
9F97 LD A,(DE) Fetch the number of rows in the sprite (the first byte of the sprite data).
9F98 LD ($5E18),A Write the number of rows to Old_Sprite_Row_Count.
This entry point is used by the routine at PrepDraw2.
PrepDraw23_Finish 9F9B LD C,$00 C=00.
9F9D INC DE Move past the height byte.
9F9E RET Return.
View the equivalent code in;
Prev: 9F74 Up: Map Next: 9F9F