STEPPER:
btfsc MOTOR_DIR1
incf COUNTER1,f
btfss MOTOR_DIR1
decf COUNTER1,f
;
movf COUNTER1,w
call GET_MOTOR_STATE
movwf TEMP_REG
swapf TEMP_REG,f
;
btfsc MOTOR_DIR2
incf COUNTER2,f
btfss MOTOR_DIR2
decf COUNTER2,f
;
movf COUNTER2,w
call GET_MOTOR_STATE
iorwf TEMP_REG,w
movwf PORTB
;
wait .100
decfsz STEP_COUNT,f
goto STEPPER
;
return
GET_MOTOR_STATE:
andlw b'00000111'
addwf PCL,F
retlw 0x8
retlw 0xA
retlw 0x2
retlw 0x6
retlw 0x4
retlw 0x5
retlw 0x1
retlw 0x9