Next Generation Emulation banner

1 - 2 of 2 Posts

·
Emu Author
Joined
·
613 Posts
Discussion Starter #1
i have decided to move on to a new emulator project, this time a space invaders emulator, and i wanted to ask for a recommendation.

would it be worth wild to look into doing a dynamic recompiler or would an interpreter still be fast enough, i ask since i am emulating an actual cpu this time around. either way should not be to difficult as i do already understand the basics of asm and than a bit more as i have coded a bit of asm before.

also if anyone does recommend that i go for a dynamic recompiler, could someone point me to really good examples of them as i only ever seen one such example that did not even go through it correctly.

thank you for any advice and the like and wish me luck :D.
 

·
Level 9998
Joined
·
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 - 2 of 2 Posts
Top