首先,我为 Vintage 计算机组编程。我写的是专门为 MS-DOS 而不是 windows,因为那是人们正在运行的。我当前的程序是为后来的系统而不是 8086 线,所以计划是使用 IRQ 8。这允许我以二进制值设置中断率,从 2 / 秒到 8192 / 秒(2、4、8、16, ETC...)
只是,出于某种原因,在较新的旧系统上(好吧,这听起来很奇怪,)它似乎不起作用。在仿真中,以及我可以访问的 386 系统,它工作得很好,但在我拥有的 P3 系统(GA-6BXC MB w/P3 800 CPU)上它就不能工作。
编码
设置中断
disable();
oldrtc = getvect(0x70); //Reads the vector for IRQ 8
settvect(0x70,countdown); //Sets the vector for
outportb(0x70,0x8a);
y = inportb(0x71) & 0xf0;
outportb(0x70,0x8a);
outportb(0x71,y | _MRATE_); //Adjustable value, set for 64 interrupts per second
outportb(0x70,0x8b);
y = inportb(0x71);
outportb(0x70,0x8b);
outportb(0x71,y | 0x40);
enable();
在中断结束时
outportb(0x70,0x0c);
inportb(0x71); //Reading the C register resets the interrupt
outportb(0xa0,0x20); //Resets the PIC (turns interrupts back on)
outportb(0x20,0x20); //There are 2 PICs on AT machines and later
关闭程序时
disable();
outportb(0x70,0x8b);
y = inportb(0x71);
outportb(0x70,0x8b);
outportb(0x71,y & 0xbf);
setvect(0x70,oldrtc);
enable();
我在代码中看不到任何可能导致问题的内容。但这似乎没有任何意义。虽然我不完全相信这些信息,但 MSD“确实”将 IRQ 8 报告为 RTC 计数器,并表示它存在并且工作正常。以后的系统有可能移动了向量吗?我发现的所有内容都表明 IRQ 8 是向量 0x70,但在我的 Pentium III 系统上从未触发中断。有什么方法可以查明向量是否已更改?