Contents << >>

## Writing Programs for DOS

Several major simplifications are made when we limit consideration to assembly programs that will run under MS-DOS. First, even in Windows 95, DOS programs run in 16-bit Virtual 8086 mode (on older machines, DOS runs in Real mode, which is the same for most practical purposes). This means that we don't have to worry about the extra complications of 32-bit registers and addressing modes (of course, people developing large applications will find many advantages to using the more advanced 32-bit modes, but almost no one developing large applications should be doing more than small pieces of the application in assembly language). Second, under DOS we can write `.COM` programs, which have a simpler structure than `.EXE` programs; this allows us to ignore most of the issues of using segment registers, at the cost of limiting the size of program text plus initialized data to a maximum of 64K. Finally, programs under DOS can make use of numerous built-in subroutines (accessed through software interrupts) from DOS and the BIOS (Basic I/O System) to perform common I/O tasks. Performing I/O in a Windows program is substantially more complex, even in C; writing a simple "Hello World'' program in assembly language to run under Windows involves an enormous amount of added complexity.

The Structure of a `.COM` File
DOS Interrupts