Help with gas and keyboard buffer

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Manton
Posts: 5
Joined: Sat May 16, 2009 10:43 am

Help with gas and keyboard buffer

Post 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?
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Help with gas and keyboard buffer

Post by Combuster »

Who told you to flush what buffer? In all sensible cases you shouldn't be doing this.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Manton
Posts: 5
Joined: Sat May 16, 2009 10:43 am

Re: Help with gas and keyboard buffer

Post 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.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Help with gas and keyboard buffer

Post by Combuster »

PS2 Keyboard <- use that and remember to send an EOI
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Manton
Posts: 5
Joined: Sat May 16, 2009 10:43 am

Re: Help with gas and keyboard buffer

Post 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();
}
npmeyer
Posts: 1
Joined: Fri May 22, 2009 9:40 pm

Re: Help with gas and keyboard buffer

Post 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.
Post Reply