Prev: 40440 Up: Map Next: 40533
40481: Set Attributes Transposed Flipped
The handler of SetGraphicAttributes for a graphic that is flipped along the diagonal from bottom left to top right. This is the same as SetAttributes_RotatedLeft, except that it starts from the last row and works back up with SubtractWidthFromAddress.
SetAttributes_TransposedFlipped 40481 POP BC Restore the attribute and graphic ID from the stack.
40482 CALL GetGraphicAttributeDetails Call GetGraphicAttributeDetails to get the details of the attributes.
40485 LD A,B Fetch the width.
40486 EXX Switch to the shadow registers.
40487 LD B,A Keep the number of columns in B'.
40488 EXX Switch back to the main registers.
40489 CALL FindLastRow Call FindLastRow to move on to the last row.
40492 CALL AddWidthToAddress Call AddWidthToAddress to move DE on to the end of the last row.
SetAttributes_TransposedFlipped_Row 40495 DEC DE Move DE back to the previous column (at first, the last byte of the last row).
40496 PUSH BC Stash the width and height on the stack.
40497 PUSH DE Stash the position in the attributes on the stack.
40498 PUSH HL Stash the attribute buffer address on the stack.
SetAttributes_TransposedFlipped_Cell 40499 LD A,(DE) Fetch the next attribute.
40500 AND A Jump to SetAttributes_TransposedFlipped_Next if it is 0.
40501 JR Z,SetAttributes_TransposedFlipped_Next
40503 CP 255 Jump to SetAttributes_TransposedFlipped_Write if it is not 255.
40505 JR NZ,SetAttributes_TransposedFlipped_Write
40507 LD A,(24090) Fetch the room attribute from CurrentRoom_Attribute.
SetAttributes_TransposedFlipped_Write 40510 LD (HL),A Write A to the attribute buffer.
SetAttributes_TransposedFlipped_Next 40511 CALL SubtractWidthFromAddress Call SubtractWidthFromAddress to move up to the previous row of the attributes.
40514 INC L Move HL on to the next cell.
40515 DEC C Decrease the height by one and loop back to SetAttributes_TransposedFlipped_Cell until all of the rows have been set.
40516 JR NZ,SetAttributes_TransposedFlipped_Cell
40518 POP HL Restore the attribute buffer address from the stack.
40519 LD BC,32 BC=0032 (the size of a row of the attribute buffer).
40522 AND A Move up a row.
40523 SBC HL,BC
40525 POP DE Restore the position in the attributes from the stack.
40526 POP BC Restore the width and height from the stack.
40527 EXX Switch to the shadow registers.
40528 DEC B Decrease the number of columns by one.
40529 EXX Switch back to the main registers.
40530 JR NZ,SetAttributes_TransposedFlipped_Row Jump to SetAttributes_TransposedFlipped_Row until all of the columns are done.
40532 RET Return.
Prev: 40440 Up: Map Next: 40533