I am quite new to assembly programming and I am trying to create a switch statement. I was using the Microchips example but it does not seem to work in my simulation. Here is my code. It supposed to go to label2 but it skips all the conditions. Any help will be appreciated
Mod: wrapped your code in General Code insert.
Mod: wrapped your code in General Code insert.
Code:
MAIN
MOVLW 0X01
MOVWF CASE1
MOVLW 0X02
MOVWF CASE2
MOVLW 0X03
MOVWF CASE3
MOVLW 0X02
MOVWF SWITCH
START
movf SWITCH, W
xorlw CASE1
btfsc STATUS, Z ; If SWITCH = CASE1, jump to LABEL1
goto LABEL1
movf SWITCH, W
xorlw CASE2
btfsc STATUS, Z ; If SWITCH = CASE2, jump to LABEL2
goto LABEL2
movf SWITCH, W
xorlw CASE3
btfsc STATUS, Z ; If SWITCH = CASE3, jump to LABEL3
goto LABEL3
LABEL1
NOP
NOP
NOP
GOTO START
LABEL2
NOP
NOP
NOP
GOTO START
LABEL3
NOP
NOP
NOP
GOTO START