neilsf / XC-BASIC

A compiling BASIC dialect for the Commodore-64
https://xc-basic.net/
MIT License
74 stars 15 forks source link

ON BIT GOTO/GOSUB #101

Open neilsf opened 4 years ago

neilsf commented 4 years ago

Idea: ON .. GOTO/GOSUB should support situations where we want to check if individual bits are set and jump to the Nth label when the Nth bit is set. for example:

ON BIT %00000001 GOTO label0, label1, label2 ...

would jump to label0 whereas

ON BIT %00000100 GOTO label0, label1, label2 ...

would jump to label2.

Not sure what happens if more than one bits are set, I guess bit checking would stop at the first match (the least significant bit that's set).

neilsf commented 4 years ago

Edit: ON BIT 0 GOTO label0, label1 ... should jump to the label0 whereas ON BIT %00000001 GOTO label0, label1... to label1, etc..