Upload
hppaulalex
View
216
Download
0
Embed Size (px)
Citation preview
8/14/2019 AssemblyLab_9
1/6
. .
8/14/2019 AssemblyLab_9
2/6
A #9
66
Parallel Part
A
. (
'' ).
/ .
25 . 25
. 8 ( ) .
PCs parallel port had a total of 12 5
3 8bit ports in the processors I/O space.
8/14/2019 AssemblyLab_9
3/6
A #9
67
8/14/2019 AssemblyLab_9
4/6
A #9
68
Part1:
8 fi.
1 AA .
. 1 ,
. 2 ,
.
dosseg
.model small
.code
start: call test
jmp start
test:
push cx
push ax
push dx
mov ah,06
mov dl,0ffh
int 21h
cmp al,27
je exitcmp al,'1'
je right
cmp al,'2'
je left
cmp al,'0'
je off
pop dx
8/14/2019 AssemblyLab_9
5/6
A #9
69
pop ax
pop cx
ret
right: mov al,80h
mov dx,378h
lop : out dx,al
ror al,1
call test
call delay
jmp lop
left: mov al,01h
mov dx,378h
loop:out dx,al
rol al,1
call test
call delay
jmp loop
off: mov al,0
mov dx,378h
out dx,al
jmp start
delay: push cx
push ax
push dx
mov cx, 10h
mov dx,0
mov ah,86h
int 15h
pop dx
pop ax
pop cx
ret
exit: mov ah,4ch
int 21h
end
Part2:
8 1
.
.
8/14/2019 AssemblyLab_9
6/6
A #9
70
dosseg
.model small
.code
x1: mov dx,379h
in al,dx
and al,00001000b
cmp al,08H
je light
mov al,00000000b
jmp end1
light: mov al,11111111b
end1: mov dx,378H
out dx,al
jmp x1
end: mov ah,4ch
int 21h
END