3.3 Interrupts
206
Chapter 3:Operation
3.3.2 Software Interrupts
(1) Overview
The software interrupt function shifts control from the program that the CPU was in the process of
executing to a user-defined interrupt processing program in response to the execution of a dedicated
instruction. The processing performed by the CPU when a software interrupt is generated includes the
following:
Saving the contents of the PC, PS, AH, AL, PCB, DTB, ADB, and DPR registers within the CPU
into the system stack
Setting the I flag in the PS register, thus automatically disabling interrupts
Fetching the contents of the corresponding interrupt vector and then branching there
There is no interrupt request flag and enable flag for interrupt requests generated by executing the INT
instruction (the software interrupt instruction); an interrupt request is always generated when the INT
instruction is executed.
There is no interrupt level for the INT instruction. Therefore, when the INT instruction is executed, the
ILM bits are not updated, the I flag is cleared, and continuing interrupt requests are put on hold.
(2) Structure
The facilities related to software interrupts all reside in the CPU:
CPU: ....................... Microcode: Interrupt processing steps
To use a software interrupt, it is necessary to execute the corresponding instruction.
As shown in Table 3.3.1, the same areas are used by the hardware interrupts and software interrupts for
the interrupt vectors. For example, interrupt request number INT 11 is used by the hardware interrupt
external interrupt #0 as well as by the software interrupt INT #11. Therefore, external interrupt #0 and
INT #11 both call up the same interrupt processing routine.
(3) Operation
Once the CPU fetches and begins executing a software interrupt instruction, it begins executing the
software interrupt processing microcode. In the software interrupt processing microcode, after the 12
bytes of the PS and PC, PCB, DTB, ADB, DPR, and A are saved to the memory locations indicated by
the SSB and SSP, a three-byte fetch is performed to get the interrupt vector, which is loaded into the PC
and PCB. After resetting the I flag and setting the S flag, branch processing is performed. As a result,
the next instruction that is executed is the user-defined interrupt processing program.
Fig. 3.3.4 shows the flow of processing from the occurrence of the software interrupt until the point
when there are no more interrupt requests in the interrupt processing program.