Prev: 29203 Up: Map Next: 29297
29250: Reverse Pixel Row
Used by the routine at PatchShift.
Reverses each pixel row of the current strip into the illustration.
ReversePixelRow 29250 PUSH BC Stash the row counter on the stack.
29251 CALL PixelRow Call PixelRow.
29254 PUSH HL Stash the start of the row on the stack.
29255 LD DE,0 Load the patched width.
29258 LD B,8 Count the 8 pixel rows to reverse.
29260 ADD HL,DE Point DE at the start and HL at the far end.
29261 DEC HL
29262 POP DE
Reverse one pixel row.
ReversePixelRow_Row 29263 PUSH HL Stash the row pointers and the bit counter.
29264 PUSH DE
29265 PUSH BC
29266 LD B,0 Copy 256 bytes.
Reverse one byte.
ReversePixelRow_Byte 29268 LD A,(DE) Fetch the source byte.
29269 LD C,128 Bit 7 of C is set.
Rotate its bits into C.
ReversePixelRow_Bit 29271 RL A Jump to ReversePixelRow_Bit until the byte is reversed.
29273 RR C
29275 JR NC,ReversePixelRow_Bit
29277 LD (HL),C Write the reversed byte.
29278 INC DE Step both pointers.
29279 DEC HL
29280 DJNZ ReversePixelRow_Byte Jump to ReversePixelRow_Byte until the row is done.
29282 POP BC Restore the bit counter and the row pointers.
29283 POP DE
29284 POP HL
29285 INC D Step both pointers.
29286 INC H
29287 DJNZ ReversePixelRow_Row Jump to ReversePixelRow_Row until eight pixel rows are done.
29289 POP BC Restore the row counter from the stack.
29290 INC B Jump to ReversePixelRow until the patched row count is done.
29291 LD A,0
29293 CP B
29294 JR NZ,ReversePixelRow
29296 RET Return.
Prev: 29203 Up: Map Next: 29297