Jump to content
IGNORED

Feature Requests for batari Basic


Random Terrain

Recommended Posts

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.

Link to comment
Share on other sites

  • 2 weeks later...

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.

Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

  • 1 year later...

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.

Link to comment
Share on other sites

  • 4 weeks later...

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.

  • Like 1
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...