Motorola M68000 User's Guide Page 152

  • Download
  • Add to my manuals
  • Print
  • Page
    / 256
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 151
158 Assembly Language Programming for the 68000 Family
<bitop> Dn,<ea>
<bitop> #<data>,<ea>
<bitop> = BTSTr BSET, BCLR, BCBG
The effective address can be a data register or memory location, but
not an address register. For each of these instructions, you specify the
number of the particular bit that you want to manipulate. The bits are
numbered starting with the low-order bit as bit 0. The bit number may be
placed in a register for the first form of the instruction, or specified as an
immediate value for the second form of the instruction. If the effective
address is a data register, then the instruction operates on any of the 32
bits of the data register. If the effective address is a memory location,
then the instruction operates only on the byte at the specified address. In
other words, the range of the bit number must be between 0 and 7.
BSET and BCLR will set the specified bit to a 1 or a 0 respectively.
BCHG will complement the specified bit—in other words, a 1 becomes
a 0, and vice versa. BTST will test the specified bit to determine if it is
a 1 or a 0. It does not change it. The Z-condition bit is set accordingly.
If the bit is zero, then Z will be set. It doesnt matter what the values of
the other bits are in the data item.
Exercises
1. What is NOT 55AA16?
2. What is AAAA16 or 555516?
3. Write a logical instruction that will clear register DO.
4. Write a logical instruction that will ensure that the high-order three
bits of register DO are ones.
5. Write a logical instruction that will ensure that the low-order four bits
of register DO are zeros.
6. Write a logical instruction that will set the bits of register Dl such that
a bit is set to one if it differs from the corresponding bit in register
DO.
7. Give the bit number of the high-order bit for
a) a byte
b) a word
c) a longword
8. Where does the bit go that is shifted off the end in a left or right shift?
9. What is the difference between a logical shift right and an arithmetic
right?
10. Is there a difference between the ASL and LSL instructions?
11. What register can be used to specify a shift count?
Page view 151
1 2 ... 147 148 149 150 151 152 153 154 155 156 157 ... 255 256

Comments to this Manuals

No comments