Motorola M68000 User's Guide Page 145

  • Download
  • Add to my manuals
  • Print
  • Page
    / 256
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 144
Logical, Shift and Rotate Instructions 151
AND[.<size>]
ANDI.<size>]
ANDII.<size>]
OR I.<size>]
0R[.<size>]
ORIt.<size>]
EORt.<size>]
EORI.<size>]
EORI(.<size>]
NOT!.<size>]
<ea>,Dn
Dn,<ea>
#<data>,<ea>
<ea>,Dn
Dn,<ea>
#<data>,<ea>
<ea>fDn
Dn,<ea>
#<data>,<ea>
<ea>
<size>
B, W, or L
For example, we can execute the following instructions:
MOVE.B # $55/DO
ANDI.B #$64,DO
The following logical operation is thus performed:
01010101
AND 01100100
01000100
The result, 4416, would be left in the DO register. The operation has been
shown in binary to make clearer what is happening. The bits in each
column are operated on separately. Notice that the result only contains a
1 in bit positions that have both the source and destination bits set to 1.
The source operand of an AND, OR, or EOR instruction is quite often
called a mask. A mask has the property of changing a certain group of
bits in the destination operand while leaving others alone. For example,
the AND instruction can be used to zero a group of bits while leaving the
others unmodified. We merely form a mask with the bits of the mask set
to ones that correspond to bits in the destination that we wish to leave
unchanged. Let's say that we want to zero the high-order four bits of a
byte in DO. The mask value we would use would be OF 16.
ANDI.B #$0F,D0
We can also make sure that certain bits are set to 1. Those bits will
correspond to ones placed in a mask used with the OR instruction. The
following instruction would ensure that the high-order two bits of a
longword in register D5 are set to 1:
ORI.L #$C000000Q,D5
Page view 144
1 2 ... 140 141 142 143 144 145 146 147 148 149 150 ... 255 256

Comments to this Manuals

No comments