Bringing emulation into the 21st century
July 23, 2021 6:39 AM   Subscribe

Emulation is a fascinating area of software engineering... Whilst the rest of world moves onto cloud first, massively distributed architectures, emulation is still stuck firmly in the 20th century writing single threaded C++ of all things. This project was born out of a desire to bring the best of modern design back to the the future of ancient computing history.
So what can the best of modern architecture bring to the emulation scene?

Hot swappable code paths allowing for in game debugging
Different languages for different components
Secure by default (mTLS on all function calls)
Scalability
Fault tolerance
Cloud native design

This culminated in the implementation of an 8080 microprocessor utilising a modern, containerised, microservices based architecture running on kubernetes with frontends for a CP/M test harness and a full implementation of the original Space Invaders arcade machine.

David Tyler
recreates Space Invaders using many cloud based microservices. The 60 odd code repositories are here.
posted by antiwiggle (25 comments total) 18 users marked this as a favorite
 
Whilst the rest of world moves onto cloud first, massively distributed architectures, emulation is still stuck firmly in the 20th century writing single threaded C++ of all things.

Because as found in this very article...
Assuming that person knows what they’re talking about then the immediate answer is a straight no. You’ll never achieve the required latency across a network (particularly a dodgy cloud data center network).
And fuck the notion that emulation is still stuck firmly in single threaded C++. Have you seen Dolphin? The team wrote an emulator for the ridiculously powerful fixed functions of the Flipper family of GPUs in a Vulkan shader. That's far more impressive and 21st century than a emulator for the sake of kubernetes.
posted by Your Childhood Pet Rock at 7:15 AM on July 23, 2021 [14 favorites]


The is a farce, or parody - no? Who would implement an op-code in VB, over HTTP with TLS for an emulator?

And... making it cloud-dependant?

Definately a parody... "Like any true modern application it also consists of significantly more JSON/YAML than code."
posted by rozcakj at 7:19 AM on July 23, 2021 [11 favorites]


And I'm just trying to run Atomiswave and NAOMI games on a Raspberry Pi 4. (If there are any RetroPie mavens in this thread, I'd super appreciate any help.)
posted by Faint of Butt at 7:20 AM on July 23, 2021 [1 favorite]


It’s written as a joke… but it’s way too close to stuff I’ve seen for me to be laughing.
posted by WaterAndPixels at 7:21 AM on July 23, 2021 [11 favorites]


As a former 808x developer, I would call this an intriguing thought experiment and a fun technical achievement. But as the author says near the end, it's "something of a joke" in practical terms. Processor-level emulation needs to be tight, especially for games -- hence the use of C++. In those days when writing games in assembly, many developers designed the pacing of animation around the clocks required by each instruction. If it ran on a faster processor, it would animate too quickly and be unplayable. This can be remediated in a tightly-written CPU-level emulator by replicating the original timing.

Modern cloud architecture would introduce arbitrary latency and "moving parts" (such as TCP calls) that may fail or require reattempts. Even for a simple example like Space Invaders on 8080, it doesn't perform well. So, how long before our technology evolves such that a cloud/microservices approach would be able to emulate more sophisticated software -- for example a legacy 3D game? Maybe never?

But he raises some interesting points about fault tolerance, multi-threading and such in the context of emulation. Not sure if this research takes us anywhere currently. What is emulation used for nowadays, other than games? Mostly for 64-bit virtual PCs, no? And the high-performance requirements for those virtual boxes to be useful would preclude the use of the author's ideas at a CPU-emulation level. Thoughts?
posted by TreeHugger at 7:22 AM on July 23, 2021 [1 favorite]


It is absolutely a joke. The blog post's tags, right at the top, are "emulation 8080 spaceinvaders satire".
posted by jedicus at 7:43 AM on July 23, 2021 [5 favorites]


It doesn't even matter whether the joke is technically feasible... it's emulation. Emulation is all about having local copies of things you don't trust the publishers to continue to support, often illegally. You don't want to make that dependent on an internet connection to a specific cloud.
posted by one for the books at 7:46 AM on July 23, 2021 [1 favorite]


Wow, you could fill a whole office floor with IBM contractors to implement Space Invaders II on WebSphere.
posted by RobotVoodooPower at 7:55 AM on July 23, 2021 [9 favorites]


(note: we strongly recommend choosing a top tier cloud provider like IBM for this)

I lol'd.
posted by jedicus at 8:04 AM on July 23, 2021 [5 favorites]


This is a joke, right
posted by OverlappingElvis at 8:06 AM on July 23, 2021 [1 favorite]


Ah, it is a joke
posted by OverlappingElvis at 8:06 AM on July 23, 2021 [1 favorite]


