This is FAQ (Frequently Asked Questions) for the µCL project.
if clockwise state := (state + 1) & 3 else state := (state - 1) & 3generates:
btfsc clockwise___byte, clockwise___bit incf state,w btfss clockwise___byte, clockwise___bit decf state,w andlw 3 movwf stateThere is always room for improvement though.