Prev: 6017 Up: Map Next: 60BD
60A4: Write Attribute Block
Used by the routine at DrawPantry.
Copies a block of colour attributes, which has the width in TileBlockWidth, into the attribute buffer.
Input
C Number of rows
DE Address of the attributes
HL Position of the block
Output
DE Address of the attributes after the block
WriteAttributeBlock 60A4 LD A,($5F28) Fetch the width of the block.
60A7 LD B,A Set the column counter to the width.
60A8 PUSH HL Stash the position of the row on the stack.
60A9 PUSH BC Stash the width on the stack.
60AA CALL AttributeAddress Convert the position to an attribute address using AttributeAddress.
60AD POP BC Restore the column counter from the stack.
WriteAttributeBlock_Loop 60AE LD A,(DE) Copy an attribute from DE to the attribute buffer.
60AF LD (HL),A
60B0 INC HL Move onto the next column.
60B1 INC DE Move onto the next attribute.
60B2 DJNZ WriteAttributeBlock_Loop Decrease the column counter by one and loop back to WriteAttributeBlock_Loop until the row has been copied.
60B4 POP HL Restore the position of the row from the stack.
60B5 LD A,H Fetch the vertical position of the row.
60B6 ADD A,$08 Add 08 to move down one row of tiles.
60B8 LD H,A Update the vertical position of the row.
60B9 DEC C Decrease the row counter by one.
60BA JR NZ,WriteAttributeBlock Loop back to WriteAttributeBlock until all of the rows have been done.
60BC RET Return.
Prev: 6017 Up: Map Next: 60BD