This may be a very simple question but I need help, How do you make a DOS style interface on my kernel? I need a command to startup a gui.
32 bit protected mode OS loaded by GRUB
-steven
How do you make a command prompt?
- stevenup7002
- Member
- Posts: 60
- Joined: Tue Sep 20, 2005 11:00 pm
- Location: Ireland
- Contact:
-
- Member
- Posts: 144
- Joined: Tue Oct 26, 2004 11:00 pm
- Location: Australia
Re: How do you make a command prompt?
A Command prompt requires a couple of things from your OS:
Keyboard support and
Writing text to the screen
Write a piece of code that does this sort of thing:
1. Create a buffer (say 256 characters) for your commands
2. Clear the buffer
3. Print a prompt to the screen
4. Accept keystrokes from the keyboard and enter them into the buffer (until the enter key is pressed). Don't forget to echo the pressed keys to the screen.
5. Parse the command line that is entered. The first word should be the command (intuitively). The words afterwards can be kept and passed on as parameters.
6. Execute the specified command. To figure out which command was specified, you will need to implement some basic string functions. I did mine in assembler. Email me for the source if you like ([email protected])
7. Once the command is completed, return to step 2.
Adam
Keyboard support and
Writing text to the screen
Write a piece of code that does this sort of thing:
1. Create a buffer (say 256 characters) for your commands
2. Clear the buffer
3. Print a prompt to the screen
4. Accept keystrokes from the keyboard and enter them into the buffer (until the enter key is pressed). Don't forget to echo the pressed keys to the screen.
5. Parse the command line that is entered. The first word should be the command (intuitively). The words afterwards can be kept and passed on as parameters.
6. Execute the specified command. To figure out which command was specified, you will need to implement some basic string functions. I did mine in assembler. Email me for the source if you like ([email protected])
7. Once the command is completed, return to step 2.
Adam
Two things are infinite: The universe and human stupidity. But I'm not quite sure about the universe.
--- Albert Einstein
--- Albert Einstein
Re: How do you make a command prompt?
And you may want to implement a backspace and cursor.
If I can give you one huge pointer! This would be it:
When you clear a character from the display, you usually clear it with a 'Space', and the space, as any screen character, has a color byte which represents the foreground and background text color. If you move the cursor onto a space the, the cursor assumes the foreground color! So if your cursor ever disapears when creating the backspace command, make sure that you have colored the empty character spot with different foreground/background colors.
May sound novel.. but it stumped me for a few days!
Brett
If I can give you one huge pointer! This would be it:
When you clear a character from the display, you usually clear it with a 'Space', and the space, as any screen character, has a color byte which represents the foreground and background text color. If you move the cursor onto a space the, the cursor assumes the foreground color! So if your cursor ever disapears when creating the backspace command, make sure that you have colored the empty character spot with different foreground/background colors.
May sound novel.. but it stumped me for a few days!
Brett