News for hackers. Stuff that matters.
Re:Implementing a NES Emulator in Rust by jrockway on Tuesday March 19, 2019 @12:14PM (#19432214)
The original hardware was multithreaded... in the sense that there were several separate processing units.
Re:Implementing a NES Emulator in Rust by flohofwoe on Tuesday March 19, 2019 @12:57PM (#19432734)
Yes, but as far as I can glance from the NES spec, those still run from the same clock (with different dividers, but they're still locked to each other).

I haven't written an emulator for the NES yet, but on machines like the Amstrad CPC or C64, the CPU can reprogram video hardware registers (like color palette entries) at any time, for instance in the middle of a scanline. When this is off by a tick, you get the color palette change a couple of pixels late or early.

If CPU and video chip emulation would run on different threads, they would need to sync with each other a few million times per second, that doesn't sound like a good idea. If synchronization is only needed once per scanline, or even per frame that's an option of course. Often this is good enough to run some games which didn't go too close to the metal (again this is only from my experience with home computer emulators, haven't done NES stuff yet).

Parallelizing through SIMD might be an option though (one can pack a lot of 4- or 8-bit counters into a 512-bit register).

Re:Implementing a NES Emulator in Rust by boomlinde on Wednesday March 20, 2019 @09:11AM (#19441691)
Yes, but their emulation needs to be performed in lockstep, normally per clock tick or at least externally visible state change, to accurately model their interaction with respect to timing.

Threading in that case would likely mean several orders of magnitude of performance degradation.