Assembly OS

If you are new to OS Development, plan on spending some time here first before going into the other forums.

Moderator:Moderators

Post Reply
LostTime77
Posts:2
Joined:Sat Dec 20, 2008 9:53 pm
Contact:
Assembly OS

Post by LostTime77 » Sat Dec 20, 2008 10:12 pm

Hello. I am new to these forums but am no stranger to the website. Let me be one of many to say that the wealth of knowledge provided on this website is great and serves as a great learning tool.

However, I have many questions regarding OS development that have been left unanswered or at least I have not seen them answered. Hopefully some people can shed some light on them. First and foremost, I am interested in making an OS entirely in assembly, not C. I have programmed with C and C++ for years and they are great, however this is mainly as a learning experience (programming the entire OS in assembly). I am not at all looking for anything fancy or anything having tons of features (right now at least). I just want an OS that boots, has a file system and such and an OS that I can add to over time, such as a GUI, network code, drivers, etc.. Before anybody tells me "It is impossible to code the entire OS in assembly", I know it is incredibly hard to maintain all the files, yadda yadda; however I believe it is possible to overcome this constraint by careful programming. Remember time is of no constraint to me, I am a hobbyist computer engineer (in college) trying to learn more about how the hardware works and how OS's work under the hood, in part so I can be ready for the accompanying classes in my major.

As a little background, I am in the robotics club at my school and have programmed a PIC with its assembly instructions and have used interrupts. I know what that is all about. I have also developed many medium scale projects in C and C++. I am also learning assembly as I go; I am no newcomer to it.

On to the questions... FINALLY :O. Ok so, as I have researched online looking at boot loader tutorials, they mainly deal with loading a boot loader to a floppy. While this is fine and dandy, and while an assembly OS could probably fit on a floppy (Minuet OS), I am interested in how boot loading for an OS such as Windows works. I mean, I pop the CD into the drive, and you tell Windows to copy the files here and there, and I assume the CD eventually writes a boot loader to the hard drive so that you don't need the CD to boot after you have installed the OS. How would one go about writing a boot loader for a CD and when run, copying that accompanying boot loader to the hard drive, much like I assume Windows does? Is it the same as doing it for a floppy disk? Secondly I am wondering how Windows works when it copies all its files to the hard drive. When run, does the CD copy all the files for the OS, Kernel, driver files, GUI stuff, to the hard drive with the boot loader and then on the next restart or whatever the boot loader is run from the hard drive and then the Kernel executes using all of the files that were copied? Loaded sentence.

My second observation is about SATA. I 'believe' I did not see any ports in one of the OS tutorials refer to SATA ports but only to IDE and SCSI for reading / writing. I assume that they work in much the same way as for IDE and SCSI drives.

Lastly, (for now) I know that these tutorials are based on the FAT 12 file system. However, I am not interested in FAT 12. Is this because the boot loader is loaded from a floppy? I am interested in using something like NTFS, much like Windows does, or another file system that is similar. How does one go about setting up the boot loader / Kernel for this?

P.S. - As a side note, I am able to boot from a virtual floppy, as show in this tutorial while using VMWare. I find VMWare to be a lot easier to use than Bochs at least for the beginning part. I have not needed to set up anything for it. I assume this will bite me in the butt when debugging comes around :P. This is here for additional background.

Again, I would like to thank this site for all the info it has on it. It really is great.

Lo$T

User avatar
Mike
Site Admin
Posts:465
Joined:Sat Oct 20, 2007 7:58 pm
Contact:

Post by Mike » Sun Dec 21, 2008 5:16 pm

Hello,

I have responded to alot of these questions over chat, however I feel I may be able to give a better response here.
Before anybody tells me "It is impossible to code the entire OS in assembly", I know it is incredibly hard to maintain all the files, yadda yadda;
Depending on how large or complex your system is, no matter what it will be very hard maintaining all of the source files and directory tree. In any case, it is entirely possible to develop the system in assembly language. I dont personally recommend it, but it is possible.
How would one go about writing a boot loader for a CD and when run, copying that accompanying boot loader to the hard drive, much like I assume Windows does?
Windows uses a bootable CD format that follows the <a href="http://en.wikipedia.org/wiki/El_Torito_ ... ndard)">El Torito</a> standard which will allow it to load the boot loader off the CD providing a method to boot from the disk.
My second observation is about SATA. I 'believe' I did not see any ports in one of the OS tutorials refer to SATA ports but only to IDE and SCSI for reading / writing. I assume that they work in much the same way as for IDE and SCSI drives.
IDE, SATA, and SCSI are very different to work with and quite complex. At startup, the BIOS can be configured to emulate SATA drives so they can be treated like IDE drives. Because the BIOS provides an interface for interacting with IDE drives, we can use the same BIOS interface to read/write both IDE/EIDE and SATA/PATA drives.

When you switch into pmode this emulation continues until you directly control the SATA/PATA or IDE/EIDE controllers. This is where things get complex as you will need drivers for these controllers as well as the devices that they communicate with.

I think I already answered the other questions before so I hope this helps a little more ;)

LostTime77
Posts:2
Joined:Sat Dec 20, 2008 9:53 pm
Contact:

Post by LostTime77 » Mon Dec 22, 2008 2:05 am

Thanks for the info Mike. You have answered all of my questions thus far :) Thanks for your time.

Lo$t

Post Reply