Prev: 7213 Up: Map Next: 7271
7242: Reverse Pixel Row
Used by the routine at PatchShift.
Reverses each pixel row of the current strip into the illustration.
ReversePixelRow 7242 PUSH BC Stash the row counter on the stack.
7243 CALL PixelRow Call PixelRow.
7246 PUSH HL Stash the start of the row on the stack.
7247 LD DE,$0000 Load the patched width.
724A LD B,$08 Count the 08 pixel rows to reverse.
724C ADD HL,DE Point DE at the start and HL at the far end.
724D DEC HL
724E POP DE
Reverse one pixel row.
ReversePixelRow_Row 724F PUSH HL Stash the row pointers and the bit counter.
7250 PUSH DE
7251 PUSH BC
7252 LD B,$00 Copy 0100 bytes.
Reverse one byte.
ReversePixelRow_Byte 7254 LD A,(DE) Fetch the source byte.
7255 LD C,$80 Bit 7 of C is set.
Rotate its bits into C.
ReversePixelRow_Bit 7257 RL A Jump to ReversePixelRow_Bit until the byte is reversed.
7259 RR C
725B JR NC,ReversePixelRow_Bit
725D LD (HL),C Write the reversed byte.
725E INC DE Step both pointers.
725F DEC HL
7260 DJNZ ReversePixelRow_Byte Jump to ReversePixelRow_Byte until the row is done.
7262 POP BC Restore the bit counter and the row pointers.
7263 POP DE
7264 POP HL
7265 INC D Step both pointers.
7266 INC H
7267 DJNZ ReversePixelRow_Row Jump to ReversePixelRow_Row until eight pixel rows are done.
7269 POP BC Restore the row counter from the stack.
726A INC B Jump to ReversePixelRow until the patched row count is done.
726B LD A,$00
726D CP B
726E JR NZ,ReversePixelRow
7270 RET Return.
Prev: 7213 Up: Map Next: 7271