Page 1 of 1

Patricknet Keyboard Problem

Posted: Sun Mar 29, 2009 3:51 pm
by PatrickV
I am trying to implament a keyboard feature for Patricknet Beta 0.3. It has been difficult. I am trying use the bran tutorial kb.c to intergrate with my operating system. But when i compile it was ok but when i link it it come with an error:
kb.o: In function `keyboard_handler':
kb.c:(.text+0xe): undefined reference to `inportb'
^ Which i added the inport and outport in my kernel file from last time
This is a pain because you want something basic like a keyboard and you cann't seem to get it to work.

Is their and simpler examples i can look at that has keyboard handeler and what happen you press a key and prints on to the screen? I've been looking into it for a few months now and keyboard is the most important.

Re: Patricknet Keyboard Problem

Posted: Sun Mar 29, 2009 4:07 pm
by Alboin
You either don't have inputb, or are not linking properly. (I'm not quite sure how that can go wrong...) Are you sure the 'input' function is not named 'inb', or maybe just 'input'?

You don't need another tutorial, you just need to understand those little annoying 'error messages'. ;)

Re: Patricknet Keyboard Problem

Posted: Sun Mar 29, 2009 4:14 pm
by Troy Martin
Haven't you had this problem before and posted it on the forum without, I don't know, maybe, googling what your problem is and writing the function?
Yep, found it: http://forum.osdev.org/viewtopic.php?f=1&t=18882

EDIT: This appears to be Ctrl+C/V'd. Soooo...
AJ wrote:... calling an OS version 0.3 when it is cut and pasted from a tutorial seem a little pretentious ...
You, Patrick, are obviously not ready to write an operating system when you do not have the slightest clue how to research something and write the code to do what you want. So I suggest you learn to do that and come back later. I had to do that when I learned to program in assembly language.

Re: Patricknet Keyboard Problem

Posted: Sun Mar 29, 2009 4:24 pm
by PatrickV
It osdev, i tried googling it but don't know what keywords that the topic used. Their are not much examples of keyboard handler as far as i looked on google
Alboin wrote:You either don't have inputb, or are not linking properly. (I'm not quite sure how that can go wrong...) Are you sure the 'input' function is not named 'inb', or maybe just 'input'?

You don't need another tutorial, you just need to understand those little annoying 'error messages'. ;)
No! I hope your are refering as inportb. I just use inportb and that is it.


Well that is my old source code if you want to know.

Code: Select all

     unsigned short keyboard_handler()
{
    unsigned char scancode;

    /* Read from the keyboard's data buffer */
    scancode = inportb(0x60);
    /* If the top bit of the byte we read from the keyboard is
    *  set, that means that a key has just been released */
    if (scancode & 0x80)
    {
        /* You can use this one to see if the user released the
        *  shift, alt, or control keys... */
    }
    else
    {
        /* Here, a key was just pressed. Please note that if you
        *  hold a key down, you will get repeated key press
        *  interrupts. */

        /* Just to show you how this works, we simply translate
        *  the keyboard scancode into an ASCII value, and then
        *  display it to the screen. You can get creative and
        *  use some flags to see if a shift is pressed and use a
        *  different layout, or you can add another 128 entries
        *  to the above layout to correspond to 'shift' being
        *  held. If shift is held using the larger lookup table,
        *  you would add 128 to the scancode when you look for it */
        print_text(kbdus[scancode]);
    }
   return (scancode,kbdus[scancode]);
}
Generally I just have issues with the keyboard. I remember that 16 bit has keyboard all setup. But 32-bit is different.

+ you guy are getting confused with my conventions of verisions. Let me simplerfly. Patricket 0.0.0 Beta 0.0.3 Example: Windows XP Beta 0.0.9

Re: Patricknet Keyboard Problem

Posted: Sun Mar 29, 2009 4:32 pm
by Combuster
The reason you got kicked out last time hasn't changed apparently.

Required knowledge: know how to code. If you can't code, you can't code an OS. You can't code, hence you can't possibly write an OS. Now go home and fix that problem before you get kicked out once again.

As homework, write a pacman clone in C without asking for help or copying existing code. Then we can talk again. (and by then, you would know enough to answer this one yourself)