Weird keyboard bug

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
kutkloon7
Member
Member
Posts: 98
Joined: Fri Jan 04, 2013 6:56 pm

Weird keyboard bug

Post by kutkloon7 »

Hi.

I've implemented some code to handle keypresses and everything seemed to work fine at first. However, I started seeing random spaces when I print the text I type on screen.

After some debugging, I am left with the following loop in my kernel:

Code: Select all

while (true)
{
    char woopwoop = foo();
    if (woopwoop != 0)
    {
        putChar(woopwoop);
        updateCursor();
    }
}
where foo is just:

Code: Select all

char foo(void)
{
    return 0;
}
I can't believe that this is happening, but random spaces (and the weird thing is: only spaces) are still showing up when I type on my keyboard! Any ideas what might be happening?

I wanted to start a debugging session, but the problems seems to be that a value seems to be changing, and I have no idea how to debug this...

Weird stuff! I hope somebody can help me :)
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: Weird keyboard bug

Post by Combuster »

Grab bochs' debugger. Check if your ISRs are preserving registers correctly.
"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 ]
kutkloon7
Member
Member
Posts: 98
Joined: Fri Jan 04, 2013 6:56 pm

Re: Weird keyboard bug

Post by kutkloon7 »

That sounds logical, the only way the value could be changed is if the irq left another value in eax. Thanks :)
kutkloon7
Member
Member
Posts: 98
Joined: Fri Jan 04, 2013 6:56 pm

Re: Weird keyboard bug

Post by kutkloon7 »

You were absolutely right!
Post Reply