Menu Close

Interrupts: UPSC Electrical Engineering Optional PYQ Solutions (2001–2026)

All 16 questions UPSC has asked on interrupts in the Electrical Engineering Optional (Paper II, Microprocessors and Microcomputers) from 2001 to 2026, solved step by step – latest first.

Try them yourself first: the same questions, without solutions, are on our Microprocessors and Microcomputers topic-wise PYQs page. Circuit diagrams have been redrawn from the question papers.

How we check these solutions

These are our own solutions, prepared with AI help. UPSC does not publish official answers. Every solution is checked a second way before it goes up, and says how:

  • ✓ Checked by computer the numbers were worked out again independently in code (SymPy and NumPy: circuit equations, power balance, matrices, integrals).
  • ✓ Answer checked step by step for theory and descriptive questions, every point was checked against the standard theory.

Where a printed question is wrong, unclear or incomplete, we say so and solve the intended version.

Spotted a mistake or a neater method? Tell us in the comments below or through Report an error.

Jump to a question (year · question number):

2026 · 3c 2025 · 3c 2023 · 4c 2022 · 4a 2018 · 5d(i) 2018 · 5d(ii) 2017 · 1c(i) 2017 · 5b(i) 2017 · 7b(ii) 2016 · 4b 2014 · 1b(i) 2012 · 5b 2011 · 7b(i) 2010 · 6b 2009 · 7b 2001 · 2a

Cover of the UPSC Prelims Topic-wise PYQ book with detailed explanations

From the Optional Province team

Preparing for Prelims too?

Our UPSC Prelims Topic-wise PYQ Book covers every Prelims question with detailed explanations, so you can see exactly where UPSC asks from. Now available as a hard copy and an eBook.

Buy Hard Copy on AmazonBuy eBook (PDF)

Download a free sample

What are the types of interrupts available in the 8085 microprocessor? Discuss the use of the EI and DI instructions. Give the significance of each bit of the accumulator when interpreted for the SIM and RIM instructions.

2026 · Paper II · Q3c · 10 marks

Solution

Types of interrupts in the 8085

Interrupt Type Triggering Vector
TRAP Non-maskable, vectored Edge and level 0024H
RST 7.5 Maskable, vectored Rising edge (latched) 003CH
RST 6.5 Maskable, vectored Level (high) 0034H
RST 5.5 Maskable, vectored Level (high) 002CH
INTR Maskable, non-vectored (the device supplies RST n or CALL) Level (high) from the device

There are also the software interrupts RST 0 to RST 7, which are instructions that jump to 8n (0000H, 0008H, … 0038H).

EI and DI

  • EI sets the interrupt-enable flip-flop. All maskable interrupts (INTR and RST 7.5, 6.5, 5.5) can then be accepted, provided they are not masked by SIM. The enable takes effect after the instruction that follows EI.
  • DI resets the flip-flop, so all maskable interrupts are ignored.
  • When any interrupt is accepted, the flip-flop is reset automatically. So an interrupt service routine must execute EI again (usually just before RET) if further interrupts are to be accepted.
  • TRAP is not affected by EI or DI.

Accumulator bits for SIM and RIM

SIM (output to the interrupt and serial control)SODD7SDED6×D5R7.5D4MSED3M7.5D2M6.5D1M5.5D0SDE = 1 sends D7 to SOD · R7.5 = 1 resets the RST 7.5 flip-flopMSE = 1 makes D2–D0 effective · mask bit 1 = maskedRIM (read into the accumulator)SIDD7I7.5D6I6.5D5I5.5D4IED3M7.5D2M6.5D1M5.5D0SID = serial input bit · I7.5–I5.5 = pending interrupts · IE = interrupt enable flag · M = current masks
Bit D7 is on the left. On a phone, swipe sideways to see all of it.

SIM (the accumulator is written to the interrupt and serial control):

Bit Name Meaning
D7 SOD Serial output bit
D6 SDE Serial data enable: 1 sends D7 to the SOD pin
D5 × Not used
D4 R7.5 1 resets the RST 7.5 request flip-flop
D3 MSE Mask set enable: 1 makes D2–D0 effective
D2, D1, D0 M7.5, M6.5, M5.5 1 masks (disables), 0 unmasks that interrupt

