RedditPP Mascot

RedditPP

r/EmuDev • … • u/thommyh

ANNOUNCE: 65816 test cases

Inspired by u/Ashamed-Subject-8573's recent work and [blog posts](raddad772.github.io), I've added a bunch of 65816 tests to [this collection](https://github.com/TomHarte/ProcessorTests). Specifically:

For each combination of opcode and emulation mode flag, 10,000 randomly-generated tests are present. Each test is a randomised start state plus randomised memory contents, followed by a single instruction execution; end state and all bus transactions between are captured and recorded.

Tests are provided in JSON format.

A complete documentation is provided in the repository, but a sample test is:

{ "name": "f7 n 9937", "initial": { "pc": 30709, "s": 31989, "p": 129, "a": 31265, "x": 40956, "y": 25203, "dbr": 96, "d": 41475, "pbr": 55, "e": 0, "ram": [ [41595, 117], [7757522, 208], [41594, 252], [7757521, 20], [41593, 94], [3635190, 118], [3635189, 247] ] }, "final": { "pc": 30711, "s": 31989, "p": 192, "a": 43533, "x": 40956, "y": 25203, "dbr": 96, "d": 41475, "pbr": 55, "e": 0, "ram": [ [41595, 117], [7757522, 208], [41594, 252], [7757521, 20], [41593, 94], [3635190, 118], [3635189, 247] ] }, "cycles": [ [3635189, 247, "dp-r----"], [3635190, 118, "-p-r----"], [3635191, 255, "---r----"], [41593, 94, "d--r----"], [41594, 252, "d--r----"], [41595, 117, "d--r----"], [7757521, 20, "d--r----"], [7757522, 208, "d--r----"] ] }

So `initial` and `final` are objects containing the processor's internal state plus all touched RAM contents, and `cycles` is a breakdown of bus activity in the form `address`, `value`, `active control lines`. The final of those are fully documented in the repository but e.g. `dp-r----` tells you that both `VDA` and `VPA` were active and that `RWB` signalled a read, i.e. that was an opcode fetch.

A closing plea:

These tests have been generated using a 'known good' emulation, i.e. one that passes all other existing tests, has been used successfully in an emulator, and — I intend — matches all other documentation I could locate.

But 65816 tests are thin on the ground, so if anybody else has implemented the 65816 and is able to validate these tests, _please do so_ and raise appropriate Github issues or pull requests as relevant.

The objective here is to provide a resource for future emulator development, so I'll be grateful for as much additional input as I can get.

— 0