Assembly Course

0. Intro to Assembly

Why, in the age of AI and Python, we still need to speak machine language.

Santi Scagliusi, PhD

🏛️
Architecture
Understanding the core
🐛
Debugging
The power of low-level
📊
Abstraction
From C to Assembly
💾
Hardware
I/O & Memory

Reality Check

"Most modern firmware is written in C or C++."

In 2025, compilers are incredibly smart. Writing an entire application in Assembly is inefficient, dangerous, and hard to maintain.

So why are you here?

Three Reasons to Learn Assembly in 2025

REASON 01

Architecture Awareness

You cannot truly understand how a CPU works until you've manually moved data between registers. Assembly is the blueprint of the processor.

CPU
Unified Bus
Instr & Data mix
Memory
Code
Data
"Shared memory space for Instructions and Data"
REASON 02

Extreme Debugging

When C code looks correct but hardware behaves weirdly, the Disassembly reveals the truth.

Example: You mistakenly used a 16-bit pointer for an 8-bit register.

C Code: *ptr = 0x0001; (ptr is int*)
Disassembly View
MOV.W #0x0001, &P1OUT
; ERROR: .W writes 16 bits to address 0x0202
warning Memory Corruption
0x0202 (P1OUT) 0x01 (OK)
0x0204 (P1DIR) 0x00 (OVERWRITTEN!)
Because you used a 16-bit pointer, the CPU wrote to P1OUT AND its neighbor P1DIR, accidentally changing pin direction.
REASON 03

Timing & Optimization

Sometimes, you need code to execute in exactly 5 clock cycles. C compilers can't guarantee that. Assembly can.

Speed
🔋
Power
⏱️
Real-Time

The Origin Story

Now that you know why it matters, let's see where it comes from.

The Problem with "Raw" Binary

Before Assembly, engineers had to program physically or via raw binary. Imagine trying to debug a sequence of 1s and 0s.

MACHINE CODE
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!

ENIAC programmers manually wiring the first electronic computer
Manual Wiring
ENIAC, 1945 - The "First" Assembly

The Solution: Mnemonics

BINARY
0100 0000
arrow_forward
ASSEMBLY
MOV

Assembly is simply a 1:1 human-readable translation of the machine code.

The Chef vs. The Recipe

Understanding Abstraction Levels

High Level

Python
A = B + C

"Make me a cake."
(You don't care how)

Mid Level

C Lang
int a = b + c;

"Mix flour and sugar."
(Standard recipe)

THIS COURSE

Low Level

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

"Move your left arm 30 degrees. Grasp spoon."
(Total control)

1. The Brain: Interactive CPU

You've seen the code. Now see how the "Brain" executes it step-by-step.

ASSEMBLY INSTRUCTION LIVE
Current Operation
System Reset. Ready to fetch.
CANVAS VER 2.0
RAM / FRAM
0x1C00
0x000A
Var A (10)
0x1C02
0x0014
Var B (20)
0x1C04
0x0000
Result
DATA BUS (16-bit)
MSP430 CORE
R4
0x0000
R5
0x0000
ALU

2. The Body: Memory & Peripherals

A brain in a jar is useless. The CPU needs to store memories (RAM/FRAM) and touch the world (I/O).

The "Map" of the Body

In high-level languages, you talk to "objects" or "files". In Embedded Systems, everything is an address.

If you want to turn on a light, you don't call a function `turnLightOn()`. You literally write a 1 into the specific memory address that is electrically wired to that lightbulb.

link

Memory Mapped I/O

The most important concept in Embedded Hardware.
"To the CPU, an LED looks exactly like a variable. You write to it, and the world changes."
Address
Physical Connection
0x0200
[ RAM Variable ]
0x0202
P1OUT Live Wire
0x0204
[ RAM Variable ]
The CPU simply writes data. The address determines if it's a calculation or an action.

Final Proof: Controlling Reality

This is the essence of Assembly. You are not asking an operating system to do a favor. You are flipping the electrical switches directly. Try it.

Memory Address
0x0202 (P1OUT)
Data to Write
0x00
P1.6 (LED2)
mode_fan
P1.3 (MOTOR)
P1.0 (LED1)
check_circle

Module 0 Complete

You now understand the philosophy behind Assembly: Total control over the CPU (Brain) and direct access to the Hardware (Body).

Goal 1
Context

Why we still need low-level languages in 2025.

Goal 2
Architecture

Von Neumann, Buses, and the Fetch-Execute cycle.

Goal 3
Interaction

How software touches hardware via Memory Mapping.

Coming Up: Module 1

It's time to stop looking and start coding. In the next module, we will dive into the MSP430 Instruction Set Architecture (ISA) and write our first lines of real assembly.

Start Module 1 arrow_forward