Page 1 of 1

IRQs again

Posted: Wed Jan 25, 2006 8:38 am
by YASC
I've got problems with my IRQ code: the IRQ is only called once and I sent 0x20 at port 0x20.
Code for IRQ:

Code: Select all

.global irq1

irq1_message: .asciz "Keyboard interrupt\n"

irq1:
   pusha
   pushl %gs
   pushl %fs
   pushl %es
   pushl %ds
   
   pushl $irq1_message
   call puts
   addl $4, %esp
   
   movb $0x20, %al
   movw $0x20, %dx
   outb %al, %dx
   
   popl %gs
   popl %fs
   popl %es
   popl %ds
   popa
   iret
This seems really weird to me, I read the FAQ and it said, writing 0x20 to port 0x20 would be enough. It fails in bochs and on real hardware.

YASC

Re:IRQs again

Posted: Wed Jan 25, 2006 8:53 am
by Pype.Clicker
reading more from the FAQ might have told you that not reading a byte from port 0x60 on keyboard IRQ will keep the keyboard controller "waiting" for room in the buffer, therefore not raising further IRQs for further keystrokes.

Re:IRQs again

Posted: Wed Jan 25, 2006 8:57 am
by YASC
*ouch*, that hurt :P
I did do this a long time ago, and lost the source. My mind's not the best it seems ;)
But thanks

Re:IRQs again

Posted: Wed Jan 25, 2006 9:42 am
by xsix
Keyboard programming? Keyboard will send the same scan code as long as you will not disable keyboard controller via PPI(61h port) controller. So you must disable and reenable keyboard controller to receive other scan codes ;] .

Re:IRQs again

Posted: Wed Jan 25, 2006 9:53 am
by kataklinger
xsix wrote: Keyboard programming? Keyboard will send the same scan code as long as you will not disable keyboard controller via PPI(61h port) controller. So you must disable and reenable keyboard controller to receive other scan codes ;] .
PPI? port 61h? Disabel & enable keyboard? You should rewrite your keyboard driver! There is no need to do all those things. When you get interrupt, check kbd status to see if someting available at data port, if it is read the data.

Re:IRQs again

Posted: Wed Jan 25, 2006 11:07 am
by Pype.Clicker
xsix wrote: Keyboard programming? Keyboard will send the same scan code as long as you will not disable keyboard controller via PPI(61h port) controller. So you must disable and reenable keyboard controller to receive other scan codes ;] .
There are situation where it's normal for the keyboard to send the same scancode several times, for instance when "typematic rate" is set so.

Moreover, I/O port 0x60 is a buffer: it won't change by the simple fact you read it, and especially, it won't turn to 0 as you read it. so if you read port 0x60 several time regardless of interrupts, you will get the same value until some other byte has arrived, but there's no reason i can see that could make you want to do this !

Re:IRQs again

Posted: Wed Jan 25, 2006 12:26 pm
by xsix
Nah, disable+enable is good :D. That's all what i can say...

Re:IRQs again

Posted: Wed Jan 25, 2006 2:17 pm
by Brendan
Hi,
xsix wrote:Nah, disable+enable is good :D. That's all what i can say...
The 8048 chip became obsolete 20 years ago....


Cheers,

Brendan