🎓 BookMCQ
← Back to 7. Interrupt Instructions of 8085

📝 Software Interrupts in 8085 Microprocessor (21 MCQs)

Software-Generated Interrupt Requests Through RST Instructions

Software interrupts in the 8085 are generated by executing specific restart instructions rather than by activating external interrupt pins. The processor supports eight instructions, RST 0 through RST 7. Each instruction transfers program control to a predefined memory location, allowing programs to invoke fixed routines for frequently required operations or service procedures.

Eight Restart Instructions and Their Vector Addresses

Each RST instruction is one byte long and uses a fixed vector separated by eight bytes. RST 0 branches to 0000H, RST 1 to 0008H, RST 2 to 0010H, RST 3 to 0018H, RST 4 to 0020H, RST 5 to 0028H, RST 6 to 0030H and RST 7 to 0038H.

Stack Operation and Program-Counter Modification

When an RST instruction executes, the processor saves the return address on the stack and loads the corresponding restart vector into the program counter. The instruction therefore behaves like a call to a fixed memory location. RET at the end of the routine retrieves the saved address and resumes normal program execution.

Example of Invoking RST 5 in an 8085 Program

Executing RST 5 transfers control to address 0028H after saving the return address on the stack. The instruction's opcode is EFH. A routine placed at the restart location can perform the required task and execute RET, allowing the processor to continue with the instruction following RST 5.

Applications of Software Interrupts in Program Organization

Restart instructions provide a compact method of invoking commonly used routines at predefined addresses. They can support simple software service mechanisms, reusable operations and structured program execution. Because the vectors are fixed, the programmer must reserve or organize the corresponding memory locations carefully and ensure that each routine returns correctly.

Misconceptions About Software Interrupt Instructions

'RST instructions require external interrupt pins' is incorrect because they are executed directly from program memory. 'RST 5 branches to 0034H' confuses software restart vectors with the RST 6.5 hardware vector. 'RST destroys the return address' is incorrect because the processor saves it on the stack.

Restart Vector and Stack-Tracing Examination Questions

Learn all eight restart instructions and their vector addresses, and calculate the opcode of a specified RST instruction. Trace the program counter and stack pointer during restart and return operations. Distinguish software RST instructions from hardware RST 5.5, RST 6.5 and RST 7.5 inputs.

Software Restart and Vector Terminology

  • Software Interrupt - Interrupt-like operation initiated by an instruction.
  • RST - Invokes a predefined restart address.
  • Restart Vector - Fixed entry address of an RST routine.
  • Stack - Stores the return address.
  • RET - Restores the saved program address.
  • Opcode - Machine code of an instruction.
4
Easy
11
Medium
6
Hard

📝 All Software Interrupts in 8085 Microprocessor MCQs

Q1. Which register pair is used to point to the first data byte in the given 8085 program?

A.H‑L ✅
B.D‑E
C.B‑C
D.A‑B
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: The H‑L pair holds the address 2100H, and after INX H it points to 2101H where the first data byte resides. Option A correctly identifies this pair. Options B, C, and D refer to other register pairs that are not used for the source address in the program. Understanding the role of H‑L clarifies how the routine accesses memory, a key step in any interrupt‑driven routine.

Q2. Which instruction in 8085 produces the one's complement of the accumulator?

A.CMA ✅
B.RAL
C.RRC
D.ADI 01H
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: CMA flips every bit of the accumulator, creating the one's complement. This is exactly what the program needs before adding one to form the two’s complement. RAL and RRC rotate bits, not complement them, and ADI 01H adds a constant rather than complementing. Recognizing CMA’s function is essential when designing interrupt service routines that manipulate binary data.

Q3. Why does the program use a separate carry register (B) after complementing a byte?

A.To propagate a possible carry from adding 1 ✅
B.To keep the sign bit
C.To store the result of the complement
D.To reset the accumulator
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: After CMA the program adds 1 with ADI, which may generate a carry. The B register temporarily holds this carry (01H) so it can be added to the next more‑significant byte. This ensures correct multi‑byte two’s complement arithmetic. The other options either describe unrelated purposes or misuse the B register, leading to incorrect results in interrupt processing.

Q4. How does the loop control using DCR C and JNZ ensure that exactly N bytes are processed?

A.DCR C decrements the counter and JNZ repeats while it is non‑zero ✅
B.DCR C sets the zero flag for the next iteration
C.JNZ checks the carry flag
D.Both DCR C and JNZ are unrelated to counting
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: C initially holds the byte count N. Each iteration DCR C reduces C by one. JNZ (Jump if Not Zero) branches back to the loop label as long as C ≠ 0, guaranteeing exactly N passes. The other choices misinterpret the flags or the purpose of the instructions, which would break the deterministic processing required in interrupt‑driven loops.

