udo-munk / z80pack

A Zilog Z80 and Intel 8080 systems emulation
MIT License
168 stars 37 forks source link

Port to ESP32 micro-controller with TTY: over USB or RS232 serial, all other IO over WiFi #39

Closed dmcnaugh closed 5 years ago

dmcnaugh commented 6 years ago

Priority: high Difficulty: difficult, been working on it for almost a year now, but its about 95% ready to go.

I have ported z80pack V1.36, specifically the imsaisim machine, to the ESP32 micro-controller. https://www.espressif.com/en/products/hardware/development-boards A device that retails for around USD$20 - I have specifically used the ESP32-PICO-KIT

These devices have a dual-core CPU @ 240MHz, 520KB SRAM, 4MB Flash RAM (storage) and builtin WiFi, USB connector for serial UART and programming.

To this I have added

Sometimes I use the USB based serial UART for TTY: but most of the time I connect over WiFi using a browser to launch the desktop GUI that this port of the imsaisim can serve using an embedded web server (see #38 for more details and screen shots).

Running with '-f0' for unlimited speed I can get a simulated 4.905 MHz. This has been steadily climbing as I optimise the code. Under conditions I can't currently reproduce I have recorded a benchmark of 5.481 MHz, but there is certainly no problem with reliably running the simulation at a realistic 2MHz or 4MHz making WordStar, SuperCalc2, M80/L80 a pleasure to use.

dmcnaugh commented 5 years ago

Wow, its been a long time since I last wrote about this - sorry for the delay. The ESP32 port of the z80pack V1.37-dev is now functionally complete, meaning:

The delays have been a combination of life getting in the way and also waiting for the ESP32 SDK (esp-idf) to fix a number of problems that were preventing me from making progress.

There are plenty of known issues and unfound bugs. The code is (very) ugly in places.

Simulated clock speed with -f0 (unlimited) averages around 4.767 MHz but is negatively effected when running the Dazzler (only a little) or the Cyclops (a lot more) owing to the increased network load.

My biggest disappointment is that the code changes to support the ESP32 are large enough that I don't think that it can be managed with simple #ifdef ... #else ... #endif blocks in the code. This makes merging changes from the dev branch a manual process.

So the decision to be made is how to publish the code. We will need to decide whether to make the ESP32 port (remember it is only of imsaisim):

  1. a seperate machine in the z80pack code
  2. a permanent new branch in the z80pack GitHub repository
  3. a seperate fork with its own GitHub repository

Let me know what you prefer. screen shot 2018-11-29 at 8 21 37 pm

udo-munk commented 5 years ago

No problem, I've had no time for this either, there is just too much to do ...

Have you seen the improved Cyclops software on the disk image? It's quite improved over what Cromemco released.

I would suggest you create your own fork for the ESP32 machine, so that you can maintain it independently, I can't contribute much to this version. It might be less work with a new permanent branch here to keep further development in sync, what do you think? I won't have a problem to give you all permissions on that branch, if I can figure out how to do here, that is.

udo-munk commented 5 years ago

IMSAI 8080esp kit is shipping, so implementation completed.