Skip to content

Foundations

Working the Bits

The tools that change a byte one switch at a time, slide the whole row, turn a letter into a number, and carry a fraction on a machine that only counts in whole steps.

Begin — Unit 01 →

What this is

Counting in Twos taught you to read a byte. This module is about doing things to one: masking a switch out, sliding the whole row sideways, and then using those tools on the two kinds of value a game cannot do without, letters and fractions.

Who it’s for

Anyone who has finished Counting in Twos. You also need Decisions, because the bit tools share their names with the question-joining words you met there, and the difference matters.

The shape

  • Switch by switchBITAND, BITOR, BITXOR and BITNOT, and what a mask is.
  • Slide the whole row — shifting, and why it is the machine’s fastest multiply.
  • A letter is a number — character codes, the trap that "7" is 55, and why changing case is one bit.
  • Numbers that aren’t whole — floating-point, and why it can never be exact.
  • Nailing the point down — fixed-point, the answer games used.

From here the road goes down into a real machine: Meet the Machine, and the code that speaks in exactly these terms. Gates and the Adder is a side-path from here that builds the part of a processor that does the adding.

The units

  1. 01Switch by SwitchStart →
  2. 02Slide the Whole RowStart →
  3. 03A Letter Is a NumberStart →
  4. 04Numbers That Aren't WholeStart →
  5. 05Nailing the Point DownStart →