Display List Interrupts
Eric Ball Wrote
For those of you who haven't started attempting to program the 7800 a bit of background first.
If the high bit of a DLL entry is set, MARIA will generate an NMI (non-maskable interrupt, vector at $FFFA) when it completes processing the last line of the previous DLL.
What can this be used for? Lots of stuff; I've used it for:
changing the color registers so I could get all 256 colors onscreen at once in my color grid demo
changing the background (non black active background) and CHARBASE (vertical scrolling) registers in my (to be completed) tile scrolling demo
setting a flag in Spacewar at the end of the active screen so I can get a jump on setting up the display lists for the next screen
It could also be used to change between 160 and 320 graphics modes.
Some important items to remember:
This is an interrupt routine, so you should save (either to zero page "shadow" registers, or push on the stack) any registers you use and end the routine with an RTI instruction.
You need to be efficient because you probably don't have that many cycles before the start of the next line (depending on how many sprites were on the previous line).
Some registers (CTRL and the color registers) should be updated only after the start of the next line because they effect how the pixels are read from the MARIA internal Line RAM. There are 7 fast CPU cycles* for this purpose, so do a STA WSYNC before updating them.
One item which occurred to me today is that you shouldn't use STA WSYNC in the main code if you are also using DLI. This is because STA WSYNC will halt the 6502 until the start of the next row, so the NMI will also be masked until then. (Anyone want to confirm this?)
Can anyone else think of useful things to do with a 7800 DLI?
* as opposed to slow CPU cycles when accessing the TIA or RIOT registers
Dennis Debro Asked
I think I've finally got the display list concept. Of course I won't know for sure until I actually write something :-)
Now I have a question about the DLI. In the MARIA doc it states… "One of the bits of a DLL entry tells MARIA to generate a Display List Interrupt (DLI) for that zone. The interrupt will actually occur following DMA on the last line of the PREVIOUS zone."
Is it possible to have a DLI point to another DLL? From reading this it says it's limited to a scan line unless I'm reading it wrong. It would be nice to have a DLI spin off to another DLL so the screen could be split vertically with two "kernels" running.
Eric Ball Answered
Nope, to point to a different DLL you'd have to change the DPPL/H registers and those only get read at the start of every screen.