Prev: 99C9 Up: Map Next: 9A0A
99E5: Copy a sprite to the screen, back to front
BLIT_SPRITE with two changes: the row is walked with DEC DE rather than INC DE, and every byte goes through REVERSE_BITS on the way out. Between them those mirror the sprite horizontally without a second copy of the data.
It patches its own combining instruction the same way BLIT_SPRITE does -- SPRITE_COMBINE_OPCODE hands back an opcode and it is written over the NOP in the loop.
BLIT_SPRITE_MIRRORED 99E5 POP BC The combining opcode, into the loop below.
99E6 CALL SPRITE_COMBINE_OPCODE
99E9 LD (BLIT_MIRRORED_OP),A
99EC CALL FETCH_SPRITE
BLIT_SPRITE_MIRRORED_0 99EF PUSH BC Start of a row.
99F0 PUSH HL
99F1 CALL NEXT_SPRITE_ROW
BLIT_SPRITE_MIRRORED_1 99F4 DEC DE Backwards through the row, reversing each byte.
99F5 LD A,(DE)
99F6 CALL REVERSE_BITS
BLIT_MIRRORED_OP 99F9 NOP Assembled at run time: NOP, OR, XOR or AND.
99FA LD (HL),A
99FB INC L
99FC DJNZ BLIT_SPRITE_MIRRORED_1
99FE POP HL
99FF CALL SCREEN_ROW_UP
9A02 POP BC
9A03 CALL NEXT_SPRITE_ROW
9A06 DEC C
9A07 JR NZ,BLIT_SPRITE_MIRRORED_0
9A09 RET
Prev: 99C9 Up: Map Next: 9A0A