I need to check which button has been pressed and compare it with a function. For example if button 0($01) is pressed, the program will compare it with the OP, 3, and if both conditions are true, the program will start again (init), otherwise if one of the conditions is false the program will loop through the subroutine again. At the moment It doesn't do anything, it should compare the button press, but it seems not to. So far I have done this:
;$01 == XOR button, $02 == NOR button, $04 == OR button, $08 == NAND button, $10 == AND button
button_pressed:
in temp2, PIND
xor_pressed:
cpi OP,3
cpi temp2, $01
brne button_pressed
rjmp init
nor_pressed:
cpi OP,4
cpi temp2,$02
brne button_pressed
rjmp init
or_pressed:
cpi OP,0
;cpi temp2,$04
brne button_pressed
rjmp init
nand_pressed:
cpi OP,2
cpi temp2,$08
brne button_pressed
rjmp init
and_pressed:
cpi OP,1
cpi temp2,$10
brne button_pressed
rjmp init