MausGames Posted March 3, 2008 Share Posted March 3, 2008 (edited) "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 March 3, 2008 by MausGames Quote Link to comment https://forums.atariage.com/topic/122244-playfield-bytes-as-variables/ Share on other sites More sharing options...
potatohead Posted March 3, 2008 Share Posted March 3, 2008 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. Quote Link to comment https://forums.atariage.com/topic/122244-playfield-bytes-as-variables/#findComment-1476597 Share on other sites More sharing options...
s0c7 Posted March 3, 2008 Share Posted March 3, 2008 The more you decrease the resolution of the playfield, the more variables you get back. In Cold War, I set pfres to 9 which gave me var0 through var11. Quote Link to comment https://forums.atariage.com/topic/122244-playfield-bytes-as-variables/#findComment-1476600 Share on other sites More sharing options...
MausGames Posted March 4, 2008 Author Share Posted March 4, 2008 The more you decrease the resolution of the playfield, the more variables you get back. In Cold War, I set pfres to 9 which gave me var0 through var11. That explains it, thank you. Quote Link to comment https://forums.atariage.com/topic/122244-playfield-bytes-as-variables/#findComment-1476856 Share on other sites More sharing options...
MausGames Posted March 4, 2008 Author Share Posted March 4, 2008 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. Quote Link to comment https://forums.atariage.com/topic/122244-playfield-bytes-as-variables/#findComment-1476859 Share on other sites More sharing options...
Recommended Posts
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.