Prev: B3D3 Up: Map Next: B479
B44F: 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 B44F POP DE Fetch the mask byte into E and the pixel byte into D.
Fetch the byte from the buffer.
B450 LD A,(BC) Clear the screen bits under the mask.
B451 CPL
B452 OR E
B453 CPL
B454 OR D Set the pixel bits.
Write the byte to the buffer.
B455 LD (BC),A Store the byte and move on to the next.
B456 INC BC
The second unit, which is used by sprites that are four bytes wide.
B457 POP DE Fetch the mask into E and the pixels into D.
B458 LD A,(BC) Clear the screen bits under the mask.
B459 CPL
B45A OR E
B45B CPL
B45C OR D Add the pixels.
B45D LD (BC),A Store the byte and move on to the next.
B45E INC BC
The third unit, which is used by sprites that are three bytes wide.
B45F POP DE Fetch the mask into E and the pixels into D.
B460 LD A,(BC) Clear the screen bits under the mask.
B461 CPL
B462 OR E
B463 CPL
B464 OR D Add the pixels.
B465 LD (BC),A Store the byte and move on to the next.
B466 INC BC
The fourth unit, which is used by sprites that are two bytes wide.
B467 POP DE Fetch the mask into E and the pixels into D.
B468 LD A,(BC) Clear the screen bits under the mask.
B469 CPL
B46A OR E
B46B CPL
B46C OR D Add the pixels.
B46D LD (BC),A Store the byte and move on to the next.
B46E INC BC
The last unit, which is used by sprites that are one byte wide.
B46F POP DE Fetch the mask into E and the pixels into D.
B470 LD A,(BC) Clear the screen bits under the mask.
B471 CPL
B472 OR E
B473 CPL
B474 OR D Add the pixels.
B475 LD (BC),A Store the byte.
Finish the row.
B476 JP DrawLines_FinishRow Jump to DrawLines_FinishRow to finish the row.
View the equivalent code in;
Prev: B3D3 Up: Map Next: B479