Prev: 39434 Up: Map Next: 39570
39504: 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 39504 POP BC Restore the attribute and graphic ID from the stack.
39505 CALL GetBlendInstruction Call GetBlendInstruction to get the instruction to mix the graphic with the screen.
39508 LD (39544),A Write it over the instruction at 39544.
39511 CALL GetGraphicDetails Call GetGraphicDetails to get the details of the graphic.
39514 LD A,B Fetch the width.
39515 EXX Switch to the shadow registers.
39516 LD B,A Keep the number of columns in B'.
39517 LD L,128 L'=128 (the mask for the first column).
39519 EXX Switch back to the main registers.
DrawGraphic_Transposed_Row 39520 PUSH BC Stash the width and height on the stack.
39521 PUSH DE Stash the position in the graphic on the stack.
39522 PUSH HL Stash the screen address on the stack.
DrawGraphic_Transposed_Bit 39523 LD A,(DE) Fetch the byte of the graphic.
39524 EXX Switch to the shadow registers.
39525 AND L Mask the column.
39526 JR Z,DrawGraphic_Transposed_Shift Jump to DrawGraphic_Transposed_Shift if the bit is not set.
39528 SCF Set the carry flag.
DrawGraphic_Transposed_Shift 39529 RL H Shift the bit into H'.
39531 EXX Switch back to the main registers.
39532 CALL AddWidthToAddress Call AddWidthToAddress to move down to the next row of the graphic.
39535 DEC C Decrease the height by one.
39536 LD A,C Fetch the number of rows left.
39537 AND %00000111 Keep only bits 0-2.
39539 JR NZ,DrawGraphic_Transposed_Bit Jump to DrawGraphic_Transposed_Bit until eight bits have been gathered.
39541 EXX Switch to the shadow registers.
39542 LD A,H Fetch the byte that was built from the column.
39543 EXX Switch back to the main registers.
39544 NOP This is replaced by an instruction that mixes A with the screen.
39545 LD (HL),A Write A to the screen.
39546 INC L Move HL on to the next byte.
39547 LD A,C Fetch the number of rows left.
39548 AND A Jump to DrawGraphic_Transposed_Bit if there are more bytes in this row of the screen.
39549 JR NZ,DrawGraphic_Transposed_Bit
39551 POP HL Restore the screen address from the stack.
39552 CALL ScreenPosition1PixelAbove Call ScreenPosition1PixelAbove to move up a line.
39555 POP DE Restore the position in the graphic from the stack.
39556 POP BC Restore the width and height from the stack.
39557 EXX Switch to the shadow registers.
39558 RRC L Move the mask on to the next column.
39560 EXX Switch back to the main registers.
39561 JR NC,DrawGraphic_Transposed_Row Jump to DrawGraphic_Transposed_Row if there are more columns in this byte.
39563 EXX Switch to the shadow registers.
39564 DEC B Decrease the number of columns by one.
39565 EXX Switch back to the main registers.
39566 RET Z Return if all of the columns have been drawn.
39567 INC DE Move DE on to the next byte.
39568 JR DrawGraphic_Transposed_Row Jump back to DrawGraphic_Transposed_Row to draw the next row of the graphic.
Prev: 39434 Up: Map Next: 39570