🎓 BookMCQ
← Back to 6. Programming of 8085

📝 Program on 8 Bit Division in 8085 Microprocessor (9 MCQs)

Unsigned Division Through Repeated Subtraction

The 8085 does not include a dedicated division instruction, so an eight-bit unsigned division program can use repeated subtraction. The dividend is reduced by the divisor until the remaining value becomes smaller than the divisor. The number of successful subtractions represents the quotient, while the final remaining accumulator value represents the remainder.

Register Allocation for Dividend, Divisor and Quotient

The accumulator holds the changing remainder, register C stores the divisor and register D counts successful subtractions. Register B can temporarily preserve the original dividend. The divisor must be nonzero, because subtracting zero never reduces the remainder and would cause the repeated-subtraction loop to continue indefinitely.

Comparison and Subtraction Sequence for Division

CMP C compares the current remainder with the divisor and sets carry when the remainder is smaller. If carry is clear, SUB C performs another subtraction and INR D increases the quotient. The loop repeats until the carry flag indicates that the remaining value is smaller than the divisor.

Program to Divide 1DH by 06H

Load the dividend from 2050H into B and the divisor from 2051H into C. Move B into A and clear D. Repeatedly execute CMP C, JC DONE, SUB C, INR D and JMP LOOP. At DONE, store A at 2053H as remainder and D at 2052H as quotient. For 1DH divided by 06H, quotient is 04H and remainder is 05H.

Applications and Accuracy of the Division Method

Repeated subtraction demonstrates integer division using comparison, arithmetic and conditional branching. It is useful for small unsigned values, quotient calculations and remainder determination. Its execution time depends on the quotient because every successful subtraction adds another loop iteration. Programs must also handle a zero divisor separately when input validity is not guaranteed.

Misconceptions About Quotient and Remainder Calculation

'The remainder must always be zero' is incorrect because division may leave an unused value smaller than the divisor. 'CMP C changes the accumulator' is incorrect because it updates flags without storing a subtraction result. 'Division by zero produces a valid quotient' is incorrect because the loop cannot make progress with a zero divisor.

Division Program Tracing and Arithmetic Examination Questions

Practise counting successful subtractions to determine the quotient and identifying the final accumulator value as the remainder. Trace CY after CMP, the updates to D and the loop termination condition. Verify that the remainder is smaller than the nonzero divisor and check the relationship dividend equals divisor multiplied by quotient plus remainder.

Division and Remainder Calculation Terms

  • Dividend - Number being divided.
  • Divisor - Number used for division.
  • Quotient - Number of successful subtractions.
  • Remainder - Value left after division.
  • CMP - Compares accumulator with divisor.
  • CY Flag - Indicates borrow during comparison.
2
Easy
5
Medium
2
Hard

📝 All Program on 8 Bit Division in 8085 Microprocessor MCQs

Q1. A student needs to divide the 8‑bit value 0x96 (150 decimal) by 0x05 using an 8085 routine that expects the dividend in the accumulator and the divisor in register B. Which of the following instruction sequences correctly prepares the registers before calling the subroutine DIV8?

A.MVI A,96H; MVI B,05H; CALL DIV8 ✅
B.MVI B,96H; MVI A,05H; CALL DIV8
C.MVI A,05H; MVI B,96H; CALL DIV8
D.MVI A,96H; MVI C,05H; CALL DIV8
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: The DIV8 subroutine reads the dividend from the accumulator (A) and the divisor from register B. Option A loads 0x96 into A and 0x05 into B, matching the routine’s expectations, so the division yields the correct quotient 0x1E and remainder 0x00. Options B and C swap the registers, causing the routine to treat the divisor as the dividend, which produces an incorrect result. Option D places the divisor in register C, which DIV8 never examines, so the operation fails.

Q2. What is the purpose of the CMA instruction in 8085 assembly language?

