Prev: 807A Up: Map Next: 80AA
8093: Clear Play Area
Used by the routines at GameOver, EnterRoom and FallThroughTrapdoor.
Clears the pixels of the play area, which is the left-hand 18 bytes of each of the C0 rows of the screen buffer. The attributes are left alone.
Before After
clear-play-area-before clear-play-area-after
ClearPlayArea 8093 LD HL,$4000 HL=4000 (the start of the screen buffer).
8096 LD BC,$18C0 B=18 (the number of bytes to clear in each row) and C=C0 (the number of rows).
8099 XOR A A=00 (the value to write).
This entry point is used by the routines at DrawRoomFrame and DrawSidePanelAttrs.
Each pass of this loop clears one row.
ClearPlayArea_Row 809A PUSH BC Stash the counters on the stack.
809B PUSH HL Stash the row address on the stack.
809C LD DE,$0020 DE=0020 (the size of a row).
ClearPlayArea_Byte 809F LD (HL),A Write A to *HL.
80A0 INC HL Move HL on to the next byte.
80A1 DJNZ ClearPlayArea_Byte Decrease the byte counter by one and loop back to ClearPlayArea_Byte until the whole row has been cleared.
80A3 POP HL Restore the row address from the stack.
80A4 ADD HL,DE Move HL on to the next row.
80A5 POP BC Restore the counters from the stack.
80A6 DEC C Decrease the row counter by one and loop back to ClearPlayArea_Row until all C0 rows have been cleared.
80A7 JR NZ,ClearPlayArea_Row
80A9 RET Return.
Prev: 807A Up: Map Next: 80AA