Instruction type CPI d8 in 8085 Microprocessor

In 8085 Instruction set, CPI is a mnemonic that stands for “ComPare Immediate with Accumulator” and here d8 stands for any 8-bit data or 1-Byte data. This instruction is used to compare Accumulator with 8-bit immediate data. The result of the comparison will be stored in an internal register not accessible to the programmer. As this internal register is not a GPR (General Purpose Register), so not accessible through any mnemonics. Actually this 8-bit data will get deducted from Accumulators present content and result thus produced will be stored in the internal register. All the flags are affected based on the result. It occupies 2-Bytes in memory.

Mnemonics, Operand Opcode(in HEX) Bytes
CPI Data FE 2

Let us consider CPI 50H is an example instruction falling in this category and also considering the initial content of the Accumulator as 70H. It is a 2-Byte instruction so it will occupy 2 consecutive Bytes. The result of execution of this instruction has been depicted in the following tracing table −

Before After


70H 70H


Any value 20H


Any value Cy=0,AC=0,S=0,P=0,Z=0

Address Hex Codes Mnemonic Comment
2002 FE CPI 50H Temp = Register A – 50H
2003 50 Operand 50H

The timing diagram against this instruction CPI 50H execution is as follows −


Summary − So this instruction CPI 50H requires 2-Bytes, 2-Machine Cycles (Opcode Fetch, Memory Read) and 7 T-States for execution as shown in the timing diagram.

Samual Sam
Samual Sam

Learning faster. Every day.