Im building an 8bit MCU based on a Z80.
Presently (Version1) I am planing on my lower 32K of address space to be mapped to an MCU. The upper 32K I will map to an SRAM chip.
The MCU will have all 16 address lines. It will also have the memory control lines such as "MREQ denoting the address bus is stable" and "RD" output for signalling the data bus is stable. Plus the clock... which I haven't even considered yet.
However. The idea is for the MCU to trigger an event handler when MREQ 'goes' low AND clock (matches the timing diagrams).
The first thing it will do is check the MSB bit.
If the MSB is 1 we exit the handler with no action. *
If it is 0, the request is for "US" so we pull the WAIT line to signal "we got it, hang on"
The MCU code can then lazily shift the 15 LSBs to create an index into a big-old-array in FlashROM and then lazily shift the 8 bit contents back out onto the dataline GPIOs. Finally it can release the WAIT and PULL the "RD" on the correct clock edge. **
There is another signal, maybe just a clock edge when we can release everything and go back to floating on all pins.
As for the physical RAM chip, the address lines are fine. Memory chips are cheap when you are looking for 16 bit address and 8 bit data. So I don't care if I have 64K or RAM and only half addressable.
The only undecided part is how to 'gate' the data bus based off of the MSB address line. Such that if that line is low, the physical RAM chip does not receive the MREQ and does not energise the data bus. Can I avoid a whole bus transceiver. Considering this is only the memory sharing on the databus, later comes the I/O peripherals sharing the databus too. I expect some creativity and a small peppering of LS74 series logic gates will be in order.
In terms of performance. With careful C or maybe even inline ASM an ESP32 or other MCU should easily be able to meet timings. If it doesn't get a response in a single clock cycle it's still fine. The Z80 supports slow DRAM, so it will wait at least a couple of cycles.
The Z80 I have is capable of 20Mhz. "Capable", but as V1 is likely to be breadboarded, also "unlikely". It's more likely to be running at 300kHz minima. I might even let the MCU do the clock, makes me eye STM32 again though as it would just be a matter of configuring the clock matrix and assign it to a pin. That makes the ROM memory timing a lot simpler too if that MCU is making the clock too.
STM32 option. A black pill has enough GPIO exposed to meet the needs. Runs at 80Mhz IIRC? It could support Z80 ROM flash writing over USB... or I could just bundle the Z80 payload in the STM deployable.
The only appealing thing with the ESP32 is it allows wireless flashing of the ROM. The peripheral set of the STM32 appeals more though.
* - we need to consider that we are in a tri-state and not a digital domain here. By no action means, "no influence", floating pins.
** Clock edge timing sounds like it will be a pain in the a.r.s.e especially on an ESP32, I might have more edge trigger functionality with STM32 timers.