Working On A Dynarec For Gpsp For The Gp2x


The NDS and GBA SNES emulators take advantage of the respective hardware sprite and tile handling capabilities. As we know the SNES custom GFX chips are the hard part so the GBA/NDS CPU only has to do relatively little work handling the sounds and CPU of the SNES.
 
PokeParadox posted on Feb 10 2007 at 08:31 PM said:
The NDS and GBA SNES emulators take advantage of the respective hardware sprite and tile handling capabilities. As we know the SNES custom GFX chips are the hard part so the GBA/NDS CPU only has to do relatively little work handling the sounds and CPU of the SNES.

As far as i understood the old paradigm was that the custom hardware did the main work while the cpus were merely directing it. It has shifted now. Units like PS3 (with its 1+8 cpus) or the GP2X seem to be more cpu-centric now.
 
Last edited by a moderator:
PokeParadox posted on Feb 11 2007 at 06:31 AM said:
The NDS and GBA SNES emulators take advantage of the respective hardware sprite and tile handling capabilities. As we know the SNES custom GFX chips are the hard part so the GBA/NDS CPU only has to do relatively little work handling the sounds and CPU of the SNES.
Yes, the architecture of the GBA is very similar to the SNES. Being a superset of the SNES hardware means that it can emulate the SNES video hardware using it's own video hardware.

For example a basic SNES graphic element might be an 8x8 graphic, much like a text character. The SNES could write one or two bytes to effectively write 64 pixels (8x8).
A traditional emulator powered by the GP2X or a PC would have to duplicate this the hard way, perhaps doing as many as 64 writes. Perhaps more depending on the situation.
On the other hand, the GBA/DS could write the same graphic in almost the same way as the original SNES, perhaps needing to write one or two bytes. Other tricks such as layers etc can be easily duplicated on the DS and GBA as well as color palette changes. Everything is at least an order of magnitude easier.

If you have a look at Flubba's GBA emulators, they all use this method to achieve amazingly fast emulators on the humble 17Mhz GBA.

PocketNES on the GBA is utterly amazing - fullspeed and highly compatible NES on the GBA.
PCEAdvance on the GBA is probably even more amazing, PC Engine on the GBA. Not quite fullspeed, but if this was ported to the NDS I'm sure it would be.

PocketNES on the GBA is what originally enticed me into the world of handheld emulators.
 
Last edited by a moderator:
slaanesh posted on Feb 10 2007 at 09:22 PM said:
PocketNES on the GBA is what originally enticed me into the world of handheld emulators.

Heh, me too. I remember how great it was to have portable NES, yet the scaled screen was killing me. Seeing that GP2x would likely have perfect, unscaled NES sold me.
 
Last edited by a moderator:
I thought this thread was about GBA running on the Gp2X? ;)

Well we did always want a good NES emu on the GP2X so I guess we can run it through GPsP when Zod' gets it going :p
 
DaveC: I was porting Little John Revolution's NES to the GP2X but I never got time to fix a bug preventing it from running. :(
 
zodttd posted on Feb 11 2007 at 04:06 AM said:
DaveC: I was porting Little John Revolution's NES to the GP2X but I never got time to fix a bug preventing it from running. :(

That is okay, the NES emu on the GP2X is not THAT bad, it could use a bit of a speedup and sound could be cleaned up but it is playable.

Since you are on GBA right now I am interested to see how well that will turn out. I am hoping it will run close to the speed of the PSP version. Do you use any native ARM code or are you emulating an ARM with an ARM? I am just curious how you are doing this, sounds interesting.
 
Last edited by a moderator:
I think that NES emulator GPFCE is an excellent emulator, i can run every game at fullspeed.

Forgetting frontend what do you think is lacking this emu Davec?

