Prev: 39397 Up: Map Next: 39504
39434: Draw Graphic Rotated Left
The handler of DrawGraphic for a graphic that is turned a quarter turn anti-clockwise. Each row of the screen is made from a column of the graphic, from the right-hand side to the left-hand side. The bits for each byte come from eight rows of the graphic, which are gathered up in H' using the mask in L'.
DrawGraphic_RotatedLeft 39434 POP BC Restore the attribute and graphic ID from the stack.
39435 CALL GetBlendInstruction Call GetBlendInstruction to get the instruction to mix the graphic with the screen.
39438 LD (39478),A Write it over the instruction at 39478.
39441 CALL GetGraphicDetails Call GetGraphicDetails to get the details of the graphic.
39444 LD A,B Fetch the width.
39445 EXX Switch to the shadow registers.
39446 LD L,1 L'=1 (the mask for the first column).
39448 LD B,A Keep the number of columns in B'.
39449 EXX Switch back to the main registers.
39450 CALL AddWidthToAddress Call AddWidthToAddress to move DE on to the second row.
39453 DEC DE Move DE back to the last byte of the first row.
DrawGraphic_RotatedLeft_Row 39454 PUSH BC Stash the width and height on the stack.
39455 PUSH DE Stash the position in the graphic on the stack.
39456 PUSH HL Stash the screen address on the stack.
DrawGraphic_RotatedLeft_Bit 39457 LD A,(DE) Fetch the byte of the graphic.
39458 EXX Switch to the shadow registers.
39459 AND L Mask the column.
39460 JR Z,DrawGraphic_RotatedLeft_Shift Jump to DrawGraphic_RotatedLeft_Shift if the bit is not set.
39462 SCF Set the carry flag.
DrawGraphic_RotatedLeft_Shift 39463 RL H Shift the bit into H'.
39465 EXX Switch back to the main registers.
39466 CALL AddWidthToAddress Call AddWidthToAddress to move down to the next row of the graphic.
39469 DEC C Decrease the height by one.
39470 LD A,C Fetch the number of rows left.
39471 AND %00000111 Keep only bits 0-2.
39473 JR NZ,DrawGraphic_RotatedLeft_Bit Jump to DrawGraphic_RotatedLeft_Bit until eight bits have been gathered.
39475 EXX Switch to the shadow registers.
39476 LD A,H Fetch the byte that was built from the column.
39477 EXX Switch back to the main registers.
39478 NOP This is replaced by an instruction that mixes A with the screen.
39479 LD (HL),A Write A to the screen.
39480 INC L Move HL on to the next byte.
39481 LD A,C Fetch the number of rows left.
39482 AND A Jump to DrawGraphic_RotatedLeft_Bit if there are more bytes in this row of the screen.
39483 JR NZ,DrawGraphic_RotatedLeft_Bit
39485 POP HL Restore the screen address from the stack.
39486 CALL ScreenPosition1PixelAbove Call ScreenPosition1PixelAbove to move up a line.
39489 POP DE Restore the position in the graphic from the stack.
39490 POP BC Restore the width and height from the stack.
39491 EXX Switch to the shadow registers.
39492 RLC L Move the mask on to the next column.
39494 EXX Switch back to the main registers.
39495 JR NC,DrawGraphic_RotatedLeft_Row Jump to DrawGraphic_RotatedLeft_Row if there are more columns in this byte.
39497 EXX Switch to the shadow registers.
39498 DEC B Decrease the number of columns by one.
39499 EXX Switch back to the main registers.
39500 RET Z Return if all of the columns have been drawn.
39501 DEC DE Move DE back to the previous byte.
39502 JR DrawGraphic_RotatedLeft_Row Jump back to DrawGraphic_RotatedLeft_Row to draw the next row of the graphic.
Prev: 39397 Up: Map Next: 39504