10 ; Set initial state CYCLE: ; Define the label CYCLE test i 1 ; Test input bit 379h:6 (Pin 10) callz LEFT ; Call if tested bit is zero callnz RIGHT ; Call if tested bit is not zero nop goto CYCLE ; Goto the CYCLE label sub LEFT shift -1 ; Rotate state unclockwise ret sub RIGHT shift +1 ; Rotate state clockwise ret