Jump to content
IGNORED

Playfield Bytes As Variables?


MausGames

Recommended Posts

"If you do run out of variables, you can use four bytes from the playfield if you're not scrolling it"

This is from the bB 1.0 manual; Can anyone explain what it means? I always run out of variables, and four more would help some.

 

Anyone have any other tips on how to get more than the standard 26? I'm using the standard kernel, with pfheights as the only option.

Edited by MausGames
Link to comment
Share on other sites

You can use some of the temp variables. I think it's temp2,3,4, if you are not scrolling.

 

 

How are you using the standard 26?

 

Are some of them holding smaller values?

 

If so, you can pack things in to get better use of the standard ones.

 

One real savings is true / false variables. So you use a whole 8 bit variable to indicate something is either gonna happen or not. Well, that can be done with just one bit of that variable, turning it into 8 true / false variables. Go and look through the manual for the bit operators. You can test, set and reset individual bits.

 

Another pretty good savings is breaking a variable into two. So, you've got some values that range from 0 to 15. That's 4 bits. You can pack two of those values into one 8 bit variable as well.

 

Finally, go through and look hard at your variable usage. Are there things that you could double up on, such as counters?

 

Maybe one variable would actually work, if you change the logic a bit.

Link to comment
Share on other sites

Another pretty good savings is breaking a variable into two. So, you've got some values that range from 0 to 15. That's 4 bits. You can pack two of those values into one 8 bit variable as well.

 

There are many times when I use variables to always hold values of 15 or less, so that would be useful. Not sure how to implement that though.

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