Q5. What is the purpose of the JNC instruction after storing each complemented byte?

A.To determine if a carry was generated and set B accordingly
B.To skip setting the carry flag ✅
C.To halt the program
D.To reset the accumulator
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: JNC (Jump if No Carry) checks whether the previous addition produced a carry. If no carry, the program jumps to the label that loads B with 00H; otherwise it falls through to load B with 01H. This decision is vital for proper propagation of the carry to the next byte. The other options describe actions that JNC does not perform, leading to logical errors.

Q6. In the context of two's complement generation, why is the instruction ADI 01H used immediately after CMA?

A.To add the missing one to complete two's complement ✅
B.To reset the accumulator
C.To set the zero flag
D.To clear the carry flag
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Two's complement is obtained by taking the one's complement (CMA) and then adding one. ADI 01H performs this addition, completing the conversion. It also may set the carry flag, which the program later records in B. The remaining options describe unrelated effects; resetting the accumulator or clearing flags would not achieve the required numeric transformation.

Q7. Explain why the program must handle a carry after each byte's two's complement calculation when processing multi-byte numbers.

A.Because the carry indicates overflow affecting higher-order bytes ✅
B.Because the carry must be cleared before next iteration
C.Because carry is irrelevant for two's complement
D.Because carry determines sign
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: When a low‑order byte overflows while adding the extra one, the generated carry must be added to the next higher‑order byte to preserve the numeric value of the whole multi‑byte word. Ignoring this would produce an incorrect final result. The other statements either deny the importance of the carry or misattribute its role, which would break correct arithmetic in interrupt service routines.

Q8. How would the program need to change if the least significant byte were stored at the highest address instead of 2101H?

A.Reverse the direction of INX/DCX operations ✅
B.Swap H‑L and D‑E register pairs
C.Replace CMA with RLC
D.No change needed
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: If the data were stored in descending order, the pointer would need to move backward after each byte. This requires replacing INX (increment) with DCX (decrement) for both the source (H‑L) and destination (D‑E) registers, and adjusting the loop accordingly. Swapping register pairs or changing CMA does not address address order, and doing nothing would read wrong locations.

Q9. If N = 02H (two bytes) and the source bytes are 0x34 at 2101H and 0xAB at 2102H, what two‑byte two’s complement result will be stored starting at 2201H?

A.0xCC, 0x55 ✅
B.0xCC, 0x54
C.0x33, 0x55
D.0xCC, 0xAA
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: Complement 0x34 → 0xCB, add 1 → 0xCC (no carry). Complement 0xAB → 0x54, add the carry from previous step (0) → 0x55. Thus the low result byte at 2201H is 0xCC and the high byte at 2202H is 0x55. The other options either miss the added carry or invert the bytes, leading to an incorrect two’s complement representation.

Q10. A programmer wants to modify the program to start processing from address 2105H instead of 2101H. Which instruction must be changed to correctly initialize the pointer?

A.LXI H, 2105H ✅
B.LXI D, 2201H
C.MOV C, M
D.INX H
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: The pointer to the source data is set by the LXI H instruction. Changing its immediate operand from 2100H to 2105H (and then INX H) will make H‑L point to 2105H as the first byte. The destination pointer (LXI D) and the counter load (MOV C, M) remain unchanged. Altering the other instructions would not affect the starting address.

Q11. Suppose the program is executed with N = 01H and the source byte is 0x00. What value will be stored at 2201H?

A.0 ✅
B.1
C.255
D.128
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: The two’s complement of 0x00 is obtained by complementing (still 0xFF) and adding 1, which yields 0x00 again. No carry is generated, so the result stored is 0x00. Options B and C represent incorrect complements, and D is unrelated to the operation, making A the only correct answer.

Q12. During execution, the B register is set to 01H after a JNC branch. What condition caused this branch to be taken?

A.A carry was generated during addition ✅
B.A zero flag was set
C.An overflow occurred
D.The accumulator was negative
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: JNC jumps when the carry flag is **not** set; the code following JNC loads B with 01H only when the preceding addition produced a carry, indicating that the complement‑plus‑one operation overflowed the byte. Therefore, the presence of a carry triggers the branch. The other conditions involve different flags that JNC does not test.

Q13. If the program processes three bytes 0xFF, 0x00, 0x01 (least significant first), what three‑byte result will be stored?

A.0x01, 0xFF, 0xFE ✅
B.0x00, 0xFF, 0xFE
C.0x01, 0x00, 0xFF
D.0xFF, 0x01, 0xFE
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Byte 1: ~0xFF = 0x00, +1 = 0x01, no carry. Byte 2: ~0x00 = 0xFF, +carry 0 = 0xFF. Byte 3: ~0x01 = 0xFE, +carry 0 = 0xFE. Hence the stored sequence (low to high) is 0x01, 0xFF, 0xFE. The other options either misplace bytes or ignore the carry handling, resulting in an inaccurate two’s complement result.

