assembly language
termKept in this browser · My desk
A notation for machine code in which each line names one processor instruction: a mnemonic for the operation, names for the registers, labels instead of addresses. An assembler translates it into bytes one for one.
Assembly is where software meets the processor's own vocabulary, so it turns up wherever a compiler cannot reach or cannot be trusted: boot code, cryptographic and multimedia kernels, debuggers, malware analysis. There is no single assembly language for a processor, only one notation per assembler, which is why the same x86 instruction is written add rax, rdi in Intel syntax and addq %rdi, %rax in AT&T syntax. Its origin has two documented claims: Kathleen Booth's 1947 notation and David Wheeler's EDSAC initial orders of 1949.
What it is. Intel's manual describes the notation it uses as a subset of the IA-32 (Intel Architecture, 32-bit) assembly language in which an instruction is written label: mnemonic argument1, argument2, argument3, where a mnemonic is "a reserved name for a class of instruction opcodes which have the same function" and, with two operands, the right one is the source and the left the destination. IBM put the idea to its 1401 customers in a manual copyrighted from 1959: symbolic programming uses mnemonic characters, the program written in symbols is the source program, the machine-language result is the object program, and the translation is "one-for-one", done by a processor "sometimes called an assembly system". Intel's 8080/8085 manual of November 1978 calls the assembler's work "the clerical task of translating symbolic code into object code" and lists its three outputs: the object file, a listing of source and generated code with the symbol table, and a cross-reference of every symbol.
One line, one instruction. That one-for-one relation separates assembly from compiled languages. The line add rax, rdi becomes exactly the three bytes 48 01 F8 on x86-64: 48 is a prefix selecting 64-bit operands, 01 is the opcode Intel lists for ADD r/m64, r64, and F8 is the ModR/M byte naming RDI as source and RAX as destination. An x86 instruction is built from optional prefixes, one to three opcode bytes, a ModR/M byte, a SIB (scale-index-base) byte, a displacement and an immediate, and never exceeds 15 bytes. Fixed-width architectures are simpler: mov x1, #0 becomes the 32-bit word D2800001 on AArch64; li a1, 0 becomes 00000593 on RISC-V. Some lines are pseudo-instructions that the assembler expands (RISC-V's li, mv, beqz and ret): the RISC-V Assembly Programmer's Manual shows li a0, 0xdeadbeef becoming two instructions on a 32-bit target, lui a0, 0xdeadc and addi a0, a0, -273, because a 32-bit constant does not fit in one. The same manual gives each register two names, such as x10 and a0, the second from the calling convention.
Statements and directives. The GNU assembler's manual says a statement begins with zero or more labels, each a symbol followed by a colon, then a key symbol: if it begins with a dot the statement is a directive, if with a letter it is an instruction that assembles into a machine instruction, and "the same symbol may represent a different instruction in a different computer's assembly language". Directives place data and set options rather than produce instructions (.align, .ascii, .byte and many more). The Netwide Assembler (NASM), at version 3.02, describes its line as label: instruction operands ; comment, with pseudo-instructions such as DB and DW for initialized data, RESB for reserved space, EQU for constants and TIMES for repetition. The Microsoft Macro Assembler (MASM) adds a macro language with loops, arithmetic and strings. Syntax is per assembler, not per processor: the GNU assembler's default AT&T syntax writes the same addition addq %rdi, %rax, with $ before immediates, % before registers, a size suffix and the operands reversed.
Two passes. A label may be used before it is defined, as in a call to a later subroutine. David Salomon's Assemblers and Loaders (1993) calls this the future symbol problem and describes the two answers: a one-pass assembler that loads code straight into memory, and the two-pass assembler most systems use, which collects every label into the symbol table on the first pass and assembles the instructions on the second, producing a relocatable object file for a linker and loader to place.
Who was first. MacTutor calls Kathleen Booth "the first to create assembly language", from the reports she and Andrew Booth wrote at the Institute for Advanced Study in 1947, and The Register's 2022 obituary says her Contracted Notation "is today known as assembly language". The extracts MacTutor publishes show the reports written in the summer of 1947 by Andrew Booth and Kathleen Britten, as she then was; in Coding for the A.R.C. (Automatic Relay Computer) they made the relay machine's code identical to the one planned for their electronic computer. The IEEE Computer Society calls David Wheeler's initial orders for the EDSAC (Electronic Delay Storage Automatic Calculator), 31 instructions that assembled programs written as letters and numbers from paper tape in 1949, "the first 'assembly language'". Wheeler's own notes, kept by the Cambridge Computer Laboratory, explain the form: a 17-bit order of five function bits, a spare bit, ten address bits and a length bit, written as a function letter, a decimal address and F or D, as in S 4D, with letters chosen to be "as mnemonic as possible" (no J for jump, since the operation was thought of as "transfer of control"), and orders mixed with directives. The laboratory's chronology dates the first logged program to 6 May 1949 and the wiring of Initial Orders 2 to 22 October 1949. Salomon credits Maurice Wilkes with labels ("floating addresses"), an early form of macros ("synthetic orders") and the first subroutine library. Both claims are documented; they answer different questions.
Into industry. Salomon dates the IBM 650's first deliveries to about 1953 and describes its SOAP (Symbolic Optimum Assembly Program) as a symbolic assembler that also placed each instruction on the magnetic drum where it would come under the read head just as the previous one finished. In February 1958 D. E. Knuth of the Case Institute of Technology documented CASE SOAP III, a revision of SOAP II, originally written by Stan Poley at IBM, with 24 new pseudo-operations, and in August 1959 his SuperSoap for a 650 with extra attachments such as index registers, core memory and a disk unit. For the IBM 704, first delivered in 1956, Roy Nutt of United Aircraft wrote UASAP-1 (United Aircraft Symbolic Assembly Program), a later version of which IBM's user group SHARE adopted and distributed.
What goes wrong. The classic misreading is operand order: Intel syntax puts the destination first and AT&T last, so a listing read in the wrong convention inverts every move. Disassembly is not simply assembly reversed: GNU objdump's -d option decodes only the sections expected to hold instructions, -D decodes everything, and -M intel or -M att picks the syntax. Hovav Shacham showed in 2007 that x86 is so dense that decoding from one byte later yields different, valid instructions, the raw material of return-oriented programming, whereas on an architecture with aligned 32-bit instructions, such as MIPS, there is no such ambiguity.
In Brazil. Brazilian practice long used "Assembler" for the language itself: the magazine Micro Sistemas in August 1982 described programs written "em linguagem de máquina ou em Assembler, uma linguagem que utiliza símbolos ou códigos mnemônicos". WebAssembly, despite the name, is not an assembly language for any physical processor but "a binary instruction format for a stack-based virtual machine".
Also known as: assembly, asm, assembler language, linguagem de montagem, linguagem assembly
Sources
- Intel, Intel 64 and IA-32 Architectures Software Developer's Manual, order 325462-093: instruction format of optional prefixes, one to three opcode bytes, ModR/M, SIB, displacement and immediate (Vol. 2A, p. 2-1); the 15-byte limit (Vol. 3A, p. 7-44); the label: mnemonic argument notation and the definition of a mnemonic as a reserved name for a class of opcodes with the same function (Vol. 1, p. 1-7) (read 2026-11-23)
- IBM, IBM 1401 Symbolic Programming Systems SPS-1 and SPS-2, C24-1480-0, 1959 to 1962: symbolic programming with mnemonic characters; source and object programs; one-for-one translation by a processor 'sometimes called an assembly system' (p. 5) (read 2026-11-23)
- MacTutor History of Mathematics, Kathleen Booth: 'the first to create assembly language'; the 1947 reports General considerations and Coding for the A.R.C., written at the Institute for Advanced Study (read 2026-11-23)
- The Register, RIP: Kathleen Booth, the inventor of assembly language, 29 October 2022: Contracted Notation for the ARC2 and SEC, 'today known as assembly language' (read 2026-11-23)
- IEEE Computer Society, David Wheeler: the EDSAC initial orders as 'the first assembly language'; the 1985 Computer Pioneer Award 'for assembly language programming' (read 2026-11-23)
- University of Cambridge Computer Laboratory, EDSAC statistics: initial orders of 31 instructions on uniselectors that assembled programs in symbolic form from paper tape; the second release with relocation in 41 words (read 2026-11-23)
- GNU Binutils, Using as, AT&T Syntax versus Intel Syntax: $ and % prefixes, reversed operand order, size suffixes (read 2026-11-23)
- Micro Sistemas no. 11, August 1982 (Internet Archive text): 'linguagem de máquina ou em Assembler, uma linguagem que utiliza símbolos ou códigos mnemônicos' (read 2026-11-23)
- WebAssembly home page: a binary instruction format for a stack-based virtual machine; the Core Specification's module magic number 0x00 0x61 0x73 0x6D (read 2026-11-23)
- Compiler Explorer, godbolt.org public API with GNU binutils 2.45: the Learn article's three listings assembled to the hand-computed bytes (read 2026-11-23)
- University of Cambridge Computer Laboratory, The EDSAC Order Code: Explanatory Notes, by David Wheeler (read 2026-11-23): 17-bit orders of five function bits, a spare bit, ten address bits and a length discriminant; written as function letter, decimal address and F or D, e.g. S 4D; letters made as mnemonic as possible, J not used for jump because the operation was thought of as transfer of control; orders mixed with directives; the 1949 order code
- University of Cambridge Computer Laboratory, EDSAC chronology (read 2026-11-23): initial orders wired during early 1949; first logged program on 6 May 1949; Initial Orders 2 wired by 22 October 1949; coordinating orders, loaded separately, had more assembly features than Initial Orders 2
- MacTutor History of Mathematics, The Booth-Britten 1947 reports, extracts (read 2026-11-23): reports written jointly by Andrew Booth and Kathleen Britten (later Kathleen Booth) at the Institute for Advanced Study in the summer of 1947; Coding for the A.R.C. made the code of the relay computer identical with that projected for the electronic machine
- GNU Binutils, Using as, 3.5 Statements (read 2026-11-23): a statement begins with zero or more labels and a key symbol; a symbol beginning with a dot is a directive, one beginning with a letter an instruction; the same symbol may represent a different instruction in a different computer's assembly language; a label is a symbol followed by a colon
- GNU Binutils, Using as, 7 Assembler Directives (read 2026-11-23): all directives begin with a period and are case insensitive on most targets; the machine-independent list from .abort and .align to the end of the alphabet
- NASM, The Netwide Assembler version 3.02, chapter 3, The NASM Language (read 2026-11-23): a source line is label: instruction operands ; comment; pseudo-instructions DB, DW, DD, DQ and others, RESB and its family, INCBIN, EQU and TIMES
- Microsoft Learn, Microsoft Macro Assembler reference (read 2026-11-23): MASM has a macro language with looping, arithmetic and string processing; ML and ML64 command-line tools
- RISC-V Assembly Programmer's Manual, riscv-non-isa asm-manual.adoc (read 2026-11-23): register names x0 to x31 with their calling-convention names (x10 is a0); assembler directives; li a0, 0xdeadbeef assembled for RV32I as lui a0, 0xdeadc and addi a0, a0, -273
- Intel, 8080/8085 Assembly Language Programming Manual, 9800301C, November 1978, copy at bitsavers (read 2026-11-23): an assembler performs the clerical task of translating symbolic code into object code; mnemonic opcodes such as MOV and JMP; outputs an object file, a list file with the symbol table and a symbol cross-reference file; relocatable object code
- David Salomon, Assemblers and Loaders, Ellis Horwood, 1993, author's copy (read 2026-11-23): the EDSAC's Initial Orders as an assembler in a read-only memory of telephone selectors; Wilkes's floating addresses, synthetic orders and subroutine library; the IBM 650 delivered around 1953 and SOAP's drum placement; UASAP-1 for the IBM 704 by Roy Nutt in 1956, a later version adopted by SHARE; the future symbol problem; two-pass assemblers collect labels in pass one and assemble in pass two
- Computer History Museum, D. E. Knuth, CASE SOAP III, Symbolic Optimum Assembly Program for the IBM 650, Case Institute of Technology Computing Center, February 1958 (read 2026-11-23): a modified version of SOAP II originally written by Stan Poley of IBM; twenty-four new pseudo-operations
- Computer History Museum, Donald E. Knuth, SuperSoap Assembly System for the Augmented 650, Case Institute of Technology, 20 August 1959 (read 2026-11-23): a major revision of Case SOAP III for a 650 with index registers, core, a disk file unit and table lookup on equal
- Hovav Shacham, The Geometry of Innocent Flesh on the Bone: Return-into-libc without Function Calls (on the x86), full version of the CCS 2007 paper, Cornell course copy (read 2026-11-23): the x86 instruction set is extremely dense, so decoding from a different byte yields unintended valid instructions; on MIPS, with aligned 32-bit instructions, there are none
- GNU Binutils, objdump (read 2026-11-23): -d disassembles only the sections expected to contain instructions, -D all non-empty sections; -M intel and -M att select the x86 syntax