For a while now, I’ve been wanting to get into some DOS hobby programming using Open Watcom C/C++ (or maybe gcc-ia16), but, given that DOS programming was on the wane before the Internet came around, and my childhood programming stuff is either for BASIC or a copy of Microsoft C/C++ 7.0 with reference manuals but no tutorials, that was proving kind of difficult.
However, recently, I was clued into the fact that there are actually some pretty good books I could borrow for free on the Internet Archive as a way to either determine that I wanted to buy them, or just read those crucial few pages that would make other resources make sense in the mind of a more modern programmer… so here’s what I’ve found so far:
- C Programming itself
- Literally any decent learning materials will do, so I don’t want to recommend the books I just happened to use.
- Segmented memory models in C, linked lists, hash tables, and the trade-offs therein
- Borrow Microsoft C: Secrets, Shortcuts, and Solutions by Kris Jamsa from the Internet Archive’s book library and read chapters 25 (Dynamic Memory Allocation) and 28 (Understanding Memory Models) and borrow Advanced Turbo C by Herbert Schildt and read Chapter 3 (Dynamic Allocation) and Appendix A (Turbo C Memory Models). (I didn’t find either to communicate the relevant ideas ideally, but seeing the same thing explained by two different people really helps.)
Alternatively, Schildt’s Advanced C, Second Edition from the following year appears to have all the same content in the relevant sections as Advanced Turbo C does. (The first edition spends less time on those topics and I didn’t see a section on memory models in it, so I advise only consulting it if you want a dead-tree edition and can’t find any of the other suggestions from Schildt cheaply.)
- See also the Special Pointer Types for Open Watcom C/16 section of the Open Watcom 2.0 C Language Reference once you’ve had things start to click.
- If you want to buy just one book, buy one of the books by Schildt. Jamsa’s phrasing on memory models was a bit more illuminating for me, but Schildt’s no slouch there and he goes into much more detail on data structures, including implementing and comparing the strengths and weaknesses of three different ways to implement sparse arrays.
- Using VGA’s 640x480x16color planar graphics mode
- Borrow or buy Richard F. Ferraro’s Programmer’s Guide to the EGA and VGA Cards, Second Edition or Third Edition (Internet Archive links) or, if you want nicer illustrations and only need a brief introduction to EGA/VGA planar video rather than an entire book about DOS graphics, borrow The Waite Group’s Microsoft C programming For The PC, Second Edition by Robert Lafore and read chapter 11 (Direct-Access Graphics).
- If you want to buy something, go for the second edition of Ferraro’s book. It’ll get you 500 pages on EGA and VGA and 500 pages on SVGA, including VESA and model-specific extensions offered by cards like the ATi VGA Wonder and the Tseng ET4000. The third edition is rarer and more expensive, has cover art that, in my opinion, has aged much more poorly, and what you’re paying for is having twice as many vendors covered in the part of the book about how to use model-specific SVGA stuff not covered by VESA… but, if you’ve got the cash and you’re going to be writing enough demoscene code for things like the XGA, the 8514/A, or S3 SVGA cards, the third edition may be worth buying.
- See also chapter 2 (Icon-Based Interfaces) of The Craft of C by Herbert Schildt.
- Using 256-color linear graphics modes on VGA and reading the mouse
- Read David Brackeen’s 256-Color VGA Programming in C. (It’s a free series of online tutorials with source downloads for DJGPP and “Borland C, Turbo C, etc.”)
- If that’s not enough, borrow Richard F. Ferraro’s Programmer’s Guide to the EGA and VGA Cards, Second Edition or Third Edition from the Internet Archive for the video and read Chapter 9, “Interfacing to the Mouse” of Herbert Schildt’s C Power User’s Guide (alt) (apparently also sold as “The Art of C: Elegant Programming Solutions”). (Schildt also covers using the PC speaker.)
- Playing music on an Adlib-compatible sound card
- Download Programming the AdLib/Sound Blaster v2.0 (A.K.A.
adlf.zip) from the Internet Archive. (local copy)
- Playing digital audio on a SoundBlaster-compatible sound card
- Download SoundBlaster Programming Information v0.90 (local copy), Soundblaster programming routines (C++ src) (utility code under MIT-like license terms) (local copy), and Programming the SoundBlaster 16 DSP (local copy).
- I’m not recommending a print book because, as far as I can tell, reverse-engineered free eBooks by hardware hackers are the only place to find info that doesn’t assume you bought the SDK from Creative Labs.
- Reading from the PC Gameport
- Read ePanorama.net – PC analogue joystick interface.
- DOS/BIOS interrupt API reference
- See Ralf Brown’s Interrupt List (alt, download).
- Turbo Vision API documentation
- When Borland released the source code for the C++ version of their Turbo Vision TUI library and the Free Pascal people ported it back to Pascal as Free Vision, neither released API documentation.
- The recommended Borland Turbo Vision Version 2.0 Programming Guide from Turbo Pascal 7.0 is in the Internet Archive’s collection. However, the Turbo Vision Programming Guide from Turbo Pascal 6.0 is a decent runner-up if you can’t use it for some reason.
- Assembly Language
- I’m still working on this, but John Socha and Peter Noton’s Assembly Language for the PC, Third Edition looks like a good candidate.
- Everything else I’ve been interested in about DOS programming so far
- Start by borrowing The Craft of C by Herbert Schildt and The C Toolbox, Second Edition by William James Hunt from the Internet Archive’s library. (Among other things, the former covers TSRs in C, writing a rudimentary C interpreter, basic EGA graphics, interacting with the DOS mouse drivers, implementing a screen editor, and building an icon-based interface and icon and bitmap font editors while the latter covers other useful things like TUI popup windows and using the serial port.)
- If you want another book that I found useful, Herbert Schildt’s C Power User’s Guide (alt) (apparently also sold as “The Art of C: Elegant Programming Solutions”) has a fair bit of useful non-overlap. Its chapters cover TUI pop-up and pull-down menus and pop-up windows, writing TSRs in C, Mode 4 (CGA) graphics including 2D rotation, basic DOS game development, using the serial port, writing a rudimentary BASIC interpreter, miscellaneous text-mode stuff like using color and changing the text cursor size, controlling the PC speaker, interacting with DOS mouse drivers, and drawing bar graphs.
Beyond that, you’re into more advanced stuff:
- Michael Abrash’s Graphics Programming Black Book (HTML, Markdown sources for making ePub/Mobi files)
- Undocumented DOS (2nd ed.)
- The Undocumented PC (2nd ed.)
- References for things like VESA and software 3D scattered around places like the Wayback Machine archive of STEEL’s Programming Resources.
I hope this helps you and you may also want to check out my Useful Info On Win16-Targeting Compilers… And a List of DOS/Win16 Resources post and my similar list of learning materials for Windows 3.1.