xor
Logical exclusive OR
Sets A to the bitwise exclusive OR of A and a register, memory byte or immediate value.
- 8-bit and 16-bit arithmetic, logic and bitsZ80 assembly
- The screen, keyboard and mouse through portsZ80 assembly
- Sum of an arrayZ80 assembly
- Multiply and divide, with the remainderZ80 assembly
- A jump tableZ80 assembly
- Convert a number to a string in any baseZ80 assembly
- Drawing shapes on the screenZ80 assembly
- A bouncing ballZ80 assembly
- Move a square with the keyboardZ80 assembly
- The snake gameZ80 assembly
- ● depends on the result
- 0 always 0
Forms
-
Sets A to the bitwise XOR of A and
r. xor1 byte7 cyclesSets A to the bitwise XOR of A and (HL).
xor2 bytes7 cyclesSets A to the bitwise XOR of A and
nn.-
Sets A to the bitwise XOR of A and the value pointed to by IX plus
dd.
Pseudo-instructions
The assembler also accepts these forms, which are other ways to write Z80 instructions. Open a row to see what each form becomes.
-
Sets A to the bitwise XOR of A and
r. -
Sets A to the bitwise XOR of A and (HL).
-
Sets A to the bitwise XOR of A and
nn. -
Sets A to the bitwise XOR of A and the value pointed to by IX plus
dd.
Undocumented 1 row
Zilog’s manual does not list these forms, but the Z80 runs them.
-
Sets A to the bitwise XOR of A and
ixh/l.
Pseudo-instructions · Undocumented 1 row
The assembler also accepts these forms, which are other ways to write Z80 instructions. Open a row to see what each form becomes. Zilog’s manual does not list these forms, but the Z80 runs them.
-
Sets A to the bitwise XOR of A and
ixh/l.
Operands
r- An 8-bit register:
a,b,c,d,e,horl. (hl)- The byte in memory at the address stored in
hl. More nn- An 8-bit immediate value,
0to255or-128to127, written as a number, character constant or symbol. More (ix+dd)- The byte in memory at
ix + dd, whereddis a signed displacement from-128to127, for example(ix+5)or(ix-3).(iy+dd)works the same way. More ixh/l- The high or low byte of
ix:ixhorixl. Foriy, useiyhoriyl. More
.org 0x8000
ld a, 5
ld b, 3
xor b
halt