Prev: 9DA0 Up: Map Next: 9DF8
9DCE: Set Attributes Flipped
The handler of SetGraphicAttributes for a graphic that is flipped from top to bottom. This is the same as SetAttributes_Upright, except that it starts from the last row and works back up with SubtractWidthFromAddress.
SetAttributes_Flipped 9DCE POP BC Restore the attribute and graphic ID from the stack.
9DCF CALL GetGraphicAttributeDetails Call GetGraphicAttributeDetails to get the details of the attributes.
9DD2 CALL FindLastRow Call FindLastRow to move on to the last row.
SetAttributes_Flipped_Row 9DD5 PUSH BC Stash the width and height on the stack.
9DD6 PUSH DE Stash the position in the attributes on the stack.
9DD7 PUSH HL Stash the attribute buffer address on the stack.
SetAttributes_Flipped_Cell 9DD8 LD A,(DE) Fetch the next attribute.
9DD9 INC DE Move DE on to the next byte.
9DDA AND A Jump to SetAttributes_Flipped_Next if it is 00.
9DDB JR Z,SetAttributes_Flipped_Next
9DDD CP $FF Jump to SetAttributes_Flipped_Write if it is not FF.
9DDF JR NZ,SetAttributes_Flipped_Write
9DE1 LD A,($5E1A) Fetch the room attribute from CurrentRoom_Attribute.
SetAttributes_Flipped_Write 9DE4 LD (HL),A Write A to the attribute buffer.
SetAttributes_Flipped_Next 9DE5 INC L Move HL on to the next cell.
9DE6 DJNZ SetAttributes_Flipped_Cell Decrease the width by one and loop back to SetAttributes_Flipped_Cell until all of the cells in the row have been set.
9DE8 POP HL Restore the attribute buffer address from the stack.
9DE9 LD BC,$0020 BC=0020 (the size of a row of the attribute buffer).
9DEC AND A Move up a row.
9DED SBC HL,BC
9DEF POP DE Restore the position in the attributes from the stack.
9DF0 POP BC Restore the width and height from the stack.
9DF1 CALL SubtractWidthFromAddress Call SubtractWidthFromAddress to move back to the previous row of the attributes.
9DF4 DEC C Decrease the height by one and loop back to SetAttributes_Flipped_Row until all of the rows have been set.
9DF5 JR NZ,SetAttributes_Flipped_Row
9DF7 RET Return.
Prev: 9DA0 Up: Map Next: 9DF8