RIM (the status is read into the accumulator):

Bit Name Meaning
D7 SID Serial input bit
D6, D5, D4 I7.5, I6.5, I5.5 1 means the interrupt is pending
D3 IE Interrupt-enable flag: 1 means enabled
D2, D1, D0 M7.5, M6.5, M5.5 Current mask status

✓ Answer checked step by step Standard result (Intel 8085 data sheet).

↑ Back to the question list

Explain maskable interrupt. Draw the timing diagram for the maskable interrupt acknowledgement cycle. List the activities in each clock cycle.

2025 · Paper II · Q3c · 10 marks

Solution

Maskable interrupt. An interrupt that the processor can enable or disable under program control. The 8085’s maskable interrupts are INTR, RST 7.5, RST 6.5 and RST 5.5:

  • EI and DI enable or disable them all;
  • SIM masks RST 7.5, 6.5 and 5.5 individually;
  • after reset, and after any interrupt is accepted, they are disabled until EI is executed.

TRAP is the only non-maskable one.

Acknowledging INTR (with RST n)

  1. The 8085 checks INTR during the last clock cycle of every instruction. If INTR = 1 and interrupts are enabled, it completes the current instruction and disables interrupts.
  2. It then runs an interrupt-acknowledge machine cycle instead of an opcode fetch.
M1: interrupt acknowledge (6T)M2: write PCHM3: write PCLT1T2T3T4T5T6T1T2T3T1T2T3CLKA15–A0PC (ignored)SP − 1SP − 2AD7–AD0PCLRST n opcodePCHPCLALEIO/MS1, S01, 10, 10, 1INTAWR
INTA cycle (6T), then two memory writes that push the PC (12 T-states). On a phone, swipe sideways to see all of it.

Activities in each clock cycle

Cycle Activity
M1 T1 The PC appears on the address lines (it is not used); ALE is high; IO/M = 1 and S1 S0 = 11 (INTA cycle)
M1 T2–T3 INTA goes low (instead of RD). The external device places the RST n opcode (11 NNN 111) on the data bus, and it is read into the instruction register. The PC is not incremented
M1 T4–T6 The opcode is decoded as a restart. SP is decremented; the restart address 8n is formed internally
M2 T1–T3 Memory write: PCH goes to SP − 1 (WR low in T2–T3)
M3 T1–T3 Memory write: PCL goes to SP − 2. SP becomes SP − 2
End PC ← 8 × n. Execution continues at the vector address (0000H, 0008H … 0038H)

The total is 6 + 3 + 3 = 12 T-states.

If the device supplies a 3-byte CALL, two more INTA cycles read the address bytes, and the total becomes 18 T-states.

✓ Checked by computer We checked the T-state count of the acknowledge sequence against the 8085 data sheet.

↑ Back to the question list

Explain four instructions which are used to control interrupt structure of 8085 microprocessor.

2023 · Paper II · Q4c · 10 marks

Solution

  1. EI (enable interrupts). Sets the interrupt-enable flip-flop, so that INTR, RST 7.5, 6.5 and 5.5 (if unmasked) are accepted. It takes effect after the next instruction. It is needed at the start of a program and before returning from a service routine.

  2. DI (disable interrupts). Resets the flip-flop, so that all maskable interrupts are ignored. It is used to protect time-critical code. TRAP still works.

  3. SIM (set interrupt mask). Uses the accumulator to:

    • mask or unmask RST 7.5, 6.5 and 5.5 individually (bits D2–D0, with MSE = D3 = 1);
    • reset the RST 7.5 flip-flop (D4);
    • send a serial bit to SOD (D7, with SDE = D6 = 1).

    Example: MVI A, 0EH then SIM masks 7.5 and 6.5 and leaves 5.5 enabled.

  4. RIM (read interrupt mask). Loads the accumulator with:

    • the current masks (D2–D0);
    • the interrupt-enable flag (D3);
    • the pending interrupts (D6–D4);
    • the serial input bit from SID (D7).

    It is used to check which interrupts are pending or masked.

✓ Answer checked step by step Standard result.

