nestest question - DCP Illegal opcode
Page 1 of 1

Author:  teaguecl [ Sun Sep 03, 2017 11:18 pm ]
Post subject:  nestest question - DCP Illegal opcode

I'm having a tough time running nestest. If I just load it and run, it reports all OK on both sets of tests. However, if I force it to start at $C000 as the documentation indicates for automation - it crashes with an illegal opcode 0x32. I tried running it in Nintendulator and forcing it to start at $C000 using the debugger and it spits out lots of errors, and eventually halts the cpu. Has anyone else had that problem?

Any advice on why running nestest from C000 doesn't seem to work on Nintendulator? I also ran it on Nestopia with weird results. It beeped once (I assume that's the success indicator) but didn't show anything on the screen (which is probably normal?). However, it then hung and had to be force killed.

Author:  Quietust [ Mon Sep 04, 2017 6:16 am ]
Post subject:  Re: nestest question - DCP Illegal opcode

If you run nestest by starting at $C000, it crashes at the end by underflowing the stack - for whatever reason, it ends with an (unmatched) RTS instruction rather than an infinite loop.

Author:  tepples [ Mon Sep 04, 2017 7:51 am ]
Post subject:  Re: nestest question - DCP Illegal opcode

When called as a subroutine (JSR $C000), nestest needs a bit of setup first:

  1. The stack pointer needs to be set to a reasonable value (e.g. $F0-$FF).
    Otherwise, you may experience undefined behavior during the stack test.
  2. The emulator needs to detect when the test has completed, by either loading a special return address onto the stack before jumping to $C000 or comparing the stack pointer after each instruction.
    Otherwise, you will experience undefined behavior once the test completes and underflows the stack, as Quietust mentioned.
  3. To run the last third of the test, the emulator needs to support the most predictable unofficial opcodes.
    Otherwise, you will experience undefined behavior once that portion of the test begins.

Author:  teaguecl [ Mon Sep 04, 2017 10:05 am ]
Post subject:  Re: nestest question - DCP Illegal opcode

Thank you so much for the assistance. To stop nestest when it's done I simply put a breakpoint at C66E which seems to work fine. I am still seeing behavior that I can't understand - maybe I'm not using the test rom correctly?
My emulator currently does not support opcode 0xE7 (ISB/ISC) and it will crash if it tries to execute one. Not surprisingly, when I run nestest in automation (starting from 0xC000) my emulator crashes on opcode E7. However, if I run nestest normally it runs fine and reports OK for everything. Specifically I select "Run all tests" from the main screen and get all OK. Then I press SELECT to get to the "Invalid Ops!" menu and again select "Run all tests" which tells me all those are OK. It never executes an opcode E7 during either suite of tests.

Am I missing something, or does nestest do a different set of tests when run from C000 than can be done manually? If so, that is definitely not mentioned in it's documentation.

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group