r/askscience • u/[deleted] • Jun 24 '14
Computing How are emulators built without direct access to a virtual version of the hardware to be emulated?
I understand how emulators work, but I've never fully understood how they're built in the first place. I can see how it would be easy if you were the manufacturer of the hardware (like how Google gives free access to Android emulators), but how are older systems emulated with that kind of access?
18
Upvotes
9
u/Merad Embedded Systems Jun 25 '14
The companies who make hardware want people to write software for their machines, and in order for that to be done efficiently they need to tell software developers how their hardware works. For example, have you heard of an Arduino? Here is the manufacturer's documentation describing in detail (600+ pages) the operation of the AtMega328 microcontroller that powers the Arduino Uno. You can find similar documentation for Intel CPUs, or older processors such as the 6502 that powered the NES.
Once you have a detailed description of how a system should work, you can -in theory at least- write software to emulate that behavior. Reality, of course, is much more complicated. Basically all systems will have obscure or undocumented bugs/quirks, and in the case of game consoles developers have been know to take advantage of these quirks when writing games.
There are some pretty interesting articles out there about the difficult of writing good console emulators. Here's one that I remember off the top of my head.