Prev: B336 Up: Map Next: B37A
B356: Erase Rows
Used by the routine at DrawShot.
Erases rows from the screen, going up from the row that HL is at, using the same layout as DrawRows but with the number of rows in A1D7. The alternate registers are used.
Input
B' Number of bytes in a row
DE' Address of the buffer
HL' Screen address
EraseRows B356 EXX Switch to the alternate registers.
B357 LD A,B A=B.
B358 AND A Jump to EraseRows_Finish if A is zero.
B359 JR Z,EraseRows_Finish
B35B LD C,B C=B.
B35C LD A,($A1D7) The rows to erase.
EraseRows_Row B35F EX AF,AF' Switch to the alternate accumulator and flags.
B360 LD B,C B=C.
B361 PUSH DE Stash DE on the stack.
B362 PUSH HL Stash HL on the stack.
EraseRows_Byte B363 LD A,(DE) Read DE.
B364 CPL Invert A.
B365 AND (HL) Keep the bits of A that are set in the byte at HL.
B366 LD (HL),A Write A where HL points.
B367 INC L Advance L.
B368 INC DE Advance DE.
B369 DJNZ EraseRows_Byte Decrease B and jump to EraseRows_Byte until none remain.
B36B POP HL Bring HL back off the stack.
B36C CALL MoveUpARow Call MoveUpARow.
B36F POP DE Bring DE back off the stack.
B370 LD A,$08 A=08.
B372 ADD A,E A gains E.
B373 LD E,A E=A.
B374 EX AF,AF' Switch to the alternate accumulator and flags.
B375 DEC A Step A back.
B376 JR NZ,EraseRows_Row Jump to EraseRows_Row if the zero flag is clear.
EraseRows_Finish B378 EXX Switch to the alternate registers.
B379 RET Return.
Prev: B336 Up: Map Next: B37A