Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

or instruction followed by a conditional jump

Status
Not open for further replies.

szevvy

Programmer
Aug 8, 2004
2
AU
Hi,

I'm trying to decipher some assembly I've come across, and there seem to be quite a few OR's followed directly by a JNE or similiar...what does this mean? Does OR also set flags if the two operands are equal?

Thanks,

Michael.
 
Hi Michael,

Something like this:

Code:
   or   al,al
   jnz  mylabel
The answer is yes, or instruction affects flags
OF and CF are cleared
SF, ZF and PF are set according to the result
if you need more information, the intel pentium manuals are available for a free download at the intel website,

regards,

Rick
 
... it's quite a common construction because it doesn't change the value of any register except the flags, and it's often shorter than cmp.

But if you can use test, test is sometimes quicker; because or would usually change the value of the destination register, any subsequent instruction using that register as a source will be delayed in the pipeline (even though this particular or won't change anything) until the or is completed. Not usually a big issue, but...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top