Hi I've got a very weird issue with blargg's instr_tests. When I run both the all_instrs.nes and official_only.nes files my emulator reports that all tests passed, however when I run the individual tests they fail. The individual tests that fail 03-09, all others pass fine.
Is this an issue with my implementation of opcodes, addressing modes (both?) or possibly a broken MMC1 implementation since the catch all tests require that to be implemented? I should also note that in the individual tests, the opcodes which fail vary each time but there are some recurring failures.
Also nestest reports that I pass all official opcodes, but I fail on SRE (ecH)
Download link for the test ROMs, please? I'd like to test them here.
http://wiki.nesdev.com/w/index.php/Emulator_tests I'm using the ones named instr_test on this page.
Are there logs anywhere for the output of each individual test? That would be quite useful.
I don't like to download individual files from github. The original package is much welcome.
Hmm... my emulator doesn't support unofficial opcodes. So, most of those individual tests fail due to an UO found.
Zepper wrote:
I don't like to download individual files from github.
There's a "Download ZIP" button on the right you can use to get the whole thing.
tokumaru wrote:
Zepper wrote:
I don't like to download individual files from github.
There's a "Download ZIP" button on the right you can use to get the whole thing.
There's also git, which is what you're supposed to use.
Code:
git clone -b master git://github.com/christopherpow/nes-test-roms
will download and make a directory of all files. To update it, put a shell script in the root directory called "Update" with the same command in it, to automate pulling any updates. Easy as anything, especially if you run Linux, you probably have git installed already. If not, it's one install command away.
The download buttom is all. Thanks for the tip. Guess I was blind somehow...
Hm, I fixed a silly bug with reading an address (adding X instead of Y) and that's fixed most bugs (some unofficial still fail) except the indexed address tests still fail for every opcode so theres a problem here I don't see somehow.
Well, what does your indexed code do?
For indexed X (Indexed Indirect), it fetches a byte at the program counter then adds X and wraps if it's bigger than FF. After it fetches a word at the address and returns it.
For indexed Y (Indirect Indexed), it fetches a byte at the program counter then fetches a word at the address and adds Y to it, then it wraps it if it's greater than FFFF and returns it.
Your description of the (d,x) and (d),y modes (as I call them because the "indirect indexed" terminology becomes tiring to read) appears correct. But are you wrapping pages within the "fetches a word at the address" step?
$0000: C0
$00FF: E0
$0100: 00
Y = $40
LDA ($FF),Y will read the low byte from $FF and the high byte from $00 (wrapping within zero page). This gives $C0E0 as the base, not $00E0. Then it adds $40, producing $C120.
Wrapping within a page happens for these:
JMP (a)
LDA (d,x) and other instructions using this mode
LDA (d),y
Have you tried comparing a log of the tests run in your emulator to a log from Nintendulator? I'd encourage you to add a feature to produce a log of (PC, cycles, A, X, Y, P, S) for comparison later.
I was not doing that, how silly of me, I suppose I need to pay more attention. Thanks very much for pointing that out. I do have the output set up like that but I wasn't saving it to a log or properly comparing it with nestest so I didn't catch this. I should be more thorough...
A possible silly question, how do I know when to stop the nes program that is currently running? Once the test says that all tests passed, presumably I'm supposed to do something to halt execution.
The NES defines no way for a program to "finish" executing, other than either executing an
unofficial STP opcode or disabling IRQ and NMI and entering an infinite loop. You'd have to either store how many frames each test takes or use some sort of heuristic to determine whether a particular test has finished writing output to whatever output method it uses, such as $2007 or $6000-$7FFF. I seem to remember that one series of tests will write a NUL terminator (zero byte) to finalize a C string in $6000-$7FFF.
Ok, thanks for all your help.