Jump to content


DLI timing

3 replies to this topic

#1 Avram OFFLINE  



  • 288 posts

Posted Fri Jan 20, 2012 7:42 AM

How much can I do in a DLI on an antic #4 screen? Currently I have an interrupt on every line where I use a lookup table to change two playfield colors (the table counter also increments each line).

I'd like to animate 2-4 bytes of the same character on each line, in addition to the color changes. Is that possible? Oh, and I'm also planning on using all the pm graphics too.


#2 Avram OFFLINE  



  • Topic Starter
  • 288 posts

Posted Fri Jan 20, 2012 7:45 AM

Ad to specify, I'm looking to have each line's character that I'm changing to look different. So the "A" on line 0 will look different from the "A" on line 1 etc.

#3 Rybags OFFLINE  



  • 14,206 posts
  • Location:Australia

Posted Fri Jan 20, 2012 7:53 AM

The Altirra hardware reference has some good info there.

When your DLI starts, there's not a great deal of time to do stuff before the end of normal display. Normally you can push 2 registers and STA WSYNC safely, fairly sure trying to push a third risks overrun.

But you can get creative and just leave the WSYNC out altogether. Just ensure any relevant changes like colour and character stuff occurs offscreen.

Pushing 3 registers and preloading 2 registers e.g. for the colour change should be about enough to ensure you're offscreen. If not, padding out with a NOP or 2 should ensure it.

The "offscreen" amount of cycles you have available will vary depending on DMA width, whether H-Scrolling is active and whether PMG DMA is enabled.

Actual cycles are 34, but you lose 1 for DList fetch, another 5 if PMG DMA is enabled, even more if HScrolling is enabled. When HScrol is enabled, the cycle loss will be variable.

Time saving tips for DLIs - use zero page, use immediate mode if possible for colour/character changes although this will typically mean multiple DLI routines will be needed rather than just one.
You can also save time by not pushing registers to the stack, but storing them in LDA/LDX immediate instructions before the RTI.

sta save_a
stx save_x
; dli stuff
lda #$ff ; this gets modified
ldx #$ff ; so does this

Edited by Rybags, Fri Jan 20, 2012 7:54 AM.

#4 Avram OFFLINE  



  • Topic Starter
  • 288 posts

Posted Fri Jan 20, 2012 8:48 AM

Thanks for the super fast reply Rybags!

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users