Prev: A419 Up: Map Next: A498
A43E: Rub out the old image in the buffer, then draw the new one
Used by the routines at draw_sprite_pair and copy_box_in.
The middle of draw_sprite_pair. The register sets are swapped so that the main set holds the old image's graphic and shift page (saved by the EXX after prepare_erase) while the new image's wait in the other set. Each row routine finishes by adding the patched step to L (the box's width less the bytes the routine covered), counting the rows in A', and either jumping back through IY (or IX) for the next row or on to the next stage.
erase_old_draw_new A43E POP HL Drop the unused screen address left by the copy in
A43F POP BC Restore the new image's graphic and page, and swap them out of the way
A440 POP DE
A441 EXX
A442 LD A,(old_sprite_rows) No old image: straight on to drawing the new one
A445 AND A
A446 JP Z,erase_old_draw_new_1
A449 LD HL,(old_sprite_x) Where the old image starts in the buffer
A44C CALL buffer_address
A44F LD A,(old_sprite_width) The bytes a row covers: the width, less one if byte-aligned (a shifted row spills into one more byte)
A452 LD C,A
A453 LD A,B
A454 CP $F8
A456 JR NZ,erase_old_draw_new_0
A458 DEC C
erase_old_draw_new_0 A459 LD A,(piece_dx) The step from the end of one row to the start of the next, into both erase loops
A45C SUB C
A45D LD ($A6D6),A
A460 LD ($A728),A
A463 LD A,(old_sprite_rows) Rub out the old image's rows (A' counts them)
A466 EX AF,AF'
A467 JP (IY)
This entry point is used by the routines at erase_aligned_row and erase_row_shifted.
erase_old_draw_new_1 A469 EXX Swap to the new image's graphic and page
A46A LD A,(new_sprite_rows) No new image: copy the box back
A46D AND A
A46E JP Z,dissolve_sprite_2
A471 LD HL,(new_sprite_x) Where the new image starts in the buffer
A474 CALL buffer_address
A477 LD A,(new_sprite_width) The bytes a row covers
A47A LD C,A
A47B LD A,B
A47C CP $F8
A47E JR NZ,erase_old_draw_new_2
A480 DEC C
erase_old_draw_new_2 A481 LD A,(piece_dx) The step to the next row, into both draw loops
A484 SUB C
A485 LD ($A751),A
A488 LD ($A799),A
A48B DEC A The dissolve's step (dissolve_sprite) is one less, as it covers one byte more
A48C LD ($A4C5),A
A48F LD (saved_speed),HL Keep the start for the dissolve, in saved_speed
A492 LD A,(new_sprite_rows) Draw the new image's rows
A495 EX AF,AF'
A496 JP (IX)
Prev: A419 Up: Map Next: A498