Prev: F04C Up: Map Next: F065
F050: Clear the 512 bytes below HL
Used by the routine at SORT_AND_DRAW_BEHIND.
And the two entries every fill of the buffers uses: CLEAR_BELOW, at offset 2, clears B times 8 bytes below HL, and FILL_BELOW, at offset 5, fills them with DE. The stack pointer is put at HL and DE pushed four times a turn, the fastest way a Z80 has to fill memory; SP is kept at IY+$76 while it is borrowed. No interrupt can push into the area meanwhile: the game runs with interrupts off (the DI at offset 11 of START). Krumlinde's names for these are RTN_ClearBuffer_512, FastFill_Zero and RTN_FastFill.
Input
HL The byte after the last to fill
B The number of 8-byte units, at CLEAR_BELOW and FILL_BELOW
DE The word to fill with, at FILL_BELOW
CLEAR_512_BELOW F050 LD B,$40 64 units: 512 bytes
This entry point is used by the routines at PRINT, SHOW_THING_IN_USE, CLEAR_THING_BOX and CLEAR_256_BELOW.
CLEAR_BELOW F052 LD DE,$0000 CLEAR_BELOW: fill with zero
This entry point is used by the routines at CLEAR_THING_BOX and REDRAW_OBJECT.
FILL_BELOW F055 LD (WORK_HEADING),SP FILL_BELOW: the stack pointer borrowed
F059 LD SP,HL
CLEAR_512_BELOW_0 F05A PUSH DE Eight bytes a turn, going down
F05B PUSH DE
F05C PUSH DE
F05D PUSH DE
F05E DJNZ CLEAR_512_BELOW_0
F060 LD SP,(WORK_HEADING) And given back
F064 RET
Prev: F04C Up: Map Next: F065