Prev: 40481 Up: Map Next: 40582
40533: Set Attributes Rotated Right
The handler of SetGraphicAttributes for a graphic that is turned a quarter turn clockwise. This is the same as SetAttributes_Transposed, except that it starts from the last row and works back up with SubtractWidthFromAddress.
SetAttributes_RotatedRight 40533 POP BC Restore the attribute and graphic ID from the stack.
40534 CALL GetGraphicAttributeDetails Call GetGraphicAttributeDetails to get the details of the attributes.
40537 LD A,B Fetch the width.
40538 EXX Switch to the shadow registers.
40539 LD B,A Keep the number of columns in B'.
40540 EXX Switch back to the main registers.
40541 CALL FindLastRow Call FindLastRow to move on to the last row.
SetAttributes_RotatedRight_Row 40544 PUSH BC Stash the width and height on the stack.
40545 PUSH DE Stash the position in the attributes on the stack.
40546 PUSH HL Stash the attribute buffer address on the stack.
SetAttributes_RotatedRight_Cell 40547 LD A,(DE) Fetch the next attribute.
40548 AND A Jump to SetAttributes_RotatedRight_Next if it is 0.
40549 JR Z,SetAttributes_RotatedRight_Next
40551 CP 255 Jump to SetAttributes_RotatedRight_Write if it is not 255.
40553 JR NZ,SetAttributes_RotatedRight_Write
40555 LD A,(24090) Fetch the room attribute from CurrentRoom_Attribute.
SetAttributes_RotatedRight_Write 40558 LD (HL),A Write A to the attribute buffer.
SetAttributes_RotatedRight_Next 40559 CALL SubtractWidthFromAddress Call SubtractWidthFromAddress to move up to the previous row of the attributes.
40562 INC L Move HL on to the next cell.
40563 DEC C Decrease the height by one and loop back to SetAttributes_RotatedRight_Cell until all of the rows have been set.
40564 JR NZ,SetAttributes_RotatedRight_Cell
40566 POP HL Restore the attribute buffer address from the stack.
40567 LD BC,32 BC=0032 (the size of a row of the attribute buffer).
40570 AND A Move up a row.
40571 SBC HL,BC
40573 POP DE Restore the position in the attributes from the stack.
40574 POP BC Restore the width and height from the stack.
40575 INC DE Move DE on to the next column.
40576 EXX Switch to the shadow registers.
40577 DEC B Decrease the number of columns by one.
40578 EXX Switch back to the main registers.
40579 JR NZ,SetAttributes_RotatedRight_Row Jump to SetAttributes_RotatedRight_Row until all of the columns are done.
40581 RET Return.
Prev: 40481 Up: Map Next: 40582