Prev: D718 Up: Map Next: D7AA
D780: Draw Aligned Columns
Unrolled code that draws the columns of a sprite that is on a byte boundary. Each column of a line takes a pair of bytes off the stack, which are the mask and the data, clears the bits of the mask in the byte of the buffer and sets the bits of the data. The code is entered at the column that gives the number of columns that the sprite has, and the last column carries on at DrawLines_Next.
The first column of a sprite that has five.
DrawAlignedColumns D780 POP DE Take the mask and the data of the column off the stack.
D781 LD A,(BC) Fetch the byte of the buffer.
D782 CPL Clear the bits of the mask and set the bits of the data.
D783 OR E
D784 CPL
D785 OR D
D786 LD (BC),A Store the byte and move on to the next one.
D787 INC BC
The second column of a sprite that has four or five.
D788 POP DE Take the mask and the data of the column off the stack.
D789 LD A,(BC) Fetch the byte of the buffer.
D78A CPL Clear the bits of the mask and set the bits of the data.
D78B OR E
D78C CPL
D78D OR D
D78E LD (BC),A Store the byte and move on to the next one.
D78F INC BC
The third column of a sprite that has three or more.
D790 POP DE Take the mask and the data of the column off the stack.
D791 LD A,(BC) Fetch the byte of the buffer.
D792 CPL Clear the bits of the mask and set the bits of the data.
D793 OR E
D794 CPL
D795 OR D
D796 LD (BC),A Store the byte and move on to the next one.
D797 INC BC
The fourth column of a sprite that has two or more.
D798 POP DE Take the mask and the data of the column off the stack.
D799 LD A,(BC) Fetch the byte of the buffer.
D79A CPL Clear the bits of the mask and set the bits of the data.
D79B OR E
D79C CPL
D79D OR D
D79E LD (BC),A Store the byte and move on to the next one.
D79F INC BC
The last column.
D7A0 POP DE Take the mask and the data of the column off the stack.
D7A1 LD A,(BC) Fetch the byte of the buffer.
D7A2 CPL Clear the bits of the mask and set the bits of the data.
D7A3 OR E
D7A4 CPL
D7A5 OR D
D7A6 LD (BC),A Store the byte.
D7A7 JP DrawLines_Next Jump to DrawLines_Next.
View the equivalent code in;
Prev: D718 Up: Map Next: D7AA