Page 1 of 1
user inputs
Posted: Wed Feb 19, 2003 9:16 pm
by Mastermind
How do you prompt for user inputs under C? I know you can't use any standard libs...
Re:user inputs
Posted: Wed Feb 19, 2003 10:03 pm
by Mr_Spam
well, you have to display something, so you'll need video routines, and you'll need the keyboard, so you'll need interrupt vectors, maping the PIC, IRQ' routines, and your keyboard driver.
Re:user inputs
Posted: Thu Feb 20, 2003 12:54 am
by Whatever5k
Standard Input requires a terminal driver - every character typed in is read by the keyboard driver and stored in a circular queue. When read()ing, the terminal driver gets the first character in the queue and returns it
Re:user inputs
Posted: Thu Feb 20, 2003 2:55 am
by Ozguxxx
you may also need a memory manager.
Re:user inputs
Posted: Thu Feb 20, 2003 7:26 am
by Pype.Clicker
Ozguxxx wrote:
you may also need a memory manager.
i hardly see why a memory manager is needed in order to implement input reading ...
Re:user inputs
Posted: Thu Feb 20, 2003 7:39 am
by Whatever5k
i hardly see why a memory manager is needed in order to implement input reading ...
Well, depends...the question is: how much code can you write without needing dynamic allocated memory
Re:user inputs
Posted: Thu Feb 20, 2003 7:42 am
by Pype.Clicker
i think having a buffer (which can be allocated statically without any problem) and handling interrupt doesn't require any dynamic memory allocation ...
Re:user inputs
Posted: Thu Feb 20, 2003 8:46 am
by Ozguxxx
I thought it was not only about dynamic memory (but it cn also be a consideration) but my idea was that your terminal driver will need some static memory for saving its data for and so that it might somewhere need to communicate with the memory manager software in the system. But I also aggree in the sense that you will not very urgently need a memory manager. Do you agree?
Re:user inputs
Posted: Thu Feb 20, 2003 11:34 am
by Mastermind
Ozguxxx wrote:
I thought it was not only about dynamic memory (but it cn also be a consideration) but my idea was that your terminal driver will need some static memory for saving its data for and so that it might somewhere need to communicate with the memory manager software in the system. But I also aggree in the sense that you will not very urgently need a memory manager. Do you agree?
Yes, I agree (and thanks to all who have replied). I know that you can use assembly language to do the same thing (get input). I did that before, but in an all-asm kernel. Does anyone know how I could insert asm code in my c kernel?
Re:user inputs
Posted: Sat Feb 22, 2003 9:39 am
by chrisa128
Rewrite it in C...
First you need to write an interrupt handler to place the key into a buffer.
Second you need to write a getch that checks to see if the buffer is empty and if not returns the value stored in it and empties it.