Hi, checked your attachment, Big difference between port 0x20 and interrupt 0x21. only outportb 0x20 to port 0x20 will suffice - to acknowledge the PIC that we've taken care of the interrupt.
The 8259 PIC master controller is at port 0x20, take out the C code to reset it ie. outportb(0x21, 0x21) which causes the code to dive off into the woods and boom and is incorrect anyway!
And leave the assembler kbd handler to take care of it which you have coded - is correct!
Remember the kbd's IRQ is 1, and is <u>remapped</u> to
<b>interrupt 0x21</b>. Don't confuse the two between int 0x21 and port 0x20!
Keyboard queue is located in memory at 0x41A (in realmode) which is the tail of the queue,
the head is located at 0x41E, and to empty the queue (essentially a kbd buffer) one could code it in this
fashion in realmode, dunno if this applies to pmode though, mind you, the memory location - am a bit rusty if that's where it resides ....ie.
void clear_kbd_buf(void)
{
int far *head_q = (int far *) MK_FP(0x40, 0x1A);
int far *tail_q = (int far *) MK_FP(0x40, 0x1E);
*head_q = *tail_q;
}
and call this immediately after processing the keystroke, that's how DOS work so that typeahead is achieved.....enter too many keys and DOS beeps at you...
Regards,
Tommie/newbie_os_dsgnr