Page 63 - Introduction to Microcontrollers Architecture, Programming, and Interfacing of The Motorola 68HC12
P. 63
40 Chapter 2 The Instruction Set
Table 2.7. Edit Instructions
The complement instruction COM takes the complement of the bit-by-bit contents of A,
B, or a memory location, putting the result in the same place. Finally, the BIT
instruction, for bit test, determines the bits as though the AND instruction had been
performed with A or B and the contents of a byte from memory. With the BIT
instruction, however, the contents of A and B are unchanged. It is to the AND instruction
what the CMP instruction is to the SUB instruction; it is used to avert the need to reload
the register after the condition code bits are set as in the AND instruction.
Logic instructions are used primarily to set and clear and to test and change
(logically invert) bits in a word. These instructions are used to build operating systems,
compilers, and other programs that control resources and format data. These are the
instructions that make a computer so much more useful than a programmable calculator.
Figure 2.12. Shifts and Rotates