Hacking on an emulator is fun because the curve of progress is so sharp. Went from interpreting 30 instructions of a ROM file last night to being in the millions tonight (granted, lots of these are loops, but still).

Of course up until now you're just looping through a byte stream and switching on some opcodes. Then you get to the point where you need to have stuff like the graphics and screen emulation working and synchronized with the emulated CPU, and that's when things start getting complicated.

The Sega Master System has separate CPU and video ("VDP") and I now have them talking to each other. The test ROM I'm using looks like it zeroes out work RAM and VRAM, and then loops waiting for a screen refresh interrupt. So the next steps are building cycle counters and timing and interrupt management.

Also I am enjoying writing this in Rust, it's a surprisingly good kind of project given how much is shuffling data and shared state around.

Finally got some shared timing stuff hooked up, and without any profiling or optimization and while being a complete Rust newbie, this thing is already running at 18 MHz, well above the 4 MHz needed by the Master System.

When I tried to build a Game Boy emulator in Swift, the performance was probably 100x slower by default, and needed a lot of tuning and measuring to get past the 4 MHz mark.


(I forgot that I also tried writing a Game Boy emulator in C++ but uhhhhhhhh that did not last)

· · Web · 0 · 0 · 1
Sign in to participate in the conversation

The original server operated by the Mastodon gGmbH non-profit