Zilog Z80 Instruction Set - 8-bit Arithmetic Group
The 8-bit Arithmetic Group for the Zilog Z80 Instruction Set provides operations for basic arithmetic functions such as addition, subtraction, bitwise operations on 8-bit, or byte, operands. The Zilog Z180 does offer 8-bit multiplication operations which can be found in this document.
ADD A, r
Operation
A ← A + r
Op Code
ADD
| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|
| 1 | 0 | 0 | 0 | 0 | ← r → | ||
Operands
A, r
Description
The contents of register r are added to the contents of the Accumulator, and the result is stored in the Accumulator.
Condition Bits Affected
- S is set if result is negative; otherwise, it is reset.
- Z is set if result is 0; otherwise, it is reset.
- H is set if carry from bit 3; otherwise, it is reset.
- P/V is set if overflow; otherwise, it is reset.
- N is reset.
- C is set if carry from bit 7; otherwise, it is reset.
Example
If the Accumulator contains 44h and Register C contains 11h, then upon the execution of an ADD A, C instruction, the Accumulator contains 55h.
| M-Cyles | T-States | 4 MHz E.T. |
|---|---|---|
| 1 | 4 | 1.0 |
ADD A, n
Operation
A ← A + n
Op Code
ADD
| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | |
|---|---|---|---|---|---|---|---|---|
| 1 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | C6 |
| ← n → | ||||||||
Operands
A, n
Description
The n integer is added to the contents of the Accumulator, and the results are stored in the Accumulator.
Condition Bits Affected
- S is set if result is negative; otherwise, it is reset.
- Z is set if result is 0; otherwise, it is reset.
- H is set if carry from bit 3; otherwise, it is reset.
- P/V is set if overflow; otherwise, it is reset.
- N is reset.
- C is set if carry from bit 7; otherwise, it is reset.
Example
If the Accumulator contains 23h, then upon the execution of an ADD A, 33h instruction, the Accumulator contains 56h.
| M-Cyles | T-States | 4 MHz E.T. |
|---|---|---|
| 2 | 7 (4, 3) | 1.75 |
ADD A, (HL)
Operation
A ← A + (HL)
Op Code
ADD
| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | |
|---|---|---|---|---|---|---|---|---|
| 1 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 86 |
Operands
A, (HL)
Description
The byte at the memory address specified by the contents of the HL register pair is added to the contents of the Accumulator, and the result is stored in the Accumulator.
Condition Bits Affected
- S is set if result is negative; otherwise, it is reset.
- Z is set if result is 0; otherwise, it is reset.
- H is set if carry from bit 3; otherwise, it is reset.
- P/V is set if overflow; otherwise, it is reset.
- N is reset.
- C is set if carry from bit 7; otherwise, it is reset.
Example
If the Accumulator contains A0h, register pair HL contains 2323h, and memory location 2323h contains byte 08h, then upon the execution of an ADD A, (HL) instruction, the Accumulator contains A8h.
| M-Cyles | T-States | 4 MHz E.T. |
|---|---|---|
| 2 | 7 (4, 3) | 1.75 |
Z180 Specific Operations
MLT rr
Operation
rr ← r1×r2
Op Code
MLT
| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | |
|---|---|---|---|---|---|---|---|---|
| 1 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | ED |
| 0 | 1 | ← rr → | 1 | 1 | 0 | 0 | ||
Operands
rr
Condition Bits Affected
Unknown.
Description
The MLT performs unsigned multiplication on two 8-bit numbers yielding a 16-bit result. MLT may specify BC, DE, HL, or SP registers. The 8-bit operands are loaded into each half of the 16-bit register and the 16-bit result is returned in that register.