4

TL;DR: I want to do this but entirely in software on my Linux laptop.

Long version:

In Ben Eater's "Hello World on a 6502", Ben shows how to build a computer from scratch using individual components on breadboards. Now I want to do the same thing, but more involved. I already have enough piles of tech equipment, so I don't want to add yet another item to the stockpile.

My end goal is to make a relatively simple computer with a retro CPU, RAM, hard-disk-like storage, a keyboard, a "display" (more likely a serial console of some sort), and maybe a user-tinkerable expansion bus of sorts. I intend to use it as a general purpose machine like one who built a computer from individual components would have done back in the 1970's, such as making a simple calculator in assembler code, getting a BASIC interpreter going, etc. (At some point I want to code an OS for it that includes an assembler for the processor's machine code, such that the assembler can assemble its own code and the OS itself, so that it functions as a self-hosted development environment.) I'm not interested in starting from an established piece of hardware - I want to reinvent the wheel here.

So, my question is, does anyone know of a piece of software that fulfills all of the following requirements:

  • Can emulate some kind of retro processor along with its supporting chips (the 6502 ecosystem would be ideal since Ben Eater's videos are a great tutorial for it, but I would also be happy to consider other CPUs like the Z80 and whatnot). Cycle-accurate emulation would be ideal, though I'm not sure if non-cycle-accurate emulation would even be possible for this kind of software.
  • Allows the chips to be assembled by the user in a breadboard-like UI (for instance, I place a chip on the screen, and then draw wires to connect it to other components and chips). Doesn't need to be perfect - I don't need to be able to make really silly mistakes like connecting a clock signal to a data line and have the resulting mess be emulated realistically or anything like that. It's fine for a mistake like that to be impossible to make, result in an error, or cause undefined behavior specific to the emulator.
  • Supports enough peripheral components (for instance, the UART and stuff like that) to allow a system like the one described above to be built.
  • Permits interactive debugging (i.e., single-stepping of the system's clock(s), the ability to inspect RAM/ROM contents, CPU registers, electrical states of wires, etc.).
  • Runs fast enough on a modern machine (mobile 11th gen i5) to run the emulated system at a comfortable speed (doesn't have to be full speed, just enough to be usable).
  • Is free and open-source, preferably under an OSI-approved license.
  • Runs on a free and open source operating system (preferably modern Linux, but if it only runs on some weird OS like Haiku I can use a VM to deal with that). Windows-only software is a dealbreaker since I don't use Windows, though it's still worth mentioning for the sake of those who do use Windows.

This is probably a lot to ask, especially for free, so even if something you know of doesn't quite match all of that, it's still worth mentioning.

Note that I don't think this is an opinion-based question - I'm not looking for the best "make-your-own-computer emulator", I'm just wondering if such a thing exists and if so, what it's called.

19
  • 1
    Maybe not opinion based, but clearly off topic as it's asking for writing modern software on a modern coputer with an up to date OS. Isn't it?
    – Raffzahn
    Feb 21 at 10:32
  • 3
    @Raffzahn More like using modern tools to simulate an old system - ideally the system once planned can be built in hardware using components like a 65C02 and whatnot. There's quite a few questions here related to programming retro hardware, and quite a few questions here about emulating retro hardware, is there any reason why the two combined would be off-topic?
    – ArrayBolt3
    Feb 21 at 10:34
  • 1
    How much freedom do you want in drawing the wires? Like, do you want to be able to accidentally wire an address pin to a clock, or create a bus clash? Do you want to have to think about decoupling capacitors, ground bounce, and signal quality? Or are you more thinking about a (stylistic) block diagram with “this device is mapped to these addresses…” Feb 21 at 15:56
  • 1
    @JacobKrall Don't need a ton of freedom - I don't expect to be able to emulate every single transistor in the whole thing. The thing I want is probably a bit higher level than electronic design automation, but a bit lower level than, say, an emulator for a specific CP/M machine. Perhaps the best course of action here would be to write my own emulator for the exact design I have in mind, but I don't trust myself to get the nuances of 65C02 operation right in the emulator without a physical 65C02 to compare it to. And I don't want to buy a physical 65C02.
    – ArrayBolt3
    Feb 21 at 19:29
  • 2
    Just take Mame/Mess and use the existing chip emulations for custom hardware? Or does Proteus have chips you want to simulate?
    – Justme
    Feb 21 at 19:45

2 Answers 2

5

It's not as user friendly as you are hoping for but the chips emulator contains headers that emulate CPUs and a few peripheral chips down to the pin level.

https://github.com/floooh/chips

With some basic knowledge of C and electronics, it should be easy to add your own virtual chips and build a complete virtual computer.

1
  • Wow, that looks like almost exactly what I wanted. It might be possible for me to just build a GUI on top of that and have exactly what I want.
    – ArrayBolt3
    Feb 22 at 1:33
3

While this isn't a Z80 simulator, Wokwi lets you build and simulate Arduino or ESP32 projects, and meets the criteria you describe in your question. If you insist on a Z80, Wokwi allows you to define your own custom chips, as well.

Not the answer you're looking for? Browse other questions tagged .