北大接口所有上机类型题目和答案(4)
9. 8255方式0,C口输入0~Fh,A口输出在数码管上显示对应数,计算机显示器显示该数加1, 有键按下返回DOS,无键按下继续执行。(在计算机显示器上即输入0显示1,输入F时显示G)。
data segment
led db 3fh,06h,5bh,4fh,66h,6dh,7dh,07h,7fh,67h,77h,7ch,39h,5eh,79h,71h
data ends
code segment
assume cs:code,ds:data
start: mov dx.,28bh
mov al,89h
out dx,al
lea bx,led
l1: mov dx,28ah
in al,dx
and al,0fh
call disp
xlat
mov dx,288h
out dx,al
mov ah,1
int 16h
jz l1
mov ah,4ch
int 21h
disp proc near
push dx
push ax
add al,1
mov dl,al
cmp dl,0ah
jb d1
add dl,7
d1: add dl,30h
mov ah,02
int 21h
mov dl,0dh
int 21h
mov dl,0ah
int 21h
pop ax
pop dx
disp endp
code ends
end start
10. 8253通道0方式0,计数值为0Fh,手动逐个输入脉冲,从计算机显示器上显示对应的数。
code segment
assume cs:code
start: mov dx,283h
mov al,10h
out dx,al
mov dx,280h
mov al,0fh
out dx,al
l1: mov dx,280h
in al,dx
call disp
mov ah,1
int 16h
jz l1
mov ah,4ch
int 21h
disp proc near
push dx
and al,0fh
mov dl,al
cmp dl,9
jbe num
add dl,7
num: add dl,30h
mov ah,02h
int 21h
mov dl,0dh
int 21h
mov dl,0ah
int 21h
pop dx
ret
disp endp
code ends
end start