↑ Back to the question list

(i) List various interrupts in microprocessor 8085 in order of decreasing priority. Specify which of these are edge-sensitive and which are level-sensitive. Explain why TRAP is having good noise immunity as compared to other interrupts. (ii) What will be the action of running the given assembly program segment? MVI A, 0B H; SIM.

2022 · Paper II · Q4a · 20 marks

Solution

(i) Interrupts in decreasing priority

Priority Interrupt Sensitivity
1 (highest) TRAP Edge and level sensitive (rising edge, then must stay high)
2 RST 7.5 Edge sensitive (rising edge, latched in a flip-flop)
3 RST 6.5 Level sensitive (high)
4 RST 5.5 Level sensitive (high)
5 (lowest) INTR Level sensitive (high)

Why TRAP has good noise immunity. TRAP is accepted only if a rising edge occurs and the line then stays high until it is sampled. A short noise spike gives an edge but does not hold the level. A steady wrong level without a fresh edge is ignored too.

This double requirement keeps false triggering low, which matters because TRAP cannot be masked. It is used for critical events such as power failure.

(ii) MVI A, 0BH then SIM 0BH=00001011(D7…D0)

Bit Value Effect
D7 SOD, D6 SDE 0, 0 no serial output
D4 R7.5 0 the RST 7.5 flip-flop is not reset
D3 MSE 1 the masks are applied
D2 M7.5 0 RST 7.5 unmasked (enabled)
D1 M6.5 1 RST 6.5 masked
D0 M5.5 1 RST 5.5 masked

So only RST 7.5, among the three restart interrupts, is enabled. It will actually be recognised only if the interrupt system is enabled by EI. TRAP and INTR are not affected by SIM.

✓ Checked by computer We decoded the SIM byte bit by bit in Python.

↑ Back to the question list

What do you mean by maskable interrupts? Which interrupt cannot be masked?

2018 · Paper II · Q5d(i) · 5 marks

Solution

A maskable interrupt is one that the processor can ignore (mask) under program control.

  • In the 8085, DI or a reset disables all of INTR, RST 7.5, RST 6.5 and RST 5.5, and EI enables them again.
  • In addition, SIM can mask RST 7.5, 6.5 and 5.5 one by one.

While masked, a request is not serviced. RST 7.5 is the exception in one respect: its request is remembered (latched) until it is serviced or reset.

TRAP cannot be masked. It is always accepted, whatever the state of EI, DI or SIM, which is why it is used for emergencies such as power failure. It has the highest priority and vectors to 0024H.

✓ Answer checked step by step Standard result.

↑ Back to the question list

Write an assembly language program to enable RST 6.5 interrupt.

2018 · Paper II · Q5d(ii) · 5 marks

Solution

To enable RST 6.5 we must:

  • clear its mask bit with SIM (MSE = 1, M6.5 = 0);
  • enable the interrupt system with EI.

Here we unmask only RST 6.5 and keep 7.5 and 5.5 masked: mask byte=00001101=0DH(MSE=1,M7.5=1,M6.5=0,M5.5=1)

Instruction Comment
LXI SP, 27FFH stack for the return address
MVI A, 0DH 0000 1101: unmask 6.5 only
SIM apply the mask
EI enable the interrupt system
LOOP: JMP LOOP main program (or other work)

Service routine at the vector 0034H (usually a JMP to the actual routine):

Instruction Comment
ISR65: PUSH PSW save the registers used
… service the device
POP PSW
EI re-enable interrupts
RET

To enable all three restart interrupts, use MVI A, 08H (MSE = 1, all masks 0).

✓ Checked by computer We worked out the mask byte bit by bit in Python.

↑ Back to the question list

Describe the two ways in which the interrupt RST 7.5 in 8085 micro-processor can be disabled.

2017 · Paper II · Q1c(i) · 5 marks

Solution

