Jump to content
IGNORED

looking for CPU diagnostic routines


pnr

Recommended Posts

For testing a CPU core, I'm looking for diagnostic routines that test the functionality of a 9900 CPU.

 

Maybe this was developed for one of the emulators? Or were those debugged by just throwing a lot of programs at them and fixing bugs where they did not execute as expected?

 

All suggestions welcome.

 

Link to comment
Share on other sites

For MAME I did not use a formal test method. As you suspected, I let it converge against the ideal behavior, with the hope that errors cannot hide too long until they show up somewhere.

 

This bit me twice:

  • In Microsurgeon, the game was over right after the start. It turned out that the Subtract instruction failed to set the Carry bit when subtracting 0, something I did not expect (subtract means to add the complement, and it actually adds the one's complement of 0 (=FFFF) and fixes the result by adding 1).
  • In a TMS9995-based arcade game, the timing was completely wrong. This was because I implemented the decrementer to subtract 1 every clock pulse, but it is only every four clock pulses.

In hindsight, I could have made good use of such a program.

Link to comment
Share on other sites

Thanks for pointing out those gotcha's!

 

The subtraction thing is a clever implementation trick, I think I will try that in the core. The ALU already needs to support "A and not B" for instructions like COC and SZC, so must have complemented B available anyway. Doing subtract as "A + not B + 1", where the "+ 1" is done by setting 'carry in' to one, means that the ALU only needs to implement an adder and not a subtractor as well.

 

The MDEX operating system ("CP/M for the Marinchip M9900") has a program "BRAINS" that does a memory and a CPU check. However, I only have the executable, not the source. I'm not sure how thorough it is, it may only check for some common failure cases (e.g. CRU drivers fried).

Link to comment
Share on other sites

Classic99 ran for many years with such bugs hidden in the CPU core too... some patterns are just not commonly used. :)

 

I did write a simple CPU test program - it's in the Classic99 archive. It tests a couple of points on each instruction but is not at all comprehensive. It still found a couple of issues in my early development and was verified against hardware.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...