Page 1 of 1
Hi, I just have a questions to ask osdev?
Posted: Fri Nov 28, 2014 5:27 pm
by surfosinc
Hi, I'm new here at the forum and in developing a operating system, I have been reading a lot about it and how operating systems work and stuff, like how compiler work and anything programming languages, Iv been programming in c++ and visual basic and python, and bash for linux and batch for windows I some others to but that's not what I wanted to ask. ok my operating system does just the basic like type help for a list of help commands and entering thous commands out putting it on screen just the basics, I wanted to know how I can get batch projects that I have made and I'm trying to get my OS to open batch files and edit it and save a .bat, do I have to program like every command that batch has to hive it open and save? I just can not get the os to read the batch file the .bat, Do I really have to put every command that batch has just to run .bat files? I'm new and have been studying a lot really a lot. Sorry for asking this I'm a complete newbie. Thanks
Re: Hi, I just have a questions to ask osdev?
Posted: Fri Nov 28, 2014 6:02 pm
by Cjreek
Well what do you think?
The CPU won't do it on its own
You're probably not at the point to worry about .bat files. You need to care about memory management and (multi-)tasking, filesystems etc before you should think about something like batch files. What do you even want to do with those? You don't have any access to disks (floppy/hdd/cd) or filesystems, you can't run tasks.. What do you even want to do with .bat?
Re: Hi, I just have a questions to ask osdev?
Posted: Fri Nov 28, 2014 7:02 pm
by SpyderTL
surfosinc wrote:I wanted to know how I can get batch projects that I have made and I'm trying to get my OS to open batch files and edit it and save a .bat, do I have to program like every command that batch has to hive it open and save? I just can not get the os to read the batch file the .bat, Do I really have to put every command that batch has just to run .bat files?
.bat files are just text files, so if all you want to do is "edit" .bat files, you just need to create a utility (or command) in your OS to edit a text file. It will need to display the file and let you change the file on the screen, and it will need some way to save the file back to disk. Think about notepad.exe.
If you want to actually "execute" your batch file on your OS, your OS will need to be able to read the file, and "detect" the commands, individually. To start with, you can just read the file character by character until you see a CR/LF (0x13 0x10). Then you just need to pretend that the user typed in the characters that you've found so far, and hit ENTER. Then you just start over on the next line.
Hopefully, this answers your question. If not, let us know.
Re: Hi, I just have a questions to ask osdev?
Posted: Fri Nov 28, 2014 7:28 pm
by AndrewAPrice
surfosinc wrote:I wanted to know how I can get batch projects that I have made and I'm trying to get my OS to open batch files and edit it and save a .bat, do I have to program like every command that batch has to hive it open and save? I just can not get the os to read the batch file the .bat, Do I really have to put every command that batch has just to run .bat files?
As soon as you mentioned reading and writing files to a disk, you're opening a whole can of worms. Device drivers, file system drivers, some kind of VFS implementation to mount them in a way that your shell can reference them.
It will be a large step that will distinguish your operating system from simple Hello World tutorial OS's that just print to the screen and take input.
Re: Hi, I just have a questions to ask osdev?
Posted: Fri Nov 28, 2014 8:49 pm
by sortie
Read a book on osdev. You obviously know so little you can't reason about osdev. We have a nice list on our wiki. Please also use more descriptive topic subjects.
Re: Hi, I just have a questions to ask osdev?
Posted: Sat Nov 29, 2014 12:14 pm
by surfosinc
Hi, thanks for all the reply's, I've been up for two days now, fingering how to read files write files, I now have a basic file system done and ready to use
and it works, Yes
I dissected to learn more before I continue more on this os. So I'm going to leave it at where it is tell I learn more. But my list that the os does so far (Has own file system, can write and save/open text files, os can run on boot cd or dvd, and all the basic help system, os can calculate how much space is available on the system, can load drivers now for keyboard mouse VGA change colors, has a error system I have added, and there's more but I have to get some sleep lol. Other then that I still have a lot of work to do. There is a lot of stuff I want to do with this os but like i said I need to know more so I'm going to put this on hold. Thanks for all your reply's, I will be back when I know more. On operating system development. Thank you
Re: Hi, I just have a questions to ask osdev?
Posted: Sat Nov 29, 2014 1:10 pm
by no92
Re: Hi, I just have a questions to ask osdev?
Posted: Mon Dec 01, 2014 7:13 pm
by AndrewAPrice
surfosinc wrote:But my list that the os does so far (Has own file system, can write and save/open text files, os can run on boot cd or dvd, and all the basic help system, os can calculate how much space is available on the system, can load drivers now for keyboard mouse VGA change colors, has a error system I have added, and there's more but I have to get some sleep lol. Other then that I still have a lot of work to do.
Assuming you're serious (your operating system can load text files from disk), and you have some kind of shell you type commands in to, then handling batch files is as simple as executing each line of the text file as if the user typed it in.
Your shell would likely have a function run_command(char *line) or similar that the line you typed in is sent to when you press enter, so you'd loop over the text file sending each line of the text file to run_command instead.
Two pieces of advice:
1. Label your thread something relevant to what you are asking. Imaging if every thread had the subject "I have questions!"
2. Get straight to the topic rather than starting out with "I know C++, Visual Basic, and Python, so you know I'm super cereal with milk and can make an OS..." People who are serious get to the point rather than start their posts by proving themselves. We all start somewhere, so we don't expect you to know everything.
Re: Hi, I just have a questions to ask osdev?
Posted: Tue Dec 02, 2014 3:48 am
by mathematician
To execute batch files you would need
a.) A command line interpreter which could understand commands like (in the case of Windows) copy or type.
b.) The kernel of an operating system, which could open, close, and read files on behalf of the command line interpreter.
You might be able to ommit b.) If the interpreter programmed the hardware directly. If you do not write the code to execute the batch files commands, who do you think is going to do it for you? The ability to execute batch files would come towards the end of an osdev project, when the only thing left to do is implement a GUI. Not that a GUI isn' a large project in its own right. From what you say, you are at a point where you are just having the BIOS outputing a few messages.
MS-DOS, which was a single tasking command line system, written in assembly language, compiled to around 60kb worth of machine code. It needed all of that, and a command line interpreter, before it was able to execute batch files.
Re: Hi, I just have a questions to ask osdev?
Posted: Mon Dec 08, 2014 2:31 pm
by 0fb1d8
First, you should focus on completing your kernel. By a "complete kernel", I mean
- memory management
- virtual memory
- mm (malloc, free, realloc, calloc, ...)
- heap & stack management
- paging (if you are developing in 32-bit/64-bit protected/long mode)
- VFS layer
- Filesystem drivers
- device manager
- HAL (hardware abstraction layer)
- system API layer
Anyways, do you even have a readable filesytem driver?
If you don't, you won't even be able to read the file.
Anyways, *.bat files are just plain text. IF YOU REALLY want to parse batch files, you should take a look at the open source MS-DOS (it is highly not recommended since MS-DOS~Windows operating systems are written poorly)
http://www.computerhistory.org/atchm/mi ... v1-1-v2-0/)
You should either implement your own shell interface (and make your own script format, like *.cool) or port other applications like BASH, SH, KSH.
Cheers, bro!