Q14. A designer wants to reuse the same routine for both 2’s complement and 1’s complement calculations, selectable at runtime via a flag at address 2100H (0 for 1’s, 1 for 2’s). Which modification best implements this without changing the main loop structure?

A.Test the flag after CMA and conditionally execute ADI 01H ✅
B.Replace CMA with RRC
C.Insert a NOP when flag=0
D.Move flag into B register
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: By testing the flag after performing CMA, the program can decide whether to add the extra 1 (for two’s complement) or skip it (for one’s complement). This keeps the loop unchanged while providing runtime selection. Replacing CMA, inserting NOPs, or moving the flag into B would not give the required conditional behavior.

Q15. If the memory location 2100H inadvertently contains 0xFF (255) instead of a valid byte count, what will be the program’s behavior?

A.It will attempt to process 255 bytes, potentially overrunning memory ✅
B.It will stop immediately
C.It will process only two bytes
D.It will cause a divide‑by‑zero error
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: The byte at 2100H is loaded into C as the loop counter. A value of 0xFF makes C = 255, so the loop will iterate 255 times, reading and writing far beyond the intended region, which can corrupt memory or crash the system. The other outcomes are not produced by the program logic.

Q16. Consider extending the routine to handle signed 16‑bit numbers stored in little‑endian format. Which additional instruction(s) must be inserted after processing the low byte to correctly propagate the sign?

A.No extra instruction is needed; the existing carry propagation handles the sign ✅
B.Insert an INR B to set carry based on sign
C.Use DAA to adjust BCD result
D.Add a JZ to skip high byte if low byte is zero
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: The current algorithm already propagates any carry generated when converting the low byte into the high byte via the B register. This mechanism naturally extends to signed 16‑bit two’s complement numbers, so no extra code is required. The other suggestions either add unnecessary steps or target unrelated number formats.

Q17. When adapting the program for the 8086 microprocessor, which of the following changes is essential due to differences in register architecture?

A.Replace LXI with MOV and immediate address loading
B.Replace CMA with NOT AL
C.Replace STAX D with MOV [DI], AL
D.All of the above ✅
💡 Difficulty: hard | ✅ Correct: D

📖 Explanation: 8086 lacks the LXI instruction, uses MOV with segment:offset addressing, and has a NOT instruction for bitwise complement. Additionally, storing via STAX D must be replaced by a MOV to memory addressed by DI (or similar). Therefore, each of the listed changes is required, making option D the correct comprehensive answer.

Q18. If the program’s loop counter C is accidentally loaded with the value at memory location 2102H instead of 2100H, how many iterations will occur when N=03H?

A.Three iterations
B.The value stored at 2102H determines iterations ✅
C.Zero iterations
D.One iteration
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: The counter C receives whatever byte resides at 2102H, so the loop will iterate that many times, completely independent of the intended N = 03H. Hence the number of iterations equals the contents of 2102H. The other options incorrectly assume the original count or a fixed small number.

Q19. A student proposes to eliminate the B register and directly use the CY flag after ADI 01H. Which potential problem could arise?

A.The carry from the previous iteration would be lost ✅
B.The program would run faster
C.The accumulator would overflow
D.The zero flag would be set incorrectly
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: If B is removed, the program would need to test the CY flag immediately after each addition. However, the subsequent JNC/JNC sequence clears the flag before it can be examined for the next byte, causing the carry information to be lost and leading to incorrect high‑byte results. The other choices describe effects that do not stem from removing B.

Q20. What is the main advantage of using two’s complement representation for signed numbers in arithmetic operations?

A.It allows addition and subtraction using the same hardware ✅
B.It doubles the range of positive numbers
C.It eliminates the need for a sign bit
D.It makes numbers easier to read
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: Two’s complement lets the processor treat signed numbers as if they were unsigned, so the same adder circuitry can perform both addition and subtraction without extra logic. This simplifies interrupt‑driven arithmetic. The other statements are inaccurate: the range is asymmetric, a sign bit still exists, and readability is not the primary benefit.

Q21. How does the use of software interrupts differ from hardware interrupts in terms of control flow in 8085?

A.Software interrupts are invoked by executing an instruction, allowing the program to decide when to trigger ✅
B.Software interrupts require external signals
C.Hardware interrupts cannot be masked
D.Software interrupts always have higher priority
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Software interrupts (RST instructions) are triggered by the program itself, giving precise control over when the interrupt service routine runs. Hardware interrupts depend on external events and occur asynchronously. Hence option A correctly captures the distinction, while the other options misstate the nature of masking, priority, or signal requirements.

🔗 Related Topics (MCQs)