Prev: 46035 Up: Map Next: 46201
46159: Draw Aligned Columns
Draws the columns of a sprite which is not shifted or flipped. There is a piece of code for each of up to five columns, and the code for the width of the sprite is where the jump at DrawLines_Jump starts. Each piece takes the mask and the pixels for one byte of the row from the sprite data on the stack, wipes the screen where the mask is and puts the pixels in. The buffer address is in BC.
The first unit of the run, which is used by sprites of five bytes wide.
DrawAlignedColumns 46159 POP DE Fetch the mask byte into E and the pixel byte into D.
Fetch the byte from the buffer.
46160 LD A,(BC) Clear the screen bits under the mask.
46161 CPL
46162 OR E
46163 CPL
46164 OR D Set the pixel bits.
Write the byte to the buffer.
46165 LD (BC),A Store the byte and move on to the next.
46166 INC BC
The second unit, which is used by sprites that are four bytes wide.
46167 POP DE Fetch the mask into E and the pixels into D.
46168 LD A,(BC) Clear the screen bits under the mask.
46169 CPL
46170 OR E
46171 CPL
46172 OR D Add the pixels.
46173 LD (BC),A Store the byte and move on to the next.
46174 INC BC
The third unit, which is used by sprites that are three bytes wide.
46175 POP DE Fetch the mask into E and the pixels into D.
46176 LD A,(BC) Clear the screen bits under the mask.
46177 CPL
46178 OR E
46179 CPL
46180 OR D Add the pixels.
46181 LD (BC),A Store the byte and move on to the next.
46182 INC BC
The fourth unit, which is used by sprites that are two bytes wide.
46183 POP DE Fetch the mask into E and the pixels into D.
46184 LD A,(BC) Clear the screen bits under the mask.
46185 CPL
46186 OR E
46187 CPL
46188 OR D Add the pixels.
46189 LD (BC),A Store the byte and move on to the next.
46190 INC BC
The last unit, which is used by sprites that are one byte wide.
46191 POP DE Fetch the mask into E and the pixels into D.
46192 LD A,(BC) Clear the screen bits under the mask.
46193 CPL
46194 OR E
46195 CPL
46196 OR D Add the pixels.
46197 LD (BC),A Store the byte.
Finish the row.
46198 JP DrawLines_FinishRow Jump to DrawLines_FinishRow to finish the row.
View the equivalent code in;
Prev: 46035 Up: Map Next: 46201