Online Assembly Simulator
A free assembly simulator for an educational 8-bit processor: write a program, compile it into ROM and execute it clock by clock with a debugger. The processor is not a picture — it is built from gates inside the circuit simulator, and you can look inside any of its parts.
What it is
Inside Ershov Computer, level 25 of the course has you build a real 8-bit processor from separate parts: a clock generator, a program counter, two ROMs, RAM, an ALU, an accumulator register and an instruction decoder. The sandbox offers this processor in one click, together with an assembler and a debugger.
Instructions use a two-byte word format: the first byte holds the opcode, the second holds an operand from 0 to 255. The assembler compiles the program into ROM as opcodes; data lives in a 256-cell RAM. The assembler knows 15 instructions in total.
Processor instructions
- Arithmetic and logic: ADD, SUB, AND, OR — the operand is read from RAM.
- Data movement: LDA n loads the number n into the accumulator, STA n stores the accumulator into RAM[n].
- Jumps: JMP (unconditional), JZ and JN (on zero and on negative accumulator).
- Service: NOP (an empty tick) and HLT (stop).
- Index register IX: LDX, INX, LDA [IX], STA [IX] — indirect addressing.
Template program: Fibonacci numbers
The button below opens the sandbox with the processor and a ready program. The loop computes the Fibonacci series up to 55 and also builds two folds of the series: OR (which bits ever appeared) and AND (which bits are common to all terms). This exact listing opens in the editor:
; FIBONACCI NUMBERS — the classic first program ; with a loop: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 ; ; Variables: ; RAM[32] = a, RAM[33] = b, RAM[34] = t (a + b) ; RAM[35] = counter, RAM[36] = OR fold of the series, ; RAM[37] = AND fold of the series, RAM[38] = constant 1 LDA 1 STA 32 ; a = F(1) = 1 STA 33 ; b = F(2) = 1 STA 36 ; OR fold = 1 STA 38 ; constant 1 (for the decrement) LDA 255 STA 37 ; AND fold = 0xFF LDA 7 ; 8 iterations (the counter runs 7→0→exit) STA 35 loop: LDA 0 ADD 32 ; ACC = a ADD 33 ; ACC = a + b — the next number STA 34 ; t = a + b LDA 0 ADD 36 OR 34 ; OR fold: which bits ever appeared STA 36 LDA 0 ADD 37 AND 34 ; AND fold: which bits are common to all STA 37 LDA 0 ADD 33 STA 32 ; a = b — shift the window LDA 0 ADD 34 STA 33 ; b = t LDA 0 ADD 35 SUB 38 ; counter − 1 STA 35 JN done ; 0−1 = 255 (bit 7 = 1) — the loop is over NOP ; an empty tick (NOP demo) JMP loop done: HLT ; result: RAM[33] = 55 = F(10); RAM[37] = 0 — F(3) = 2 is even
The program takes 34 instructions (68 bytes of ROM) and finishes in 208 ticks. Each term of the series costs one pass of the loop; the exit goes through JN: when the counter wraps from 0 to 255, the top bit of the result turns on.
How to use it
- Open the processor. Press the button above — the sandbox builds the circuit and puts the program into the assembly editor.
- Run it. The "▶ Run" button compiles the listing into ROM and drives the ticks. The speed slider raises the clock from 1 Hz to 50 Hz; the whole run takes about four seconds.
- Debug it. "⏭ Step" executes one instruction through the "Fetch" and "Execute" phases, and the debugger explains each one. A click on an address in the listing sets a breakpoint; "⟲ Reset" returns the processor to the start.
- Look inside memory. The RAM inspector shows all 256 cells: a click edits the value, a double click toggles hex/dec. By the time HLT fires, RAM[33] holds 55.
After editing the code, press "Run" again: the debugger recompiles the program and warns you when the code has drifted from ROM.
Who it is for
The simulator suits students in their first computer architecture labs, school olympiad clubs, and developers who want to see machine code executed for real — on a schematic built from gates. Theory without install: the article "Learn Assembly from Scratch" and the reference for every instruction. In levels 18–29 of the course you will build this processor yourself, part by part.
Other tools
- Logic circuit simulator — 47 levels from a wire to a processor.
- Truth table generator — a full table from a Boolean formula.
- Number base converter — binary, decimal and hexadecimal.
- Knowledge library — 46 articles and 43 component datasheets.