Brand new to assembly need some help with unsigned arithmetic. Converting from a C program is that means anything.
Using:
Linux
NASM
x86 (3
In assembly, there are no distinct signed and unsigned types. A register holds a value that can be either signed or unsigned, depending on how you look at it.
The are instructions that are consistent with the signed interpretation (jg
, jl
, etc.) and instructions that are consistent with the unsigned interpretation (ja
, jb
, etc.) The cmp
instruction works for both - it sets flags that can be used by instructions like jl
to jump based on the signed interpretation, and flags that can be used by instructions like jb
to jump based on the unsigned interpretation. Whichever flags you're not using, you just ignore.
So when you say "my register storing that is negative", that's nonsense. It can only appear negative if you chose to interpret it that way.