RST 7.5 can be disabled in two ways.

  1. By masking it with SIM. Load the accumulator with D3 (MSE) = 1 and D2 (M7.5) = 1, then execute SIM. For example, MVI A, 0CH then SIM masks only RST 7.5. Its request can still be latched in the RST 7.5 flip-flop, and it will be serviced later, when it is unmasked. Setting D4 (R7.5) = 1 in the same SIM byte (for example 1CH) also clears any pending request.
  2. By disabling the whole interrupt system with DI (or by a reset, or automatically on accepting any interrupt). The interrupt-enable flip-flop is reset, so RST 7.5, together with RST 6.5, RST 5.5 and INTR, is not recognised until EI is executed.

The difference: SIM disables RST 7.5 selectively and leaves the others; DI disables all the maskable interrupts at once.

✓ Answer checked step by step Standard result.

↑ Back to the question list

How long can the INTR pulse stay high in 8085 microprocessor?

2017 · Paper II · Q5b(i) · 5 marks

Solution

INTR is level-sensitive and is not latched inside the 8085. So the pulse must satisfy two conditions.

  • Minimum: it must stay high until it is acknowledged. The 8085 samples INTR only in the last clock cycle of an instruction. So INTR must remain high long enough to be seen at the end of the current instruction, which can be up to 18 T-states (CALL): 6 µs at 3 MHz. In practice the device keeps INTR high until it receives INTA.
  • Maximum: it must go low before interrupts are enabled again. Accepting INTR automatically disables interrupts, but if INTR is still high when the service routine executes EI, the same request is accepted again and the routine re-enters itself. So INTR must be removed after INTA and before the EI in the service routine (in practice, as soon as the INTA cycle is over).

In short, INTR may stay high from the request until it is acknowledged, and no longer than the execution of EI in the service routine.

✓ Answer checked step by step Standard result.

↑ Back to the question list

Cover of the UPSC Mains Topic-wise and Year-wise PYQs book (2013–2026)

From the Optional Province team

Strengthen your GS papers

Our UPSC Mains Topic-wise & Year-wise PYQ Book (2013–2026) maps every GS question to the syllabus, so you know what UPSC asks and how often. Now available as a hard copy and an eBook.

Buy Hard Copy on AmazonBuy eBook (PDF)

Download a free sample

Suppose that an 8085 microprocessor has received three interrupt requests in the following order: RST 7.5, RST 6.5 and RST 5.5. If these three interrupts are nested, to what depth does the stack penetrate if all registers within the CPU must be saved? Assume that the stack pointer initially points to location FFFFH.

2017 · Paper II · Q7b(ii) · 10 marks

Solution

For each interrupt, the 8085 pushes the return address (2 bytes) automatically. To save all registers, the service routine executes PUSH PSW, PUSH B, PUSH D and PUSH H (8 bytes).

Bytes per interrupt=2+8=10

With three interrupts nested (each service routine re-enables interrupts with EI and is interrupted by the next):

Event SP after
Start FFFFH
RST 7.5 accepted + 4 PUSH FFFFH − 10 = FFF5H
RST 6.5 accepted + 4 PUSH FFEBH
RST 5.5 accepted + 4 PUSH FFE1H

The stack penetrates 30 bytes deep, occupying FFFEH down to FFE1H. SP ends at FFE1H.

Note. Because 7.5 > 6.5 > 5.5 in priority, this nesting happens only if each service routine executes EI early and leaves the lower interrupts unmasked. The 8085 itself has no rule against a lower-priority interrupt interrupting a higher-priority service routine once interrupts are re-enabled.

✓ Checked by computer We traced the stack pointer through the three nested interrupts in Python.

↑ Back to the question list

Write down the purpose of each bit in SIM (Set Interrupt Mark) instruction. Give three different functions of SIM instruction.

2016 · Paper II · Q4b · 10 marks

Solution

SIM (output to the interrupt and serial control)SODD7SDED6×D5R7.5D4MSED3M7.5D2M6.5D1M5.5D0SDE = 1 sends D7 to SOD · R7.5 = 1 resets the RST 7.5 flip-flopMSE = 1 makes D2–D0 effective · mask bit 1 = maskedRIM (read into the accumulator)SIDD7I7.5D6I6.5D5I5.5D4IED3M7.5D2M6.5D1M5.5D0SID = serial input bit · I7.5–I5.5 = pending interrupts · IE = interrupt enable flag · M = current masks
Bit D7 is on the left. On a phone, swipe sideways to see all of it.

