You can view the full emulator here: http://www.grantgalitz.org/gameboy/
It's all on github: https://github.com/grantgalitz/GameBoy-Online
And a few other ROMS are available for play now:
In essence, you accumulate instructions in basic blocks and turn them into functions, which are then 'executed' (meaning turned into function objects) and then cached. In your case it becomes a little more complex as you do cycle timing, interrupts, etc, but there's no reason you can't bake this into your basic block functions. This drastically increases the performance of CPU emulation, while maintaining the same high quality.
If you're interested in doing this and/or have any questions, feel free to contact me.
P.S.: Here's another game - http://www.grantgalitz.org/SuperMarioLand2/
So, in effect what you do is take your code from `GameBoyCore.prototype.executeIteration' and roll that into your dynarec'd function on a per-instruction basis. The simpler you can make it, the better for performance; you have the benefit of knowing how long each instruction will take to execute at dynarec-time, so you can do some fun optimizations there.
Dynarec'ing cycle-accurate code is hard, but it's a lot of fun and damn efficient if you get it right.
And you if you had wanted them shorter just remove everything after the id field.
grantg, if you're just trying to show off an emulator but aren't ready to be the example, may I suggest finding a free Gameboy game to show off instead? I know there are actually-free games for many other consoles, I presume there are for the gameboy as well.
Don't try to emulate their latest or one-to-latest console though.
I put up a freeware ROM test page - http://www.grantgalitz.org/gbc_demo/
Also, the source code:
Give it a go!
It's a webkit/safari build with web audio in it, so audio is perfect as hell in it. :)
And for firefox, just get firefox 4 (god no, not 3.6!).
I've run into this bug before, it seems to be a bug with the GC possibly in V8.
Edit: Firefox 4 on linux has a GC issue, not my fault.
Too bad webkit browsers don't allow to turn off image smoothing like Firefox does, which makes true pixel art impossible. I'd love to see support for nearest-neighbor resampling included in the future versions of Chrome/Safari.
See -moz-crisp-edges @ https://developer.mozilla.org/en/css/image-rendering
I still want you kids off my lawn, though.
I took it down because the others posting about potential problems are right, so in order to use the emulator go to http://www.grantgalitz.org/gameboy/ and load in your OWN ROM files. Before I was providing the for you, but due to legalities, I am forcing you to provide your own. I didn't get a takedown notice, but I definitely don't want to get one, sorry for the inconvenience. :P