STEPPER_MOTOR IN Emu8086

Source Code

#START=STEPPER_MOTOR.EXE#

NAME "STEPPER"

#MAKE_BIN#

STEPS_BEFORE_DIRECTION_CHANGE = 20H 

JMP START

DATCW    DB 0000_0110B

         DB 0000_0100B    

         DB 0000_0011B

         DB 0000_0010B

DATCCW   DB 0000_0011B

         DB 0000_0001B    

         DB 0000_0110B

         DB 0000_0010B

DATCW_FS DB 0000_0001B

         DB 0000_0011B    

         DB 0000_0110B

         DB 0000_0000B

DATCCW_FS DB 0000_0100B

          DB 0000_0110B    

          DB 0000_0011B

          DB 0000_0000B

START:

MOV BX, OFFSET DATCW 

MOV SI, 0

MOV CX, 0 

NEXT_STEP:

WAIT:   IN AL, 7     

        TEST AL, 10000000B

        JZ WAIT

MOV AL, [BX][SI]

OUT 7, AL

INC SI

CMP SI, 4

JB NEXT_STEP

MOV SI, 0

INC CX

CMP CX, STEPS_BEFORE_DIRECTION_CHANGE

JB  NEXT_STEP

MOV CX, 0

ADD BX, 4 

CMP BX, OFFSET DATCCW_FS

JBE NEXT_STEP

MOV BX, OFFSET DATCW 

JMP NEXT_STEP 

Result












Post a Comment

0 Comments