Branch to one of several specified labels, depending on the value of a variable.
ON var [GOTO] [GOSUB] label1 [, label2 ]
The numeric variable to test.
This can also be a SFR such as P1.
The labels to jump to depending on the value of var.
Note that the value is zero based. So when var = 0, the first specified label is jumped/branched.
Dim X As Byte
X = 2 'assign a variable interrupt
On X Gosub Lbl1 , Lbl2 , Lbl3 'jump to label lbl3
X = 0
On X Goto Lbl1 , Lbl2 , Lbl3
'nop is an ASM statement that does nothing