Module 6 · Fetch, Decode, Do It Again

What does a program look like to the processor?

Lesson 6.1 · A List of Tiny Steps

Sarah · Jenny · Mark

Load. Add. Store. That’s a whole program.

Sarah expects the processor to see something like an app.

Jenny shows her what it actually sees for “add the price and the tax and save the total”: three instructions so small they look like a joke.

Load a number. Add another number. Store the answer. Mark asks how anyone could write a whole game that way.

Jenny says mostly, people don’t anymore. Computers write those steps for them.

The short answer

A long list of tiny numbered instructions sitting in memory: load this, add that, store it there. No apps, no words, no pictures. Just steps, one after another, which is why everything depends on how fast it can take the next step.

Try it yourself

Step through the program the processor actually runs to add a price and tax.

AddressWhat’s there
10price: 20
11tax: 2
12total: 0

Memory holds the numbers: the price is 20 and the tax is 2. The total spot is empty.

Step 1 of 5

What you just did has a name

Machine instructions

Machine instructions are the tiny commands a processor can carry out directly: load a number from memory, add two numbers, store a result, jump to a different instruction.

Each type of processor has its own short list, called its instruction set.

Every app, game and website eventually turns into long lists of these before the processor can run it.

A few more things

Really small steps

One instruction might add two numbers or copy one number. Showing a single letter on screen can take thousands of instructions.

People write in bigger steps

Programmers write in languages like Python or JavaScript, where one line can mean thousands of instructions. A program called a compiler or interpreter does the translating. Module 17 is about it.

Stored like data

Instructions are numbers in memory, right next to the data. LOAD might be 0001 and ADD 0010. The processor reads them like any other bytes.

Go deeper

The longer version, if you want it.

Assembly language

The words LOAD, ADD and STORE are a human-friendly way to write instructions, called assembly language. Each word stands for one numeric instruction the processor understands.

In the early days, programmers wrote everything in assembly, or straight in numbers. Some still do for tiny devices or the fastest parts of games. Most people never have to, which is the whole point of Module 17.

Quick check

What does a single machine instruction usually do?

Let’s take it slower

Imagine giving directions to someone who can only do one microscopic thing at a time. Not “go to the store,” but “lift left foot, move it forward, put it down.” That’s how a processor gets told things. It sounds painful, but it can do a few billion of those per second, so even very long lists get done instantly.

More examples

1

Pressing a key

One keypress becomes thousands of instructions: read the key, look up the letter, find where it goes, draw the shape, update the cursor.

2

A calculator app

Tapping 7 + 5 = runs a handful of load and add instructions for the math, and thousands more to draw the buttons and the answer.

Back to the question

So what does a program look like to the processor?

Show the answer

A long list of tiny numbered instructions sitting in memory: load this, add that, store it there. No apps, no words, no pictures. Just steps, one after another, which is why everything depends on how fast it can take the next step.

More on this: CPU vs. GPU: what’s the difference?

One last question

Put the instructions in order to add two numbers and save the answer.

Tap the pieces in order. Tap one again to take it back.

…
Talk Card

Talk Card · 6.1

A processor runs machine instructions: tiny steps like load, add, store and jump. Every app eventually becomes millions of them.

How Computers Work · pettigrewlab.com/learn

Next lesson