Kudos to Go, which managed to produce a svelte 6 MB package for rotate operations -- certainly a one-liner like all of the other microservices. It would fit on only 45 Apple ][ floppy disks.
posted by RobotVoodooPower at 8:21 AM on July 23, 2021 [7 favorites]


Needs more blockchain.
posted by acb at 8:47 AM on July 23, 2021 [6 favorites]


I suggested that the author finish the job and implement this all in WASM, then port it to Verilog and then burn it into a billion-gate FPGA.

The 8080 has 6,000 gates
posted by JoeZydeco at 8:48 AM on July 23, 2021 [5 favorites]


In all seriousness, I came to this article with high expectations. Perhaps emulators that build formal descriptions of the emulated systems, which can be recompiled to arbitrary (hardware and/or software) platforms and modified arbitrarily, or at least the “single-threaded C++” being replaced with Rust or Swift or something. Though I guess we got Swift in the modest proposal sense.

This could probably do with a chindogu tag.
posted by acb at 8:54 AM on July 23, 2021 [2 favorites]


A friend of mine made a game boy emulator, as a proof of concept for his C-to-verilog compiler. It's a circuit level emulation and the verilog could almost surely be turned into an FPGA or VLSI fabricated chip. I am curious whether the verilog verson would require a lot more footprint than the original or not.

project is here, please note that I don't really understand all of it so I might be explaining it badly.
posted by RustyBrooks at 9:23 AM on July 23, 2021 [1 favorite]


The fact hat he built so much of this is what blurs the line between it being a joke and a serious proposal, but it absolutely a joke. This is basically Jonathan Swift dressing up a roast goose like a baby and eating it on camera.
posted by GuyZero at 10:37 AM on July 23, 2021 [6 favorites]


absolutely assumed that satire was some new container manager I hadn't heard of
posted by OverlappingElvis at 11:46 AM on July 23, 2021 [11 favorites]


That project is interesting, they've taken Furrtek's reverse-engineering description of the original circuit and converting that to their own HDL (which is a subset of C++).

The original chip engineers pretty much knew what they were doing, and did some tricks you can't succinctly model in a HDL. It'd be unusual for an emulation to be smaller than the thing being emulated, unless you were to reduce functionality or accuracy. But that's just talking percentage points, the monstrosity in the FPP is literally a million times bigger than the original.
posted by RobotVoodooPower at 11:49 AM on July 23, 2021 [1 favorite]


If you've ever played the Ms Pac Man / Galaga 20 Year Reunion machine, the developers of that hardware took the original Pac Man / Ms Pac motherboard (example) and broke it all down into Verilog and then put it on an FPGA (result).

And that was twenty years ago. There are projects like MiSTer (Project Page) that have taken this even farther.
posted by JoeZydeco at 12:22 PM on July 23, 2021 [3 favorites]


It'd be unusual for an emulation to be smaller than the thing being emulated, unless you were to reduce functionality or accuracy.

I don't know how accurate his source material is, or how well it's modelled, but this is more of a recreation than an emulator. The emulated part would be what you run on a computer, but if you made the verilog into a chip, that chip would be more of... a reverse engineering result than an emulator. (I think)
posted by RustyBrooks at 2:07 PM on July 23, 2021


The source material is likely very good if not perfect. See also excrutiating detail about recreating the 6502 CPU in Verilog. You can get very close to the original chip, but there are a couple things you have to "emulate" -- which ends up the same in the end, because the logic is the same. Same as if you want to use the block RAM on the FPGA -- it's not the same as the asynchronous RAM used in the old 8-bit hardware, but the end result is the same.

Technically an FPGA based on a reverse-engineered circuit is an emulator, but it's likely the best emulator you can get short of the original chip, and you might be able to fool an outside observer, since latency of input to output is basically zero. But you could also fool an outside observer with a bit-banging emulator running on a really fast microcontroller, although this gets difficult as you try to emulate multi-MHz systems.
posted by RobotVoodooPower at 3:04 PM on July 23, 2021 [1 favorite]


This has to be a parody. It's throwing buzzwords atva problem that doesn't exist.
posted by GallonOfAlan at 3:39 PM on July 23, 2021


prior art:

* C++ std::unique_ptr that represents each object as an NFT on the Ethereum blockchain. ( zhuowei ; 2021/03)
* bfaas - scalable, resilient brainfuck (zserge.com ; 2021/04)

The bfaas architecture very elegantly shards memory cells by address % 2.

> It’s written as a joke… but it’s way too close to stuff I’ve seen for me to be laughing.

Yes. I can imagine $enterprise_dayjob mandating that all future system architectures implement the pattern:

> Secure by default (mTLS on all function calls)
posted by are-coral-made at 10:30 PM on July 23, 2021 [1 favorite]


> assumed that satire was some new container manager I hadn't heard of

Satire service mesh extends Kubernetes to establish a fully autonomic, metastasized service mocking capability.

"Satire enabled us to rapidly and thoroughly mock our entire complex enterprise microservice architecture, allowing us to iterate faster on feature delivery with more confidence"
posted by are-coral-made at 10:45 PM on July 23, 2021 [4 favorites]


« Older A unanimous vote for the right to repair.   |   Man Calling Libraries and Masturbating to a... Newer »


This thread has been archived and is closed to new comments