How do I get Started
How do I get Started
I want to make my own OS, but I have no idea where to start. I know a little ASM and C++, along with a HUGE amount of QBasic. What confuses me the most, is how do I use C++ to write an OS? How will my program run all by itself without an OS, if it isn't coded in Assembly?
Thanks!
Thanks!
- Brynet-Inc
- Member
- Posts: 2426
- Joined: Tue Oct 17, 2006 9:29 pm
- Libera.chat IRC: brynet
- Location: Canada
- Contact:
- Kevin McGuire
- Member
- Posts: 843
- Joined: Tue Nov 09, 2004 12:00 am
- Location: United States
- Contact:
How will a program written in assembly run all by it's self - with out a OS?How will my program run all by itself without an OS, if it isn't coded in Assembly?
If you take a look at what some C source compiles into you might be able to start to understand. I assume you know a little about how assembly can run with out a OS, so lets show the assembly for a C function.
Code: Select all
int a()
{
return 1;
}
push %ebp
mov %esp,%ebp
mov $0x1,%eax
pop %ebp
ret
Well, ASM runs without an OS by sending signals directly to the microprocessor, right? So, then, when you compile the ASM code, it gets turned to HEX, right? And then... um... well, im stumped... If you guys could explain it to me that would really rock, as I'm 13, and I have school and other things I need to do, and I don't really have the time to become an advanced C++ programer...
Buck1000 wrote:Well, ASM runs without an OS by sending signals directly to the microprocessor, right? So, then, when you compile the ASM code, it gets turned to HEX, right? And then... um... well, im stumped... If you guys could explain it to me that would really rock, as I'm 13, and I have school and other things I need to do, and I don't really have the time to become an advanced C++ programer...
- The PC boots.
- It checks to see if there's anything in it to run.
- It finds your floppy.
- As you installed your boot sector* onto it, the PC finds it and loads it into memory from the floppy.
- Your boot sector runs.
That's it. Your boot sector is running. Your code is running. (That is, your compiled code; be it C, C++, or assembly.) You can write an OS in assembly. However, the language is nearly irrelevant. The only thing that truly matters is that you know your architecture.
I suggest, after learning a bit more on general programming, you download the Intel\AMD and study those.
C8H10N4O2 | #446691 | Trust the nodes.
- Brynet-Inc
- Member
- Posts: 2426
- Joined: Tue Oct 17, 2006 9:29 pm
- Libera.chat IRC: brynet
- Location: Canada
- Contact:
Can someone confirm this? what are the requirements? any shipping/handling etc costs?Yayyak wrote:Yes, ordering the hard copy is free. It's an awesome service, IMHO. Unfortunately, they sometimes become sold out due to demand, and so you might have to wait a while (I had to wait several months after first hearing about the service before I could order).
Yes, I can confirm they're free. They prefer to ship to companies though (so i gave them my employer's address). They're out of stack atm until mid september.
@OP: Please, please seriously consider not trying to code an OS atm. You obviously have no idea how anything works at any low level, please, just do some other C, asm projects to work out how things work, you'll be doing us all a favour because we won't have to answer questions about elementary programming problems that a little experience will teach you much better.
@OP: Please, please seriously consider not trying to code an OS atm. You obviously have no idea how anything works at any low level, please, just do some other C, asm projects to work out how things work, you'll be doing us all a favour because we won't have to answer questions about elementary programming problems that a little experience will teach you much better.
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
The only offence at sanity I see is that he wants to use a language for OSDev that he hasn't mastered (and with that, how the corresponding tools work, see other threads).@OP: Please, please seriously consider not trying to code an OS atm. You obviously have no idea how anything works at any low level, please, just do some other C, asm projects to work out how things work, you'll be doing us all a favour because we won't have to answer questions about elementary programming problems that a little experience will teach you much better.
I'm going to stick with my suggestion to use a basic compiler for the sole reason he knows the language. I recently put up a freebasic barebones which can be used as a starting point.
For the rest all I see are system architecture questions. Very well a side effect of programming in a high level language, but its hardly an excuse to not answer his question, let alone telling him to (...) off.
All compiled programs run directly on the processor. That means that they use what the processor has to offer. When they need more than just the processor, they ask the processor to send messages to all the hardware of the computer.Buck1000 wrote:How will my program run all by itself without an OS, if it isn't coded in Assembly?
An OS is basically the big bully that prevents processes to directly access hardware. Instead of doing things for themselves they have to ask the OS.
The only thing that is different when developing an OS is where you ask for help. Now its just you and the plain hardware, instead of you and the OS. For several compiled languages, that does not make a difference. There are still a few that are hopelessly dependent on the system of the OS that you can't use them for other tasks. Quickbasic isn't autonomous enough, while assembly is the most autonomous language there is. In between you have GCC, G++, Object Pascal, FreeBasic, Visual C, and many many more. Some are closer to the processor and some are closer to the operating system, The only thing that's needed is that the language does not require the OS. People use C because they think its the best trade-off between ease and power. Some other people use assembly for the very same reason. You decide what you want.
If you still want to use C or C++ (or any non-basic in your case) for OS development, You will first need to know the language inside out before trying to use it for OS development.
I didn't tell him to (...) off at all. All I stated was that writing an OS is an immensely complex task that is not to be attempted lightly. And the fact that his posts suggested he has no knowledge of how a processor works at all (not trolling, just stating a percieved fact), suggested to me that it probably isn't wise him starting an OS yet. Especially considering he has started 3 topics recently on information that is quite clearly stated in (a) Bran's tutorials and (b) the wiki.For the rest all I see are system architecture questions. Very well a side effect of programming in a high level language, but its hardly an excuse to not answer his question, let alone telling him to (...) off.
I apologise for any offence to the OP, and I didn't answer his question because others had already answered it admirably.
JamesM
Well, I think I'm gonna go ahead and look into FreeBasic, and maybe learn some more C++. I'm also gonna go ahead and study the processor and see how it works, and maybe learn a little more ASM. See ya in a little while! (Oh, and JamesM, thanks for the tip, because I think your right, I really am not ready to start on an OS, so I'm gonna go learn some more before I come back.)