Page 1 of 2
keyboard
Posted: Sat Apr 26, 2008 1:26 pm
by Woellchen
hi
i have a little problem
i coded a very short keyboard handler and set it to irq1
Code: Select all
void keyboard_handler(struct regs *r)
{
scancode = inportb(0x60);
if (scancode & 0x80)
{
}
else
{
last_key = kbdus[scancode];
//putch(last_key);
}
}
but i am not sure how to deliver the chars
so my question: how to?
my idea was to set a program as "active window" and the handler sends it there
but theres my problem: i dont know how to do so
anyone who could help me with that?
Posted: Sat Apr 26, 2008 1:29 pm
by 01000101
what do you mean by "deliver the chars"? if you mean writing the characters to the screen, you must write a video driver/handler, but it looks like you might already have that since you have a commented-out putch function.
Posted: Sat Apr 26, 2008 1:31 pm
by Woellchen
yea, i already wrote a function to print text on screen
but my problem is that i want to send the chars to the program (maybe with an api?)
i dont know how to do so
Posted: Sat Apr 26, 2008 1:35 pm
by 01000101
hmm, I'd suggest giving each 'program' it's own personal char buffer, or begin implementing Inter-Process Communication (IPC) handling.
Posted: Sat Apr 26, 2008 1:42 pm
by Woellchen
and how could an ipc handler look like?
or could you give me a tutorial which shows how to work with them?
i dont know sorry
Posted: Mon Apr 28, 2008 5:35 am
by jal
Woellchen wrote:i dont know sorry
I think your knowledge is so limited, you have no chance to succeed making anything even close to an OS. Please do yourself a favour and start with echoing a character to the screen for example, before you start thinking about processes and APIs and the like...
JAL
Posted: Mon Apr 28, 2008 7:55 am
by Woellchen
now i think you dont know about me..
i wrote my own bootloader, my own kernel, my own print function(so yes, i already can print a character on the screen (with scroll functions btw..)), i wrote my own irq routines and i wrote a little keyboard handler(with a little shell btw)
in fact i dont think "i have no chance to succeed making anything even close to an OS" because i have already done so
i just asked how to get the pressed buttons to the right "task"
and i think i will do it like 01000101's suggestion by giving each "task" an own char buffer
anyway i thank you
Posted: Mon Apr 28, 2008 8:01 am
by JamesM
Woellchen wrote:now i think you dont know about me..
i wrote my own bootloader, my own kernel, my own print function(so yes, i already can print a character on the screen (with scroll functions btw..)), i wrote my own irq routines and i wrote a little keyboard handler(with a little shell btw)
in fact i dont think "i have no chance to succeed making anything even close to an OS" because i have already done so
i just asked how to get the pressed buttons to the right "task"
and i think i will do it like 01000101's suggestion by giving each "task" an own char buffer
anyway i thank you
Before you can dispatch to "tasks" you have to implement "inter process communication". And to implement "inter process communication" you have to implement "multitasking". And to implement "multitasking" you have to implement "memory management"...
And don't flame back, because both myself and jal could cook up exactly what you have in less than a day.
Cheers,
James
Posted: Mon Apr 28, 2008 8:13 am
by Woellchen
i dont wanted to look it like a flame sorry
and yes the description "task" is wrong, i just wanted to make it as clear as possible
for tasks its still a long way for me but im already lucky with what i have got
Posted: Mon Apr 28, 2008 8:39 am
by jal
Woellchen wrote:i just asked how to get the pressed buttons to the right "task" and i think i will do it like 01000101's suggestion by giving each "task" an own char buffer
And now the $100,000 question: where are you going to put that buffer? And who is going to manage it? How does the application extract key presses from it? Thought about locking access to it? Concurrency problems?
JAL
Posted: Mon Apr 28, 2008 8:47 am
by Woellchen
maybe not really a buffer..
my idea was to save the last key by the handler(which is already done) and writing an additional function like get_key()
it returns then the last key and sets the last key to false or something else
in a while loop in the shell script i will write something like this:
Code: Select all
if( get_key() )
{
//do something (for example print to screen)
}
or is it that wrong?
Posted: Mon Apr 28, 2008 8:51 am
by JamesM
Woellchen wrote:maybe not really a buffer..
my idea was to save the last key by the handler(which is already done) and writing an additional function like get_key()
it returns then the last key and sets the last key to false or something else
in a while loop in the shell script i will write something like this:
Code: Select all
if( get_key() )
{
//do something (for example print to screen)
}
or is it that wrong?
But that's not reentrant. How does it tie in with your multitasking ideas?
Posted: Mon Apr 28, 2008 8:55 am
by Woellchen
ok sorry maybe i am confusing you so forget the multitasking
my idea is to set the active window as active_window or so
and the get_key function would check this or something like this to not give inactive windows the key->only the active window can get the keys
do u understand now?
Posted: Mon Apr 28, 2008 9:02 am
by JamesM
Woellchen wrote:ok sorry maybe i am confusing you so forget the multitasking
my idea is to set the active window as active_window or so
and the get_key function would check this or something like this to not give inactive windows the key->only the active window can get the keys
do u understand now?
Yes I understand - it sounds like an adequate solution - doesn't seem particularly extensible or scaleable but if that's what you want...
Posted: Mon Apr 28, 2008 9:09 am
by Woellchen
hmm.. is it really that bad?
how could i do it better then?
i just need some hints on how to make it as good as possible
edit: ok this post wasnt nesessary..
i got some inspirations from the kernel u have linked in your signature
i think i know enough now so thank you all