Module 0Módulo 0

Intro to AssemblyIntroducción al Ensamblador

Why, in the age of AI and Python, we still need to understand code close to machine language. Por qué, en la era de la IA y Python, seguimos necesitando entender código cercano al lenguaje máquina.

Santi Scagliusi, PhD

Reality CheckComprobación de Realidad

"Most modern firmware is written in C or C++." "La mayoría del firmware moderno se escribe en C o C++."

In 2026, compilers are incredibly smart. Writing an entire application in Assembly is usually inefficient, risky, and hard to maintain. En 2026, los compiladores son increíblemente inteligentes. Escribir una aplicación entera en Assembly suele ser ineficiente, arriesgado y difícil de mantener.

So why are you here?Entonces, ¿por qué estás aquí?

Three Reasons to Learn Assembly in 2026 Tres Razones para Aprender Assembly en 2026

REASON 01RAZÓN 01

Architecture AwarenessConocimiento de la Arquitectura

You cannot truly understand how a CPU works until you've manually moved data between registers. Assembly is the blueprint of the processor. No puedes entender realmente cómo funciona una CPU hasta que hayas movido datos manualmente entre registros. El Assembly es el plano del procesador.

CPU
Unified BusBus Unificado
Instr & Data mixMezcla Instr y Datos
MemoryMemoria
CodeCódigo
DataDatos
"Shared memory space for Instructions and Data" "Espacio de memoria compartido para Instrucciones y Datos"
REASON 02RAZÓN 02

Extreme DebuggingDepuración Extrema

When C code looks correct but hardware behaves weirdly, the Disassembly reveals the truth. Cuando el código C parece correcto pero el hardware se comporta de forma extraña, el Desensamblado revela la verdad.

Example: You mistakenly used a 16-bit write for what you thought was a single 8-bit GPIO register. Ejemplo: Usaste por error una escritura de 16 bits para lo que creías que era un único registro GPIO de 8 bits.

C Code:Código C: *ptr = 0x0001; (ptr is int*)
Disassembly ViewVista de Desensamblado
MOV.W #0x0001, &P1OUT
; .W updates the full 16-bit PAOUT register starting at 0x0202 ; .W actualiza el registro PAOUT completo de 16 bits empezando en 0x0202
warning Collateral Register WriteEscritura Colateral en Registro
0x0202 (P1OUT, low byte) 0x01 (intended)0x01 (intencionado)
0x0203 (P2OUT, high byte) 0x00 (written too)0x00 (también escrito)
On the MSP430FR6989, P1OUT is the low byte of the 16-bit PAOUT register. A word write also touches the neighboring high byte (P2OUT). Disassembly reveals these device-specific side effects. En el MSP430FR6989, P1OUT es el byte bajo del registro de 16 bits PAOUT. Una escritura de palabra también toca el byte alto contiguo (P2OUT). El desensamblado revela estos efectos específicos del dispositivo.
REASON 03RAZÓN 03

Timing & OptimizationTemporización y Optimización

Sometimes, you need to reason about code at the level of individual clock cycles. Assembly gives you direct visibility and much tighter control, although the final timing still depends on the concrete device, clocking, and memory system. A veces, necesitas razonar sobre el código al nivel de ciclos de reloj individuales. El Assembly te da visibilidad directa y un control mucho más fino, aunque la temporización final sigue dependiendo del dispositivo concreto, del reloj y del sistema de memoria.

bolt
SpeedVelocidad
battery_full
PowerEnergía
timer
Real-TimeTiempo Real

The Origin StoryLa Historia del Origen

Now that you know why it matters, let's see where it comes from.Ahora que sabes por qué importa, veamos de dónde viene.

The Problem with "Raw" BinaryEl Problema del Binario "Crudo"

Before Assembly, engineers had to program physically or via raw binary. Imagine trying to debug a sequence of 1s and 0s. Antes del Assembly, los ingenieros tenían que programar físicamente o mediante binario crudo. Imagina intentar depurar una secuencia de 1s y 0s.

MACHINE CODECÓDIGO MÁQUINA
0100 0000 0011 0100
0000 0000 0000 0101
0100 0000 0011 0101
0000 0000 0000 0011
0101 0101 0000 0100
0100 0000 1000 0010
0000 0010 0000 0000

▲ This program adds 5 + 3 and stores the result. Seven lines just for that! ▲ Este programa suma 5 + 3 y almacena el resultado. ¡Siete líneas solo para eso!

ENIAC programmers manually wiring the first electronic computer
Manual WiringCableado Manual
ENIAC, 1945 - Early Electronic ProgrammingENIAC, 1945 - Programación Electrónica Temprana

The Solution: MnemonicsLa Solución: Mnemónicos

BINARYBINARIO
0100 0000
arrow_forward
ASSEMBLY
MOV

At its core, Assembly is a near 1:1 symbolic representation of machine instructions for a specific ISA, although assemblers also add labels, directives, and convenience instructions. En su núcleo, el Assembly es una representación simbólica casi 1:1 de las instrucciones máquina de una ISA concreta, aunque los ensambladores también añaden etiquetas, directivas e instrucciones de conveniencia.

The Chef vs. The RecipeEl Chef vs. La Receta

Understanding Abstraction LevelsComprendiendo los Niveles de Abstracción

High LevelAlto Nivel

Python
A = B + C

