Prev: 9A0A Up: Map Next: 9A92
9A50: Draw Graphic Transposed
The handler of DrawGraphic for a graphic that is flipped along the diagonal from top left to bottom right. Each row of the screen is made from a column of the graphic, from the left-hand side to the right-hand side, from the top down. This is the same as DrawGraphic_RotatedLeft except for the direction of the columns.
DrawGraphic_Transposed 9A50 POP BC Restore the attribute and graphic ID from the stack.
9A51 CALL GetBlendInstruction Call GetBlendInstruction to get the instruction to mix the graphic with the screen.
9A54 LD ($9A78),A Write it over the instruction at 9A78.
9A57 CALL GetGraphicDetails Call GetGraphicDetails to get the details of the graphic.
9A5A LD A,B Fetch the width.
9A5B EXX Switch to the shadow registers.
9A5C LD B,A Keep the number of columns in B'.
9A5D LD L,$80 L'=80 (the mask for the first column).
9A5F EXX Switch back to the main registers.
DrawGraphic_Transposed_Row 9A60 PUSH BC Stash the width and height on the stack.
9A61 PUSH DE Stash the position in the graphic on the stack.
9A62 PUSH HL Stash the screen address on the stack.
DrawGraphic_Transposed_Bit 9A63 LD A,(DE) Fetch the byte of the graphic.
9A64 EXX Switch to the shadow registers.
9A65 AND L Mask the column.
9A66 JR Z,DrawGraphic_Transposed_Shift Jump to DrawGraphic_Transposed_Shift if the bit is not set.
9A68 SCF Set the carry flag.
DrawGraphic_Transposed_Shift 9A69 RL H Shift the bit into H'.
9A6B EXX Switch back to the main registers.
9A6C CALL AddWidthToAddress Call AddWidthToAddress to move down to the next row of the graphic.
9A6F DEC C Decrease the height by one.
9A70 LD A,C Fetch the number of rows left.
9A71 AND %00000111 Keep only bits 0-2.
9A73 JR NZ,DrawGraphic_Transposed_Bit Jump to DrawGraphic_Transposed_Bit until eight bits have been gathered.
9A75 EXX Switch to the shadow registers.
9A76 LD A,H Fetch the byte that was built from the column.
9A77 EXX Switch back to the main registers.
9A78 NOP This is replaced by an instruction that mixes A with the screen.
9A79 LD (HL),A Write A to the screen.
9A7A INC L Move HL on to the next byte.
9A7B LD A,C Fetch the number of rows left.
9A7C AND A Jump to DrawGraphic_Transposed_Bit if there are more bytes in this row of the screen.
9A7D JR NZ,DrawGraphic_Transposed_Bit
9A7F POP HL Restore the screen address from the stack.
9A80 CALL ScreenPosition1PixelAbove Call ScreenPosition1PixelAbove to move up a line.
9A83 POP DE Restore the position in the graphic from the stack.
9A84 POP BC Restore the width and height from the stack.
9A85 EXX Switch to the shadow registers.
9A86 RRC L Move the mask on to the next column.
9A88 EXX Switch back to the main registers.
9A89 JR NC,DrawGraphic_Transposed_Row Jump to DrawGraphic_Transposed_Row if there are more columns in this byte.
9A8B EXX Switch to the shadow registers.
9A8C DEC B Decrease the number of columns by one.
9A8D EXX Switch back to the main registers.
9A8E RET Z Return if all of the columns have been drawn.
9A8F INC DE Move DE on to the next byte.
9A90 JR DrawGraphic_Transposed_Row Jump back to DrawGraphic_Transposed_Row to draw the next row of the graphic.
Prev: 9A0A Up: Map Next: 9A92