:o
Hmm, the link to the pdf does not exists any more or I am to dumb to find it
Anyway, cool thingy ^^
Sounds impressive, cant seem to find much evidence tho.
http://www.flickr.com/photos/feria/149120535/
http://www.lombardisoftware.com/pr.php?pr=5-9-06
Pretty convincing evidence to me.
I’m guessing part of reasons why it’s so fast is that they created a dynamic recompiling CPU core using the JVM (at least that’s what they suggested in the articles). This is much easier to do in java than in for example C as you can simply write bytecode and let HotSpot do the optimizing. This will achieve great performance gains compared to the traditional interpretting CPU emulator (comparable to running a java program in interpreted mode versus HotSpot).
Toby Reyelts once rewrote JEmu2’s Z80 core to a ‘dynarec’ core, and he showed me that it’s much easier than I anticipated. His first attempt was a static recompiler but this is close to impossible without any human intervention, but a dynarec core is very doable.
erikd, do you have the source for that Z80 dynarec somewhere? I’d like to change my emu and see if I can make it work with dynarec, but I wouldn’t know where to start. It all sounds pretty advanced, but it ought to be a lot simpler with Java than with C++.
I’m not sure, it was on my previous PC so I hope I have a back up of it somewhere. There were some issues with it though, which is why it wasn’t included in the JEmu2 distribution.
Toby has some blogs about the subject too at http://jroller.com/page/rreyelts/20041019.
The idea is to compile ‘basic blocks’ of code, which is a block of code ending with a branch or return. When the branch or return is encountered, it will write byte code for all instructions in the basic block, and the instruction of the 1st instruction in the original ROM is changed to a special instruction which is illegal for the original CPU, but a mark for the CPU emulator to call the generated java version of the block of code instead of going on to interpret.
The fun thing is, in java you can simply generated all byte codes for emulating the basic block of code, and let HotSpot do the optimizing. If you let HotSpot do it’s job, you don’t have to do the difficult things like dead code removal and such (and you can imagine that these translated basic blocks of code will have a lot of dead code, like unused flags).
I’ll see if I can find the Z80 recompiling core.
Just as a funny comment, maybe Nintendo should have developped the Wii emulators for NES, SNES and N64, etc. in Java! Maybe they would have benefited of all the major advantages discussed by erikd. I know, I know, dream on… :
how do you know they didnt’? ;D
Well , ask them then… ;D
Heh, a Wii is probably fast enough to emulate even an N64 using just interpreters so why bother?
I am sure they have a hardware based VM or any other low level architecture. Can’t image that they would use java for it.
It’s very likely they didn’t use java, but I wouldn’t know why they wouldn’t go for software based emulators. To include 3 emulators in HW sounds very expensive to me.
[quote]Heh, a Wii is probably fast enough to emulate even an N64 using just interpreters so why bother?
[/quote]
Yes, I know. It’s just that Java would have been a good choice for emulating old Nintendo systems. It would have open the door for Java game dev.
Hi Guys,
I actually attended the session at JavaOne where Lombardi talked through and demonstrated their PSX emulator. It was pretty cool stuff. I learned some nifty tricks I hadn’t thought of - like using a custom ClassLoader to allow you to generate static references to code that doesn’t exist yet (i.e. code that you have yet to dynamically recompile). I talked a little bit to the presenter afterwards, and he was a pretty cool guy. We talked some about skipping BCEL/ASM to generate bytecode binaries directly from templates.
Anyway, I’ll look around and see if I can find that dynarec code. IIRC, there were a few bugs in it, but it was generating code correctly for Ms. Pac Man and Galaga.
Does anyone know how Sony feels about these emulators? I’m just curious. It seems like non-PS2 owners can buy Playstation 2 games and play them on their home computer. Increasing even more sales for Sony and other publishers.
Jeff
I can tell you that Sony doesn’t like it. Emulators are frowned upon by ALL game console manufacturers.
-Chris
As I understand it they basically lose money on the console itself but get all the profits from licensing the software… if you buy software without a console, then they are farther ahead…
I guess emulators are really just used to bypass copy protection…
The Z80 dynarec code is here: http://www.gagaplay.com/jemu2/cpu.zip
I’m not sure if this was the latest version though.
[quote]I can tell you that Sony doesn’t like it. Emulators are frowned upon by ALL game console manufacturers.
[/quote]
Like swpalmer mentioned, this is probably because they are usually used for piracy. I guess they wouldn’t mind a PSX emulator so much if it were only capable of running the original CD’s especially since the PSX itself is not in production anymore.
The japanese company behind the MSX system, ASCII, released an official MSX emulator themselves a few years ago.
I guess if Sony did the same with PSX and rerelease the best PSX titles cheaply which would run on the emulator, they could still make a buck with an otherwise dead system.
Erikd, the Wii emulates even more than 3 old consoles. From the latest I read it will emulate NES, SNES, N64, Sega Genesis and Turbo Grafx. Don’t know which system the last one is, never heard of it. GameCube games shall run on the hardware itself.
ED, you’re KILLING me! Turbo-Grafx 16 by NEC. Specs blew Genesis out of the water but was too “Japanese” for the American market. Games like Street Fighter found their first home on the TG-16, along with great characters like Bonk, Keith Courage and Dracula X. Check out the information here: http://www.atari7800.com/turbo/
-Chris