Hi guys I want some informations on how the operating systems are made--just the basic of them. How they are constructed-- Do you have any information or any web site. I think that we can start building one from now. Please give some comments!
I don't know that much about them, but you would have to learn Assembly Language to write the Bootloader which much be 512 Kb.
After that, you should be able to write the rest in C/C++.
"Don't go too deep into programming! (Just joking)"? Programming an OS is pretty deep.
Don't forget to write interfaces (drivers) for all the popular hardware. If you are writing your own custom OS for a smaller set of (custom) hardware, then you have an easier task.
You need to integrate both ASM and C++ to create this. Use ASM for low-level programming like the kernel and talking to the hardware, etc. and use C++ for the file system, running application software, etc.
if you are interested in operating systems, look into the linux kernel. it is of course open source and you can create your own modules to add to the kernel fairly easily.
If you want to get into OS development, my suggestion would be to start off with very simple "hello world" operating systems. And if you do, boot it from diskette. NEVER EVER modify your HD's bootsector cause you will never be able to boot Windows again unless you reformat it. I recently bought a book on ASM language that goes more into depth with BIOS and DOS interrupts. Something that you will need to master before you start writing an OS. Here are some links that you might be interested in...
I tried to learn the assembly language. It is really confusing. You just move the stacks or something like that in the register and I don't see anything visually happening. Where can I find a really easy tutorial on assembly. And also because this is a C++ forum then I am going to ask that let us say that you want to draw a circle, lines, write and get text, everything which you can do it dos, can you do that when you are developing the operating system?
Ok the problem with me is that I just know C++ for this kind of DOS programming. Do I need to learn C in order to develop(make would fit) a simple hello world operating system. The program which you wrote, Will I have to make an exe file from this and then boot from the floppy disk or it will work fine when I will boot with just c or cpp extention? Can you give an example in C++, and the procedures to run that program.
You can write an operating system in C++. I don't know why you wouldn't be able to. But I think it is better to write it in C so that there is minimal overhead. I ran the code above in Windows 98 console just fine as an EXE. BUT if it going to be the operating system it MUST be in binary form (.com, .bin, etc.). It cannot be in .c or .cpp extentions because the computer cannot execute C/C++ code. It can only execute 1's and 0's.
To boot it from a diskette you must write a bootstrap that loads it when booting. It REALLY isn't that hard to write a bootstrap (once you know ASM).
I made the program above with PowerC. It should work with any other C or C++ compiler so go ahead and give it a try. I changed a few things cause I couldn't get the other code to work properly so here is the new code along with an attached example...
Code:
#include <dos.h>
#include <conio.h>
/*----------------------------------------------------------*/
void setVGAmode()
{
_AH = 0; /* request change video mode */
_AL = 0x12; /* VGA 640x400 mode */
geninterrupt(0x10);
}
/*----------------------------------------------------------*/
void printtext(char* txt, int num)
{
int cnt; /* loop counter */
_AH = 0x0E; /* request display character */
_BH = 0; /* page number */
_BL = 2; /* green on black */
for (cnt=0; cnt<=num; cnt++)
{
_AL = txt[cnt];
geninterrupt(0x10); /* call the interrupt */
}
}
/*----------------------------------------------------------*/
int main()
{
setVGAmode();
printtext("Hello World!", 12); /* print the text */
getch(); /* wait until you are ready to exit */
return 0;
}
Originally posted by abdul I tried to learn the assembly language. It is really confusing
Okay, I hate to say this, but that is a bad sign.
Anyway, Assembly shouldn't be that hard, though if you would preffer, I suggest learning on an old Motorola chip first. The word order is more natural than the Intel series. There isn't an advantage either way, just preference. And you can grab an old Motorola box (Apple, Ami, VMI, maybe some old Sun boxes, I don't know). Though, I worked with a Motorola emulator that ran under Ultrix. I'm sure you can find the source for something like that to build it for Linux. There may be other emulators out there.
For those of you who want to see something funny... look for Perlix. And OS written in Perl. It is more of a joke than anything else, kind of a hackers wet dream, going against the "right tool for the right job" mentality.
I can't remember where I got it but I actually have some source code for a version of DOS, it includes all of the c++ side of things, however, does not contain any assembly code. So once you've got the asm code going you should be able to fiddle around with this and combine the 2 together to come up with an OS!
I haven't really had much of a look at this so if anyone finds anyhting interesting please comment.
I just check over the os i got and it does have assembly with it, i still can't remember where i got it from though! It's amazing what you can find on and old software devleopers computer!
I have done heavey resurch into building your own OS. It is harder than what everyone is telling you. Of course you must know ASM. But you don't want to work with DOS!!!! So 90% of what every one previous to this post has said will not work!
You don't want to go straight into c++ either. You want to do plain C.
If I were you I would get a VERY VERY stripped down, non GUI, copy of Linux. Just the OS and some sort of Compiler for it. Scrap all of the aditional software. Use it as a guid line to writing your own OS but do not directly copy it. Once you build your OS/Kernel... then rewrite the compiler to work with your OS if it doesn't already. When you have a functional C compiler for your OS... then you can do anything you want. But note -- the open source for the compiler must be totally stripped down to a level that can work for you. You don't want it using "evil" headers.
Brandito is right, you have to write a compiler for your OS or else people won't be able to write programs for it! and niether will you.
The Source that I have included in this forum is DOS-C which apparently is a GNU OS and from what I have just brielfly looked over it can read fat format so basically if you are able to fiddle around with this a bit and re-compile it you'll be at where Microsoft was when they brought PC DOS and edited it and release it as MSDOS 1.0
So I guess if you really want to start heading down that path than this is a start.
Lots of folks have written OS components. I've had students who did that - like write the HAL (microkernel) for a Unix flavor for a given hardware platform. Long ago, I wrote dispatchers, schedulers, and device queueing for other OS's.
The short story is that you have to be able to write code at different levels. Like C and MASM, or A86.
And you have to create re-entrant primitives (like api's) to keep code size down. Unix was written originally on PDP's using mostly C and assembler under another OS called RSX. That's why the Unix shell and command language is C-like.
In Unix, the poor level of interactive help, cryptic error messages, and absurd command names (ls, anyone?) are all due to memory limitations on the old PDP's. You have to keep a lot of command table information memory resident. And if you have 8K of RAM you can't have commands like 'DIRECTORY' when 'ls' is a lot smaller and does okay.
IF you are interested in this sort of thing, you can get OS source for Hurd & GNU/LINUX at GNU. You'll have to do several downloads. And hop to another page or three. Knock yourselves out....