[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]

INTERRUPT STATUS REGISTER

The interrupt status register shows the current status of any interrupt source. The current status of bit 2 of the interrupt register will be a 1 when two sprites hit each other. The same is true, in a corresponding 1 to 1 relationship, for bits 0-3 listed in the chart below. Bit 7 is also set with a 1, whenever an interrupt occurs.

The interrupt status register is located at 53273 ($D019) and is as follows:
LATCHBIT#DESCRIPTION
IRST 0 Set when current raster count = stored raster count
IMDC 1 Set by SPRITE-DATA collision (1st one only, until reset)
IMMC 2 Set by SPRITE-SPRITE collision (1st one only, until reset)
ILP 3 Set by negative transition of light pen (1 per frame)
IRQ 7 Set by latch set and enabled

Once an interrupt bit has been set, it's "latched" in and must be cleared by writing a 1 to that bit in the interrupt register when you're ready to handle it. This allows selective interrupt handling, without having to store the other interrupt bits.

The INTERRUPT ENABLE REGISTER is located at 53274 ($D01A). It has the same format as the interrupt status register. Unless the corresponding bit in the interrupt enable register is set to a 1, no interrupt from that source will take place. The interrupt status register can still be polled for information, but no interrupts will be generated.

To enable an interrupt request the corresponding interrupt enable bit (as shown in the chart above) must be set to a 1.

This powerful interrupt structure lets you use split screen modes. For instance you can have half of the screen bit mapped, half text, more than 8 sprites at a time, etc. The secret is to use interrupts properly. For example, if you want the top half of the screen to be bit mapped and the bottom to be text, just set the raster compare register (as explained previously) for halfway down the screen. When the interrupt occurs, tell the VIC-II chip to get characters from ROM, then set the raster compare register to interrupt at the top of the screen. When the interrupt occurs at the top of the screen, tell the VIC-II chip to get characters from RAM (bit map mode).

You can also display more than 8 sprites in the same way. Unfortunately BASIC isn't fast enough to do this very well. So if you want to start using display interrupts, you should work in machine language.


[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]
This page has been created by Sami Rautiainen.
Read the small print. Last updated May 12, 2002.