It is currently Mon Oct 23, 2017 9:14 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Sun Sep 03, 2017 11:18 pm 
Offline
User avatar

Joined: Thu Oct 21, 2004 4:02 pm
Posts: 210
Location: San Diego
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.


Top
 Profile  
 
PostPosted: Mon Sep 04, 2017 6:16 am 
Offline
User avatar

Joined: Sun Sep 19, 2004 10:59 pm
Posts: 1390
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.

_________________
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.


Top
 Profile  
 
PostPosted: Mon Sep 04, 2017 7:51 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19122
Location: NE Indiana, USA (NTSC)
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.


Top
 Profile  
 
PostPosted: Mon Sep 04, 2017 10:05 am 
Offline
User avatar

Joined: Thu Oct 21, 2004 4:02 pm
Posts: 210
Location: San Diego
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group