Gi@nnis Cheater Reputation: 1 Joined: 26 Oct 2013 Posts: 32 Location: Greece
|
Posted: Fri May 02, 2014 3:52 am Post subject: Re: A question |
|
|
@Nemexia55:
Nemexia55 wrote: |
cmp eax,ebx ==> eax=5 ebx=6
jl [99+99a]
jl will jump or not??!!
|
Yes it will jump. (If [99+99a] was a valid address or a label)
Just to be clear, your code will NOT work. But if the eax register contains 5 and the ebx 6 the after comparing them the instruction Jl will lead to a jump.
Nemexia55 wrote: | What is the deference between:
ja and jg
jb and jl
|
Ja vs Jg: Ja compares the numbers as unSIGNED and jumps if the value first value is greater than the second value, while Jg compare the number as signed. It doesn't actually do any comparison, it just reads the flags, but you know what I mean...
Jb vs Jl: Just like the Ja/Jg, unsigned/singed.
So as an example:
Code: |
Cmp EAX,EBX // EAX=-1,EBX=2
// Ja will jump, Jg will NOT jump.
|
@SliderMan:
Direct, mem/mem, comparison is impossible, as far as I know. You need to use a register. But with push and pop protecting the original value of your register this shouldn't be a problem. Note that push and pop operations do not affect any flag (unlike most other operations).
So for example you can say:
Code: |
Push EAX
Mov EAX,[mem_address1]
Cmp EAX,[mem_address2]
Pop EAX
Jz a_label
|
|
|