www.pudn.com > 8255.rar > E8255_1O.ASM


code      segment 
assume    cs:code 
start:    mov   ax,cs 
	mov   ds,ax 
	mov   dx,offset int_proc 
	mov   ax,250fh     ;设外部中断int_proc类型号为0FH 
	int   21h 
	cli                ;清中断标志位 
	mov   dx,21h 
	in    al,dx 
	and   al,07Fh      ;开放IR7号中断 
	out   dx,al 
	mov   dx,28bh      ;置8255为A口方式1输出 
	mov   al,0a0h 
	out     dx,al 
	mov   al,0dh       ;将PC6置位 
	out   dx,al 
	mov   bl,1 
	sti                ;开中断 
ll:	jmp   ll           ;循环等待 
int_proc:	mov   al,bl 
	mov   dx,288h      ;将AL从8255的A口输出 
	out   dx,al 
	mov   al,20h 
	out   20h,al 
	shl   bl,1 
	jnc   next         ;中断次数小于8,返回主程序 
	in    al,21h 
	or    al,80h       ;关闭IRQ7中断 
	out   21h,al 
	sti                ;开中断 
	mov   ah,4ch       ;返回DOS 
	int   21h 
next:	iret 
code	ends 
	end    start