Sorry for my bad english. :(
 
Rivroner posted on Feb 11 2007 at 04:26 AM said:
I think that NES emulator GPFCE is an excellent emulator, i can run every game at fullspeed.

Forgetting frontend what do you think is lacking this emu Davec?

Sorry for my bad english. :(

No not the frontend, the sound is a bit off and you have to overcklock to get near full speed on GPFCE. Plus it uses the stick click which I don't have.

This is about GBA though not NES. Off topic I think.
 
Last edited by a moderator:
slaanesh posted on Feb 11 2007 at 03:22 AM said:
PokeParadox posted on Feb 11 2007 at 06:31 AM said:
The NDS and GBA SNES emulators take advantage of the respective hardware sprite and tile handling capabilities. As we know the SNES custom GFX chips are the hard part so the GBA/NDS CPU only has to do relatively little work handling the sounds and CPU of the SNES.
Yes, the architecture of the GBA is very similar to the SNES. Being a superset of the SNES hardware means that it can emulate the SNES video hardware using it's own video hardware.

For example a basic SNES graphic element might be an 8x8 graphic, much like a text character. The SNES could write one or two bytes to effectively write 64 pixels (8x8).
A traditional emulator powered by the GP2X or a PC would have to duplicate this the hard way, perhaps doing as many as 64 writes. Perhaps more depending on the situation.
On the other hand, the GBA/DS could write the same graphic in almost the same way as the original SNES, perhaps needing to write one or two bytes. Other tricks such as layers etc can be easily duplicated on the DS and GBA as well as color palette changes. Everything is at least an order of magnitude easier.

If you have a look at Flubba's GBA emulators, they all use this method to achieve amazingly fast emulators on the humble 17Mhz GBA.

PocketNES on the GBA is utterly amazing - fullspeed and highly compatible NES on the GBA.
PCEAdvance on the GBA is probably even more amazing, PC Engine on the GBA. Not quite fullspeed, but if this was ported to the NDS I'm sure it would be.

PocketNES on the GBA is what originally enticed me into the world of handheld emulators.
did you try the snes emu also ? (snesAdvance)
is it any good ? http://www.snesadvance.org/index.html
(i also noted that source are available for all of loopy+flubbas emus)
 
Last edited by a moderator:
evol posted on Feb 13 2007 at 10:59 AM said:
did you try the snes emu also ? (snesAdvance)
is it any good ? http://www.snesadvance.org/index.html
(i also noted that source are available for all of loopy+flubbas emus)
Yes, I did and it played some games really nicely.
There were a couple problems including screen priority, speed and screen-cropping.

The biggest problem was screen-cropping due to the GBA screenmode used for the emulation.
The GBA could not rescale the entire screen so you were always left with cropped screens. This, for me was a show-stopper.
The reason being that the GBA can rescale the screen in hardware if the chosen screenmode has two or less backgrounds. The SNES can have up to four backgrounds. So using the GBA 4-background mode, hardware rescale is not available. So you are left with only view a portion of the screen. So the GBA screen gave you a 240x160 window of the SNES 256x240 screen. Blah. Give me rescale anytime.

The NES, SMS and PC-Engine emu rescale modes were also quite clever (and possibly the same could be done with CPS2 as an option).
The GBA would alternate lines so that all the pixels would be displayed every alternate frame.
ie.
Frame 1 draw lines 1,2,4,5
Frame 2 draw lines 1,2,3,5
Frame 3 draw lines 1,2,4,5
etc

Because it was running at a full 60FPS, this meant that all the pixels would be displayed within 2 frames.
 
Last edited by a moderator:
OK, total noob time. Why is a dynarec faster? Would it take ages to compile on the GP2X every time you start up a game or does it store itself then as a "compiled optimized" version for running with each ROM?
Why can't you just post the C to someone with a faster computer and let them compile for you?
 
DanSolo posted on Feb 13 2007 at 10:49 PM said:
Why can't you just post the C to someone with a faster computer and let them compile for you?
I can answer this one. Developing is kind of interactive. There's an iterative cycle of compile, test, change, compile, test, change, etc. :)
 
Last edited by a moderator:
slaanesh posted on Feb 13 2007 at 12:58 PM said:
DanSolo posted on Feb 13 2007 at 10:49 PM said:
Why can't you just post the C to someone with a faster computer and let them compile for you?
I can answer this one. Developing is kind of interactive. There's an iterative cycle of compile, test, change, compile, test, change, etc. :)

Dammit, I should've remembered that from that last time I tried to compile... in 1984 on a 6502. I guess you need the speed at your fingertips.
 
Last edited by a moderator:
Just to elaborate...A dynarec is a method of generating "bytecode" on-the-fly, meaning during run-time. This bytecode is executed and cached. When a codeblock is requested again, the cache can be checked to see if it's already been translated and has the bytecode generated within it. If it has, it's instantly executed, saving time and generally being much faster. This is in comparison to an interpreter which everything is set during the compile, and during runtime everything must be translated every time. Imagine a counter doing "a = a + 1" and having to go through a lengthy interpreter code to extract that information just to repeatedly increment the variable "a" by 1. In a dynarec this would be done as if it were running natively in ARM by using the ARM instruction set and just incrementing that register by 1. Much faster. :)

Problem is, this dynarec is giving me a hard time. I suppose it's because I'm trying to wrap the MIPS dynarec instead of completely starting from scratch. What a pain. ;P

Time to talk to Exophase and see what we can work out. I'm so close though, it will get done.
 
zodttd posted on Feb 13 2007 at 02:51 PM said:
Problem is, this dynarec is giving me a hard time. I suppose it's because I'm trying to wrap the MIPS dynarec instead of completely starting from scratch. What a pain. ;P

Time to talk to Exophase and see what we can work out. I'm so close though, it will get done.

Thanks for all of the good work on this. Looking forward to this. Good luck.
 
Last edited by a moderator:
Yay! I got to speak with Exophase. It landed up that the version I was originally using for the dynarec was outdated. I am getting the updated version now. Things will work a lot better I'm thinking. :)

I will give a status update on the dynarec in a few hours. We might have something working that quickly. You never know with dynarecs, I'm due for getting lucky with one by now. Heh. :)

Since I already converted this dynarec to work with ARM, redo'ing it will be much easier. I have most of it done already to some extent.

YAY!
 
Back
Top