W and Z registers in 8085 Microprocessor

MicrocontrollerMicroprocessor8085

To define Temporary Register, we can mention that it is an 8-bit non-programmable resister used to hold data during an arithmetic and logic operation (temporary resister is used to hold intermediate result). The result is stored in the accumulator, and the flags (flip-flops) are set or reset according to the result of the operation.

W and Z are two 8-bit temporary registers of 8085 microprocessor, which is not accessible to the user. They are exclusively used for the internal operation by the microprocessor. These registers are used either to store 8-bit of information in each W and Z registers or a 16-bit data in W, Z register pair with lower order 8-bits in Z and higher-order 8-bits in W register.

Let us consider one example. First of all, the PC is loaded with the value 8000H. This is done by typing the ‘Go’ key, then typing “8000”, and finally typing the “Exec” key. Then the 8085 performs the following action. It sends out 8000H the address, which is the content of the PC. From location 8000H it receives 21H, the opcode for LXI H. It is received in an 8-bit register called instruction register (IR for short), as shown in the following figure.

Address
Hex Codes
Label
Mnemonic
T-States
Comment
8000
21 (IR)
50 (Z)
80 (W)
START:
LXI H, 8050H
10
Setup HL pair as a pointer for source memory.
8003
11 (IR)
70 (Z)
80 (W)

LXI D, 8070H
10
Set up DE pair as a pointer for destination memory
8006
76 (IR)

HLT
5
Stop

So in the above example, at first IR will get loaded by 21H i.e. LXI H instruction at address 8000H. then by 11H i.e. LXI D at address 8003H and at last by 76H i.e. HLT instruction at address 8006H. IR is having auto-increment feature which is very much useful in linear execution of instructions from the memory. On the other hand, when instruction LXI was getting executed then temporary registers W and Z were holding the 16-bit address 8050H, then 8070H as shown in the table.

raja
Published on 11-Mar-2019 10:40:31
Advertisements