Prev: E3FF Up: Map Next: E4C9
E49F: Draw Aligned Columns
The code that draws a row of a sprite that is on a character boundary. There is a copy of the code for each of up to five characters, and the code is entered at the one that leaves the number of characters of the sprite, by DrawSprite. Each character takes a mask and pixels from the stack, and puts them on the screen buffer: the pixels under the mask are cleared, and then the pixels of the sprite are set.
Input
BC Address in the screen buffer
Draw the first character.
DrawAlignedColumns_Five E49F POP DE Take the mask and the pixels of the first character from the stack.
E4A0 LD A,(BC) Fetch the byte of the screen buffer.
E4A1 CPL Clear the pixels under the mask, and set the pixels of the sprite.
E4A2 OR E
E4A3 CPL
E4A4 OR D
E4A5 LD (BC),A Put the byte in the screen buffer, and move on to the next byte.
E4A6 INC BC
Draw the second character.
DrawAlignedColumns_Four E4A7 POP DE Take the mask and the pixels of the second character from the stack.
E4A8 LD A,(BC) Fetch the byte of the screen buffer.
E4A9 CPL Clear the pixels under the mask, and set the pixels of the sprite.
E4AA OR E
E4AB CPL
E4AC OR D
E4AD LD (BC),A Put the byte in the screen buffer, and move on to the next byte.
E4AE INC BC
Draw the third character.
DrawAlignedColumns_Three E4AF POP DE Take the mask and the pixels of the third character from the stack.
E4B0 LD A,(BC) Fetch the byte of the screen buffer.
E4B1 CPL Clear the pixels under the mask, and set the pixels of the sprite.
E4B2 OR E
E4B3 CPL
E4B4 OR D
E4B5 LD (BC),A Put the byte in the screen buffer, and move on to the next byte.
E4B6 INC BC
Draw the fourth character.
DrawAlignedColumns_Two E4B7 POP DE Take the mask and the pixels of the fourth character from the stack.
E4B8 LD A,(BC) Fetch the byte of the screen buffer.
E4B9 CPL Clear the pixels under the mask, and set the pixels of the sprite.
E4BA OR E
E4BB CPL
E4BC OR D
E4BD LD (BC),A Put the byte in the screen buffer, and move on to the next byte.
E4BE INC BC
Draw the fifth character.
DrawAlignedColumns_One E4BF POP DE Take the mask and the pixels of the fifth character from the stack.
E4C0 LD A,(BC) Fetch the byte of the screen buffer.
E4C1 CPL Clear the pixels under the mask, and set the pixels of the sprite.
E4C2 OR E
E4C3 CPL
E4C4 OR D
E4C5 LD (BC),A Put the byte in the screen buffer.
E4C6 JP EndSpriteRow Jump to EndSpriteRow to move on to the next row.
View the equivalent code in;
Prev: E3FF Up: Map Next: E4C9