; well, that went ok, I hope. Now we have to reprogram the interrupts :-( ; we put them right after the intel-reserved hardware interrupts, at ; int 0x20-0x2F. There they won't mess up anything. Sadly IBM really ; messed this up with the original PC, and they haven't been able to ; rectify it afterwards. Thus the bios puts interrupts at 0x08-0x0f, ; which is used for the internal hardware interrupts as well. We just ; have to reprogram the 8259's, and it isn't fun.
mov al,#0x11 ; initialization sequence out #0x20,al ; send it to 8259A-1 .word 0x00eb,0x00eb ; jmp $+2, jmp $+2 out #0xA0,al ; and to 8259A-2 .word 0x00eb,0x00eb mov al,#0x20 ; start of hardware int's (0x20) out #0x21,al .word 0x00eb,0x00eb mov al,#0x28 ; start of hardware int's 2 (0x28) out #0xA1,al .word 0x00eb,0x00eb mov al,#0x04 ; 8259-1 is master out #0x21,al .word 0x00eb,0x00eb mov al,#0x02 ; 8259-2 is slave out #0xA1,al .word 0x00eb,0x00eb mov al,#0x01 ; 8086 mode for both out #0x21,al .word 0x00eb,0x00eb out #0xA1,al .word 0x00eb,0x00eb mov al,#0xFF ; mask off all interrupts for now out #0x21,al .word 0x00eb,0x00eb out #0xA1,al
由于 IBM 在最初的 PC 设计中将硬件中断放置在 0x08 到 0x0F,这可能会与其他系统功能发生冲突,因此有必要重新编程中断控制器以避免这些冲突。新编程之后,8259 这个芯片的引脚与中断号的对应关系,变成了后面这样:
切换模式
1 2 3
mov ax,#0x0001 ; protected mode (PE) bit lmsw ax ; This is it; jmpi 0,8 ; jmp offset 0 of segment 8 (cs)