News:

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

XOR question.

Started by OceanJeff32, February 01, 2005, 01:06:10 AM

Previous topic - Next topic

OceanJeff32

Now, I'm familiar with this:

test eax, eax
JUMP on condition

But XOR eax, eax?

Is that similar? or is this setting EAX to ZERO.???

You guys are all great, thanks for the help.

Later,

Jeff  :U :toothy :dazzled: :dazzled:
Any good programmer knows, every large and/or small job, is equally large, to the programmer!

pbrennick

OceanJeff32,
The difference between the two is that test eax,eax sets the flag bits based on the result but does not store the result.

xor eax,eax stores the result and changes the flag bits accordingly.

Cheers,
Paul

hutch--

Jeff,
Paul is right here. TEST is usually preferred to OR as it does less work. XOR with the same register sets it to zero. You can also use SUB to do the same thing. SUB EAX, EAX
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Relvinian

Another thing XOR reg, reg or SUB reg, reg are good for is to break the dependancy chain on P4 systems.

Relvinian

Nilrem

If you need more information on basic assembly commands Jeff and hex, bin, and oct data then send me a pm and I will send you the link to an article I wrote a while back.

Mandrake

The XOR is an operation to work with bits in a register. The syntax is: xor register, mask/register.
The result is it sets to 1 all bits that diferes the mask and to 0 all that are equal (in the same position). So, it is useful to set a regeter to 0 using xor ad itself as a mask.