Purpose of each bit of the accumulator for SIM

Bit Name Purpose
D0 M5.5 Mask for RST 5.5 (1 = masked)
D1 M6.5 Mask for RST 6.5
D2 M7.5 Mask for RST 7.5
D3 MSE Mask set enable: D0–D2 are used only if MSE = 1
D4 R7.5 1 resets the RST 7.5 flip-flop (clears a pending 7.5 request)
D5 – Not used
D6 SDE Serial data enable: D7 is sent out only if SDE = 1
D7 SOD Serial output data bit, sent to the SOD pin

Three functions of SIM

  1. Set or clear the masks of RST 7.5, 6.5 and 5.5 individually. For example, MVI A, 08H then SIM unmasks all three.
  2. Reset the RST 7.5 flip-flop, which cancels a pending 7.5 request. For example, MVI A, 10H then SIM.
  3. Serial output. Send one bit at a time to the SOD pin. For example, MVI A, C0H then SIM outputs a 1. This is used for software serial transmission.

(The question’s “Set Interrupt Mark” means Set Interrupt Mask.)

✓ Answer checked step by step Standard result.

↑ Back to the question list

Write the various interrupts available in the microprocessor 8085 in the order of decreasing priority.

2014 · Paper II · Q1b(i) · 6 marks

Solution

In order of decreasing priority:

  1. TRAP: non-maskable; edge and level triggered; vector 0024H.
  2. RST 7.5: maskable; rising edge (latched); 003CH.
  3. RST 6.5: maskable; level; 0034H.
  4. RST 5.5: maskable; level; 002CH.
  5. INTR: maskable; level; non-vectored. The vector comes from the device (RST n or CALL), and it is acknowledged by INTA.

The software interrupts RST 0–RST 7 are instructions, so they have no priority level.

✓ Answer checked step by step Standard result.

↑ Back to the question list

Can the 8085 microprocessor be interrupted before completion of existing Interrupt Service Subroutine (ISS)? Justify your answer.

2012 · Paper II · Q5b · 10 marks

Solution

Yes, it can, if the program allows it.

When the 8085 accepts an interrupt, it automatically resets the interrupt-enable flip-flop. So, by default, no other maskable interrupt can break into the service routine.

However:

  1. TRAP is non-maskable. It is always accepted, even in the middle of any service routine. So the routine can always be interrupted by TRAP.
  2. Re-enabling. If the routine executes EI before it finishes (for example, near the start), the maskable interrupts (RST 7.5, 6.5, 5.5 and INTR, if unmasked by SIM) are accepted again. A new request then suspends the current routine: its return address is pushed onto the stack, and the new routine runs. This is nested interrupts. The original routine resumes after the inner one returns.
  3. RST 7.5 requests are latched, so a 7.5 request that arrives while interrupts are disabled is not lost. It is serviced as soon as interrupts are enabled again.

The 8085 has no hardware that blocks a lower-priority interrupt from interrupting a higher-priority routine once EI is executed. The programmer controls this with SIM masks, for example by masking the lower levels inside a high-priority routine.

So the routine can be interrupted by TRAP always, and by maskable interrupts if it re-enables them with EI. If it does not, the new requests wait (RST 7.5 latched; INTR and 6.5/5.5 only if still held high) until EI is executed before RET.

✓ Answer checked step by step Standard result.

↑ Back to the question list

This question has the following parts.

(i) What are the features of three sources of interrupts that 8086 has?

(ii) What are the three operations possible in the ‘string’ group? What are the registers used by the instructions in this group?

(iii) Write the block diagram indicating how 8255A PPI is interfaced to 8086 max mode CPU module, using two 8255As for 16-bit I/O operation.

2011 · Paper II · Q7b(i) · 6 marks · also asked 2011 (Q7b(ii)), 2011 (Q7b(iii))

Solution

