Explain LXI and CMP instruction. Write an assembly language program for 8-bit microprocessor to divide 8 bit data stored in memory location 8050 by 8 bit data stored in 8051 and store the quotient in 8052 and remainder in 8053.


This answer is not selected as best answer. This answer may not be sufficient for exam.

Your limit has been exceed. We have implemented this system because, We got difficulty on managing our servers. Please donate some amount to remove this limit.

Quota: 0 / 30


   LXI Instruction

In the 8085 Instruction set there are four instructions, which belong to the type LXI rp, d16. These instructions are used to load the 16-bit address into the register pair. We can use this instruction to load data from memory location using the memory address, which is stored in the register pair rp.

The rp can be BC, DE, HL or SP.

The LXI instructions and their Hex-codes are as follows.

Mnemonics, Operand Opcode (in HEX) Bytes
LXI B 01 3
LXI D 11 3
LXI H 21 3
LXI SP 31 3


COMPARE is an important instruction widely used in 8085 microprocessor. The 8085 instruction set has two types of Compare operations: Compare with accumulator (CMP) and Compare immediate with accumulator (CPI).

The microprocessor compares a data byte (or register/memory contents) with the contents of the accumulator by subtracting the data byte from (A), and indicates whether the data byte is less than, greater than or equals to the content of accumulator by modifying the flags. However, the contents are not modified. The two types of COMPARE instructions are explained briefly in the following section:

  1. Compare (register or memory) with accumulator (CMP R/M) –
    This is a 1-byte instruction. It compares the data byte in the register or memory with the contents of accumulator.

    1. If A less than (R/M), the CY flag is set and Zero flag is reset.
    2. If A equals to (R/M), the Zero flag is set and CY flag is reset.
    3. If A greater than (R/M), the CY and Zero flag are reset.

    When memory is an operand, its address is specified by HL Pair. No contents are modified; however all remaining flags (S, P, AC) are affected according to the result of subtraction.

    Let register B contains data byte 62H and the accumulator A contains 57H. Then,

    Instruction- CMP B
    Before execution: A = 57, B = 62
    After execution: A = 57, B = 62

    Flags: As A less than B, thus CY is set and Z flag is reset.

    CY=1, Z=0 
If you found any type of error on the answer then please mention on the comment or submit your new answer.
Leave your Answer:

Click here to submit your answer.

  Loading . . .