3 ms·
"This sort of thing" is actually really simple to get started with. You just read a few docs about the object-code format and instruction-set of the device you
by derefr 3y ago
"This sort of thing" is actually really simple to get started with. You just read a few docs about the object-code format and instruction-set of the device you want to emulate, and then start writing a simple interpreter loop that reads and executes instructions from any arbitrary existing program ROM. Compare and contrast the results of running it on your emulator with running the same thing on real hardware (or on some other emulator.)
As soon as you get one well-known program working and displaying something on the screen — congratulations, you've made "an emulator"! Now all that's left is "just" debugging the inevitable compatibility issues that your emulator will encounter with every other program ever compiled for the target architecture. It's like Test Driven Development, but your test suite is "the complete game library of the console"!
(And then, once you've got 100-ish percent compatibility, maybe you can spare some time to optimize performance!)
If you've never done this before, it can be great fun! I'd recommend starting with a Z80 (Gameboy) emulator — it's an extremely well-documented architecture, fairly simple (no weird concepts like clipping masks or MMU mapper chips), fast to get to the "rewarding" point where you've got something displaying on-screen, and so low-powered that on modern hardware it'll run at full speed even with the most naive implementation.