Page 1 of 1

Help with gas and keyboard buffer

Posted: Wed May 20, 2009 8:11 am
by Manton
I need to flush keyboard buffer and i searched in google and this forum. I find information and write gas code(I NEED ONLY GAS CODE):

Code: Select all

cli
mov $0x40, %si
mov 0x1a(%si), %al
mov %al, 0x1c(%si)
sti
But it doent work( Where was i wrong?

Re: Help with gas and keyboard buffer

Posted: Wed May 20, 2009 8:22 am
by Combuster
Who told you to flush what buffer? In all sensible cases you shouldn't be doing this.

Re: Help with gas and keyboard buffer

Posted: Wed May 20, 2009 8:37 am
by Manton
Keyboard interrupt works one time. I get one scancode. I find in google some man with same problem. And there said that if dont flush keyboard buffer the controller keyboard does not send next scancode.

Re: Help with gas and keyboard buffer

Posted: Wed May 20, 2009 9:53 am
by Combuster
PS2 Keyboard <- use that and remember to send an EOI

Re: Help with gas and keyboard buffer

Posted: Wed May 20, 2009 10:30 am
by Manton
I did like there but it dont work ( I see "pressed" one time. Whats wrong?

Code: Select all

void irq_timer (void);
asm("irq_timer : pusha \n call _irq_timer \n movb $0x20, %al \n outb %al, $0x20 \n popa \n iret \n");
void _irq_timer(void)
{
}

void irq_keyboard(void)
{
	printf("pressed\n");
	outportb(0x20,0x20); // EOI
}

void init_interrupts()
{
	i_install(0x20, &irq_timer, 0x8e);
	i_install(0x21, &irq_keyboard, 0x8e);
	i_setup();
	i_enable();
}

Re: Help with gas and keyboard buffer

Posted: Fri May 22, 2009 9:42 pm
by npmeyer
Hi Manton,

I had this problem too... you need to actually read the scancode from the keyboard controller in order to get another interrupt (in addition to the EOI). Add an inportb (0x60) to your irq_keyboard function.