Jump to content

Recommended Posts

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

Link to comment
https://forums.atariage.com/topic/98299-question-on-lsbs/
Share on other sites

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

Link to comment
https://forums.atariage.com/topic/98299-question-on-lsbs/#findComment-1191426
Share on other sites

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

Link to comment
https://forums.atariage.com/topic/98299-question-on-lsbs/#findComment-1191801
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...