Creating an operating system from scratch

chibicitiberiu

New Member
Hello,

For a long time I wanted to create an operating system, but I didn't knew too much programming, but now I learned a lot.
I want to create an operating system from scratch. What do I need to know before starting?

I understand that a project of this size will be enormous work, a lot of headaches, and so on. Is enough knowledge of programming in C++, or do I need to learn Assembly language? The platform will be a standard Intel x86 PC.
And about Assembly language, what can it do, and how can I learn it?

I don't really have experience with such big projects, and I didn't have the opportunity to talk to an expert about this.
 

fmw

New Member
Hello,

For a long time I wanted to create an operating system, but I didn't knew too much programming, but now I learned a lot.
I want to create an operating system from scratch. What do I need to know before starting?

I understand that a project of this size will be enormous work, a lot of headaches, and so on. Is enough knowledge of programming in C++, or do I need to learn Assembly language? The platform will be a standard Intel x86 PC.
And about Assembly language, what can it do, and how can I learn it?

I don't really have experience with such big projects, and I didn't have the opportunity to talk to an expert about this.

C will do anything an assembler will do. Given the fact that you ask these questions, I would suggest you aren't quite ready for prime time. Writing an operating system is about as complex as programming gets. Why not spend your time working on some useful applications.
 

chibicitiberiu

New Member
Given the fact that you ask these questions, I would suggest you aren't quite ready for prime time. Writing an operating system is about as complex as programming gets. Why not spend your time working on some useful applications.

I know!! Don't be one of these guys who instead of answering the questions I pose, tries to discourage me. How will I gain experience if not trying? I want to try this, I want to learn.
I won't quit this project, at least not yet. But I have many things to learn first. Today I just learned a bit of Assembly and how easy is to make a bootable floppy.

Now I have a question. When the compiler compiles the code, does it turn into Assembly code (that .obj file) which is then linked and you get the executable? Or the linker does that? Or it never happens?

Because I want to turn some C++ projects which are much easier for me to make into Assembly. I found out that it is possible with the DEBUG command which exists in both DOS and Windows cmd to display this Assembly code.
 

fmw

New Member
I know!! Don't be one of these guys who instead of answering the questions I pose, tries to discourage me. How will I gain experience if not trying? I want to try this, I want to learn.
I won't quit this project, at least not yet. But I have many things to learn first. Today I just learned a bit of Assembly and how easy is to make a bootable floppy.

Now I have a question. When the compiler compiles the code, does it turn into Assembly code (that .obj file) which is then linked and you get the executable? Or the linker does that? Or it never happens?

Because I want to turn some C++ projects which are much easier for me to make into Assembly. I found out that it is possible with the DEBUG command which exists in both DOS and Windows cmd to display this Assembly code.

C produces machine code, just like an assembler or any compiler for that matter. Assemblers are low level programming tools. As an example, if you want to set up a stack for the results of some computations, an assembler allows you to define exactly where in memory the stack will go. Most high level compilers would allocate the memory for you. Someone writing an accounting system in a high level language wouldn't care where the stacks are located or even that there are stacks at all. Someone writing an O/S would. C, unlike higher level compilers can provide the same kind of low level instruction work that an assembler can handle. It is certainly possible to write an O/S in C.

I wasn't trying to discourage you. I was trying to advise you. Work on some applications until you become conversant with C programming. The O/S work can wait until you know what you're doing.
 

chibicitiberiu

New Member
C produces machine code, just like an assembler or any compiler for that matter. Assemblers are low level programming tools. As an example, if you want to set up a stack for the results of some computations, an assembler allows you to define exactly where in memory the stack will go. Most high level compilers would allocate the memory for you. Someone writing an accounting system in a high level language wouldn't care where the stacks are located or even that there are stacks at all. Someone writing an O/S would. C, unlike higher level compilers can provide the same kind of low level instruction work that an assembler can handle. It is certainly possible to write an O/S in C.

I wasn't trying to discourage you. I was trying to advise you. Work on some applications until you become conversant with C programming. The O/S work can wait until you know what you're doing.

Okay, thanks for help. But how do you explain that the DEBUG command in dos is able to display in assembly the data on a floppy for example in the boot sector to make it execute a program? Is it possible to put a C program in that boot sector to boot?
 

movzx

New Member
Is it possible to put a C program in that boot sector to boot?

You won't be able to write the initialization steps of a bootloader in C. You can either write a two stage loader or write the whole thing in assembly and call your kernel (in C) once you have the machine ready to transfer execution. Or, you can take the even easier route and use GRUB.

Straight x86 assembly is very, very messy in my opinion. I suggest reading up on the Intel docs if you want to know the in's and out's of the architecture, because I can already tell you that there is just some stuff that will always have to be done in assembly when it comes down to the nitty-gritty machine-level operations of an OS kernel.

http://www.intel.com/products/processor/manuals/
 
Top