What I’ve been working on
Right now, the emulator emulates both CPUs on a single thread. First it emulates the ARM9 CPU for a while, then emulates the ARM9（把这里可能是笔误，因为NDS是ARM9+ARM7) CPU for a while. The problem is that switching between emulating the two is extremely slow, since I basically have to flush all the registers into memory and then reload them. I’ve been trying to emulate the CPUs on separate threads, but right now, there’s two problems. Syncing the threads is way too slow. On the interpreter, which I’m using since it’s much easier to debug, multithreading basically gives no performance improvement. I’m pretty sure this is caused by a bug in my code, since there’s literally no possible way to write this faster. I’m using a spinlock, and using a bigger time slice causes certain images on the screen to flash, since the graphics hardware isn’t being update enough. The other problem is that exophase’s dynarec isn’t exactly built for multiple threads. Each thread needs its own separate copy of each data structure, but the dynarec has global variables everywhere. I’m thinking of literally copy-pasting the code. So basically, if you didn’t understand any of that, I’ve been rewriting a lot of code, and at least, in theory, it should give a big speed boost.