neg
Negate
Negates A, giving its two's complement, which is the same as subtracting A from zero.
2 bytes · 8 cycles
Used in
- 8-bit and 16-bit arithmetic, logic and bitsZ80 assembly
- The screen, keyboard and mouse through portsZ80 assembly
- The bigger of two numbersZ80 assembly
- A bouncing ballZ80 assembly
SZHP/VNC ●●●●1●
- ● set from the result
- 1 always 1
Forms
negThe contents of A are negated (two's complement). Operation is the same as subtracting A from zero.
.org 0x8000
ld a, 5
neg
halt