We're looking for your comments on how to best organize the wiki's content.
XOR arg1, arg2
XOR performs a bitwise Exclusive-OR on
arg2 and stores the result in
arg1. That is, only the bits different between
arg2 become 1 in the result; all other bits are set to 0.
|Input A||Input B||Output Y|
SET A, 3 ; 0b0011 XOR A, 5 ; 0b0101 ; A is now 0b0110, or 6
In the above program, each bit of each argument to
XOR is compared to each other. Starting from the rightmost, least significant bit:
- 1 equals 1, so the LSB of A is set to 0
- 1 is not equal to 0, so the next bit of A is set to 1
- 0 is not equal to 1, so the next bit of A is set to 1
- 0 is not equal to 0, so the next bit of A is set to 0
- Same for the high 12 bits of the arguments - all are 0, so the high 12 bits of A are set to 0.
 Signing dependence
In binary machine code, this Basic opcode's five-bit representation is:
0b0 1100 (
The instruction has a takes one cycle to execute, plus any additional cycles necessary to evaluate the arguments.
- DCPU-16 specification v1.1 (Copyright 2012 Mojang)
- DCPU-16 specification v1.7 (Copyright 2012 Mojang)