; assume the code is stored in the variable called "CODE"
; use: call ProcessCode
ProcessCode:
banksel CODE
CASE_xxxx:
btfsc CODE,3
goto CASE_1xxx
CASE_0xxx:
btfsc CODE,2
goto CASE_01xx
CASE_00xx:
btfsc CODE,1
goto CASE_001x
CASE_000x:
btfsc CODE,0
goto CASE_0001
CASE_0000:
; do here what you want for code 0000
return
CASE_0001:
; do here what you want for code 0001
return
CASE_001x:
btfsc CODE,0
goto CASE_0011
CASE_0010:
; do here what you want for code 0010
return
CASE_0011:
; do here what you want for code 0011
return
CASE_01xx:
btfsc CODE,1
goto CASE_011x
CASE_010x:
btfsc CODE,0
goto CASE_0101
CASE_0100:
; do here what you want for code 0100
return
CASE_0101:
; do here what you want for code 0101
return
CASE_011x:
btfsc CODE,0
goto CASE_0111
CASE_0110:
; do here what you want for code 0110
return
CASE_0111:
; do here what you want for code 0111
return
CASE_1xxx:
btfsc CODE,2
goto CASE_11xx
CASE_10xx:
btfsc CODE,1
goto CASE_101x
CASE_100x:
btfsc CODE,0
goto CASE_1001
CASE_1000:
; do here what you want for code 1000
return
CASE_1001:
; do here what you want for code 1001
return
CASE_101x:
btfsc CODE,0
goto CASE_1011
CASE_1010:
; do here what you want for code 1010
return
CASE_1011:
; do here what you want for code 1011
return
CASE_11xx:
btfsc CODE,1
goto CASE_111x
CASE_110x:
btfsc CODE,0
goto CASE_1101
CASE_1100:
; do here what you want for code 1100
return
CASE_1101:
; do here what you want for code 1101
return
CASE_111x:
btfsc CODE,0
goto CASE_1111
CASE_1110:
; do here what you want for code 1110
return
CASE_1111:
; do here what you want for code 1111
return