Prev: 40352 Up: Map Next: 40440
40398: 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 40398 POP BC Restore the attribute and graphic ID from the stack.
40399 CALL GetGraphicAttributeDetails Call GetGraphicAttributeDetails to get the details of the attributes.
40402 CALL FindLastRow Call FindLastRow to move on to the last row.
SetAttributes_Flipped_Row 40405 PUSH BC Stash the width and height on the stack.
40406 PUSH DE Stash the position in the attributes on the stack.
40407 PUSH HL Stash the attribute buffer address on the stack.
SetAttributes_Flipped_Cell 40408 LD A,(DE) Fetch the next attribute.
40409 INC DE Move DE on to the next byte.
40410 AND A Jump to SetAttributes_Flipped_Next if it is 0.
40411 JR Z,SetAttributes_Flipped_Next
40413 CP 255 Jump to SetAttributes_Flipped_Write if it is not 255.
40415 JR NZ,SetAttributes_Flipped_Write
40417 LD A,(24090) Fetch the room attribute from CurrentRoom_Attribute.
SetAttributes_Flipped_Write 40420 LD (HL),A Write A to the attribute buffer.
SetAttributes_Flipped_Next 40421 INC L Move HL on to the next cell.
40422 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.
40424 POP HL Restore the attribute buffer address from the stack.
40425 LD BC,32 BC=0032 (the size of a row of the attribute buffer).
40428 AND A Move up a row.
40429 SBC HL,BC
40431 POP DE Restore the position in the attributes from the stack.
40432 POP BC Restore the width and height from the stack.
40433 CALL SubtractWidthFromAddress Call SubtractWidthFromAddress to move back to the previous row of the attributes.
40436 DEC C Decrease the height by one and loop back to SetAttributes_Flipped_Row until all of the rows have been set.
40437 JR NZ,SetAttributes_Flipped_Row
40439 RET Return.
Prev: 40352 Up: Map Next: 40440