MICROPROCESOR ARCHITECTURE-2
Register Organization
• The 8085 microprocessor has various types of registers as shown
below.
• It includes six , 8 – bit registers (B, C, D. E, H and L), one 8-bit
Accumulator ,One Flag register and two 16-bit registers (SP and PC).
• Also there are two 8-bit temporary registers
W and Z.
• These registers W and Z are not
accessible to the user, They are used by the
processor for internal, intermediate operations.
• These registers B, C, D. E, H and L are known
• as general purpose registers.
contd
• The registers Program Counter and Stack Pointer are known as the
speci purpose Registers.
• So, the total registers are classified into three groups .They are
(i).Temporary registers. (W and Z )
(ii).General purpose registers (B, C, D. E, H and L)
(iii).Special purpose registers. (SP and PC).
• The special purpose registers PC and SP are 16 bit registers.
• As you know 8085 is a 8-bit processor with 16 bit-address bus.So, the
address of the memory location is always16-bit .
• But a very interesting thing is there are no 16-bit general purpose
registers to hold the address of the memory location.
contd
• To overcome this limitation, Intel has provided the feature of Register
pairing.
• That is two 8-bitregisters are paired so that they can store a 16-bt
address.
• The admissible register pairs are B-C; D-E and H-L only. No other
pairs are allowed.
• These pair of register are mainly used only during the times of
address accessing .
• At all the other times they are only 8-bit data registers (B,C,D,E,H and
L).
• Let us see this with an example.
• LXI H 8509 ; It means, load immediately the register pair H-L with
the address 8509.
contd
• Here L-register is loaded with 09 and H-register is loaded with
address 85H. Here H indicates that the address is Hexadecimal.
• It is a three byte instruction.(Hex code = 21, 09, 85 (Three bytes)
21 = 0010 0001 8-bits = 1 byte
09 = 0000 1001 8-bits = 1 byte
85 = 1000 0110 8-bits = 1 byte
Total 3-bytes
Program Counter (PC)
• It is a 16-bit special purpose register, which stores the address of the
next instruction to be fetched or executed.
• The execution of a program is initiated by loading the PC by the address
of the first instruction of the program.
• Once the first instruction is executed, the PC is automatically
incremented to point to the next instruction unless a jump to some
specific address occurs.
• This process is repeated till the last instruction of the program is
executed.
•
contd
• Here the diagram shows the Operation of PC.
contd
• In case of JUMP or CALL instructions, current address is stored in the
Program Counter.
• The processor then fetches
the next instruction from the
new address specified by the
JUMP or CALL instruction.
Address HEX –
CODE
LABEL MNEMONIC COMMENTS
OPCODE OPERAND
8000 21,00,85 LXI H, 8500 INITIALISE H-L PAIR
8003 7E MOV C,M Count in the C register
8004 23 INX H First number in H-L pair
8005 4E MOV A,M Move first number in to Accumulator
8006 0D DCR C Decrement the count
8007 91 LOOP1 INX H Get the next number
8008 BE CMP M Compare the next number with previous
number
8009 D2 JNC LOOP2 Is next number >previous maximum?No,go
to the loop2
800A 0D
800B 80
800C 7E MOV A,M If,yes move the large number in to
Accumulator
800D 0D LOOP2 DCR C Decrement the count
800E C2 JNZ LOOP1 If count not equal to zero,repeat
800F 07
8011 80
8012 78
8013 32 STA 85XX Store the largest number in the location
85XX
8014 XX
8015 85
8016 76 HLT Stop the execution
Stack Pointer (SP)
• It is a 16-bit special purpose register which always stores the address of
top of the Stack. i.e. it always points to top of the Stack.
• Stack is a part of the memory location used to store the data
temporarily.
• A stack works on Last in First out (LIFO) basis. As the Stack pointer
always points to the top of the Stack, only top of the Stack of the
memory can be accessed.
• When a Write operation (PUSH) takes place, the contents of the stack
pointer is decremented by two so that the SP points to the new location.
Stack Pointer (SP)
• Similarly when the Read operation (POP) occurs, the Stack pointer is
incremented by two to point to the next data on top of the Stack.
• The Stack Pointer is initialized by load register pair immediate
instruction.
• Ex: LXI SP, 8530 H
Here 8530 H is the 16 bit address of the top of Stack location.
Stack Details
• Stack is a set of memory locations in the Read/Write memory(RAM),
which is used for temporary storage of binary information during the
execution of a program.
• It is implemented in the Last-in-first-out (LIFO) manner. i.e., the data
written first can be accessed last.
• The stack may also be used for storing local variables of subroutine and
for the transfer of parameter addresses to a subroutine.
• This facilitates the implementation of re-entrant subroutines which is a
very important software property.
Stack operation
• Operations on stack are performed using the two instructions namely PUSH and
POP.
• The contents of the stack are moved to certain memory locations on stack after
PUSH instruction. Similarly, the contents of the stack are transferred back to
registers by POP instruction.
• For example, let us consider a Stack whose
stack top is 4506 H. This is stored in the
16-bit Stack pointer register as shown below.
• Let us consider two registers (register pair) B &
C whose contents are 25 & 62.
Reg. B Reg. C
contd
• After PUSH operation the status of the Stack is as shown below.
contd
• Let us now consider POP operation: The Figs below explains before
and after the POP operation in detail.
• Ex: POP B
Temporary Registers
• The two temporary data registers are W register and Z register. These
are 8-bit registers.
• We have already seen in the earlier video that one temporary data
register is associated with the ALU operations.
• Similarly W and Z are also temporary registers used to hold 8-bit data
during execution of certain instructions.
• As these registers are internally used by the CPU, they are not
accessible to the user.
• For ex: the W and Z registers are used by the processor during CALL
instruction.
contd
• When a CALL instruction is encountered in any program, the current
Program counter (PC) contents are pushed on to the stack and the given
address is loaded on to PC.
• The given address is temporarily stored in W and Z registers and
placed on the bus for the fetch cycle.
• Thus the program control is transferred to the address given in the
instruction.
• Another example is, during the execution of XCHG instruction, the
contents of H-L pair are exchanged with D-E pair.
• At the time of exchange W and Z registers are used for temporary
storage of data.
Microprocessor architecture   II

Microprocessor architecture II

  • 1.
  • 2.
    Register Organization • The8085 microprocessor has various types of registers as shown below. • It includes six , 8 – bit registers (B, C, D. E, H and L), one 8-bit Accumulator ,One Flag register and two 16-bit registers (SP and PC). • Also there are two 8-bit temporary registers W and Z. • These registers W and Z are not accessible to the user, They are used by the processor for internal, intermediate operations. • These registers B, C, D. E, H and L are known • as general purpose registers.
  • 3.
    contd • The registersProgram Counter and Stack Pointer are known as the speci purpose Registers. • So, the total registers are classified into three groups .They are (i).Temporary registers. (W and Z ) (ii).General purpose registers (B, C, D. E, H and L) (iii).Special purpose registers. (SP and PC). • The special purpose registers PC and SP are 16 bit registers. • As you know 8085 is a 8-bit processor with 16 bit-address bus.So, the address of the memory location is always16-bit . • But a very interesting thing is there are no 16-bit general purpose registers to hold the address of the memory location.
  • 4.
    contd • To overcomethis limitation, Intel has provided the feature of Register pairing. • That is two 8-bitregisters are paired so that they can store a 16-bt address. • The admissible register pairs are B-C; D-E and H-L only. No other pairs are allowed. • These pair of register are mainly used only during the times of address accessing . • At all the other times they are only 8-bit data registers (B,C,D,E,H and L). • Let us see this with an example. • LXI H 8509 ; It means, load immediately the register pair H-L with the address 8509.
  • 5.
    contd • Here L-registeris loaded with 09 and H-register is loaded with address 85H. Here H indicates that the address is Hexadecimal. • It is a three byte instruction.(Hex code = 21, 09, 85 (Three bytes) 21 = 0010 0001 8-bits = 1 byte 09 = 0000 1001 8-bits = 1 byte 85 = 1000 0110 8-bits = 1 byte Total 3-bytes
  • 6.
    Program Counter (PC) •It is a 16-bit special purpose register, which stores the address of the next instruction to be fetched or executed. • The execution of a program is initiated by loading the PC by the address of the first instruction of the program. • Once the first instruction is executed, the PC is automatically incremented to point to the next instruction unless a jump to some specific address occurs. • This process is repeated till the last instruction of the program is executed. •
  • 7.
    contd • Here thediagram shows the Operation of PC.
  • 8.
    contd • In caseof JUMP or CALL instructions, current address is stored in the Program Counter. • The processor then fetches the next instruction from the new address specified by the JUMP or CALL instruction. Address HEX – CODE LABEL MNEMONIC COMMENTS OPCODE OPERAND 8000 21,00,85 LXI H, 8500 INITIALISE H-L PAIR 8003 7E MOV C,M Count in the C register 8004 23 INX H First number in H-L pair 8005 4E MOV A,M Move first number in to Accumulator 8006 0D DCR C Decrement the count 8007 91 LOOP1 INX H Get the next number 8008 BE CMP M Compare the next number with previous number 8009 D2 JNC LOOP2 Is next number >previous maximum?No,go to the loop2 800A 0D 800B 80 800C 7E MOV A,M If,yes move the large number in to Accumulator 800D 0D LOOP2 DCR C Decrement the count 800E C2 JNZ LOOP1 If count not equal to zero,repeat 800F 07 8011 80 8012 78 8013 32 STA 85XX Store the largest number in the location 85XX 8014 XX 8015 85 8016 76 HLT Stop the execution
  • 9.
    Stack Pointer (SP) •It is a 16-bit special purpose register which always stores the address of top of the Stack. i.e. it always points to top of the Stack. • Stack is a part of the memory location used to store the data temporarily. • A stack works on Last in First out (LIFO) basis. As the Stack pointer always points to the top of the Stack, only top of the Stack of the memory can be accessed. • When a Write operation (PUSH) takes place, the contents of the stack pointer is decremented by two so that the SP points to the new location.
  • 10.
    Stack Pointer (SP) •Similarly when the Read operation (POP) occurs, the Stack pointer is incremented by two to point to the next data on top of the Stack. • The Stack Pointer is initialized by load register pair immediate instruction. • Ex: LXI SP, 8530 H Here 8530 H is the 16 bit address of the top of Stack location.
  • 11.
    Stack Details • Stackis a set of memory locations in the Read/Write memory(RAM), which is used for temporary storage of binary information during the execution of a program. • It is implemented in the Last-in-first-out (LIFO) manner. i.e., the data written first can be accessed last. • The stack may also be used for storing local variables of subroutine and for the transfer of parameter addresses to a subroutine. • This facilitates the implementation of re-entrant subroutines which is a very important software property.
  • 12.
    Stack operation • Operationson stack are performed using the two instructions namely PUSH and POP. • The contents of the stack are moved to certain memory locations on stack after PUSH instruction. Similarly, the contents of the stack are transferred back to registers by POP instruction. • For example, let us consider a Stack whose stack top is 4506 H. This is stored in the 16-bit Stack pointer register as shown below. • Let us consider two registers (register pair) B & C whose contents are 25 & 62. Reg. B Reg. C
  • 13.
    contd • After PUSHoperation the status of the Stack is as shown below.
  • 14.
    contd • Let usnow consider POP operation: The Figs below explains before and after the POP operation in detail. • Ex: POP B
  • 15.
    Temporary Registers • Thetwo temporary data registers are W register and Z register. These are 8-bit registers. • We have already seen in the earlier video that one temporary data register is associated with the ALU operations. • Similarly W and Z are also temporary registers used to hold 8-bit data during execution of certain instructions. • As these registers are internally used by the CPU, they are not accessible to the user. • For ex: the W and Z registers are used by the processor during CALL instruction.
  • 16.
    contd • When aCALL instruction is encountered in any program, the current Program counter (PC) contents are pushed on to the stack and the given address is loaded on to PC. • The given address is temporarily stored in W and Z registers and placed on the bus for the fetch cycle. • Thus the program control is transferred to the address given in the instruction. • Another example is, during the execution of XCHG instruction, the contents of H-L pair are exchanged with D-E pair. • At the time of exchange W and Z registers are used for temporary storage of data.