Your version works but you can try this shorter version:
Code:
test btfsc PORTA,0 ; skip if portA,0 low
goto next1 ; is high, go to handling routine
btfsc PORTA,1
goto next2
btfsc PORTA,2
goto next3
btfsc PORTA,3
goto next4
goto test ;loop until switch closure
Electronics4you said:
It's used as a scanningcode for 4 micro-switches. How can I store the values in variables so I can use them later on?
Four tests, total 8 instructions. Difficult to make it faster. On a PIC with a 20MHz crystal, the loop would take just 2uS to go around once. A switch closure is more like several mS and that's several thousand times slower than you can check them.