So next, wire in the Z80,...
Got that done today, have just been debugging the connection with a little spare time. Started out oddly - clearly a bad connection for bit 1 on the data bus, fixed that now but am still not getting 100% results.
I'm using two methods to read and set the contents of the GPU RAM from the Microcom - the
PEEK direct command in my monitor program (DMI) and
MEMX, a memory viewer/editor program in the DMI. I'm trying to set contents using the
POKE direct command.
Here's the output from MEMX when viewing the first page of the GPU RAM (a 16KB bank of the GPU's memory window mapped to $C000), compared with the (simultaneous) output from the RS232_debugger viewing the same page:
MEMX:
RS232_debug:
As you can see, there are some errors in the MEMX output (addresses $C01C, $C01E, $C02C are the first). Looks like a timing issue getting data out from the GPU to the Z80?
Writing the GPU RAM using POKE seems to be fine for the most part, unless I try to perform a block write - I have another command that sets a block of RAM to a user-specified value (it uses
LDIR iirc - one of the Z80's block data-shifting commands) - that completely fails - doesn't change anything according to the RS232_debugger, but returns all zeros (or whatever value was written) on the Microcom.
Going to dig out the Z80 manual and see what it says around the memory RD/WR cycles. I'm wondering if I need to keep the data valid on the data bus for a short while AFTER the end of the memory cycle, but I'm pretty sure the Z80 doesn't require the data to be held after RD goes high...
Sometimes PEEK returns the correct value, sometimes it just returns $FF and the data returned using MEMX changes each time I view the page (well, the errors change in terms of value and location).