When I resurrected my old Z80 board (just the processor module) I needed to add memory and IO to make it useful. The old processor only runs at 2.6MHz so I decided to use a PIC18f46k22 that runs at 64MHz to act as the memory/IO system for the board to drive an SPI character display. The uC will emulate (at a fraction of the original hardware speed) the program ROM, data RAM and 8 bit data ports the Z80 will use to program and send data on the display. All Z80 programming will be in SDCC with the binary program file converted to a C array for the PIC to serve from flash. The Z80 ram memory will be supplied by the PICs internal SRAM in another C array.
The first step was to add the PIC, a few glue chips (mainly to gate out refresh commands from the PIC interrupts) to the original board then wire it and several debug/io pins to the Z80 circuit.
Write the hardware emulator program for the PIC. (in progress)
https://github.com/nsaspook/z80memio/tree/rom
Write some test code in C for the Z80 using the SDCC compiler with no C runtime starting at absolute code address 0x0000, ram at address 0x0400 using IO port 0xff.
SDCC Assembly code output.
Then take the IHX file from SDCC, convert that to binary and then convert that to the needed C array containing the hex codes of the program using a few simple programs and scripts from various sources.
The end result is the Z80 running the program stored on the PIC that's a simple up count variable 'a', stored and retrieved in the PICs memory then sent back to the PIC for transmission on the SPI port for capture on the o-scope.
The emulator is set to auto-step only a few instructions per second using memory WAIT states.
SPI data and clocks for IO address and IO value.
Next step, finish the emulator code and write the real demo program.
The first step was to add the PIC, a few glue chips (mainly to gate out refresh commands from the PIC interrupts) to the original board then wire it and several debug/io pins to the Z80 circuit.

Write the hardware emulator program for the PIC. (in progress)
https://github.com/nsaspook/z80memio/tree/rom

Write some test code in C for the Z80 using the SDCC compiler with no C runtime starting at absolute code address 0x0000, ram at address 0x0400 using IO port 0xff.
C:
__sfr __at 0xff IoPort;
volatile __at (0x0400) unsigned char chk;
void main(void)
{
unsigned char a=0;
while (1) {
chk=a++;
IoPort=chk;
};
}

Then take the IHX file from SDCC, convert that to binary and then convert that to the needed C array containing the hex codes of the program using a few simple programs and scripts from various sources.
The end result is the Z80 running the program stored on the PIC that's a simple up count variable 'a', stored and retrieved in the PICs memory then sent back to the PIC for transmission on the SPI port for capture on the o-scope.
The emulator is set to auto-step only a few instructions per second using memory WAIT states.
SPI data and clocks for IO address and IO value.
Next step, finish the emulator code and write the real demo program.
Last edited: