The 8-Bit Computer by Ben Eater.

This code is an attempt to simulate Ben Eater's 8-bit computer.

Differences from the hardware

CPU
PC

Bus

Acc

MAR

ALU

MDR

B
IR

Simulation State
uCPU
uPC

uIR

Status
ZERO:
CARRY:
HALT:
I/O
Output:
Memory
Address Data
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
Op Codes
Value
MNEMONIC
Ben Dan
0 NOPnop
1 LDAload
2 ADDadd
3 SUBsubtract
4 STAstore
5 LDIloadI
6 JMPjump
7 JCjumpC
8 JZjumpZ
9   
A   
B   
C   
D   
E OUToutput
F HLThalt
μCode
μCode RTN
AI ACC ← BUS
AO BUS ← ACC
BI B ← BUS
CE PC ← PC + 1
CI PC ← BUS
CO BUS ← PC
EO BUS ← ALU
II IR ← BUS
IO BUS ← IR<3..0>
J PC ← BUS
MI MAR ← BUS
RI MDR ← BUS
RO BUS ← MDR
SU ALU_OP = -
UO μClock ← 0
HLT HALT
? If the specified flag is high raise dest
? ? Carry J, if carry is high, raise J
Program:

Control:

Clock Speed (cycle length in ms) : (Smaller is faster!)