Jump to content
IGNORED

DLI Weirdness


Recommended Posts

I understand the basics of how DLIs work and how to implement them in BASIC with assembly routines. However, I have found them to be very fussy and have come to believe maybe I missing something important. The DLI BASIC code below successfully draws the screen with four different shades of blue. The assembly code for setting the background color registers comes from listing 8.2 of Compute's Second Book of Atari. It reads from a table of colors stored in page 4 of memory.

 

Here are some weird observations I don't understand and need your help with. First, if I remove the POKE 752,1 from line 1000 I get a black screen. This seems odd. Why? Second, if I move lines 5000+ up between lines 2000+ and 3000+ the colors are shifted down by six lines. Why would that matter?

 

Thanks for any insight you can provide! The code is below. I have also attached it as a .txt file and with the BASIC code in an ATR.

 

1000 GRAPHICS 1+16:POKE 752,1:PRINT " "
1010 DIM DLI$(35)
1020 DL=PEEK(560)+PEEK(561)*256

2000 REM read in assembly code to modify graphics
2010 FOR I=1 TO 35:READ X:DLI$(I)=CHR$(X):NEXT I
2020 DATA 72,152,72,172,0,4,185,2,4,141,10,212
2030 DATA 141,24,208,238,0,4,173,0,4,205,1,4
2040 DATA 144,5,169,0,141,0,4,104,168,104,64

3000 REM modify display list for interrupt
3010 FOR I=2 TO 3:POKE DL+I,PEEK(DL+I)+128:NEXT I
3020 FOR I=6 TO 27:POKE DL+I,PEEK(DL+I)+128:NEXT I

4000 REM point to DLI in memory and enable interrupt
4010 DLIADR=ADR(DLI$)
4020 DLIHI=INT(DLIADR/256):DLILO=(DLIADR-DLIHI*256)
4030 POKE 512,DLILO:POKE 513,DLIHI
4040 POKE 54286,128+64

5000 REM read background color data to page 4
5010 POKE 1024,0:POKE 1025,24
5020 FOR I=0 TO 23:READ X:POKE 1026+I,X:NEXT I
5030 DATA 112,112,112,112,112,112,114,114,114,114,114,114
5040 DATA 116,116,116,116,116,116,118,118,118,118,118,118

10000 GOTO 10000

 

DLIweird.atr DLIweird.txt

Edited by scitari
Link to comment
Share on other sites

I tried your code, removing the POKE 752,1 had no effect other than leaving the cursor on screen, which is what should happen.

 

As for the shifting of the colour, not sure about that, it's really weird, it says that area is "a reserved spare buffer"

whatever that means, so not sure if it's some sort of side effect, I removed the code and it still shifted the colours.

 

I put the code back and changed the area to page 6, still it shifted, then it hit me, sometimes BASIC keeps things when

it's tokenised, even if you save and reload, To clean a BASIC program, list it to disk, type NEW or exit and reload BASIC

"ENTER" your program and run it and it worked for me.

 

Just some weird side effect of BASIC by the looks of it.

  • Like 1
Link to comment
Share on other sites

7 minutes ago, TGB1718 said:

I tried your code, removing the POKE 752,1 had no effect other than leaving the cursor on screen, which is what should happen.

 

As for the shifting of the colour, not sure about that, it's really weird, it says that area is "a reserved spare buffer"

whatever that means, so not sure if it's some sort of side effect, I removed the code and it still shifted the colours.

 

I put the code back and changed the area to page 6, still it shifted, then it hit me, sometimes BASIC keeps things when

it's tokenised, even if you save and reload, To clean a BASIC program, list it to disk, type NEW or exit and reload BASIC

"ENTER" your program and run it and it worked for me.

 

Just some weird side effect of BASIC by the looks of it.

Thanks for giving it a try. I have been testing this code in Altirra with Altirra BASIC and cold boots in between tests.

Link to comment
Share on other sites

Seems like you've tried to modify this program in some way? The line:

GRAPHICS 1+16:POKE 752,1:PRINT " "

Makes no sense as the print goes to the non-existent text window (due to the +16) and so screws things up.

E.g. running in debug mode, pressing break and trying to do something crashes Altirra.

 

If you leave this as just the graphics statement then you just see a black screen but this is because the DLI is affecting COLPF2.

Change the 24 to 26 in line 2030 and it writes to COLBK instead and you'll see the effect.

  • Like 2
Link to comment
Share on other sites

1 minute ago, Wrathchild said:

Seems like you've tried to modify this program in some way? The line:


GRAPHICS 1+16:POKE 752,1:PRINT " "

Makes no sense as the print goes to the non-existent text window (due to the +16) and so screws things up.

E.g. running in debug mode, pressing break and trying to do something crashes Altirra.

 

If you leave this as just the graphics statement then you just see a black screen but this is because the DLI is affecting COLPF2.

Change the 24 to 26 in line 2030 and it writes to COLBK instead and you'll see the effect.

Right! Thanks!

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...