Computer Programming/DOS Programming

About the platform edit

DOS, or Disk Operating System, can colloquially refer to any of a hundred different such operating systems. The name itself derives from it's ability to work with disks, a significant improvement over previous methods of storage. Generally this means the OS supplies a means of organizing, listing, reading, and writing files on the media.

MS-DOS was Microsoft's first Operating System. It was built upon QDOS (Quick and Dirty Operating System), which was deliberated modeled after Gary Kildall's CP/M. The original MS-DOS was simplistic and very difficult to use for the untrained. As time progressed, the interface remained essentially the same (keyboard on a text console), however it had some significant usability features (e.g. DOSKey) implemented as well.

MS-DOS retained the crown of most used DOS until Microsoft usurped its own OS with Windows, however there were other non-Microsoft disk operating systems (DOS) as well. DR-DOS was the primary competitor for MS-DOS and did fairly well until Windows 95 arrived. Afterwards, most people abandoned the non-GUI DOS system.

A few diehards continued to use DOS, however, and some have produced a version of DOS written under an Open Source license known as FreeDOS. Although abandoned by its "creator", DOS is still a stable and viable operating system, although it has been overshadowed by Windows and the most popular open source operating system, Linux.

DOS is still occasionally used on boot disks, so system recovery software may sometimes be written for DOS.

The most popular languages for use on the DOS platform, besides DOS batch files and Intel x86 Assembly Language, are C and BASIC.

See QEMU/FreeDOS and A Neutral Look at Operating Systems/DOS for more information about FreeDOS.

C/C++ Compilers edit

The main compiler for 32-bit DOS is DJGPP ( http://www.delorie.com/djgpp ). Nevertheless, 16 bit programs make up a substantial amount of the pre-Windows 95 program set, and so you may need to find a 16 bit compiler if you want to program on extremely old computers.

For the most part however, one can just use a 32 bit DOS extender, such as CWSDPMI.

Batch files edit

DOS allows the use of batch files, which are a collection or "batch" of DOS prompt commands stored in a file. When a user types in the filename (with or without the extension) of a batch file, DOS will perform each command listed in the .bat file, then return control to DOS.

Assembly Language edit

DOS comes with a low-level debugger called DEBUG. This allows debugging of an executable program which it loads into memory along with DEBUG. This is done by running DEBUG program at the DOS prompt, where program is the name of your program. DEBUG will work with .com and .exe executables. You must include the file extension in the filename when you call it using DEBUG. DEBUG does not work with .bat files.

DEBUG can also be run without a file to view CPU register contents, memory, and to assemble machine instructions directly into memory. A brief walkthrough of how to run DEBUG to view and change memory and registers, as well as assemble and run some basic machine instructions can be viewed here.