Prev: 40398 Up: Map Next: 40481
40440: 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 40440 POP BC Restore the attribute and graphic ID from the stack.
40441 CALL GetGraphicAttributeDetails Call GetGraphicAttributeDetails to get the details of the attributes.
40444 CALL FindLastRow Call FindLastRow to move on to the last row.
40447 CALL AddWidthToAddress Call AddWidthToAddress to move on to the end of the last row.
40450 DEC DE Move DE back one byte.
SetAttributes_RotatedHalf_Row 40451 PUSH BC Stash the width and height on the stack.
40452 PUSH HL Stash the attribute buffer address on the stack.
SetAttributes_RotatedHalf_Cell 40453 LD A,(DE) Fetch the next attribute.
40454 DEC DE Move DE back one byte.
40455 AND A Jump to SetAttributes_RotatedHalf_Next if it is 0.
40456 JR Z,SetAttributes_RotatedHalf_Next
40458 CP 255 Jump to SetAttributes_RotatedHalf_Write if it is not 255.
40460 JR NZ,SetAttributes_RotatedHalf_Write
40462 LD A,(24090) Fetch the room attribute from CurrentRoom_Attribute.
SetAttributes_RotatedHalf_Write 40465 LD (HL),A Write A to the attribute buffer.
SetAttributes_RotatedHalf_Next 40466 INC L Move HL on to the next cell.
40467 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.
40469 POP HL Restore the attribute buffer address from the stack.
40470 LD BC,32 BC=0032 (the size of a row of the attribute buffer).
40473 AND A Move up a row.
40474 SBC HL,BC
40476 POP BC Restore the width and height from the stack.
40477 DEC C Decrease the height by one and loop back to SetAttributes_RotatedHalf_Row until all of the rows have been set.
40478 JR NZ,SetAttributes_RotatedHalf_Row
40480 RET Return.
Prev: 40398 Up: Map Next: 40481