code segment
assume cs:code,ds:code
org 100h
start: jmp begin
table db 05h,15h,14h,50h,51h,41h,45h ;相序表
begin: mov ax,cs
mov ds,ax
mov dx,303h ;8255初始化
mov al,81h
out dx,al
......... ;打开开关
get1: mov cl,8
font mov si,offset table
mov dx,301h
mov al,[si]
out dx,al ;开始转动
......... ;延时
wait: mov dx,302h
in al,dx
and al,01 ;判断是否拨动开关
jz back
dec cl
jnz font
jmp get1
get2: mov cl,8
back: mov si,table+7
mov al,[si]
out dx,al
......... ;延时
wait: mov dx,302h
in al,dx
and al,01 ;判断是否拨动开关
jz font
dec cl
jnz back
jmp get2
........ ;关闭电机
mov ah,4ch
int 21h
code ends
end start
---------------------------------------------
顺手写的,端口要改一下
楼主看能不能用!