Next Generation Emulation banner
1 - 1 of 1 Posts

Level 9998
9,384 Posts
Well, you fetch opcodes before you do anything, pretty much. :p

Then here's the part that is different:

Interpreter: you write high-level generic codes to perform certain tasks in general. For example... store a BCD interpretation of a value. This obviously takes about two or three instructions in C++ or Java or so.

Recompiler: you call the native machine code at this point. (refer to an ASM opcode table for this. Typically... x86 ASM) If the emulating CPU has the same opcode, it means... just one instruction is needed. Portability is obviously non-existent at this point due to the fact that the same opcode/instruction might not be present on another platform, but the performance boost is immense.

Dynamic recompiler: well, basically a mix of the above two, because not all instructions will be available on a certain platform. A full recompiler might only be possible if the emulating CPU has all of the opcodes/instructions of the emulated CPU. Otherwise... a dynamic recompiler, which... does emulation of instructions at both high-level and low-level at the same time (to compensate for the lack of instructions/opcodes), is necessary. Also there *might not* be any boosts in some cases where the timing tables for the opcodes of the emulated CPU is much too... complicated. Then you'd have latency problems because some opcodes would be emulated too fast while others too slow. This is why hacks exist. ;p

In other words, there's not much of a difference from what I can understand. Just a different term to describe the differences. :p The main difference is that an interpreter will be portable to many platforms, hence... if you see a port of an emulator surfaces on another platform, chances are it's using the interpreter engine. In the same context, a recompiler won't be portable, but is pretty useful because it boosts performance immensely (one LL instruction versus two or three HL instructions).

Well, that's how I understand it. :p Hope that does answer your question.

In any case, start looking at ASM opcode tables. I think they'll be of great help.
1 - 1 of 1 Posts