
132 Assembly Language Programming for the 68000 Family
EOR has the most interesting property in its use with a mask. Each bit
set to 1 in the mask corresponds to a bit in the destination that we desire
to complement. In other words, 1 flips to 0 or 0 flips to 1.
Shifts
The logical instructions can be used to manipulate individual bits or
groups of bits within a byte, word, or longword. However, the positions
of the bits that are manipulated remain the same. We sometimes desire to
treat all of the bits of a byte or word as a group and change their positions.
One can imagine a virtually unlimited number of possible operations.
Since it would not be practical to implement a machine instruction for
every possible reorganization of the bits of a word or byte, two of the
most useful operations are implemented, shifts and rotates.
The bits of a word or byte are normally numbered as follows:
Byte
7
G
5 4 3 2 1 0
IS 14 13
12
11
10 9
Word
B 7
6 5
4 3 2
1 0
31 30 29 2B
27 26
Longword
6 5
4 3 2
1 0
The bits of a word or byte can be shifted either to the left or to the right.
For each shift of one position, all the bits move to the left or right, each
bit replacing the bit that was previously occupying that position. This
looks like the following:
Kommentare zu diesen Handbüchern