IRQs again

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
YASC

IRQs again

Post 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
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:IRQs again

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

Re:IRQs again

Post 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
xsix

Re:IRQs again

Post 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 ;] .
User avatar
kataklinger
Member
Member
Posts: 381
Joined: Fri Nov 04, 2005 12:00 am
Location: Serbia

Re:IRQs again

Post 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.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:IRQs again

Post 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 !
xsix

Re:IRQs again

Post by xsix »

Nah, disable+enable is good :D. That's all what i can say...
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re:IRQs again

Post 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
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Post Reply