"Make me a cake."
(You don't care how)
"Hazme un pastel."
(No te importa cómo)

Mid LevelNivel Medio

C Lang
int a = b + c;

"Mix flour and sugar."
(Standard recipe)
"Mezcla harina y azúcar."
(Receta estándar)

THIS COURSEESTE CURSO

Low LevelBajo Nivel

ASM
MOV R5, R4
ADD R6, R4
MOV R4, &A

"Move your left arm 30 degrees. Grasp spoon."
(Total control)
"Mueve tu brazo izquierdo 30 grados. Agarra la cuchara."
(Control total)

1. The Brain: Interactive CPU 1. El Cerebro: CPU Interactiva

You've seen the code. Now see how the "Brain" executes it step-by-step. Has visto el código. Ahora observa cómo el "Cerebro" lo ejecuta paso a paso.

ASSEMBLY INSTRUCTIONINSTRUCCIÓN ASSEMBLY
Current OperationOperación Actual
System Reset. Ready to fetch.Sistema reiniciado. Listo para buscar.
RAM / FRAM
0x1C00
0x000A
Var A (10)
0x1C02
0x0014
Var B (20)
0x1C04
0x0000
ResultResultado
DATA BUS (16-bit)
MSP430 CORE
R4
0x0000
R5
0x0000
ALU

2. The Body: Memory & Peripherals 2. El Cuerpo: Memoria y Periféricos

A brain in a jar is useless. The CPU needs to store memories (RAM/FRAM) and touch the world (I/O). Un cerebro en un frasco es inútil. La CPU necesita almacenar memorias (RAM/FRAM) e interactuar con el mundo (E/S).

The "Map" of the BodyEl "Mapa" del Cuerpo

In high-level languages, you talk to "objects" or "files". In Embedded Systems, many critical hardware resources are exposed through addresses and registers. En lenguajes de alto nivel, hablas con "objetos" o "archivos". En Sistemas Embebidos, muchos recursos hardware críticos se exponen mediante direcciones y registros.

At the hardware boundary, turning on a light means writing a 1 into the register bit that controls that pin. If the pin is configured as a GPIO output, that write becomes a voltage on the outside world. En la frontera con el hardware, encender una luz significa escribir un 1 en el bit del registro que controla ese pin. Si el pin está configurado como salida GPIO, esa escritura se convierte en un voltaje hacia el mundo exterior.

link

Memory Mapped I/OE/S Mapeada en Memoria

The most important concept in Embedded Hardware.El concepto más importante en Hardware Embebido.
"At the instruction level, accessing a memory-mapped peripheral register looks like a normal memory access. The difference is what that address is connected to." "A nivel de instrucción, acceder a un registro periférico mapeado en memoria se parece a un acceso normal a memoria. La diferencia está en a qué está conectada esa dirección."
AddressDirección
Physical ConnectionConexión Física
0x1C00
[ RAM Variable ][ Variable RAM ]
0x0202
P1OUT
0x0203
[ P2OUT / upper byte of PAOUT ][ P2OUT / byte alto de PAOUT ]
The CPU simply reads and writes addresses. The memory map determines whether that access hits RAM, code, or a peripheral register with physical consequences. La CPU simplemente lee y escribe direcciones. El mapa de memoria determina si ese acceso cae en RAM, código o un registro periférico con consecuencias físicas.

Final Proof: Controlling RealityPrueba Final: Controlando la Realidad

This is the essence of low-level bare-metal programming. You are not relying on an operating system abstraction here; you are writing hardware control bits directly. Try it. Esta es la esencia de la programación bare-metal de bajo nivel. Aquí no dependes de una abstracción de sistema operativo; estás escribiendo directamente bits de control hardware. Pruébalo.

For simplicity, this demo assumes the relevant pins are already configured as outputs. Para simplificar, esta demo asume que los pines relevantes ya están configurados como salidas.

Memory AddressDirección de Memoria
0x0202 (P1OUT)
Data to WriteDato a Escribir
0x00
P1.6 (LED2)
mode_fan
P1.3 (MOTOR)P1.3 (MOTOR)
P1.0 (LED1)
check_circle

Module 0 CompleteMódulo 0 Completado

You now understand the philosophy behind Assembly: explicit control over the CPU (Brain) and direct access to hardware registers (Body). Ahora comprendes la filosofía detrás del Assembly: control explícito sobre la CPU (Cerebro) y acceso directo a los registros hardware (Cuerpo).

Goal 1Objetivo 1
ContextContexto

Why we still need low-level languages in 2026.Por qué seguimos necesitando lenguajes de bajo nivel en 2026.

Goal 2Objetivo 2
History & AbstractionHistoria y Abstracción

From ENIAC to modern code: the layers between you and the hardware.Del ENIAC al código moderno: las capas entre tú y el hardware.

Goal 3Objetivo 3
First LookPrimer Vistazo

A hands-on preview of the CPU simulator and I/O hardware.Una vista previa práctica del simulador de CPU y el hardware de E/S.

Coming Up: Module 1A Continuación: Módulo 1

Now that you know why, let's understand what. In the next module, we'll cover the foundations: digital logic, embedded systems, memory architectures, and RISC vs CISC — everything you need before writing your first instruction. Ahora que sabes por qué, entendamos qué. En el próximo módulo cubriremos los fundamentos: lógica digital, sistemas embebidos, arquitecturas de memoria y RISC vs CISC — todo lo necesario antes de escribir tu primera instrucción.

Start Module 1Comenzar Módulo 1 arrow_forward