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
A byte holds eight bits. A program can read those bits as an unsigned number, a character code or part of a picture. Here we change selected bits, shift the row, and compare two ways to represent fractions.
Who it’s for
You will use binary place values, small sums and yes/no comparisons. We recall the relevant rules as we use them. Counting in Twos offers more practice with bytes and their readings; Decisions explains joined questions. The bit tools and question-joining words have different jobs, which the first unit separates. Prior attendance is not required. BASIC and assembly remain independent entry points.
The shape
- Switch by switch —
BITAND,BITOR,BITXORandBITNOT, and what a mask is. - Slide the whole row — logical shifts within a chosen width, when they match arithmetic, and why speed depends on the processor and instructions.
- A letter is a number — character codes, the difference between ASCII
"7"and the number 7, and the range checks that make a case-changing mask useful. - Numbers that aren’t whole — binary floating-point: some fractions fit exactly, while others need rounding within the format’s precision and range.
- Nailing the point down — fixed-point: agree a scale, read the stored value, and choose precision, range and rounding for the job.
A system track explains its language’s operations and representation rules. Use these ideas alongside a real program, or return when a game gives you a reason to inspect its bits. Gates and the Adder is an optional look at a Boolean model of arithmetic beneath the instructions.