This page was last updated on March 13th, 2020(UTC) and it is currently December 1st, 2020(UTC).
That means this page is 263 days, 5 hours, 53 minutes and 46 seconds old. Please keep that in mind.

22 - Disk Operating System Now, right before we get to programming, we need to understand that there are formats that we must conform to. For writing your own OS, this usually amounts to an IVT. If you're going to write a program that can be run by an existing OS, you must conform to some sort of standard laid out by that OS provider. Fortunately for you, most programming tools do this for you, if you conform to their standard format. If you want more information, some great examples (both of how they work and how unnecessarily difficult they can be) look into "MZ executable (DOS)," "Portable Executable (Windows)," and "Executable and Linkable Format (Linux and a few other)." I've worked with ELF directly, and I've glanced at PE. All I can say is, while messing with them yourself instead of letting the tools do it, you can often shrink your programs by vast amounts (wasteful padding and such, and it can take away the advantages of caches, which is why Intel made x86 processors got such a huge boost from doubling the cache size), but the headache isn't worth it and you probably won't be able to do it in a commercial setting, since it can have a huge impact on development time the first time you do it (and also, you wouldn't be able to use things like C++ and such if you did).

Anyway, since we're going to be using DOS, we my as well figure out what we need to know about it. DOS (Disk Operating System) was an OS used a long, long time ago. Eventually, Microsoft bought it, and the early versions of Windows more or less used DOS as a "bootloader," or program that you use to load your OS. Thanks to IBM, the x86 family processors, for a long time, all followed a certain standard that established a "default state" which would result as the computer was turning on and starting. The CPU would load the BIOS (which has now largely been replaced by UEFI), which provided basic functions and would allow you to set certain settings based on where you wanted your OS to come from (Harddrive, USB stick, Floppy Disk, etc). Then, depending on what medium, there would be certain expectations (like floppys only loaded 512 bytes, and you had to stick your bootloader within those 512 bytes to load the rest of the OS, certain graphics modes, etc). DOS basically was a simple OS that extended this by giving you a series of programs and drivers that allowed you to operate the computer via something known as the "command line."

Command Line Interfaces are common, but often hidden behind "GUIs" or "Graphical User Interfaces." With a command line interface, you would usually start out in a specific "folder" on a disk, and be given a prompt to type in the name of a program and some "arguments." Arguments are basically anything that followed the name of the program you wanted to use and a space, usually separated by spaces. Most command line interfaces allow you to use quotation marks and/or "escape characters" (something like "\n" to represent a "newline" to move the cursor down by one space) to allow spaces within arguments and other special characters. Every DOS installation has it's own programs and quirks, but, for now, I want to focus on some basic commands you'll need for working with this, but since you probably don't want to actually code for DOS regularly, there's no point in going over all of them. Also note that many CLIs have different rules and commands given to them. You'll want to learn the CLI's rules for the machine you're working with (when you're done with this tutorial).

Firstly, we have the "cd" command, which stands for "change directory [folder]," which you can use to change which folder you're in. A long time ago, you set up a DOS emulator and needed to use this command to test your installation. In most interfaces, you can use ".." as a shortcut for "the folder above the current folder."

CLS (CLear Screen): Simply clears the screen.
COPY: The first argument is the file you want to copy, the second argument is the path you want to copy it to. If you specify something other than an existing folder, it'll give it that name.
DEL: Remove file. Appears to only remove files.
DIR: List all the files and folders in the current folder.
EXIT: Close the DOS emulator.
MD (Make Directory): Creates a folder.
RD (Remove Directory): DEL that applies to foldrs instead. REN (REName): Changes the names of files (and folders). BOOT: For now, we aren't going to be using this much, because I don't predict we can rely on it existing. Can be used for some fun things, though. It makes the DOS emulator try to set the virtual RAM to act like a BIOS instead, setting up the previously mentioned default state for OS development.

Get your own web kitty here!
┬ęCopyright 2010-2020. All rights reserved.