Assembly x86 registers signed or unsigned

The CPU does not know nor does it care. Instead, bits in the Flags register are set on certain operations, and how your program acts on those flags depends on what the source code told it to.

E.g.,

mov eax, 0FFFFFFFFh
test eax, eax
js isNegative

vs.

mov eax, 0FFFFFFFFh
test eax, eax
jb isNegative

The first jumps to ‘IsNegative’ because test sets the Sign Flag here. The second does not, because test resets the Carry Flag to 0 and jb only jumps if it is 1.

Leave a Comment