Page 149 - DCAP210_INTRODUCTION__TO_MICROPROCESSORS
P. 149
Unit 10: Programming Techniques with Additional Instructions
LDA proves to be more efficient as compared to LDAX and MOV R, M. But for a block of memory Notes
transfer, the instruction LDA (three bytes) will have to be repeated for each memory. On the
other hand, a loop can be set up with two other instructions and the contents of a register pair can
be incremented or decremented.
(2) From Microprocessor to Memory or Directly into Memory
The instructions belonging to this category are listed in Table 10.3.
Table 10.3: List of Instructions Related to Data Transfer from Microprocessor to Memory.
Opcode Operands Description
MOV M, R Move data from register to memory
(a) It is a 1-byte instruction
(b) Copies the data from a register R, into the
memory location specified by the contents of
HL register pair
(c) Uses indirect addressing mode.
STAX B/D Store Accumulator indirect
(a) It is a 1-byte instruction
(b) Copies data from the Accumulator into the
memory location specified by the contents of
either BC or DE registers.
(c) Uses indirect addressing mode
STA 16-bit Store Accumulator direct
(a) It is a 3-byte instruction
(b) Copies data from the Accumulator into the
memory location specified by the 16-bit
operand.
(c) Uses direct addressing mode.
MVI M, 8-bit Load 8-bit data is memory
(a) It is a 2-byte instruction
(b) Second byte specifies 8-bit data
(c) Memory location is specified by the contents
of the HL register.
(d) Uses immediate addressing mode.
Example: Register B contains 48H. Use memory location 8000H for indirect addressing
mode for instructions MOV, STAX, MVI. Also use direct addressing mode for STA instruction.
Solution: In MOV instructions, the byte 48H is copied from register B into memory location
8000H by using the HL as a memory pointer. In STAX instructions, DE register is used as a
memory pointer, the byte 48H must be copied from B into the Accumulator first as the STAX
instruction copies only from the Accumulator.
The STA instruction copies 48H from the Accumulator into the memory location 8000H.
The memory address is specified as the operand. The MVI instruction, load a byte directly in
memory location by using the HL as a memory pointer.
LOVELY PROFESSIONAL UNIVERSITY 143