I’ve been trying to debug a program I’m working on and have managed to narrow it down to a single not statement. I fail to understand how this could fail. My current suspicion is the fact that I’m using a 16 bit (aka short) register. Should I even be using this?

Before not di 1101111110000000
Expected after not di 0010000001111111
Actually after not di 10000001111111

Code

.certain:
not di ; ← this line is the problem
bsf ax, di

GDB output

(gdb) p/t (short) $di $4 = 1101111110000000
(gdb) nexti
(gdb) p/t (short) $di $5 = 10000001111111
  • @mrkite
    link
    205 months ago

    Your result is correct, is just not displaying the leading zeros.

    • qazOP
      link
      fedilink
      25 months ago

      Do you perhaps know how to show the leading zeros?

      • @mrkite
        link
        35 months ago

        I’m not great with gdb but I think using the x cmd shows them.

        • qazOP
          link
          fedilink
          15 months ago

          Yes, but that doesn’t seem to work with registers

    • qazOP
      link
      fedilink
      25 months ago

      Thanks, I somehow completely missed that.