Prev: 48773 Up: Map Next: 48869
48778: Draw Shifted Columns
Draws the columns of a sprite which is shifted to the right by two, four or six pixels. There is a piece of code for each of up to five columns of the sprite, and the code for the width of the sprite is where the jump at SpriteJumpOpcode starts. Each piece puts a column into two bytes of the buffer, using the table for the shift to split the mask and the pixels in two. The buffer address is in BC.
The jump at SpriteJumpOpcode starts here for five columns.
DrawShiftedColumns 48778 CPL Invert the screen byte, and fetch the mask into E and the pixels into D.
48779 POP DE
48780 LD L,E Clear the screen bits under the part of the mask which is in this byte.
48781 OR (HL)
48782 CPL
48783 LD L,D Add the part of the pixels which is in this byte.
48784 OR (HL)
48785 LD (BC),A Store the byte and move on to the next.
48786 INC BC
48787 INC H Point H at the table for the bits which move into the next byte, and fetch that screen byte.
48788 LD L,E
48789 LD A,(BC)
48790 CPL Clear the screen bits under the part of the mask which has moved into it.
48791 OR (HL)
48792 CPL
48793 LD L,D Add the part of the pixels which has moved into it.
48794 OR (HL)
48795 DEC H Point H back at the first table.
The jump at SpriteJumpOpcode starts here for four columns.
48796 CPL Invert the screen byte, and fetch the mask into E and the pixels into D.
48797 POP DE
48798 LD L,E Clear the screen bits under the part of the mask which is in this byte.
48799 OR (HL)
48800 CPL
48801 LD L,D Add the part of the pixels which is in this byte.
48802 OR (HL)
48803 LD (BC),A Store the byte and move on to the next.
48804 INC BC
48805 INC H Point H at the table for the bits which move into the next byte, and fetch that screen byte.
48806 LD L,E
48807 LD A,(BC)
48808 CPL Clear the screen bits under the part of the mask which has moved into it.
48809 OR (HL)
48810 CPL
48811 LD L,D Add the part of the pixels which has moved into it.
48812 OR (HL)
48813 DEC H Point H back at the first table.
The jump at SpriteJumpOpcode starts here for three columns.
48814 CPL Invert the screen byte, and fetch the mask into E and the pixels into D.
48815 POP DE
48816 LD L,E Clear the screen bits under the part of the mask which is in this byte.
48817 OR (HL)
48818 CPL
48819 LD L,D Add the part of the pixels which is in this byte.
48820 OR (HL)
48821 LD (BC),A Store the byte and move on to the next.
48822 INC BC
48823 INC H Point H at the table for the bits which move into the next byte, and fetch that screen byte.
48824 LD L,E
48825 LD A,(BC)
48826 CPL Clear the screen bits under the part of the mask which has moved into it.
48827 OR (HL)
48828 CPL
48829 LD L,D Add the part of the pixels which has moved into it.
48830 OR (HL)
48831 DEC H Point H back at the first table.
The jump at SpriteJumpOpcode starts here for two columns.
48832 CPL Invert the screen byte, and fetch the mask into E and the pixels into D.
48833 POP DE
48834 LD L,E Clear the screen bits under the part of the mask which is in this byte.
48835 OR (HL)
48836 CPL
48837 LD L,D Add the part of the pixels which is in this byte.
48838 OR (HL)
48839 LD (BC),A Store the byte and move on to the next.
48840 INC BC
48841 INC H Point H at the table for the bits which move into the next byte, and fetch that screen byte.
48842 LD L,E
48843 LD A,(BC)
48844 CPL Clear the screen bits under the part of the mask which has moved into it.
48845 OR (HL)
48846 CPL
48847 LD L,D Add the part of the pixels which has moved into it.
48848 OR (HL)
48849 DEC H Point H back at the first table.
The jump at SpriteJumpOpcode starts here for one column.
48850 CPL Invert the screen byte, and fetch the mask into E and the pixels into D.
48851 POP DE
48852 LD L,E Clear the screen bits under the part of the mask which is in this byte.
48853 OR (HL)
48854 CPL
48855 LD L,D Add the part of the pixels which is in this byte.
48856 OR (HL)
48857 LD (BC),A Store the byte and move on to the next.
48858 INC BC
48859 INC H Point H at the table for the bits which move into the next byte, and fetch that screen byte.
48860 LD L,E
48861 LD A,(BC)
48862 CPL Clear the screen bits under the part of the mask which has moved into it.
48863 OR (HL)
48864 CPL
48865 LD L,D Add the part of the pixels which has moved into it.
48866 OR (HL)
48867 DEC H Point H back at the first table.
48868 LD (BC),A Store the last byte of the row.
Continue on to FinishSpriteRow.
View the equivalent code in;
Prev: 48773 Up: Map Next: 48869