bB feature request.

Recommended Posts

Hey all,

I've been busy lately... Been toying with Bb some recently. Lots of changes.

A quick answer to 2600land's movement question prompted me to post this now before it slips again.

It would be really handy to be able to push one var onto the stack, then pull it again. Of course this can be done with a temp, but I think less overall code would be used with a push [var], pull [var] instruction set. It's also very intuitive.

a = x + 30

[some logic]

push a

a = a / 2

player1xpos = a + 30 : player0xpos = a + 60

pull a

[more logic]

Assume the stack is one level deep. (Which is all that is needed) Whatever is in the stack would be put into whatever var is named.

push a

a = a + 20

pull t : pull v

Is this a savings over the usual temp approach? I kind of like it because it's more assembly like, IMHO. (Which is what bB is supposed to be about right?)

I don't expect a response to this anytime soon. Just wanted to post it here for Batari when he once again sees fit to hack on bB. Maybe it's crap, maybe it's a good idea, but it's not forgotten this time!

Share on other sites

It would be really handy to be able to push one var onto the stack, then pull it again. Of course this can be done with a temp, but I think less overall code would be used with a push [var], pull [var] instruction set. It's also very intuitive.

a = x + 30

[some logic]

push a

a = a / 2

player1xpos = a + 30 : player0xpos = a + 60

pull a

[more logic]

bB supports complex equations now so the temp var approach isn't strictly necessary. For example, you could just do this:

player1xpos = a/2+30

That's not to say a stack wouldn't be useful for something. It would be very easy to implement, so it's probably worth adding if someone will find it useful.

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.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.