+Random Terrain Posted October 14, 2008 Share Posted October 14, 2008 Automatic splitting of one variable into two nybble variables Do you think batari Basic could ever include a way to automatically split a variable in half by using some kind of symbol or symbols that would tell bB that you want to use one variable as two? There are many times when I don't need a variable to go higher than 15, so maybe dim could be used to tell bB that you want to split a variable so both halves will only contain values of 0 through 15. For example, fixed point variables are set up like this: dim monsterx = d.r So maybe in a semi-similar way, a symbol could be used to tell bB that you want to split a variable in half. Here's one possibility: dim monstercounter = a< That would make monstercounter the low nybble of a. And the following would make playercounter the high nybble of a: dim playercounter = a> You might want to use different symbols or go about it in a different way, but whatever you could come up would be a big help. SeaGtGruff's example is useful and works great, but it can make the code hard to figure out later, even with comments. And I've screwed up the conversion more than a few times and it never seems to get easier. If bB could allow us to use nybble variables as if they were regular variables, any confusion would be eliminated and the code would be easier to understand. Thanks. Quote Link to comment Share on other sites More sharing options...
+batari Posted October 27, 2008 Share Posted October 27, 2008 I will look into it. I'm not sure how difficult it would be. I suppose that depends on what programmers would expect to do with 4-bit variables. Anyway, you can do this now using &, |, * and /. & and | are useful to "mask" bits, while * and / by powers of two do bit shifts. If 4-bit variables are implemented into bB, these operations are what will take place under the hood. Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted October 27, 2008 Author Share Posted October 27, 2008 I will look into it. I'm not sure how difficult it would be. I suppose that depends on what programmers would expect to do with 4-bit variables. Anyway, you can do this now using &, |, * and /. & and | are useful to "mask" bits, while * and / by powers of two do bit shifts. If 4-bit variables are implemented into bB, these operations are what will take place under the hood. Yep, as I said, SeaGtGruff's example is useful and works great, but it can make the code hard to figure out later, even with comments. And I've screwed up the conversion more than a few times and it never seems to get easier. If bB could allow us to use nybble variables as if they were regular variables, any confusion would be eliminated and the code would be easier to understand. If it's possible to have bB do the calculations for us, it would be less confusing since we could just use 4-bit variables like any other variable. Bit operations are nice for flags, but there are a lot of times when you need more, but you don't need the whole variable. That's where 4-bit variables will come in handy. I'm working on 3 programs right now and there are many variables in all three programs that don't need to contain a value over 15. It's a waste to use a whole variable for them, and the one program I converted using SeaGtGruff's example works fine, but the code has become so confusing to look at that, even with comments, that it has become almost impossible to continue work on it. If you can fix it so 4-bit variables can be as easy to use as regular variables, I bet I won't be the only one doing a happy dance. 1 Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted March 26, 2010 Author Share Posted March 26, 2010 Just saw this thread while looking for something else. I hope the next version of batari Basic will have easy-to-use nybble variables (4-bit variables). The variables that bB users choose to use as nybble variables would work like normal variables, except they'd be limited to 15. Best part is that bB users wouldn't have to deal with the math. Quote Link to comment Share on other sites More sharing options...
Pioneer4x4 Posted March 26, 2010 Share Posted March 26, 2010 My "Did I bite off more than I can chew?" first project could use this feature as well! Heck I could use 2 bit variables to clean up what I need to do! Quote Link to comment Share on other sites More sharing options...
SeaGtGruff Posted March 27, 2010 Share Posted March 27, 2010 The def and macro commands might help with that. Michael Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted March 27, 2010 Author Share Posted March 27, 2010 The def and macro commands might help with that. Thanks. Can you explain what you mean? I don't believe I know how that works. Quote Link to comment Share on other sites More sharing options...
jrok Posted April 21, 2010 Share Posted April 21, 2010 It would be great if there were a way to define the color rows for the P0 sprite (in exchange for M0) without doing so for P1 as well. Having a multicolor sprite take display priority without losing both missile objects would be helpful in certain types of games. Cheers, Jarod. 1 Quote Link to comment Share on other sites More sharing options...
yuppicide Posted April 23, 2010 Share Posted April 23, 2010 AtariVox support built in without me having to figure out things on my own since I'm not an ASM guy. Quote Link to comment 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.