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++.

Writing full apps in Assembly is rare today. Escribir aplicaciones enteras en Assembly es raro hoy.

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

Move data between registers by hand. Assembly is the CPU's blueprint. Mueve datos entre registros a mano. El Assembly es el plano de la CPU.

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 looks right but hardware misbehaves, the disassembly tells the truth. Cuando C parece correcto pero el hardware falla, el desensamblado revela la verdad.

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)
.W writes 16 bits: both P1OUT and P2OUT. .W escribe 16 bits: P1OUT y P2OUT a la vez.
REASON 03RAZÓN 03

Timing & OptimizationTemporización y Optimización

Reason about code at the level of individual clock cycles. Razona sobre el código al nivel de ciclos de reloj.

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: only 1s and 0s. Antes del Assembly: sólo 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

▲ 7 lines to compute 5 + 3. ▲ 7 líneas para calcular 5 + 3.

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

One mnemonic, one machine instruction. A near 1:1 symbolic mapping. Un mnemónico, una instrucción máquina. Un mapeo simbólico casi 1:1.

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 arm 30°. Grasp spoon."
(Total control)
"Mueve el brazo 30°. Agarra la cuchara."
(Control total)

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

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

High level: objects and files. Alto nivel: objetos y archivos.
Embedded: addresses and registers. Embebido: direcciones y registros.

Writing a 1 into a register bit = a voltage on a physical pin. Escribir un 1 en un bit del registro = un voltaje en un pin físico.

Same instruction. The address decides whether it hits RAM… or real hardware. Misma instrucción. La dirección decide si cae en RAM… o en hardware real.

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

Bits → hardware. Try it. Bits → hardware. Pruébalo.

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

Now you know the why: explicit CPU control, direct hardware access. Ahora sabes el por qué: control explícito de CPU y hardware directo.

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

The what: digital logic, memory architectures, RISC vs CISC. El qué: lógica digital, arquitecturas, RISC vs CISC.

Start Module 1Comenzar Módulo 1 arrow_forward