devstruggle

Code Fantasies

My perspective on software and computing was built from vibes extracted from books on the early days of the PC when Homebrew was the norm rather than the exception, when everyone who knew anything about computers probably had pretty advanced electronics skills, when HAM Radio was a common hobby for youngsters, when a kid who said he wanted a career in computing got eye-rolls from his parents and instructors. Initially, this era appealed to me mainly because computers of that time were simple enough to actually be understood from the lowest-level concept to the highest. A user practically had to understand the operation of his computer's CPU in order to use it. Running a program on some early PCs required entering commands to load data from a certain location in RAM. This was a time when a PC came with a programming environment, such as the BASIC interpreter, built-in; a user was not just allowed to build software, he was encouraged, or even expected to do so.

Something about the ethos of these early machines captures my imagination. The idea of nothing being hidden from the user, of the user himself being a master of this digital realm exposed through the glowing terminal (or chattering teletype, as the case may be) is oddly alluring. It seems that the true nature of a computer as a tool is most apparent in a machine such as the one most commonly referred to as the literal first PC, the Altair 8800.

MITS Altair 8800

The 8800 is pretty much just a CPU (an Intel 8080) and a little memory (up to 8K) with some switches on the front for you to talk to it. It seems the ultimate embodiment of an idea commonly thrown about in the early 20th century of the general purpose brain in a vat, that can do, realistcally, anything you can simultaneuosly express mathematically, and manage to fit into its limited memory.

It's precisely this sort of thing that I fantasize about when I daydream of programs I'd like to write. The simple elegance of something like a universal computing machine, like the concept described by Alan Turing haunts me. One of the most exciting concepts I've come across is the idea of emulation. Emulation is the practice of writing a computer program that behaves like a completely different computer or other hardware device. For example, using emulation software, one may play games designed to run on a Nintendo Entertainment System from the 1980s on a modern computer. The concept is that of a virtual machine, or a machine that exists only in code running within another actual computer. The program is made to behave as the actual hardware would so that for instance, unmodified, original game code intended to run on a real NES would, when read into the program, produce a playable redition of the game on the computer's screen. This idea blows my mind, not solely because of the potential for experiencing rare, obsolete hardware that I can't afford, but also because by doing the study necessary to build an emulator for a specific machine, one may gain a deep understanding of the inner workings of that machine. I imagine myself building emulators of all sorts of vintage processors like the Motorola 68000 or the Intel 8080, ultimately being able to design my own computers around them, in much the same way that Steve Wozniak famously designed the Apple I on paper.

This fascination with emulating hardware came from a chance discovery of the history of the Linux operating system. I had read of the creation of Unix at Bell Labs and was naturally enamoured with its story, when I came across a documentary on YouTube about Linus Torvalds and Linux. This lead to me reading the book Rebel Code: inside linux and the open source revolution, where I read of Mr. Torvalds building this operating system while in college, inspired in part by an educational OS called Minix which happened to be covered in a textbook by a professor named Andrew Tanenbaum. Of course I turned to Amazon and found the exact version of the book Linus would've been reading in the early '90s and began an attempt to understand operating system comstruction. It was here and in the early Linux source code (that I still barely understand) that I came across the concept of virtual memory and the idea of writing a file system. It was here that it hit me that everything that is going on at anytime in a computer is really just code that someone wrote at some point to tell a computer how to behave. NTFS, FAT32 and the like were actually described by humans who decided how these formats should be formed. During this foray into 'vintage' OSes as I read blog posts of people who had actually managed to run one of them in virtualization software, I read of a program called a floppy disk emulator. this floored me as I hadn't yet connected the dots that if one could write a file system and emulate a CPU, one could emulate a disk drive and mount and interact with it as though it were real hardware.

Although I know of the myriad emulators that exist for just about every computing platform that has ever existed and that pretty much all of them are freely downloadable, I, like probably many people interested in these topics, have become obsessed with the idea of building my own. I fantasize about gaining masterful, encyclopedic knowledge of the operation of vintage computers like the PDPs or (swoon!) the Symbolics Lisp machines and locking myself away from the world with nothing but a powerful workstation to build my own universe in code. (to be cont'd)...