Jump to content
IGNORED

comparing switches


Pioneer4x4

Recommended Posts

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.

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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!)

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