Jump to content
IGNORED

Nested for loops


Karl G

Recommended Posts

I'm new to this forum and to batari BASIC. I have a question about nested for loops. The online manual seems to imply that they won't work because the next will jump to the closest previous for. However, I have seen posts in this forum indicating that people do have success with nested for loops. Here is the relevant bit of code:

   for temp = 0 to 7
      AUDV0 = 15
      AUDC0 = 8
      AUDF0 = temp
      temp5 = temp + 2
      for temp4 = 0 to temp5
         drawscreen
      next 
   next
The sound seems to be the same duration regardless of what value I assign to temp5, which makes me suspect that it's an issue with my nested for loops.

 

For those of you who have success with nested for oops, do you have any idea why this isn't working?

Edited by kdgarris
Link to comment
Share on other sites

I think temp7 is only used for bank switching so it's probably safe as long as you're not using multiple banks

if all you're doing is drawscreen I think the aux variables (at least some of them) should be safe (they're the bottom of the stack)

however they may be used by the kernel depending on the options

and of course var44..47

Link to comment
Share on other sites

  • 2 weeks later...

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...