Section 2 CPU
Operation field only
Operation field and register fields
op
Operation field, register fields, and effective address extension
op
Operation field, effective address extension, and condition field
op
2.6.5
Notes on Use of Bit Manipulation Instructions
The BSET, BCLR, BNOT, BST, and BIST instructions read a byte of data, modify a bit in the
byte, then write the byte back. Care is required when these instructions are used to access registers
with write-only bits, or to access ports.
Step
Description
1
Read
Read one data byte at the specified address
2
Modify
Modify one bit in the data byte
3
Write
Write the modified data byte back to the specified address
Example 1: BCLR is executed to clear bit 0 in the port 4 data direction register (P4DDR) under
the following conditions.
P4
, P4
:
Input pins
7
6
P4
– P4
: Output pins
5
0
The intended purpose of this BCLR instruction is to switch P4
Rev. 4.00 Jan 26, 2006 page 46 of 938
REJ09B0276-0400
op
rn
rn
EA (disp)
cc
Figure 2.9 Instruction Formats
rm
rm
EA (disp)
from output to input.
0
NOP, RTS, etc.
ADD.B Rn, Rm, etc.
MOV.B @(d:16, Rn), Rm
BRA d:8