A Few Decades Late Book Reviews
DOS Internals, by Geoff Chappell
Addison-Wesley, March 1994; 768 pages, ISBN 0-201-60835-9; $39.95
DOS Internals is a very unusual book. Written by an academic whose field isn’t computer science, it is a in-depth and highly analytical look at DOS, very thorough and detailed. Significant space is devoted to exploring to the way DOS interacts with Windows (a hot topic in 1994 when the book was published).
After a chapter or two, the reader inevitably starts wondering about the book’s title. While DOS Internals sounds nice enough, something like Why DOS Is Bad for You or simply DOS Bugs would have been much better represented the content and spirit of the book. Rather than explaining the internals of DOS in a coherent manner as the title might suggest, DOS Internals uses various bugs and misbehaviors of DOS as a springboard for explaining how a particular aspect of DOS works. This method is quite effective but not entirely comprehensive.
The writing style is wry, perhaps funny or perhaps strange, depending on the reader’s taste. At any rate, the book is engaging and surprisingly easy to read for a highly technical treatise. What is lacking is an explanation of author’s research methods; this is not to imply that the book’s contents are in any way untrustworthy or suspect, but knowing exactly how the author arrived at sometimes surprising conclusions would have been helpful.
The first part of the book is devoted to DOS memory management, loosely speaking. The first three chapters interlock and deal with system configuration (especially CONFIG.SYS), system footprint, and the startup sequence. The fourth chapter is devoted to DOS memory allocation, followed by a lengthy and highly informative chapter on program execution.
These five chapters examine various aspects of DOS implementation, with numerous sidebars and small digressions. There is no overarching narrative there, but the information is well presented and thoroughly explained.
The second part of the book is highly practical. Not satisfied with Microsoft’s standard response that “it can’t be done”, the author explores how to write first TSRs and then device drivers in C. Only Microsoft C is considered, and it is questionable whether the method presented in the book is the most efficient or straightforward—but it does work.
The third part is ostensibly about extended memory management, but again manages to meander through many topics. The eighth chapter presents a highly detailed dissection of how HIMEM.SYS uses undocumented CPU features to access extended memory from real mode on 286 and 386 systems, explaining how and why these mechanisms work. Chapter 9 is then devoted to the infamous A20 line, with emphasis on how it is managed by DOS 5/6.
The next two chapters examine where extended memory comes from and how it is parceled out. This is followed by a look at HIMEM.SYS, using the published source code. Chapter 14 is about extending the XMS, i.e. hooking into the XMS handler chain. This is followed by a highly practical demonstration: a XMS monitor utility.
The last part of the book is devoted to disk management. Chapter 16 includes an in-depth explanation on how DOS manages disks, how drive letters are assigned, and disk-related IOCTLs. Emphasis is given to topic not covered in standard literature. Again this chapter is highly informative and detailed.
Chapter 17 (somewhat incongruously) deals with DOS errors, especially critical error handling. There simply doesn’t seem to have been a better place in the book for this. The final chapter synthesizes much of the material presented in the book and presents a XMS-based disk copy utility.
The final chapter of DOS Internals has a distinctly unfinished feel to it. The very last section mentions DoubleSpace, only to conclude that it is not worth paying much attention to as DoubleSpace does not significantly alter the DOS programming model. Somehow that doesn’t seem too relevant when discussing floppy disk copying via XMS.
The way the book is structured is somewhat unfortunate. There is a wealth of excellent reference material documenting various obscure interfaces, such as the various DOS/Windows communication channels or the SmartDrive control functions. The documentation sections are more or less randomly interspersed with expository material, which makes the book easier to read, but far harder to use as a reference.
For a book which came with a floppy disk containing source code, far too many pages are devoted to reprinting the disk’s contents. It is true that the source code is very heavy on comments and meant to be read, but simply duplicating the files is still a waste of paper.
Despite its flaws, DOS Internals is a brilliant book, guaranteed to bring new, often surprising facts to every DOS programmer. Although not all of the information presented in the book has immediate practical use, it is nevertheless very enlightening and explains many mysteries of DOS.