Assembly what is signed and unsigned

JL Jump if (signed) less
JNA Jump if (unsigned) not above

Can someone explain me what is signed and unsigned means.
with a example if possible
Who is Participating?
KendorConnect With a Mentor Commented:
as Infinity08 mentioned there are two types of binary representation. A little example:
signed (-/+) and unsigned (only positive)

0b0101 is 1*2^0+1*2^2 = 5 in signed
0b0101 is the same in unsigned

in signed representation the first bit indicates whether you have a negative value or not.

if we would like to display -5 we would have to do as follows
5 = 0b0101 -> invert -> 0b1010 -> +1 -> 0b1011
which is called the two's complement

so the binary representation of -5 woul be 0b1011 (in signed representation)

you see:
0b1011 if signed represents -5,
however if your value is defined to be unsigned it represents (1*2^3+0*2^2+1*2^1+1*2^0) = 11

therefore you always should know if your values are being written as signed or unsigned.

for your assembly:
let a=-5=0b1011 and b=2=0b0010
with JL Jump if (signed) less => it will jump since -5 < 2
JNA Jump if (unsigned) not above => it will not jump since 0b1011 (=11) > 0b0010 (=2)
Infinity08Connect With a Mentor Commented:
There are two types of integers : signed and unsigned integers.

A signed integer can hold both positive and negative values (in fact, one of the bits will commonly be used as the sign bit, leaving the remaining bits for the value).
And unsigned integer can only hold positive values (ie. all bits will be used for the value).
For further info, see eg. the "Value and representation" paragraph of this wiki :
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.