![]() |
Routines |
| Prev: 39700 | Up: Map | Next: 39842 |
|
The handler of DrawGraphic for a graphic that is turned a quarter turn clockwise. This is the same as DrawGraphic_Transposed, except that it starts from the last row and works up using SubtractWidthFromAddress.
|
||||
| DrawGraphic_RotatedRight | 39773 | POP BC | Restore the attribute and graphic ID from the stack. | |
| 39774 | CALL GetBlendInstruction | Call GetBlendInstruction to get the instruction to mix the graphic with the screen. | ||
| 39777 | LD (39816),A | Write it over the instruction at 39816. | ||
| 39780 | CALL GetGraphicDetails | Call GetGraphicDetails to get the details of the graphic. | ||
| 39783 | LD A,B | Fetch the width. | ||
| 39784 | EXX | Switch to the shadow registers. | ||
| 39785 | LD B,A | Keep the number of columns in B'. | ||
| 39786 | LD L,128 | L'=128 (the mask for the first column). | ||
| 39788 | EXX | Switch back to the main registers. | ||
| 39789 | CALL FindLastRow | Call FindLastRow to move on to the last row. | ||
| DrawGraphic_RotatedRight_Row | 39792 | PUSH BC | Stash the width and height on the stack. | |
| 39793 | PUSH DE | Stash the position in the graphic on the stack. | ||
| 39794 | PUSH HL | Stash the screen address on the stack. | ||
| DrawGraphic_RotatedRight_Bit | 39795 | LD A,(DE) | Fetch the byte of the graphic. | |
| 39796 | EXX | Switch to the shadow registers. | ||
| 39797 | AND L | Mask the column. | ||
| 39798 | JR Z,DrawGraphic_RotatedRight_Shift | Jump to DrawGraphic_RotatedRight_Shift if the bit is not set. | ||
| 39800 | SCF | Set the carry flag. | ||
| DrawGraphic_RotatedRight_Shift | 39801 | RL H | Shift the bit into H'. | |
| 39803 | EXX | Switch back to the main registers. | ||
| 39804 | CALL SubtractWidthFromAddress | Call SubtractWidthFromAddress to move up to the previous row of the graphic. | ||
| 39807 | DEC C | Decrease the height by one. | ||
| 39808 | LD A,C | Fetch the number of rows left. | ||
| 39809 | AND %00000111 | Keep only bits 0-2. | ||
| 39811 | JR NZ,DrawGraphic_RotatedRight_Bit | Jump to DrawGraphic_RotatedRight_Bit until eight bits have been gathered. | ||
| 39813 | EXX | Switch to the shadow registers. | ||
| 39814 | LD A,H | Fetch the byte that was built from the column. | ||
| 39815 | EXX | Switch back to the main registers. | ||
| 39816 | NOP | This is replaced by an instruction that mixes A with the screen. | ||
| 39817 | LD (HL),A | Write A to the screen. | ||
| 39818 | INC L | Move HL on to the next byte. | ||
| 39819 | LD A,C | Fetch the number of rows left. | ||
| 39820 | AND A | Jump to DrawGraphic_RotatedRight_Bit if there are more bytes in this row of the screen. | ||
| 39821 | JR NZ,DrawGraphic_RotatedRight_Bit | |||
| 39823 | POP HL | Restore the screen address from the stack. | ||
| 39824 | CALL ScreenPosition1PixelAbove | Call ScreenPosition1PixelAbove to move up a line. | ||
| 39827 | POP DE | Restore the position in the graphic from the stack. | ||
| 39828 | POP BC | Restore the width and height from the stack. | ||
| 39829 | EXX | Switch to the shadow registers. | ||
| 39830 | RRC L | Move the mask on to the next column. | ||
| 39832 | EXX | Switch back to the main registers. | ||
| 39833 | JR NC,DrawGraphic_RotatedRight_Row | Jump to DrawGraphic_RotatedRight_Row if there are more columns in this byte. | ||
| 39835 | EXX | Switch to the shadow registers. | ||
| 39836 | DEC B | Decrease the number of columns by one. | ||
| 39837 | EXX | Switch back to the main registers. | ||
| 39838 | RET Z | Return if all of the columns have been drawn. | ||
| 39839 | INC DE | Move DE on to the next byte. | ||
| 39840 | JR DrawGraphic_RotatedRight_Row | Jump back to DrawGraphic_RotatedRight_Row to draw the next row of the graphic. | ||
| Prev: 39700 | Up: Map | Next: 39842 |