(i) Three sources of interrupts in the 8086

  1. Hardware, external.
    • NMI: non-maskable, rising-edge triggered, type 2 (vector at 00008H).
    • INTR: maskable through the IF flag (STI, CLI), level triggered. It is acknowledged by two INTA pulses, and the device (usually an 8259A) supplies an 8-bit type number. The vector address is 4 × type.
  2. Software. The instruction INT n (n = 0–255) calls any of the 256 vectors; INT 3 is a 1-byte breakpoint and INTO is interrupt on overflow (type 4). These let programs call system services.
  3. Internal (processor-generated exceptions).
    • Type 0: divide error.
    • Type 1: single-step, when TF = 1.
    • Type 4: overflow (with INTO).
    These are produced by the CPU itself during execution.

All of them use the same interrupt vector table at 00000H–003FFH: 4 bytes (IP, CS) per type. On entry, the CPU pushes the flags, CS and IP, and clears IF and TF.

(ii) String group

  • Operations:

    • move (MOVS);
    • compare (CMPS), scan (SCAS);
    • load (LODS) and store (STOS), with the prefix REP, REPE, REPNE.

    These are usually summed up as three operations: move/copy, compare/scan (search), and load/store.

  • Registers used:

    • SI, the source offset, in the DS segment;
    • DI, the destination offset, in the ES segment;
    • CX, the count for the REP prefixes;
    • AL/AX, the data for SCAS, LODS and STOS.
  • Direction: the DF flag sets the direction. CLD makes SI and DI auto-increment; STD makes them auto-decrement (by 1 for bytes, 2 for words).

(iii) Two 8255As for 16-bit I/O on an 8086 maximum-mode CPU module

8086(max mode)S2–S0, BHE,AD15–AD08288 buscontrollerAddress latches74LS373 (ALE)Data transceivers8286 (DT/R, DEN)I/O addressdecoder8255A (even)D0–D7A0, A1 ← A1, A2CS: decoder & A0 = 08255A (odd)D0–D7 ← D8–D15A0, A1 ← A1, A2CS: decoder & BHE = 0Ports A, B, C(low byte)Ports A, B, C(high byte)S2–S0A15–A0D7–D0D15–D8IORC, AIOWC → RD, WR
A typical arrangement; address decoding details vary. On a phone, swipe sideways to see all of it.
  • In maximum mode, the 8288 bus controller decodes S2–S0 into the command signals IORC and AIOWC. These drive RD and WR of both 8255As.
  • Addresses are latched by 74LS373s using ALE, and data passes through 8286 transceivers (DT/R, DEN).
  • One 8255A sits on the low data byte D7–D0 and is selected when A0 = 0. The other sits on the high byte D15–D8 and is selected when BHE = 0.
  • Address lines A1 and A2 select the port or control register in each chip (A0 is used for the byte selection), and the higher address lines go to the decoder for CS.
  • A 16-bit IN AX, port or OUT port, AX at an even address enables both chips together, giving 16-bit ports: for example port A of both chips as one 16-bit port.

✓ Answer checked step by step Standard result.

↑ Back to the question list

The interrupt is a process of data transfer whereby a peripheral can inform the processor that it is ready for communication. How can interrupt be masked or unmasked using a program control? List the instructions used for control of interrupts. Explain any one by taking a suitable example.

2010 · Paper II · Q6b · 20 marks

Solution

Masking and unmasking by program. Interrupts are controlled at two levels.

  1. All the maskable interrupts together, through the interrupt-enable flip-flop:

    • EI enables INTR, RST 7.5, 6.5 and 5.5;
    • DI disables them all.

    The flip-flop is also reset on reset and whenever an interrupt is accepted.

  2. RST 7.5, 6.5 and 5.5 individually, through the mask bits set by SIM: 1 = masked, 0 = unmasked, with MSE = 1.

TRAP cannot be masked at all. INTR has no individual mask: only EI and DI control it.

Instructions for controlling interrupts: EI, DI, SIM, RIM, together with RST n (the software interrupts) and RET (return from the service routine).

Example: SIM. We want RST 5.5 enabled, RST 6.5 and 7.5 masked, and a pending 7.5 request cleared: A=00011110=1EH

  • D4 R7.5 = 1: reset the 7.5 flip-flop.
  • D3 MSE = 1.
  • D2 = 1: mask 7.5.
  • D1 = 1: mask 6.5.
  • D0 = 0: unmask 5.5.
