| 北大接口上机试题及答案 2 |
原文作者:佚名 文章录入:admin 发布时间:2007-3-20 11:40:52  |
|
5. 8255方式0,A口输入C口输出,如果A口的PA7输入为0,则L5、L2灯亮,PA7 为1,则L7、L0灯亮,有键按下返回DOS,无键按下继续执行。 code segment assume cs:code start: mov dx,28bh mov al,90h out dx,al l3: mov dx,288h in al,dx test al,80h jz l1 mov al,81h mov dx,28ah out dx,al l2: mov ah,1 int 16h jz l3 mov ah,4ch int 21h l1: mov dx,28ah mov al,24h out dx,al jmp l2 code ends end start 6. 8255方式0,A口输出C口输入,C口输入高2为位取反低6位不变,用键盘控制程序,有键按下返回DOS,无键按下程序继续执行。 code segment assume cs:code start: mov dx,28bh mov al,89h out dx,al l1: mov dx,28ah in al,dx xor al,0c0h mov dx,288h out dx,al mov ah,1 int 16h jz l1 mov ah,4ch int 21h code ends end start 7. 8255方式0,A口输出到LED灯上,让灯按顺序从左到右移动显示,每显示一个灯延时一秒在显示下一个灯,有键按下返回DOS,无键按下继续执行。 code segment assume cs:code start: mov dx,28bh mov al,80h out dx,al mov dx,288h mov al,01h l1: out dx,al call time rol al,1 mov ah,1 int 16h jz l1 mov ah,4ch int 21h time proc near push cx mov si,0200h t2: mov cx,0 t1: loop t1 dec si jnz t2 pop cx ret time endp code ends end start 8. 8255方式0,C口输入0~Fh,A口输出在数码管上显示和 计算机显示器显示相应数, 有键按下返回DOS,无键按下继续执行。 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 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 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
| 凡本站注明版权的文章,版权归本站所有,任何媒体、网站或个人未经本站协议授权不得转载、链接、转贴或以其他方式复制,否则本站将依法追究责任。本站转载的信息,尽量保证版权信息的完整性,用户在网站上所发布、转载的文章所引起的版权问题以及其他纠纷,后果由用户自行承担,本网概不负责。如转载文章涉及版权等问题,请与我们联系。版权声明:http://www.4lzx.com/Copyright.asp |
|
|
上一篇文章: 北大接口上机试题及答案 1 下一篇文章: 没有了 |
| 【论坛交流】【发表评论】【打印本文】【关闭窗口】 |
| |