实验目的
掌握可编程中断控制器8259的一般使用方法
掌握8259初始化的编程方法及中断服务程序的编写方法、中断程序的调试方法
实验内容
用单脉冲按钮的正脉冲输出作为中断控制器8259的中断源产生中断请求,在中断服务程序中对中断的次数进行计数,并将计数值显示在数码管的最右边两位,中断10次程序结束。
.MODEL TINY .DATA cnt db ? done db ? ReDisplayFlag db 0 buffer db 8 dup (?) EXTRN initKeyDisplay:near,Display8:near .CODE start: mov ax,@data mov ds,ax mov es,ax cli push es mov ax,0 mov es,ax mov di,8H*4 mov ax,offset intproc mov es:[di],ax mov ax,seg intproc mov es:[di+2],ax pop es call initKeyDisplay mov dx,250H mov al,13H out dx,al mov dx,251H mov al,08H out dx,al mov al,01H out dx,al mov al,0FEH out dx,al mov cnt,0 mov done,0 mov redisplayflag,1 sti label1: lea si,buffer call display8 cmp redisplayflag,0 call leddisplay jz label1 mov redisplayflag,0 cmp done,1 jnz label1 mov ax,4c00h int 21h intproc proc far push ax push ds sti mov ax,seg done mov ds,ax mov redisplayflag,1 inc cnt cmp cnt,10 jnz exit mov done,1 exit: cli mov al,20H mov dx,250H out dx,al pop ds pop ax iret intproc endp leddisplay proc near mov al,cnt mov buffer,al mov buffer+1,10H mov buffer+2,10H mov buffer+3,10H mov buffer+4,10H mov buffer+5,10H mov buffer+6,10H mov buffer+7,10H ret leddisplay endp end start