On Jun 23, 7:49 am, LouisB <[email protected]> wrote: > fadden, thanks for taking a looksy into the emulator. Great ideas for > optimization BTW. I've been looking at your ideas plus this document > (http://slack.net/~ant/nes-emu/6502.html) and wondering how much mhz I > can squeeze out of her.
Interesting article, though some of the advice is C-specific. It did inspire one thought: have your instruction fetch call return the next 2 bytes. That way you're doing one method call and $C000 range check for every two bytes, instead of one per byte. If the address is in the I/O range, call over to the generic get-byte-from- memory function. You'd end up with slower execution (or duplicated code) for handling the bank-switched ROM area though. Interpreter loops do tend to be massive switch statements though. See, for example, dalvik/vm/mterp/out/InterpC-portstd.c. :-) > Mhz is calculated by counting clock cycles per loop. Is that available for display anywhere? I saw a single-digit integer fps counter in the top left but that's all. > Might be pessimistic, but I'm thinking the G1 hardware is just too > slow. It's at 1/3 mhz right now, and even if I squeeze another 1/3rd > out I'm still at .66Mhz. The last 1/3 would probably be more trouble > than the time is worth (or impossible.) I'm leaning heavily towards > waiting for the hardware to catch up. The combination of G1 hardware and interpreted bytecode is probably insufficient. You're on a mobile device emulating a Dalvik machine emulating a 6502. A JIT will help, but only if it aggressively inlines methods -- you're losing a lot to method call overhead. Considering the RAM and CPU cache limitations, inlining more than basic setters and getters is questionable. > Do you know anything about the NDK? Would it allow me to do C > language type operations to speed this up? i.e. get the JVM out of > the way and go straight to the cpu / memory? This is the sort of thing that the NDK should work well for -- raw computation independent of the Android APIs. It's not yet available, but there's some discussion on the android-ndk mailing list. > > BTW, at some point you'll want to add support for a virtual keyboard. > > Not all devices have physical keyboards, which makes it tough to get > > things going. > > True - I could use the built in one correct? Yup. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

