+Karl G Posted October 30, 2016 Share Posted October 30, 2016 (edited) 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 October 30, 2016 by kdgarris Quote Link to comment Share on other sites More sharing options...
bogax Posted October 30, 2016 Share Posted October 30, 2016 the kernel uses temp4, temp5 they won't survive drawscreen 2 Quote Link to comment Share on other sites More sharing options...
+Karl G Posted October 30, 2016 Author Share Posted October 30, 2016 the kernel uses temp4, temp5 they won't survive drawscreen Okay; that explains it. Thanks! Are there any tempX variables that are not blown away by drawscreen? I'm using the standard kernel, btw. Quote Link to comment Share on other sites More sharing options...
+Karl G Posted October 30, 2016 Author Share Posted October 30, 2016 I found the answer to my own second question. Since I'm not scrolling the playfield, I can use var44 through var47 as temp variables. Quote Link to comment Share on other sites More sharing options...
bogax Posted October 31, 2016 Share Posted October 31, 2016 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 Quote Link to comment Share on other sites More sharing options...
+Gemintronic Posted November 14, 2016 Share Posted November 14, 2016 When I re-purpose var44-47 I usually reduce my playfield resolution. If I don't do that I can sometimes see the bottom row bugging out and flickering playfield pixels. const pfres=8 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.