OK, by looking at the structure, I understand what is supposed to happen except for the "MaskSwitch = porta & $7". What is actually happening with the & and $7? Is it a directive for the chip? I'm using a PIC16F627.

I modified the pgm to match the requirements of my particular setup and the program is compiling but when I start the program, all the LEDs turn on and stay on.
I really hate to be a pest. No really :-)

Here's what I have:

'Chip Registers

CMCON = 7 'disable comparators
TRISA = %11111111 'PortA inputs
TRISB = %00000000 'Portb outputs

'Declare and init vars

sw0 var porta.0
sw1 var porta.1
sw2 var porta.2
sw3 var porta.3

led0 var portb.0
led1 var portb.1
led2 var portb.2
led3 var portb.3

MaskSwitch var byte
MaskSwitch = porta & $7

'Set all leds low
portb = %00000000

Select Case Maskswitch
case 0
sw0 = 1
gosub sw0_proc
case 1
sw1 = 1
gosub sw1_proc
case 2
sw2 = 1
gosub sw2_proc
case 3
sw3 = 1
gosub sw3_proc
End select

sw0_proc:
LED0 = 1
sw1_proc:
led1 = 1
sw2_proc:
led2 = 1
sw3_proc:
led3 = 1
end