Welcome to LC-3
Introduction to the LC-3 architecture and why we learn assembly.
What is the LC-3?
The LC-3 (Little Computer 3) is a simplified computer architecture designed for teaching. Despite its simplicity, it has all the essential features of real processors — registers, memory, an ALU, and a full instruction set.
Learning LC-3 assembly gives you a deep understanding of how computers actually execute programs. Every high-level language — Python, JavaScript, C — eventually becomes machine instructions like these.
Architecture Overview
The LC-3 has:
Every LC-3 instruction is exactly 16 bits. The top 4 bits specify the opcode (which instruction), and the remaining 12 bits encode the operands.
The Instruction Categories
LC-3 instructions fall into three groups:
ADD, AND, NOT — arithmetic and logic on registersLD, LDI, LDR, LEA, ST, STI, STR — move data between registers and memoryBR, JMP, JSR, JSRR, RET, TRAP — change the flow of executionYour First Program
Here's the simplest LC-3 program — it halts immediately:
.ORIG x3000 ; Program starts at address x3000
HALT ; Stop execution
.END ; End of sourceEvery program starts with .ORIG (the starting memory address) and ends with .END. The HALT instruction (actually TRAP x25) tells the computer to stop.
How many general-purpose registers does the LC-3 have?