I have several questions regarding OS programming.
1 - How do they write Operating systems?
2 - Do you know what compilers is used to do that (or library)?
3 - Do they have to burn it to a CD and reboot the computer every time they test it?
4 - I heard that most of the operating systems are written in C and some of them are in assembler. If so then why do you need assembly if you can just compile the C program to assembly. Is it something like this

#include <OSSTUFF>

int OSmain {
int prints(char toprint) {
_ASM {
//asm to print screen
asmint cdf = topring;
push eax;
pop cdf;
.dada
disp cdf;
}
prints(gdf);
} //normal C

Also the assembly can be used in Windows. But I heard windows does not allow direct access to hardware and assembly is a machine code. Then how is assembly used in windows or unix stuff? How does windows allow that?
Also do you know any good books about OS programming. I just ordered a book about asm. I don't like internet tutorials, just books. Also is assembly different for Intel and AMD and 32 and 64 bit systems? I got 64 bit AMD and the book is for 34 bit Intel and if it will not work I will have to use my mom's Intel 32 bit netbook for that and she will not like it lol. Sorry if my questions seem a bit silly for you, I am just 13 years old :)

Recommended Answers

All 3 Replies

This Tanenbaum book is what I studied in Helsinki University and also Linus Torvalds, it is kind of classic. i do not know the newer books though.http://minix1.woodhull.com/osdi2/

There is a big OS development community here:
http://forum.osdev.org/index.php with a wiki: http://wiki.osdev.org/Main_Page

Usually, hobby-OS projects are compiled with a GCC cross compiler. There is a document on the OSDev WIKI about how to set this up. In early stages, the kernel can not depend on anything from from libc - so a stripped down compiler is necessary.

While it is possible to write an OS is assembly, it is hardly ever done any more.
I'm not really sure what your question about inline-asm in C with regard to Windows/Linux is, but:
If you will ever write a Windows kernel driver, you _can_ use inline asm but it is _highly_ discouraged. Mainly because the ASM is platform dependent, and very very easily breaks on someone else's machine.
That is why only minor parts of an OS are written in ASM.

The book for 32bit asm will do fine, as you will probably write a 32 bit OS (don't start with a 64 bit kernel).

You don't need to burn the OS to a CD every time you test it, there are virual machines like Qemu, Bochs etc.
You will 'just' compile your kernel, stick in the boot loader, and tell one of these virtual machines to load it as if it were a floppy disk.

Thanks a lot guys, and tahsnk for the link to the forum :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.