The year was 1978. I remember the first time I saw a computer. It has a bank of switches on a sloping panel and row of lights across the top. Inside it was a mass of wire and integrated circuits. The owner, Mr. A, was a retired electronics expert who use to work for an observatory. He built it from a kit as an exercise to learn about computers. You see, I had a crush on his daughter and shamelessly used that as a pretext to look at his computer.
Anyway, I was 15 and I didn’t have a clue how the computer worked. I barely knew what digital electronics was. The only logic I knew was what I’d gleamed from digital electronics. But, Mr. A was a kind old gentleman and he had learned all he was going to from the dark box so he generously lent it to me. The great thing was that it came with a bunch of instruction manuals with everything from how to build it to how to run it; all laid out for a young mind to absorb.
Well, the first thing I learned was what all those switches did. There was the memory switches arranged in two panels of eight switches across and eight rows down. Imagine, you could physically set each bit of memory; a whole sixteen bytes of it. That’s what I call ROM with an attitude. Then, there was the Reset button, the Step button and the Run button on the right about half way up the front panel. There was also a speed switch for fast or slow beside the buttons. Below these were eight address/data switches and two buttons: one for setting the address of the instruction pointer and other for writing eight bits of data to one of the 16 bytes of RAM. There was also a Power switch down in the lower left-hand corner. The first thing I learned was when you turned the power on, you could give yourself a small, non-fatal shock by touching the frame of the computer. You see, when Mr. A built the computer, the power supply had not been grounded properly.
There was also a cryptic table stencilled onto the front panel just right of the memory switches and just above the other buttons and switches. I later learned that it was the op codes for the limited instruction set you could use to program the computer. Fascinating. A secret language that only a few special people knew. Every kid’s dream.
Now to the lights. There was the accumulator (ACC): eight lights on the left. One light was the carry bit and another the zero bit. The instruction pointer (IP) was the next five lights. And last was the fetch/execute light. The lights were mesmerizing since when you pushed the Step button the pattern of lights in the ACC would shifted right, sometimes the IP would count upward (in binary) and the fetch/execute light would blink away. When you set the Speed switch to slow and press the Reset button then the Run button and it would come alive. I had no idea what it was doing or what it meant but it was a thing of beauty.
Putting it all together. I had achieved step one: I was a computer user. I could run the computer but that wasn’t enough. I had to have control over what it did. Step two: becoming a programmer. I learned that by setting the memory switches with the correct op codes the computer could be programmed to do useful work. It took a lot of imagination but I could see patterns emerge from the mist of ignorance.
First, there’s the computer’s native language: binary. If you want to know how a computer works you have to learn binary. The only two digits in binary are zero (0) and one (1). By combining 0 and 1 in to a pattern of eight digits (called a byte) you get the decimal (regular, every day) number from 0 to 255. Now here’s the neat part. The lights can be on or off. When a light is on it represents the digit 1 and when the light is off it represents the digit 0. So just by turning the ACC lights on and off you can have 256 different patterns; each pattern representing a number. Oh yeah, the same applies to the memory switches. When the switch is up (on) it mean 1 and when the switch is down (off) it means 0. Welcome to the world of digital electronics.
Let me digress for a moment. Now binary numbers are the same a decimal (normal) number because they are isomorphic. That is to say you can convert from one to another without getting all mixed up. Computers love numbers. Everything in the computer is numbers. Op codes are numbers; letters are numbers; the address of every byte of memory in the computer is a number. Even the pretty pictures you get off the web are really just numbers. The neat thing about numbers is that you can put them one after another to create a context in which the numbers give raise to meaning.
Ok. The foundation of computer’s architecture is the hardware. This is the grossest possible context. It does everything that a computer is capable of doing. In the world of computer hardware, there are only switches (called bits) that can be turned on or off. Billions of them. Some work in unison like the video RAM to give you a screen full of information all at once. Some work by coaxing the various parts of your hard drive to spin and grind until it gets to a useful place where your pr0n is stored. Some you can set by typing on a keyboard or pushing your mouse around.
The next level in the computer’s architecture is the software. This is a sequence of numbers know as op codes (collectively called a program) that tell the computer, given that some bits are on or off, how to turn on and off the various other bits. The op codes only make sense in the context of the central processing unit (CPU) which is at the heart of the computer hardware. Random access memory (RAM) is the very place where the op codes, among other things, are stored. This leads to levels with in levels since a small program (boot strap loader) can load a larger program (kernel) that loads a larger program (desktop GUI) that loads your favourite game.
The top level of the computer’s architecture is the data. Data only makes sense in the context of a program and the “state” of the computer. When you type the “A” key on the keyboard, it eventually under most circumstances gets stored in memory as the number 65 (binary 01000001) and the only reason you can see it is because you are using a word process (or some such program) that tells the OS to draw a picture of the 65th image in the “Times New Roman” font onto the graphics screen. The actual data of the “A” you see is really just a bunch of bits set to look approximately like the shape of the letter “A”. It has very little to do with the bits that were set when you typed the “A” except that the program interpreted the context and took appropriate action.
Let’s get back to the story. Second, there are the op codes: instructions that Mr. A’s computer can follow. All the op codes were one byte long and most had two parts: the instruction field (3 bits) and the address field (5 bits). The most useful instruction was LOAD. This would take the data at the specified memory address and move it into the ACC. There was also the reverse instruction: SAVE that moved the ACC to a memory location. (Of course, you could only do this with a RAM address.) One of the most useful instructions was ADD. It would take the data at the specified address and mathematically add it to the ACC. There was also the JZ (jump on zero) instruction that changed the IP to the specified address if the ACC value was zero but I’m getting ahead of myself. You see, the computer looks at the op codes one at a time. Only looking at the instruction pointed to by the IP. Since every memory location has a numeric address, it is easy for the computer to keep track of were it is currently working. The computer does its work in two steps: fetch and execute. In the fetch stage, the computer reads the memory location at the IP. Then, when executing, it is changes the ACC or RAM or IP: whatever the op codes says. After each fetch the IP is increased by one so that after executing the current instruction it will fetch and execute the next instruction. You can explicitly change the IP with a jump instruction, this is what we call flow control in a program and determines the order in which things get done.
So that’s how a computer works. Things haven’t changed much since 1978 except that there are more instructions, faster CPUs, more memory and a host of devices that extend the usefulness of your computer.
As for Mr. A’s daughter, I never saw her much after I got my first computer. I hope she found a nice boy to marry and have lots of kids. I’ll never forget her or Mr. A’s computer. You never forget your first love.