Door thegeps

Champion (315)

afbeelding van thegeps

12-12-2018, 09:52

Hi all. I know XOR A can be used instead LD A,0 and is faster. May I assume I can use XOR B too instead LD B,0 and so on?

Aangemeld of registreer om reacties te plaatsen

Van gdx

Prophet (3172)

afbeelding van gdx

12-12-2018, 10:08

No because A ⊕ A is not same as A ⊕ B.


In addition XOR A is not exactly the same as LD A,0 because XOR A modifies the flags.

Van thegeps

Champion (315)

afbeelding van thegeps

12-12-2018, 10:59

I know XOR A modifies the flags, but I don't need them for this purpouse so they can be discarded. Now I have clear XOR usage.
I misunderstood its usage. I was sure the Xor was between a reg and itself. Now I see it's between reg and A. Thx

Van konamiman

Paragon (1050)

afbeelding van konamiman

12-12-2018, 21:05

"XOR r" instructions are just shortcuts for "XOR A,r", that meaning "A = A XOR r". The same goes for AND, OR and other instructions that take only one parameter, like CP.