Prev: 9D25 Up: Map Next: 9D6F
9D47: Set Attributes Mirrored
The handler of SetGraphicAttributes for a graphic that is mirrored from left to right. This is the same as SetAttributes_Upright, except that each row is read from its end.
SetAttributes_Mirrored 9D47 POP BC Restore the attribute and graphic ID from the stack.
9D48 CALL GetGraphicAttributeDetails Call GetGraphicAttributeDetails to get the details of the attributes.
9D4B DEC DE Move DE back one byte.
SetAttributes_Mirrored_Row 9D4C CALL AddWidthToAddress Call AddWidthToAddress to move DE on to the end of the row.
9D4F PUSH BC Stash the width and height on the stack.
9D50 PUSH DE Stash the position in the attributes on the stack.
9D51 PUSH HL Stash the attribute buffer address on the stack.
SetAttributes_Mirrored_Cell 9D52 LD A,(DE) Fetch the next attribute.
9D53 DEC DE Move DE back one byte.
9D54 AND A Jump to SetAttributes_Mirrored_Next if it is 00.
9D55 JR Z,SetAttributes_Mirrored_Next
9D57 CP $FF Jump to SetAttributes_Mirrored_Write if it is not FF.
9D59 JR NZ,SetAttributes_Mirrored_Write
9D5B LD A,($5E1A) Fetch the room attribute from CurrentRoom_Attribute.
SetAttributes_Mirrored_Write 9D5E LD (HL),A Write A to the attribute buffer.
SetAttributes_Mirrored_Next 9D5F INC L Move HL on to the next cell.
9D60 DJNZ SetAttributes_Mirrored_Cell Decrease the width by one and loop back to SetAttributes_Mirrored_Cell until all of the cells in the row have been set.
9D62 POP HL Restore the attribute buffer address from the stack.
9D63 LD BC,$0020 BC=0020 (the size of a row of the attribute buffer).
9D66 AND A Move up a row.
9D67 SBC HL,BC
9D69 POP DE Restore the position in the attributes from the stack.
9D6A POP BC Restore the width and height from the stack.
9D6B DEC C Decrease the height by one and loop back to SetAttributes_Mirrored_Row until all of the rows have been set.
9D6C JR NZ,SetAttributes_Mirrored_Row
9D6E RET Return.
Prev: 9D25 Up: Map Next: 9D6F