Prev: 24599 Up: Map Next: 24765
24740: 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 24740 LD A,(24360) Fetch the width of the block.
24743 LD B,A Set the column counter to the width.
24744 PUSH HL Stash the position of the row on the stack.
24745 PUSH BC Stash the width on the stack.
24746 CALL AttributeAddress Convert the position to an attribute address using AttributeAddress.
24749 POP BC Restore the column counter from the stack.
WriteAttributeBlock_Loop 24750 LD A,(DE) Copy an attribute from DE to the attribute buffer.
24751 LD (HL),A
24752 INC HL Move onto the next column.
24753 INC DE Move onto the next attribute.
24754 DJNZ WriteAttributeBlock_Loop Decrease the column counter by one and loop back to WriteAttributeBlock_Loop until the row has been copied.
24756 POP HL Restore the position of the row from the stack.
24757 LD A,H Fetch the vertical position of the row.
24758 ADD A,8 Add 8 to move down one row of tiles.
24760 LD H,A Update the vertical position of the row.
24761 DEC C Decrease the row counter by one.
24762 JR NZ,WriteAttributeBlock Loop back to WriteAttributeBlock until all of the rows have been done.
24764 RET Return.
Prev: 24599 Up: Map Next: 24765