Prev: 42674 Up: Map Next: 42803
42721: Erase Shifted Row In Buffer
Erases one row of a sprite that is not aligned to a byte from the buffer used by DrawSprites, using the shift table that B points to. Each byte of the sprite makes two bytes in the buffer. The entry point depends on the width of the sprite in bytes, from five bytes at EraseShiftedRowInBuffer to one byte at 42777.
Input
B High byte of the shift table
DE' Address of the data of the sprite
HL' Address in the buffer
EraseShiftedRowInBuffer 42721 LD A,(DE) Fetch a byte of the sprite.
42722 LD C,A Use it to look up the left part in the shift table.
42723 LD A,(BC) Fetch the left part.
42724 CPL Invert it.
42725 AND (HL) Clear the pixels of the buffer.
42726 LD (HL),A Store the byte.
42727 INC B Move to the table of right parts.
42728 INC L Move on to the next byte of the buffer.
42729 LD A,(BC) Fetch the right part.
42730 CPL Invert it.
42731 DEC B Move back to the table of left parts.
42732 AND (HL) Clear the pixels of the buffer.
42733 LD (HL),A Store the byte.
42734 INC DE Move on to the next byte of the sprite.
42735 LD A,(DE) Fetch a byte of the sprite.
42736 LD C,A Use it to look up the left part in the shift table.
42737 LD A,(BC) Fetch the left part.
42738 CPL Invert it.
42739 AND (HL) Clear the pixels of the buffer.
42740 LD (HL),A Store the byte.
42741 INC B Move to the table of right parts.
42742 INC L Move on to the next byte of the buffer.
42743 LD A,(BC) Fetch the right part.
42744 CPL Invert it.
42745 AND (HL) Clear the pixels of the buffer.
42746 LD (HL),A Store the byte.
42747 DEC B Move back to the table of left parts.
42748 INC DE Move on to the next byte of the sprite.
42749 LD A,(DE) Fetch a byte of the sprite.
42750 LD C,A Use it to look up the left part in the shift table.
42751 LD A,(BC) Fetch the left part.
42752 CPL Invert it.
42753 AND (HL) Clear the pixels of the buffer.
42754 LD (HL),A Store the byte.
42755 INC B Move to the table of right parts.
42756 INC L Move on to the next byte of the buffer.
42757 LD A,(BC) Fetch the right part.
42758 CPL Invert it.
42759 DEC B Move back to the table of left parts.
42760 AND (HL) Clear the pixels of the buffer.
42761 LD (HL),A Store the byte.
42762 INC DE Move on to the next byte of the sprite.
42763 LD A,(DE) Fetch a byte of the sprite.
42764 LD C,A Use it to look up the left part in the shift table.
42765 LD A,(BC) Fetch the left part.
42766 CPL Invert it.
42767 AND (HL) Clear the pixels of the buffer.
42768 LD (HL),A Store the byte.
42769 INC B Move to the table of right parts.
42770 INC L Move on to the next byte of the buffer.
42771 LD A,(BC) Fetch the right part.
42772 CPL Invert it.
42773 DEC B Move back to the table of left parts.
42774 AND (HL) Clear the pixels of the buffer.
42775 LD (HL),A Store the byte.
42776 INC DE Move on to the next byte of the sprite.
42777 LD A,(DE) Fetch a byte of the sprite.
42778 LD C,A Use it to look up the left part in the shift table.
42779 LD A,(BC) Fetch the left part.
42780 CPL Invert it.
42781 AND (HL) Clear the pixels of the buffer.
42782 LD (HL),A Store the byte.
42783 INC B Move to the table of right parts.
42784 INC L Move on to the next byte of the buffer.
42785 LD A,(BC) Fetch the right part.
42786 CPL Invert it.
42787 DEC B Move back to the table of left parts.
42788 AND (HL) Clear the pixels of the buffer.
42789 LD (HL),A Store the byte.
42790 INC DE Move on to the next byte of the sprite.
42791 LD A,0 Fetch the amount to skip, which was set at 42080.
42793 ADD A,L Add it to the address in the buffer.
42794 LD L,A Store it in L.
42795 EX AF,AF' Switch to the count of rows.
42796 DEC A Take one off.
42797 JP Z,DrawSprites_Draw Jump to DrawSprites_Draw to draw the second sprite when there are none left.
42800 EX AF,AF' Switch back.
42801 JP (IY) Erase the next row.
Prev: 42674 Up: Map Next: 42803