[geek] I want my two hours!

Sep 04, 2003 03:41

I've just blown a bit more than two hours on a stupid little issue with my emulator. I want them back!


By way of background, the Z80-like CPU in the Gameboy, like most CPUs, has instructions for enabling and disabling interrupts. They are EI and DI, respectively. Where things get funky is that EI doesn't immediatly re-enable interrupt processing, but it waits until the next instruction after the EI.
This problem reared its head in Bubble Bobble, of all games, by causing my emulator to segfault. After considerable digging and tracing, I stumbled on the fact that Bubble Bobble is extremely sensitive to timings in the Gameboy. As a result, it consumed so much time running its large interrupt routines (with interrupts disabled, of course) that by the time it completed them and reenabled interrupts, another interrupt was forced immediately.
I guess I'll will have to redo the sychronization stuff sooner, rather than later.
On the upside, I redid the memory read routine (which caused the segfault in the first place), and added a execution tracing facility.

Oh yeah, lest you think this emulator is a figment of my imagination, here's a screenshot: DragonWarrior running in Color GB mode

geek, emulation

Previous post Next post
Up