Prev: AAE2 Up: Map Next: AB0F
AAE5: Fill Scratch Rectangle
Used by the routines at PrintText and DrawFrame.
Fills a rectangle of the attribute file using the rectangle at AttributeRectangle.
Input
HL The pixel position of the bottom left of the rectangle
FillScratchRectangle AAE5 LD DE,$AAE2 Point DE at the rectangle.
This entry point is used by the routines at ShowEnding, SwitchPlayer, StartGame, RunGame, DrawPanel and DrawGaugeBar.
This entry point takes the address of the rectangle in DE.
FillRectangle AAE8 PUSH HL Save the position.
AAE9 CALL GetAttributeAddress Convert the position into an attribute address.
AAEC LD A,(DE) Fetch the width of the rectangle.
AAED LD ($AAFF),A Store it in the operand of the instruction at AAFE.
AAF0 ADD A,$1E Add 1E to it.
AAF2 CPL Invert it, to make minus the width less 1F.
AAF3 LD ($AB07),A Store it in the operand of the instruction at AB06.
AAF6 INC DE Move onto the height.
AAF7 LD A,(DE) Fetch it.
AAF8 LD C,A Keep the height in C.
AAF9 INC DE Move onto the attribute.
AAFA LD A,(DE) Fetch it.
AAFB LD ($AB01),A Store it in the operand of the instruction at AB00.
FillRectangle_Row AAFE LD B,$00 Set the width of the row (this is patched at AAFF).
FillRectangle_Cell AB00 LD (HL),$00 Set the attribute of a cell (this is patched at AB01).
AB02 INC L Move onto the next cell.
AB03 DJNZ FillRectangle_Cell Jump back until the row has been filled.
AB05 DEC L Move back to the last cell of the row.
AB06 LD DE,$FF00 Set the offset to the start of the row above (this is patched at AB07).
AB09 ADD HL,DE Add it to the address.
AB0A DEC C Decrease the height by one.
AB0B JR NZ,FillRectangle_Row Jump back until all of the rows have been filled.
AB0D POP HL Restore the position.
AB0E RET Return.
Prev: AAE2 Up: Map Next: AB0F