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.

user3840170
  • 23,072
  • 4
  • 91
  • 150
ArrayBolt3
  • 551
  • 3
  • 11
  • 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 '23 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 '23 at 10:34
  • Related: https://retrocomputing.stackexchange.com/questions/16190/is-there-still-no-digital-version-of-pcbs-and-ics-software-that-all-future-emu?rq=1 I'm not looking for something quite as involved as this question is mentioning, but the concepts are (kinda) the same. – ArrayBolt3 Feb 21 '23 at 11:00
  • 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…” – Jacob Krall Feb 21 '23 at 15:56
  • There's a name for what you seek. It's called an "Electronic Design Automation" system. Most such systems are able to run gate-level or transistor-level simulations of the circuit that you're trying to build, but the intended purpose of the simulation is to run test vectors and find design defects. You may find the experience of simulating a complete computer system (including all of its peripherals) at such a low level to be less than satisfactory. – Solomon Slow Feb 21 '23 at 18:19
  • 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 '23 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 '23 at 19:45
  • @Justme Hmm, using Mame/Mess as a starting point seems like a great idea. Proteus is pricey and appears to be for modern hardware, so I probably won't use them. – ArrayBolt3 Feb 21 '23 at 22:25
  • Yeah now I’m wondering if a bus-diagram editor for Mame would be possible… hmmm – Jacob Krall Feb 21 '23 at 23:09
  • @Raffzahn Not off topic. Emulating old systems is retro computing. It's much more on topic than all the "when did x first do y?" questions that are really computing history. – JeremyP Feb 22 '23 at 09:02
  • @JeremyP Mind to check again, emulation is only on topic if it's about the emulated classic system i.e. behaviour found on that system and solutions needed within the context of that classic system. This question is about neither. It does ask for modern software to create a a simulation of a new system. Thus 100% off topic. – Raffzahn Feb 22 '23 at 16:30
  • @Raffzahn For some reason I thought that the 6502 and related components were classic systems. Would it be similarly off-topic if I were to build a 6502 computer from parts and asked for help programming my custom setup? The highly upvoted question linked to at the start of my question suggests otherwise. – ArrayBolt3 Feb 22 '23 at 20:03
  • @ArrayBolt3 I believe they're saying that either vintage software or hardware must be involved and a modern software-only simulation of vintage hardware with no intent to actually implement with either vintage part numbers, modern pin-compatible replacements, or near-pin-compatible chips which implement the same instruction set counts as neither "vintage hardware" nor "vintage software". – ssokolow Feb 22 '23 at 23:27
  • @Raffzahn This question was about emulating a chip from the 1970's. It's retro computing. If you don't want anybody posting to this site, just say so. – JeremyP Feb 23 '23 at 08:26
  • I have voted to reopen this question because it is about emulating ancient technology (in computing terms). Of course it's retro computing. – JeremyP Feb 23 '23 at 08:27
  • @ssokolow It's basically snobbery. Of course emulating old computer systems is retro computing. On the other hand, discussing the history of computers like "why didn't people use the Z80 extensions over the 8080" is not computing at all. It's history. But people think that's OK probably because it's easier to write about. It's not like this site is inundated with questions in the first place. – JeremyP Feb 23 '23 at 08:30
  • @JeremyP - It might be better to post and discuss this in a Meta.Retrocomputing post, as (IMHO) the comments section seems to not be the place for this type of "Is it a valid question" debate... and you could make a much better argument for this type of question in a post that isn't limited by character length. – Greenonline Feb 23 '23 at 09:20
  • @JeremyP To me, it sounds more like a particularly strict interpretation of the rule that questions about software running in a DOS or NES emulator are on topic, but questions about how to choose or set up the DOS or NES emulator itself are considered questions about modern computing and are off-topic unless you're asking about something like running a DOS version of ZSNES. – ssokolow Feb 23 '23 at 16:56
  • 1
    @Greenonline Yes, I was thinking the same after I posted the comment. I'll compose something for meta. – JeremyP Feb 27 '23 at 08:54

2 Answers2

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.

Dash
  • 59
  • 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 '23 at 01: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.

Eric Brown
  • 561
  • 3
  • 5