page 60,132
title robotic arm
.model small
.stack 64
.data
.code
.486
begin proc far
mov ax,@data
mov ds,ax
start: ;----input for the start get or put operation
call inf6
cmp al,0dfh
je put
call inf7
cmp al,0efh
je get
call inf6
cmp al,7fh
je exit
jne start
exit: ;----for terminating the program
mov ax,0000h
call outf0
call outf1
call outf2
call outf3
call outf4
mov ax,4c00h
int 21h
;******************************************
put: ;----input for put
call inf6
cmp al,0fdh
je slot1
call inf7
cmp al,0feh
je slot2
call inf6
cmp al,0efh
je slot3
call inf6
cmp al,0feh
je slot4
call inf6
cmp al,0fbh
je slot5
call inf6
cmp al,0bfh
je slot6
call inf7
cmp al,0bfh
je slot7
call inf7
cmp al,0dfh
je slot8
call inf7
cmp al,0fbh
je slot9
call inf7
cmp al,0f7h
je slot10
call inf7
cmp al,0fdh
je slot11
call inf7
cmp al,07fh
je slot12
jne put
;*****************************************
get: ;----input for get
call inf6
cmp al,0fdh
je slotget1
call inf7
cmp al,0feh
je slotget2
call inf6
cmp al,0efh
je slotget3
call inf6
cmp al,0feh
je slotget4
call inf6
cmp al,0fbh
je slotget5
call inf6
cmp al,0bfh
je slotget6
call inf7
cmp al,0bfh
je slotget7
call inf7
cmp al,0dfh
je slotget8
call inf7
cmp al,0fbh
je slotget9
call inf7
cmp al,0f7h
je slotget10
call inf7
cmp al,0fdh
je slotget11
call inf7
cmp al,07fh
je slotget12
jne get
;********************************************
slot1:
mov ax,01h
call outf0
call shelf1
jmp start
slot2:
mov ax,02h
call outf0
call shelf2
jmp start
slot3:
mov ax,04h
call outf0
call shelf3
jmp start
slot4:
mov ax,08h
call outf0
call shelf4
jmp start
slot5:
mov ax,10h
call outf0
call shelf5
jmp start
slot6:
mov ax,20h
call outf0
call shelf6
jmp start
slot7:
mov ax,40h
call outf0
call shelf7
jmp start
slot8:
mov ax,80h
call outf0
call shelf8
jmp start
slot9:
mov ax,10h
call outf2
call shelf9
jmp start
slot10:
mov ax,20h
call outf2
call shelf10
jmp start
slot11:
mov ax,40h
call outf2
call shelf11
jmp start
slot12:
mov ax,80h
call outf2
call shelf12
jmp start
;**********************************************
slotget1:
mov ax,01h
call outf0
call shelfget1
jmp start
slotget2:
mov ax,02h
call outf0
call shelfget2
jmp start
slotget3:
mov ax,04h
call outf0
call shelfget3
jmp start
slotget4:
mov ax,08h
call outf0
call shelfget4
jmp start
slotget5:
mov ax,10h
call outf0
call shelfget5
jmp start
slotget6:
mov ax,20h
call outf0
call shelfget6
jmp start
slotget7:
mov ax,40h
call outf0
call shelfget7
jmp start
slotget8:
mov ax,80h
call outf0
call shelfget8
jmp start
slotget9:
mov ax,10h
call outf2
call shelfget9
jmp start
slotget10:
mov ax,20h
call outf2
call shelfget10
jmp start
slotget11:
mov ax,40h
call outf0
call shelfget11
jmp start
slotget12:
mov ax,80h
call outf0
call shelfget12
jmp start
;*********************************************
begin endp ;----begin procedure
shelf1 proc near ;----put on slot1
mov ax,00
mov bx,00
shel1:
call subarmforward
call gripp
call subarmback
call rotateright
call subarmforward
call ungrip
call subarmback
call rotateleft
call clearled
ret
shelf1 endp
shelf2 proc near ;----put on slot2
mov ax,00
mov bx,00
shel2:
call subarmforward
call gripp
call subarmback
call rotateright
call horizontal
call subarmforward
call ungrip
call subarmback
call horizontalback
call rotateleft
call clearled
ret
shelf2 endp
shelf3 proc near ;----put on slot3
mov ax,00
mov bx,00
shel3:
call subarmforward
call gripp
call subarmback
call rotateright
call horizontal
call horizontal
call subarmforward
call ungrip
call subarmback
call horizontalback
call horizontalback
call rotateleft
call clearled
ret
shelf3 endp
shelf4 proc near ;----put on slot4
mov ax,00
mov bx,00
shel4:
call subarmforward
call gripp
call subarmback
call rotateright
call up
call subarmforward
call ungrip
call subarmback
call down
call rotateleft
call clearled
ret
shelf4 endp
shelf5 proc near ;----put on slot5
mov ax,00
mov bx,00
shel5:
call subarmforward
call gripp
call subarmback
call rotateright
call horizontal
call up
call subarmforward
call ungrip
call subarmback
call down
call horizontalback
call rotateleft
call clearled
ret
shelf5 endp
shelf6 proc near ;----put on slot6
mov ax,00
mov bx,00
shel6:
call subarmforward
call gripp
call subarmback
call rotateright
call horizontal
call horizontal
call up
call subarmforward
call ungrip
call subarmback
call down
call horizontalback
call horizontalback
call rotateleft
call clearled
ret
shelf6 endp
shelf7 proc near ;----put on slot7
mov ax,00
mov bx,00
shel7:
call subarmforward
call gripp
call subarmback
call rotateright
call up
call up
call subarmforward
call ungrip
call subarmback
call down
call down
call rotateleft
call clearled
ret
shelf7 endp
shelf8 proc near ;----put on slot8
mov ax,00
mov bx,00
shel8:
call subarmforward
call gripp
call subarmback
call rotateright
call horizontal
call up
call up
call subarmforward
call ungrip
call subarmback
call down
call down
call horizontalback
call rotateleft
call clearled
ret
shelf8 endp
shelf9 proc near ;----put on slot9
mov ax,00
mov bx,00
shel9:
call subarmforward
call gripp
call subarmback
call rotateright
call horizontal
call horizontal
call up
call up
call subarmforward
call ungrip
call subarmback
call down
call down
call horizontalback
call horizontalback
call rotateleft
call clearled
ret
shelf9 endp
shelf10 proc near ;----put on slot10
mov ax,00
mov bx,00
shel10:
call subarmforward
call gripp
call subarmback
call rotateright
call up
call up
call up
call subarmforward
call ungrip
call subarmback
call down
call down
call down
call rotateleft
call clearled
ret
shelf10 endp
shelf11 proc near ;----put on slot11
mov ax,00
mov bx,00
shel11:
call subarmforward
call gripp
call subarmback
call rotateright
call horizontal
call up
call up
call up
call subarmforward
call ungrip
call subarmback
call down
call down
call down
call horizontalback
call rotateleft
call clearled
ret
shelf11 endp
shelf12 proc near ;----put on slot12
mov ax,00
mov bx,00
shel12:
call subarmforward
call gripp
call subarmback
call rotateright
call horizontal
call horizontal
call up
call up
call up
call subarmforward
call ungrip
call subarmback
call down
call down
call down
call horizontalback
call horizontalback
call rotateleft
call clearled
ret
shelf12 endp
;*************************************************
shelfget1 proc near ;----get on slot1
mov ax,00
mov bx,00
shelget1:
call rotateright
call subarmforward
call gripp
call subarmback
call horizontal
call horizontal
call rotateright
call ungrip
call rotateleft
call horizontalback
call horizontalback
call rotateleft
call clearled
ret
shelfget1 endp
shelfget2 proc near ;----get on slot2
mov ax,00
mov bx,00
shelget2:
call rotateright
call horizontal
call subarmforward
call gripp
call subarmback
call horizontal
call rotateright
call ungrip
call rotateleft
call horizontalback
call horizontalback
call rotateleft
call clearled
ret
shelfget2 endp
shelfget3 proc near ;----get on slot3
mov ax,00
mov bx,00
shelget3:
call rotateright
call horizontal
call horizontal
call subarmforward
call gripp
call subarmback
call rotateright
call ungrip
call rotateleft
call horizontalback
call horizontalback
call rotateleft
call clearled
ret
shelfget3 endp
shelfget4 proc near ;----get on slot4
mov ax,00
mov bx,00
shelget4:
call rotateright
call up
call subarmforward
call gripp
call subarmback
call down
call horizontal
call horizontal
call rotateright
call ungrip
call rotateleft
call horizontalback
call horizontalback
call rotateleft
call clearled
ret
shelfget4 endp
shelfget5 proc near ;----get on slot5
mov ax,00
mov bx,00
shelget5:
call rotateright
call horizontal
call up
call subarmforward
call gripp
call subarmback
call down
call horizontal
call rotateright
call ungrip
call rotateleft
call horizontalback
call horizontalback
call rotateleft
call clearled
ret
shelfget5 endp
shelfget6 proc near ;----get on slot6
mov ax,00
mov bx,00
shelget6:
call rotateright
call horizontal
call horizontal
call up
call subarmforward
call gripp
call subarmback
call down
call rotateright
call ungrip
call rotateleft
call horizontalback
call horizontalback
call rotateleft
call clearled
ret
shelfget6 endp
shelfget7 proc near ;----get on slot7
mov ax,00
mov bx,00
shelget7:
call rotateright
call up
call up
call subarmforward
call gripp
call subarmback
call down
call down
call horizontal
call horizontal
call rotateright
call ungrip
call rotateleft
call horizontalback
call horizontalback
call rotateleft
call clearled
ret
shelfget7 endp
shelfget8 proc near ;----get on slot8
mov ax,00
mov bx,00
shelget8:
call rotateright
call horizontal
call up
call up
call subarmforward
call gripp
call subarmback
call down
call down
call horizontal
call rotateright
call ungrip
call rotateleft
call horizontalback
call horizontalback
call rotateleft
call clearled
ret
shelfget8 endp
shelfget9 proc near ;----get on slot9
mov ax,00
mov bx,00
shelget9:
call rotateright
call horizontal
call horizontal
call up
call up
call subarmforward
call gripp
call subarmback
call down
call down
call rotateright
call ungrip
call rotateleft
call horizontalback
call horizontalback
call rotateleft
call clearled
ret
shelfget9 endp
shelfget10 proc near ;----get on slot10
mov ax,00
mov bx,00
shelget10:
call rotateright
call up
call up
call up
call subarmforward
call gripp
call subarmback
call down
call down
call down
call horizontal
call horizontal
call rotateright
call ungrip
call rotateleft
call horizontalback
call horizontalback
call rotateleft
call clearled
ret
shelfget10 endp
shelfget11 proc near ;----get on slot11
mov ax,00
mov bx,00
shelget11:
call rotateright
call horizontal
call up
call up
call up
call subarmforward
call gripp
call subarmback
call down
call down
call down
call horizontal
call rotateright
call ungrip
call rotateleft
call horizontalback
call horizontalback
call rotateleft
call clearled
ret
shelfget11 endp
shelfget12 proc near ;----get on slot12
mov ax,00
mov bx,00
shelget12:
call rotateright
call horizontal
call horizontal
call up
call up
call up
call subarmforward
call gripp
call subarmback
call down
call down
call down
call rotateright
call ungrip
call rotateleft
call horizontalback
call horizontalback
call rotateleft
call clearled
ret
shelfget12 endp
;*********************************************
up proc near ;----movement for up
mov ax,00
mov bx,00
call upp
call uph
ret
up endp
upp proc near
mov ax,00
mov bx,00
up1:
mov al,0ch
call outf4
call delayvertical
up2:
shr al,1
call outf4
call delayvertical
cmp al,03h
jne up2
mov al,09h
call outf4
call delayvertical
inc bx
cmp bx,0fh ;====number of loops
jne up1
ret
upp endp
uph proc near
mov ax,00
mov bx,00
uphigh:
mov al,0ch
call outf4
call delayvertical1
uphigh1:
shr al,1
call outf4
call delayvertical1
cmp al,03h
jne uphigh1
mov al,09h
call outf4
call delayvertical1
inc bx
cmp bx,007ffh ;----number of loops (up&downhigh)
jne uphigh
ret
uph endp
down proc near ;====for down
mov ax,00
mov bx,00
call downhigh
ret
down endp
downhigh proc near
downh1:
mov ax,09h
call outf4
call delayvertical1
mov ax,03h
call outf4
call delayvertical1
downh2:
shl ax,1
call outf4
call delayvertical1
cmp ax,0ch
jne downh2
call outf4
call delayvertical1
inc bx
cmp bx,007ffh ;====number of loops
jne downh1
ret
downhigh endp
horizontal proc near ;----horizontal
mov ax,00
mov bx,00
hor:
mov al,0ch
call outf3
call delayhorizontal
hor1:
shr ax,1
call outf3
call delayhorizontal
cmp ax,03h
jne hor1
mov ax,09h
call outf3
call delayhorizontal
inc bl
cmp bl,2fh ;====number of loops
jne hor
ret
horizontal endp
horizontalback proc near ;----horizontal back
mov ax,00
mov bx,00
hor2:
mov al,09h
call outf3
call delayhorizontal
mov al,03h
call outf3
call delayhorizontal
hor3:
shl al,1
call outf3
call delayhorizontal
cmp al,0ch
jne hor3
inc bl
cmp bl,2fh ;====number of loops
jne hor2
ret
horizontalback endp
rotateleft proc near ;----for rotateleft
mov ax,00
mov bx,00
rot:
mov al,090h
call outf3
call delaysub
mov al,030h
call outf3
call delaysub
rot1:
shl al,1
call outf3
call delaysub
cmp al,0c0h
jne rot1
inc bl
cmp bl,4eh ;====number of loops
jne rot
ret
rotateleft endp
rotateright proc near ;----for rotate right
mov ax,00
mov bx,00
rot2:
mov al,0c0h
call outf3
call delaysub
rot3:
shr ax,1
call outf3
call delaysub
cmp ax,030h
jne rot3
mov ax,090h
call outf3
call delaysub
inc bl
cmp bl,4eh ;====number of loops
jne rot2
ret
rotateright endp
subarmforward proc near ;----for subarm forward
mov ax,00
mov bx,00
sub0:
mov ax,09h
call outf1
call delaysub
mov ax,03h
call outf1
call delaysub
sub1:
shl al,1
call outf1
call delaysub
cmp ax,0ch
jne sub1
inc bl
cmp bl,6fh ;====number of loops
jne sub0
ret
subarmforward endp
subarmback proc near ;----for subarm back
mov ax,00
mov bx,00
sub2:
mov ax,0ch
call outf1
call delaysub
sub3:
shr ax,1
call outf1
call delaysub
cmp ax,03h
jne sub3
mov ax,09h
call outf1
call delaysub
inc bl
cmp bl,6fh ;====number of loops
jne sub2
ret
subarmback endp
gripp proc near ;----for grip
mov ax,00
mov bx,00
grip:
mov ax,08h
call outf2
call delaygrip
grip1:
shr ax,1
call outf2
call delaygrip
cmp ax,01h
jne grip1
inc bl
cmp bl,07h ;====number of loops
jne grip
ret
gripp endp
ungrip proc near ;----for ungrip
mov ax,00
mov bx,00
grip2:
mov al,09h
call outf2
call delaygrip
mov al,03h
call outf2
call delaygrip
grip3:
shl al,1
call outf2
call delaygrip
cmp al,0ch
jne grip3
inc bl
cmp bl,04h ;====number of loops
jne grip2
ret
ungrip endp
;********************************************
delayvertical proc near ;----delay for vertical movement
mov cx,008fh
time4:
mov si,00ffh
time5:
dec si
cmp si,09ffh
jne time5
loop time4
ret
delayvertical endp
delayvertical1 proc near
mov cx,0019h
time6:
mov si,00ffh
time7:
dec si
cmp si,09ffh
jne time7
loop time6
ret
delayvertical1 endp
delayhorizontal proc near ;----delay for horizontal movement
mov cx,004dh
time8:
mov si,00ffh
time9:
dec si
cmp si,09ffh
jne time9
loop time8
ret
delayhorizontal endp
delaysub proc near ;----delay for subarm movement
mov cx,004dh
time1:
mov si,00ffh
time:
dec si
cmp si,09ffh
jne time
loop time1
ret
delaysub endp
delaygrip proc near ;----delay for gripper
mov cx,00ffh
time3:
mov si,00ffh
time2:
dec si
cmp si,09ffh
jne time2
loop time3
ret
delaygrip endp
clearled proc near
mov ax,0000h
call outf0
call outf1
clearled endp
;**********************************************
outf0 proc near
mov dx,00f0h
out dx,ax
ret
outf0 endp
outf1 proc near
mov dx,00f1h
out dx,ax
ret
outf1 endp
outf2 proc near
mov dx,00f2h
out dx,ax
ret
outf2 endp
outf3 proc near
mov dx,00f3h
out dx,ax
ret
outf3 endp
outf4 proc near
mov dx,00f4h
out dx,ax
ret
outf4 endp
inf6 proc near
mov dx,00f6h
in al,dx
ret
inf6 endp
inf7 proc near
mov dx,00f7h
in al,dx
ret
inf7 endp

0 comments:
Post a Comment