A family of very low-level programming languages, just above machine code, where each statement corresponds to a single machine code instruction.
Assembly is a family of very low-level programming languages, just above machine code. In assembly, each statement corresponds to a single machine code instruction. These instructions are converted into executable machine code by a utility program referred to as an [assembler]; the conversion process is referred to as assembly, or assembling the code.
There is a large degree of diversity in the way that assemblers categorize statements and in the nomenclature that they use. In particular, some describe anything other than a machine mnemonic or extended mnemonic as a pseudo-operation (pseudo-op). A typical assembly language consists of three types of instruction statements that are used to define program operations:
- [Opcode] mnemonics
- Data sections
- Assembly directives
Opcode mnemonics and extended mnemonics
Instructions (statements) in assembly language are generally very simple, unlike those in [high-level language]. Generally, a mnemonic is a symbolic name for a single executable machine language instruction (an opcode), and there is at least one opcode mnemonic defined for each machine language instruction. Each instruction typically consists of an operation or opcode plus zero or more [operands]. Most instructions refer to a single value, or a pair of values. Operands can be immediate (value coded in the instruction itself), registers specified in the instruction or implied, or the addresses of data located elsewhere in storage. This is determined by the underlying processor architecture: the assembler merely reflects how this architecture works. Extended mnemonics are often used to specify a combination of an opcode with a specific operand. For example, the System/360 assemblers use
B as an extended mnemonic for
BC with a mask of 15 and
BC with a mask of 0.
Extended mnemonics are often used to support specialized uses of instructions, often for purposes not obvious from the instruction name. For example, many CPU's do not have an explicit
NOP instruction, but do have instructions that can be used for the purpose. In 8086 CPUs the instruction
xchg ax,ax is used for
nop being a pseudo-opcode to encode the instruction
xchg ax,ax. Some disassemblers recognize this and will decode the
xchg ax,ax instruction as
nop. Similarly, IBM assemblers for System/360 and System/370 use the extended mnemonics
BCR with zero masks. For the SPARC architecture, these are known as synthetic instructions
Some assemblers also support simple built-in macro-instructions that generate two or more machine instructions. For instance, with some Z80 assemblers the instruction
ld hl,bc is recognized to generate
ld l,c followed by
ld h,b. These are sometimes known as pseudo-opcodes.