Well, I've been quite enjoying working on this emulator.
One thing nagging at me while doing so was, "how do I test this thing?" Doing a complete implementation and then loading a game into it hoping it would work would just be ridiculous.
It took a fair bit of Googling, braving asking a question on the now toxic Stack Overflow (no joy) and some more Googling to find something useful.
I came across JSMoo on GitHub. A JavaScript/AssemblyScript multiple machine emulator. Specifically, this part of the project was going to prove extremely useful to me. It is a lot of JSON files (~1,600) each containing multiple tests. Each file targets a specific instruction. The test provides a starting machine state and an expected machine state once the instruction(s) have been executed.
Perfect.
So, at this point I have implemented 175 instructions in my Z80 processor class. When I first found this test suite, about 20% of them failed the given tests. Imagine not having these tests and trying to track down what is wrong when attempting to run something on the emulator! Virtually impossible I reckon.
Anyway, at the time of writing this, all instructions pass all the tests thrown at them. I'm looking forward to getting everything implemented and see if I can get a booting 48K Speccy running.
I've also implemented a test runner that will output debug information for failing tests.
And if there are differences in expected RAM contents...
Which is pretty handy.
Here is the result of running the test suite at the moment.
GitHub repository is here.
