Prev: 9D19 Up: Map Next: 9D47
9D25: Set Attributes Upright
The handler of SetGraphicAttributes for a graphic that is as it is stored. Each attribute byte is written to the attribute buffer, unless it is 00 (which leaves the attribute as it is) or FF (which uses the attribute of the room from CurrentRoom_Attribute). Each row is a line up from the last, as in DrawGraphic_Upright.
SetAttributes_Upright 9D25 POP BC Restore the attribute and graphic ID from the stack.
9D26 CALL GetGraphicAttributeDetails Call GetGraphicAttributeDetails to get the details of the attributes.
SetAttributes_Upright_Row 9D29 PUSH BC Stash the width and height on the stack.
9D2A PUSH HL Stash the attribute buffer address on the stack.
SetAttributes_Upright_Cell 9D2B LD A,(DE) Fetch the next attribute.
9D2C INC DE Move DE on to the next byte.
9D2D AND A Jump to SetAttributes_Upright_Next if it is 00.
9D2E JR Z,SetAttributes_Upright_Next
9D30 CP $FF Jump to SetAttributes_Upright_Write if it is not FF.
9D32 JR NZ,SetAttributes_Upright_Write
9D34 LD A,($5E1A) Fetch the room attribute from CurrentRoom_Attribute.
SetAttributes_Upright_Write 9D37 LD (HL),A Write A to the attribute buffer.
SetAttributes_Upright_Next 9D38 INC L Move HL on to the next cell.
9D39 DJNZ SetAttributes_Upright_Cell Decrease the width by one and loop back to SetAttributes_Upright_Cell until all of the cells in the row have been set.
9D3B POP HL Restore the attribute buffer address from the stack.
9D3C LD BC,$0020 BC=0020 (the size of a row of the attribute buffer).
9D3F AND A Move up a row.
9D40 SBC HL,BC
9D42 POP BC Restore the width and height from the stack.
9D43 DEC C Decrease the height by one and loop back to SetAttributes_Upright_Row until all of the rows have been set.
9D44 JR NZ,SetAttributes_Upright_Row
9D46 RET Return.
Prev: 9D19 Up: Map Next: 9D47