Jump to content
IGNORED

Display List Interrupts routine: problem


Philsan

Recommended Posts

I found this DLI ML routine that could suit my needs (e.g. more colors like my 2600 game L.E.M. or a beautiful sky).

http://www.atariarch..._Interrupts.php

(program 10 + program 12)

 

There is a problem.

As-is, cyclically artifacts appear (see yellow pixel on the right):

post-12528-0-37086500-1329047293_thumb.png

If I completely remove the bar draw part (type 126 GOTO 240 in the program), I get those moving artifacts:

post-12528-0-33482900-1329047449_thumb.png

 

To do tests, you can use the attached .atr and type ENTER "D:DLIST.LST".

Filippo2012-TurboBasic.atr

Link to comment
Share on other sites

The reason for the artifacts is that the DLI routine doesn't wait for WSYNC -- it just begins changing colors in the middle of the scan line. This puts you at the timing mercy of whatever code is running in mainline and what screen mode is in use. Adding WSYNC isn't enough, though, because there aren't enough cycles in horizontal blank with a standard width screen to cleanly switch all five color registers with the 77 cycles this routine takes. You'd need a streamlined routine with transposed color tables to do it in 24-28.

Link to comment
Share on other sites

Thank you.

So in 1983 were published books (The Creative Atari) with programs far from perfection...

 

If it's not a time consuming task, it would be nice if someone would write a graphics 15 (or graphics 7) DLI ML routine to have more on-screen colors (f.e. 24 rows with different backgrounds / colors).

Link to comment
Share on other sites

dli1.zip

 

Here's a better one + sample Basic program.

 

Source included for the assembly routine (for AtAsm).

 

As is, the colour tables are:

 

$7000 Background

$7100 ColPF0

$7200 ColPF1

$7300 ColPF2

 

You can put as many DLIs as you need, you can't really have 2 DLIs adjacent because you'll get overrun. If you wanted something like that, then you need to do one DLI that continually changes the colours.

 

The Assembly routine sits @ $600 and has included a short USR routine that sets the DLI/VBlank vectors up.

  • Like 2
Link to comment
Share on other sites

10 GOSUB 1000
20 DL=PEEK(560)+PEEK(561)*256
30 FOR C=0 TO 2:COLOR C+1
40   FOR X=C*40 TO C*40+38 STEP 2
50	 PLOT X,0:DRAWTO X,191:NEXT X
60 NEXT C
70 POKE DL+20,174
80 POKE DL+40,174
90 POKE DL+60,174
91 POKE DL+80,174
92 POKE DL+100,174
93 POKE DL+120,174
94 POKE DL+140,174
95 POKE DL+160,174
100 TABBAK=7*4096:TABPF0=TABBAK+256:TABPF1=TABBAK+512:TABPF2=TABBAK+768
110 POKE TABBAK,2:POKE TABBAK+1,4:POKE TABBAK+2,6:POKE TABBAK+3,8:POKE TABBAK+4,10:POKE TABBAK+5,10
120 POKE TABPF0,34:POKE TABPF0+1,136:POKE TABPF1+2,248
130 POKE TABPF1,54:POKE TABPF1+1,PEEK(53770):POKE TABPF1+2,PEEK(53770)
140 POKE TABPF2,168:POKE TABPF2+1,PEEK(53770):POKE TABPF2+2,PEEK(53770)
500 Z=USR(1536)
999 GOTO 999
1000 TRAP 1020
1010 RESTORE 2000:FOR A=1536 TO 1791:READ D:POKE A,D:NEXT A
1020 GRAPHICS 15+16
1490 RETURN
2000 DATA 104,169,0,141,14,212,162,32
2010 DATA 160,6,142,0,2,140,1,2
2020 DATA 162,72,160,6,142,34,2,140
2030 DATA 35,2,169,64,141,14,212,96
2040 DATA 72,152,72,172,85,6,185,0
2050 DATA 112,141,10,212,141,26,208,185
2060 DATA 0,113,141,22,208,185,0,114
2070 DATA 141,23,208,185,0,115,141,24
2080 DATA 208,238,85,6,104,168,104,64
2090 DATA 169,0,141,85,6,169,192,141
2100 DATA 14,212,76,95,228,0,14,212
2110 DATA 76,95,228,3,0,-1

Link to comment
Share on other sites

  • 7 years later...
On 2/14/2012 at 2:26 PM, Philsan said:

10 GOSUB 1000
20 DL=PEEK(560)+PEEK(561)*256
30 FOR C=0 TO 2:COLOR C+1
40   FOR X=C*40 TO C*40+38 STEP 2
50	 PLOT X,0:DRAWTO X,191:NEXT X
60 NEXT C
70 POKE DL+20,174
80 POKE DL+40,174
90 POKE DL+60,174
91 POKE DL+80,174
92 POKE DL+100,174
93 POKE DL+120,174
94 POKE DL+140,174
95 POKE DL+160,174
100 TABBAK=7*4096:TABPF0=TABBAK+256:TABPF1=TABBAK+512:TABPF2=TABBAK+768
110 POKE TABBAK,2:POKE TABBAK+1,4:POKE TABBAK+2,6:POKE TABBAK+3,8:POKE TABBAK+4,10:POKE TABBAK+5,10
120 POKE TABPF0,34:POKE TABPF0+1,136:POKE TABPF1+2,248
130 POKE TABPF1,54:POKE TABPF1+1,PEEK(53770):POKE TABPF1+2,PEEK(53770)
140 POKE TABPF2,168:POKE TABPF2+1,PEEK(53770):POKE TABPF2+2,PEEK(53770)
500 Z=USR(1536)
999 GOTO 999
1000 TRAP 1020
1010 RESTORE 2000:FOR A=1536 TO 1791:READ D:POKE A,D:NEXT A
1020 GRAPHICS 15+16
1490 RETURN
2000 DATA 104,169,0,141,14,212,162,32
2010 DATA 160,6,142,0,2,140,1,2
2020 DATA 162,72,160,6,142,34,2,140
2030 DATA 35,2,169,64,141,14,212,96
2040 DATA 72,152,72,172,85,6,185,0
2050 DATA 112,141,10,212,141,26,208,185
2060 DATA 0,113,141,22,208,185,0,114
2070 DATA 141,23,208,185,0,115,141,24
2080 DATA 208,238,85,6,104,168,104,64
2090 DATA 169,0,141,85,6,169,192,141
2100 DATA 14,212,76,95,228,0,14,212
2110 DATA 76,95,228,3,0,-1
 

 

