I want to have sprites and a function to draw them in this game. For sprites, I'll have one byte for the height, followed by one byte for the width, followed by (width x height) bytes for the actual pixel data. A pixel set to 0xff will be transparent. The IBM PC doesn't have a stack at bootup, so we have to set the stack pointer ourselves before we can call functions. I'll use 0x0800:0x7fff downward as our stack. Our binary has also become larger than a single sector, so I'll add a part at the start to load the next sector.

Now, making some sprites and testing them in various locations might look like this:

In this, the lower-right block is a 15 x 15 sprite. The upper-left is the same sprite with an 8 x 8 transparent sprite over it. The lower-left is a 32 x 8 sprite.

We now have a sprite-drawing function. Here is a tar archive of the files used for this chapter.