Prev: D593 Up: Map Next: D5F8
D5D8: Clear Buffers
Used by the routine at UpdateXXXXXBuffer.
ClearBuffers D5D8 LD A,$03 A=03 (counter).
ClearBuffers_Loop D5DA PUSH AF Stash the counter on the stack.
D5DB CALL ClearBuffers_Action Call ClearBuffers_Action.
D5DE POP AF Restore the counter from the stack.
D5DF DEC A Decrease the counter by one.
D5E0 JR NZ,ClearBuffers_Loop Jump to ClearBuffers_Loop until the counter is zero.
D5E2 CALL ClearBuffers_Action Call ClearBuffers_Action.
D5E5 RET Return.
Calculate each buffer address.
Counter Registers
A HL DE
03 GameBuffer 6801
02 BuildingBuffer 6501
01 6200 6201
00 5F00 5F01
ClearBuffers_Action D5E6 LD H,A H=A.
D5E7 ADD A,A A*=03+5F.
D5E8 ADD A,H
D5E9 ADD A,$5F
D5EB LD H,A H=A.
DE is the same address + 01.
D5EC LD D,A D=A.
D5ED LD L,$00 L=00.
D5EF LD E,$01 E=01.
D5F1 LD (HL),L Write 00 (from L) to *HL.
D5F2 LD BC,$02FF BC=02FF.
D5F5 LDIR Copy 02FF bytes from HL to DE.
D5F7 RET Return.
Prev: D593 Up: Map Next: D5F8