AND X5(急停)
SET M0
LDP M0
SET S0
STL S0
LD M8000
OUT Y0(行到B点)
LD X1(B点限位)
SET S10
STL S10
LD M8000
OUT Y1(行誉圆到A点)
LD X2(A点限位)
SET S11
STL S11
LD M8000
OUT Y2(行到C点)
LD X3(C点限差纳位)
SET S12
STL S12
LD M8000
OUT Y1(行到A点)
LD X2(A点限位虚虚没)
SET S13
STL S13
LD M8000
OUT Y3(行到C点)
LD X4(C点限位)
OUT S0
RET
LD M8002
ORI X5(急停)
ZRST Y0 Y3
ZRST S0 S13
ZRST M0 M10
END wo zhi neng zhe yang le
data segmentcar db 2,2,2,2,2,2,2,2,2,2
db 2,2,2,2,2,2,0,0,0,2
db 2,2,2,2,2,2,0,0,0,2
db 2,2,2,2,2,2,0,0,0,2
db 2,2,2,2,2,2,2,2,2,2
db 2,2,2,2,2,2,2,2,2,2
db 0,0,2,0,0,0,0,2,0,0
db 0,2,0,2,0,0,2,0,2,0
db 0,0,2,0,0,0,0,2,0,0
x dw 10
y dw 10
msg db 'car program finish!!$'
speed dw 5
data ends
code segment
assume cs:code,ds:data
start:
mov ax,data
mov ds,ax
mov ax,0a000h
mov es,ax
mov ax,13h
int 10h
call picture
ag: mov ah,7
int 21h
cmp al,'s'
jne ag
start1: in al,60h
cmp al,80h if release key
jae keyrelease
cmp al,2 1 key
jz upspeed
cmp al,3 2 key
jz downspeed
jmp keyrelease
upspeed:
mov si,speed
inc si
mov speed,si
jmp keyrelease
downspeed:
mov si,speed
dec si
mov speed,si
jmp keyrelease
keyrelease:
call clearpicture
mov si,speed
add si,x
mov x,si
call picture
call delay
mov si,x
cmp si,310
jc start1
mov ah,9
mov dx,offset msg
int 21h
mov ah,7
int 21h
mov ax,4c00h
int 21h
picture proc near
mov dx,y
mov bx,0
again: cmp dx,0
je over
add bx,320
dec dx
jmp again
over: mov dx,9
lea si,car
next1: mov cx,10
mov di,x
next: mov al,[si]
mov es:[bx+di],al
inc si
inc di
loop next
add bx,320
dec dx
jne next1
ret
picture endp
clearpicture proc near
mov dx,y
mov bx,0
again2: cmp dx,0
je over2
add bx,320
dec dx
jmp again2
over2: mov dx,9
next12: mov cx,10
mov di,x
next2: mov al,0
mov es:[bx+di],al
inc di
loop next2
add bx,320
dec dx
jne next12
ret
clearpicture endp
delay proc near
push bx
push cx
mov bx,1234
back:
mov cx,66
push ax
wait1:
in al,61h
and al,10h
cmp al,ah
je wait1
mov ah,al
loop wait1
pop ax
dec bx
jne back
pop cx
pop bx
ret
delay endp
code ends
end start
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)