Drawing the Cursor

Seems like our Chef Horst Hummel got impatient and sliced the hourglass cleanly in half..

The 16×16 cursor image is stored as a bitmap like the newspaper images I described in my previous post on graphics and animation in Supernova. The black outline and red filling are rendered seperately, both taking 32 bytes.

I skimmed through my code and could not find a shift that possibly corrupted the cursor data. But how to fix it? Well, it seems the image is split right at 8 pixels and since they are represented by one byte we could just do a wordRoll that swaps its bytes like wapped = (i >> 8) | (i << 8).

The disassembly shows the critical part for drawing the black outline

next_line:
          lodsw
          mov cx,dx

next_pixel:
          shl ax,1
          jc skip1
          mov byte es:[di],0
skip1:
          inc di
          loop next_pixel

          add di,320
          sub di,dx
          dec bh
          jnz next_line

lodsw… The first endianess bug in this project that I got stuck on…
At least now it’s working and I can keep going with more important stuff like actually making it playable and hopefully won’t get distracted by those small things again…