Page 42 - DCAP210_INTRODUCTION__TO_MICROPROCESSORS
P. 42

Introduction to Microprocessors


                  Notes          3.1.1 Registers

                                 The 8085 has six general-purpose registers to store 8-bit data; these are identified as B, C, D, E, H,
                                 and L as shown in the figure. They can be combined as register pairs — BC, DE, and HL – to
                                 perform some 16-bit operations. The programmer can use these registers to store or copy data
                                 into the registers by using data copy instructions.

                                                Any registers including memory can be incremented and decremented.


                                 3.1.2 Accumulator
                                 The accumulator is an 8-bit register that is a part of arithmetic/logic unit (ALU). This register is
                                 used to store 8-bit data and to perform arithmetic and logical operations. The result of an operation
                                 is stored in the accumulator. The accumulator is also identified as register A.

                                 3.1.3 Flags
                                 The ALU includes five flip-flops, which are set or reset after an operation according to data
                                 conditions of the result in the accumulator and other registers. They are called Zero (Z), Carry
                                 (CY), Sign (S), Parity (P), and Auxiliary Carry (AC) flags; their bit positions in the flag register are
                                 shown in the Figure 3.2 below. The most commonly used flags are Zero, Carry, and Sign. The
                                 microprocessor uses these flags to test data conditions.

                                                                 Figure 3.2: Flags








                                 For example, after an addition of two numbers, if the sum in the accumulator is larger than eight
                                 bits, the flip-flop uses to indicate a carry called the Carry flag (CY) is set to one. When an arithmetic
                                 operation results in zero, the flip-flop called the Zero (Z) flag is set to one. The first Figure shows
                                 an 8-bit register, called the flag register, adjacent to the accumulator. However, it is not used as a
                                 register; five bit positions out of eight are used to store the outputs of the five flip-flops. The flags
                                 are stored in the 8-bit register so that the programmer can examine these flags (data conditions)
                                 by accessing the register through an instruction.
                                 These flags have critical importance in the decision-making process of the microprocessor. The
                                 conditions (set or reset) of the flags are tested through the software instructions. For example, the
                                 instruction JC (Jump on Carry) is implemented to change the sequence of a program when CY
                                 flag is set. The thorough understanding of flag is essential in writing assembly language programs.

                                                The flags are affected according to the results.



                                 3.1.4 Program Counter (PC)

                                 This 16-bit register deals with sequencing the execution of instructions. This register is a memory
                                 pointer. Memory locations have 16-bit addresses, and that is why this is a 16-bit register.

                                 The microprocessor uses this register to sequence the execution of the instructions. The function
                                 of the program counter is to point to the memory address from which the next byte is to be
                                 fetched. When a byte (machine code) is being fetched, the program counter is incremented by
                                 one to point to the next memory location.



        36                               LOVELY PROFESSIONAL UNIVERSITY
   37   38   39   40   41   42   43   44   45   46   47