user inputs
user inputs
How do you prompt for user inputs under C? I know you can't use any standard libs...
Re:user inputs
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
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
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:user inputs
i hardly see why a memory manager is needed in order to implement input reading ...Ozguxxx wrote: you may also need a memory manager.
Re:user inputs
Well, depends...the question is: how much code can you write without needing dynamic allocated memoryi hardly see why a memory manager is needed in order to implement input reading ...
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:user inputs
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
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
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?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?
Re:user inputs
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.
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.