I'm developing my own legacy bios implementation for bochs, and got stuck at INT 16h. The keyboard IRQ just won't fire(bochs reported keyboard buffer full,ignoring scancode). The PIC initialization code looks really fine, the handlers looks fine, but it just wont fire. I checked everything, and I just can't find the reason why(interrupt flag is present, proper segment, ivt does have int 0x9 according to bochs's info ivt 0x9 command).Here's the pic initialization code, which set an irq offset of 0x8 for master and 0x70 for slave:
Code:
initpic:
mov al,0x11
out 0x20,al
out 0xa0,al
mov al,0x8
out 0x21,al
mov al,0x70
out 0xa1,al
mov al,4
out 0x21,al
mov al,0x2
out 0xa1,al
mov al,1
out 0x21,al
out 0xa1,al
mov al,0xfd
out 0x21,al
mov al,0xff
out 0xa1,al
Here's the handler code, which is a dummy code for now:
Code:
irq1:
pusha
mov al,0x20 ;the acknowledge interrupt code
out 0x20,al
in al,60h
popa
iret
And here's the code for setting the ivt:
Code:
setivt:
xor dx,dx
mov gs,dx
mov [gs:0x9*4+2],cs
mov [gs:0x9*4],irq1
and the code looked perfectly fine to me.
EDIT: Added the acknowledge interrupt code