XOR
Compute the bitwise exclusive OR of the two operands, storing the result in the left operand.
| Opcode | Bytes | Cycles | Form | Example |
|---|---|---|---|---|
| $82 | 3 | 3 | xor b:_, {u_byte} | xor b:1, 123 |
| $d2 | 4 | 3 | xor p:_, {u_pair} | xor p:2, 12345 |
| $83 | 3 | 3 | xor i:_, {u_byte} | xor i:4, 123 |
| $d3 | 4 | 3 | xor i:_, {u_pair} | xor i:4, 12345 |
| $84 | 3 | 3 | xor i:_, xhex {xint} | xor i:4, xhex $d000_0000 |
| $85 | 3 | 3 | xor b:_, b:_ | xor b:1, b:2 |
| $86 | 3 | 3 | xor p:_, p:_ | xor p:2, p:4 |
| $87 | 3 | 3 | xor i:_, i:_ | xor i:4, i:8 |
| Condition flag | Output |
|---|---|
| zero (ZF) | If the result is zero, this flag is 1; otherwise it is 0. |
| negative (NF) | This flag is updated with the highest bit of the result. For example, if xor b:0, $ff stores $80 in b:0, then NF will be 1. |
| overflow (OF) | This flag is always 0. |
| carry (CF) | This flag is always 0. |
Notes
-
xoris commonly used for reversing bits. -
Large literal values such as
$d000_0000must be compatible with XHEX encoding.