There are five sources of interrupts on the 6526: underflow from TIMER
A, underflow from TIMER B, TOD ALARM, Serial Port full/empty and
. A single register provides masking and interrupt
information. The interrupt Control Register consists of a write-only MASK
register and a read-only DATA register. Any interrupt will set the
corresponding bit in the DATA register. Any interrupt which is enabled by
the MASK register will set the IR bit (MSB) of the DATA register and bring
the
pin low. In a multi-chip system, the IR bit can be
polled to detect which chip has generated an interrupt request. The
interrupt DATA register is cleared and the
line returns
high following a read of the DATA register. Since each interrupt sets an
interrupt bit regardless of the MASK, and each interrupt bit can be
selectively masked to prevent the generation of a processor interrupt,
it is possible to intermix polled interrupts with true interrupts. However,
polling the IR bit will cause the DATA register to clear, therefore, it is
up to the user to preserve the information contained in the DATA register
if any polled interrupts were present.
The MASK register provides convenient control of individual mask bits. When writing to the MASK register, if bit 7 (SET/CLEAR) of the data written is a ZERO, any mask bit written with a one will be cleared, while those mask bits written with a zero will be unaffected. If bit 7 of the data written is a ONE, any mask bit written with a one will be set, while those mask bits written with a zero will be unaffected. In order for an interrupt flag to set IR and generate an Interrupt Request, the corresponding MASK bit must be set.
REG | NAME | D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
---|---|---|---|---|---|---|---|---|---|
D | ICR | IR | 0 | 0 | FLAG | SP | ALARM | TB | TA |
REG | NAME | D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
---|---|---|---|---|---|---|---|---|---|
D | ICR | S/C | X | X | FLAG | SP | ALARM | TB | TA |