📝 Interrupt Control Circuit in 8085 Microprocessor (12 MCQs)
Internal Interrupt Recognition and Priority Circuitry
The 8085 contains internal interrupt-control logic that recognizes external requests, evaluates their priority and determines whether they can be accepted. Its five hardware inputs are TRAP, RST 7.5, RST 6.5, RST 5.5 and INTR. The circuitry combines request recognition, global interrupt enabling, individual masking and vector selection to coordinate interrupt servicing.
Interrupt Enable Flip-Flop and Individual Mask Registers
A global interrupt-enable flip-flop controls acceptance of maskable requests. EI enables these interrupts, while DI disables them. Individual mask bits control RST 7.5, RST 6.5 and RST 5.5. TRAP remains non-maskable, and INTR is controlled by the global interrupt-enable condition rather than the SIM individual masks.
SIM and RIM Control of Interrupt Status
SIM sets individual masks when accumulator bit 3, called MSE, is one. Bits 2, 1 and 0 specify masks for RST 7.5, RST 6.5 and RST 5.5 respectively; one masks the corresponding request. RIM reads interrupt masks, global enable status and pending requests into the accumulator.
Example of Masking RST 6.5 Through SIM
Load 0AH into the accumulator using MVI A,0AH and execute SIM. Bit 3 enables mask loading, and bit 1 sets the mask for RST 6.5. The processor therefore masks RST 6.5 while leaving the RST 7.5 and RST 5.5 individual mask bits clear. Global enabling must also permit acceptance.
RST 7.5 Request Latch and Interrupt Priority Resolution
RST 7.5 contains an internal request latch that retains a valid rising-edge event until serviced or reset through the appropriate mechanism. Priority logic selects eligible requests in the order TRAP, RST 7.5, RST 6.5, RST 5.5 and INTR. This arrangement supports reliable recognition of requests arriving at different times.
Misconceptions About Interrupt Masking and Control
'SIM globally enables all interrupts' is incorrect because EI controls the global enable condition. 'Setting a SIM mask bit enables that interrupt' reverses the meaning because one masks the request. 'TRAP is controlled by DI' is incorrect because TRAP is non-maskable and unaffected by ordinary interrupt masking.
SIM, RIM and Interrupt-Control Examination Questions
Practise interpreting accumulator bits during SIM and RIM operations. Identify MSE, the three individual mask bits, pending interrupt indicators and global enable status. Understand RST 7.5 request latching, interrupt priority and the difference between DI and individual masking. Numerical questions may require constructing an accumulator value to mask selected requests.
Interrupt Control and Mask-Register Terminology
- SIM - Sets interrupt masks and serial output.
- RIM - Reads masks and interrupt status.
- MSE - Enables individual mask loading.
- Mask Bit - Disables a selected interrupt.
- IE Flip-Flop - Controls global interrupt enabling.
- Pending Request - Interrupt awaiting recognition.
📝 All Interrupt Control Circuit in 8085 Microprocessor MCQs
Q1. What is the function of the CMA instruction in the 8085 program that finds the 2’s complement of N bytes?
📖 Explanation: CMA stands for Complement Accumulator. It flips every bit of the accumulator, turning a binary pattern like 01101001 into 10010110, which is the 1’s complement. The program then adds 1 to obtain the 2’s complement. Option A describes ADI, option B describes an undefined operation, and option D would be performed by STAX. Understanding CMA is essential because the routine relies on it to start the complement‑then‑add sequence, a common step in arithmetic operations.
Q2. Why does the program copy the carry flag into register B after each addition instead of using the flag directly?
📖 Explanation: The 8085 sets the carry flag after an addition, but many subsequent instructions (like MOV or INX) overwrite the flag. By moving the flag into B (MVI B,01 H or MVI B,00 H) the program saves the carry state, allowing the next iteration to add it with the ADD B instruction. Option A is false because the flag can be tested with JNC/JC. Options C and D describe unrelated uses of B.
Q3. How does the program guarantee that the least significant byte (LSB) is processed first when converting N bytes to their 2’s complement?
📖 Explanation: The routine starts by executing LXI H,2100 H and then INX H, which moves HL to 2101 H – the address of the LSB. The loop then processes the byte at (HL), increments HL, and moves to the next more significant byte. This forward scanning ensures the LSB is handled first. Option B would process bytes backward, option C is unrelated to input order, and option D merely counts remaining bytes, not address order.
Q4. If the JNC (Jump if No Carry) instruction were removed from the loop, what incorrect behavior would most likely occur?
📖 Explanation: JNC decides whether the previous addition generated a carry. Without it, the program would fall through to the MVI B,01 H path only when the carry flag is set, but the subsequent logic that clears B when no carry occurs would be missing, causing B to retain its previous value. This effectively makes the program assume a carry of zero for every byte, producing wrong results. Option A suggests skipping handling entirely, option C implies looping forever, and option D is unrelated.
Q5. What is the purpose of the DCR C instruction inside the loop of the 2’s complement routine?
📖 Explanation: C is loaded with the byte count N at the start of the routine. Each time a byte is processed, DCR C reduces this count by one. When C reaches zero, the JNZ LOOP instruction fails, allowing the program to exit the loop. Thus DCR C acts as a loop counter. Option A would require decrementing HL, option C describes a side effect of DCR but not its primary role, and option D is unrelated.
Q6. Given N = 03 H and the three bytes stored at 2101 H = 34 H, 2102 H = A5 H, 2103 H = 01 H, what values will be stored at 2201 H‑2203 H after the program finishes?
📖 Explanation: The first byte 0x34 is complemented to 0xCB, then ADI 01 yields 0xCC with no carry. The second byte 0xA5 becomes 0x5A after complement; no carry is added, so it stays 0x5A. The third byte 0x01 complements to 0xFE, and again no carry is added, leaving 0xFE. Hence the result sequence is CC, 5A, FE. Options B, C, and D contain incorrect values either in the first or later bytes.
Q7. To store the 2’s complement results beginning at 2300 H instead of 2201 H, which instruction in the original program must be changed?
📖 Explanation: The destination address is held in the D‑E register pair, which is initialized by LXI D,2201 H. Changing the start of the result area requires modifying this instruction to LXI D,2300 H. The source pointer (LXI H,2100 H) remains unchanged because the input data location does not move. STAX D uses whatever address is currently in D‑E, so it does not need alteration, and JMP NXT1 is unrelated to address setup.
Q8. When the addition of a complemented byte produces a carry, how does the program propagate this carry to the next more significant byte?
📖 Explanation: After a complemented byte is added to 01 H, the program tests the carry with JNC. If a carry exists, it executes MVI B,01 H; otherwise it loads B with 00 H. In the next loop iteration the instruction ADD B adds this saved carry to the newly complemented byte, effectively propagating the overflow to the higher‑order byte. Options A and D describe flag checks but not the actual propagation mechanism, while option C changes the source pointer, not the carry.
Q9. If the byte at 2100 H (the count N) is accidentally set to 00 H, what will the program do after execution begins?
📖 Explanation: At the start, the program copies the value at 2100 H into register C. If C is zero, the subsequent DCR C will keep it at 0xFF, but the JNZ LOOP test will be evaluated after the first iteration. However, because the loop condition checks C after decrementing, the very first DCR makes C = 0xFF, causing the loop to continue erroneously. In practice, most implementations include an initial check; without it, the program may process unintended bytes. The safest answer is that it halts immediately because there are no bytes to process. Options A, C, and D describe behaviours that would require additional code.
Q10. Which modification to the program would correctly compute the 10’s complement of each byte instead of the 2’s complement?
📖 Explanation: The 10’s complement of a decimal digit is (10 – digit). For a byte representing a decimal value, the algorithm first forms the 9’s complement (CMA gives the 1’s complement, then adding 0x09 yields the 9’s complement) and finally adds 0x01 to obtain the 10’s complement. Adding 0x0A directly after the complement step achieves the same result because 0x0A = 0x09 + 0x01. Options A and D change the nature of the operation, and option C adds before forming the 9’s complement, leading to an incorrect result.
Q11. In an interrupt‑driven microcontroller, why might the 2’s complement routine be placed inside an Interrupt Service Routine (ISR) rather than in the main program flow?
📖 Explanation: When new data arrives, an interrupt can trigger the ISR, allowing the conversion to happen instantly, which reduces the time the raw data remains in a buffer and prevents overflow. Placing the routine in the ISR also isolates the conversion from other tasks, improving determinism. Option A is true but not the main reason for this specific routine, option C is false because the main program can use any registers, and option D is unnecessary since the H‑L pair can be saved and restored.
Q12. In the given program, which register pair is used to point to the destination memory area where the results are stored?
📖 Explanation: The routine uses the instruction LXI D,2201 H to load the D‑E register pair with the address of the result area. Subsequent STAX D stores each computed byte at the address held in D‑E, then INX D moves to the next location. Therefore D‑E is the destination pointer. H‑L points to the source data, while B‑C and A‑F are not used as address registers in this program.