The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: FlySky on December 26, 2011, 09:42:50 AM

Title: Weird problem with JL / JLE instruction
Post by: FlySky on December 26, 2011, 09:42:50 AM
Hey guys,

I am just playing with large numbers in my program and encountered the following:

When a value is larger than:

10000000h it has to not take the jump. Else take the jump.

The numbers are translated using htodw as the numbers are text-strings.

after htodw converts the string to it's DWORD value I am using:

cmp eax, 10000000h
jle > SkipTheCode

DoMathematicalOperation:

SkipTheCode:
Ret

Now with the following values the JLE is taken while the values are bigger than 10000000h.

804B1D35 --> JLE is taken ??
8C067485 --> JLE is taken ??
895E498B --> JLE is taken ??
DFB9392C --> JLE is taken ??
CF7953D6 --> JLE is taken ??

Is there any reason why this is happening?
I know 32 bit is limited to 7FFFFFFFh, but why does it stick in in EAX than?
So does it has to be translated into an QWORD value?

Merry xmas and thx for helping already!.

Title: Re: Weird problem with JL / JLE instruction
Post by: jj2007 on December 26, 2011, 12:07:26 PM
Try js and read the manual.
Title: Re: Weird problem with JL / JLE instruction
Post by: FORTRANS on December 26, 2011, 01:28:29 PM
Hi,

   JL and JLE are for signed numbers.  The values you posted
are negative, and are less than 10000000H.  Look at JB and JBE
for unsigned comparisons.

HTH,

Steve N.
Title: Re: Weird problem with JL / JLE instruction
Post by: dedndave on December 26, 2011, 03:26:52 PM
...and JA, JAE

JL, JG, JLE, JGE are for signed comparison

JZ/JE works in both signed and unsigned

what you need is a good table   :bg

http://www.arl.wustl.edu/~lockwood/class/cs306/books/artofasm/Chapter_6/CH06-5.html#HEADING5-226