Prev: 9AEF Up: Map Next: 9B5D
9B14: Draw Graphic Transposed Flipped
The handler of DrawGraphic for a graphic that is flipped along the diagonal from bottom left to top right. This is the same as DrawGraphic_RotatedLeft, except that it starts from the last row and works up using SubtractWidthFromAddress.
DrawGraphic_TransposedFlipped 9B14 POP BC Restore the attribute and graphic ID from the stack.
9B15 CALL GetBlendInstruction Call GetBlendInstruction to get the instruction to mix the graphic with the screen.
9B18 LD ($9B43),A Write it over the instruction at 9B43.
9B1B CALL GetGraphicDetails Call GetGraphicDetails to get the details of the graphic.
9B1E LD A,B Fetch the width.
9B1F EXX Switch to the shadow registers.
9B20 LD B,A Keep the number of columns in B'.
9B21 LD L,$01 L'=01 (the mask for the first column).
9B23 EXX Switch back to the main registers.
9B24 CALL AddWidthToAddress Call AddWidthToAddress to move DE on to the end of the first row.
9B27 DEC DE Move DE back to the last byte of the first row.
9B28 CALL FindLastRow Call FindLastRow to move on to the last row.
DrawGraphic_TransposedFlipped_Row 9B2B PUSH BC Stash the width and height on the stack.
9B2C PUSH DE Stash the position in the graphic on the stack.
9B2D PUSH HL Stash the screen address on the stack.
DrawGraphic_TransposedFlipped_Bit 9B2E LD A,(DE) Fetch the byte of the graphic.
9B2F EXX Switch to the shadow registers.
9B30 AND L Mask the column.
9B31 JR Z,DrawGraphic_TransposedFlipped_Shift Jump to DrawGraphic_TransposedFlipped_Shift if the bit is not set.
9B33 SCF Set the carry flag.
DrawGraphic_TransposedFlipped_Shift 9B34 RL H Shift the bit into H'.
9B36 EXX Switch back to the main registers.
9B37 CALL SubtractWidthFromAddress Call SubtractWidthFromAddress to move up to the previous row of the graphic.
9B3A DEC C Decrease the height by one.
9B3B LD A,C Fetch the number of rows left.
9B3C AND %00000111 Keep only bits 0-2.
9B3E JR NZ,DrawGraphic_TransposedFlipped_Bit Jump to DrawGraphic_TransposedFlipped_Bit until eight bits have been gathered.
9B40 EXX Switch to the shadow registers.
9B41 LD A,H Fetch the byte that was built from the column.
9B42 EXX Switch back to the main registers.
9B43 NOP This is replaced by an instruction that mixes A with the screen.
9B44 LD (HL),A Write A to the screen.
9B45 INC L Move HL on to the next byte.
9B46 LD A,C Fetch the number of rows left.
9B47 AND A Jump to DrawGraphic_TransposedFlipped_Bit if there are more bytes in this row of the screen.
9B48 JR NZ,DrawGraphic_TransposedFlipped_Bit
9B4A POP HL Restore the screen address from the stack.
9B4B CALL ScreenPosition1PixelAbove Call ScreenPosition1PixelAbove to move up a line.
9B4E POP DE Restore the position in the graphic from the stack.
9B4F POP BC Restore the width and height from the stack.
9B50 EXX Switch to the shadow registers.
9B51 RLC L Move the mask on to the next column.
9B53 EXX Switch back to the main registers.
9B54 JR NC,DrawGraphic_TransposedFlipped_Row Jump to DrawGraphic_TransposedFlipped_Row if there are more columns in this byte.
9B56 EXX Switch to the shadow registers.
9B57 DEC B Decrease the number of columns by one.
9B58 EXX Switch back to the main registers.
9B59 RET Z Return if all of the columns have been drawn.
9B5A DEC DE Move DE back to the previous byte.
9B5B JR DrawGraphic_TransposedFlipped_Row Jump back to DrawGraphic_TransposedFlipped_Row to draw the next row of the graphic.
Prev: 9AEF Up: Map Next: 9B5D