Chapter 0: Why Demystifying Computing?

“Any sufficiently advanced technology is indistinguishable from magic.”

Arthur C. Clark

What is a Computer? Revisited

For several years now you have been learning about computers and how they operate by programming them. You’ve learned at least three programming languages, JavaScript, Python, and C++, gradually using them to understand how computers process data at an increasingly foundational level.

In this book, we take that journey a lot further, going all the way down to machine code, the only language that the computer natively “speaks”. Our goal is to develop an understanding of how computers work at a foundational level - to remove the mystery about what they are doing so you can reason effectively about them. That’s why this book is titled “Demystifying Computers”.

We will still be performing the fundamental operations of input, storage, processing, and output that characterize what all computers do, but we will be working directly with the bit strings on which they operate instead of the many higher level data abstractions we have been using until now. As the course progresses, we will build some of these higher level data types ourselves from the ground up, so that we understand how they work.

We have chosen for this journey to use a famous historical computer introduced in 1975, the Altair 8800. Often referred to as “the first personal computer”, this machine was directly involved in the founding of both Microsoft and Apple, and was a harbinger of the personal computer industry that appeared in the years following its introduction.

Aside from its historical significance, it is well suited for an indepth study of how computers work because it is small enough that we can fit it completely in our heads. Since our focus here is on the logic and mathematics of computer operations, we won’t be exploring the electrical engineering aspects of the machine. But with curiousity and some personal effort, it is perfectly possible for you to investigate this in other places until you understand what every transistor and digital circuit in the machine does.

It’s All Just Bits

Computers use arithmetic and logical operations to process bit strings. Fundamentally, that’s all there is to it. It is mind-boggling to consider all of the ways computer scientists and engineers have been able to map bit strings to other things, sounds, colors, images, videos, and countless other data types, at ever increasing levels of abstraction and complexity.

Since our goal is to demystify the computer, we are going to keep things simple and largely limit ourselves to the two interpretations of bit strings that have been with us since dawn of computers - numbers and text. By the end of this course, you will have these two data types as intimate friends.

For the sake of sanity, we will be using two shorthand representations of bit strings, octal and hexadecimal. You’ve learned about these number systems in previous courses, but now you are going to have to really know them! You’ll need to be able to convert between binary, octal and hex in the blink of an eye, and to convert back and forth between them and our familiar decimal numbers before you can blink twice.

You’ll need to be comfortable with these representations and to do these conversations to be able follow along with our Altair computer as it churns bit strings from one form into another. So if you are not presently comfortable with these number systems, now is the time to become so. The exercises at the end of this chapter will help you assess if you are ready.

Bits and Bytes

The Altair is a byte addressable computer, meaning that each memory address refers to a single byte. Its registers are also either one or two bytes in size.

It is still possible to manipulate individual bits, and we will learn how to do this, but it will be done by operating on the bytes in which the bits reside.

The Intel 8080 Microprocessor

The Altair was the first of many early personal computers made possible by the Intel 8080 microprocessor. It is this microprocessor that will be our main object of study. It is an 8-bit processor with 16-bits of addressable memory. Here is a block diagram of it:

Intel 8080 block diagram

Intel 8080 block diagram

The parts of this diagram that will be particularly important for our study include:

ALU

Digital logic circuit that performs arithmetic and bitwise operations on binary integers. Abreviation for arithmetic logic unit.

register

One of seven 8-bit process registers that are part of the Intel 8080 CPU. Named A, B, C, D, E, H, and L.

accumulator

8-bit process register (register A) in which immediate ALU results are stored.

flags

8-bit status register that maintains bits recording machine state, including sign, zero, parity, and carry.

program counter

16-bit register that stores where the next instruction in a program is located.

stack pointer

16-bit register that stores the memory address for the return from a subroutine call.

The Altair 8800

Start with an Intel 8080 central processing unit, or CPU, add a clock, memory, data and address buses, and input / output devices, and you have a complete personal computer.

Altair 8800 diagram

That’s pretty much all we have with our Altair 8800, and as we will see next, its input / output devices are as elementary as they can be.

The Front Panel

Take a close look at the front panel of the Altair 8800 computer.

Altair 8800 front panel

At first, this will be the only user interface we will have with the machine.

The front panel consists of a set of switches used for input and control, and a set of lights used for output and system monitoring.

Glossary

computer

a machine that be programmed to automatically carry out sequences of arthmetic and logical operations referred to as computations.

Exercises