程序源码如下:
- .MODEL SMALL
- .8086
- .stack
- .data
- LED byte 00000001B
- .code
- start:
- cli
- mov ax,0 ; init interrupt vector TABLE
- mov ds,ax
- mov si,0
- mov cx,80H
- mov ax,offset intx
- mov bx,seg intx
- l: mov [si],ax
- mov [si+2],bx
- add si,4
- loop l
- mov si,60h*4 ; init INT1 interrupt vector
- mov ax,offset int0
- mov [si],ax
- mov ax,seg int0
- mov [si+2],ax
- mov ax,@data
- mov ds,ax
- mov dx,206h ; init 8255
- mov al,10000000b
- out dx,al
- JMP $+2
- mov al,LED
- mov dx,200h
- out dx,al
- JMP $+2
- mov al,00010011b ; init 8259
- mov dx,210h
- out dx,al ; ICW1
- JMP $+2
- mov al,60h
- mov dx,212h
- out dx,al ; ICW2
- JMP $+2
- mov ax,00000001h
- out dx,al ; ICW4
- JMP $+2
- mov ax,0
- out dx,al ; OCW1
- JMP $+2
- sti
- jmp $
- int0 proc
- rol LED, 1
- mov al, LED
- MOV dx, 200h
- out dx, al
- jmp $+2
- mov al,20h
- mov dx,210h
- out dx,al
- jmp $+2
- iret
- int0 endp
- intx proc
- ror LED, 1
- mov al, LED
- MOV dx, 200h
- out dx, al
- jmp $+2
- mov al,20h
- mov dx,210h
- out dx,al
- jmp $+2
- iret
- intx endp
- END start
复制代码
对于8259A的仿真我倒是做成了,可是成功的很郁闷,其实大家很多做的就差最后一点了。
1.首先原来软件的8259改成8259A(加几个字符)大家应该都知道,我不说这个了。
2.经过反复的实验,我发现虽然仿真的时候看到8259A在第二个INTA返回给8086的中断号是对的,但是实际上到了8086那里这个中断号就变了,而且好像变成随机的了。因此,如果你只有一个中断,那你就把整个中断向量表的所有表项全部填上该中断处理程序的入口地址,你就会发现,当中断来的时候,中断处理程序被执行了,当然前提是你的程序没有错误。
我把我做的给大家做示范吧,不过大家注意修改一下“Code Generation Tool “ 中的设置
8259A仿真实例所有资料下载:
base8259.rar
(39.25 KB, 下载次数: 113)
|