Jump to content
IGNORED

Arguments not working for stack or bit assignment


wallaby

Recommended Posts

23 hours ago, Karl G said:

I don't know of many people who have said they used the stack feature, and it can easily be ignored if you don't have a specific use for it. 

 

I just added this to the bB page:

 

"The DPC+ stack is for advanced users. You could make a finished game without even knowing that the stack exists. If you are new to batari Basic or consider yourself to be a novice programmer, you might want to avoid the DPC+ stack."

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

When I first read about it I thought it was neat and I started to imagine what I could do with it. But then I realized one important detail - I wasn't there yet. I needed to work on a lot of the fundamentals before I even looked at the stack.

 

It took me months before I had even looked at some of the more advanced features. I would practice using different code in different scenarios to see how things work and the best resource are the hundreds of posts on the Atariage forum that may address partsbor all of your questions.

  • Like 1
Link to comment
Share on other sites

You've allready pushed color values to the display RAM, the stack works the same way, here's an easy example..

 

You know how temp1-temp6 doesn't save the values between frames, because they are used when you call drawscreen,

well you can push the values they contain to the stack, right before drawscreen

 stack 6  ; points to the sixth position in the stack (will start pushing to 5)

 push temp1 temp2 temp3 temp4 temp5 temp6  ; stores temp1 into stack position 5, temp2 into 4.... temp6 into 0

 

and pull the values from the stack back into the variables right after drawscreen

 stack 0  ; points to the first position in the stack

 pull temp1 temp2 temp3 temp4 temp5 temp6  ; stores stack position 0 into temp6, 1 into temp5.... 5 into temp1

 

Now you can use those temp variables like regular variables.

 

If you only use it like that you don't need to set the stack pointer in the mainloop since it will be at 0 after the pushes,

and at 6 after the pulls, so you just need to set it to 6 before the mainloop.

 

 stack 6

 

I think it would be a little more intuitive if you had to write the variables in the reverse order when pulling

pull temp6 temp5 temp4 temp3 temp2 temp1

but bB flips it for you instead.

Edited by Lillapojkenpåön
  • Like 3
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...