Prev: 53428 Up: Map Next: 53467
53431: Clear Buffer
Used by the routines at InitialiseGame, GiveReward and ReturnToTown.
Clears PlayfieldBuffer by pushing zeroes onto the stack, 24 bytes in each of 112 rows.
Output
HL The address of the start of the buffer
Point at the end of PlayfieldBuffer, and fill with zero.
ClearBuffer 53431 LD HL,57707 Point HL at the end of PlayfieldBuffer.
53434 LD DE,0 Set the fill word to 0.
53437 LD B,112 Set a count of 112 rows.
Keep the stack pointer, and point it at the end of the buffer.
53439 LD (41501),SP Set SavedStackPointer.
53443 LD SP,HL Point the stack pointer at the end of the buffer.
Clear a row.
ClearBuffer_Row 53444 PUSH DE Stash twelve zero words on the stack.
53445 PUSH DE
53446 PUSH DE
53447 PUSH DE
53448 PUSH DE
53449 PUSH DE
53450 PUSH DE
53451 PUSH DE
53452 PUSH DE
53453 PUSH DE
53454 PUSH DE
53455 PUSH DE
53456 DJNZ ClearBuffer_Row Jump to ClearBuffer_Row.
Keep the start of the buffer, and restore the stack pointer.
53458 LD HL,0 Put the start of the buffer in HL.
53461 ADD HL,SP
53462 LD SP,(41501) Fetch SavedStackPointer.
53466 RET Return.
View the equivalent code in;
Prev: 53428 Up: Map Next: 53467