Anyways...im curious as to how its really possible, I know there are a few other conversions out there like Mario bros, but is the PCE really emulating anything ? I have used quite a few emulators before and I dont see how a 7.6mhz cpu can emulate a 1.6mhz one, on a PC emulating a 3mhz cpu can be rough on a 1ghz system. Also I wonder if its possible that some of the higher end games could be converted to PCE, such as Mario 3 and the like...
Figured some people might want to chew on this abit =p anyways it got the inner geek in me going.
PC emulation today is geared for extreme accuracy. Every little pixel flickering on a scanline (you know, like status windows and such), etc. My approach and goal is different, of course. As long as I can get the all the game logic to fit within frame (1/60 second) like it would on the real NES, then the gameplay is identical - minus any removal of slowdown. The PCE is running the original game/logic code at 7.16mhz. There's no emulation of the CPU itself since the PCE CPU is about 99.99% backwards compatible - as long as the game doesn't try to use illegal opcodes or the jump indirect bug of the original 6502. So that part is taken care of. While the video is completely different on the NES than the PCE, everything from format to regs to tilemaps layouts/etc, what they do have in common is they are both tile/tilemap and sprite based systems (although the format and sizes are different). So I can used the PCE's VDC (video display controller) for video acceleration. It also helps out a
TON that the PCE allows access to vram during active display and that the NES
does not. On a PC, you would do it pixel by pixel and in software - for accuracy. There are some mismatches like the NES having 8x8 sprites, but the PCE doesn't. It has 16x16 sprites. So I have to waste a whole 16x16 sprite to store this 8x8 NES sprite. This also means games like Megaman will have the
same sprite flicker/drop out as the original NES. If an NES game uses 8x16 sprite sizes, then flicker is reduced. Megaman doesn't, but Castlevania does and thus has reduced flicker. Anyway, I optimized the
hell out of the PCE video and audio emulation code. The only other optimization layer I could add would be self modifying code and it's not going to add much speed increase to what I already have. For sound, my audio emulation code isn't as complete as I would like it. Trying to emulate NES audio quirks and such is a pain and I haven't emulated everything about the NES audio hardware/regs either. It needs some work.
In reality, it would be better to hack the original game's routines for tilemap/tiles/sprites/audio to use PCE native format. But that would be a lot a work and fairly complex. Not that my method isn't complex, but it is like 95% directly reusable for other similar projects. I was able to get Castlevania, SMB, RoboWarrior up and running/playable in 6-8 hours by reusing code from Megaman. And, it's not like a hacker can't still replace the NES hardware routines with native PCE ones if they decided to 'upgrade' these PCE projects. PCE hardware is actually more straight forward than NES.