Keyboard
Re:Keyboard
Stephen, Legend: Feel free to register
http://osdever.net/documents.php?cat=8&sort=1 is your friend. So much docs you won't probably need in your whole life If you want a serious keyboard driver, you'll need interrupt support. http://osdever.net/tutorials.php?cat=5&sort=1
However you can toy with a non-interrupt driver for a while by reading from port 0x60.
Cheers
http://osdever.net/documents.php?cat=8&sort=1 is your friend. So much docs you won't probably need in your whole life If you want a serious keyboard driver, you'll need interrupt support. http://osdever.net/tutorials.php?cat=5&sort=1
However you can toy with a non-interrupt driver for a while by reading from port 0x60.
Cheers
Re:Keyboard
Argh, uglyAdek336 wrote: However you can toy with a non-interrupt driver for a while by reading from port 0x60.
Being you, I would directly implement interrupt service routines. Do not go the long way.
Re:Keyboard
What did you start to code from, how much did you implement it and where are you stuck?
Re:Keyboard
I started my OS from tutorials, and I implemented most of it. I only have a little knoledge of coding in C, but not bios stuff. All the code I have found on the internet is either for dos programming or in assembly.Adek336 wrote: What did you start to code from, how much did you implement it and where are you stuck?
Re:Keyboard
Hi,
- does your OS use 16 bit real mode or is the BIOS useless
- does your OS have support for interrupts, IRQs and IO ports yet
- how much of the keyboard code have you already done
- where exactly in the keyboard code are you stuck
Cheers,
Brendan
I think what Adek336 is asking is:Stephen wrote:I started my OS from tutorials, and I implemented most of it. I only have a little knoledge of coding in C, but not bios stuff. All the code I have found on the internet is either for dos programming or in assembly.Adek336 wrote: What did you start to code from, how much did you implement it and where are you stuck?
- does your OS use 16 bit real mode or is the BIOS useless
- does your OS have support for interrupts, IRQs and IO ports yet
- how much of the keyboard code have you already done
- where exactly in the keyboard code are you stuck
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.
Re:Keyboard
Hello!
I am using 32 bit Protected Mode, I dont have support for ICQs or for interrupts (I tried enabling them with the codes on the websites (http://osdever.net/tutorials.php?cat=5&sort=1) but i got heaps of errors when I tried to link the compiled C and ASM Files) and I dont have any keyboard code.
I am using 32 bit Protected Mode, I dont have support for ICQs or for interrupts (I tried enabling them with the codes on the websites (http://osdever.net/tutorials.php?cat=5&sort=1) but i got heaps of errors when I tried to link the compiled C and ASM Files) and I dont have any keyboard code.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Keyboard
You'll have to enable interrupts sooner or later... what kind of "compile error" do you encounter ? could that come from the fact you're trying to compile something that was MS-targetted (e.g. pre-pending underscores) on a non-MS platform ?
what tools do you use for compiling ?
what tools do you use for compiling ?
Re:Keyboard
I use DJGPP to compile the C part of my OS, NASM to compile the ASM part, and ld to link the two files. When I try to link the two files, I get this error.
kernel_c.o(.text+0x12):kernel_c.c: undefined reference to `_outb'
kernel_c.o(.text+0x20):kernel_c.c: undefined reference to `_outb'
kernel_c.o(.text+0x2a):kernel_c.c: undefined reference to `_outb'
kernel_c.o(.text+0x37):kernel_c.c: undefined reference to `_outb'
kernel_c.o(.text+0x42):kernel_c.c: undefined reference to `_outb'
kernel_c.o(.text+0x50):kernel_c.c: more undefined references to `_outb' follow
These errors are all from the code to remap the PICS as follows:
#define PIC1 0x20
#define PIC2 0xA0
#define ICW1 0x11
#define ICW4 0x01
void init_pics(int pic1, int pic2)
{
/* send ICW1 */
outb(PIC1, ICW1);
outb(PIC2, ICW1);
/* send ICW2 */
outb(PIC1 + 1, pic1);
outb(PIC2 + 1, pic2);
/* send ICW3 */
outb(PIC1 + 1, 4);
outb(PIC2 + 1, 2);
/* send ICW4 */
outb(PIC1 + 1, ICW4);
outb(PIC2 + 1, ICW4);
/* disable all IRQs */
outb(PIC1 + 1, 0xFF);
}
kernel_c.o(.text+0x12):kernel_c.c: undefined reference to `_outb'
kernel_c.o(.text+0x20):kernel_c.c: undefined reference to `_outb'
kernel_c.o(.text+0x2a):kernel_c.c: undefined reference to `_outb'
kernel_c.o(.text+0x37):kernel_c.c: undefined reference to `_outb'
kernel_c.o(.text+0x42):kernel_c.c: undefined reference to `_outb'
kernel_c.o(.text+0x50):kernel_c.c: more undefined references to `_outb' follow
These errors are all from the code to remap the PICS as follows:
#define PIC1 0x20
#define PIC2 0xA0
#define ICW1 0x11
#define ICW4 0x01
void init_pics(int pic1, int pic2)
{
/* send ICW1 */
outb(PIC1, ICW1);
outb(PIC2, ICW1);
/* send ICW2 */
outb(PIC1 + 1, pic1);
outb(PIC2 + 1, pic2);
/* send ICW3 */
outb(PIC1 + 1, 4);
outb(PIC2 + 1, 2);
/* send ICW4 */
outb(PIC1 + 1, ICW4);
outb(PIC2 + 1, ICW4);
/* disable all IRQs */
outb(PIC1 + 1, 0xFF);
}
Re:Keyboard
All this code is in my C kernel.These errors are all from the code to remap the PICS as follows:
The code that calls the function:
init_pics(0x20, 0x28);
is in the main function
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Keyboard
Ok, I fixed that one up and now the interupts are set up, but I have no keyboard code. How yould you write this??