PDP-12 User's Manual

CHAPTER 4
PDP-8 MODE PROGRAMMING

Section IV. PROGRAM INTERRUPT

OPERATION

To facilitate the handling of data transfers and the checking of peripheral device status, provision is made for interrupting a program when a given condition exists. In general, an interrupt occurs when a peripheral device flag is raised, i.e., when the device is available for service, when an operation has been completed, or when a specific condition, such as an alarm, occurs within the device.

The Program Interrupt is enabled or disabled by the program. When it is disabled, a device flag must be sensed by means of a skip; the program is not interrupted. When the interrupt is enabled, any device flag that is connected to the interrupt system will cause the following sequence of events to occur when the flag is raised:

  1. The instruction in progress at the time of the interrupt request is completed.
  2. The contents of the program counter are stored in register 0000, and 0001 is placed in the PC.
  3. Processing continues beginning with the instruction in register 0001.
  4. The interrupt facility is disabled.

The two IOT instructions which control the interrupt facility are described below.

ION - Interrupt On

Octal code: 6001
Execution time: 4.25 µsec
Operation: The interrupt facility is enabled immediately after the instruction following the ION has been executed. If an interrupt request is waiting at the time of the ION, the interrupt will occur after the next instruction has been completed. The enabling is delayed in this manner so that an interrupt service routine can return to the interrupted program before a subsequent interrupt request destroys the contents of register 0000.

IOF - Interrupt Off

Octal code: 6002
Execution time: 4.25 µsec
Operation: The interrupt facility is disabled. Subsequent requests will not cause an interrupt, although the flag causing the request may be sensed in the usual manner with an IOT skip.

USING THE INTERRUPT

Normally, when an interrupt occurs, the instruction in register 0001 is a JMP to an interrupt service routine, which examines the expected flags to determine which device or condition caused the request. The appropriate routine is called to service the device. During this time, the interrupt facility is disabled. When the device service routine is completed, control normally returns to the interrupt handling routine for restoring the interrupt facility and exiting to the main program. The last two instructions of such a routine would be:

ION              /ENABLE INTERRUPT FACILITY
JMP I 0          /RETURN TO MAIN PROGRAM AT THE ADDRESS
                 /STORE 0 IN REGISTER 0000
The interrupt is not enabled until the JMP I 0 has been executed, so that the return to the main program is completed before a waiting request can cause another interrupt.