Skip to content

Foundations

Counting in Twos

How a machine counts: binary, hex, two bytes together, and a minus sign made of nothing but switches.

Begin — Unit 01 →

What this is

Everything a program touches is a number, and underneath every number is a row of switches, on or off. This module is about reading that row: in twos, in hex, two bytes at a time, and when one of the switches means minus.

Nothing here is tied to a machine. It is the same pseudocode the programming modules used, with a few new words for writing a number the machine’s way.

Who it’s for

Anyone heading down into a machine, and sooner than you might expect. Assembly needs this on every line. BASIC reaches for it the moment you draw your own character. Nothing here gates a machine, though: if you would rather start a game first and come back when bits turn up, do that.

You need Working It Out first, for the arithmetic.

The shape

  • Ten fingers, two wires — why we count in tens and the machine counts in twos; the bit and the byte.
  • Four bits at a time — hex, and why it shows you the switches where decimal hides them.
  • Two bytes together — sixteen switches count to 65535, and that is where 64K comes from.
  • A minus with no minus sign — two’s complement, and why it makes subtraction free.

Next comes Working the Bits, where you stop reading the switches and start changing them.

The units

  1. 01Ten Fingers, Two WiresStart →
  2. 02Four Bits at a TimeStart →
  3. 03Two Bytes TogetherStart →
  4. 04A Minus With No Minus SignStart →