A.Loads immediate data into the accumulator
B.Complements (1's complement) the contents of the accumulator ✅
C.Adds the carry flag to the accumulator
D.Stores the accumulator contents into a memory location
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: CMA stands for Complement Accumulator. When executed, it flips every bit of the accumulator, producing the 1’s complement of the original value. This is useful for arithmetic operations such as subtraction using two’s complement. The other options describe unrelated instructions: loading immediate data uses MVI, adding the carry uses ADC, and storing uses STA. Therefore only option B correctly describes CMA’s function.

Q3. Memory location 3000H holds the dividend and 3001H holds the divisor. Which code fragment correctly computes the 8‑bit quotient and stores it at 3002H while storing the remainder at 3003H using a repeated‑subtraction routine?

A.LDA 3000H; MOV B,A; LDA 3001H; MOV C,A; CALL DIV8; STA 3002H; MOV A,B; STA 3003H
B.LDA 3000H; MOV B,A; LDA 3001H; MOV C,A; CALL DIV8; STA 3002H; MOV A,C; STA 3003H
C.LDA 3000H; MOV B,A; LDA 3001H; MOV C,A; CALL DIV8; MOV A,B; STA 3002H; MOV A,C; STA 3003H
D.LDA 3000H; MOV B,A; LDA 3001H; MOV C,A; CALL DIV8; STA 3002H; MOV A,B; STA 3003H ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: The DIV8 routine is designed to return the quotient in the accumulator (A) and the remainder in register B. After the call, STA 3002H stores the quotient directly, and MOV A,B transfers the remainder into A so it can be stored at 3003H. Option D follows this exact sequence, making it correct. Options A and B store the wrong register values, and option C writes the remainder to the quotient address, swapping the results.

Q4. Before performing an 8‑bit division on the 8085, which of the following checks correctly prevents a divide‑by‑zero error?

A.CMP B; JZ DIV_ERROR
B.MOV A,B; CPI 00H; JZ DIV_ERROR ✅
C.INR B; JZ DIV_ERROR
D.DCR B; JZ DIV_ERROR
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Division by zero must be avoided by testing the divisor, which resides in register B. Moving B into the accumulator and comparing it with 0H (CPI 00H) sets the Zero flag when B is zero, allowing the program to branch to an error handler. Option B implements this exact test. Option A uses CMP B, which compares the accumulator with B, not B with zero. Options C and D modify B before testing, which could change the divisor value and still not detect a zero divisor correctly.

Q5. An existing DIV8 routine returns the quotient in A and the remainder in B. To also set the Zero flag when the dividend is smaller than the divisor (resulting in a zero quotient), which additional instruction should be inserted just before the routine returns?

A.ORA A ✅
B.XRA A
C.CMA
D.RLC
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: When the dividend is less than the divisor, the quotient stored in A becomes zero. Executing ORA A performs a logical OR of A with itself, which does not change the value but updates the status flags based on the result. Since the result is zero, the Zero flag is set, indicating the condition. XRA A would also zero the accumulator but clears the Zero flag only after the operation, while CMA inverts bits and RLC rotates bits, neither of which reliably set the Zero flag for this specific case.

Q6. Why does the 8085 microprocessor rely on repeated subtraction rather than a dedicated divide instruction for 8‑bit division operations?

A.Because repeated subtraction is faster than any hardware division unit
B.Because the 8085 instruction set does not include a hardware divide operation, so division must be implemented in software ✅
C.Because division is rarely needed in embedded systems
D.Because the accumulator cannot hold more than 8 bits, making hardware division impossible
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: The original 8085 architecture was designed with a minimal instruction set to keep hardware simple and cost low. It provides arithmetic instructions for addition, subtraction, and logical operations but lacks a native divide opcode. Consequently, programmers create division routines that repeatedly subtract the divisor from the dividend until the remainder is smaller, effectively performing division in software. Options A and C are inaccurate statements about speed and usage, while D misinterprets the accumulator’s role.

Q7. How do the Zero (Z) and Carry (C) flags behave after the 8‑bit division routine finishes, assuming the divisor is non‑zero?

A.Z is set if the quotient is zero; C is cleared because the final subtraction caused a borrow that was undone ✅
B.Z is cleared if the quotient is zero; C is set to indicate a successful division
C.Z reflects whether the remainder is zero; C is always cleared after division
D.Z is set if the dividend was larger than the divisor; C is set if the divisor was odd
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: During a repeated‑subtraction division, the loop stops when a subtraction would require a borrow, leaving the Carry flag cleared. If the final quotient stored in the accumulator is zero, the Zero flag is set; otherwise it remains cleared. Therefore, after a successful division with a non‑zero divisor, Z indicates a zero quotient, and C shows that no borrow occurred on the last successful subtraction. The other options misrepresent the relationship between the flags and the division outcome.

Q8. To divide two signed 8‑bit numbers using two’s complement on the 8085, which sequence correctly handles sign conversion and restores the correct sign of the quotient?

A.1. Load dividend into A; if negative, CMA+INR and set sign flag. 2. Load divisor into B; if negative, CMA+INR and toggle sign flag. 3. CALL DIV8 (unsigned). 4. If sign flag set, CMA+INR on A. ✅
B.1. Load dividend into A; if negative, DAA. 2. Load divisor into B; if negative, DAA. 3. CALL DIV8. 4. No further steps needed.
C.1. Load dividend into A; CALL DIV8; then CMA+INR on A if dividend was negative.
D.1. Load dividend into A; if negative, CMA+INR. 2. Load divisor into B; CALL DIV8. 3. If divisor was negative, CMA+INR on A.
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Signed division requires converting both operands to their absolute values before using an unsigned routine. Steps 1 and 2 detect negativity, apply two’s complement (CMA followed by INR) to obtain magnitude, and toggle a sign flag each time a negative operand is found. After the unsigned DIV8 call, the quotient in A is positive; if the sign flag indicates an odd number of negatives, the quotient must be negated again using CMA+INR. Options B, C, and D omit essential steps such as handling the divisor’s sign or re‑applying the sign to the result, making them incorrect.

Q9. What limitation prevents an 8‑bit division routine from detecting overflow when the dividend exceeds 255, and why can't the overflow flag (V) be used for this purpose on the 8085?

A.The 8085 does have an overflow flag, but it is only updated by logical instructions
B.The 8085 lacks an explicit overflow flag; overflow must be detected manually, and the existing flags (S, Z, C, P) do not indicate arithmetic overflow for division ✅
C.The overflow flag is only set for addition, not division
D.The overflow flag is cleared automatically after every instruction, making it unreliable
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: The 8085 status register does not include a dedicated overflow (V) flag; it provides Sign, Zero, Auxiliary Carry, Parity, and Carry flags. Consequently, an overflow condition—such as a dividend larger than the 8‑bit range—cannot be automatically signaled by hardware. Programmers must manually test the dividend before the division, for example by comparing it with 0xFF, to detect overflow. Options A, C, and D incorrectly describe the existence or behavior of an overflow flag on the 8085.

🔗 Related Topics (MCQs)