Jump to content
Junosix

Can I improve how I store my playfield data?

Recommended Posts

Been working on my first bit of 2600 code which I'm quite happy with, managed to get it going without asking any questions so far. It's actually at a state where I can start designing levels and a proper game around it, but I just wanted to ask a couple of questions before I plough ahead.

 

I've attached my code to this post. You'll see that I build the level using a sort of tile map method, and that map is near the end of the code, labelled "pfmapleft" and "pfmapright". Due to the way I've got the sprite jumping, my collision routine depends on a platform being at least a height of 4-scanlines (it's a two-scanline kernel), so I have to double up the data for each platform (should be pretty clear what I mean if you look at the code). So what I'd like to do is not have to do that doubling-up on the data and just refresh from the tile map every other read. My way of thinking is that I would use the data from the Y register (which I use for counting down through the scanlines), and divide it by two, but I just can't find a way to get enough cycles free to do that. I've even done away with STA WSYNC to try to claim as many cycles as I can (there are a few free though, but they're scattered separately throughout the kernel).

 

Do you think it's possible?

 

Ignore what's going on in the vertical blank routine, there's a load of tidying up to do and logic to add. The display kernel is what I'm concerned about at the moment

 

Does that make any sense? I hope it does :)

 

EDIT - I also thought about using a 4-scanline kernel, but that would complicate the resolution of the sprite movement, I think.

wicked.zip

post-4529-128868061084_thumb.png

Edited by Junosix

Share this post


Link to post
Share on other sites

Oops, sorry, was playing wannabe VCS programmer and discovered I didn't know what the frak I was talking about. Nothing to see here. Move on...

Edited by tetrode kink

Share this post


Link to post
Share on other sites

You can free some cycles with the illegal opcode LAX. Instead of:

 

LDA (something),Y ; 5+ cycles

TAX ; 2 cycles

 

 

You can simply go:

 

LAX (something),Y ; 5+ cycles

 

 

With you index it might be simple to use INY and DEY as needed in the loop. You would have 8 free cycles already by using LAX, and the 2 NOP's I say. Alternatively you might simply do something like:

 

 

TYA

LSR

TAY

 

To divide Y by 2. Anyhow I'm sure you'll find a few solutions.

Share this post


Link to post
Share on other sites
:idea: You could do a 2 line kernel and fine tune the vertical sprite positioning by using e.g. VDELP0. But that requires that you update the opposite sprite (GRP1) each scanline (too).

Share this post


Link to post
Share on other sites

Thanks for the replies!

 

Funnily enough I was thinking about how VDELP0 could be used for doing it over a 4-scanline kernel, and that wouldn't be a problem as I'm only using GRP0 anyway. But I'm thinking about just using illegal opcodes to reserve cycles for other things. For purity, I was trying to avoid using illegal opcodes, but thinking through I realise I could do lots of tasty stuff if I use them (there are other points in the code where they'd be handy, there's at least one I know of that can be used in skipdraw). The game's main element is rising water so I think I might even have enough time left over to change the colour of PF/GRP depending on whether they're submerged or not.

 

I shall have a play and report back :)

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