Prev: 34175 Up: Map Next: 34265
34190: XOR Sprite Loop
XOR the old sprite (normal registers) and the new sprite (shadow registers) onto the screen one row at a time, using C as each sprite's row counter. Any rows left in SpriteCachedRows and SpriteRowsLeft are then picked up.
Input
HL Screen address
DE Graphic pointer
Draw remaining rows from the current graphic pair.
XORSpriteLoop 34190 LD A,C Jump to XORSpriteLoop_TryShadow if the row counter is zero.
34191 AND A
34192 JR Z,XORSpriteLoop_TryShadow
34194 DEC C Decrease the row counter and XOR the next row of the old sprite.
34195 CALL XORSpriteLoop_LoadPair
34198 EXX Switch to the shadow registers.
34199 LD A,C Jump to XORSpriteLoop_NextSide if the shadow row counter is zero.
34200 AND A
34201 JR Z,XORSpriteLoop_NextSide
XORSpriteLoop_Loop 34203 DEC C Decrease the shadow row counter and XOR the next row of the new sprite.
34204 CALL PrepareSpriteWrite
XORSpriteLoop_NextSide 34207 EXX Switch back and loop to XORSpriteLoop.
34208 JR XORSpriteLoop
No more rows on this side; try the other register set.
XORSpriteLoop_TryShadow 34210 EXX Switch to the shadow registers.
34211 LD A,C Jump to XORSpriteLoop_Loop if the shadow row counter is still live.
34212 AND A
34213 JR NZ,XORSpriteLoop_Loop
Finish the sprites if either has rows left to draw.
XORSpriteLoop_FinishSprite 34215 EXX Switch back to the normal registers.
This entry point is used by the routine at DrawSprite.
XORSpriteLoop_Write 34216 LD A,(24154) Return if both SpriteCachedRows and SpriteRowsLeft are zero.
34219 LD C,A
34220 LD A,(24153)
34223 OR C
34224 RET Z
34225 XOR A Write 0 to SpriteCachedRows and switch register sets.
34226 LD (24154),A
34229 EXX
34230 LD A,(24153) Load the remaining row count and clear A.
34233 LD C,A
34234 XOR A
This entry point is used by the routine at DrawSprite.
XORSpriteLoop_NextPair 34235 LD (24153),A Write the remaining row count to SpriteRowsLeft.
34238 EXX Switch back and loop to XORSpriteLoop.
34239 JR XORSpriteLoop
Copy of XORSpritePairUp for the old sprite. The self-modified jump at XORSpriteLoop_Shift lands here when the sprite is byte-aligned.
34241 EX DE,HL XOR the graphic pair onto the screen and move up one pixel.
34242 EX (SP),HL
34243 LD A,D
34244 XOR (HL)
34245 LD (HL),A
34246 INC L
34247 LD A,E
34248 XOR (HL)
34249 LD (HL),A
34250 POP DE
34251 DEC L
34252 JP ScreenPosition1PixelAbove
XORSpriteLoop_LoadPair 34255 EX DE,HL Load the next graphic pair from DE.
34256 PUSH DE
34257 LD D,(HL)
34258 INC HL
34259 LD E,(HL)
34260 INC HL
34261 EX DE,HL
34262 XOR A
XORSpriteLoop_Shift 34263 JR XORSpriteLoop_Shift Self-modifying shift. The operand is written by 34410.
Prev: 34175 Up: Map Next: 34265