I have written a model of a Z80 computer system in Verilog and implemented it on an FPGA development board (a Terasic DE10). It features a Z80 CPU, 64K of RAM, a UART, and a timer. I also wrote a ROM monitor program for it that is loosely based on the Xerox 820/Bigboard monitor. It has been a fun project and a great way to learn more about the Z80 CPU architecture.
Here’s a picture of the DE10 FPGA development board:
It’s a new z80 model. I wrote the Verilog code based solely on published information from Zilog data books. During development, I used the YAZE preliminary instruction test. I have not yet run any of the more extensive YAZE test suites, mostly because they have very long run times which made them impractical to run in Verilog simulations. Now that I have the ROM monitor running in hardware, I have the ability to run longer tests, and I can try some of the longer-running YAZE tests, but I have not done so yet. I made no effort to match the instruction cycle times, so programs that depend on that won’t work, but since I’m running at a 50 MHz clock speed, those programs wouldn’t work anyway. At the system level, I included a 1msec-resolution timer, so for programs that need time-delay loops, I have just replaced the time-delay loops with a call to the timer. I also have not made any efforts to implement the undocumented z80 instructions.
The assembler that I’m using cannot decode the macros in the zexdoc.asm (part of the YAZE test suite). Does anyone know of an assembler (Win10 or Linux) that can assemble zexdoc.asm?
EDIT: I have found a workaround. I wrote a Perl script to expand the macros.
The 90 seconds is misleading because it includes all the serial I/O time.
Edit: I did a test and the I/O takes less than a second, so I can’t blame I/O…
The Pi algorithm does lots of 32-bit divisions which is pretty slow on an 8-bit CPU.
Really really close … With 32-bit integer arithmetic, this algorithm can accurately compute up to 9674 digits of Pi. I haven’t tried that though. My main purpose for porting and running this calculation is as another z80 compatibility test.
The most challenging part of this project has been testing and validation. I have written or ported several test and demo programs, and I am overall happy with the current level of functionality and compatibility but the project could still use more testing and validation. If anyone wants to help/collaborate on writing or porting tests or demo programs, please let me know.
I’d be kind of interested in what bugs remain after passing ZXDOC - I dare say there could be some, and yet, what might they be?
I mostly use 6502, myself. I do run z80 in an Acorn second processor context, where I’m most likely to run BBC Basic - that might be worth porting - and then there’s CP/M, for which I have a small collection of games and applications but no great familiarity with them.
Are you running CP/M, or loading programs directly from your monitor?
At this point I have not run the full zexdoc test. That’s one area I could use some help with. I made a number of hacks to the zexdoc source (mainly I expanded the macros using a Perl script pre-processor) so it would assemble with my assembler. A set of CRC-based tests have been run (and passed) as well as other tests that I have written or ported. I also have written or ported several demo programs including Palo Alto Basic. I have not tried porting BBC Basic. I have also not tried getting CP/M to run, mainly because I do not have a convenient way to attach mass storage. I load all programs via a monitor program-load command which reads hex files over the serial/console connection.
I have all of the zexdoc tests passing except for the daa test. I have done extensive testing of the daa instruction with other test suites and they all pass, so I don’t know what zexdoc is doing differently. (Note: zexdoc bundles daa with cpl,scf, and ccf but those are very simple instructions so I’m assuming the problem is in daa. I don’t currently have an assembler that will assemble zexdoc, so I can’t modify it to test that assumption.)