Prev: D0B4 Up: Map Next: D0DB
D0B7: Clear Buffer
Used by the routines at InitialiseGame, GiveReward and ReturnToTown.
Clears PlayfieldBuffer by pushing zeroes onto the stack, 18 bytes in each of 70 rows.
Output
HL The address of the start of the buffer
Point at the end of PlayfieldBuffer, and fill with zero.
ClearBuffer D0B7 LD HL,$E16B Point HL at the end of PlayfieldBuffer.
D0BA LD DE,$0000 Set the fill word to 00.
D0BD LD B,$70 Set a count of 70 rows.
Keep the stack pointer, and point it at the end of the buffer.
D0BF LD ($A21D),SP Set SavedStackPointer.
D0C3 LD SP,HL Point the stack pointer at the end of the buffer.
Clear a row.
ClearBuffer_Row D0C4 PUSH DE Stash twelve zero words on the stack.
D0C5 PUSH DE
D0C6 PUSH DE
D0C7 PUSH DE
D0C8 PUSH DE
D0C9 PUSH DE
D0CA PUSH DE
D0CB PUSH DE
D0CC PUSH DE
D0CD PUSH DE
D0CE PUSH DE
D0CF PUSH DE
D0D0 DJNZ ClearBuffer_Row Jump to ClearBuffer_Row.
Keep the start of the buffer, and restore the stack pointer.
D0D2 LD HL,$0000 Put the start of the buffer in HL.
D0D5 ADD HL,SP
D0D6 LD SP,($A21D) Fetch SavedStackPointer.
D0DA RET Return.
View the equivalent code in;
Prev: D0B4 Up: Map Next: D0DB