Prev: 39369 Up: Map Next: 39434
39397: Draw Graphic Mirrored
The handler of DrawGraphic for a graphic that is mirrored from left to right. Each row is read from its end and the bits of each byte are reversed with ReverseBits.
DrawGraphic_Mirrored 39397 POP BC Restore the attribute and graphic ID from the stack.
39398 CALL GetBlendInstruction Call GetBlendInstruction to get the instruction to mix the graphic with the screen.
39401 LD (39417),A Write it over the instruction at 39417.
39404 CALL GetGraphicDetails Call GetGraphicDetails to get the details of the graphic.
DrawGraphic_Mirrored_Row 39407 PUSH BC Stash the width and height on the stack.
39408 PUSH HL Stash the screen address on the stack.
39409 CALL AddWidthToAddress Call AddWidthToAddress to move DE on to the end of the row.
DrawGraphic_Mirrored_Byte 39412 DEC DE Move DE back one byte.
39413 LD A,(DE) Fetch the byte of the graphic.
39414 CALL ReverseBits Call ReverseBits to reverse the bits.
39417 NOP This is replaced by an instruction that mixes A with the screen.
39418 LD (HL),A Write A to the screen.
39419 INC L Move HL on to the next byte.
39420 DJNZ DrawGraphic_Mirrored_Byte Decrease the width by one and loop back to DrawGraphic_Mirrored_Byte until all of the bytes in the row have been drawn.
39422 POP HL Restore the screen address from the stack.
39423 CALL ScreenPosition1PixelAbove Call ScreenPosition1PixelAbove to move up a line.
39426 POP BC Restore the width and height from the stack.
39427 CALL AddWidthToAddress Call AddWidthToAddress to move DE on to the start of the next row.
39430 DEC C Decrease the height by one and loop back to DrawGraphic_Mirrored_Row until all of the rows have been done.
39431 JR NZ,DrawGraphic_Mirrored_Row
39433 RET Return.
Prev: 39369 Up: Map Next: 39434