+atari2600land Posted December 9, 2006 Share Posted December 9, 2006 I've read the section in the help file about variables and for some reason I still can't use c{0}. For example, if I put if c{0}=0 then...(more code) a message will come up saying "Error: unknown keyword=0." Sometimes I use a variable different for what the dim at the beginning says, but if I can get c{0} - c{7} to work, I can free up more variables! I used c because it's a constant all throughout my code (and it's always either 0 or 1.) help! gosub120806a.bas Quote Link to comment https://forums.atariage.com/topic/98299-question-on-lsbs/ Share on other sites More sharing options...
SeaGtGruff Posted December 9, 2006 Share Posted December 9, 2006 I've read the section in the help file about variables and for some reason I still can't use c{0}. For example, if I put if c{0}=0 then...(more code) a message will come up saying "Error: unknown keyword=0." Sometimes I use a variable different for what the dim at the beginning says, but if I can get c{0} - c{7} to work, I can free up more variables! I used c because it's a constant all throughout my code (and it's always either 0 or 1.) help! The bit operations don't work that way in the if statement. To *check* a bit, you use if c{0} then ... to see if the bit is on (i.e., equal to 1), and you use if !c{0} then ... to see if the bit is off (i.e., equal to 0). On the other hand, if you want to *set* a bit to 1 or 0, you use c{0} = 1 : rem * set the bit to 1 c{0} = 0 : rem * set the bit to 0 Michael Quote Link to comment https://forums.atariage.com/topic/98299-question-on-lsbs/#findComment-1191426 Share on other sites More sharing options...
+atari2600land Posted December 9, 2006 Author Share Posted December 9, 2006 Thanks for clearing that up for me. Quote Link to comment https://forums.atariage.com/topic/98299-question-on-lsbs/#findComment-1191700 Share on other sites More sharing options...
SeaGtGruff Posted December 9, 2006 Share Posted December 9, 2006 Thanks for clearing that up for me. You're welcome. I had the same problem when I tried to use the bit operations in if statements. In fact, don't some of the examples in the documentation/help guides show it being used that way (the wrong way)? I might be mistaken about that, though. Michael Quote Link to comment https://forums.atariage.com/topic/98299-question-on-lsbs/#findComment-1191801 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.