π Live demo: delfuria.github.io/EasyCPU β run EasyCPU directly in your browser, no installation required.
A comprehensive, cross-platform IDE for teaching Assembly language programming and X86 processor architecture fundamentals.
EasyCPU is an educational tool designed to make learning assembly language and CPU architecture accessible and intuitive. It provides a simplified but functional virtual CPU that implements a subset of X86 instructions, allowing students to write, execute, and debug assembly programs with immediate visual feedback on CPU state.
- Key Features
- What is EasyCPU?
- What You Can Do
- Assembly Instruction Set
- IDE Overview
- Documentation
- Project Structure
- Requirements
- Supported Platforms
- Architecture
- Build
- Credits
- License
- Interactive Assembly Editor β Write assembly code with syntax support for EasyCPU's instruction set
- Step-by-Step Debugging β Execute programs one instruction at a time to understand control flow and side effects; after each step the register, memory, symbol and stack values that changed are highlighted
- Real-Time CPU State Visualization β Monitor registers, memory, stack, and flags as code executes
- Integrated Compiler β Parse and compile assembly code with detailed syntax error reporting; runtime errors (division by zero, stack overflow, invalid IPβ¦) are reported with the offending line
- Multiple Data Format Viewers β Display memory, stack, and register values in decimal, hexadecimal, or ASCII
- Infinite Loop Detection β Safely interrupt runaway programs with configurable thresholds
- Code & Data Separation β Organize assembly into code and data sections; the data section supports MASM-style
DB/DWvariables,EQUconstants, strings,DUPandORG - Console I/O β DOS-style
int 21hservices for keyboard input and text output - x86-Faithful Byte Memory β Optional per-program mode (Esegui β Memoria a byte (x86), saved in the
.asjfile): 512 bytes, little-endian words, 2-byte stack steps, and x86 rules (byte ptr/word ptrrequired for ambiguous operands, no memory-to-memory operations)
- Live Register & Flag Tracking β Watch how each instruction modifies CPU state
- Memory Inspection β View memory and stack contents, plus a Symbols list with the address, type and current value of each data name
- Run-to-Instruction β Execute all instructions up to a selected line for faster iteration
- Breakpoints β Mark lines with F9 or a click in the editor margin; execution pauses there so the CPU state can be inspected
- Execution State Indicators β Visual feedback on whether program is running, paused, or stopped
- Error Highlighting β Clicking compilation errors jumps directly to problematic code
- Print (Ctrl+P / βP) β Prints the data section, with the memory address of each declaration, and the code with line numbers and syntax colors, through the browser's print dialog (which can also save as PDF)
- Contextual Help (F1) β Opens the Assembly Reference in the browser at the instruction under the cursor (offline on desktop, online on iOS/Android)
EasyCPU is:
- β An educational tool for learning assembly fundamentals
- β A simplified X86 simulator with a reduced, easy-to-understand instruction set
- β An interactive debugger for real-time program state inspection
- β A didactic environment designed for classroom and self-study use
EasyCPU is not:
- β A production assembler β it does not generate native machine code for any real platform
- β A full X86 emulator β it implements a simplified subset of instructions and addressing modes
- β Compatible with standard Intel syntax or POSIX assembly conventions
- β Intended for real-world assembly development
Create programs using EasyCPU's instruction set. Programs can:
- Perform arithmetic and logical operations
- Manipulate memory and stack
- Use conditional and unconditional jumps
- Call subroutines
- Work with registers and flags
Execute one instruction at a time to:
- Trace control flow
- Inspect register values after each operation
- Watch memory and stack changes
- Understand how different addressing modes work
- Verify algorithm correctness
Develop practical understanding of:
- Register-based computation
- Memory and addressing
- Stack frame management
- Flag-based conditional logic
- Procedure calls and returns
- Infinite loop detection
EasyCPU implements an 8086-style instruction set (16-bit and 8-bit registers, CF/ZF/SF/OF/DF flags with x86 bit layout, base+index addressing such as [bx+si+2]):
Arithmetic: ADD, ADC, SUB, SBB, MUL, IMUL, DIV, IDIV, INC, DEC, NEG, CBW, CWD
Logic: AND, OR, XOR, NOT, TEST
Shift/Rotate: SHL, SHR, SAR, ROL, ROR, RCL, RCR
Data Transfer: MOV, XCHG, LEA
String: MOVSB/MOVSW (MOVS), LODSB/LODSW, STOSB/STOSW, CMPSB/CMPSW, SCASB/SCASW with REP, REPE/REPZ, REPNE/REPNZ prefixes
Comparison: CMP
Conditional Jumps (signed): JE/JZ, JNE/JNZ, JL, JLE, JG, JGE, JO, JNO, JS, JNS (plus x86 synonyms JNGE, JNG, JNLE, JNL)
Conditional Jumps (unsigned): JA, JAE, JB, JBE, JC, JNC (plus synonyms JNBE, JNB, JNAE, JNA)
Loops: LOOP, LOOPE/LOOPZ, LOOPNE/LOOPNZ, JCXZ
Unconditional Control: JMP (direct, or indirect through a register or memory: jmp bx, jmp [tab+bx])
Procedure Calls: CALL (direct or indirect: call [proc+si]), RET, RET n
Stack: PUSH, POP, PUSHF, POPF
Flags: CLC, STC, CMC, CLD, STD
Interrupts: INT (DOS-style int 21h console services)
Miscellaneous: NOP, STOP
MUL/DIV operate on unsigned values, IMUL/IDIV on signed values.
int 21h provides DOS-style services selected via AH: 01h read a character with echo (into AL), 02h write the character in DL, 07h read a character without echo, 09h write the $-terminated string at DX, 0Ah read a line into the buffer at DX, 4Ch terminate the program. Output and keyboard input are shown/captured in the dedicated Console panel.
By default memory is made of 256 16-bit cells (word model). The optional x86-faithful mode switches the program to a 512-byte memory with little-endian words, a 64-byte stack (SP starts at 512 and moves by 2), and x86 compile-time rules; see the ModalitΓ x86 fedele chapter of the Assembly Reference.
The data section supports MASM-style symbolic declarations: DB/DW variables, EQU constants, strings, DUP, ORG and offset; code labels can be used as values (offset label in code, tab DW case0, case1 in data) to build jump tables. byte ptr and word ptr set the size of a memory operand (example programs in Docs/samples).
For complete instruction documentation, register definitions, addressing modes, and flag behavior, see the Easy CPU Assembly Reference.
The EasyCPU IDE is organized into four main areas:
Side-by-side editors for assembly code and data section initialization. Supports syntax highlighting and automatic indentation.
Displays all CPU registers (AX, BX, CX, DX, SI, DI, BP, SP, IP) in the selected format, with the high and low bytes of AXβDX (AX = 0141 [AH=01 AL=41]). The flags are listed as C, Z, S, O, D (carry, zero, sign, overflow, direction).
Shows the data memory and the stack. Toggle between decimal, hexadecimal, and character formats (the choice is remembered); view the stack in one or two columns. In byte-memory mode the panel is titled Memoria (byte) and shows 16 bytes per row, while the stack shows one word per row. Below the memory, the Symbols section lists the names defined in the data section and the code labels with their instruction number.
Displays output and captures keyboard input for int 21h calls. Auto-activates on int 21h and shows a blinking cursor while waiting for a keypress.
Toolbar buttons and menu commands for:
- Run (F5) β Execute until program end, a breakpoint (F9) or infinite loop detection
- Step (F11; F10 steps over a
call) β Execute one instruction (forrep-prefixed string instructions, one repetition per step) - Run to Instruction (Ctrl+F5) β Execute until selected line
- Stop (F8) β Halt execution
- New/Open/Save β File management, with the 10 most recent programs (in the browser, under the Recenti entry of the side menu)
A breakpoint pauses the program when execution reaches its line, leaving registers, memory and stack available for inspection; from there you can continue with Run or go on step by step.
- Set/remove β Press F9 (or Esegui β Imposta/Rimuovi breakpoint) on the line under the cursor, or click the margin to the left of the line numbers; the line is marked with a red dot
- Where they apply β Run (F5), Run to Instruction (Ctrl+F5), and Step Over/Step Out (F10/Shift+F11) when a breakpoint is inside the subroutine being skipped
- Executable lines only β Breakpoints on empty lines, comments or lines holding only a label are ignored
repstring instructions β Execution pauses when the instruction is reached, not at every repetition- Saved per program β Kept between sessions: in a
.bkptfile next to the program on the desktop, inlocalStoragein the browser
Automatic compilation before execution. Syntax errors are listed with line numbers and descriptions; click an error to navigate directly to it in the editor. Errors detected while the program runs are shown in the same panel as Esecuzione errors, with the line of the instruction that caused them.
Options, panel layout, recent programs and breakpoints are kept between sessions: in files on the desktop, in the browser's localStorage in the web version (clear the site data to reset them).
For detailed step-by-step tutorials and screenshots, see the EasyCPU IDE Tutorial. (Note: Tutorial focuses on Windows UI; layouts differ slightly on other platforms.)
Complete documentation is available in the Docs/ folder:
- Easy CPU Assembly Reference β Complete instruction set documentation with syntax, examples, and flag behavior
- EasyCPU IDE Tutorial β Step-by-step guide to using the IDE, debugging, and managing programs
- Toolbar Icons Reference β Visual guide to IDE toolbar buttons
Ready-to-run example programs (.asj) are available in Docs/samples/, organized by topic (data transfer, arithmetic and flags, logic and shifts, stack and subroutines, data section, int 21h console, complete programs, jumps and loops, string instructions, errors, indirect jumps, byte memory, step-by-step debugging, F1 help); each one starts with a comment describing what it shows and the expected result. The original examples in the legacy .as format are in Docs/Subroutines/.
Design documents for the x86 extensions (roadmap, open proposals and their designs) are in Proposte/.
EasyCPU/
βββ EasyCpu.Assembler/ # Assembly parser and compiler
β βββ Parsing/ # Lexer, parser, AST
β βββ Processore/ # Virtual CPU and instruction execution
β βββ Memoria/ # Memory and register management
βββ EasyCpu.Backend/ # Shared backend logic
βββ EasyCpu.Common/ # Common types and utilities
βββ EasyCPU/ # Shared Avalonia UI (views/viewmodels)
βββ EasyCPU.Desktop/ # Desktop platform (Windows/macOS/Linux)
βββ EasyCPU.Browser/ # Browser platform (WASM)
βββ EasyCPU.iOS/ # iOS platform
βββ EasyCPU.Android/ # Android platform
βββ EasyCpu.Assembler.Tests/ # Unit tests for assembler
βββ EasyCpu.DocGen/ # Generates Docs/html/reference.html (F1 help) from the Assembly Reference
βββ Docs/ # Documentation
β βββ Easy CPU Assembly Reference.md
β βββ EasyCPU IDE Tutorial.md
β βββ html/reference.html # Generated F1 help page (EasyCpu.DocGen)
β βββ samples/ # Example programs (.asj) by topic
β βββ Subroutines/ # Original examples (.as)
βββ Proposte/ # x86 extension roadmap and design documents
- .NET SDK 10 or later
- AvaloniaUI 12.0+ (included via NuGet)
- Platform-specific requirements:
- Desktop: Windows 10+, macOS 10.13+, or Linux (GTK 3.0+)
- Browser: Modern web browser with WebAssembly support
- iOS: iOS 12.0+ with Xcode
- Android: Android 5.0+ (API level 21+) with Android SDK
To build for specific platforms, install the necessary .NET workloads:
# Desktop support (Windows/macOS/Linux)
dotnet workload install desktop
# Browser/WebAssembly support
dotnet workload install wasm-tools
# iOS support
dotnet workload install ios
# Android support
dotnet workload install android
# Install all at once
dotnet workload install desktop wasm-tools ios androidAfter installing workloads, restore NuGet dependencies:
dotnet restoreEasyCPU is implemented for multiple platforms with a shared core:
| Platform | Status | Features |
|---|---|---|
| Desktop (Windows/macOS/Linux) | β Implemented | Full IDE with all features |
| Browser (WebAssembly) | β Implemented | Complete IDE running in browser via WASM; options, layout, recent programs and breakpoints are kept in the browser's localStorage (clear the site data to reset them) |
| iOS | β Implemented | Touch-optimized interface for iPad/iPhone |
| Android | β Implemented | Native Android app interface |
All platforms share the same assembly compiler and virtual CPU core, ensuring consistent behavior across devices.
EasyCPU is built on a modular architecture with clear separation of concerns:
- EasyCpu.Assembler β Assembly language parser and compiler, and the virtual CPU that executes the compiled program (registers, flags, memory, stack)
- EasyCpu.Backend β File formats (
.asj, legacy.as) and settings storage (files on the desktop,localStoragein the browser) - EasyCpu.Common β Shared data structures and utilities used across projects
- EasyCPU. (UI Projects)* β Platform-specific front-ends (Desktop, Browser, iOS, Android)
- Framework: .NET SDK 10
- UI Framework: AvaloniaUI β Cross-platform, XAML-based UI for Desktop, Browser, iOS, and Android
- Language: C#
- Browser Target: WebAssembly (Emscripten compilation)
# Restore dependencies
dotnet restore EasyCPU.Desktop
# Build
dotnet build EasyCPU.Desktop -c Release
# Or directly run
dotnet run --project EasyCPU.Desktop -c Release# Restore dependencies
dotnet restore EasyCPU.Browser
# Publish for WebAssembly (creates wwwroot output)
dotnet publish EasyCPU.Browser -c Release
# The output will be in EasyCPU.Browser/bin/Release/net10.0/publish/wwwroot# Restore dependencies
dotnet restore EasyCPU.iOS
# Build
dotnet build EasyCPU.iOS -c Release -f net10.0-ios
# Or create an IPA for deployment
dotnet publish EasyCPU.iOS -c Release -f net10.0-ios# Restore dependencies
dotnet restore EasyCPU.Android
# Build
dotnet build EasyCPU.Android -c Release -f net10.0-android
# Or create an APK for deployment
dotnet publish EasyCPU.Android -c Release -f net10.0-androidTo perform a clean rebuild across all projects:
# Clean all build artifacts
dotnet clean
# Restore workloads and dependencies
dotnet workload restore
dotnet restore
# Rebuild all projects
dotnet build -c ReleaseEasyCPU was developed by Paolo Meozzi and Stefano Del Furia.
Special thanks to Avalonia for providing the cross-platform UI framework that powers EasyCPU across Desktop, Browser, iOS, and Android.
See repository for license details.