2024-01-14 - Adventures in Text Interfaces
For a while now I've been curious about how full screen MS-DOS applications were made. The kind of programs that have menus, scroll bars and pop-up prompts. Stuff like Edit or the various DOS IDEs. They seemed pretty common so I assumed that there would be a lot written about them, I was wrong and that just made me more curious.
My first problem was coming up with the right terms to search for. Searching for "Text Interface" leads to a bunch of pages taking about it in an abstract sense but nothing specific. Adding "DOS" helps a little but but you still end up with a lot of general discussion. Adding "Programming" would just flood the results with discussion of DOS programming in general.
Eventually I found a page talking about programming with DOS conio and this seemed promising but it was also very confusing. For example, the page talked about the conio library but none of the functions mentioned on the page appeared in any examples of the conio library I could find. This article was talking about FreeDOS, so I assumed this was a modern implementation that did things differently.
Later I figured out that the confusion was coming from differences between different compilers. The Microsoft compiler implemented a lot of its drawing functions in graph.h, you can see it being included in all of the examples on that page. Borland had those kinds of functions in conio.h but with different names. So conio + function name didn't give any results because the conio with those functions didn't use those names and the functions with those names weren't in conio. I imagine the writer of that article used Borland back in the day which is why they associated that kind of programming with conio. Microsoft used conio for functions more related to command line programming (Where text is printed to the screen one line at a time).
This did lead me to the header files and functions that I was interested in but I still couldn't find any good examples. The compiler documentation I had did give examples of how to use the functions but nothing about how to combine them together.
Unrelated to my text mode interface searches, I've also been looking for old software and documentation on eBay. One of my saved searches was for "Programmer's guide" in an attempt to find books talking about how to program for various systems. From this search I found a book titled "C Programmer's guide to Graphics" by James W. McCord. This book is geared towards programming in graphics modes and not text mode but it did get me thinking. The book is titled "C Programmer's guide" and not "DOS programmer's guide", maybe that's my problem.
So I did some searches for "C programming text interfaces" and eventually found "User Interfaces in C" by Mark Goodwin. This book was exactly what I wanted and gave a bunch of examples of how to write text mode user interfaces for MS-DOS applications. Of course the words "text-mode" and "MS-DOS" don't appear in the title of the book.
I'm not sure why the book was titled this way. Putting "C" in the name to indicate what language it was using makes sense but why not mention what operating system it was for? It was published by Microsoft Press, did they assume that only MS-DOS users would be looking at their books? Was it just that MS-DOS was ubiquitous at this point and no one would have thought you were talking about something else?
It just goes to show that one of the problems with searching for things is that you don't know what to search for until you've found it.
At least I have some DOS text mode programming examples now.
Comments: