Types of instructions in assembly language: a complete guide

Last update: May 7th 2025
  • Assembly language organizes its instructions by purpose: transfer, calculation, flow control, and more.
  • Each instruction consists of an opcode and operands, with different formats depending on the architecture.
  • There are several addressing modes for accessing data, such as immediate, direct, and indirect.

assembler Machine language and instruction format

Assembly language has been one of the fundamental pillars of software development since the dawn of computing. Although high-level languages ​​dominate the scene today, assembly language remains widely used and relevant in environments where hardware control, optimization, or resource constraints are a priority.

In this article, we'll delve into the types of assembly language instructions, analyzing their structure, purpose, addressing modes, and how they are organized across different architectures. You'll also find examples, formats, and a comprehensive overview that will allow you to fully understand the logic behind these instructions, which operate very closely with the hardware.

What is an instruction in assembly language?

An assembly instruction is a command that the CPU can directly understand (once translated into machine code by an assembler program). Each instruction has a specific purpose and is usually composed of a mnemonic that represents the operation and one or more operands that indicate where the data is taken and/or where the results are stored.

These instructions are highly dependent on the processor architecture, so each type of CPU (whether x86, ARM, MIPS, among others) has its own set of instructions with particular syntax and capabilities.

Structure of an instruction

Instructions are usually composed of two parts:

  • Operation code (opcode): Indicates the action to be executed, such as adding, moving data, comparing, etc.

Operands provide the information necessary to perform the operation and can be stored in registers, memory, or be constants. Not all instructions require operands, and in some cases, these may be implicit in the instruction or stored in predefined registers.

Types of instructions in assembly language

Depending on the function they perform within a program, assembly language instructions can be classified into several groups. The most relevant ones are detailed below:

1. Data transfer instructions

These instructions allow data to be copied from one location to another without modifying its content at the source. They are essential for moving information between registers, memory, and peripherals.

  OpenAI Codex CLI: Everything you need to know about the terminal code assistant

Some of the most common instructions in this group are:

  • MOV: Copies the contents of one operand to another. For example, MOV AX, BX copy the contents of BX to AX.
  • MOVS / MOVSB ​​/ MOVSW: Moves strings from a source address (SI) to a destination address (DI), automating the transfer process.
  • LODS / LODSB / LODSW: Loads a value from the address indicated by the SI register into the accumulator (AL or AX).
  • READ: Loads an effective address instead of a value. Useful for getting the address of a variable or structure.

2. Battery instructions

The stack is a LIFO (last in, first out) structure used to temporarily store data, pass parameters, or save the execution context.

  • PUSH: Stores a value on the stack, decrementing the SP pointer.
  • POP: Retrieves the most recent value stored on the stack, incrementing SP.
  • PUSHF / POPF: They store and retrieve the state of the CPU flags on the stack.

3. Arithmetic and logical instructions

They allow calculations and operations to be performed on bits. These instructions are essential for manipulating numerical data and making decisions in the program flow.

Among the most used we find:

  • ADD / SUB: Addition and subtraction.
  • MUL / IMUL: Binary multiplications.
  • DIV / IDIV: Division (integer or signed).
  • AND / OR / XOR / NOT: Bitwise logical operations.
  • SHL / SHR / ROL / ROR: Bit shifts and rotations.

4. Flow control instructions

They allow you to modify the program's execution sequence , introducing jumps or conditional and unconditional calls to other instructions.

  • JMP: Unconditionally jumps to another address in the program.
  • CALL / RET: Call to a subroutine and return.
  • JE/JNE/JG/JL/JZ/JNZ: Conditional jumps, they are executed if certain conditions are met (after a comparison).

5. Input/Output (I/O) Instructions

They enable communication between the processor and external devices. These instructions allow data to be read and written to/from ports (hardware).

  • IN: Reads data from an input port.
  • OUT: Sends data to an output port.

6. Floating point instructions

Many CPUs have math coprocessors (or special instructions) dedicated to working with decimal (floating-point) numbers. These instructions allow operations such as:

  • Addition, subtraction, multiplication and division of real numbers.
  • Trigonometric operations (sine, cosine, tangent).
  • Logarithmic, exponential and root operations.
  Regular Expressions (RegEx): Complete Guide and Examples

These instructions typically comply with the IEEE 754 standard for numerical precision.

Addressing modes

A fundamental part of instruction design is how the location of operands is identified. Addressing modes define how the CPU accesses data.

1. Immediate addressing

The data is included directly in the instruction. It's fast, but it doesn't allow modifying values ​​without changing the instruction.

MOV AX, 5

2. Direct addressing

The memory address containing the data is specified explicitly.

MOV AX, 

3. Indirect addressing

The effective address is obtained from the contents of a record. Very flexible and used for structures and linked lists.

MOV AX, 

4. Indexed addressing

The address is calculated by adding a base and an index (for example, to traverse arrays). It uses special registers such as SI, DI, or base + offset registers.

MOV AX, 

Instruction formats: different types depending on the architecture

The structure of an instruction can vary depending on the architecture. Common formats include:

4-way format

It includes two operands, a result location, and the address of the next instruction. It is now obsolete due to its complexity.

3-way format

It specifies two operands and a destination address. It is common in modern RISC architectures.

2-way format

Use a source operand and a destination operand (the destination can also contribute value). Popular on x86 and other CISC architectures.

1-way format

Only one operand is specified; the other is assumed to be the accumulator. Common in older processors and simple systems.

0-address format (stack-based)

The operations use the stack to fetch and store operands and results. Very efficient for stack-based machines, such as some programmable calculators.

Macro instructions and pseudo-opcodes

To improve productivity, many assemblers offer macro instructions , which expand a single line into several actual instructions. These are useful for avoiding repeating complex patterns or for creating high-level structures such as loops or conditional statements.

The pseudo-opcodes are instructions that the assembler internally translates into an actual sequence of instructions. For example, NOP (no operation) can be translated as XCHG AX, AX on x86 CPU.

  Complete Guide to the Agent Development Kit (ADK) for Kotlin

Assembler directives

Directives ( also called pseudo-operations ) are not instructions in the strict sense. They serve to control the assembly process, define data, code sections, macros, compilation conditions, etc.

Common examples include:

  • .data / .code: They indicate the data or code section.
  • .org: Sets the address from which the assembly will start.
  • .equ: Defines symbolic constants.

Assembly language use cases

Despite the rise of high-level languages, assembly language remains key in several areas:

  • Development of embedded systems and microcontrollers.
  • Programming drivers, bootloaders and BIOS.
  • Extreme optimization in applications such as video games or cryptography.
  • Reverse engineering, debugging, and low-level hacking.

Furthermore, training in assembly language still occupies an important place in computer science and electronics degrees, as it provides a deep understanding of how a processor works, how data is stored and manipulated, and how instructions are executed at the binary level.

Understanding all types of assembly instructions, their structure, functionality, and addressing modes provides a solid foundation for any programmer who wants to delve into low-level programming or understand how high-level languages ​​are ultimately translated into machine code. Although its use has become more specific, it remains an essential tool in multiple critical areas of software and systems development.

Assembly language
Related articles:
All about Assembly Language: What It Is and How It Works