Download Print this page

ZiLOG Z80 Handbook page 165

Hide thumbs Also See for Z80:

Advertisement

CHAPTER 12
Shifting and Bit Manipulation-
Rotate and Shift , Bit Set, Reset,
and Test Groups
The instructions in this general category are basically concerned
with shifting for arithmetic reasons or with manipulation of bits or
fields of data. The Z-80 allows many combinations of shifts, supple-
menting the basic 8080 base containing four rotate A register in-
structions with logical and arithmetic shifts to CPU registers or
memory. With the proper use of shifts, many arithmetic operations
such as multiplication and division may be implemented in addition
to manipulation of fields within words. The bit-oriented instructions
permit testing and storage of data on a bit basis, either in CPU reg-
isters or memory.
LOGICAL SHIFTS
Logical shifts are perhaps the simplest shifts to understand. In a
logical shift of eight bits, there is no consideration of the sign. The
data is shifted right, or left, one bit at a time. The data is not "re-
circulated" to the opposite end of the register or memory location as
it is shifted; bits that are shifted out of the register are lost except
that they set the CY flag. Zeros fill vacated bit positions. There are
two shift methods that perform a logical shift in the Z-80, one being
the SRL or Shift Right Logical, and the other being the SLA or
Shift Left Arithmetic. The latter, although designated "arithmetic,"
performs a classic logical shift. All shifts in the Z-80 operate on
174

Advertisement

loading
Need help?

Need help?

Do you have a question about the Z80 and is the answer not in the manual?

Questions and answers