This Insane 16-Bit CPU Runs Inside Excel—Yes, Really
What if I told you that the spreadsheet you use to track expenses could run its own operating system? That those cells you fill with SUM formulas could instead execute machine code, render graphics, and process real programs? Sounds impossible, right?
Here's the shocking truth: someone built a complete 16-bit CPU inside Microsoft Excel. Not a simulation. Not a toy. A genuine, programmable computer with registers, RAM, a display, and its own assembly language—running entirely on Excel's formula engine. While most developers debate whether to use Rust or Go for their next project, the creator of excelCPU asked a far more radical question: what if Excel itself was the computer?
This isn't a joke. This isn't a hackathon gimmick. This is a meticulously engineered processor architecture that turns every cell recalculation into a clock cycle. If you've ever felt constrained by "normal" programming environments, or if you simply want to witness one of the most mind-bending achievements in recreational computing, keep reading. The excelCPU project will reshape how you think about what's possible with everyday software—and might just inspire you to build something equally impossible.
What Is excelCPU?
excelCPU is an open-source project by InkboxSoftware that implements a complete 16-bit CPU architecture entirely within Microsoft Excel spreadsheets. Released on GitHub, this project transforms Excel from a mundane business tool into a legitimate computing platform capable of executing compiled assembly programs.
The project emerged from the deep well of "demoscene" and recreational engineering culture, where developers push consumer software far beyond its intended boundaries. What makes excelCPU extraordinary isn't just that it works—it's the sheer completeness of the implementation. We're talking about a processor with 16 general-purpose registers, 128KB of addressable RAM, a 128×128 pixel display, and a custom instruction set architecture (ISA) with 24 distinct operations.
The CPU leverages Excel's iterative calculation feature, normally used for solving circular references in financial models, to create a genuine feedback loop that mimics hardware clock cycles. Each press of the F9 key triggers a spreadsheet recalculation, which the CPU interprets as a single clock pulse. The "transistors" are Excel formulas. The "wires" are cell references. The "memory" is literally just... more cells.
Why is this trending now? In an era of cloud-native Kubernetes clusters and AI-accelerated GPUs, there's something profoundly refreshing—and viral—about computational minimalism. excelCPU represents the ultimate software-defined hardware: no silicon required, no fabrication plants, no billion-dollar clean rooms. Just formulas, patience, and engineering brilliance. It challenges our assumptions about where computation can live and proves that Turing completeness hides in the most unexpected places.
Key Features That Will Blow Your Mind
The excelCPU isn't a stripped-down proof-of-concept. It's a feature-rich computing platform that rivals early personal computers in capability. Here's what you're getting:
16-Bit Processor Architecture
The core CPU operates on 16-bit words, giving it a 64KB address space and computational power comparable to legendary processors like the Intel 8086 or MOS 6502. This isn't a 4-bit toy—it's a serious architecture capable of meaningful computation.
16 General-Purpose Registers
Named R0 through R15, these registers provide ample working space for complex algorithms. The register file is implemented through carefully structured Excel ranges that update atomically with each clock cycle.
128KB of RAM
That's 65,536 addressable 16-bit words—enough for substantial programs, data structures, and even framebuffers. The RAM exists as a massive Excel table where each row represents a memory address and its stored value.
128×128 Pixel Display
Perhaps the most visually striking feature: a genuine bitmap display rendered within Excel cells. Programs can draw graphics, create animations, or output text by writing to specific memory-mapped display regions. Watching pixels light up in a spreadsheet is genuinely magical.
Custom Instruction Set Architecture (ISA)
The CPU implements 24 distinct instructions covering data movement, arithmetic, logic, control flow, and I/O operations. The complete specification lives in InstructionSet.xlsx, serving as both documentation and a teaching tool.
Excel-ASM16 Assembly Language
A full assembly language with human-readable mnemonics, operand types (registers, memory addresses, immediate values), and a dedicated Python compiler. You write .s files, compile them to ROM.xlsx, and load them into the CPU.
Dual Operation Modes
Automatic mode executes programs from RAM sequentially. Manual mode lets you step through individual instructions for debugging or educational purposes—perfect for understanding how CPUs actually work at the gate level.
Complete Development Toolchain
From the compileExcelASM16.py compiler to Notepad++ syntax highlighting (Excel-ASM16.xml), this is a production-ready environment for spreadsheet-based software development.
Real-World Use Cases (That Actually Make Sense)
You might wonder: "This is cool, but who would actually use it?" Surprisingly, excelCPU has legitimate applications beyond pure novelty:
1. Computer Architecture Education
Nothing demystifies CPU operation like seeing every signal propagate through visible cells. Students can single-step through instructions, watch the program counter increment, observe flags being set, and trace data flowing from registers to ALU to memory. It's a living, breathing textbook that responds to your programs.
2. Digital Logic Training
Before designing real hardware in Verilog or VHDL, excelCPU lets you experiment with processor design concepts risk-free. The iterative calculation model accurately simulates synchronous digital logic without requiring FPGA boards or expensive simulation software.
3. Retrocomputing Preservation
The 16-bit architecture closely mirrors classic processors. Developers can port algorithms from 1980s systems, recreate vintage demo effects on the 128×128 display, or build emulators within the emulator. It's computational archaeology with a spreadsheet twist.
4. Spreadsheet Formula Mastery
For Excel power users, studying excelCPU reveals the hidden depths of formula capabilities. You'll learn advanced techniques: circular references, iterative solving, array operations, and conditional formatting—all by observing how a CPU harnesses them.
5. Artistic and Demo Scene Projects
The 128×128 display invites creative coding. Generative art, procedural animations, and even simple games become achievable. The constraint breeds creativity: what can you express in 16,384 monochrome pixels refreshed by F9 presses?
Step-by-Step Installation & Setup Guide
Ready to run your own CPU? Follow these exact steps:
Prerequisites
- Microsoft Excel (Windows version recommended for full compatibility)
- Python 3.x installed and in your PATH
- Git (optional, for cloning)
Step 1: Download the Repository
git clone https://github.com/InkboxSoftware/excelCPU.git
cd excelCPU
Or download and extract the ZIP from the GitHub repository.
Step 2: Configure Excel for Iterative Calculation
This is critical—without this setting, the CPU cannot function:
- Open
CPU.xlsx - Navigate to File → Options → Formulas
- Check Enable iterative calculation
- Set Maximum Iterations to 1
- Click OK
⚠️ Why exactly 1 iteration? The CPU relies on controlled circular references. Each F9 press should trigger exactly one complete propagation through the logic. Higher values would cause multiple "clock cycles" per keypress, making execution unpredictable.
Step 3: Understand the Control Interface
Open CPU.xlsx and locate these control cells:
| Cell | Function | Usage |
|---|---|---|
| B2 | Clock Signal | Toggles high/low to trigger execution |
| F2 | Reset Button | Set TRUE to reset PC to 0 |
| J2 | Manual/Auto Mode | TRUE = manual override; FALSE = automatic execution |
| D8 | Override Slot | Manual mode instruction input |
Step 4: Prepare ROM Data (Optional)
Open ROM.xlsx alongside CPU.xlsx. This contains your program memory. The Read ROM button copies these values into the CPU's RAM.
Step 5: Run the CPU
Standard startup sequence:
- Set Reset Button (F2) to
TRUE→ resets PC to 0 - Either:
- Set Reset RAM to
TRUEthenFALSEto clear memory, OR - Set Read ROM to
TRUEthenFALSEto load program fromROM.xlsx
- Set Reset RAM to
- Set Reset Button (F2) to
FALSE - Choose mode:
- Automatic: Set J2 to
FALSE, then press F9 repeatedly to run - Manual: Set J2 to
TRUE, enter instruction in D8, press F9
- Automatic: Set J2 to
⏱️ Pacing is essential! Wait for "Ready" in Excel's bottom-left status bar before each F9 press. Mashing the key faster than Excel can recalculate 65,000+ cells will corrupt execution.
REAL Code Examples from the Repository
Let's examine actual Excel-ASM16 code and understand how this architecture works in practice.
Example 1: Basic Register Operations and Immediate Loading
; Load immediate values into registers
LOAD R0 #1234 ; R0 = 0x1234 (decimal 4660)
LOAD R1 $0FFF ; R1 = 0x0FFF (hexadecimal)
; Transfer between registers
TRAN R1 R2 ; R2 = R1 (R2 now holds 0x0FFF)
; Store to memory
STORE R0 @0000 ; Memory[0x0000] = 0x1234
STORE R1 @0001 ; Memory[0x0001] = 0x0FFF
Explanation: This demonstrates the three operand types. # prefix indicates decimal immediate, $ indicates hexadecimal immediate, and @ addresses memory. The TRAN instruction copies register-to-register without touching memory—faster for intermediate calculations. Notice how LOAD REG IMD directly embeds constants, while LOAD REG REG performs indirect addressing (loading from memory address stored in another register).
Example 2: Arithmetic with Carry Flag Manipulation
; Initialize values
LOAD R0 #5
LOAD R1 #3
; Addition with carry
ADD R0 R1 ; R0 = R0 + R1 + CF = 5 + 3 + 0 = 8
; Result stored in R0, flags updated
; Set up for subtraction
LOAD R2 #10
LOAD R3 #4
; Clear carry flag before operation
CLC ; CF = 0 (explicit initialization)
SUB R2 R3 ; R2 = R2 - R3 - CF = 10 - 4 - 0 = 6
; Multiplication (produces 32-bit result)
LOAD R4 #100
LOAD R5 #200
MULT R4 R5 ; R4 = low 16 bits of 20,000
; R5 = high 16 bits (0 in this case)
Explanation: The ALU operations reveal sophisticated design. ADD and SUB incorporate the carry flag, enabling multi-word arithmetic. MULT splits its 32-bit result across two registers—critical since we're limited to 16 bits. The CLC/STC instructions provide explicit carry control, essential for chained arithmetic and comparison operations.
Example 3: Control Flow and Conditional Branching
; Program: Count from 10 down to 0, storing values in memory
LOAD R0 #10 ; Counter initialized to 10
LOAD R1 @0100 ; Memory pointer at address 0x0100
LOOP: STORE R0 @R1 ; Store counter value at pointer address
INC R1 ; Increment memory pointer
DEC R0 ; Decrement counter (CF unaffected)
; Check if counter reached zero
LOAD R2 #0 ; Load zero for comparison
ADD R0 R2 ; Sets ZF if R0 == 0
JEQ END ; Jump to END if Zero Flag set
JMP LOOP ; Otherwise, continue looping
END: NOP ; No operation (halt point)
ORG $0200 ; Place next code at address 0x0200
Explanation: This reveals the branching model. JEQ, JLT, and JGE test flags set by previous ALU operations. Notice the clever comparison technique: adding zero to a register sets flags without changing its value. The ORG directive controls code placement—vital for memory-mapped I/O and avoiding collisions with data regions.
Example 4: Bitwise Operations and Display Output
; Create a checkerboard pattern on the 128x128 display
; Display memory starts at specific mapped addresses
LOAD R0 $AAAA ; Pattern: 1010101010101010
LOAD R1 $5555 ; Pattern: 0101010101010101
LOAD R2 @8000 ; Display base address (hypothetical)
LOAD R3 #64 ; Row counter (half of 128)
ROWLOOP:
STORE R0 @R2 ; Write pattern to display memory
INC R2 ; Next column
STORE R1 @R2 ; Alternate pattern
INC R2
; Roll patterns for next row variation
ROL R0 #1 ; Rotate left by 1 bit
ROR R1 #1 ; Rotate right by 1 bit
DEC R3 ; Decrement row counter
JNE ROWLOOP ; Continue if not zero (using JGE/JLT combination)
JMP $0000 ; Restart or halt
Explanation: The ROL/ROR instructions accept 4-bit immediate values (0-15), enabling efficient bit manipulation. This code demonstrates how graphics programming works: writing specific bit patterns to memory-mapped display regions. The 128×128 display at 1 bit per pixel requires 2,048 bytes—easily fitting within the address space.
Compiling and Loading Programs
After writing your .s file:
# Compile assembly to ROM spreadsheet
py compileExcelASM16.py myprogram.s ROM.xlsx
# Ensure ROM.xlsx is open, then in CPU.xlsx:
# 1. Set Reset Button TRUE, then FALSE
# 2. Toggle Read ROM TRUE, then FALSE (loads program)
# 3. Ensure Reset Button is FALSE
# 4. Press F9 to execute
Critical detail: The ROM.xlsx file must remain open during the Read ROM operation because Excel's cross-workbook references require both files accessible. The compiler translates human-readable mnemonics into the binary format expected by the CPU's fetch-decode-execute cycle.
Advanced Usage & Best Practices
Optimizing Execution Speed
- Close unnecessary workbooks to free Excel's calculation engine
- Disable screen updating via VBA for batch execution:
Application.ScreenUpdating = False - Use manual calculation mode globally:
Application.Calculation = xlManual
Memory Layout Strategy
Reserve address regions systematically:
0x0000-0x3FFF: Program code0x4000-0x7FFF: Data and variables0x8000-0xBFFF: Display framebuffer0xC000-0xFFFF: Stack and temporary storage
Debugging Techniques
- Single-step in Manual mode: Set J2 TRUE, enter instructions in D8 individually
- Monitor register values: The spreadsheet exposes all 16 registers in visible cells
- Trace memory writes: Compare RAM table before/after suspected operations
- Use NOP strategically: Insert between operations to observe intermediate states
Avoiding Common Pitfalls
- Never press F9 before "Ready" appears—corrupts state
- Always initialize carry flag (
CLC/STC) before arithmetic chains - Remember
INC/DECdon't affect carry flag; useADD/SUBfor flag-setting increments - The
ORGdirective only accepts addresses beyond current program length
Comparison with Alternatives
| Feature | excelCPU | Logisim | QEMU | Physical 6502 |
|---|---|---|---|---|
| Cost | Free (Excel required) | Free | Free | $5-50+ |
| Hardware needed | None (software only) | None | None | Breadboard, chips, power |
| Visibility of internals | ⭐⭐⭐⭐⭐ (every cell visible) | ⭐⭐⭐⭐ (schematic level) | ⭐⭐ (opaque emulation) | ⭐⭐⭐ (oscilloscope needed) |
| 16-bit architecture | ✅ Native | ⚠️ Must design | ✅ Many targets | ❌ 8-bit only |
| Built-in display | ✅ 128×128 | ⚠️ Add components | ❌ Separate window | ❌ External circuitry |
| Programming language | Custom assembly | Visual wires | Any compiled | Native assembly |
| Educational value | ⭐⭐⭐⭐⭐ (spreadsheet familiarity) | ⭐⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐⭐ |
| Practical programs | ⚠️ Limited by speed | ⚠️ Limited by complexity | ✅ Production-ready | ⚠️ Vintage constraints |
Why choose excelCPU? It uniquely bridges familiar software (Excel) with deep hardware concepts. Unlike Logisim's abstract gates or QEMU's opaque virtualization, every computation is literally visible in cells you can click and inspect. It's the only platform where debugging means reading spreadsheet values.
Frequently Asked Questions
Does excelCPU work in Google Sheets or LibreOffice?
No. The implementation relies on Excel-specific iterative calculation behavior and cross-workbook linking. Google Sheets lacks equivalent iterative control; LibreOffice Calc's formula engine differs subtly enough to break timing assumptions.
How fast does the CPU actually run?
Performance depends entirely on Excel's recalculation speed. Typical throughput is 1-10 instructions per second with manual F9 pressing. Automated VBA macros can achieve faster rates, but the fundamental limitation is Excel's single-threaded formula evaluation across 65,000+ cells.
Can I run real operating systems on excelCPU?
Theoretically possible with sufficient adaptation, but practically infeasible. The 128KB RAM and minimal I/O don't match any standard OS requirements. However, custom minimalist "OS" kernels demonstrating task switching are achievable projects.
Is Excel-ASM16 similar to x86 or ARM assembly?
Conceptually yes—registers, memory operands, flags, and jumps follow familiar patterns. However, the specific mnemonics, addressing modes, and instruction encoding are unique to excelCPU. Experience with 6502 or Z80 assembly translates more directly than modern architectures.
What's the most complex program demonstrated?
The Sample Programs folder includes working demonstrations. Community members have reportedly implemented prime number sieves, maze generators, and interactive drawing programs using the 128×128 display.
Can I modify the CPU architecture itself?
Absolutely! Since the CPU is "implemented" in editable Excel formulas, advanced users can extend instructions, add registers, or modify the ALU. This is hardware description without HDLs—edit formulas, not silicon masks.
Why build this? What's the practical purpose?
The creator hasn't stated explicit goals, but the project exemplifies computational minimalism and software art. It asks: what are the true boundaries of "general-purpose" software? The answer: far beyond what vendors imagine.
Conclusion: The Spreadsheet Is the Computer
excelCPU by InkboxSoftware isn't merely a technical curiosity—it's a philosophical statement about the nature of computation. In an industry obsessed with faster silicon and cloud scale, this project dares to ask: what if we went slower, deeper, and more visible?
The achievement here is staggering. A 16-bit processor with genuine RAM, registers, display output, and a complete toolchain—running where absolutely nobody expected it. Every F9 press becomes a meditation on how computers actually work. Every visible cell update demystifies the magic we've buried beneath abstraction layers.
For educators, it's an unparalleled teaching instrument. For hobbyists, it's the ultimate constraint-based challenge. For professionals, it's a humbling reminder that Turing completeness is everywhere—even in your expense reports.
The excelCPU repository awaits your exploration. Download the spreadsheets. Write your first assembly program. Watch pixels flicker to life through the power of spreadsheet formulas. And the next time someone tells you Excel is "just for numbers," smile knowingly—you've seen it run a CPU.
Star the repo. Share the madness. Build something impossible.