EMZETT.
Login

Assembly

In short: The programming language closest to the machine that’s still human-readable — each line corresponds (almost) directly to a processor instruction, dependent on the processor architecture (x86, ARM, etc.).

In more detail: Assembly has no high-level concepts like classes or loop syntax — instead you work directly with CPU registers, memory addresses and jump instructions. Today it’s used almost only for extremely performance-critical code, operating-system/driver development, reverse engineering, or embedded systems with extremely limited resources.

In Depth

Every assembly instruction corresponds (almost) directly to a machine instruction of the respective CPU architecture — so there’s no universal “assembly”, but separate dialects for x86, ARM, RISC-V, etc., which aren’t compatible with each other. A simple example in x86 assembly that adds two registers:

mov eax, 5
add eax, 3   ; eax now contains 8

Because assembly is so close to the hardware, it allows optimisations a compiler doesn’t always find with higher-level languages — but at the cost of readability, development speed and portability (code for one architecture doesn’t run on another). In practice, hardly anyone writes entire programs in assembly today; instead, it’s used selectively, for example for individual extremely hot code paths, when reverse-engineering malware, or to understand what a compiler actually does with higher-level code.

Registers, memory and jump instructions

The basic building blocks of every assembly language are always the same three things: registers (a handful of extremely fast storage locations directly in the CPU, e.g. rax, rbx, rcx on x86-64), memory addresses in RAM (considerably slower than registers, but much larger), and jump instructions (jmp, je, jne), which interrupt normal sequential execution — they’re the raw foundation from which compilers build higher-level constructs like loops and if-conditions. A for loop in Java or Python “doesn’t exist” at the assembly level — it’s translated by the compiler into a combination of comparison and a conditional jump back to the start of the loop.

Assembler, not compiler

The translator from assembly source code to machine code is called an assembler (not a compiler) — the term fits better, because the translation happens almost 1:1, without the complex optimisation steps of a real compiler. Well-known assemblers are NASM and the GNU Assembler (GAS); both support the same x86 architecture, but with different syntax (Intel vs. AT&T syntax), which can be confusing when reading someone else’s assembly code if you only know one of the two variants.

Where assembly still genuinely appears today

In modern applications, assembly almost never appears as complete program code any more, but very much in targeted snippets: operating-system kernels contain assembly for hardware-level operations that can’t be expressed in any higher-level language (interrupt handling, context switching between processes). Compiler authors and security researchers read the assembly output produced by the compiler, to understand performance problems or exploits at the instruction level. And in embedded systems with only a few kilobytes of memory (e.g. simple microcontrollers), assembly is sometimes still the only practical option, because even a minimal C compiler brings too much overhead.

See also: C, CPU