Sorry to revive an old thread. I'm trying to get a handle on using DLI's for adding color and I was wondering; in the above code, where does the  TABBAK=7*4096 figure come from? I tried to insert the Graphics 7+16 version of this code code into a program I'm working on as a test and when I do it seems to overwrite the screen memory.

 

Thanks for any help! 

Link to comment
Share on other sites

The colour table bases are hardcoded into the program.

 

To cater for the larger graphics memory you'd need to relocate them lower down.  Instead of $7000, maybe $6000.

 

The changes needed would be to the data in lines 2050 to 2070.  The high byte of each colour table is 112, 113, 114 and 115, so just change those numbers to 96, 97 etc.

Then in line 100 change TABBAK=7*4096 to TABBAK=6*4096

 

That should work.  I did that program years ago and probably don't have it anymore, worked it out by pasting into the emualtor.

Link to comment
Share on other sites

They're just LDA $abs,Y instructions, so the address base can be almost anywhere though note if not starting on a page boundary you get the extra cycle per instruction.

Just basing on a page (divisible by 256) is fine - you end up wasting some memory since there's 192 or whatever colour entries with the remainder of the 256 not being used.

Link to comment
Share on other sites

I'm still having a bit of trouble with the DLI routine that I can't figure out.

 

I set 8 DLI color change rows in GR.7+16 with 4 Players on the screen as a test. I am getting a wobble for some reason but only with color 3 and only in a stripe of a few pixel width about 25 rows from the left. The strange thing is that I don't get it until the line where I activate the PMG's by Poking 559,62. A poke 559,34 and no wobble. I've tried moving the DLI and PMG's around to different memory locations to see if there was a conflict but the results are the same. I also tried using less than the 8 DLI color changes to see if that helps. I also switched the DLI ML routine from DATA statements to a string to save space but I also tried it with the data statements too. Everything looks good but after days of trying, I just can't figure it out. Can you think of anything I missed? These are the times I wish I new assembly language! :)

 

I attached the code to this message and in the screenshot, the three wide horizontal bars are in color 1,2&3 from top to bottom with an extra vertical color 3 bar where the DLI wobbles.

Capture.JPG

DLITEST.LST

Link to comment
Share on other sites

PMGs add more DMA cycle losses which can affect timing.  Same with custom DLists or doing H-Scrolling or wide DMA mode.

 

There's plenty of cycle-saving hints around such as preload 6502 registers then hit WSync and do all the stores in a row, have an early DLI, avoid too much processing that can be done outside the DLI.

Link to comment
Share on other sites

34 minutes ago, gobo said:

I also noticed that if I press a key on the keyboard the wobble speed increases.

Here's a bit of De Re Atari about that:

 

The OS keyboard click routine interferes with the function of the DLI. Whenever a key is pressed and acknowledged, the onboard speaker is clicked. The timing for this click is provided by several STA WSYNC instructions. This can throw off the timing of a DLI routine and cause the screen colors to jump downward by one scan line for a fraction of a second. There is no easy solution to this problem. One possible solution involves the VCOUNT register, a read-only register in ANTIC which tells what scan line ANTIC is displaying. A DLI routine could examine this register to decide when to change a color. Another solution is to disable the OS keyboard service routine and provide your own keyboard routine. This would be a tedious job. The final solution is to accept no inputs from the keyboard. If key presses are not acknowledged, the screen jiggle does not occur.

  • Like 1
Link to comment
Share on other sites

The OS keyclick only interferes on 400/800 as it uses WSync which can delay DLIs by a scanline.

The XL uses wait loops on VCount which have no effect (probably other than reducing cycle jitter a little) and turning off the keyclick would make no difference other than the jitter although when E: is waiting for input it's just sitting in a similar loop anyway.

 

If you do aim for your DLI to coexist with keyclick on older machines then you'll probably need to do some more work such as having the DLIs occur earlier then do a VCount test to see where you are, and act accordingly (such as hitting WSync until you're where you need to be)

  • Like 1
Link to comment
Share on other sites

Thanks for all the help. You guys are way ahead of me on the technical side of things!! :) I've always wanted to learn assembly and I think its time I give it a go as I'm limited to  programming in Turbo BASIC. So far I've been modifying little BASIC ML routines available to the public figuring out how it works. I was so happy to find the great DLI code in this thread to add colors, I've been looking for one like this for a while and this seemed perfect, (until I added the PMGs). It just might be a while now before I update my old game!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...