Free web demo

Assembly CPU Lab

Write assembly for the 6502 or the Z80, run it on an emulated machine with a pixel display and step through it one instruction at a time. Ten short lessons check your work for you. The offline phone app adds 12 CPUs.

Lessons

Program

Run with Ctrl+Enter. Click a line number to set a breakpoint. Tab inserts 2 spaces. Keyboard users: press Esc then Tab to leave the editor.

    Ready. Press Run, or Step to go one instruction at a time.

    Listing

    Address, bytes, source. Click a row to set a breakpoint.
    Assembly listing with line numbers, addresses and machine code bytes

    Registers

    0 instructions

    Stack (top first)

    Display and console

    Key: none

    
         

    Memory

    PC highlighted. Green outline is the last write.

    Breakpoints

    Machine map and cheat sheet

    An assembler, emulator and debugger in one page

    Assembly CPU Lab turns your assembly source into machine code, loads it into an emulated computer and lets you run it or step through it one instruction at a time. Pick the 6502 or the Z80, edit the example or one of the lessons, and press Run. Registers, flags, the stack and a live hexdump of memory update as the program runs, and every value that just changed is highlighted. Nothing is uploaded: the assembler and both CPU cores run inside your browser, and your code is saved on your device.

    What you can do here

    Ten short lessons with automatic checking

    Each CPU has five lessons: hello registers, loops and flags, memory and addressing, drawing pixels and reading keys. Every lesson gives you a short explanation, starter code and a goal. When your program halts, the lab checks the registers, memory or display and shows a Lesson complete message if you got it right. Stuck? Show the solution and compare it with your own code. The lessons are the same ideas that retro game and homebrew developers use every day on the NES, Commodore 64, Game Boy and ZX Spectrum.

    Safe by design

    A program that never stops cannot freeze this page. Programs run in short slices with an instruction budget, and after one million instructions you get a clear message and the choice to continue. Illegal opcodes stop the CPU with the opcode and the address. Programs can overwrite their own code, wrap around the end of memory or overflow the stack, and the emulator keeps behaving like the real chip.

    Why an offline app?

    Learning assembly happens on the train, on a plane or on a bench with no signal. The Assembly CPU Lab phone app will work fully offline and add more processors, including the 8086, 68000, ARM and RISC-V, together with lesson packs and a deeper step debugger. Join the launch list below and tell us which CPU you want next.

    Frequently asked questions

    Is Assembly CPU Lab free?

    Yes. The web demo is free, needs no account and has no ads. The planned offline phone app costs $6.99 and adds more CPUs and lesson packs.

    Which CPUs and instructions are supported?

    The 6502 with all 151 official opcodes and decimal mode, and the Z80 with the main documented instruction set including CB and ED prefixed instructions and IX and IY indexing. Undocumented opcodes stop the program with an illegal opcode message.

    Where do I see the display and the keyboard?

    On the 6502 the 32 by 32 display starts at $0200 and the last key pressed is at $FF. On the Z80 the display starts at $8000 and the key is at $8400. Click the display and press keys, or use the on-screen keypad.

    Is my code uploaded anywhere?

    No. Assembling and running happen in your browser. Your code is saved only in this browser on this device.

    Why did my program stop after one million instructions?

    Each Run has a budget of one million instructions so an endless loop cannot freeze the page. Press Run again to continue, or use Pause and Step to inspect the loop.

    Can I load and save my own files?

    Yes. Use Load .asm file to open a text file up to 100 KB, and Download .asm or Download .bin to save your work. Copy hex puts the machine code on the clipboard.