How console emulator works?

290 views

People have been able to create emulator for consoles like N64 or PS1, but how were they able to do it? and how has it become harder to do for new gen consoles like PS5?

In: 15

4 Answers

Anonymous 0 Comments

In older consoles, cartridges contained ROMs (read only memory) which stored all the game code and art assets. The game code is stored as a series of CPU instructions, like “take this value and store it in this location in RAM”, or “send this data to the GPU and tell it to do this”.

When you power on the console, it runs a special sequence of steps to basically look for a cartridge connection, confirm its valid and for the right region, and if it finds one it will look in a specific location in the ROM to figure out what it is supposed to do first, then begin executing it.

What an emulator does, is essentially copies this process: it reads the ROM file, finds the first instruction and begins doing what it is being told to.

The catch is that the instructions the ROM contains assume a specific machine, such as a NES, N64, Genesis etc. When it gives an instruction like “move this block of memory to this location in memory on the VDU” your PC thinks “what the heck is a ‘VDU’?” When the ROM says “wait for vertical blank”, your PC thinks “what is a vertical blank”. This means it cannot actually run any of the instructions it’s being given.

This is where “high-level emulation” (HLE) and “low-level emulation” (LLE) come in. HLE can be described as directly translating instructions. When the ROM says “move memory to VDU and wait for vertical blank”, the emulator translates this to “draw this triangle on screen and wait for the next frame” for your PC to execute.

HLE works quite well, but its not very accurate. For those who just want to play a bit of Mario 64 it generally works OK, but there are a lot of quirks specific to the original hardware which means the way your PC reproduces those instructions isn’t exactly 100% identical. Sometimes the differences are tiny, such as Mario’s shadow is a little darker in the emulator than the original, and sometimes it can be severe (game crashes).

This is where LLE comes in. The emulator doesn’t just interpret instructions for your PC, it actually simulates the original machine. It gets really psychotically anal about everything, down to “it takes 2 nanoseconds for the memory to transfer to the VDU, so we will simulate that delay exactly. Then the TV’s electron beam takes 1 ns to finish a scan line, so we will simulate that”. This is MUCH more accurate and can produce 100% faithful recreations, but at the cost of being MUCH more demanding on hardware. That’s why a SNES emulator can require a 3ghz machine.

Hope this helps!

You are viewing 1 out of 4 answers, click here to view all answers.