Page 152 - DCAP210_INTRODUCTION__TO_MICROPROCESSORS
P. 152
Introduction to Microprocessors
Notes
Example: Write instructions to load the number 3040H in the register pair BC. Increment
the number using the instruction INX B.
Solution: The assembly language program for the above stated problem is as follows:
Machine code Opcode Operands
(Hex)
01 LXI B, 3040H 40
30
03 INX B
Example: Write instructions to load the number 2054H in the register pair BC. Decrement
the number using the DCX B.
Solution: The assembly language program for the above stated problem is as follows:
Machine code Opcode Operands
(Hex)
01 LXI B, 2054H
54
20
OB DCX B
10.4 Advanced Logical Operations
The advanced logical operations include rotate and compare instructions. The rotate instruction
is related to rotating the Accumulator bits. The compare instruction compares the data byte or
register/memory contents with the contents of the Accumulator.
10.4.1 Rotate
Rotate instructions rotate the Accumulator bits. This group includes four instructions. Two for
rotating left and two are for rotating right.
Table 10.6: List of Rotate Instructions.
Opcode Description
RLC Rotate Accumulator left
(a) Each bit is shifted to the adjacent left position
(b) Bit D, becomes Do
(c) CY flag is modifed according to bit D7
RAL Rotate Accumulator left through carry
(a) Each bit is shifted to the adjacent left position
(b) D7 becomes the carry bit .
(c) Carry bit is shifted into Do
RRC Rotate Accumulator right
(a) Each bit is shifted right to the adjacent position
Contd. ...
146 LOVELY PROFESSIONAL UNIVERSITY