gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > Neo Geo Pocket emulation on gba?

#34180 - Cthulhu32 - Fri Jan 14, 2005 11:39 pm

Just curious to see if anyone else has thought about this. There are a few open source Neo Geo emulators that run NGP games full speed. I'd love to play some of my old school NGP games on my ds, so I was wondering if anyone else has worked on this before. If no one else has, I might have to start up the task of learning how to use a pre-made emulator to write one for the GBA hardware.

If I do wind up taking on this project, any suggestions?

I do have quite a bit of C/C++ background, I'm learning ASM this semester in college so this will help me a lot with that class.

Also if I do wind up taking on this project, I'll probably post some help wanted, but if anyone else wants to contribute please feel free.

-thanks

#34185 - Lord Graga - Sat Jan 15, 2005 2:41 am

I have had a faint idea about coding a NGPC emu, but I certainly ain't gonna do it within a suitable amount of years.

Yet, there is no such thing for GBA yet, but I would be happy to see a emu without sound running around fullspeed :)

#34270 - Cthulhu32 - Sun Jan 16, 2005 9:41 pm

well I wouldn't do this from scratch, I definitely don't know enough to make an emulator for the NGP from scratch, however NeoPop is an open source Neo Geo pocket emulator, and I'm sure the author wouldn't mind if I ported it over giving him plenty of credit. http://neopop.emuxhaven.net/ It runs Neo Geo pocket games full speed, so I can see what needs to be converted, and I can see what can be optimized/turned into ASM to make it run faster. If it turns out it runs mo-slow, it'll be a learning experience.

#34395 - Cthulhu32 - Tue Jan 18, 2005 11:54 pm

R&D so far:
well I've emailed the author of the Emulator to see his opinions (he has already given the OK to all programmers wanting to modify his code under the GNU license) and now I'm doing some R&D to make sure the GBA will be able to handle this thing. Here's my comparisons so far

Gameboy Advance vs Neo Geo Pocket Color

GBA
* CPU: Memory embedded 32-bit RISC CPU (CPU core design by ARM)
* SOUND:
Analogue 4 channel CGB compatible
Digital 2 DMA sound channels
* RESOLUTION: 240 x 160 pixels

NGPC
* CPU: 16-bit Toshiba TLCS900H (6.144MHZ)
* SOUND: Z80 sound processor (3.072MHZ)
* RESOLUTION: 160 x 152 pixels

the NeoPop emulator has a z80 emulator which I could look into optimizing for the gba so it runs it smoothly.

and now for a very important comparison, the RAM:

NGPC
RAM: 12KB for core processor, 4KB for Z80 processor
(slightly more powerful than a GBC, which is a plus if I'm going to get this thing running on the GBA smoothly)

GBA
Internal Memory

BIOS ROM 16 KBytes
Work RAM 288 KBytes (32K in-chip + 256K on-board)
VRAM 96 KBytes
OAM 1 KByte (128 OBJs 3x16bit, 32 OBJ-Rotation/Scalings 4x16bit)
Palette RAM 1 KByte (256 BG colors, 256 OBJ colors)

how are my numbers looking so far? I'm thinking this will be a very feasible project, the GBA's ram outnumbers the NGP significantly, so the Z80 emulator should run fine. The pixel ratios are great, the GBA can run it in its native resolution or I can write some code for full screen. The CPUs are different brands, but considering how slow the NGP cpu is compared to the GBA, the GBA should handle it no problem.

#34410 - sgeos - Wed Jan 19, 2005 3:14 am

Cthulhu32 wrote:
how are my numbers looking so far?

I think they look good.

Cthulhu32 wrote:
The pixel ratios are great, the GBA can run it in its native resolution or I can write some code for full screen.

You could use a rotation/scaling BG and stretch it out. I think that would be the easiest.

-Brendan

#34421 - tepples - Wed Jan 19, 2005 6:58 am

sgeos wrote:
Cthulhu32 wrote:
The pixel ratios are great, the GBA can run it in its native resolution or I can write some code for full screen.

You could use a rotation/scaling BG and stretch it out.

Whether that would be possible depends on the tiles. Let me go check.

Here are some basic specs. There are 48 palettes of 3 colors each, 16 for BG0, 16 for BG1, and 16 for sprites. Rot/scale backgrounds can't reuse the same tile with different palettes. I'd suggest running it in native res in mode 0.

In addition, because of 32 total BG palettes, the emulator would have to duplicate the BG tiles to use colors 1-3 and 5-7 of each 15-color GBA palette. Another doc tells me that the NGPC has 8 KB of VRAM for 2-bit-per-pixel tiles, just like the NES (but in a different 2bpp format similar to that of the Virtual Boy); it'd fit, even with the 2:1 expansion for GBA 4-bit tile format and the 2:1 expansion for 32 palettes.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#34516 - Cthulhu32 - Thu Jan 20, 2005 8:48 pm

well I pm'd FluBBa (the author of PocketNES, and all that goodness) and he said it'd be really hard to run a 16-bit cpu @ 6.33mhz and a 8-bit cpu @ 3mhz on a 16mhz cpu, unless I did video only. So here's the plan of attack: Get NGP emulator running w/ video only for now, leave the sound out of it until I have the emulator fully working, then possibly leave it up to other coders to help me out getting the z80 emulated quickly and efficiently. I can try the sound code myself, but it'll probably need some fixing up.
I also decided I'm going to work on the 2d shooter competition at pdroms, so hopefully by the time I finish both these projects my gba coding skills will be a hundred times better than they are now.

#34528 - Lord Graga - Thu Jan 20, 2005 11:55 pm

Cthulhu32 wrote:
well I pm'd FluBBa (the author of PocketNES, and all that goodness) and he said it'd be really hard to run a 16-bit cpu @ 6.33mhz and a 8-bit cpu @ 3mhz on a 16mhz cpu, unless I did video only. So here's the plan of attack: Get NGP emulator running w/ video only for now, leave the sound out of it until I have the emulator fully working, then possibly leave it up to other coders to help me out getting the z80 emulated quickly and efficiently. I can try the sound code myself, but it'll probably need some fixing up.
I also decided I'm going to work on the 2d shooter competition at pdroms, so hopefully by the time I finish both these projects my gba coding skills will be a hundred times better than they are now.


Excelent! Go for it!

#34529 - pyros - Fri Jan 21, 2005 12:23 am

Not sure about this, but it may be easyer to write a program to convert reo-geo roms into gba roms. That way much of the work is done by a PC before-hand.

Also check the rom/ram read/write speeds for each system.

#34530 - sajiimori - Fri Jan 21, 2005 12:35 am

Pyros, no offense, but it's pretty clear that you've never written an emulator.

(I haven't either, but then again I don't try to give advice about writing them.)

#34552 - XeroxBoy - Fri Jan 21, 2005 8:04 am

Pyros is describing an emulation technique called static recompilation. Easier? No, probably not. It is quite a bit faster, though. However, there are several problems with it, such as its inability to handle self-modifying code.

The only emulator I know of (off of the top of my head) that used static recompilation was the now discontinued N64 emulator Corn.

#34557 - bertsnks - Fri Jan 21, 2005 12:05 pm

If I would write a CPU emulator, I would use a combination of both opcode recompilation and opcode emulation.

Some things are impossible to recompile to native GBA instructions, however, most of the Neo Geo arithmetic operations could easily be recompiled to GBA code.