Hi. This is my first post in this board but certainly won?t be the last. I have always liked to make my own Operating System and I am so determined in coding one. I have searched around the internet for decent OS-Dev tutorials but all of them tend to skim over crucial parts of the explanations or keep focusing on one aspect of the development process.

I have also bought a copy of the Modern Operating Systems (2nd edition) by Andrew Tanenbaum but they I wish I hadn?t done so because to me it?s just a nice story and that?s all. Maybe after I create my first Operating System it would be a valuable resource but for now, it is not.

What I really want to know is if there is a good OS-Dev book out there which solely uses Assembly code and walks you through different stages of the process of creating your own Operating System. I?d appreciate it if you guys could put me into the right direction. I?m talking no boot-loaders like GRUB or anything else so you have to create everything from the ground up.
Posted on 2006-12-19 01:47:37 by XCHG
If I were you, I write boot sec with fasm and I let myself to C.
I have done this at my os.
Boot sec -> Fasm
16-bit Loader -> Open Watcom
32-bit kernel and all other things -> Visual C++ Express edition (free :) ) (I use C ofcourse)
Posted on 2006-12-19 07:16:23 by Dite
Look here for the topics with my posts. These topics contain some useful answers from others.
Posted on 2006-12-19 10:34:48 by ti_mo_n
It sounds like the kind of OS stuff that I'm coding.  I wish there was a good set of tutorials out there, but there doesn't seem to be at the moment.  I could probably write on a lot of topics, and I had started to on my website.  Unfortunately, making tutorials takes a long time, and there's an insane amount of info involved with OS development, so I never got very far.  I've made sure to document most stuff fairly well, though (except my bootloader, but I'll get to that).  I might write a tutorial series once the first release of the kernel is done, so that people can try stuff out by changing/adding/removing code in the kernel and bootloader.

That said, if you'd like in on the PwnOS project, I'd love some company.  I took a bit of a break for a month to work on an editor to speed up documentation once it's done, but now I'm back to the OS, and today I'm almost done coding the basic NTFS File I/O stuff.  Hopefully I'll be done ReadFileNTFS this evening.  I've got page allocation done (not freeing, but that's not hard with allocation done), and heap memory allocation and freeing done.  Once File I/O's ready, it'll be on to getting CreateProcess and CreateThread done, then the ThreadScheduler and the kernel's pretty much ready to rock.

The main PwnOS site is now http://www.scs.carleton.ca/~ndickson/os/, the code is on Google Code at http://code.google.com/p/pwnos/, and the documentation is at http://pwnos.googlecode.com/svn/trunk/Documents/index.html.  I've got some info on how to get started with the code, but I've never tried it.  You can contact me at hackulous (at-sign) gmail (period) com.  Man, this sounds like such a sales pitch  :lol:

Anyway, best of luck to ya!
Posted on 2006-12-19 14:48:36 by hackulous
Alright, here is what I really feel at this point. There are hundreds of operating system tutorials out there but almost none of them *really* teach you what to do. I was reading an operating system tutorial in the HTML format which was supposed to teach you how to create your own 32-bit Protected Mode Operating System and right at the first chapter of the tutorial the writer put a handful of Protected-Mode code in the Kernel?s source which he left to be described in later chapters. And of course, he never described those. Ironically, I saw the exact same code in another tutorial!

What I am really looking for is a tutorial based on Assembly (or maybe even C) that walks you through different stages of the development process. I have already created a ?Hello, World!? boot-loader and know a few pointers about the matter but am really confused about the whole Protected-Mode, booting process, 512 bytes and etc.
Posted on 2006-12-21 03:04:01 by XCHG
- 32/64-bit Protected mode is what you want to enter ASAP (read: as soon as you finish your work with the BIOS), except some very special cases.
- 512 bytes is 1 sector. That's the amount the BIOS loads at 7c00 and starts executing. You are to load the rest of your OS.

I recommend reading about the FAT12/16/32 (from the original MS's pdf). First 2 bytes are supposed to be a jump. If you've done a 'hello world' then try doing a 'hello world' on a fully fat12-compliant virtual FDD (it is simply a 1.44MB file). You'll need fat12 stuff very soon if you want to make an OS on a floppy disk. The sooner you do it the safer you'll be. I've learned fat12 AFTER I have written my bootloader. It was 512 bytes long, but due to the fat12 bootsector data, I had to split the bootloader code into 3 parts, change the loader, realign all data and reapir jumps (both the conditional and unconditional). In other words: I had to change ~50% of the bootloader code ^^

So go and read about fat12 :P
Posted on 2006-12-21 06:10:04 by ti_mo_n
So, if you are a "windows" person like me, that will save your life :P
virtual fdd for windows
http://blog.int6.net/wp-content/uploads/2006/10/vfd21-050404.zip

I can recommend you those tutorials, they are not "os" tuts but pmode and includes lots of description
http://alexfru.chat.ru/programming/pmtuts.zip

I know everybody is telling that "read intel manuals", so even if you don't read whole thing, just take a look...
for example, there are cetain steps how to switch pmode or what is gdt and what it do

good luck ;)
Posted on 2006-12-21 11:19:36 by Dite

Alright, here is what I really feel at this point. There are hundreds of operating system tutorials out there but almost none of them *really* teach you what to do. I was reading an operating system tutorial in the HTML format which was supposed to teach you how to create your own 32-bit Protected Mode Operating System and right at the first chapter of the tutorial the writer put a handful of Protected-Mode code in the Kernel?s source which he left to be described in later chapters. And of course, he never described those. Ironically, I saw the exact same code in another tutorial!

Yeah, there's not a lot of good detailed info in any one place, so development tends to end up being a lot of guess-and-hope until you've got something that works.  Plus, contradictory/incorrect references can crop up, like the original version of the FAT long filename specification, which wasn't ever used, but threw me way off for a while, hehe.


What I am really looking for is a tutorial based on Assembly (or maybe even C) that walks you through different stages of the development process. I have already created a ?Hello, World!? boot-loader and know a few pointers about the matter but am really confused about the whole Protected-Mode, booting process, 512 bytes and etc.

Yeah.  Unfortunately, at the moment, to really understand Protected Mode well, one of the few options is to read the intel manuals.  I've read a big chunk of Volume 3, the System Programming Guide, and even though it's not great for learning stuff quickly, there's a lot of detailed info that can't be found elsewhere.  Volume 2, Instruction Set Reference, is pretty important as a reference too.
Posted on 2006-12-21 11:48:15 by hackulous
(...)intel manuals.(...)

Yeah, it took me about 2 weeks to read (1166 pages ^^), but it's really worth it.
Posted on 2006-12-23 02:09:48 by ti_mo_n
Yes, I believe I have problems understanding many Protected Mode features so I guess I better read about it and also about File Allocation Table. About the Intel Manuals, I always read those first when I need help but the whole protected mode architecture has became a double headed monster in my head.

Thanks everyone, for the links and information. I wish you all a merry Christmas.
Posted on 2006-12-24 05:05:35 by XCHG