Prev: 9DCE Up: Map Next: 9E21
9DF8: Set Attributes Rotated Half
The handler of SetGraphicAttributes for a graphic that is turned a half turn. This is the same as SetAttributes_Mirrored, except that it starts from the end of the last row.
SetAttributes_RotatedHalf 9DF8 POP BC Restore the attribute and graphic ID from the stack.
9DF9 CALL GetGraphicAttributeDetails Call GetGraphicAttributeDetails to get the details of the attributes.
9DFC CALL FindLastRow Call FindLastRow to move on to the last row.
9DFF CALL AddWidthToAddress Call AddWidthToAddress to move on to the end of the last row.
9E02 DEC DE Move DE back one byte.
SetAttributes_RotatedHalf_Row 9E03 PUSH BC Stash the width and height on the stack.
9E04 PUSH HL Stash the attribute buffer address on the stack.
SetAttributes_RotatedHalf_Cell 9E05 LD A,(DE) Fetch the next attribute.
9E06 DEC DE Move DE back one byte.
9E07 AND A Jump to SetAttributes_RotatedHalf_Next if it is 00.
9E08 JR Z,SetAttributes_RotatedHalf_Next
9E0A CP $FF Jump to SetAttributes_RotatedHalf_Write if it is not FF.
9E0C JR NZ,SetAttributes_RotatedHalf_Write
9E0E LD A,($5E1A) Fetch the room attribute from CurrentRoom_Attribute.
SetAttributes_RotatedHalf_Write 9E11 LD (HL),A Write A to the attribute buffer.
SetAttributes_RotatedHalf_Next 9E12 INC L Move HL on to the next cell.
9E13 DJNZ SetAttributes_RotatedHalf_Cell Decrease the width by one and loop back to SetAttributes_RotatedHalf_Cell until all of the cells in the row have been set.
9E15 POP HL Restore the attribute buffer address from the stack.
9E16 LD BC,$0020 BC=0020 (the size of a row of the attribute buffer).
9E19 AND A Move up a row.
9E1A SBC HL,BC
9E1C POP BC Restore the width and height from the stack.
9E1D DEC C Decrease the height by one and loop back to SetAttributes_RotatedHalf_Row until all of the rows have been set.
9E1E JR NZ,SetAttributes_RotatedHalf_Row
9E20 RET Return.
Prev: 9DCE Up: Map Next: 9E21