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:
(B), (C), (A), (D)
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).
Let's look at the activities mentioned in the question related to the TYPE-4 Interrupt in the 8086:
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.
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.
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.
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.
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.
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).
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. |
| 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.
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).
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.
Cycle stealing mode of DMA operation involves
The period of machine cycle of an 8051 system with crystal frequency 16 MHz is
Which of the following instructions will move the contents of register 3 to the accumulator ?
In 8086, which instruction at the end of a sub-routine takes the execution back to the main program?
Which one of the following is not the feature of 8051?