Jump to content
IGNORED

playfield memory pointers


jbs30000

Recommended Posts

I use to know how to do this, but not only have I forgotten, but using the search function doesn't help me much either.

What I would like to know is how to manually set the playfield pointers in a basic 32x12 playfield.

 

I thought that there was something like a playfield hi and playfield lo pointer, but I can't find them. I did it in a multisprite game I was working on, but deleted it, whoops.

 

Looking at a list file, I see where I put playfield it has a PF_data0 label and then after the data it puts:

lda PF_data0,x

sta playfield,x

 

So maybe that's it? Just store the data label into the playfield variable?

 

Thanks in advance.

Link to comment
Share on other sites

What I would like to know is how to manually set the playfield pointers in a basic 32x12 playfield.

Are you trying to do this with the standard kernel or the multisprite kernel?

 

The standard kernel uses the following code (found in 2600basic.h) to define the start of the playfield:

 

  ifconst superchip
playfieldbase = $10D0
 else
playfieldbase = $A4
 endif

; define playfield start based on height
 ifnconst pfres
playfield = playfieldbase
 else
playfield = playfieldbase-(pfres-12)*4
 endif

It's contingent upon two factors-- whether or not the Superchip option is being used, and whether or not the pfres option is being used.

 

If the Superchip is being used, the playfield will be located in the Superchip RAM area, otherwise it will be located in the RIOT RAM (i.e., page zero RAM).

 

If the pfres option is being used, the address of the playfield will be adjusted based on the pfres setting.

 

In any event, the playfield address will be defined as a static constant, so it can't be changed on the fly in the program without reworking the kernel (I think).

 

The multisprite kernel works differently, since the playfield isn't located at a static address, but is instead pointed to by two pointers, as defined in the following code (found in multisprite.h):

 

playfield = $BB
PF1pointer = $BB

PF2pointer = $BD

The two pointers have a lo byte and a hi byte, so PF1pointer will be $BB (lo byte) and $BC (hi byte), while PF2pointer will be $BD (lo byte) and $BE (hi byte). Note that the multisprite playfield is reflected and symmetrical, rather than asymmetrical, so you define the data for the left half, and the right half is always a reflection of it.

 

Michael

Link to comment
Share on other sites

I'm talking strictly standard kernel, no superchip or pfres.

 

OK, I think I have it figured out then.

 

Oh, and searching for playfieldbase brought up a post where you helped me with this before.

Without the Superchip:

 

pfres = 1, playfield = $D0 through $D3

pfres = 2, playfield = $CC through $D3

pfres = 3, playfield = $C8 through $D3

etc.

 

With the Superchip:

 

pfres = 1, playfield = $10FC through $10FF

pfres = 2, playfield = $10F8 through $10FF

pfres = 3, playfield = $10F4 through $10FF

etc.

 

Notice that the number of bytes used by the playfield is 4 times pfres, and the last row is always in the same place-- either $D0 through $D3 (without the Superchip), or $10FC through $10FF (with the Superchip). The start of the first row will move depending on pfres.

Thanks again, and I'm going to make sure to print this info out so I don't forget about it in the future.

Link to comment
Share on other sites

I'm talking strictly standard kernel, no superchip or pfres.

 

OK, I think I have it figured out then.

 

Oh, and searching for playfieldbase brought up a post where you helped me with this before.

As long as you're going to use a single (unchanging) ROM playfield, you can remove those lines of code at the end of 2600basic.h, then set playfield to the address of your ROM playfield inside your program. (I don't think you need playfieldbase-- it's just used in calculating the start of the playfield; so if you already know what the address of the playfield will be, you can skip the calculation step.) But you can't change it to point to a different ROM playfield later in the same program-- i.e., you get one playfield, and it can never change.

 

Michael

Link to comment
Share on other sites

Wait, I'm confused. I thought that in the standard kernel the playfield was held in ram.

I thought that the bB statement playfield followed by drawing the playfield with dots and X's translated to data statements in the asm file and that the data was copied into the playfield ram.

Link to comment
Share on other sites

Wait, I'm confused. I thought that in the standard kernel the playfield was held in ram.

I thought that the bB statement playfield followed by drawing the playfield with dots and X's translated to data statements in the asm file and that the data was copied into the playfield ram.

Yes, that is correct. But I'm confused about what you're trying to do, because your original post was asking how to set the playfield pointer manually. If you're going to use a RAM playfield, there's no playfield pointer for you to change, because the standard kernel doesn't use a playfield pointer, it uses a direct address (either a one-byte zero-page address or a two-byte absolute address).

 

As for changing the playfield address (as opposed to the playfield pointer), there are only two reasons I can see for wanting to manually change the playfield address: (1) To point it to a ROM playfield instead of having the playfield be stored in RAM, or (2) to relocate the RAM playfield to some other area of memory (such as if you've modified batari Basic to use a bankswitching with extra RAM in a location other than where the Superchip RAM is located).

 

Michael

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