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

Programs represent data with bit patterns. We can read a pattern as a number, a character or part of a picture; the program decides what it means. This module starts by reading whole numbers with no minus sign: in twos, in hex and two bytes at a time. Later we give some of the same patterns a negative-number reading.

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 will add small whole numbers and double place values: 1, 2, 4, 8 and so on. We show those steps locally. Working It Out offers more arithmetic practice if you want it; prior course attendance is not required.

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 — the unsigned range 0–65535 and a 64K address space.
  • A minus with no minus sign — two’s complement, and how addition can also subtract.

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