Jump to content
gs80065xe

Problems creating custom display list

Recommended Posts

I'm studying Assembly language and am currently on Display Lists. The author has an exercise to create an Antic mode 14 display list from scratch. Using what I've learned I created a program in FastBasic. The program is on the attached atr file. But it appears when the program is run, the screen goes blank and there are pixelated artifacts flashing on the screen. Almost like the display list and or screen ram are in a location being used by another program. The flashing continues after I stop the program execution. But now there are characters flashing. I have to do a warm reset to get the display back to normal. I tried to keep it simple. So I'm currently being wasteful with RAM. But the exercise is to focus on creating the display list.

 

Any ideas? Thanks.

dlist.atr

Share this post


Link to post
Share on other sites

Still early in the book. But the author is trying to do some things starting in Basic. He assumes the readers will be familiar with it. And I assume later he will show it in Assembly. But I haven't gotten that far because I'm trying to get my display list working for the last day or two. I know there are Display list methods in FastBasic. But the author wants the reader to manually create the Display List because you'll need to do the same thing in Assembly.

Share this post


Link to post
Share on other sites
1 hour ago, gs80065xe said:

Still early in the book. But the author is trying to do some things starting in Basic. He assumes the readers will be familiar with it. And I assume later he will show it in Assembly. But I haven't gotten that far because I'm trying to get my display list working for the last day or two. I know there are Display list methods in FastBasic. But the author wants the reader to manually create the Display List because you'll need to do the same thing in Assembly.

which book ?

  • Like 1

Share this post


Link to post
Share on other sites

Some more information. This is running on latest Altirra using xl/Xe os and Basic roms. And Rambo 256k to simulate my real hardware. 
 

I rewrote the program with Atari basic. Same results. Except reset resulted in losing the program.

 

I noticed the exercise mentions it is more for the 400/800 and basic rev a which lacked an antic mode 14 graphics object. Changed Altirra to mimic an 800 with the Atari rev cart. Loaded the basic program and get a black screen without flickering. But Altirra crashed when I reset to exit the program.

Share this post


Link to post
Share on other sites

A number of things, your start of of screen memory may not be quite right for later calculation of the 4K LMS instruction,

I've listed below one that works, but I chose the place in memory for the screen myself, I put the display list in page 6, but you

could just reserve a space in front of the screen and put it there, I just did it this way for debugging as the other DL might

get corrupted when switching back to Graphics 0.

Also I think you only have 191 scan lines in your code.

 

You must always let the OS know what mode your in, that's what the POKE 87,14 does, without this in your code the OS thinks

your still in a character mode.

 

I don't use FB, so this is in Atari BASIC, should be easy to translate, hope this helps

 

10 REM GRAPHICS 0
20 DL=1536:REM PAGE 6 FOR DL
30 FOR I=0 TO 2:POKE DL+I,112:NEXT I
40 DL=DL+3
50 POKE DL,14+64
60 POKE DL+1,80
70 POKE DL+2,129:REM 
80 DL=DL+3
90 FOR I=0 TO 92
100 POKE DL+I,14
110 NEXT I
120 DL=DL+93
130 POKE DL,14+64
140 POKE DL+1,0
150 POKE DL+2,144
160 DL=DL+3
170 FOR I=0 TO 96
180 POKE DL+I,14
190 NEXT I
200 DL=DL+97
210 POKE DL,65
220 POKE DL+1,0
230 POKE 88,80:POKE 89,129
240 POKE 560,0:POKE 561,6
250 POKE 87,14
255 A=INT(RND(1)*256)
260 FOR I=33104 TO 33104+7680 STEP 2
270 POKE I,A
280 NEXT I
290 A=INT(RND(1)*256)
300 FOR I=33104+7680 TO 33104 STEP -3
310 POKE I,A
320 NEXT I
330 GOTO 330

 

 

Share this post


Link to post
Share on other sites

Hi!

10 hours ago, gs80065xe said:

Thanks. I found out why it was flickering. It only occurs if I have SpartaDOS X with TD ON. I turn it off and it works fine.

Your program has various problems:

 

1)  You are setting RAMTOP to an invalid value: The Atari OS can't handle any value in RAMTOP, it needs the ram to be in multiples of 4KB, so RAMTOP must be changed in increments of 16, otherwise the OS will be confused.

2)  You don't really need to set RAMTOP. As you are not using the OS to set the graphics mode, you don't really need to set RAMTOP. Just do:

DLP=PEEK(106)-33
SRP=PEEK(106)-32

This will initialize both the display-list pointer and the screen pointer to the correct locations.

3) The screen memory that you define crosses a 4KB boundary. This is because SRP is a multiple of 16, meaning that SRP*256 is exactly a multiple of 4096.

     You are setting line 0 to address "SRP*256", line 1 to "SRP*256+40", etc. up until line 95. Then, at line 96, you set the display memory to "(SRP+15)*256", just after the last line. This is correct, *but* 15*256 = 3840, just short of 4KB. So, line 102 will start at "SRP*256 + 4080" and wrap to "SRP*256 + 24".

     The correct way to address this is to calculate the starting address of graphics memory so that one line ends exactly at 4095, so the next one starts at 4096.

     This is easy, you just need to set SRP to one more than the current value.

 

Hope that makes sense.

 

Have Fun!

  • Like 1

Share this post


Link to post
Share on other sites
18 hours ago, dmsc said:

The correct way to address this is to calculate the starting address of graphics memory so that one line ends exactly at 4095, so the next one starts at 4096.

That's pretty much what my example above does :)

 

Share this post


Link to post
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...