954,490 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

cmp instruction and conditional jumps

When you do something like

cmp eax,ebx
ja start;jump if above
start:


Jump if above jumps if eax is greater or if ebx is greater?

os.hacker64
Newbie Poster
9 posts since Mar 2008
Reputation Points: 8
Solved Threads: 0
 

; hi.
; it will jump if eax is greater.
; "jg" is the opposite

low_coder
Junior Poster in Training
55 posts since Nov 2008
Reputation Points: 40
Solved Threads: 4
 

can you give example of while loop in assymbly code?

josephbeluan
Newbie Poster
13 posts since Feb 2011
Reputation Points: 10
Solved Threads: 0
 

actually jb is the opposite of ja. ja and jg are basically the same, they will both jump if it second operand is > the first opcode... in your example it will jmp to start if eax is above or greater than ebx... ja and jg check differant flags, but do the same thing.

@josephbeluan

How would you write a "while Loop"? you need a counter, and an exit value... you can test the counter at the beginning of the loop or at the end of the loop.... inside the loop, increment your counter and then test where you want to... and jump if the counter is greater than the exit value...

GunnerInc
xor eax, eax
Team Colleague
79 posts since Jan 2011
Reputation Points: 38
Solved Threads: 13
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You