Prev: A59F Up: Map Next: A669
A629: Erase Aligned Row Directly
Erases one row of a sprite that is aligned to a byte from the screen. The entry point depends on the width of the sprite in bytes, from six bytes at EraseAlignedRowDirectly to one byte at EraseAlignedRowDirectly_Sixth. Each byte clears the pixels of the screen that are set in the sprite.
Input
DE' Address of the data of the sprite
HL' Screen address of the row
EraseAlignedRowDirectly A629 LD A,(DE) Fetch a byte of the sprite.
A62A CPL Invert it.
A62B AND (HL) Clear the pixels of the screen.
A62C LD (HL),A Store the byte.
A62D INC L Move on to the next byte of the screen.
A62E INC DE Move on to the next byte of the sprite.
EraseAlignedRowDirectly_Second A62F LD A,(DE) Fetch a byte of the sprite.
A630 CPL Invert it.
A631 AND (HL) Clear the pixels of the screen.
A632 LD (HL),A Store the byte.
A633 INC L Move on to the next byte of the screen.
A634 INC DE Move on to the next byte of the sprite.
EraseAlignedRowDirectly_Third A635 LD A,(DE) Fetch a byte of the sprite.
A636 CPL Invert it.
A637 AND (HL) Clear the pixels of the screen.
A638 LD (HL),A Store the byte.
A639 INC L Move on to the next byte of the screen.
A63A INC DE Move on to the next byte of the sprite.
EraseAlignedRowDirectly_Fourth A63B LD A,(DE) Fetch a byte of the sprite.
A63C CPL Invert it.
A63D AND (HL) Clear the pixels of the screen.
A63E LD (HL),A Store the byte.
A63F INC L Move on to the next byte of the screen.
A640 INC DE Move on to the next byte of the sprite.
EraseAlignedRowDirectly_Fifth A641 LD A,(DE) Fetch a byte of the sprite.
A642 CPL Invert it.
A643 AND (HL) Clear the pixels of the screen.
A644 LD (HL),A Store the byte.
A645 INC L Move on to the next byte of the screen.
A646 INC DE Move on to the next byte of the sprite.
EraseAlignedRowDirectly_Sixth A647 LD A,(DE) Fetch a byte of the sprite.
A648 CPL Invert it.
A649 AND (HL) Clear the pixels of the screen.
A64A LD (HL),A Store the byte.
A64B INC DE Move on to the next byte of the sprite.
This entry point is used by the routine at EraseMirroredRowDirectly.
EraseAlignedRowDirectly_Next A64C LD A,($5C28) Fetch the low byte of the screen address of the start of the row.
A64F LD L,A Restore it.
A650 DEC H Move up a pixel row.
A651 LD A,H Fetch the high byte.
A652 INC A Add one.
A653 AND %00000111 Keep the bits that give the pixel row.
A655 JP NZ,DrawNextRow Jump to DrawNextRow if the row is still in the same cell.
A658 LD A,L Fetch the low byte.
A659 SUB $20 Move up a row of cells.
A65B LD L,A Store it.
A65C LD ($5C28),A Store it as the start of the row.
A65F JP C,DrawNextRow Jump to DrawNextRow if that crossed a third of the screen.
A662 LD A,H Fetch the high byte.
A663 ADD A,$08 Add eight to correct it.
A665 LD H,A Store it.
A666 JP DrawNextRow Jump to DrawNextRow.
Prev: A59F Up: Map Next: A669