A few years ago, I came across an ESP8266 PC-XT Emulator project by MCUHacker01 and I was amazed by how a small ESP8266 could be used to boot up a DOS. I was quite busy with other projects so I decided to revisit this later. Recently, I had some free time, so I decided to exercise my brain and try to continue with the project.
I understand that many experts have already switched to ESP32 for PC-XT emulation, and there are a few great projects with VGA output and faster speed. I am planning to try out those projects in the future as well! However, for the time being, I will just make do with those ESP8266 boards that I have and try get the most of out them.
A week ago, I came across an Hackaday.io article by Steve L, who was actually working on the very same project since 2018/2019. Since the project is on Hackaday.io, I decided to post my project here as well. I wish I had come across his project logs earlier, as many of the issues that I encountered were actually described in full details in Steve's project- I could have saved lots of time trying to figure out how to solve them. However, I was also lucky to be able to get through those issues by myself and learnt so much about how an IBM PC-XT works, and also went a bit further than Steve.
The main breakthrough came with the addition of ESP-PSRAM64H SPI PSRAM. However, as I could only get the ESP8266 and the PSRAM to communicate with single line SPI protocol, the RAM access speed was not great. Comparing to the "Standard" IBM PC-XT @ 4.77MHz, the final emulator had a speed varying from 30% to 80% (maybe 90%). Because most games require lots of RAM access, they ran very slowly. Some simple games, such as PC-man and Paratrooper (my personal favourite when I was a kid), ran at almost FULL speed! Besides, I could also do some work with Lotus 1-2-3, although the limited number of GPIOs on ESP8266 mean I would not be able to emulate a printer port to print out what I have done.
Speaking of the I/O ports, I also managed to emulate a serial port using the remaining 2 GPIOs. As there was no more GPIO that I could use (although I did consider recruiting GPIO10), there was no hardware flow control. The slow emulator could only take in serial data at a rate of closer to 300bps. I managed to connect the Serial I/O port (3F8) to an ESP01s Serial Wifi Modem, wrote a simple terminal program with QBASIC, and connected to some BBSes!
Another ESP01s was needed for the Wifi connection as the main ESP8266 Wifi function had been set to deep sleep. ESP8266 Wifi radio consumes Heap, slows down the emulator and generates too many interrupts that seriously affected the video generation.
Please kindly leave your comments if you managed to build one successfully! I will try my best to help if you have any problem getting the emulator to work. Also, please share your improved code, so we can make it even better.
List of Features added:
- Added PSRAM as the emulator RAM.
- Disk image address change to 0x100000. Possible of a 1.44M or 2.88M floppy disk image;
- Video mode 2 and 3, 80x25 text mode: Text is still white, and I added a 1-bit background (black or grey);
- Added video mode 0 and 1, 40 x25 text mode: White text, 1-bit background (black or grey);
- Added video mode 4 and 5, 320x200: 2-bit greyscale;
- Added video mode 6, 640x200: B/W only;
- Included character ROM for ASCII 128-255;
- Added cursor display for video mode 0, 1, 2 and 3;
- Reactivated built-in BASIC ROM;
- Enabled disk WRITE;
- Added accurate timer ticks (18.2 ticks/second);
- Added PC speaker output (using PWM feature of EPS8266);
- Added PS2 Keyboard code;
- Added Serial port (COM1) emulation;
- Rewrote the MMU swap for the emulated RAM;
The addition of the PSRAM was the game changer. Although I couldn't get hold of the ESP-PSRAM64H, but I managed to buy some LY68L6400 (I was told they are actually...Read more »