Friday, January 5, 2018

Fixing various niggly problems

So, nothing hugely exciting to see here, but important progress on a number of fronts that have been causing niggly problems.

First, the cartridge port clock is now correctly and accurately at 8MHz for the dotclock and 1MHz for the CPU clock.  It was variously about half that previously due to various little bugs.

Second, the mapping of several register blocks had some subtle, and not so subtle bugs preventing their access. This has now been fixed.

Third, in trying to track down the IO address collision bugs, I have moved just about every IO device that was not using a chip-select line to use one.

Fourth, the Nexys4DDR boards thought that they always had an 8KB cartridge plugged in if switch 8 was not set.  This was a debug thing I put in when getting the cartridge interface to work some time ago, and of course then promptly forgot about, resulting in a few hours of lost time trying to figure out why on earth I was seeing 30719 BYTES FREE, but no actual data in the mapped cartridge.

Fifth, in making the ethernet controller use a chip-select line, I stripped out all of the half-baked RR-NET emulation code, as it was seriously complicating the ethernet controller addressing. I suspect that this might well have been the source of the IO address collisions.  Also, the RR-NET sits at $DE00, which now that we have a real cartridge port, causes even more problems, as we have to be able to work out which $DE00 to look at.  If anyone desperately needs an RR-NET based ethernet instead of using the internal 100mbit ethernet of the MEGA65, they can just plug a cartridge with it in.  The MEGA65 ethernet controller is much simpler to use, with a memory-mapped TX and RX buffer, and no bizarre 16-bit access semantics for the registers.  I expect that over time software that uses ethernet will be patched to use the MEGA65 native ethernet in most cases.  Binary patching will be possible because of the simpler interface allowing for smaller code, and there are not that many programs that use RR-NET ethernet, in any case.  Is this a perfect solution? No, but it is a reasonable trade-off.


Sixth, sprite vertical-expansion has been fixed, so the players in International Soccer have returned to their full stature.  There are still some remaining display glitches with sprites that are on my list to tackle in the next couple of days.  But here is international soccer looking like it should: