Page 150 - DCAP210_INTRODUCTION__TO_MICROPROCESSORS
P. 150

Introduction to Microprocessors


                  Notes          (a)        Machine code         Opcode                Operands

                                            21                   LXI                   H, 8000H
                                            00
                                            80
                                            70                   MOV                   M, B

                                 (b)        Machine code         Opcode                Operands
                                            11                   LXI                   D, 8000H 00
                                            80
                                            78                   MOV                   A, B

                                            12                   STAX                  D

                                 10.3 Additional Arithmetic Operations

                                 Simple arithmetic operations describe the operations between numbers or contents of the
                                 microprocessor register. The advanced arithmetic operations include memory as one of its operand.
                                 The arithmetic instructions referenced to memory perform two tasks:
                                 (a) Copy a byte from a memory location to the microprocessor.
                                 (b) Perform arithmetic operation.

                                 10.3.1 Related to Memory

                                 ADD and SUB instructions implicitly assume that one of the operand is register A i.e., Accumulator.
                                 After an operation, the previous contents of the Accumulator are replaced by the result. All the
                                 flags are modified according to the result.


                                               Table 10.4: List of Memory Related Arithmetic Operations.

                                     Opcode        Operands        Description

                                     ADD           M               Add memory contents
                                                                   (a) It is a 1-byte instruction.
                                                                   (b) Adds (M) to (A) and stores result in A.
                                                                   (c) Contents of HL register specifies the memory
                                                                       location.
                                     SUB                           Subtract memory
                                                                   (a) It is a 1-byte instruction.
                                                                   (b) Subtract (M) from (A) and stores the result in
                                                                       A
                                                                   (c) Contents of HL register specifies the memory
                                                                       location.
                                     INR           M               Increments memory contents
                                                                   (a) It is a 1-byte instruction
                                                                   (b) Increments the contents of memory by 1, not
                                                                       the memory address
                                                                   (c) (HL) register specifies the memory location.
                                                                                                     Contd. ...


        144                              LOVELY PROFESSIONAL UNIVERSITY
   145   146   147   148   149   150   151   152   153   154   155