Hi ,I just started learning assembly ,and I have a question
when we add unsigned 255 and 1 in 8 bit registry CF=1 and OF=1 right,
and how do we realize if this numbers are sign or unsigned
Thanks

Recommended Answers

All 2 Replies

Since the cpu doesn't distinguish signed from unsigned integers, the only way to check that an unsigned overflow happened is through the carry flag.
If the overflow flag is set, but not the carry flag, an unsigned overflow happened.
It only depends on your interpretation of the data.

ASM is the purest developing language available. It just translates Mnorics to hex code. The good thing is you can control up to 100 percent what your CPU is supposed to do.

CPUs dont distinguish between signed or unsigned variables. They don't even know the difference between datatypes. CPUs do whatever you want them to do.

So if you want to diplay bytes signed, you have to write your own procedure for that. In C this is done by testing the highest (7th) Bit of the Byte. If it's set to 1, then you have a negative number. If not, than it's positive.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.