943,987 Members | Top Members by Rank

Ad:
  • Assembly Discussion Thread
  • Unsolved
  • Views: 15944
  • Assembly RSS
Mar 22nd, 2008
0

cmp instruction and conditional jumps

Expand Post »
When you do something like

Assembly Syntax (Toggle Plain Text)
  1. cmp eax,ebx
  2. ja start;jump if above
  3. start:

Jump if above jumps if eax is greater or if ebx is greater?
Reputation Points: 8
Solved Threads: 0
Newbie Poster
os.hacker64 is offline Offline
9 posts
since Mar 2008
Dec 7th, 2008
0

Re: cmp instruction and conditional jumps

; hi.
; it will jump if eax is greater.
; "jg" is the opposite
Reputation Points: 40
Solved Threads: 4
Junior Poster in Training
low_coder is offline Offline
55 posts
since Nov 2008
Mar 28th, 2011
0
Re: cmp instruction and conditional jumps
can you give example of while loop in assymbly code?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
josephbeluan is offline Offline
12 posts
since Feb 2011
Mar 28th, 2011
0
Re: cmp instruction and conditional jumps
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...
Sponsor
Reputation Points: 38
Solved Threads: 13
xor eax, eax
GunnerInc is offline Offline
77 posts
since Jan 2011

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Assembly Forum Timeline: reading from file to buffer ->sorting->writing to file
Next Thread in Assembly Forum Timeline: I need help for my assignment :(





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC