Disk Operating System/Introduction

Objective edit

Introduction edit

Welcome edit

Hello and welcome to the first lesson in the course, Disk Operating System! This course is meant to teach anyone with minimal computer skills to create a disk operating system, also known as DOS. The course will slowly build upon previous lessons and skills you've learned, but that doesn't stop you from jumping around from lesson to lesson, though it is recommended that you follow this course in a school like manner.

Requirements edit

For starters, you'll need an x86 compatible personal computer. A super majority of people own these type of computers, which commonly run Windows, Linux, and Unix, and other operating systems. Newer version of macOS are even x86 compatible.

Next, you'll need an assembler, since all of the examples in this course will be written in the assembly language. It is suggested that you use Nasm, since that will be the assembly of choice through this course. But don't let that limit your choices, since you can use any assembler that outputs a 16-bit flat binary. If you have no idea what that is, you better use Nasm, since I'll show you how to produce them. You can download it cost free at their website.

In addition, you'll need a program that can read and write to a virtual disk or a physical disk. If you're on Unix, you could use dd. If you're on windows, you could use WinImage (which is really user friendly and has a gui). If you're on Mac, then you're in luck because Apple includes a copy of Disk Copy with every installation. (DiskImageMounter comes with macOS since the release of Panther.) I should note that I've never used DiskImageMounter or Disk Copy and I find dd to be a little slow.

Finally, you will need an emulator if you want to quickly test your operating system. I recommend using VirtualBox, since I will be using it and teach with it. You can download it for free at their website. If you don't want to install an emulator, you can use a bootable medium on a real computer, not an emulator. Some bootable mediums would be a bootable USB or a bootable floppy disk (If you can boot such legacy hardware).

Any additional software that is needed for more advanced work will be mentioned later in the course.

OS Design edit

Now, think about building an operating system. What will it be like? How will it act? Since you will be developing your own operating system, the choice of everything from system calls to the look and feel of the operating system is entirely up to your decision. You don't have to follow any guidelines and you are free to do what you please with your operating system, unless it is physically impossible (like bringing coffee to your bed every morning...).

Computer Language edit

Most people think they can just start writing an operating system in their favorite computer language, like Java or Python. I hate to say that not all computer languages can be used for operating system development. To make the matter worse, you can only use some computer languages that can build a 16-bit flat binary file. Though their are no limit to what language you use, the computer language limits itself. Computer languages, like Java or Python, can only run on a certain virtual machine. These program languages cannot build native x86 file. Because of limitations, a computer language must:

  1. Be able to include inline assembly.
  2. Be able to be compiled to a flat 16-bit file.
  3. Be small in executable size.

The third is very important to follow. When working in 16-bit mode, real mode, you only get 64KiB of room to work with (unless you break this barrier). For example, I compiled a simple 16-bit C "Hello, world!" program for MS-DOS and the file size was nearly 8KiB. Yikes! In assembly, a simple 16-bit assembly "Hello, world!" program for MS-DOS was less than 30 bytes! You can definitely see the difference in size! Usually, when working with flat binaries, your source code in assembly will be larger than the actual binary file itself! This is one of the perk you get when working with assembly.

The Course's Language edit

Though you cannot use interpreted languages, like Java or Python, you still could use them if you build a compiler for them, but that would be a long and hard effort.

C based languages can be used for operating system development, but the problem is that most compilers nowadays do not target 16-bit, they usually target 32-bit and 64-bit.

Working with assembly will also help you to understand what the computer actually does, so you'll get very low in working with the computer. That means you'll actually learn how a computer works. Plus, any language used to develop operating systems allow inline assembly, so you'll need to learn it sooner or later.

These are the main reasons why assembly language is going to be used along with our course. Plus, some of the good compilers sometimes cost money and since this is a free course, why not use free tools? Assembly starts to make sense when we factor in all of these facts.

The Assembly Language edit

It so perfect that assembly seems superior over languages like C... or is it? There's a catch to using assembly. writing software in C will take less time and less typing, and it is more abstract than assembly. This scares away many new comers to assembly and is one of many reasons programmers have shifted to higher level program languages. Imagine a C program that is 2 million lines in source code. Assembly can be a bit touchy, one wrong, illegal instruction and the program won't assemble. Worse, one wrong, legal instruction and you'll have a program with a bug in it. This can be a problem, since squashing out the bugs in your program will probably take a lot longer to do. Hey, don't worry about it. One of the main reasons for this course is to help teach assembly alongside OS development.

Now What? edit

From here, you can continue on learning about disk operating systems, but you don't have to follow any order. The course sections, Getting Started, Protecting Your Work, DOS Then & Now, and DOS Fundamentals are more lesson teaching than actual hands-on work. You can think of these lessons as reference guides, since they can help you out from time to time. Introduction to Nasm and Your First DOS are more hands-on lessons that actually walk you through the disk operating system design. Don't forget to complete the assignment at the end of each lesson and I hope to see you around soon!

Assignments edit

  • Get the necessary hardware to build a DOS.
  • Get the necessary software to build a DOS.

Completion status: Ready for testing by learners and teachers. Please begin!