Prev: 40229 Up: Map Next: 40303
40263: 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 40263 POP BC Restore the attribute and graphic ID from the stack.
40264 CALL GetGraphicAttributeDetails Call GetGraphicAttributeDetails to get the details of the attributes.
40267 DEC DE Move DE back one byte.
SetAttributes_Mirrored_Row 40268 CALL AddWidthToAddress Call AddWidthToAddress to move DE on to the end of the row.
40271 PUSH BC Stash the width and height on the stack.
40272 PUSH DE Stash the position in the attributes on the stack.
40273 PUSH HL Stash the attribute buffer address on the stack.
SetAttributes_Mirrored_Cell 40274 LD A,(DE) Fetch the next attribute.
40275 DEC DE Move DE back one byte.
40276 AND A Jump to SetAttributes_Mirrored_Next if it is 0.
40277 JR Z,SetAttributes_Mirrored_Next
40279 CP 255 Jump to SetAttributes_Mirrored_Write if it is not 255.
40281 JR NZ,SetAttributes_Mirrored_Write
40283 LD A,(24090) Fetch the room attribute from CurrentRoom_Attribute.
SetAttributes_Mirrored_Write 40286 LD (HL),A Write A to the attribute buffer.
SetAttributes_Mirrored_Next 40287 INC L Move HL on to the next cell.
40288 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.
40290 POP HL Restore the attribute buffer address from the stack.
40291 LD BC,32 BC=0032 (the size of a row of the attribute buffer).
40294 AND A Move up a row.
40295 SBC HL,BC
40297 POP DE Restore the position in the attributes from the stack.
40298 POP BC Restore the width and height from the stack.
40299 DEC C Decrease the height by one and loop back to SetAttributes_Mirrored_Row until all of the rows have been set.
40300 JR NZ,SetAttributes_Mirrored_Row
40302 RET Return.
Prev: 40229 Up: Map Next: 40303