# Assembly language and the assembler: from Booth's notation to RISC-V, byte by byte

> Assembly language is machine code written so a person can read it: one line, one instruction, a mnemonic for the operation and names for the registers and addresses it works on. The assembler is the program that turns those lines back into bytes. This article takes the subject from the processor's side, with every encoding taken from the architecture manuals themselves (the Intel SDM, the Arm Architecture Reference Manual, the RISC-V unprivileged specification, the Zilog Z80 and MOS 6500 manuals): what machine code is; opcodes, operands, registers, flags and addressing modes; the same small program hand-assembled for x86-64, AArch64 and RISC-V and checked byte by byte; the Z80 and the 6502 of the home-computer era; how an assembler works in two passes with its symbol table, directives and macros, and what the linker and loader do after it; the history from Kathleen Booth's 1947 notation and the EDSAC's initial orders to IBM's SOAP and SPS; Intel and AT&T syntax; where assembly still lives; why WebAssembly only borrowed the name; and the security thread, from disassembly to return-oriented programming and the defences built into today's processors. After reading, you can encode and decode a handful of instructions by hand on three architectures, compute a branch offset in each, run the two passes of an assembler on paper, read a disassembly listing and say which defences answer which attack.

Source: https://ronutz.com/en/learn/assembly-language-and-the-assembler  
Updated: 2026-11-23

---

