CHAPTER 11
Arithmetic and Logical Operations
8-and 16-Bit Arithmetic Group,
LIeci4 Arithmetic
The arithmetic and logical operations covered in this chapter in-
clude adds, subtracts, logical ORS, ANDS, exclusive ORS, compares,
increments, and decrements. All of these operations can be per-
formed in 8-bit precision and the adds, subtracts, increments, and
decrements can also be performed in 16-bit precision using register
pairs. The functions performed in these groups are some of the most
basic operations that a computer can perform. Additionally, the Z-80
allows bed or decimal adds and subtracts by means of a special
"decimal adjust."
S-BIT ARITHMETIC OPERATIONS
In 8-bit arithmetic operations, two 8-bit operands are added or
subtracted. One of the operands must be in the A register while the
other operand may be an immediate operand, an operand in an-
other CPU register, or an operand from memory. The result of the
operation always goes to the A register. The add or subtract func-
tion sets the condition-code flags in the flag register on the result of
the operation as discussed in Chapter 6. A variety of addressing
modes may be used to fetch the second operand, including register
indirect and indexing addressing.
The simplest operation in this group is an 8-bit add. If a checksum
of a block of 63 bytes was to be computed, the following routine
1
6
1
Need help?
Do you have a question about the Z80 and is the answer not in the manual?
Questions and answers