4 ms·
Wait. You emulate 3.5MHz machine on 2.8GHz Core i5, reach 10 the speed of original (1.3 to 1.5 ms 'emulator time' per 16.6ms) and therefore proclaim success? :o
by rasz_pl 10y ago
Wait. You emulate 3.5MHz machine on 2.8GHz Core i5, reach 10 the speed of original (1.3 to 1.5 ms 'emulator time' per 16.6ms) and therefore proclaim success? :o
- flohofwoe 10y agoHe, do it better then ;) The CPU emulation alone is about 300x faster then an original Z80 (runs at 1.2 GHz on the same MBP), most performance is currently burned in the CPC video emulation (way more expensive then the CPU). The CPU and memory system is quite optimized, the other systems not so much.
- rasz_pl 10y agoafaik CPC video is very basic, pretty much a raw MC6845 crtc. No sprites, no blitters, no dma. What is giving you so much problems performance wise?
- flohofwoe 10y agoThe video config can be changed by the CPU in the middle of a scanline so you can't decode an entire scanline in a tight loop but need to run video decoding interleaved with the CPU (currently it's ticked after an entire CPU instruction though, not per cycle), and every tick of the video system needs to figure out all the decoding parameters again, because they might have changed since the last tick (and demo-scene demos use this mid-scanline-stuff a lot). Also the display isn't driven directly by the 6845, HSYNC and VSYNC go through the Gate Array where a few ticks of latency is added, the same is true for the interrupt request that happens every 52 scanlines. On top of that the CPC has an extra funky pixel bit pattern (http://cpctech.cpc-live.com/docs/graphics.html http://cpctech.cpc-live.com/docs/graphics.html) I haven't spent any time at all yet optimizing the video system though, for instance the pixel decoding might benefit from lookup tables. I first want to get it accurate enough for demo-scene gfx demos, and than will take care of performance.
- pjc50 10y agoAs the author says in sibling comment, impersonating a processor is much easier than making an accurate reproduction of period video and sound hardware.
- rasz_pl 10y agoThis depends entirely on hardware. You can run good emulation of 8 bit computers (spectrum, c64, cpc) at ~hundreds to thousands the original speed using emulators written in C. Using emulator that barely reaches x10 factor as a performance benchmark for webassembly is questionable.
- flohofwoe 10y agoThat's a pretty bold claim considering that (for instance) MAME's CPC emulation eats 25% of one CPU core (checked with vsync enabled). MAME might not be the fastest because they do a lot of the inter-chip-communication via function pointers, but they're also not idling around and the CPC emulation is quite accurate AFAIK. If you can point me to an emulator that's hundreds or thousands of times faster I'd really like to take a look, might steal some ideas ;)
- sp332 10y agoGames use every little glitch and quirk of an architecture. Emulating a zillion edge cases on another architecture takes a lot of power. In 2011, someone finally made an accurate SNES emulator but it needed a 3GHz CPU. https://arstechnica.com/gaming/2011/08/accuracy-takes-power-one-mans-3ghz-quest-to-build-a-perfect-snes-emulator/ https://arstechnica.com/gaming/2011/08/accuracy-takes-power-...