All Exams Test series for 1 year @ ₹349 only
Question

Arrange the following activities to properly run the TYPE-4 Interrupt in 8086 micro processor:

(A) Pushes the CS and IP value on stack for next instruction

(B) Pushes the flag register on the stack

(C) Reset TF and IF

(D) Gets the CS value for start of interrupt service procedure

Choose the correct answer from the options given below:

The correct answer is

(B), (C), (A), (D)

Understanding 8086 Interrupt Handling for TYPE-4

Interrupts are crucial mechanisms in the 8086 microprocessor that allow external devices or internal events to suspend the normal execution of a program and transfer control to a special routine called an Interrupt Service Routine (ISR). The 8086 supports various types of interrupts, identified by a TYPE number from 0 to 255. The TYPE-4 interrupt is specifically the Overflow Interrupt (INTO).

When an interrupt occurs, the 8086 processor performs a specific sequence of steps to handle it properly. This process ensures that the processor's state is saved so that it can return to the interrupted program after the ISR completes. The steps generally involve saving important register values onto the stack and loading the address of the corresponding ISR from the Interrupt Vector Table (IVT).

Analyzing the TYPE-4 Interrupt Activities

Let's look at the activities mentioned in the question related to the TYPE-4 Interrupt in the 8086:

  • (A) Pushes the CS and IP value on stack for next instruction
  • (B) Pushes the flag register on the stack
  • (C) Reset TF and IF
  • (D) Gets the CS value for start of interrupt service procedure

These activities describe the sequence of events that the 8086 processor performs when it acknowledges a TYPE-4 interrupt. The correct order of these activities is essential for the proper execution and return from the Interrupt Service Routine.

Correct Order of Activities for TYPE-4 Interrupt

The typical sequence of events in 8086 interrupt processing involves saving the processor's context (Flags, CS, IP), disabling further maskable interrupts and single-stepping, and then fetching the new execution address (CS and IP) from the Interrupt Vector Table (IVT). Let's arrange the given activities based on the standard 8086 interrupt handling procedure, leading to the correct sequence.

  1. Activity (B): Pushes the flag register on the stack

    The first step in the interrupt acknowledgment process is to save the current state of the processor's Flags register onto the stack. This preserves the flags from the interrupted program.

  2. Activity (C): Reset TF and IF

    After saving the original flags, the processor clears the Trap Flag (TF) and the Interrupt Flag (IF) in the Flags register. Clearing the TF disables single-stepping during the execution of the ISR. Clearing the IF disables further maskable interrupts, preventing nested interrupts unless explicitly re-enabled within the ISR.

  3. Activity (A): Pushes the CS and IP value on stack for next instruction

    Next, the processor saves the return address onto the stack. This is the address (Segment in CS and Offset in IP) of the instruction that would have executed after the interrupted instruction. Saving this allows the processor to return to the correct point in the original program after the ISR finishes.

  4. Activity (D): Gets the CS value for start of interrupt service procedure

    Finally, the processor fetches the starting address of the Interrupt Service Routine from the Interrupt Vector Table (IVT). For a TYPE-4 interrupt, the processor calculates the IVT entry address (Type number * 4) and reads the 16-bit IP and 16-bit CS values from that location. These values are then loaded into the IP and CS registers, causing execution to jump to the ISR. Note that while the activity mentions getting the CS value, it implies fetching both CS and IP from the IVT.

Therefore, the correct sequence of activities is (B), (C), (A), and (D).

Summary of TYPE-4 Interrupt Steps

Here is a summary of the steps in the correct order:

Order Activity Description
1 (B) Pushes the flag register on the stack Saves current flags.
2 (C) Reset TF and IF Disables tracing and maskable interrupts.
3 (A) Pushes the CS and IP value on stack for next instruction Saves the return address (CS:IP).
4 (D) Gets the CS value for start of interrupt service procedure Fetches the ISR address (CS:IP) from the IVT.

Revision Table: 8086 Interrupt Sequence

Step Action Register(s) Involved Stack Operation
1 Push Flags Flags Push Flags (16 bits)
2 Clear Interrupt & Trap Flags Flags (IF, TF) None (Flags register modified)
3 Push CS CS Push CS (16 bits)
4 Push IP IP Push IP (16 bits)
5 Fetch new IP from IVT IP None (IP loaded from memory)
6 Fetch new CS from IVT CS None (CS loaded from memory)

Comparing this detailed table to the activities (A)-(D), we can see how the activities map to the general steps. Activity (B) is Step 1. Activity (C) is Step 2. Activity (A) combines Steps 3 and 4. Activity (D) (mentioning CS) refers to Steps 5 and 6 (fetching both CS and IP). Based on the arrangement of activities provided in the question and the derived sequence (B), (C), (A), (D), the processor saves flags, then clears IF/TF, then saves CS and IP, and finally loads the new CS and IP from the IVT.

Additional Information: 8086 Interrupts and IVT

The 8086 has a 256-entry Interrupt Vector Table (IVT) located at the beginning of memory, from address 00000H to 003FFH. Each entry is 4 bytes long and stores the CS:IP address (segment and offset) of the corresponding Interrupt Service Routine (ISR).

  • Interrupt Vector Table (IVT): A table in the first 1 KB of memory storing addresses of ISRs. Each entry is 4 bytes.
  • Interrupt Type Number: An 8-bit number (0-255) that identifies the interrupt. This number is multiplied by 4 to get the starting address of the corresponding vector in the IVT. For TYPE-4, the address is \(4 \times 4 = 16\), or 00010H in hexadecimal.
  • Stack Usage: The stack is critical during interrupt handling. It is used to save the return address (CS and IP) and the processor flags, allowing the program to resume correctly after the interrupt.
  • TYPE-4 Interrupt (INTO): This is a software interrupt triggered automatically by the 8086 processor if the Overflow Flag (OF) is set and the INTO instruction is executed.

Understanding the sequence of saving context onto the stack and fetching the ISR address from the IVT is fundamental to grasping how the 8086 handles different interrupt types, including the TYPE-4 Interrupt.

Was this answer helpful?

Important Questions from Microprocessors and Microcontrollers

  1. Cycle stealing mode of DMA operation involves

  2. The period of machine cycle of an 8051 system with crystal frequency 16 MHz is

  3. Which of the following instructions will move the contents of register 3 to the accumulator ?

  4. In 8086, which instruction at the end of a sub-routine takes the execution back to the main program?

  5. Which one of the following is not the feature of 8051?

Need Expert Advice?

Start Your Preparation with Prepp Mobile App

Download the app from Google Play & App Store
Download the app from Google Play & App Store
Prepp Mobile App