X86 -> Arm Dynamic Recompiler For Dosbox? Maybe.


zodttd

Solving your premature emulation since the Tapwave
Joined
Dec 2, 2005
Messages
1,167
Website
www.zodttd.com
Hello everyone,

As I'm mostly maintaining the port for the 8086 static recompiler for GP2X, so it seems...
I'll have more time to work on a project of my own.
I'm seriously considering taking up the challenge to write a dynamic recompiler for DOSBox for ARM-based handhelds, and possibly MIPS after that if all goes well. I don't have much expierence with DOSBox, but it seems like it's a great way to play older PC games on the GP2X. I just don't know how controls are currently handled on DOSBox for GP2X due to the lack of a touchscreen. I'll have to try it out. :)

Hopefully the dynarec could make DOSBox feasible on the GP2X. If that doesn't sound true, let me know! :)

Sound like a good idea to you? ...Wrote to DOSBox developers to see what they think.
 
My dream is to play Hocus Pocus fullspeed on the GP2X. That would make me happy. As of now, it's not too nice, but that would definitely be something sweet.
 
Rayek posted on Sep 18 2006 at 09:34 PM said:
My dream is to play Hocus Pocus fullspeed on the GP2X. That would make me happy. As of now, it's not too nice, but that would definitely be something sweet.

it is a greate idea :D, dynrec will use more assembly language to deal with it. It should accelerate much more. If it is possible to run the protected mode game, it would be GREAT!
 
Last edited by a moderator:
That would be great, I got Bio Menace (Apogee, same engine as Keen 4) running at full speed with the current version of dosbox.. but it seems to crash when shooting an enemy etc (when things get to complex ingame)..
Maybe a dynamic recompiler could fix this because it's faster..

Also, Hocus Pocus would be great indeed..

The current dosbox is pretty good actually, but if someone managed to make it even faster, that would be great.. and there's probably no need of overclocking then (which saves battery life :p).
 
gavie posted on Sep 19 2006 at 06:42 PM said:
That would be great, I got Bio Menace (Apogee, same engine as Keen 4) running at full speed with the current version of dosbox.. but it seems to crash when shooting an enemy etc (when things get to complex ingame)..
Maybe a dynamic recompiler could fix this because it's faster..

Also, Hocus Pocus would be great indeed..

The current dosbox is pretty good extually, but if someone managed to make it even faster, that would be great.. and there's probably no need of overclocking then (which saves battery life :p).

I had the same problem when I played Bio Menace on my Cyrix 5x86 100PR + 4mb Cirrus 2D.

I thought it was because the CPU sucked.
 
Last edited by a moderator:
My dreams are Tyrian and FFE... the former, I think, possible, the latter... maybe, if I'm lucky. Very very lucky. I think it almost worked on a 386 16, but not quite.

On the other hand, a recompiler core might well make all the difference, and hey, if you're ready to take up the challenge, go for it by all means ZodTTD!

Just don't let psx4all slip out of the spotlight for too long! Err... please?
 
Wow, lot's of requests for this.
psx4all will still be my main project, so no need to worry about that. ;P
I figure the more hands on expierence I get with recompilers, the better it is for psx4all in the long run.

Now if only I could get Syndicate Plus (PC, as I didn't like the Genesis one) working/controlling right on the GP2X...The Bullfrog line-up of games would be amazing.
 
The biggest challenge for dynamic recompilation compared to static is that it's not practical to use gcc as a backend compiler on the gp2x itself - so the emulator has to produce the recompiled code itself. This typically means you won't end up with it outputting well optimized code, but it's still a huge gain over interpreter style emulation (some complex translation overhead only happens the first time a particular piece of code is run, instead of simpler translation happening constantly).

The big advantage over static recompilation is compatability - the code you execute doesn't have to be "known" ahead of time, and it's much more of an accurate emulation as far as looking at the whole system goes.

What's nice about using DosBox is that the hardware, BIOS, and DOS emulation has already been addressed, allowing a programmer to focus just on the CPU side of things. Without that, it changes from a mid sized project that needs some specialized knowledge into an enormous project that needs tons of specialized knowledge.
 
Cool, I have the support of the DOSBox developers. I'm going to give this a hard try. This also might lead to official ARM releases of DOSBox. Meaning constantly updated GP2X releases. :)

BradN: I completely agree. When I wrote the ARM dynarec for psx4all, I figured out some cool techniques that can be done due to the fact code is being generated on the fly. Currently the psx4gp2x dynarec calls the recompile function that generates the first block of code, then executes it. The cool thing is the generated code from the first recompile function jumps back to the recompile function by itself as needed or hits the cache. So it never leaves the recompiled function. It's referred to as being "threaded", but not to be confused with multithreading.

There's other advantages of using a dynarec and DOSBox but it's pretty much understood so it seems. :)
 
I think what we'll end up see happening is dynarec'd dosbox being used for emulation up to about the 386/early 486 level (with a good success rate), and after that, maybe some well targeted static recompilation to get a handful of more power hungry games to work (the hope being that gcc can better optimize the code as it compiles the new binary).

Statically compiling fully 32 bit code might in some ways be easier than 16 bit code... there won't be as many (if any) overlays to deal with, and there's no godawful segmented memory model. Once you figure out how to deal with a program that uses one type of DOS extender, it's likely it will be very similar for other games that used it too. I doubt any of the DOS extenders were very aggressive in their use of memory mapping type features.
 
zodttd posted on Sep 19 2006 at 04:47 PM said:
Cool, I have the support of the DOSBox developers. I'm going to give this a hard try. This also might lead to official ARM releases of DOSBox. Meaning constantly updated GP2X releases. :)
There's other advantages of using a dynarec and DOSBox but it's pretty much understood so it seems. :)

Sadly I see a big problem with this and th 386 emulation need for games like tyrian and so, and is the pmode and mmu management.. I think the big hit would be emulating the memory in mixed flat/segmented memory models... I have not seen dosbox though...

btw.. I'm waitng for u online...
 
Last edited by a moderator:
if this works would games like blood and redneck rampage be possible?
not that I have much hope I'm just curious.
 
banjosrevenge posted on Sep 20 2006 at 05:25 AM said:
if this works would games like blood and redneck rampage be possible?
not that I have much hope I'm just curious.

Zodttd: I love you (in a heterosexual way ;) ) just as much as anyone else on this boards, but you do realize what can of worms you just opend, right?
Now we will have whiny twelve-year-olds, posting about every game every released on the PC every other day, demanding it to run on the GP2x and quoting you totally out of context on that Dosbox dynarec, which might work out or not, but right now pretty much still is a idea only, with little chance to ever run anything more than a slow 386 (given a lot of time).
It is bad enough with the PSX emulator of yours already (with I look forward to play a few certain games on, but would never expect to run 100% full speed for all games on the gp2x).

Thanks for all your hard work, and I am definitly looking forward to what you come up with, but please consider the who reads your posts around here, and what the fallout might be :(

Edit: sorry I am in a strange mood right now...
 
Last edited by a moderator:
Back
Top