Since you defined switch and lamp as a bit variable, they will simply report what is in them or be set to what you set them to... For output things like lamp. That is easy. You should use the CON instead of defining them as variables...
But I don't think this works for input. There are some other hacks I have seen, using the LookUp command... Something like:
Code:
switch con 0
lamp con p2
switchval var bit
main:
lookup switch, [in0, in1, in2, in3, in4, in5], switchval
if switchval then
low lamp
else
high lamp
endif
goto main
Obviously this does not make sense to do in a fixed case, but this can be useful, if the switch pin is passed to a subroutine...
Kurt