Prev: 39663 Up: Map Next: 39773
39700: 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 39700 POP BC Restore the attribute and graphic ID from the stack.
39701 CALL GetBlendInstruction Call GetBlendInstruction to get the instruction to mix the graphic with the screen.
39704 LD (39747),A Write it over the instruction at 39747.
39707 CALL GetGraphicDetails Call GetGraphicDetails to get the details of the graphic.
39710 LD A,B Fetch the width.
39711 EXX Switch to the shadow registers.
39712 LD B,A Keep the number of columns in B'.
39713 LD L,1 L'=1 (the mask for the first column).
39715 EXX Switch back to the main registers.
39716 CALL AddWidthToAddress Call AddWidthToAddress to move DE on to the end of the first row.
39719 DEC DE Move DE back to the last byte of the first row.
39720 CALL FindLastRow Call FindLastRow to move on to the last row.
DrawGraphic_TransposedFlipped_Row 39723 PUSH BC Stash the width and height on the stack.
39724 PUSH DE Stash the position in the graphic on the stack.
39725 PUSH HL Stash the screen address on the stack.
DrawGraphic_TransposedFlipped_Bit 39726 LD A,(DE) Fetch the byte of the graphic.
39727 EXX Switch to the shadow registers.
39728 AND L Mask the column.
39729 JR Z,DrawGraphic_TransposedFlipped_Shift Jump to DrawGraphic_TransposedFlipped_Shift if the bit is not set.
39731 SCF Set the carry flag.
DrawGraphic_TransposedFlipped_Shift 39732 RL H Shift the bit into H'.
39734 EXX Switch back to the main registers.
39735 CALL SubtractWidthFromAddress Call SubtractWidthFromAddress to move up to the previous row of the graphic.
39738 DEC C Decrease the height by one.
39739 LD A,C Fetch the number of rows left.
39740 AND %00000111 Keep only bits 0-2.
39742 JR NZ,DrawGraphic_TransposedFlipped_Bit Jump to DrawGraphic_TransposedFlipped_Bit until eight bits have been gathered.
39744 EXX Switch to the shadow registers.
39745 LD A,H Fetch the byte that was built from the column.
39746 EXX Switch back to the main registers.
39747 NOP This is replaced by an instruction that mixes A with the screen.
39748 LD (HL),A Write A to the screen.
39749 INC L Move HL on to the next byte.
39750 LD A,C Fetch the number of rows left.
39751 AND A Jump to DrawGraphic_TransposedFlipped_Bit if there are more bytes in this row of the screen.
39752 JR NZ,DrawGraphic_TransposedFlipped_Bit
39754 POP HL Restore the screen address from the stack.
39755 CALL ScreenPosition1PixelAbove Call ScreenPosition1PixelAbove to move up a line.
39758 POP DE Restore the position in the graphic from the stack.
39759 POP BC Restore the width and height from the stack.
39760 EXX Switch to the shadow registers.
39761 RLC L Move the mask on to the next column.
39763 EXX Switch back to the main registers.
39764 JR NC,DrawGraphic_TransposedFlipped_Row Jump to DrawGraphic_TransposedFlipped_Row if there are more columns in this byte.
39766 EXX Switch to the shadow registers.
39767 DEC B Decrease the number of columns by one.
39768 EXX Switch back to the main registers.
39769 RET Z Return if all of the columns have been drawn.
39770 DEC DE Move DE back to the previous byte.
39771 JR DrawGraphic_TransposedFlipped_Row Jump back to DrawGraphic_TransposedFlipped_Row to draw the next row of the graphic.
Prev: 39663 Up: Map Next: 39773