Page 147 - DCAP210_INTRODUCTION__TO_MICROPROCESSORS
P. 147

Unit 10: Programming Techniques with Additional Instructions



               5A                                                ; destination, Starting          Notes
               40                                                ; at last location
               06                        MVI         B, 06H      ; Byte counter
               06
               7E          NEXT:         MOV         A, M        ; Get data byte
               12                        STAX        D           ; Store data byte
               23                        INX         H           ; Next location

               1B                        DCX         D
               05                        DCR         B           ; Next count
               C2                        JNZ         NEXT        ; If counter is not 0, go
               X                                                 ; back to transfer next byte
               X
               76.                       HLT                     ; End of program.

            10.2 Additional Data Transfer Instructions


            Additional data transfer instructions are between the microprocessor and memory.

            10.2.1 16-bit Data Transfer to Registers Pairs
            This is done with LXI mnemonic of assembly language. LXI is similar to MVI instruction except
            LXI loads 16-bit data in register pairs and the stack pointer register. No flags are affected by these
            instructions. LXI is a 3-byte instruction where as MVI is a 2-byte instruction.
                  Table 10.1 List of Instructions of 16-bit Data Transfer to Register Pairs (LXI).


               Opcode         Operand        Description

               LXI            R, 16-bit      Load Register Pair Immediate
               LXI            B, 16-bit      (a) It is a 3-byte instruction
               LXI            D, 16-bit      (b) Second byte is loaded in the low-order register
                                             of the register pair
               LXI            H, 16-bit      (c) Third byte is loaded in the high-order register
                                              of the register pair.

               LXI            SP, 16-bit     (d) The operands B, D, H, represents BC, DE, HL
                                             registers and SP represents the stack pointer
                                             register.


            The basic difference between MVI and LXI are:
            1. LXI can load 16-bit data in register pairs and stack pointer register where as MOV can copy
               data from source register to destination register and MVI can load 8-bit data into the specified
               register.
            2. LXI is a 3-byte instruction whereas MVI and MOV are 2-byte and 1-byte instructions.





                                             LOVELY PROFESSIONAL UNIVERSITY                                   141
   142   143   144   145   146   147   148   149   150   151   152