Prev: 58367 Up: Map Next: 58569
58527: 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 58527 POP DE Take the mask and the pixels of the first character from the stack.
58528 LD A,(BC) Fetch the byte of the screen buffer.
58529 CPL Clear the pixels under the mask, and set the pixels of the sprite.
58530 OR E
58531 CPL
58532 OR D
58533 LD (BC),A Put the byte in the screen buffer, and move on to the next byte.
58534 INC BC
Draw the second character.
DrawAlignedColumns_Four 58535 POP DE Take the mask and the pixels of the second character from the stack.
58536 LD A,(BC) Fetch the byte of the screen buffer.
58537 CPL Clear the pixels under the mask, and set the pixels of the sprite.
58538 OR E
58539 CPL
58540 OR D
58541 LD (BC),A Put the byte in the screen buffer, and move on to the next byte.
58542 INC BC
Draw the third character.
DrawAlignedColumns_Three 58543 POP DE Take the mask and the pixels of the third character from the stack.
58544 LD A,(BC) Fetch the byte of the screen buffer.
58545 CPL Clear the pixels under the mask, and set the pixels of the sprite.
58546 OR E
58547 CPL
58548 OR D
58549 LD (BC),A Put the byte in the screen buffer, and move on to the next byte.
58550 INC BC
Draw the fourth character.
DrawAlignedColumns_Two 58551 POP DE Take the mask and the pixels of the fourth character from the stack.
58552 LD A,(BC) Fetch the byte of the screen buffer.
58553 CPL Clear the pixels under the mask, and set the pixels of the sprite.
58554 OR E
58555 CPL
58556 OR D
58557 LD (BC),A Put the byte in the screen buffer, and move on to the next byte.
58558 INC BC
Draw the fifth character.
DrawAlignedColumns_One 58559 POP DE Take the mask and the pixels of the fifth character from the stack.
58560 LD A,(BC) Fetch the byte of the screen buffer.
58561 CPL Clear the pixels under the mask, and set the pixels of the sprite.
58562 OR E
58563 CPL
58564 OR D
58565 LD (BC),A Put the byte in the screen buffer.
58566 JP EndSpriteRow Jump to EndSpriteRow to move on to the next row.
View the equivalent code in;
Prev: 58367 Up: Map Next: 58569