Showing posts with label flag register. Show all posts
Showing posts with label flag register. Show all posts

Thursday, 5 May 2016

Flag register

Flag register:-It contains 5 single bit flags and three unused bits which changes its status according to the result stored in an accumulator. It is also known as status registers.
        There are five flip-flops in the flag register are as follows:
                                1.Sign flag(S)
                                2.zero flag(z)
                                3.Auxiliary carry flag(AC)
                                4.Parity flag(P)
                                5.Carry flag(C)

Bit position of flags in flag register
1.Sign (S)- If D7 of the result is 1 then sign flag is set otherwise reset. As we know that a number on the D7 always decides the sign of the number.
if D7 is 1: the number is negative.
if D7 is 0: the number is positive.

2.Zero (Z)-If the result stored in an accumulator is zero then this flip flop is set otherwise it is reset.

3.Auxiliary carry(AC)-If any carry goes from D3 to D4 in the output then it is set otherwise it is reset.

4.Parity (P)- If the no of 1's is even in the output stored in the accumulator then it is set otherwise it is reset for the odd.

5.Carry Flag (CY)- If the result stored in an accumulator generates a carry in its final output then it is set otherwise it is reset.

Register array

Register array:
     There are various types of registers in 8085.These registers are used for storage ,manipulating data and instructions.The different types of registers are:

  1. Accumulator.
  2. Temporary register.
  3. General purpose register.
  4. Program Counter.
  5. Stack Pointer.
  6. Instruction register.
  7. Flag register.




Accumulator:-It is a 8-bit register which is used to perform arithmetical and logical operation. It stores the output of any operation. It also works as registers for i/o accesses.

Temporary Register:-It is a 8-bit register which is used to hold the data on which the acumulator is computing operation. It is also called as operand register because it provides operands to ALU.

General purposes registers:-Microprocessor consists 6 general purpose registers of 8-bit each named as B,C,D,E,H and L. Generally theses registers are not used for storing the data permanently. It carries the 8-bits data. These are used only during the execution of the instructions.
      These registers can also be used to carry the 16 bits data by making the pair of 2 registers. The valid register pairs available are BC,DE HL. We can not use other pairs except BC,DE and HL . These registers are programmed by user.

Program Counter:-It is a 16 bit register used as memory pointer. It stores the memory address of the next instruction to be executed. So we can say that this register is used to sequencing the program. Generally the memory have 16 bit addresses so that it has 16 bit memory. The program counter is set to 0000H.

Stack Pointer:-It is also a 16 bit register used as memory pointer. It points to the memory location called stack. Generally stack is a reserved portion of memory where information can be stores or taken back together.

Instruction registers :-It is a 8-bit register. When op-code of an instruction is fetched from memory then it is stored in this register. This is not programmable and is not available to he programmer.

Flag register:-It contains 5 single bit flags and three unused bits which changes its status according to the result stored in an accumulator