this post was submitted on 01 Feb 2024
15 points (89.5% liked)

Programming

17270 readers
39 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



founded 1 year ago
MODERATORS
 

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
top 5 comments
sorted by: hot top controversial new old
[–] [email protected] 20 points 9 months ago (2 children)

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

[–] [email protected] 2 points 9 months ago

Thanks, I somehow completely missed that.

[–] [email protected] 2 points 9 months ago (1 children)

Do you perhaps know how to show the leading zeros?

[–] [email protected] 3 points 9 months ago (1 children)

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

[–] [email protected] 1 points 9 months ago

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