Prev: 8787 Up: Map Next: 8807
87B9: Write Sprite Row
XOR one graphic row from DE onto the screen at HL.
Input
HL Screen address
DE Graphic pointer
XOR one graphic row from DE onto the screen at HL.
WriteSpriteRow 87B9 LD A,C Jump to ContinueSpriteWrite if the row counter is zero.
87BA AND A
87BB JR Z,ContinueSpriteWrite
87BD DEC C Decrease the row counter by one.
87BE PUSH BC Stash the counters and screen address.
87BF PUSH HL
WriteSpriteRow_Loop 87C0 LD A,(DE) XOR the next graphic byte onto the screen.
87C1 INC DE
87C2 XOR (HL)
87C3 LD (HL),A
87C4 INC L Move to the next column and loop back to WriteSpriteRow_Loop.
87C5 DJNZ WriteSpriteRow_Loop
Skip the unused graphic bytes, then step up one pixel line.
WriteSpriteRow_SkipRest 87C7 JR WriteSpriteRow_SkipRest Self-modifying skip. The operand is written by 88F8.
87C9 INC DE Skip the remaining bytes of this graphic row.
87CA INC DE
87CB INC DE
87CC INC DE
87CD INC DE
87CE INC DE
87CF INC DE
87D0 INC DE
87D1 INC DE
87D2 INC DE
87D3 INC DE
87D4 INC DE
87D5 INC DE
87D6 INC DE
87D7 INC DE
87D8 INC DE
87D9 POP HL Restore the screen address from the stack.
87DA CALL ScreenPosition1PixelAbove Call ScreenPosition1PixelAbove.
87DD POP BC Restore the counters from the stack.
Switch to the other sprite and write its next row if it has rows left.
87DE EXX Jump to WriteSpriteRow_NextSide if the shadow row counter is zero.
87DF LD A,C
87E0 AND A
87E1 JR Z,WriteSpriteRow_NextSide
This entry point is used by the routine at ContinueSpriteWrite.
WriteSpriteRow_DecreaseShadow 87E3 DEC C Decrease the shadow row counter.
87E4 PUSH BC Stash the counters and the screen address on the stack.
87E5 PUSH HL
WriteSpriteRow_XORByte 87E6 LD A,(DE) XOR the next graphic byte onto the screen.
87E7 INC DE
87E8 XOR (HL)
87E9 LD (HL),A
87EA INC L Move to the next column and loop back to WriteSpriteRow_XORByte.
87EB DJNZ WriteSpriteRow_XORByte
Skip the unused graphic bytes, then step up one pixel line.
WriteSpriteRow_SkipGraphic 87ED JR WriteSpriteRow_SkipGraphic Self-modifying skip. The operand is written by 8850 and ReadSpriteHeader_Loop.
87EF INC DE Skip the remaining bytes of this graphic row.
87F0 INC DE
87F1 INC DE
87F2 INC DE
87F3 INC DE
87F4 INC DE
87F5 INC DE
87F6 INC DE
87F7 INC DE
87F8 INC DE
87F9 INC DE
87FA INC DE
87FB INC DE
87FC INC DE
87FD INC DE
87FE INC DE
87FF POP HL Restore the screen address from the stack.
8800 CALL ScreenPosition1PixelAbove Call ScreenPosition1PixelAbove.
8803 POP BC Restore the counters from the stack.
WriteSpriteRow_NextSide 8804 EXX Switch back and loop to WriteSpriteRow.
8805 JR WriteSpriteRow
Prev: 8787 Up: Map Next: 8807