Prev: 46408 Up: Map Next: 46522
46502: Fill Attribute Block
Used by the routines at Messaging_YouWin, DrawCurrentOpponent and Print_MatchCard.
Input
A Attribute byte to copy
B Height (number of rows)
C Width (number of columns)
H Y position
L X position
FillAttributeBlock 46502 PUSH BC Stash the height, width, X/ Y position, attribute byte and (again) height and width on the stack.
46503 PUSH HL
46504 PUSH AF
46505 PUSH BC
Convert the X/ Y co-ordinates to an attribute buffer location.
46506 CALL CalculateAttributeBuffer Call CalculateAttributeBuffer.
46509 POP BC Restore the height, width and attribute byte from the stack.
46510 POP AF
46511 LD B,C Copy the width into B as a counter.
FillAttributeBlock_RowLoop 46512 LD (HL),A Write the attribute byte to the attribute buffer.
46513 INC HL Move the attribute buffer pointer right one position.
46514 DJNZ FillAttributeBlock_RowLoop Decrease the width counter by one and loop back to FillAttributeBlock_RowLoop until this row has been coloured in.
46516 POP HL Restore the original co-ordinates from the stack.
46517 INC H Move down one row.
46518 POP BC Restore the height and width from the stack.
46519 DJNZ FillAttributeBlock Decrease the height counter by one and loop back to FillAttributeBlock until all rows have been coloured in.
46521 RET Return.
Prev: 46408 Up: Map Next: 46522