Assembly language is a low-level programming language that represents machine instructions with symbolic mnemonics and operands. It lets programmers specify operations down to individual instructions, but its code is difficult for humans to read and write. section 1.1
Counting from 0 to 9
A short assembly program can count from 0 to 9 by moving values into registers, storing a character, invoking output, incrementing the value, and repeating with a loop. The example exposes the detailed steps hidden by higher-level languages. section 1.1
Assembly was useful when performance mattered more than programmer convenience. Speed-critical parts of 1990s games such as Doom and Quake used it to extract performance from underpowered computers. Today, compilers commonly translate languages such as Python into assembly or machine code, so few programmers inspect compiler output. section 1.1 section 12.2.2
section .text
global _start
_start:
mov ecx, 10
mov eax, '0'
l1:
mov [num], eax
mov eax, 4
mov ebx, 1
push ecx
mov ecx, num
mov edx, 1
int 0x80
mov eax, [num]
inc eax
pop ecx
loop l1
mov eax, 1
int 0x80
section .bss
num resb 1
Inspect the complete counting listing, including registers, memory storage, output, incrementing, and looping. section 1.1
