Diving into DOS I have

Found at: zaibatsu.circumlunar.space:70/~solderpunk/phlog/diving-into-dos.txt

Diving into DOS

I have been sinking the vast majority of my spare time recently
into writing assembly code for the ROM chip of my homebrew Z80
computer.  In parallel with this I have been doing a lot of reading
about old operating systems, especially small and simple ones, but
really anything is interesting to me.

A side effect of all this, which I mentioned on Mastodon recently,
is that I've become fairly interested in DOS for the first time in
my life.

I made what seemed like plenty of use of DOS when I was younger,
but I never really had anything like a deep technical understanding
of it.  By the time I taught myself to program circa 2000, DOS was
not really a part of everyday computing life for most people.  My
earliest DOS use was for playing games, back in an age when AU$10
shareware games on single 3.5 inch floppies was my main vector for
new entertainment.  To this end, I was happy enough moving around
the filesystem, and running SETUP.EXE to install games.  I
memorised the magic IRQ numbers for our SB16 sound card and other
peripherals so that I could get through the trickier game insalls,
with no understanding whatsoever of what an "interrupt" was.
Later, in the Win95/98 era I relied on DOS as a rescue environment.
But I never really knew what I was doing.

By the time I got into Linux and BSD, and once again spent time at
the command line, DOS was a vaugely distant memory.  As a teenager
getting into Linux in the early naughties it was basically
impossible not to pick up the habit of unthinkingly and uncritically
dismissing anything and everything vaguely related to Microsoft as
irredeemable crap, so I probably thought of DOS as quite limited
and pathetic compared to my newly discovered *nix.  Which, I
suppose, it *is*, but its unfair to be too deprecating of it.

Reading Wikipedia articles about technical aspects of DOS,
especially but not limited to the article on "Terminate and Stay
Resident" programss [1], have given me a kind of appreciation for
it.  The earliest computers I used, like the Commodore 64 and BBS
Micro, slapped you across the face with their true nature as
universal computing machines.  They boot up into interpreted
programming language environments, and the only interface for a lot
of features are PEEKing and POKEing directly into memory.  This is
great for learning, for hacking, etc. but has the consequence that
the machines are largely unusable for "normal people".  Even for
the technically inclined, they are not terribly usable, with the
general paradigm being that closing one program and opening another
involves rebooting the machine.  Modern mainstream operating
systems invert this pattern, being comparatively easy to learn and
use, but achieving this by abstracting away from any and all
underlying technical concepts (in the Win95/98 days, I used to
lament how Microsoft had tried to make it as difficult as possible
to get the computer to expose in any way the concept of a file
extension - these days, tablets and smartphones come pretty close
to hiding the very notion of *files*!).

DOS seems to live somewhere between these two extremes.  Even if
the user interface is a CLI, it is comparatively user friendly
compared to a C64.  All of your software resides on *one* disk,
which is permanently available, and even if you cannot run more
than one program at once, you can exit one program and enter
another without rebooting your machine.  It *was* possible for not
terribly technical people to use it day to day to do real work.

However, this palatable interface did not actually do an awful lot
to insulated you from the true machine underneath it, if you
actually wanted to get your hands dirty.  Using TSRs, it was
possible to "effectively hijack the operating system in varying
documented or undocumented ways" to overcome limitations and, e.g.,
achieve very limited kinds of multitasking.  DOS seems to make it
easy to do a certain limited range of "normal" activities while
simultaneously not making it impossible to go off on your own crazy
path and push the machine to its limits if you have the underlying
technical knowledge.  Xmanmonk taught me about the DEBUG command[2],
a basic (dis)assembler and hex dump program for DOS, which I never
would have imagined was there!

Of course, all of this appreciation gleaned from reading Wikipedia
articles is theoretically and possibly involves a certain degree of
rose-tinted glasses.  Happily, it's quite possible in this day and
age to get your hands dirty with DOS even if you are a hardcore
FOSS zealot, because the FreeDOS project provides a GPL licensed
implementation of the MS-DOS API with excellent compatibility with
the original.  So, I've installed FreeDOS on a VirtualBox machine
and hope to play around with it a bit over the holiday period, to
see if it really is a nice environment for the informd user to play
around with.  I'll have to see if I can get a gopher client for it,
if nothing else.

[1] https://en.wikipedia.org/wiki/Terminate_and_stay_resident_program
[2] https://en.wikipedia.org/wiki/Debug_%28command%29