Emulators written in C and assembly plus whatever the original proccessor had running on it. They are literally translating everything from one proccessor arcitecture like the GPU, the libraries of c programs, the memory controllers, the assembly of the CPU, and the sound into a entirely different format.
The only thing more complex then that is wine/codeweavers. Because their doing the above and trying to maintain compatibility with winblows.