Instruction Comment
MVI A, 1EH mask pattern
SIM apply the masks, clear the 7.5 request
EI enable the interrupt system

Afterwards, RIM would show D2 D1 D0 = 110 and IE = 1. A high level on RST 5.5 then causes a jump to 002CH at the end of the current instruction.

✓ Answer checked step by step Standard result.

↑ Back to the question list

An 8085 processor based interrupt system requires handling of 11 interrupting devices, excluding TRAP interrupt. Show schematically how this can be achieved. Indicate any one interrupt vector address.

2009 · Paper II · Q7b · 20 marks

Solution

The 8085 has four maskable hardware inputs: RST 7.5, RST 6.5, RST 5.5 and INTR.

  • Three devices are connected directly to RST 7.5, 6.5 and 5.5. These are vectored, and their priority is fixed.
  • The remaining eight devices share INTR. A priority encoder (74LS148, or an 8259A PIC) does three jobs:
    • it raises INTR whenever any of them requests;
    • it encodes the highest-priority request as a 3-bit number AAA;
    • when INTA comes, it places the 1-byte opcode RST AAA = 11 AAA 111 on the data bus through a tri-state buffer.

The total is 3 + 8 = 11 devices.

8085RST 7.5 (003CH)RST 6.5 (0034H)RST 5.5 (002CH)INTRINTAD7–D0Device 9Device 10Device 11Devices 1–8I0 … I7Priorityencoder74LS148Tri-state bufferRST opcode11 AAA 111A2 A1 A0any request → INTRINTAopcode
Three direct RST inputs plus eight devices on INTR through a priority encoder. On a phone, swipe sideways to see all of it.

Vector addresses

Source Vector
RST 7.5 003CH
RST 6.5 0034H
RST 5.5 002CH
INTR → RST n 8n: 0000H, 0008H, … 0038H

One vector worked out. A device on encoder input 5 produces RST 5 (opcode EFH = 11 101 111). The processor pushes the PC and jumps to 5×8= 0028H, where a JMP to that device’s service routine is stored.

(RST 0 at 0000H is the reset address, so a practical design avoids using it; an 8259A, which supplies a full CALL address, removes this limit.)

✓ Checked by computer We counted the inputs and worked out the vector addresses in Python.

↑ Back to the question list

What is the fundamental difference between a subroutine call and an interrupt request? Is it possible to employ a common memory stack for both?

2001 · Paper II · Q2a · 20 marks

Solution

Fundamental difference. A subroutine call is a planned, synchronous transfer: the CALL instruction is written in the program, at a known point, and the programmer knows when it happens. An interrupt request is an external, asynchronous event. It comes from a device at an unpredictable time, between any two instructions, and the processor answers it (if enabled) by itself calling a service routine.

Subroutine call Interrupt
Started by an instruction in the program Started by a hardware signal (or RST, INT)
Occurs at a known place Occurs at any time (asynchronous)
Target address in the instruction Target from a fixed vector or supplied by the device
Cannot be disabled Maskable ones can be enabled or disabled (EI, DI, SIM)
No acknowledge cycle Acknowledge cycle (INTA) for INTR; interrupts disabled on entry
Registers are saved as the program needs The service routine must save every register it uses, because the interrupted program did not expect the break

Can a common stack be used? Yes. Both save the return address with the same mechanism: the PC is pushed at SP − 1 and SP − 2. Both return with RET (in the 8086, IRET for interrupts). So one stack in R/W memory serves both, and calls and interrupts can be nested in any order, because they unwind last-in, first-out.

The stack must be large enough for the deepest combination: nested subroutines plus nested interrupts with all their saved registers. Every service routine must also leave it balanced (equal PUSH and POP before RET).

✓ Answer checked step by step Standard result.

↑ Back to the question list

More on Microprocessors and Microcomputers

Questions: UPSC Civil Services (Main) Examination, Electrical Engineering Paper II, 2001–2026. Solutions: Optional Province. Found an error? Tell us.

Spotted an error? Tell us.

We classify every PYQ with care, but mistakes can slip in. If a question is in the wrong topic, has a typo, the wrong year, or is missing, let us know. We review every report and update the page.

Report an Error
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted