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.
Define "doesn't work". Please describe what the intent of the software is, what it is doing (or not doing) on your machine, and what debugging steps you have already taken.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
So it is working on a new computer, but fails on an old laptop. This seems like a KBC problem, not an IRQ one, you might want to post the setup part of the keyboard driver. Seeing your code, you haven't taken the KBC out of emulation mode, you might want to look at the contents of the controller command byte and see if you like it's contents. Oh, and if you get nothing at all, it might be that the keyboard is locked.
This piece of code is a driver loaded by the kernel. In the first machine, where it works, it is installed a general irq handler for line 1 which read the code in the keyboard register and than it translate it in ascii. Eventually it displays it on the screen (the function putc works I'm sure).
On the old laptop irq1 never fires...
Perhaps on old machines have I to send some commands to the keyboard before using it?
Karlosoft wrote:
Perhaps on old machines have I to send some commands to the keyboard before using it?
Yes, that is what i think is happening, the state in which the BIOS leaves the keyboard can be anything, and with old laptops such a state can be, hmm, rather, hmm, funny. So, try to find out what the state is in which the laptop-BIOS leaves the keyboard, and think up a good init-sequence.
You may also want to try sending the Reset signal to the keyboard and see if the keyboard responds with the ACK byte(0xFA).
There are lots of commands from which you can track if the keyboard is responding or not. If the keyboard is not responding, reinitialize the keyboard port/controller and try again.
Good Luck.
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
Isn't 0xfe the system reset command? However now it works sometimes -.-... I added the 0xae command to enable the keyboard. On the other computer it always works...
It's not a problem of the irq I'm sure because the timer handler and the serial port handler are working well.
It seems to work when I don't leave the keyboard buffer of the bios empty O.O... ok I'm going to take a break, or I'll start speaking in a sort of keyboard scancode language -.-...