6502 Instruction Timing Tests
Moderator: Moderators
6502 Instruction Timing Tests
This iNES file tests 6502 instruction timing for all documented instructions except branches, both with and without a page crossing. It also tests some of the undocumented NOP instructions, but no others. If it finds a problem, it prints the opcode and the number of clocks it timed along with the correct timing. It's a bit complex so post if you encounter any odd problems. No source code yet.
cpu_timing_test.zip
cpu_timing_test.zip
Just how long does this take to run? I get the text "6502 TIMING TEST (12 SECONDS)" for a split second followed by a solid black screen for about 12 seconds, then the screen flashes white and turns blue-violet (and then flashes white every so often).
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
P.S. If you don't get this note, let me know and I'll write you another.
I'm not sure what's happening on your end. I made a few changes to the text console initialization in the version below, but I'm not seeing what could be happening. What kind of hardware are you running it on?
cpu_timing_test2.nes
cpu_timing_test2.nes
-
mattmatteh
- Posts: 345
- Joined: Fri Jul 29, 2005 3:40 pm
- Location: near chicago
-
mattmatteh
- Posts: 345
- Joined: Fri Jul 29, 2005 3:40 pm
- Location: near chicago
Evidently, that ROM does something screwy that my emulator doesn't like; exactly what is going on, I have no idea. Naturally, it works fine on my CopyNES's RAM cart.
If anybody's interested, a partial CPU log can be found at http://qmt.ath.cx/~nes/cputiming.zip
If anybody's interested, a partial CPU log can be found at http://qmt.ath.cx/~nes/cputiming.zip
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
P.S. If you don't get this note, let me know and I'll write you another.
-
mattmatteh
- Posts: 345
- Joined: Fri Jul 29, 2005 3:40 pm
- Location: near chicago
Here's the (somewhat unpolished) main source, in case it helps: cpu_timing_test.asm The main obscure thing I'm doing is filling the stack with the value $02 to allow thousands of repeated RTS and RTI in those tests, without having to keep refilling the stack. The test loop is copied to $200-$210 or so. RTS should return to $203, and RTI to $202 (the loops are adjusted accordingly). This will require proper stack wrap-around, for one.
mattmatteh, not sure why your emulator is failing. The SED instruction should add two clocks to execution time and set the D flag. The D flag has no effect other than it being remembered; the NES 6502 does not have a decimal mode. I can't imagine why not setting that flag would affect anything timing related. I've found Nestress to be useless as a test since it reports errors for some things when they are working correctly. I recommend Kevtris' NESTEST for a thorough CPU test.
mattmatteh, not sure why your emulator is failing. The SED instruction should add two clocks to execution time and set the D flag. The D flag has no effect other than it being remembered; the NES 6502 does not have a decimal mode. I can't imagine why not setting that flag would affect anything timing related. I've found Nestress to be useless as a test since it reports errors for some things when they are working correctly. I recommend Kevtris' NESTEST for a thorough CPU test.
-
mattmatteh
- Posts: 345
- Joined: Fri Jul 29, 2005 3:40 pm
- Location: near chicago
i just noticed that your first version gives failed op f8 unknown error, and the second gives unknown error f8.
i looked at your source and if i read that right, there are 4 locations that jump to error. is that the code where it would cause fail ? perhaps you could separate those errors ?
thanks
matt
i looked at your source and if i read that right, there are 4 locations that jump to error. is that the code where it would cause fail ? perhaps you could separate those errors ?
thanks
matt
mattmatteh, try this and post the 16-bit hex value it prints at the end of the unknown error report:
cpu_timing_test3.asm
cpu_timing_test3.asm
-
mattmatteh
- Posts: 345
- Joined: Fri Jul 29, 2005 3:40 pm
- Location: near chicago
mattmatteh, looks like a CPU error that NESTEST isn't catching. The timing for $F8 is correct, but it's failing in the comparison routine that has a bunch of SBCs in it. Hmmm, could it be that you're supporting 6502's decimal mode?!? The NES does not have that mode; it ignores the D flag. That would explain why it worked when you disabled the flag_d = 1 code! Sounds like your problem. Argh, I guess NESTEST isn't bulletproof after all. :)
The file is BZIP2-compressed - 7-ZIP should be able to extract it properly, and I'd be surprised if WinRAR or WinZip were unable to do the same.mattmatteh wrote:i tried to unzip your file Quietust and it failed:
skipping: cpu_timing_test2-1.20060915_005436.debug need PK compat. v4.6 (can do v2.1)
how are you zipping that ?
matt
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
P.S. If you don't get this note, let me know and I'll write you another.
-
Muchaserres
- Posts: 96
- Joined: Sat Nov 13, 2004 6:25 am