Prev: B548 Up: Map Next: B5BA
B5A6: Fill Attribute Block
Used by the routines at Messaging_YouWin, DrawCurrentOpponent and B548.
Input
A Attribute byte to copy
B Height (number of rows)
C Width (number of columns)
H Y position
L X position
FillAttributeBlock B5A6 PUSH BC Stash the height, width, X/ Y position, attribute byte and (again) height and width on the stack.
B5A7 PUSH HL
B5A8 PUSH AF
B5A9 PUSH BC
Convert the X/ Y co-ordinates to an attribute buffer location.
B5AA CALL CalculateAttributeBuffer Call CalculateAttributeBuffer.
B5AD POP BC Restore the height, width and attribute byte from the stack.
B5AE POP AF
B5AF LD B,C Copy the width into B as a counter.
FillAttributeBlock_RowLoop B5B0 LD (HL),A Write the attribute byte to the attribute buffer.
B5B1 INC HL Move the attribute buffer pointer right one position.
B5B2 DJNZ FillAttributeBlock_RowLoop Decrease the width counter by one and loop back to FillAttributeBlock_RowLoop until this row has been coloured in.
B5B4 POP HL Restore the original co-ordinates from the stack.
B5B5 INC H Move down one row.
B5B6 POP BC Restore the height and width from the stack.
B5B7 DJNZ FillAttributeBlock Decrease the height counter by one and loop back to FillAttributeBlock until all rows have been coloured in.
B5B9 RET Return.
Prev: B548 Up: Map Next: B5BA