A processor does not read words. It reads numbers from memory, one instruction after another, and each number tells it what to do next: add these two registers, compare this value with zero, jump back twelve bytes. Those numbers are machine code. Assembly language is the same program written so a person can read and write it: one line for each instruction, a short name (the mnemonic) for the operation, names for the registers, labels instead of addresses. The assembler is the program that turns the text back into the numbers. This article starts at the bytes and works outwards, with every opcode and encoding taken from the architecture manuals read on 23 November 2026, and it builds on two pieces already here: [byte order](https://ronutz.com/en/learn/big-endian-and-little-endian), because instruction words are stored in one, and [how a WebAssembly tool works](https://ronutz.com/en/learn/how-a-webassembly-tool-works), because WebAssembly is a different thing that borrowed the name (the section near the end says exactly how). The companion post, [The bytes under everything](https://ronutz.com/en/blog/the-bytes-under-everything), tells the stories. After reading, you can encode and decode a handful of instructions by hand on three architectures, compute a branch offset on each, run an assembler's two passes on paper, read a disassembly and match each modern defence to the attack it answers.

**In short:** machine code is the bit pattern the processor executes; assembly language is a one-for-one textual form of it; the assembler translates the text, resolves labels into addresses with a symbol table, and leaves the rest to a linker and a loader. Three architectures show three philosophies: x86-64 packs instructions into 1 to 15 bytes with prefixes and a ModR/M byte, AArch64 and RISC-V use fixed 32-bit words with fields at fixed places. The same eight-line function is 16 bytes on x86-64 and 28 on the other two.

## What machine code is

A program in memory is a sequence of bytes, and the processor's instruction set architecture (ISA) is the contract that says what each pattern means. The Intel 64 and IA-32 Architectures Software Developer's Manual (SDM) describes its format as "optional instruction prefixes (in any order), primary opcode bytes (up to three bytes), an addressing-form specifier (if required) consisting of the ModR/M byte and sometimes the SIB (Scale-Index-Base) byte, a displacement (if required), and an immediate data field (if required)" ([Intel SDM, Vol. 2A, p. 2-1](https://cdrdv2-public.intel.com/929349/325462-093-sdm-vol-1-2abcd-3abcd-4.pdf)). An instruction can therefore be one byte long or many; the SDM lists "exceeding the instruction length limit of 15 bytes" among the conditions that raise a general-protection exception (Vol. 3A, p. 7-44).

Arm's 64-bit instruction set takes the opposite route. The Arm Architecture Reference Manual states that "A64 instructions have a fixed length of 32 bits and are always little-endian" ([Arm ARM, DDI 0487 M.d, section B2.9.2, p. B2-316](https://documentation-service.arm.com/static/6abbec2a6db85c5e6614a4a1?token=)), and the same manual describes Arm as a reduced instruction set computer (RISC) architecture with a large uniform register file, a load/store design in which data-processing operations work only on registers, and simple addressing modes (p. A1-41). RISC-V, whose specification says it was "originally designed to support computer architecture research and education" ([RISC-V Unprivileged ISA, version 20250508, p. 12](https://github.com/riscv/riscv-isa-manual/releases/download/20250508/riscv-unprivileged-20250508.pdf)), also uses 32-bit base instructions, and its manual adds a detail that matters for anyone reading a memory dump: "Instructions are stored in memory as a sequence of 16-bit little-endian parcels, regardless of memory system endianness" (p. 19).

So the first fact of machine code is that it has a byte order. The AArch64 instruction word `D2800001`, which the next sections build by hand, sits in memory as the four bytes `01 00 80 D2`, lowest address first. The Intel SDM states the same rule for the multi-byte values inside an x86 instruction: "All words, doublewords, and quadwords are given with the low-order byte first" (Vol. 2A, p. 3-2), and it calls Intel 64 processors "little endian" machines (Vol. 1, p. 1-6). The [byte order article](https://ronutz.com/en/learn/big-endian-and-little-endian) explains why that convention exists; here it is simply the reason a hex dump of code looks backwards.

## Assembly language: one line, one instruction

Intel's manual defines the notation it uses throughout, and the definition doubles as the best short description of an assembly language: "When instructions are represented symbolically, a subset of the IA-32 assembly language is used. In this subset, an instruction has the following format: label: mnemonic argument1, argument2, argument3", where "A label is an identifier which is followed by a colon" and "A mnemonic is a reserved name for a class of instruction opcodes which have the same function"; the operands are optional, from zero to three, and "When two operands are present in an arithmetic or logical instruction, the right operand is the source and the left operand is the destination" (Vol. 1, p. 1-7).

IBM explained the same idea to its customers more than sixty years earlier. The manual of the IBM 1401 Symbolic Programming Systems (SPS), copyrighted 1959, 1960 and 1962, says that "Symbolic programming, the use of mnemonic characters to write a program, has been developed to facilitate computer programming", and it shows a payroll fragment in both forms: the symbolic lines `ZA CURWTX ACCUM`, `A TOTMDN ACCUM`, `ZA GROSS NETPAY`, `S ACCUM NETPAY`, and the machine-language version with numeric addresses. The program written in symbols "(the source program) requires translation into an actual machine-language program (the object program)", done by "a processor", and "In general, the translation is 'one-for-one.' That is, for each instruction written in symbolic form, one machine-language instruction is produced. The processor, sometimes called an assembly system, generally utilizes the machine for which the symbolic program is written" ([IBM, C24-1480-0, p. 5](https://bitsavers.org/pdf/ibm/1401/C24-1480-0_1401symbPgmSys.pdf)).

That one-for-one relation is what separates assembly from the languages a [compiler](https://ronutz.com/en/glossary/compiler) translates. A line of C may become a dozen instructions; a line of assembly becomes one, and a disassembler can usually turn the bytes back into the same line. Two words are worth keeping apart from the start. The *assembly language* is the notation; the *assembler* is the program that translates it. In Brazil the two have long shared one word: the magazine *Micro Sistemas* called the language itself "Assembler" in 1982, and the Portuguese word for the tool is *montador* (the Brazilian section below has the sources).

## The vocabulary: opcodes, operands, registers, flags and addressing modes

**Opcode.** The part of an instruction that says which operation to perform. On x86 it is one to three bytes, sometimes completed by three bits of the ModR/M byte; the SDM writes `/digit` when "the reg field contains the digit that provides an extension to the instruction's opcode" and `/r` when "the ModR/M byte of the instruction contains a register operand and an r/m operand" (Vol. 2A, p. 3-2). On AArch64 and RISC-V the opcode is a set of fixed bit fields inside the 32-bit word: RISC-V puts a 7-bit `opcode` in bits 6 to 0 and refines it with `funct3` and `funct7` ([RISC-V, chapter 35, p. 609](https://github.com/riscv/riscv-isa-manual/releases/download/20250508/riscv-unprivileged-20250508.pdf)).

**Operands.** What the operation works on: registers, an immediate value carried inside the instruction, or a memory location. The encodings say which kind is allowed where.

**Registers.** The processor's own small, fast storage, named in the instruction. In 64-bit mode an x86-64 processor has 16 general-purpose registers (Intel SDM, Vol. 1, p. 3-12), numbered 0 to 7 in the 3-bit fields of the ModR/M byte (`RAX` 000, `RCX` 001, `RDX` 010, `RBX` 011, `RSP` 100, `RBP` 101, `RSI` 110, `RDI` 111; Vol. 2A, Table 2-2, p. 2-6), with an extra bit in the REX prefix reaching the other eight. AArch64 has "31 64-bit general-purpose registers, of which X30 is used as the procedure link register" (Arm ARM, p. A1-44), and register number 31 in an operand field means either the stack pointer or a zero register, depending on the instruction (p. B1-209). RISC-V has 32 `x` registers, and "Register x0 is hardwired with all bits equal to 0" (RISC-V, p. 23). The Zilog Z80 has "two sets of six general purpose registers which may be used individually as either 8-bit registers or as 16-bit register pairs" besides its accumulators and flag registers ([Zilog, Z80 CPU User Manual UM008005-0205, p. 1](https://archive.air.in.tum.de/pub/Main/TeachingWs2009Echtzeitsysteme/um0080.pdf)), and the MOS 6502 has one accumulator and two index registers, X and Y.

**Flags.** Single bits the processor sets after an operation so that a later instruction can test them. On x86, the zero flag "ZF (bit 6)" is "Set if the result is zero; cleared otherwise" (Intel SDM, Vol. 1, p. 3-16); `DEC` leaves the carry flag alone and sets "The OF, SF, ZF, AF, and PF flags ... according to the result" (Vol. 2A, p. 3-262). AArch64 has condition flags too, but only some instructions touch them: `SUBS` "updates the condition flags based on the result", while `CBZ` "does not affect condition flags" (Arm ARM, pp. C6-2837 and C6-1943). RISC-V has no flags register at all for integer comparisons: its branch instructions compare two registers and jump in a single step, as the listings below show.

**Addressing modes.** The ways an operand can name its value: in a register, as an immediate, at an address built from a register and a displacement, or relative to the program counter. The SDM's Table 2-2 enumerates every 32-bit form the ModR/M byte can express, from `[EAX]` to `[EDI]+disp32` and the eight plain registers (Vol. 2A, p. 2-6). The 6502 has a "zero page" mode that reaches the first 256 bytes of memory with a one-byte address, and its manual lists the instructions that allow it (LDA, STX, ADC and others; [MOS Technology, MCS6500 Microcomputer Family Programming Manual, January 1976, p. 63](https://archive.org/download/mos_microcomputers_programming_manual/mos_microcomputers_programming_manual.pdf)).

## Worked example 1: one x86-64 instruction, encoded by hand

Take `add rax, rdi`: add the value in RDI to RAX. The SDM's ADD page lists the row `REX.W + 01 /r   ADD r/m64, r64   Add r64 to r/m64` (Vol. 2A, p. 3-14). Reading it:

1. `REX.W` is a prefix. The REX byte has the bit pattern `0100WRXB`, and W = 1 means "64 Bit Operand Size" (Vol. 2A, Table 2-4, p. 2-9). With R, X and B at 0 the byte is `0100 1000`, that is `48`.
2. `01` is the opcode byte.
3. `/r` says a ModR/M byte follows, holding a register operand in its `reg` field and a register-or-memory operand in its `r/m` field. The ModR/M byte is `mod` (2 bits), `reg` (3 bits), `r/m` (3 bits) (Figure 2-1, p. 2-1).
4. The destination is the `r/m64` operand, RAX, so `r/m` = 000; the source is the `r64` operand, RDI, so `reg` = 111; both are registers, so `mod` = 11.
5. `11 111 000` in binary is `F8`. Table 2-2 confirms it: in the row for EAX/AX (mod 11, r/m 000) and the column for EDI (reg 111) the value is F8.

The instruction is three bytes: `48 01 F8`.

Now `xor eax, eax`, the usual way to clear a register. The row is `31 /r   XOR r/m32, r32` (Vol. 2D, p. 6-40). Both operands are EAX: `mod` 11, `reg` 000, `r/m` 000, so the ModR/M byte is `C0` and the instruction is `31 C0`. It names the 32-bit register, yet it clears all 64 bits, because in 64-bit mode "32-bit operands generate a 32-bit result, zero-extended to a 64-bit result in the destination general-purpose register" (Vol. 1, p. 3-13). That one sentence of the manual is why compilers emit the two-byte form instead of a three-byte one with REX.W.

## Worked example 2: the same function on three architectures

The function adds the numbers from `n` down to 1 and returns the sum, a loop small enough to encode by hand and large enough to need a label, a conditional branch, a register that accumulates and a return. In C:

```text
unsigned long sum(unsigned long n) {   // n arrives in the first argument register
    unsigned long s = 0;               // the running total
    while (n != 0) { s += n; n--; }    // add n, count down, stop at zero
    return s;                          // the result leaves in the return register
}
```

Where `n` arrives and where the result must be left is not decided by the processor but by the calling convention of the platform's application binary interface (ABI). On Linux and other System V systems, integer arguments go in "the next available register of the sequence RDI, RSI, RDX, RCX, r8 and r9" and integer results come back in RAX ([x86-64 psABI, low-level-sys-info.tex](https://gitlab.com/x86-psABIs/x86-64-ABI/-/raw/master/x86-64-ABI/low-level-sys-info.tex)); Microsoft's x64 convention passes the first four integer arguments in "RCX, RDX, R8, and R9" instead ([Microsoft Learn, x64 calling convention](https://learn.microsoft.com/en-us/cpp/build/x64-calling-convention)). The same processor, two conventions: the instructions below follow System V. On AArch64, "The first eight registers, r0-r7, are used to pass argument values into a subroutine and to return result values from a function" ([Arm, Procedure Call Standard for the Arm 64-bit Architecture (AAPCS64)](https://raw.githubusercontent.com/ARM-software/abi-aa/main/aapcs64/aapcs64.rst)); on RISC-V, `x10` to `x17` are the argument registers `a0` to `a7`, "the first two of which are also used to return values", and `x1` is `ra`, the return address ([RISC-V ABIs Specification, calling convention](https://raw.githubusercontent.com/riscv-non-isa/riscv-elf-psabi-doc/master/riscv-cc.adoc)).

### x86-64

```text
; x86-64, Intel syntax, System V: n in RDI, result in RAX
sum:                    ; the function's label
        xor eax, eax    ; 31 C0     clear RAX (the 32-bit result is zero-extended)
        test rdi, rdi   ; 48 85 FF  AND RDI with itself, set ZF if n is zero
        jz done         ; 74 08     n == 0: skip the loop
loop:                   ; the loop's label
        add rax, rdi    ; 48 01 F8  s += n
        dec rdi         ; 48 FF CF  n -= 1, sets ZF when n reaches zero
        jnz loop        ; 75 F8     not zero yet: go back
done:                   ; the exit label
        ret             ; C3        return to the caller, result in RAX
```

Every byte comes from a row of the SDM: `31 /r` XOR (Vol. 2D, p. 6-40); `REX.W + 85 /r` TEST r/m64, r64, which does "AND r64 with r/m64; set SF, ZF, PF according to result" (Vol. 2B, p. 4-721); `74 cb` JZ rel8 and `75 cb` JNZ rel8 (Vol. 2A, p. 3-499); `REX.W + 01 /r` ADD (p. 3-14); `REX.W + FF /1` DEC r/m64 (p. 3-262), where `/1` puts 001 in the `reg` field, so with RDI in `r/m` the ModR/M byte is `11 001 111` = `CF`; and `C3` RET, "Near return to calling procedure" (Vol. 2B, p. 4-569). The total is 16 bytes.

**The branch offsets, by hand.** The SDM says that for a conditional jump "the target instruction is specified with a relative offset (a signed offset relative to the current value of the instruction pointer in the EIP register)", that it "is generally specified as a label in assembly code, but at the machine code level, it is encoded as a signed, 8-bit or 32-bit immediate value, which is added to the instruction pointer" (Vol. 2A, p. 3-502). When the jump executes, the instruction pointer already points past it. Lay the bytes out: `xor` at 0x00 (2 bytes), `test` at 0x02 (3), `jz` at 0x05 (2), `loop:` at 0x07, `add` at 0x07 (3), `dec` at 0x0A (3), `jnz` at 0x0D (2), `done:` at 0x0F, `ret` at 0x0F.

- `jz done`: the next instruction starts at 0x07 and the target is 0x0F, so the offset is 0x0F − 0x07 = +8, encoded `08`.
- `jnz loop`: the next instruction starts at 0x0F and the target is 0x07, so the offset is 0x07 − 0x0F = −8. In 8-bit two's complement, −8 is 256 − 8 = 248 = `F8`.

### AArch64

```text
// AArch64, AAPCS64: n in X0, result in X0
sum:                        // the function's label
        mov x1, #0          // D2800001  MOVZ: X1 = 0, the running total
        cbz x0, done        // B4000080  n == 0: skip the loop (flags untouched)
loop:                       // the loop's label
        add x1, x1, x0      // 8B000021  s += n
        subs x0, x0, #1     // F1000400  n -= 1 and set the flags
        b.ne loop           // 54FFFFC1  not equal to zero: go back
done:                       // the exit label
        mov x0, x1          // AA0103E0  ORR X0, XZR, X1: copy s to the result
        ret                 // D65F03C0  branch to the address in X30
```

The Arm ARM prints each encoding as a diagram of bit fields, and every word above is those fields filled in:

- MOVZ (C6.2.285, p. C6-2453): `sf 10 100101 hw imm16 Rd`. With sf = 1 (64-bit), hw = 00, imm16 = 0 and Rd = 1: `1 10 100101 00 0000000000000000 00001` = `D2800001`. The assembler accepts `mov x1, #0` because MOVZ "is used by the alias MOV (wide immediate)".
- CBZ (C6.2.78, p. C6-1943): `sf 011010 0 imm19 Rt`, with the label's offset "encoded as imm19 times 4" from the address of the CBZ itself.
- ADD, shifted register (C6.2.6, p. C6-1815): `sf 0 0 01011 shift 0 Rm imm6 Rn Rd`; for `add x1, x1, x0`, Rm = 0, Rn = 1, Rd = 1: `8B000021`.
- SUBS, immediate (C6.2.464, p. C6-2837): `sf 1 1 100010 sh imm12 Rn Rd`; imm12 = 1, Rn = Rd = 0: `F1000400`.
- B.cond (C6.2.34, p. C6-1862): `01010100 imm19 0 cond`, where NE is `0001` in the table of conditions on the same page.
- MOV, register (C6.2.282, p. C6-2447), an alias of ORR with the zero register as the first source: `AA0103E0` for `mov x0, x1`.
- RET (C6.2.338, p. C6-2562): `1101011001011111000000 Rn 00000`, where Rn "Defaults to X30 if absent": `D65F03C0`.

**The branch offsets, by hand.** Every instruction is 4 bytes: `mov` at 0x00, `cbz` at 0x04, `loop:` and `add` at 0x08, `subs` at 0x0C, `b.ne` at 0x10, `done:` and `mov` at 0x14, `ret` at 0x18. AArch64 measures from the branch instruction itself, not from the next one.

- `cbz x0, done`: 0x14 − 0x04 = +16 bytes = 4 words, so imm19 = 4. Placed at bits 23 to 5: `4 << 5 = 0x80`. The word is `B4000000 | 0x80 | Rt=0` = `B4000080`.
- `b.ne loop`: 0x08 − 0x10 = −8 bytes = −2 words. In 19-bit two's complement, −2 is `0x7FFFE`; shifted left by 5 it is `0xFFFFC0`. With NE = 1: `54000000 | FFFFC0 | 1` = `54FFFFC1`.

The total is 7 words, 28 bytes, stored little-endian: the first word, `D2800001`, is the bytes `01 00 80 D2` in memory.

### RISC-V (RV64I)

```text
# RISC-V RV64I, base encodings: n in a0 (x10), result in a0
sum:                        # the function's label
        li a1, 0            # 00000593  ADDI a1, zero, 0: the running total
        beqz a0, done       # 00050863  BEQ a0, zero: n == 0, skip the loop
loop:                       # the loop's label
        add a1, a1, a0      # 00A585B3  s += n
        addi a0, a0, -1     # FFF50513  n -= 1
        bnez a0, loop       # FE051CE3  BNE a0, zero: not zero yet, go back
done:                       # the exit label
        mv a0, a1           # 00058513  ADDI a0, a1, 0: copy s to the result
        ret                 # 00008067  JALR zero, 0(ra): return
```

Four of the eight lines are pseudo-instructions, shorthand that the assembler expands into a real instruction. The RISC-V Assembly Programmer's Manual lists them: `mv rd, rs` is `addi rd, rs, 0`; `beqz rs, offset` is `beq rs, x0, offset`; `bnez` is `bne rs, x0, offset`; `ret` is `jalr x0, 0(x1)`; and `nop` is `addi x0, x0, 0` ([RISC-V Assembly Programmer's Manual](https://raw.githubusercontent.com/riscv-non-isa/riscv-asm-manual/main/src/asm-manual.adoc)). The ISA manual confirms two of them from its side: "ADDI rd, rs1, 0 is used to implement the MV rd, rs1 assembler pseudoinstruction" and "NOP is encoded as ADDI x0, x0, 0" (RISC-V, pp. 28 and 30).

The encodings are the rows of the RV32I listing (chapter 35, p. 609), which RV64I uses at 64 bits: `imm[11:0] rs1 000 rd 0010011` ADDI, `0000000 rs2 rs1 000 rd 0110011` ADD, `imm[12|10:5] rs2 rs1 000 imm[4:1|11] 1100011` BEQ (BNE has 001 in `funct3`), `imm[11:0] rs1 000 rd 1100111` JALR.

**The branch offsets, by hand.** RISC-V also measures from the branch itself, in bytes, and stores a 13-bit signed offset whose bit 0 is always zero, scattered across the word so that the register fields stay in the same place in every format. Take `bnez a0, loop` at 0x10 with the target at 0x08: the offset is −8.

1. −8 in 13 bits is `1 1111 1111 1000`: imm[12] = 1, imm[11] = 1, imm[10:5] = `111111`, imm[4:1] = `1100`.
2. Place the pieces: bit 31 = imm[12] = 1; bits 30 to 25 = imm[10:5] = 111111; bits 24 to 20 = rs2 = x0 = 00000; bits 19 to 15 = rs1 = x10 = 01010; bits 14 to 12 = funct3 = 001 (BNE); bits 11 to 8 = imm[4:1] = 1100; bit 7 = imm[11] = 1; bits 6 to 0 = 1100011.
3. Written out: `1111 1110 0000 0101 0001 1100 1110 0011` = `FE051CE3`.

The forward branch `beqz a0, done` at 0x04 jumps +16 to 0x14: imm[4:1] = 1000 and everything else zero, giving `00050863`. The total is again 7 words, 28 bytes.

### The three side by side, and a check

| Step | x86-64 bytes | AArch64 word | RISC-V word |
| --- | --- | --- | --- |
| total = 0 | `31 C0` | `D2800001` | `00000593` |
| n == 0? skip | `48 85 FF` + `74 08` | `B4000080` | `00050863` |
| total += n | `48 01 F8` | `8B000021` | `00A585B3` |
| n -= 1 | `48 FF CF` | `F1000400` | `FFF50513` |
| loop while n != 0 | `75 F8` | `54FFFFC1` | `FE051CE3` |
| result register | (already in RAX) | `AA0103E0` | `00058513` |
| return | `C3` | `D65F03C0` | `00008067` |
| size | 16 bytes, 7 instructions | 28 bytes, 7 instructions | 28 bytes, 7 instructions |

Hand assembly is easy to get wrong, so the three listings were also assembled on 23 November 2026 by the GNU (GNU's Not Unix, as the [GNU Project](https://www.gnu.org/gnu/gnu-history.html) expands it) binutils 2.45 for each architecture, through the public interface of [Compiler Explorer](https://godbolt.org/). Every byte matched. The disassembler printed `je` for `jz` and `jne` for `jnz` (two mnemonics for the same opcode, as the SDM's Jcc table shows: `74 cb` is listed as both JE and JZ), printed `mov x1, #0x0` for the MOVZ, and, for RISC-V, showed a relocation of type `R_RISCV_BRANCH` next to each branch: the assembler had left a note for the linker even though the target was in the same file. The linker section below explains why that note exists.

## CISC and RISC, seen through the bytes

The labels complex instruction set computer (CISC) and RISC are usually argued about in terms of speed. The bytes above show the differences that are not in dispute.

- **Length.** x86-64 instructions here are 1, 2 or 3 bytes, and the format allows up to 15; AArch64 and RISC-V instructions are all 4 bytes. A decoder for the fixed formats knows where every instruction starts; an x86 decoder knows only by decoding.
- **Where operands may be.** Arm's manual lists the load/store rule as a defining RISC feature: data-processing operations "only operate on register contents, not directly on memory contents" (p. A1-41). x86's ADD has forms whose destination is a memory location (the `r/m` in `ADD r/m64, r64`).
- **How a decision is made.** x86 sets flags in one instruction and tests them in the next (`dec`, then `jnz`); AArch64 can do the same (`subs`, then `b.ne`) or test a register directly (`cbz`); RISC-V always compares registers inside the branch.
- **Density.** For this function x86-64 needs 16 bytes and the other two 28. That is one function, not a benchmark, and the RISC-V specification itself reports the opposite result at scale for its compressed extension: "Typically, 50%-60% of the RISC-V instructions in a program can be replaced with RVC instructions, resulting in a 25%-30% code-size reduction" (p. 160), and the same chapter recalls that the compressed RISC instruction sets of the 1980s and later "reduced code size relative to their starting points by about 25-30%, yielding code that was significantly smaller than 80x86", which "surprised some, as their intuition was that the variable-length CISC ISA should be smaller" (p. 161). Compilers for 64-bit RISC-V commonly use that compressed extension; the listing above was assembled without it on purpose, to show the base encodings.

## The 8-bit home computers: Z80 and 6502

The same loop shrinks on the 8-bit processors that put assembly in front of a generation, and their manuals make the encodings visible in a way the 64-bit manuals no longer do. The two processors have glossary entries, [Zilog Z80](https://ronutz.com/en/glossary/zilog-z80) and [MOS 6502](https://ronutz.com/en/glossary/mos-6502), and the machines built on them are in [Microcomputers by category and generation](https://ronutz.com/en/learn/microcomputers-by-category-and-generation).

### Z80

```text
; Z80: n in register B (1 to 255), result in A
sum:            ; the routine's label
        XOR A   ; AF      A = 0 (the accumulator XORed with itself)
loop:           ; the loop's label
        ADD A,B ; 80      A = A + B
        DJNZ loop ; 10 FD decrement B, jump back if B is not zero
        RET     ; C9      return to the caller
```

Five bytes. The Zilog manual gives `ADD A, r` as `10 000 r` with B = 000 (p. 140), so `ADD A,B` is `1000 0000` = `80`. `RET` is `C9` (p. 260). `DJNZ` is the Z80's own loop instruction: "The B register is decremented, and if a non zero value remains, the value of the displacement e is added to the Program Counter (PC)", the op code is `00010000` followed by `e-2`, and "The jump is measured from the address of the instruction Op Code and has a range of -126 to +129 bytes. The assembler automatically adjusts for the twice incremented PC" (p. 253). Here DJNZ is at address 2 and `loop` at address 1, so e = −1 and the byte stored is e − 2 = −3 = `FD`. That sentence about the assembler adjusting for the program counter is the whole reason hand assemblers of the 1980s kept a pencil next to the opcode table.

The manual also shows why the opcode table, not a single page, is the reference to trust. Its `XOR s` page (p. 156) prints the encodings of the OR instruction, labelled "OR r", "OR n", "OR (HL)", with OR's bit pattern. The 8-bit arithmetic and logic table of the same manual gives the XOR row as `AF A8 A9 AA AB AC AD AE` for the registers A, B, C, D, E, H, L and (HL) (p. 60), and the manual's own example program uses `XOR A ;CLEAR ACCUMULATOR` (p. 35). `XOR A` is therefore `AF`. Manuals have errata; two pages of the same manual that agree with each other beat one that does not.

The Z80 was designed to run the Intel 8080's programs, and the two manuals show the same byte under different names. Intel's 8080/8085 Assembly Language Programming Manual encodes `MOV r1,r2` as `01DDDSSS`, with B = 000 and the accumulator = 111 ([Intel, 9800301C, November 1978, pp. A-1 to A-3](https://bitsavers.org/components/intel/8085/9800301C_8080_8085_Assembly_Language_Programming_Manual_Nov78.pdf)), so Intel's `MOV A,B` is `01 111 000` = `78`. Zilog encodes `LD r, r'` as `01 r r'` with A = 111 and B = 000 (Zilog, p. 81), so Zilog's `LD A,B` is also `78`. One byte, two mnemonics, two companies. The same holds for `RET` (`1100 1001` = `C9` in both manuals) and for Intel's `XRA r` (`10101SSS`), whose `XRA A` is the same `AF` as Zilog's `XOR A`.

The Z80's production story ended while this article's sources were being written: The Register reported on 22 April 2024 that Zilog had issued an end-of-life notice blaming its wafer foundry, that orders would be accepted until 14 June 2024, that the chip had debuted in 1976 with about 8,500 transistors, and that Zilog still appeared to make the eZ80 ([The Register, 22 April 2024](https://www.theregister.com/2024/04/22/z80_cpu_end_of_sales/)).

### 6502

```text
; 6502: n in X (1 to 255), result in A, $FB is a free zero-page byte
sum:            ; the routine's label
        LDA #$00 ; A9 00  A = 0
loop:           ; the loop's label
        STX $FB  ; 86 FB  copy X to memory: the 6502 cannot add X to A directly
        CLC      ; 18     clear the carry, because ADC always adds it
        ADC $FB  ; 65 FB  A = A + memory[$FB] + carry
        DEX      ; CA     X = X - 1, sets the zero flag when X reaches 0
        BNE loop ; D0 F8  not zero: go back
        RTS      ; 60     return to the caller
```

Eleven bytes, and the extra lines are the lesson: the 6502 has an accumulator architecture, so the only addition is "Add memory to accumulator with carry", and the loop counter has to pass through memory to be added. The opcodes come from the instruction summary of the MOS programming manual: `LDA #` immediate `A9` (p. B-17), `STX` zero page `86` (p. B-26), `CLC` `18` (p. B-9), `ADC` zero page `65` (p. B-3), `DEX` `CA` (p. B-13), `BNE` `D0` (p. B-7) and `RTS` `60` (p. B-23). A branch "is limited to +127 or -128 from the current program counter location" (p. 42), and the manual's worked example shows a branch at 0100 whose offset is added to 0102, the address after the two-byte branch (p. 66). Here BNE sits at 8 and 9, the next instruction is at 10 (0x0A), and `loop` is at 2: 2 − 10 = −8 = `F8`.

### Hand assembly

On these machines many owners assembled by hand: write the mnemonics, look up each opcode in the manual's table, count bytes to place each label, compute each relative branch as above, then type the numbers into memory. The Brazilian section below shows what that looked like in São Paulo in 1983. The rule of thumb that falls out of the three branch conventions above is worth memorizing: x86 and the 6502 count from the end of the branch, AArch64 and RISC-V from its start, and the Z80's DJNZ from its start but with the two bytes subtracted by the assembler.

## How an assembler works

David Salomon's *Assemblers and Loaders* (Ellis Horwood, 1993, now published free by its author) describes the core in a few pages. The assembler keeps a location counter (LC), "a variable, maintained by the assembler, that contains the address into which the current instruction will eventually be loaded", and a symbol table, "an internal, dynamic table that is generated, maintained, and used by the assembler", with "fields for the name, value, and type of the symbol". A label defines a symbol with the current value of the LC; an operand uses it ([Salomon, pp. 17 and 18](http://www.davidsalomon.name/assem.advertis/asl.pdf)).

The one difficulty is the label used before it is defined, which Salomon calls "the future symbol problem or the problem of unresolved references". It has two classic solutions. A two-pass assembler "performs two passes over the source file. In the first pass it reads the entire source file, looking only for label definitions. All labels are collected, assigned values, and placed in the symbol table in this pass. No instructions are assembled... In the second pass, the instructions are again read and are assembled, using the symbol table" (p. 20). A one-pass assembler reads the source once and patches the gaps later (p. 19).

### Worked example 3: the two passes on paper

Run the x86-64 listing through both passes.

**Pass 1.** The LC starts at 0. The assembler does not encode anything, but it must know each instruction's size to advance the LC, which on x86 means looking at the mnemonic and the operands (Salomon notes that "on most modern microprocessors ... the size is determined by the OpCode and the specific operands used", p. 20).

| Line | Size | LC before | Symbol table after |
| --- | --- | --- | --- |
| `sum:` | 0 | 0x00 | sum = 0x00 |
| `xor eax, eax` | 2 | 0x00 | |
| `test rdi, rdi` | 3 | 0x02 | |
| `jz done` | 2 (short form assumed) | 0x05 | |
| `loop:` | 0 | 0x07 | loop = 0x07 |
| `add rax, rdi` | 3 | 0x07 | |
| `dec rdi` | 3 | 0x0A | |
| `jnz loop` | 2 | 0x0D | |
| `done:` | 0 | 0x0F | done = 0x0F |
| `ret` | 1 | 0x0F | |

**Pass 2.** The assembler reads the lines again, encodes each instruction with the rows of the SDM, and when it meets `jz done` looks up `done` (0x0F), subtracts the address of the next instruction (0x07) and emits `74 08`; for `jnz loop` it emits `75 F8`. The output is the 16 bytes of the listing.

There is a catch hidden in "short form assumed". `JZ` has an 8-bit form (`74 cb`) and a 32-bit form (`0F 84 cd`, same Jcc table), and pass 1 had to guess the size before it knew the distance. If a target turns out to be more than 127 bytes away, every later address moves. Assemblers handle it in different ways. The Netwide Assembler (NASM) documents an option that iterates: in its default `-Ox` mode it performs "Multipass optimization. Minimize branch offsets and signed immediate bytes", and it can print "the number of passes actually executed" ([NASM manual, section 2.1.24](https://www.nasm.us/doc/nasmdoc2.html)). The GNU assembler says that "Unlike older assemblers, as is designed to assemble a source program in one pass of the source file" ([GNU as manual, The GNU Assembler](https://sourceware.org/binutils/docs/as/GNU-Assembler.html)).

### Directives and macros

Not every line becomes an instruction. Directives (GNU calls them "pseudo-ops") tell the assembler where to put things, how to align them, which symbols to export, which bytes of data to emit ([GNU as, Assembler Directives](https://sourceware.org/binutils/docs/as/Pseudo-Ops.html)). IBM's SOAP II (Symbolic Optimal Assembly Program) for the 650 already had them in 1957: `BLR` (Block Reservation) marked drum addresses as unavailable, `BLA` (Block Availability) released them, `RBR` reserved relocatable blocks ([Wikipedia, Symbolic Optimal Assembly Program](https://en.wikipedia.org/wiki/Symbolic_Optimal_Assembly_Program)). Macros let a programmer define a new pseudo-instruction that expands into several real ones; GNU's `.macro` directive "allows you to define macros that generate assembly output" ([GNU as, .macro](https://sourceware.org/binutils/docs/as/Macro.html)). Local labels avoid inventing a unique name for every small loop: in the RISC-V assembler a numeric label such as `1:` is referenced as `1b` (backwards) or `1f` (forwards) ([RISC-V Assembly Programmer's Manual, Labels](https://raw.githubusercontent.com/riscv-non-isa/riscv-asm-manual/main/src/asm-manual.adoc)).

### The linker and the loader

An assembler rarely produces the final program. It produces an object file whose addresses start at zero and whose references to other files are still open, and it lists the places that need fixing as relocations. The GNU linker's manual says that "ld combines a number of object and archive files, relocates their data and ties up symbol references" ([GNU ld manual, Overview](https://sourceware.org/binutils/docs/ld/Overview.html)). Salomon puts the distinction between the two kinds of output: a one-pass assembler of the classic kind "does not generate a relocatable object file but rather loads the object code ... directly into memory", while "the most important feature of the two-pass assembler is that it generates a relocatable object file, that is later loaded into memory by a loader" (p. 19). The `R_RISCV_BRANCH` entries in the cross-check above are those relocations: GNU's RISC-V assembler leaves them even for branches inside one file, so that the linker can still move code (the toolchain's "relaxation" of RISC-V code, which this article does not cover further).

The loader's job is the last step: put the program in memory at its real addresses, apply what remains of the relocations, and jump to it. On the Cambridge EDSAC (Electronic Delay Storage Automatic Calculator), as the history below shows, the first assembler and the first loader were the same 31 words.

## A short history

### 1947: Kathleen Booth's notation

Kathleen Britten, who married Andrew Booth in 1950, spent the summer of 1947 at the Institute for Advanced Study in Princeton with him, and they co-authored two reports there: *General considerations in the design of an all-purpose electronic digital computer* and *Coding for the A.R.C.* ([MacTutor, Kathleen Booth](https://mathshistory.st-andrews.ac.uk/Biographies/Booth_Kathleen/)). The second report opens by explaining that "we have made the code of A.R.C. identical with that projected for the electronic machine" ([MacTutor, extracts from the Booth and Britten reports](https://mathshistory.st-andrews.ac.uk/Extras/Booth-Britten_reports/)); MacTutor's bracketed gloss expands A.R.C. as Automatic Relay Computer in one place and Automatic relay calculator in another. MacTutor calls her "the first to create assembly language". The Register's obituary of 29 October 2022 says that she "wrote all the software for the ARC2 and SEC machines, in the process inventing what she called Contracted Notation. This language, through evolution and contributions by others, is today known as assembly language" ([The Register, 29 October 2022](https://www.theregister.com/2022/10/29/kathleen_booth_obit/)).

What the notation looked like is harder to establish from a copy anyone can read. The Institute's own repository holds a scan of *Coding for A.R.C.*, but it refused automated access on 23 November 2026, and the scan of *General considerations* hosted in the Association for Computational Linguistics' anthology is an image without text. <Claim status="attributed" by="Hackaday (Steven Dufresne, 21 August 2018), reading the 1947 General considerations report">The *General considerations* report gives the order to clear the arithmetic register and transfer a value from memory into it as the binary pattern 10011, and writes the same order in contracted notation as `M -> cR`</Claim> ([Hackaday, 21 August 2018](https://hackaday.com/2018/08/21/kathleen-booth-assembling-early-computers-while-inventing-assembly/)); the same author doubted that the contracted notation in that report was the assembly language itself, and placed the assembly language in *Coding for A.R.C.* instead. <Claim status="attributed" by="MacTutor and The Register">Booth is credited with creating the first assembly language</Claim>, and the credit is not exclusive: the next machine has its own claim.

### 1949: the EDSAC's initial orders

At the University of Cambridge's Mathematical Laboratory, the EDSAC (the Institute of Electrical and Electronics Engineers (IEEE) Computer Society's profile of David Wheeler expands its last word as Computer, not Calculator) ran its first logged program on 6 May 1949 ([Cambridge Computer Laboratory, EDSAC chronology](https://www.cl.cam.ac.uk/relics/chron.html)). Its orders were written as a function letter, a decimal address and F or D for short or long numbers, for example `A D`, `S 4D` and `T D`; David Wheeler recalled that "we did try to make it as mnemonic as possible", and that "J was not used for jump because the operation was then thought of as 'transfer of control'" ([Wheeler, EDSAC order code notes](https://www.cl.cam.ac.uk/relics/orders.notes.html)). The program that read those letters from paper tape and placed the binary orders in memory was the "initial orders": according to the laboratory's statistics page they "consisted of 31 instructions which were hard-wired on uniselectors, a mechanical read-only memory. These instructions assembled programs in symbolic form from paper tape into the main memory and set them running" ([EDSAC statistics](https://www.cl.cam.ac.uk/events/EDSAC99/statistics.html)), and the laboratory's poster credits Wheeler with writing them in May 1949 ([EDSAC poster](https://www.cl.cam.ac.uk/events/800/TreasureTrail/edsacposter.pdf)).

The second version, Initial Orders 2, added relocation ("coordination") for subroutines in 41 words; the statistics page says it "was installed in August 1949", while the chronology says it was "Wired by Oct 22 49". The two pages of the same laboratory disagree, and both are reported here. <Claim status="attributed" by="IEEE Computer Society, David Wheeler profile">Wheeler's initial orders were "the first 'assembly language'", and the IEEE gave him its 1985 Computer Pioneer Award "for assembly language programming"</Claim> ([IEEE Computer Society, David Wheeler](https://www.computer.org/profiles/david-wheeler)). Salomon adds that Maurice Wilkes was "the first to propose the use of labels (which he called floating addresses), the first to use an early form of macros (which he called synthetic orders), and the first to develop a subroutine library" (Salomon, p. 7). Wilkes, Wheeler and Stanley Gill described all of it in *The Preparation of Programs for an Electronic Digital Computer* (1951), the book that the IEEE profile calls the first book for programmers; <Claim status="attributed" by="Wikipedia, Assembly language">the term "assembler" is generally attributed to that book, which used it for a program that combined several sections into a single program</Claim> ([Wikipedia, Assembly language](https://en.wikipedia.org/wiki/Assembly_language)).

### The 1950s: SOAP, Autocoder and their kin

The IBM 650 kept its program on a rotating magnetic drum, and each instruction carried the address of the next. SOAP placed each instruction so that it would arrive under the read head just as the previous one finished; Salomon calls it "perhaps the first assembler" to do symbolic assembly "in the conventional way" (p. 7). Its name is spelt three ways in the sources: Symbolic Optimal Assembly Program (Wikipedia), Symbolic Optimum Assembly Program ([Donald Knuth](https://ronutz.com/en/glossary/donald-knuth)'s manual) and Symbolic Optimizer and Assembly Program (Salomon). Knuth, then at the Case Institute of Technology in Cleveland, wrote in February 1958 that his CASE SOAP III "is a modified version of SOAP II which was originally written by Stan Poley of the Applied Science Division of IBM Service Bureau Corp." ([Knuth, CASE SOAP III, February 1958, Computer History Museum copy](https://archive.computerhistory.org/resources/access/text/2018/07/102784981-05-01-acc.pdf)); Wikipedia places Poley at the IBM Thomas J. Watson Research Center instead. In August 1959 Knuth's SuperSoap promised assembly "considerably faster than ever before", at 140 to 150 cards per minute ([Knuth, SuperSoap, August 1959](https://archive.computerhistory.org/resources/access/text/2018/07/102784983-05-01-acc.pdf)).

Salomon's short history continues: the IBM 704's first assembler, UASAP-1 (United Aircraft Symbolic Assembly Program), was written by Roy Nutt of United Aircraft in 1956 and "did practically nothing but one-to-one translation"; SHARE, the IBM users' organization, distributed a later version; the IBM Autocoder for the 702 and 705, developed by R. Goldfinger, "was apparently the first to use macros"; UNISAP for the UNIVAC I and II (1958, M. E. Conway) "was the first one to use local labels"; and by the late 1950s IBM's SCAT (Symbolic Coder And Translator) for the 709 and 7090 "had all the features of modern assemblers" (Salomon, pp. 7 and 8). The 1401's SPS, quoted at the top of this article, belongs to the same years. The cards these assemblers read, and how a program deck was laid out, are in [Punched cards: from the Jacquard loom to the 80-column card](https://ronutz.com/en/learn/punched-cards-from-the-jacquard-loom-to-the-80-column-card).

### The 1970s and 1980s: microprocessors and hand assembly

Intel's 8080 manual, MOS Technology's 6500 manuals and Zilog's Z80 manual, all quoted above, were the textbooks of the next wave. The microprocessors were cheap, the assemblers were not always available, and the manuals printed every opcode in tables designed to be read by a person. Magazines printed programs as columns of numbers to be typed in.

### The demoscene

The craft of fitting effects into small, fast code outlived the 8-bit machines in the demoscene, whose biggest gathering is called, fittingly, Assembly. The first Assembly was held from 24 to 26 July 1992 in Kauniainen, Finland, organized by the Amiga groups Complex and Rebels and the PC group Future Crew, and it now runs every summer at the Messukeskus in Helsinki ([Wikipedia, Assembly (demoparty)](https://en.wikipedia.org/wiki/Assembly_(demoparty))). In 2020 Finland's Ministry of Education and Culture added the demoscene to its national inventory of living heritage "as the first branch of digital culture ever" ([Aalto University, 7 May 2020](https://www.aalto.fi/en/news/the-demoscene-accepted-to-the-national-inventory-of-living-heritage)); the Art of Coding initiative dates the Finnish decision to April 2020, Aalto's news item to May, and the initiative lists Finland, Germany, Poland, Switzerland, the Netherlands, Sweden, France and Norway as having recognized the demoscene as national cultural heritage by April 2026 ([Art of Coding](https://demoscene-the-art-of-coding.net/)).

## The Brazilian angle

Brazil's first home-grown computer was not programmed in anyone else's assembly language. The Patinho Feio, built at the Escola Politécnica of the Universidade de São Paulo (USP) as the final project of a graduate course in computer architecture proposed by Glen Langdon Jr., was inaugurated on 24 July 1972, according to the magazine of the Fundação de Amparo à Pesquisa do Estado de São Paulo (FAPESP) ([Revista Pesquisa FAPESP, December 2022](https://revistapesquisa.fapesp.br/o-legado-do-patinho-feio/)). It had about 450 integrated circuits and a core memory of 4,096 words of 8 bits, and Antônio Massola, then a master's student, was one of those who wrote its software ([Revista Pesquisa FAPESP, June 2002](https://revistapesquisa.fapesp.br/patinho-feio-completa-30-anos/)). The machine led to the G-10, built by USP and the Pontifícia Universidade Católica do Rio de Janeiro (PUC-Rio) for the Brazilian Navy, which in turn was the prototype for Cobra's MC 500, the country's first commercial computer (FAPESP, 2022; [Jornal da USP, 23 September 2022](https://jornal.usp.br/?p=566577)).

A decade later, under the [market reserve](https://ronutz.com/en/learn/brazil-market-reserve), the Brazilian micros of the early 1980s were largely clones of foreign designs, and the magazine [*Micro Sistemas*](https://ronutz.com/en/learn/brazil-computing-press-from-micro-sistemas-to-the-cd-rom) taught their owners the assembly language. In August 1982 it explained that "many programs are written in machine language or in Assembler, a language that uses symbols or mnemonic codes representing the microcomputer's instruction set" (*em linguagem de máquina ou em Assembler*: the magazine called the language itself "Assembler"; our translation, as for every quotation from Portuguese in this article), and listed the reasons to use it: a machine without a high-level language, programs that must be small and fast, access to the bits of a word, and "for pure 'fun'", because it gives a fine view of how the microcomputer works ([Micro Sistemas no. 11, August 1982, pp. 45 and 46](https://archive.org/download/microsistemas/MicroSistemas011_djvu.txt)). In February 1983 the magazine opened a twelve-lesson *Curso de Assembler* (Assembler course) "taking the Z80 central processing unit as its basis", for situations in which a high-level language does not let you handle the microprocessor and its peripherals directly ([Micro Sistemas no. 17, February 1983](https://archive.org/download/microsistemas/MicroSistemas017_djvu.txt)).

The June 1983 issue shows hand assembly in practice on the TK82-C, the Microdigital clone of the Sinclair ZX81 that also appears in the [1984 São Paulo post](https://ronutz.com/en/blog/1984-sao-paulo-what-the-market-reserve-actually-built). A reader who had bought one wrote that his micro's processor "is a Z80, and it does everything", and published a program-renumbering routine as a list of decimal numbers: a BASIC loop `POKE`d them into memory starting at address 16514, inside a `REM` line at the top of the program, and `USR 16514` ran them. He explained what the reader was seeing: the numbers "are nothing more than Z80 machine-code instructions", and when the program is listed the `REM` line looks full of odd characters because BASIC "reads our list of numbers not as Z80 commands but as characters to be printed" ([Micro Sistemas no. 21, June 1983, pp. 66 and 67](https://archive.org/download/microsistemas/MicroSistemas021_djvu.txt)). That is machine code in its rawest form: the same bytes are instructions to the processor and characters to the BASIC listing, depending only on who reads them.

The law that governs software in Brazil, Lei 9.609 of 1998, does not mention disassembly or decompilation. Its article 6 lists what does not offend the rights of a program's owner, among them "the partial citation of the program, for teaching purposes, provided that the program and the holder of the respective rights are identified" and the integration of a program into an application or operating system when technically indispensable to the user, "provided that it is for the exclusive use of whoever carried it out" ([Lei 9.609/1998, art. 6](https://www.planalto.gov.br/ccivil_03/leis/l9609.htm)). How far reverse engineering for interoperability is covered is a question for a lawyer, not for this article.

## Intel syntax and AT&T syntax

There is no single assembly language for a processor; there is one notation per assembler. On x86 two families dominate, and the GNU assembler manual summarizes the differences: "AT&T immediate operands are preceded by '$'"; "AT&T register operands are preceded by '%'"; "AT&T and Intel syntax use the opposite order for source and destination operands. Intel 'add eax, 4' is 'addl $4, %eax'"; and in AT&T syntax "the size of memory operands is determined from the last character of the instruction mnemonic", with the suffixes `b`, `w`, `l` and `q` for 8, 16, 32 and 64 bits, where Intel syntax writes `byte ptr`, `word ptr` and so on ([GNU as, AT&T Syntax versus Intel Syntax](https://sourceware.org/binutils/docs/as/i386_002dVariations.html)). The manual adds that the `.intel_syntax` directive selects Intel mode and that the source-then-destination order "is maintained for compatibility with previous Unix assemblers".

The instruction encoded by hand above, in both:

```text
add rax, rdi        ; Intel syntax: destination first, no prefixes, size from the register names
addq %rdi, %rax     # AT&T syntax: source first, % before registers, q for a 64-bit operation
```

Both assemble to `48 01 F8`. The Intel SDM writes Intel syntax; the GNU Compiler Collection (GCC) and the GNU tools default to AT&T; NASM, "an 80x86 and x86-64 assembler designed for portability and modularity" ([NASM manual, chapter 1](https://www.nasm.us/doc/nasmdoc1.html)), and the Microsoft Macro Assembler (MASM) use Intel-style syntax ([Microsoft Learn, Microsoft Macro Assembler reference](https://learn.microsoft.com/en-us/cpp/assembler/masm/microsoft-macro-assembler-reference)). Go has a third dialect: its assembler "is based on the input style of the Plan 9 assemblers", and "The most important thing to know about Go's assembler is that it is not a direct representation of the underlying machine" ([The Go Programming Language, A Quick Guide to Go's Assembler](https://go.dev/doc/asm)).

## Where assembly still lives

Almost nobody writes whole applications in assembly any more. It survives where a compiler cannot reach, or cannot be trusted to.

- **Boot code.** A processor starts in a state that no high-level language expects. The Linux kernel's `arch/x86/boot/header.S` begins with the warning "We're in real mode using 64k segments", keeps `BOOTSEG = 0x07C0`, the "original address of boot-sector", and and in the part of its header that comes "from the old boot sector" still carries the field `boot_flag: .word 0xAA55`, followed by the comment "offset 512, entry point" ([Linux, arch/x86/boot/header.S](https://raw.githubusercontent.com/torvalds/linux/master/arch/x86/boot/header.S)). The boot sector is also where the [boot sector viruses](https://ronutz.com/en/glossary/boot-sector-virus) of the 1980s, such as [Ping-Pong](https://ronutz.com/en/glossary/ping-pong-virus), made their home. How a machine finds its first code over the network is told in the article on [network boot](https://ronutz.com/en/learn/pxe-and-network-boot).
- **Cryptographic primitives.** OpenSSL's AES-NI module is written in Perl that generates assembly through the project's perlasm translator (`x86_64-xlate.pl`); it was "Written by Andy Polyakov ... initially for use in the OpenSSL project" and dual-licensed under the OpenSSL and CRYPTOGAMS licences; its header discusses performance in cycles per byte for each mode ([OpenSSL, crypto/aes/asm/aesni-x86_64.pl](https://raw.githubusercontent.com/openssl/openssl/master/crypto/aes/asm/aesni-x86_64.pl)).
- **Multimedia.** FFmpeg's assembly lessons explain that most of its assembly is SIMD (Single Instruction Multiple Data) code and say why the project writes it by hand: <Claim status="attributed" by="FFmpeg, asm-lessons, lesson 1">it is "very common to get a 10x or more speed improvement from writing assembly code", and intrinsics "are typically around 10-15% slower"</Claim> ([FFmpeg, asm-lessons, lesson 1](https://raw.githubusercontent.com/FFmpeg/asm-lessons/main/lesson_01/index.md)).
- **Inside high-level languages.** Rust supports inline assembly "via the `asm!`, `naked_asm!`, and `global_asm!` macros" ([The Rust Reference, Inline assembly](https://doc.rust-lang.org/reference/inline-assembly.html)); Go's assembler guide points to the standard library's `runtime` and `math/big` packages for examples of its assembly.
- **Reading what the compiler did.** Matt Godbolt open-sourced "a little tool called GCC Explorer" on 22 May 2012, written in a week of spare time at his then-employer DRW; it became Compiler Explorer on 30 April 2014, and ten years after its start it was performing "around 3,000,000 compilations a week" ([Godbolt, Happy 10th Birthday Compiler Explorer](https://xania.org/202206/happy-birthday-ce)). Its README describes it as "an interactive compiler exploration website" for more than 30 languages ([Compiler Explorer README](https://raw.githubusercontent.com/compiler-explorer/compiler-explorer/main/README.md)).
- **History kept running.** The source code of the Apollo 11 guidance computer for the command module (Comanche055) and the lunar module (Luminary099), digitized by the Virtual AGC project and the MIT Museum, is public, with lines such as "Assemble revision 055 of AGC program Comanche by NASA" ([Apollo-11 repository](https://raw.githubusercontent.com/chrislgarry/Apollo-11/master/README.md)). The software effort is told in the glossary entry on [Margaret Hamilton](https://ronutz.com/en/glossary/margaret-hamilton).

The TIOBE index, which describes itself as "an indicator of the popularity of programming languages" with ratings based on "the number of skilled engineers world-wide, courses and third party vendors" as counted through popular web sites and search engines, placed "Assembly language" 17th in November 2026, with 0.92% ([TIOBE Index, November 2026](https://www.tiobe.com/tiobe-index/)).

## WebAssembly is a different thing

WebAssembly borrowed the word and little else. Its home page defines it as "a binary instruction format for a stack-based virtual machine", "designed as a portable compilation target for programming languages" ([webassembly.org](https://webassembly.org/)). It is not the instruction set of any physical processor; a browser or runtime compiles or interprets it. The specification's binary format begins every module with a 4-byte magic number that spells the name, the bytes `0x00 0x61 0x73 0x6D`, the string `\0asm` ([WebAssembly Core Specification, Modules](https://webassembly.github.io/spec/core/binary/modules.html)). WebAssembly has a text format for people, as assembly does, but the bytes it describes run on a virtual machine with its own sandbox, which is what [How a WebAssembly tool works](https://ronutz.com/en/learn/how-a-webassembly-tool-works) examines.

## The security thread

### Disassembly and reverse engineering

A disassembler runs the assembler backwards: bytes in, mnemonics out. GNU's `objdump` does it from the command line ([GNU Binutils, objdump](https://sourceware.org/binutils/docs/binutils/objdump.html)); Ghidra, "a software reverse engineering (SRE) framework created and maintained by the National Security Agency Research Directorate", lists among its capabilities "disassembly, assembly, decompilation, graphing, and scripting" ([Ghidra README](https://raw.githubusercontent.com/NationalSecurityAgency/ghidra/master/README.md)); its public GitHub repository was created on 1 March 2019, UTC (GitHub's application programming interface (API) [record of the repository](https://api.github.com/repos/NationalSecurityAgency/ghidra)). Disassembly is how defenders read malware, how researchers find vulnerabilities in programs without source, and how interoperability is achieved with undocumented formats. In the United States, 17 U.S. Code section 1201(f) permits a person who has lawfully obtained the right to use a program to circumvent a protection measure "for the sole purpose of identifying and analyzing those elements of the program that are necessary to achieve interoperability of an independently created computer program with other programs" ([17 U.S. Code 1201](https://www.law.cornell.edu/uscode/text/17/1201)); the Brazilian text is quoted in the section above.

### Why x86 disassembly can disagree with itself

Because x86 instructions have variable length, a disassembler that starts one byte off reads different instructions from the same bytes. Hovav Shacham's 2007 paper makes the point with an analogy, "Intel x86 code is like English written without punctuation or spaces, so that the words all run together", and with an example from the C library he studied ([Shacham, The Geometry of Innocent Flesh on the Bone, full version of the CCS 2007 paper](https://www.cs.cornell.edu/courses/cs5432/2021sp/reading/ROP.x86.pdf)):

| Read from the intended start | Read from one byte later |
| --- | --- |
| `f7 c7 07 00 00 00` test $0x00000007, %edi | `c7 07 00 00 00 0f` movl $0x0f000000, (%edi) |
| `0f 95 45 c3` setnzb -61(%ebp) | `95` xchg %ebp, %eax |
| | `45` inc %ebp |
| | `c3` ret |

The byte `c3` at the end, the operand of one instruction, becomes a `RET` when decoded from another start. The example is 32-bit code: in 64-bit mode the bytes 40 to 4F are not `INC` and `DEC` but REX prefixes, as the SDM puts it, "REX prefixes are a set of 16 opcodes that span one row of the opcode map and occupy entries 40H to 4FH. These opcodes represent valid instructions (INC or DEC) in IA-32 operating modes and in compatibility mode" (Vol. 2A, p. 2-8). The meaning of a byte depends on the mode as well as the offset, which is why a disassembler must be told both.

### Shellcode, as a concept

[Shellcode](https://ronutz.com/en/glossary/shellcode) is a small piece of machine code that an attacker places in a vulnerable program's memory and causes to run, classically through a [buffer overflow](https://ronutz.com/en/glossary/buffer-overflow). It is written in assembly because it must work with no loader, no libraries and often no zero bytes. This article does not show any; the concept is enough to understand the defences below.

### Return-oriented programming, at the idea level

The defence called W⊕X (memory may be writable or executable, never both), enforced in hardware by the no-execute [NX bit](https://ronutz.com/en/glossary/nx-bit) (the execute-disable, or XD, flag of Intel's paging-structure entries; Intel SDM, Vol. 3A, p. 6-2), stops injected code from running. Shacham's paper showed that it does not stop an attacker from reusing code that is already there: short instruction sequences ending in a `RET`, which he called gadgets, can be chained by writing a sequence of return addresses on the stack, each `RET` jumping to the next gadget. He found enough of them in the C library to compute anything, and concluded that W⊕X "is much less useful than previously thought". Intel's manual now opens its chapter on Control-flow Enforcement Technology (CET) with the same description: "Return-oriented programming (ROP), and similarly CALL/JMP-oriented programming (COP/JOP), have been the prevalent attack methodologies for stealth exploit writers targeting vulnerabilities in programs" (Intel SDM, Vol. 1, p. 18-1).

### The defences in the instruction set

- **Shadow stack (Intel CET).** "A shadow stack is a second stack for the program that is used exclusively for control transfer operations"; when it is enabled, "the CALL instruction pushes the return address on both the data and shadow stack. The RET instruction pops the return address from both stacks and compares them", and a mismatch raises a control protection exception (Vol. 1, p. 18-1).
- **Indirect branch tracking (Intel CET).** Valid targets of indirect calls and jumps begin with `ENDBR64`, encoded `F3 0F 1E FA` (Vol. 2A, p. 3-288), an opcode "selected to be one that is a NOP on legacy machines" (Vol. 1, p. 18-1). The SDM says the instruction "is used to mark valid jump target addresses of indirect calls and jumps in the program", so in code built for indirect branch tracking a disassembly shows those four bytes at such targets.
- **Pointer authentication and branch target identification (Arm).** `PACIASP` "calculates and inserts a Pointer Authentication Code for an instruction address, using a modifier and key A", taking the address from X30, the link register, and the modifier from SP (C6.2.306, p. C6-2495); the Arm ARM encodes it as `1101010100000011001000 CRm op2 11111` with CRm = 0011 and op2 = 001, that is `D503233F` (p. C6-2496); `BTI` guards "against the execution of instructions that are not the intended target of a branch" and "Outside of a guarded memory region ... executes as a NOP" (C6.2.50, p. C6-1888).
- **Guarded Control Stack (Arm).** The Arm ARM states the threat plainly, "ROP techniques involve changing the return address of procedure calls to cause execution to change to a different path", notes that "Technologies such as Pointer Authentication help to significantly reduce the scope of an attack", and adds the Guarded Control Stack to store return addresses "such that they are immutable" (section D11.1.1, p. D11-7909).
- **And the older ones.** Address space layout randomization ([ASLR](https://ronutz.com/en/glossary/aslr)) randomizes where a process's memory regions land, so the gadgets' addresses change from run to run, and [stack canaries](https://ronutz.com/en/glossary/stack-canary) are there to reveal a stack overwrite before the function returns. The root cause, memory that a program can corrupt, is the subject of [Memory safety](https://ronutz.com/en/learn/memory-safety).

### Trust in the toolchain

An assembler, like a compiler, sits between the text you read and the bytes that run. Ken Thompson's lecture, discussed in [Reflections on trusting trust](https://ronutz.com/en/learn/reflections-on-trusting-trust), is about exactly that gap. Disassembling the output, or assembling the same source with an independent tool as this article did, is the practical check.

## What defenders can do

- **Read the bytes, not just the source.** A disassembler on the shipped binary shows what will run, including whether `ENDBR64` or `PACIASP` is present where it should be.
- **Tell the disassembler the mode and the start.** The same bytes decode differently in 32-bit and 64-bit mode and from a different offset; a listing made with the wrong assumption is wrong without warning.
- **Expect hand-written assembly where speed or the boot path matters.** Cryptographic and multimedia libraries and boot code contain it by design; review it with the manuals open, as their authors did.
- **Know which defence answers which attack.** Non-executable memory answers injected code; shadow stacks, pointer authentication and Guarded Control Stacks answer reused code; ASLR and canaries raise the cost of both.
- **Cross-check the toolchain.** A second assembler or disassembler that agrees byte for byte is cheap evidence that the first one did what it says.

## What to remember

- Machine code is bytes; assembly language is a one-for-one textual form of them; the assembler translates, the disassembler reads back.
- x86-64 instructions are 1 to 15 bytes, built from prefixes, opcode, ModR/M, SIB, displacement and immediate; AArch64 and RISC-V base instructions are 32-bit words with fields in fixed places, stored little-endian.
- Branch offsets are counted from different places: from the next instruction on x86 and the 6502, from the branch itself on AArch64 and RISC-V, with the Z80's DJNZ adjusted by the assembler.
- An assembler needs a location counter and a symbol table; a two-pass assembler collects labels first and encodes second, and variable-length branches can force more passes.
- The calling convention is part of the ABI, not of the processor: RDI on Linux, RCX on Windows, X0 on AArch64, a0 on RISC-V.
- Booth's notation (1947) and the EDSAC's initial orders (1949) both have documented claims to be the first assembly language.
- ROP reuses existing code ending in `RET`; shadow stacks, pointer authentication, branch target identification and guarded control stacks are the instruction-set answers.

The next step away from the machine, the languages that a compiler or an interpreter turns into instructions like these, is [Programming languages: from Plankalkül to Rust](https://ronutz.com/en/learn/programming-languages-from-plankalkul-to-rust).

<ReaderQuestions>
- Why does x86-64 clear a register with `xor eax, eax` rather than `mov rax, 0`, and what does the SDM's zero-extension rule have to do with it?
- If the loop in the x86-64 listing grew to 200 bytes, which bytes of the output would change, and why would a one-pass assembler find that harder than a two-pass one?
- What would a disassembler print if it started reading the AArch64 listing two bytes late, and why is that question much less interesting for AArch64 than for x86?
- Which of the defences in this article would stop the gadget in Shacham's example, and which would only make it harder to find?
- In 1983 a TK82-C owner stored Z80 code inside a `REM` line. What does that trick show about the difference between code and data, and where does the same idea appear in modern attacks?
</ReaderQuestions>

## Sources

- [Intel, Intel 64 and IA-32 Architectures Software Developer's Manual, combined volumes 1, 2A to 2D, 3A to 3D and 4, order 325462-093, Intel Corporation, 2026, PDF from Intel: instruction format, ModR/M and REX tables, opcode notation, the rows for ADD, DEC, ENDBR64, INT3, Jcc, MOV, NOP, PUSH, RET, TEST and XOR, the zero-extension rule, flags, the 15-byte limit and the CET chapter (accessed 23 November 2026)](https://cdrdv2-public.intel.com/929349/325462-093-sdm-vol-1-2abcd-3abcd-4.pdf)
- [Arm, Arm Architecture Reference Manual for A-profile architecture, DDI 0487 M.d, Arm Limited, 2026, PDF from Arm's documentation service: A64 encodings of ADD, B.cond, BRK, BTI, CBZ, MOV, MOVZ, NOP, ORR, PACIASP, RET and SUBS, instruction endianness, registers, RISC features and the Guarded Control Stack (accessed 23 November 2026)](https://documentation-service.arm.com/static/6abbec2a6db85c5e6614a4a1?token=)
- [RISC-V International, The RISC-V Instruction Set Manual Volume I: Unprivileged Architecture, version 20250508, 2025, PDF from the official GitHub release: base encodings, the RV32I listing, register x0, parcels, pseudo-instruction notes and the compressed-extension code-size figures (accessed 23 November 2026)](https://github.com/riscv/riscv-isa-manual/releases/download/20250508/riscv-unprivileged-20250508.pdf)
- [RISC-V International, RISC-V Assembly Programmer's Manual, asm-manual.adoc, GitHub, source file: pseudo-instructions and labels (accessed 23 November 2026)](https://raw.githubusercontent.com/riscv-non-isa/riscv-asm-manual/main/src/asm-manual.adoc)
- [RISC-V International, RISC-V ABIs Specification, calling convention, riscv-cc.adoc, GitHub, source file: argument and return registers (accessed 23 November 2026)](https://raw.githubusercontent.com/riscv-non-isa/riscv-elf-psabi-doc/master/riscv-cc.adoc)
- [Zilog, Z80 Family CPU User Manual, UM008005-0205, 2005, PDF hosted by the Technical University of Munich: register set, encodings of LD, ADD, XOR, DJNZ and RET, the 8-bit opcode table and the XOR page erratum (accessed 23 November 2026)](https://archive.air.in.tum.de/pub/Main/TeachingWs2009Echtzeitsysteme/um0080.pdf)
- [MOS Technology, MCS6500 Microcomputer Family Programming Manual, publication 6500-50A, January 1976, Internet Archive scan: instruction summary opcodes, zero page and relative addressing (accessed 23 November 2026)](https://archive.org/download/mos_microcomputers_programming_manual/mos_microcomputers_programming_manual.pdf)
- [Intel, 8080/8085 Assembly Language Programming Manual, 9800301C, November 1978, bitsavers scan: MOV, ADD, XRA and RET bit patterns and register codes (accessed 23 November 2026)](https://bitsavers.org/components/intel/8085/9800301C_8080_8085_Assembly_Language_Programming_Manual_Nov78.pdf)
- [IBM, IBM 1401 Symbolic Programming Systems: SPS-1 and SPS-2 Specifications and Operating Procedures, C24-1480-0, 1959 to 1962, bitsavers scan: symbolic programming, source and object programs, one-for-one translation (accessed 23 November 2026)](https://bitsavers.org/pdf/ibm/1401/C24-1480-0_1401symbPgmSys.pdf)
- [David Salomon, Assemblers and Loaders, Ellis Horwood, Chichester, 1993, PDF from the author's site: location counter, symbol table, one-pass and two-pass assemblers, relocatable object files and the short history of assemblers (accessed 23 November 2026)](http://www.davidsalomon.name/assem.advertis/asl.pdf)
- [Donald E. Knuth, CASE SOAP III, Case Institute of Technology, Cleveland, February 1958, Computer History Museum scan: SOAP II's author and SOAP III's changes (accessed 23 November 2026)](https://archive.computerhistory.org/resources/access/text/2018/07/102784981-05-01-acc.pdf)
- [Donald E. Knuth, SuperSoap, Case Institute of Technology, Cleveland, August 1959, Computer History Museum scan: assembly speed (accessed 23 November 2026)](https://archive.computerhistory.org/resources/access/text/2018/07/102784983-05-01-acc.pdf)
- [Wikipedia, Symbolic Optimal Assembly Program, web page: drum optimization and SOAP II pseudo-operations (accessed 23 November 2026)](https://en.wikipedia.org/wiki/Symbolic_Optimal_Assembly_Program)
- [Wikipedia, Assembly language, web page: the attribution of the term "assembler" (accessed 23 November 2026)](https://en.wikipedia.org/wiki/Assembly_language)
- [MacTutor History of Mathematics, Kathleen Hylda Valerie Booth, University of St Andrews, web page: biography, the 1947 reports and the credit for assembly language (accessed 23 November 2026)](https://mathshistory.st-andrews.ac.uk/Biographies/Booth_Kathleen/)
- [MacTutor History of Mathematics, Extracts from Booth and Britten reports, University of St Andrews, web page: the opening of Coding for the A.R.C. (accessed 23 November 2026)](https://mathshistory.st-andrews.ac.uk/Extras/Booth-Britten_reports/)
- [The Register, RIP: Kathleen Booth, the inventor of assembly language, London, 29 October 2022, web page: Contracted Notation and the ARC2 and SEC software (accessed 23 November 2026)](https://www.theregister.com/2022/10/29/kathleen_booth_obit/)
- [Steven Dufresne, Kathleen Booth: Assembling Early Computers While Inventing Assembly, Hackaday, 21 August 2018, web page: the contracted notation example and where the report can be found (accessed 23 November 2026)](https://hackaday.com/2018/08/21/kathleen-booth-assembling-early-computers-while-inventing-assembly/)
- [David Wheeler, The EDSAC Order Code: Explanatory Notes, University of Cambridge Computer Laboratory, 2004, web page: written form of the orders and the choice of letters (accessed 23 November 2026)](https://www.cl.cam.ac.uk/relics/orders.notes.html)
- [University of Cambridge Computer Laboratory, EDSAC chronology, web page: first logged program and Initial Orders 2 (accessed 23 November 2026)](https://www.cl.cam.ac.uk/relics/chron.html)
- [University of Cambridge Computer Laboratory, EDSAC statistics, web page: the 31 instructions of the initial orders and the second release (accessed 23 November 2026)](https://www.cl.cam.ac.uk/events/EDSAC99/statistics.html)
- [University of Cambridge Computer Laboratory, EDSAC Initial Orders and Squares Program, poster, PDF: Wheeler writing the initial orders in May 1949 (accessed 23 November 2026)](https://www.cl.cam.ac.uk/events/800/TreasureTrail/edsacposter.pdf)
- [IEEE Computer Society, David Wheeler, web page: the initial orders and the 1985 Computer Pioneer Award (accessed 23 November 2026)](https://www.computer.org/profiles/david-wheeler)
- [x86-64 psABI maintainers, System V Application Binary Interface, AMD64 Architecture Processor Supplement, low-level-sys-info.tex, GitLab, source file: integer argument and return registers (accessed 23 November 2026)](https://gitlab.com/x86-psABIs/x86-64-ABI/-/raw/master/x86-64-ABI/low-level-sys-info.tex)
- [Arm, Procedure Call Standard for the Arm 64-bit Architecture (AAPCS64), GitHub, source file: argument and result registers (accessed 23 November 2026)](https://raw.githubusercontent.com/ARM-software/abi-aa/main/aapcs64/aapcs64.rst)
- [Microsoft, x64 calling convention, Microsoft Learn, web page: RCX, RDX, R8 and R9 (accessed 23 November 2026)](https://learn.microsoft.com/en-us/cpp/build/x64-calling-convention)
- [GNU Binutils, Using as: AT&T Syntax versus Intel Syntax, web page: the differences between the two syntaxes (accessed 23 November 2026)](https://sourceware.org/binutils/docs/as/i386_002dVariations.html)
- [GNU Binutils, Using as: The GNU Assembler, web page: one-pass design (accessed 23 November 2026)](https://sourceware.org/binutils/docs/as/GNU-Assembler.html)
- [GNU Binutils, Using as: Assembler Directives, web page: pseudo-ops (accessed 23 November 2026)](https://sourceware.org/binutils/docs/as/Pseudo-Ops.html)
- [GNU Binutils, Using as: .macro, web page: macro definitions (accessed 23 November 2026)](https://sourceware.org/binutils/docs/as/Macro.html)
- [GNU Binutils, ld manual: Overview, web page: what the linker does (accessed 23 November 2026)](https://sourceware.org/binutils/docs/ld/Overview.html)
- [GNU Binutils, objdump, web page: disassembly from the command line (accessed 23 November 2026)](https://sourceware.org/binutils/docs/binutils/objdump.html)
- [GNU Project, Overview of the GNU System, gnu.org, web page: what GNU stands for (accessed 23 November 2026)](https://www.gnu.org/gnu/gnu-history.html)
- [NASM, The Netwide Assembler manual, chapter 1, web page: what NASM is (accessed 23 November 2026)](https://www.nasm.us/doc/nasmdoc1.html)
- [NASM, The Netwide Assembler manual, chapter 2, web page: multipass optimization (accessed 23 November 2026)](https://www.nasm.us/doc/nasmdoc2.html)
- [Microsoft, Microsoft Macro Assembler reference, Microsoft Learn, web page: MASM (accessed 23 November 2026)](https://learn.microsoft.com/en-us/cpp/assembler/masm/microsoft-macro-assembler-reference)
- [The Go Authors, A Quick Guide to Go's Assembler, go.dev, web page: the Plan 9 style and the semi-abstract instruction set (accessed 23 November 2026)](https://go.dev/doc/asm)
- [The Rust Project, The Rust Reference: Inline assembly, web page: asm!, naked_asm! and global_asm! (accessed 23 November 2026)](https://doc.rust-lang.org/reference/inline-assembly.html)
- [Linux kernel, arch/x86/boot/header.S, GitHub mirror, source file: real-mode boot code, 0x07C0 and the 0xAA55 boot flag (accessed 23 November 2026)](https://raw.githubusercontent.com/torvalds/linux/master/arch/x86/boot/header.S)
- [OpenSSL Project, crypto/aes/asm/aesni-x86_64.pl, GitHub, source file: authorship, licensing and performance notes of the AES-NI module (accessed 23 November 2026)](https://raw.githubusercontent.com/openssl/openssl/master/crypto/aes/asm/aesni-x86_64.pl)
- [FFmpeg, asm-lessons, lesson 1, GitHub, source file: why FFmpeg writes SIMD assembly by hand (accessed 23 November 2026)](https://raw.githubusercontent.com/FFmpeg/asm-lessons/main/lesson_01/index.md)
- [Matt Godbolt, Happy 10th Birthday Compiler Explorer!, xania.org, June 2022, web page: origin, renaming and usage figures (accessed 23 November 2026)](https://xania.org/202206/happy-birthday-ce)
- [Compiler Explorer, README, GitHub, source file: what the site does (accessed 23 November 2026)](https://raw.githubusercontent.com/compiler-explorer/compiler-explorer/main/README.md)
- [Compiler Explorer, godbolt.org, public compile interface with GNU binutils 2.45 for x86-64, AArch64 and RISC-V: cross-check of the three hand-assembled listings (used 23 November 2026)](https://godbolt.org/)
- [Apollo-11 repository, README, GitHub, source file: the Comanche055 and Luminary099 listings (accessed 23 November 2026)](https://raw.githubusercontent.com/chrislgarry/Apollo-11/master/README.md)
- [TIOBE Software, TIOBE Index for November 2026, web page: the rank of assembly language (accessed 23 November 2026)](https://www.tiobe.com/tiobe-index/)
- [WebAssembly Community Group, WebAssembly home page, web page: definition of WebAssembly (accessed 23 November 2026)](https://webassembly.org/)
- [WebAssembly Community Group, WebAssembly Core Specification: Binary Format, Modules, web page: the magic number (accessed 23 November 2026)](https://webassembly.github.io/spec/core/binary/modules.html)
- [Hovav Shacham, The Geometry of Innocent Flesh on the Bone: Return-into-libc without Function Calls (on the x86), full version of the ACM CCS 2007 paper, Cornell University course copy, PDF: gadgets, the English analogy, the decoding example and W⊕X (accessed 23 November 2026)](https://www.cs.cornell.edu/courses/cs5432/2021sp/reading/ROP.x86.pdf)
- [National Security Agency, Ghidra README, GitHub, source file: what Ghidra is and does (accessed 23 November 2026)](https://raw.githubusercontent.com/NationalSecurityAgency/ghidra/master/README.md)
- [GitHub, repository record of NationalSecurityAgency/ghidra, API response: creation date (accessed 23 November 2026)](https://api.github.com/repos/NationalSecurityAgency/ghidra)
- [Legal Information Institute, 17 U.S. Code 1201, Circumvention of copyright protection systems, Cornell Law School, web page: subsection (f) on reverse engineering (accessed 23 November 2026)](https://www.law.cornell.edu/uscode/text/17/1201)
- [Presidência da República, Lei 9.609, de 19 de fevereiro de 1998, Planalto, web page: article 6 (accessed 23 November 2026)](https://www.planalto.gov.br/ccivil_03/leis/l9609.htm)
- [The Register, Zilog to end standalone sales of the legendary Z80 CPU, London, 22 April 2024, web page: the end-of-life notice and the Z80's history (accessed 23 November 2026)](https://www.theregister.com/2024/04/22/z80_cpu_end_of_sales/)
- [João Alexandre Magri, Linguagens de programação, Micro Sistemas no. 11, ATI Editora, August 1982, Internet Archive text: why use Assembler (accessed 23 November 2026)](https://archive.org/download/microsistemas/MicroSistemas011_djvu.txt)
- [Amaury Moraes Jr., Curso de Assembler I, Micro Sistemas no. 17, ATI Editora, February 1983, Internet Archive text: the Z80 course (accessed 23 November 2026)](https://archive.org/download/microsistemas/MicroSistemas017_djvu.txt)
- [Rui Cesar Torres, program renumbering on the TK82-C, Micro Sistemas no. 21, ATI Editora, June 1983, Internet Archive text: Z80 code in a REM line run with USR 16514 (accessed 23 November 2026)](https://archive.org/download/microsistemas/MicroSistemas021_djvu.txt)
- [Domingos Zaparolli, O legado do Patinho Feio, Revista Pesquisa FAPESP no. 322, São Paulo, December 2022, web page: the course, the inauguration, the G-10 and the MC 500 (accessed 23 November 2026)](https://revistapesquisa.fapesp.br/o-legado-do-patinho-feio/)
- [Neldson Marcolin, Patinho Feio completa 30 anos, Revista Pesquisa FAPESP no. 76, São Paulo, June 2002, web page: the hardware and the software team (accessed 23 November 2026)](https://revistapesquisa.fapesp.br/patinho-feio-completa-30-anos/)
- [Jornal da USP, Cerimônia na Poli marca celebração dos 50 anos do primeiro computador brasileiro, São Paulo, 23 September 2022, web page: the G-10 and the first Brazilian commercial computer (accessed 23 November 2026)](https://jornal.usp.br/?p=566577)
- [Wikipedia, Assembly (demoparty), web page: the first Assembly in 1992 and the event today (accessed 23 November 2026)](https://en.wikipedia.org/wiki/Assembly_(demoparty))
- [Aalto University, The demoscene accepted to the national inventory of living heritage, Espoo, 7 May 2020, web page: Finland's decision (accessed 23 November 2026)](https://www.aalto.fi/en/news/the-demoscene-accepted-to-the-national-inventory-of-living-heritage)
- [Art of Coding, demoscene-the-art-of-coding.net, web page: the countries that recognized the demoscene by April 2026 (accessed 23 November 2026)](https://demoscene-the-art-of-coding.net/)
