The "hidden" register of the Z80, commonly known as MEMPTR, has been documented for many years, but we've never implemented it in Fuse, nominally because of the overhead of doing so and the (very) limited again. However, as even a $5 Raspberry Pi can run Fuse these days without so much as breaking sweat, it's probably time to implement it.
If anyone strongly thinks this is the wrong decision, please shout.
Work proceeding in the feature-106-memptr branch.
Right, implementation is pretty much done on this one. The most important thing is that we don't regress anything, but I'm not entirely sure of the best way to test that. I tried to be careful when I was updating the Z80 test suite that no observable behaviour was changed (other than BIT n,(HL)), but could have made a mistake somewhere. Any thoughts welcome...
The good news here is that we now match the expected results for running zexall, whereas master failed on the test containing BIT n,(HL).
And even better, we pass all the MEMPTR tests in Patrik Rak's test suite, so I'm now pretty confident on this one. Any objections if I merge?
Hi Phil,
I'm on holiday and haven't had a chance to look and am also struggling to log onto sourceforge to comment on the issue, but I'm happy for the merge to go ahead.
The only other test that comes to mind would be something like reworking Sergio's RZX regression scripts to check before and after behaviour of Fuse doesn't have any significant regressions.
I think there is also a game that depends on MEMPTR to work properly?
Thanks,
Fred
Related
Feature Requests:
#106Nothing released in the commercial days of the Spectrum depends on MEMPTR. One of the reasons I didn't worry about it until now ;-)
Somebody did write a snake game (I think) in the past few years which depends on MEMPTR, but that was more as a "ha ha I can break emulators" rather than an honest attempt at a game. Patrik's tests are probably much better at actually testing we've done things right - as we pass all of ZEXALL and Patrik's tests (apart from SCF/CCF which is a different issue), I'm happy I haven't regressed anything.
The implementation also pass Woody's tests:
http://web.archive.org/web/20160411222144/http://homepage.ntlworld.com/mark.woodmass/z80tests.tap
Do you mind adding MEMPTR support for SZX snapshots?
Will do - hopefully Wednesday evening.
Well, that was easier than I thought as I'd forgotten we already had MEMPTR support in libspectrum. Thanks Fred :-)
One last bit I realised that needs to be done: expose MEMPTR to the debugger.
And done - as either z80:memptr or z80:wz as the register is sometimes referred to as "WZ". Think this one is probably ready to merge now.
And merged. Please report any problems!