Jump to content
IGNORED

BACKGRND ?


fultonbot

Recommended Posts

I don't see BACKGRND mentioned in the Atari 7800 Basic Guide.
I'm trying to figure out how ofnten it can be used to update the background color, or what needs to be done to make the background color chage.

I know this seems simple, but I can't find any info. 

Link to comment
Share on other sites

You're right, that is an odd omission. Fortunately you can just write a colour value to BACKGRND as you would on the 2600 and it will work. (You can't read the value back from BACKGRND so if you ever want your code to know what it is, it can be a good idea to store the background colour you want in a variable and then copy it when you want to).

 

As for how often it can be changed, the answer is as quickly as you can change it. The below example is the smallest loop you can have to rapidly change the background colour and the results as shown in both A7800 (first screenshot) and Bupsystem (second screenshot) with Bupsystem being the more accurate. Unless you're changing the background mid-screen you don't need to worry about the difference though.

	a=0
mainLoop
	BACKGRND=a
	a=a+1
	goto mainLoop

2129434034_A7800BACKGRND.thumb.png.9da56604c14cd6fba456e62513071ffb.png

641451151_BupsystemBACKGRND.thumb.png.9b320fe386856e34d576adcae0684738.png

  • Like 2
Link to comment
Share on other sites

	LDX	#0
.deathLoop:
	STX	BACKGND
	INX
	JMP	.deathLoop

 

I believe that is as fast as you can go, can't remember, if CLC/BCC is faster than JMP right now.

 

EDIT: Of course you could remove the LDX #0 as well, as we don't care where the color starts.

  • Like 1
Link to comment
Share on other sites

1 hour ago, SmittyB said:

You're right, that is an odd omission. Fortunately you can just write a colour value to BACKGRND as you would on the 2600 and it will work. (You can't read the value back from BACKGRND so if you ever want your code to know what it is, it can be a good idea to store the background colour you want in a variable and then copy it when you want to).

 

As for how often it can be changed, the answer is as quickly as you can change it. The below example is the smallest loop you can have to rapidly change the background colour and the results as shown in both A7800 (first screenshot) and Bupsystem (second screenshot) with Bupsystem being the more accurate. Unless you're changing the background mid-screen you don't need to worry about the difference though.


	a=0
mainLoop
	BACKGRND=a
	a=a+1
	goto mainLoop

 

 

 

Perfect, this solves it.
It does make me want to start using some in-line assembly though.

Link to comment
Share on other sites

Definitely BACKGRND is an omission. Will need to update the docs. :thumbsup:

 

One thing to note, is that a loop like that is only really warranted when you want to do 2600 style colorbars or have more than 3 different color areas in your game. It has a huge cost in terms of the cycles available to your game.

 

To change the colors 2 or 3 times mid-screen you can use the interrupts, as demonstrated in the "splitmodedemo*" samples.

Link to comment
Share on other sites

2 hours ago, RevEng said:

Definitely BACKGRND is an omission. Will need to update the docs. :thumbsup:

 

One thing to note, is that a loop like that is only really warranted when you want to do 2600 style colorbars or have more than 3 different color areas in your game. It has a huge cost in terms of the cycles available to your game.

 

To change the colors 2 or 3 times mid-screen you can use the interrupts, as demonstrated in the "splitmodedemo*" samples.


Is this a way to get more than 23 colors on the screen?
when I finally get my basic games done, I'll look at some more elaborate stuff like this.

 

Link to comment
Share on other sites

Changing the background color for each zone isn't presently supported. If you change the colors using the previous colorbar method, I fear you'll find the result disappointing - if there is moderate-to-heavy number of objects on the screen, the colors will sometimes be pushed a line or two down for some frames.

 

For various reasons, giving the program full access to the interrupts for color changes (which requires tight timing) means I can't use them reliably for other purposes. (visible screen flagging, scrolling, non-dma device communication, etc.)

 

  • Like 1
Link to comment
Share on other sites

5 hours ago, RevEng said:

Changing the background color for each zone isn't presently supported. If you change the colors using the previous colorbar method, I fear you'll find the result disappointing - if there is moderate-to-heavy number of objects on the screen, the colors will sometimes be pushed a line or two down for some frames.

 

For various reasons, giving the program full access to the interrupts for color changes (which requires tight timing) means I can't use them reliably for other purposes. (visible screen flagging, scrolling, non-dma device communication, etc.)

 

My goal right now is to be creative within the confines of what you have created. 

  • Like 2
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...