Lesson 1 of 48 beginner

What is a Microprocessor?

The tiny brain that runs everything electronic

Open interactive version (quiz + challenge)

Real-world analogy

A microprocessor is like a chef in a restaurant kitchen. The chef reads orders (instructions) from a ticket, gathers ingredients (data) from the pantry (memory), follows the recipe step by step, and produces a finished dish (output). The chef can only handle one order step at a time, but works so fast that a whole restaurant full of orders gets served in minutes.

What is it?

A microprocessor is a complete central processing unit (CPU) built on a single semiconductor chip. It fetches instructions from memory, decodes them, and executes arithmetic, logic, and control operations to produce useful output. It is the core component that makes computers, phones, and countless electronic devices work.

Real-world relevance

Every time you type on a keyboard, tap a phone screen, or ask a voice assistant a question, a microprocessor is fetching and executing millions of instructions per second to turn your input into the response you see. From car engine management to spacecraft guidance, microprocessors are everywhere.

Key points

Code example

; 8086 Assembly: Add two numbers and store the result
; This is one of the simplest programs a microprocessor can run.

.MODEL SMALL
.STACK 100h
.DATA
  num1 DW 0019h        ; num1 = 25 in decimal
  num2 DW 000Fh        ; num2 = 15 in decimal
  result DW ?          ; reserve space for result
.CODE
MAIN PROC
  MOV AX, @DATA        ; Load data segment address
  MOV DS, AX           ; Set DS register

  MOV AX, num1         ; AX = 25
  ADD AX, num2         ; AX = 25 + 15 = 40
  MOV result, AX       ; Store 40 in result

  MOV AH, 4Ch          ; DOS terminate function
  INT 21h              ; Call DOS interrupt
MAIN ENDP
END MAIN

Line-by-line walkthrough

  1. 1. .MODEL SMALL -- Tells the assembler we are using the small memory model (one code segment, one data segment).
  2. 2. .STACK 100h -- Reserves 256 bytes for the stack, which is used for temporary storage and subroutine calls.
  3. 3. .DATA -- Begins the data segment where we declare our variables.
  4. 4. num1 DW 0019h -- Declares a 16-bit word variable 'num1' with the value 25 (0x19 in hexadecimal).
  5. 5. num2 DW 000Fh -- Declares 'num2' with the value 15 (0x0F).
  6. 6. result DW ? -- Reserves space for the result; the '?' means it is uninitialized.
  7. 7. .CODE and MAIN PROC -- Begins the code segment and defines the main procedure.
  8. 8. MOV AX, @DATA / MOV DS, AX -- Loads the address of our data segment into DS so the CPU knows where our variables live.
  9. 9. MOV AX, num1 -- Copies the value of num1 (25) into the AX register.
  10. 10. ADD AX, num2 -- Adds num2 (15) to AX. Now AX holds 40 (0x28).
  11. 11. MOV result, AX -- Stores the value 40 from AX into the memory location 'result'.
  12. 12. MOV AH, 4Ch / INT 21h -- Calls DOS interrupt 21h function 4Ch to cleanly terminate the program.

Spot the bug

MOV AX, 0010h
MOV BX, 0020h
ADD CX, BX
MOV result, CX
Need a hint?
Look carefully at which register was loaded with the first value and which register is used in the ADD instruction.
Show answer
The ADD instruction uses CX instead of AX. CX was never loaded, so it contains garbage. The fix is: ADD AX, BX and then MOV result, AX.

Explain like I'm 5

Imagine you have a magic box. You write a simple instruction on a card, like 'add 2 and 3.' You slide the card into the box. The box reads the card, does the math inside, and shows you '5' on a little screen. A microprocessor is that magic box inside every computer, phone, and game console. It reads millions of instruction cards every second!

Fun fact

The Intel 4004, the world's first commercial microprocessor (1971), had 2,300 transistors and ran at 740 kHz. A modern Apple M2 chip has over 20 billion transistors and runs at 3.49 GHz. That is roughly 8.7 million times more transistors and 4,700 times the clock speed -- yet both follow the same fundamental fetch-decode-execute cycle.

Hands-on challenge

Write an 8086 assembly snippet that loads the value 42 (2Ah) into register BX, loads 8 into CX, and then adds them together storing the result in BX. Bonus: what is the final hex value in BX?

More resources

Open interactive version (quiz + challenge) ← Back to course: Microprocessor A–Z