Pioneer4x4 Posted November 30, 2011 Share Posted November 30, 2011 I want to change if my R.O.B. program uses Joysticks or Keyboard/Kids/Touchpad/Keypad controllers based on difficulty switches. One of my pet peeves is not knowing how they should be used, especially when different systems have different labels on them. So what I decided is if they are the same, use Joystick, if they are different, use keyboard. I will probably make switches un-needed anyway, but I wanted to ask about this code. It seems I cannot use this code (or any variant I can come up with). if switchrightb = switchleftb then (goto routine) --- Unresolved Symbol List 0.switchleftb 0000 ???? (R ) but if I do this if switchleftb then if !switchrightb then (goto routine) if !switchleftb then if switchrightb then (goto routine) It compiles and works. I am ok, just curious if I missed somthing in the documentation. Quote Link to comment Share on other sites More sharing options...
jbs30000 Posted December 1, 2011 Share Posted December 1, 2011 Just a guess, but I'm guessing that switchleftb and switchrightb are bits, or at least they're acting like working with bits. What I mean is, you can't go if a{1}=b{1} for example, but you can go if a{1} then if !b{1}. Quote Link to comment Share on other sites More sharing options...
Pioneer4x4 Posted December 1, 2011 Author Share Posted December 1, 2011 I guess that is what is happening. And that is what I did to get around it. (I had to check each way). Quote Link to comment Share on other sites More sharing options...
RevEng Posted December 1, 2011 Share Posted December 1, 2011 switchleftb and switchrightb aren't real variables, even though they look like they are. When bB sees them in a simple if-then command, it creates some conditional logic that tests bits in the 2600 SWCHB hardware register. But if you try to use them in other ways bB doesn't even try to catch it, and your code winds up referencing them as variables that don't exist. If you want to check if both difficulty switches are the same, you can check the top two bits of SWCHB yourself. Something like the following should work... temp1=SWCHB&%11000000 if temp1=%11000000 || temp1=%00000000 then (goto routine) Quote Link to comment Share on other sites More sharing options...
Pioneer4x4 Posted December 1, 2011 Author Share Posted December 1, 2011 switchleftb and switchrightb aren't real variables, even though they look like they are. When bB sees them in a simple if-then command, it creates some conditional logic that tests bits in the 2600 SWCHB hardware register. But if you try to use them in other ways bB doesn't even try to catch it, and your code winds up referencing them as variables that don't exist. If you want to check if both difficulty switches are the same, you can check the top two bits of SWCHB yourself. Something like the following should work... temp1=SWCHB&%11000000 if temp1=%11000000 || temp1=%00000000 then (goto routine) Sounds good, thanks. I may try that if I clean it up for extra space. I'm down to about 200 bytes and it doesn't do much other than flash and update playfields (But it does work!) Quote Link to comment Share on other sites More sharing options...
bogax Posted December 4, 2011 Share Posted December 4, 2011 Similar thread http://www.atariage....-are-different/ 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.