Is it too late to chuck this in the mix?
(I only stumbled across this forum yesterday)
Why not do the easy thing?
You have CP/M running.
There are many programs that allowed one CP/M computer to talk to another computer and transfer files
file transfer protocols
Kermit
XMODEM,YMODEM, ZMODEM
Some of these are built in to a PC terminal program
TeraTerm is one of many for PC side
It should be easy enough to understand. Think about it some more and consider what it would take to feed the Z80 a known sequence of opcodes and data bytes in place of what would normally come from the external memories. If you want to use a smaller ATmega, it needs a couple of shift registers so it can do the Z80 data bus interface via SPI, to save pins, it doesn't hook up to the address bus but does need several control signals and some of them have to be intercepted - do that with analog switches to minimise the propagation delay when the hardware bootstrap/debugger is not in control - and some glue logic to handle some control signals that are too fast for the Atmega to handle in code.
My explanation of how you can make the ATmega bootstrap the Z80 is really not that tricky, and doesn't need a deep knowledge of the bus timings - or at least no more so than you need to build a Z80 system that's more complex than a minimal one in the first place. The idea of a zero CPU resources hardware debugger is however a lot more complex so I quite understand your reluctance to start down that road at thios stage. Its something you could retrofit later by adding a daughterboard carrying the hardware bootstrap/debugger between the Z80 and its socket. Adding mounting holes to permit such a daughterboard to be secured with PCB standoffs would future-proof your design.
However if you aten't going to have a hardware bootstrap of any sort, then you are up s--t creek if the boot block in the FLASH chip gets corrupted.
If you want to avoid having to pull the FLASH chip to put in your programmer, I strongly recommend writing a monitor ROM that can cold-boot the machine, and can also receive data in IntelHEX format and store it to RAM. Burn it to EPROM and provide a socket for it on your memory board. You'll also need a SPDT switch to select between routing the ROM chip select to the FLASH or the EPROM, while the non-selected one is held inactive by a pullup on its /CS pin.
Then if you brick the FLASH bootblock, you can switch to the monitor ROM, restart anduse it to load an IntelHEX downloader + FLASH writer utility into RAM and run it, then flip the switch back to select the FLASH before sending it the FLASH image to be programmed.
You are working on CP/M BIOS. One small function is write sector or block. You will be reading/writing blocks of ram. Small change to have a Ram disk. An it's a second small change to have a ROM disk.
You can have CP/M use part of chip and have your bios capable of writing any area of chip.
When you can read/write blocks of a rom/ram you can then use CP/M format command to create a working disk.
With good foundation steps it becomes easer to expand.
You cant wire the switch as you have drawn as the LED will prevent the level going low enough for a valid logic 0. Move the logic takeoff point to the LED cathode and a 4K7 resistor across the LED to fix it.
How about using the HD64180 ?. it already has an MMU giving access to 512K of memory plus other facilities. It was marketed as a "Super Z80" and sold by Zilog as the Z180. You can still find them : https://www.ebay.com/itm/Hitachi-64180-Kits-HD64180-MPU-TC551001-128K-SRAM-W27C020-EEPROM-DIP32-/161337103516
An example of its use is at https://www-users.cs.york.ac.uk/~pcc/Circuits/64180/doc.html
Ken
You have all the answers you need to answer your question from Ian.M's post.
Now go a step further and change how switch is connected.
Wire the switch with C1 connected to ground.
If you understand Ian.M's post, this is a small change.
Now what happens when connection to U4 pin B gets disconnected or switch fails?
Do not make it hard, take simple steps from first drawing to improversion of last drawing.
Start here in post
You cant wire the switch as you have drawn as the LED will prevent the level going low enough for a valid logic 0. Move the logic takeoff point to the LED cathode and a 4K7 resistor across the LED to fix it.You should know answers to my above questions if you go step by step changing circuit as lan.M suggests.
Understanding now will save you time later.
Now continue reading lan.M's post.
It's probably entirely wrong but, if it's not, how does the LED not light up when the switch is open? Surely it's earthed via U4:B? And what is the purpose of the 4K7 resistor in parallel with the LED?
Surely it's earthed via U4:B? And what is the purpose of the 4K7 resistor in parallel with the LED?
Thanks Ken - but the reason I haven't gone for a more modern processor / microcontroller is because it defeats the purpose of doing all this in the first place - to build something similar in capability to my first ever computer, and maybe learn something about electronics at the same time.