Lesson 8: Machine Code & Assembly
We saw that the CPU runs instructions through the fetch-decode-execute cycle, but what exactly is inside those instructions? At the very bottom is machine code — a stream of 0s and 1s where each instruction is made of an opcode (which operation to perform) and operands (what to perform it on). Human
Machine code is 0s-and-1s instructions the CPU runs. Assembly is those exact same instructions, but written with short names people can read — like 'ADD' instead of a row of zeros and ones.
- Machine Code
- Binary instructions (sequences of 0s and 1s) the CPU executes directly, with no further translation.
- Opcode
- The part of an instruction that says which operation to perform (add, copy, jump). The name is short for Operation Code.
- Operand
- The part of an instruction that names what to act on: a register, a numeric value, or a memory address.
- Instruction Set Architecture (ISA)
- The contract that defines every instruction a CPU can run and how each is encoded; real examples are x86 and ARM.
- Assembly
- A human-readable, one-to-one representation of machine code: each assembly line corresponds to one machine instruction.
- Mnemonic
- The short name of an operation in assembly, such as MOV, ADD, or JMP, that stands in for the binary opcode.
- Register
- A tiny, extremely fast storage cell inside the CPU itself, holding the values that instructions operate on.
- Instruction Encoding
- The exact binary pattern a mnemonic plus its operands turns into so the CPU can execute it.
- RISC vs CISC
- Two approaches to ISA design: RISC with few simple instructions (like ARM), CISC with many complex instructions (like x86).
- Jump / Branch
- An instruction that changes which instruction runs next — sometimes conditionally — implementing loops and conditionals in machine code.