Computers Are Simple

A computer is a very simple thing. When you first turn it on, it goes through some sort of initialization procedure. The exact specifics of how the initialization procedure works varies somewhat depending on what kind of computer. I am going to talk about a very simple computer for the sake of explaining how simple they are.

This simple computer has a few pieces. There is the memory and the Central Processing Unit (CPU). The memory is a large array of digital memory. It holds the program and the data with which we will compute. The CPU is largely a collection of registers each of which amounts to individual, named memory locations. For instance the program counter is a register that holds the address of the next instruction that we will execute. The instruction register holds the instruction that the computer is getting ready to execute.

The initialization procedure of our hypothetical computer fetches two bytes from address FFFE hexadecimal. It loads those bytes into the program counter, which is the way that the computer keeps track of its place in a program. The next thing that the program does is load the instruction that is indicated by the program counter.

As it loads the instruction from memory into the instruction register, it increments the program counter to point to the next byte of memory. It decodes the instruction in the instruction register and decides how much more information it needs to load into the CPU and into which registers it should load the information into.

The computer then executes the operation indicated by the instruction register. It then adjusts the program counter to point to the next instruction and waits for the current instruction to complete executing so that it can repeat the process.

The instructions are extremely simple. They facilitate loading values into the various registers for later use.  They allow the programmer to be much more adaptive to the way that the host has arranged for the instructions to be displayed. The operations that they implement include loading and saving a value to memory, doing math on values, comparing two values together, among other things.

Sweet dreams, don’t forget to tell the ones you love that you love them, and most important of all, be kind.