GB Emulator - Issues with cpu_instrs

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
GB Emulator - Issues with cpu_instrs
by on (#227195)
Hi there! I've been working on my own Game Boy emulator for a while now (I made a post several months ago on here, but much progress has been made since).

Recently I've added MBC1 support so I can test the main cpu_instrs.gb test ROM.
It seems to run fine until it starts actually testing.

This is the output:
Code:
cpu_instrs

01:05

Failed 1 tests.


So obviously, it's failing the first test, and the fifth sub-test. I checked the ASM of the fifth sub-test, and verified that all of the instructions are implemented correctly.
The bad instruction is most likely not in the test routine itself, but before it even gets there. My question is, how would I debug this? I really don't feel like using a working emulator and stepping over every line until they change. That would take forever.

Thanks!
Re: GB Emulator - Issues with cpu_instrs
by on (#227441)
I find the fastest way to do this is to log all executing instructions to a text file and then just compare against a log from a working emulator. If your emulator can't already do this I strongly suggest it as it has saved me countless hours.