Page 1 of 1
How do you make a command prompt?
Posted: Fri Oct 14, 2005 11:00 pm
by stevenup7002
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
Re: How do you make a command prompt?
Posted: Mon Oct 24, 2005 11:00 pm
by Da_Maestro
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
Re: How do you make a command prompt?
Posted: Wed Nov 02, 2005 12:00 am
by vbbrett
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