Is it theoretically possible to create a game console that works with all kinds of different games (PS1-4, all Xboxes,...)? So basically some kind of 'emulator'? If not, why?

You can always build some kind of 'meta-console' that contains all parts of the consoles it should emulate. The only thing left to do is then to dispatch the game data and input to the right console and redirect the output from the active console to the screen.

So in theory it's possible, but in practice using software emulation is the easier and cheaper way. Here you have a normal PC and run an emulator on it.

The emulator takes the game data and performs the same operations (e.g. calculating, rendering) as the specific console would do, but instead on having some kind of hardware that performs an operations, it uses a piece of software that does the same thing.

The downside from using an emulator is that you need hardware that is capabable of emulating instructions with at least the same speed as the original console.

Depending on the emulation technology and the game console this requirement is hard to achieve:

Traditional interpretation for example is slow but easy to implement. It reads the next instruction it needs to execute, figures out what the instruction does (e.g. adding to numbers, writing a byte to memory) and then dispatches to the specific part of the emulator that actually executes this specific instruction (also known as 'decode-and-dispatch' interpreters). Here the emulating system needs to be much faster than the game console to handle both the expensive decode-and-dispatch mechanism and game itself.

An faster but more complex way is dynamic recompilation or Just-In-Time compilation. Here the game data is read and then translated to a format that the host hardware can understand.

In a perfect world, this would reduce the emulation overhead to zero but quite often there is still some emulation left because the hardware isn't build in the same way. The gameboy for example has AFAIK a memory segment representing the pixels on the screen, but modern operating systems don't offer to normal programs this kind of feature and hide it behind APIs, so you'll always have the operating system software causing overhead for rendering access for example.

As an pratical example for a 'meta-console' featuring software emulation of multiple game consoles, see Retron 5.

/r/AskComputerScience Thread