News:

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

Ja (Jump if above)

Started by ragdog, November 08, 2009, 03:00:52 PM

Previous topic - Next topic

ragdog

Hi

I have a question to ja register (Jump if above)
Is this in the high level syntax

;cmp eax,ebx
;ja @return   

.if eax>=ebx

Is this correct?

Greets,
      
   

jj2007

These are two examples. Check the attachment for a more complete list (opens in WordPad, MS Word or RichMasm).
Quote.if eax>=0
   nop
.endif
test eax, eax
jb @F
   nop
@@:

.if sdword ptr eax>=0
   nop
.endif
test eax, eax
jl @F
   nop
@@:

ragdog

Thanks for you reply

>= is JAE (jump if above or equal) ?

I think i must set >

.if eax >ebx jmp if greater or jmp if above

or is this wrong?

Gives a complete opcodes list with this signs (high leve syntax?)

greets


jj2007

Quote from: ragdog on November 08, 2009, 03:33:45 PM
>= is JAE (jump if above or equal) ?

Yes it is, but watch your step: the high level says .if eax<XXX then do something, the low level says jump, i.e. do nothing if it is above or equal.

dedndave

hiyas Jochen - Z sends a K
how do you know if you are using signed or unsigned jumps ?

jj2007

Quote from: dedndave on November 08, 2009, 07:30:37 PM
hiyas Jochen - Z sends a K
how do you know if you are using signed or unsigned jumps ?

hiyas Dave - 2K back ;-)
See attachment above - the red ones are signed. In high level syntax, either use a signed variable: MySignedVar SDWORD -123, or .if sdword ptr eax

One frequent source of trouble is .if eax<0 - that condition is never true...

include \masm32\include\masm32rt.inc

.code
start:
mov eax, -123
.if eax<0
inkey "Wow, eax is less than zero"
.else
inkey "Surprise, eax seems higher than zero...!"
.endif
exit
end start

ragdog

Thanks for your info and help

Farabi

And also if Im not mistaken the "<" compare sign is unsigned, it cannot compare a signed number.
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

dedndave

yes - i remember something about gt and lt - lol

Jochen - the J's i know - i was asking about the macro stuffage
is it ".gt" for signed ? - or something like that
of course, if i wasn't completely lazy, i could rtfm - lol

jj2007

Quote from: Farabi on November 09, 2009, 01:09:46 AM
And also if Im not mistaken the "<" compare sign is unsigned, it cannot compare a signed number.

It can, it can... just use .if sdword ptr eax in my example above

Quote from: dedndave on November 09, 2009, 01:29:47 AM
yes - i remember something about gt and lt - lol

Jochen - the J's i know - i was asking about the macro stuffage
is it ".gt" for signed ? - or something like that
of course, if i wasn't completely lazy, i could rtfm - lol

It is gt, but test yourself if that is signed or not - no idea...

ragdog

Thanks for your help

ebx 123

I use .if eax>ebx ;if eax greater than ebx
           jmp out
         ; or
       ; .break for stop a  loop this
       .endif

Thanks

jj2007

Quote.if sdword ptr eax>ebx ;if eax greater than ebx: SIGNED
  nop
.endif

.if eax>ebx ;if eax above ebx: UNSIGNED
  nop
.endif