0Pricing
Assembly Language & x86 Low-Level Systems Programming · Lesson

Memory Addressing Modes

Explore different ways to access memory locations using various addressing modes like direct, indirect, base, index, and scaled-index.

Memory's Many Paths

Welcome! Today, we'll learn how your CPU finds data in memory. This is crucial for understanding how programs work at a low level.

Memory addressing modes are the different ways a CPU can calculate the effective memory address of an operand.

  • They allow flexible access to data.
  • They're key for arrays, structures, and dynamic data.

Direct Addressing: Fixed Spots

Direct addressing is the simplest way to access memory. You provide the exact, fixed address of the data you want.

Think of it like going to a specific house number on a street. It's straightforward but not very flexible if you need to access different houses dynamically.

Try running this example:

section .data
  ; Define a word (2-byte) variable at a specific label
  my_data dw 0x1234

section .text
  global _start

_start:
  ; Move the content of 'my_data' into the AX register
  ; The CPU directly accesses the address associated with 'my_data'
  mov ax, [my_data]

  ; Exit program (Linux specific syscall)
  mov eax, 1    ; syscall number for exit
  xor ebx, ebx  ; exit code 0
  int 0x80      ; call kernel

All lessons in this course

  1. x86 Registers Demystified
  2. Memory Addressing Modes
  3. Data Representation and Types
  4. The FLAGS Register and Status Bits
← Back to Assembly Language & x86 Low-Level Systems Programming