Prev: A3CF Up: Map Next: A419
A3F6: Copy the box from the screen into the buffer
Used by the routine at draw_sprite_pair.
The rows are copied bottom-up into the buffer at page $F8. The loop is three pieces: PUSH HL keeps the row's screen address; a DJNZ whose displacement is patched to land in the LDI chain of copy_in_row as many LDIs from its end as the box is bytes wide (7 less the width, times two, plus three to clear the JP); and the chain's end, which pops the address, moves it up a line and jumps back to the PUSH. When B runs out the DJNZ falls through to the JP instead, with one address left on the stack for erase_old_draw_new to drop. C is $FF so that the LDIs' count of BC never reaches B.
Input
H The box's bottom line
L The box's left edge
copy_box_in A3F6 LD DE,$F800 Point DE at the buffer; patch this copy's DJNZ and the copy out's (copy_box_out) for the box's width
A3F9 LD A,(piece_dx)
A3FC XOR $07
A3FE ADD A,A
A3FF ADD A,$03
A401 LD ($A553),A
A404 LD ($A415),A
A407 CALL pixel_to_screen The screen address of the box's bottom-left byte, kept for the copy back
A40A LD (piece_page_x),HL
A40D LD C,$FF C $FF; B the rows plus one
A40F LD A,(piece_rise)
A412 LD B,A
This entry point is used by the routine at copy_in_row.
copy_box_in_0 A413 PUSH HL Keep the address; copy a row (or, when the rows are done, go on to erase_old_draw_new)
A414 DJNZ copy_box_in_0
A416 JP erase_old_draw_new
Prev: A3CF Up: Map Next: A419