XC-BASIC icon indicating copy to clipboard operation
XC-BASIC copied to clipboard

ON BIT GOTO/GOSUB

Open neilsf opened this issue 4 years ago • 1 comments

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 avatar Mar 16 '20 07:03 neilsf

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

neilsf avatar Mar 17 '20 06:03 neilsf