News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

cmp negative value

Started by kohlyang, June 26, 2010, 03:54:50 PM

Previous topic - Next topic

kohlyang

hi all, i met a simple problem, have thought one night, but still could not get the answer, please help me.

  mov eax, -1
  cmp eax, 0
jb label_negative
  mov eax, 1
label_negative:
  mov eax, 2

because eax is -1, so should jump to label_negative, why not?

can anybody here help to find the reason, and how to jump to that label, many thanks ...

jj2007

Check the difference between jb and jl. opcodes.chm has all the info you need.
Or go here and look for " The .if eax<0 trap"

kohlyang

Quote from: jj2007 on June 26, 2010, 04:14:01 PM
Check the difference between jb and jl. opcodes.chm has all the info you need.
Or go here and look for " The .if eax<0 trap"

brother, thank you very much, you also answered my second queston, what I actually want to ask is ".if eax<0", i'm very suprised to get my queston answered so quickly, thanks very much, I should post here earlier.

I do read "opcodes.chm" and "jxx" before I posted here, but just read the first several conditions, and searched two's complement to represent negtive value.

a good place here, i like here.  :bg :U