Assembler is a low-level programming language which is a human-readable format for recording machine instructions.
Assembler language commands correspond one-to-one to processor commands and, in fact, represent a convenient symbolic form of recording (mnemonic code) of commands and their arguments. Assembly language also provides basic program abstractions: linking program parts and data via labels with character names and directives.
Assembly directives also provide the ability to include data blocks (either explicitly described or read from a file); to repeat a fragment for a number of times; to compile a fragment by condition; to set the fragment’s execution address, to change label values during compilation; to use macro definitions with parameters, etc.
Each processor model, in principle, has its own set of instructions and its own assembly language (or dialect).
Advantages and disadvantages
The minimum amount of redundant code (the use of a smaller number of commands and memory accesses). As a consequence – a higher speed and smaller size of the program.
large amount of code, a large number of additional small problems
bad code readability, difficulty of support (debugging, adding capabilities)
difficult to implement programming paradigms and any other complex conventions, difficulty of joint development
smaller number of available libraries, their low compatibility
direct access to the hardware: input-output ports, special registers of the processor
the possibility to write a self-modifying code (i.e. metaprogramming, and without the need of a program interpreter).
The maximum “fit” for the required platform (using special instructions, the technical features of the “iron”)
intolerance to other platforms (other than binary compatible).
Syntax
There is no generally accepted standard for assembly language syntax. However, there are de-facto standards which are the traditional approaches followed by most assembly language developers. The main such standards are Intel syntax and AT&T syntax.
An opcode is the direct mnemonic of an instruction to the processor. Prefixes can be added to it (repetitions, address type changes, etc.). Operands can be constants, register names, RAM addresses, etc.. The differences between Intel and AT&T are mainly in the operands order and syntax for the different addressing methods.
Used mnemonics are usually similar for all processors of the same architecture or architecture family (among the well-known ones are Motorola, ARM, x86 processors and controllers mnemonics). They are described in the processor specification.
For example, the Zilog Z80 processor inherited the Intel i8080 instruction system, extended it and changed the mnemonics (and register mappings) in its own way. For example, it changed the Intel mov to ld. The Motorola Fireball processors inherited the Z80 command system, slightly cutting it down. At the same time Motorola officially returned to the Intel mnemonics. At the moment half of the Fireball assemblers works with Intel mnemonics, and the other half with Zilog mnemonics.
Directives
In addition to instructions the program may contain directives: commands, not directly translated into machine instructions, but which control the operation of the compiler. Their set and syntax vary considerably and depend not on the hardware platform, but on the compiler used (giving rise to language dialects within the same family of architectures). As a set of directives we can distinguish:
definition of data (constants and variables)
control over the program organization in memory and output file parameters
specifying the compiler mode
all sorts of abstractions (i.e. elements of high-level languages) – from the design of procedures and functions (to simplify the implementation of the procedural programming paradigm) to conditional structures and loops (for the structural programming paradigm)
macros
The origin and critique of the term “assembly language”.
This type of language got its name from the name of the translator (compiler) from these languages Assembler. The Assembler name comes from the fact that the first computers didn’t have higher-level languages, and the only alternative to creating programs with the Assembler was to program directly in the codes.