Win32下AT&T汇编Hello world教程
OOC-GCC新的测试用例[0.6]

Proteus中8259的仿真[无dos,纯手工]

pingf posted @ Wed, 16 Mar 2011 14:05:32 -1100 in 未分类 , 3692 readers

因为研究生复试的需要所以最近折腾了下8086的汇编, 
不过proteus总是没有我预期的完美[可能也跟和谐的版本有关] 
下面是折腾8259的一些总结,不过有一些问题,希望知道的能予以指正 
 
电路搭建,基于自带的例子 (原文件名:8259_1.png) 

 
程序源码 (原文件名:8259_2.png) 

 
断点设置 (原文件名:8259_3.png) 

 
仿真1 (原文件名:8259_4.png) 

 
仿真2 (原文件名:8259_5.png) 



另外,一些问题罗列如下 
-.我用的老王的77sp2和谐,不过逻辑仿真器貌似用不了啊 
-.8259模型需要改一下[加几个字符]才能用于仿真 
0.一开始会莫名其妙的产生一个终端,一般位于前16字节,所以我的程序在那里也设置了捕获的proc,要不然会跑飞,不知为何 
1.下一次触发时才会相应正确的中断,而当前相应的为上一次的?不过Simulation Log里的信息倒是正确的 
2.级联模式,次级的irr不会自动清除,至少我觉的应该自动清除的,导致响应时会被进制,当然可能是我程序的问题 
3.软件触发的中断没问题,直接int xx出来的中断都可以正确的响应,个人感觉要么是我程序的问题,要么是8259模型的问题 
4.Proteus中仿真用exe和com格式的都可以,我的程序是使用masm的,顺带试了下mingw套件里的gas汇编,com格式输出时也是可以的 
  不过没法调试,即使-gstabs加上了也不行. 

*.上面的问题可能是本人程序上的错误,希望熟悉8086汇编的人能指正一下 
工程文件ourdev_623172B3W6H8.rar(文件大小:32K) (原文件名:8086 Demo Board.rar)  [放在ourdev上了]

源程序

.MODEL  SMALL
 
io8259_main_addr equ 0600H        
io8259_sub_addr  equ 0800H        

.8086
.code
        io8259_std1_init macro base,icw1_val,icw2_val,icw4_val
                mov dx,base
                mov al,icw1_val  
                out dx,al
                
                mov dx,base+2
                mov al,icw2_val
                out dx,al
                
                mov al,icw4_val
                out dx,al
        endm
        io8259_std_init macro base,icw1_val,icw2_val,icw3_val,icw4_val
                mov dx,base
                mov al,icw1_val  
                out dx,al
                
                mov dx,base+2
                mov al,icw2_val
                out dx,al
                
                mov al,icw3_val
                out dx,al
                
                mov al,icw4_val
                out dx,al
        endm
        
        setup_int macro int_irq,int_cs,int_ip
                push di
                push ds
                mov di,0
                mov ds,di
                mov di,(int_irq)*4
                mov word ptr ds:[di],int_ip
                mov word ptr ds:[di+2],int_cs
                pop ds
                pop di
        endm
        setup_ints macro int_irq,int_cs,int_ip
                setup_int int_irq,int_cs,int_ip
                setup_int (int_irq+1),int_cs,int_ip
                setup_int (int_irq+2),int_cs,int_ip
                setup_int (int_irq+3),int_cs,int_ip
                setup_int (int_irq+4),int_cs,int_ip
                setup_int (int_irq+5),int_cs,int_ip
                setup_int (int_irq+6),int_cs,int_ip
                setup_int (int_irq+7),int_cs,int_ip
        endm

        intxx proc far
                iret
        intxx endp
        intl1 proc far
                iret
        intl1 endp
        intl2 proc far
                iret
        intl2 endp
        intl1_s proc far
                iret
        intl1_s endp
        intl2_s proc far
                iret
        intl2_s endp
        


.startup
        cli
       
        setup_ints 00h,seg intxx,offset intxx
        setup_ints 08h,seg intxx,offset intxx
        setup_ints 10h,seg intxx,offset intxx
        setup_ints 18h,seg intxx,offset intxx
        
        setup_int 30h,seg intl1,offset intl1
        setup_int 31h,seg intl2,offset intl2
        setup_int 40h,seg intl1_s,offset intl1_s
        setup_int 41h,seg intl2_s,offset intl2_s
   main:
        io8259_std_init io8259_main_addr,\ 
                        11h,30h,04h,13h
        ;io8259_std1_init io8259_main_addr,\ 
                        ;13h,30h,03h
   slave:
        io8259_std_init io8259_sub_addr,\ 
                        11h,40h,02h,03h

        sti
        jmp $

.data
.stack
END
编译链接选项[masm] 
ml /c /Zd /Zi sample.asm  
link16 /CODEVIEW sample.obj,sample.exe,,,nul.def 

 

happy wheels said:
Thu, 26 Jul 2018 22:03:18 -1100

I have been seeking information on this topic for the past few hours and found your post to be well written and has solid information. Thank you!

AAA said:
Sat, 21 May 2022 10:03:39 -1100 Appreciate this excellent article. I especially enjoyed reviewing it and ought to discuss it with everyone. How to Be a Merchant Processor
AAA said:
Fri, 27 May 2022 10:49:47 -1100

I’d must verify with you here. Which isn’t something I often do! I take pleasure in reading a post that may make people think. Additionally, thanks for allowing me to comment! 토토사이트

AAA said:
Sat, 04 Jun 2022 09:58:49 -1100

I want to thank you for the excellent post!! I certainly liked every bit of it. I’ve bookmarked your web site so I can take a look at the latest articles you post later on. 雲台

AAA said:
Mon, 13 Jun 2022 22:38:00 -1100 whoah this weblog is excellent i love reading your articles. Stay up the good paintings! You already know, lots of persons are looking round for this info, you can aid them greatly. tradein macbook
qqhow said:
Thu, 23 Jun 2022 05:57:18 -1100

It’s really a nice and helpful piece of info. I’m glad that you just shared this helpful info with us. Please keep us informed like this. Thanks for sharing. different lash extensions

meidir said:
Thu, 28 Jul 2022 20:50:50 -1100

It’s hard to find knowledgeable people on this topic however you sound like you know what you’re talking about! Thanks https://voyance-tel-avenir.com


Login *


loading captcha image...
(type the code from the image)
or Ctrl+Enter