Close
0%
0%

ESP8266 PC-XT Emulator

Improved version of the MCUHacker01's ESP8266 PC-XT Emulator

wsWS
Public Chat
Similar projects worth following
My build of MCUHacker01's ESP8266 PCXT Emulator.

A couple of years back, I stumbled upon an intriguing project created by  MCUHacker01, which involved an ESP8266 PC-XT Emulator. I was truly fascinated by the idea of a compact ESP8266 capable of booting up a DOS system. However, at the time, I was heavily occupied with other projects, so I made a mental note to return to this endeavor in the future.

I'm aware that numerous experts have already transitioned to using the ESP32 for PC-XT emulation, with some impressive projects that boast VGA output and increased speed. I intend to explore these projects in the future. However, for now, I'm content with making the most of the ESP8266 boards I currently possess and maximizing their capabilities.

A week ago, I came across a Hackaday.io article authored by Steve L, who had been actively working on the same project since 2018/2019. Seeing that the project was documented on Hackaday.io, I decided to share my own project here as well. I only wish I had discovered Steve's project logs earlier, as many of the challenges I encountered were thoroughly addressed in his project. It would have saved me a considerable amount of time spent troubleshooting. Nevertheless, I consider myself fortunate to have tackled these issues independently, which allowed me to gain a deep understanding of how an IBM PC-XT operates. In fact, I even managed to push the project a step further than Steve did.

The major breakthrough occurred when I incorporated the ESP-PSRAM64H SPI PSRAM into the project. However, due to the limitation of establishing communication between the ESP8266 and the PSRAM using a single-line SPI protocol, the RAM access speed was less than ideal. In comparison to the "standard" IBM PC-XT running at 4.77MHz, the final emulator's speed ranged from 30% to 80%, and in some cases even up to 90%. Since many games heavily rely on RAM access, they ran at a significantly reduced pace. Simpler games like PC-man and Paratrooper, which happened to be personal favorites from my childhood, ran nearly at full speed. Additionally, I managed to perform some tasks with Lotus 1-2-3. However, due to the ESP8266's limited GPIO availability, I couldn't emulate a printer port to produce printed output of my work.

Regarding the I/O ports, I successfully replicated a serial port using the two remaining GPIOs. Since there were no additional GPIOs available (though I briefly contemplated utilizing GPIO10), I had to forgo hardware flow control. Consequently, the sluggish emulator was only capable of receiving serial data at a rate of approximately 300 bits per second (bps). I established a connection between the Serial I/O port (3F8) and an ESP01s Serial Wifi Modem, crafted a basic terminal program with QBASIC, and managed to connect to several Bulletin Board Systems (BBSes).

An additional ESP01s was required to handle the WiFi connection since the primary ESP8266's WiFi function had been configured to operate in deep sleep mode. This adjustment was made because the ESP8266's WiFi radio consumed valuable heap memory, causing a slowdown in emulator performance and generating a high number of interrupts that significantly impacted video generation.

If you've successfully built a similar setup, I'd greatly appreciate your comments and feedback. I'm more than willing to provide assistance if you encounter any issues while attempting to get the emulator up and running. Furthermore, please feel free to share any code improvements you've made, as this collaborative effort can contribute to enhancing the overall project.

---   

Youtube Videos:

---

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:...

Read more »

plain - 10.59 kB - 12/11/2021 at 13:50

Download

plain - 258.65 kB - 12/11/2021 at 13:50

Download

plain - 1.66 kB - 12/11/2021 at 13:50

Download

plain - 9.45 kB - 12/11/2021 at 13:50

Download

plain - 5.40 kB - 12/11/2021 at 13:50

Download

View all 9 files

  • 1 × ESP8266 NodeMCU ESP8266 project board
  • 1 × ESP-PSRAM64H or LY68L6400 SPI PSRAM

  • Flash ROM upgrade, addition of 12MB HDD and Windows 3.0

    WS01/26/2022 at 08:03 0 comments

    26-Jan-2022: During the weekend, I finally found some free time to spare. I decided to remove the shield on the ESP8266 module and swap out the 4MB flash ROM with a larger 16MB W25Q128 flash ROM. With this expanded storage capacity and a few lines of code adjustments, I successfully integrated a 12MB "Hard Disk" into the emulator. After marking the drive as "Active" using FDISK and initializing it with FORMAT /s, the emulator can now boot up from the new "Hard Disk."

    Out of curiosity, I dedicated some time to installing Windows 3.0 onto this fresh drive. The installation process took approximately 2 hours to complete. Operating Windows 3.0 without a mouse was a bit challenging, but it functioned seamlessly with my keyboard. However, as anticipated, the system operated at an extremely slow pace. It would take around 5 minutes just to access the Program Manager. Nonetheless, it was a delightfully nostalgic experience! I've included a picture of the Windows 3.0 "About" dialogue box for your reference.

View project log

Enjoy this project?

Share

Discussions

Steve L wrote 12/29/2021 at 00:28 point

One of the things that might be a "gotcha" to anyone trying this is the keyboard. I have found that old-time, period correct keyboards (old Dell's, for example) will work with this code and hardware, but "newly manufactured" PS/2 keyboards (and/or keyboards sold as "PS/2 compatible" with a USB to PS/2 adapter) may not work. A clue to a non-working keyboard may be  a continuously flashing light on the ESP chip upon bootup of the code. I have not investigated this further,.

  Are you sure? yes | no

WS wrote 12/29/2021 at 12:44 point

Thanks Steve for trying out the code. The current PS/2 keyboard code only receive data from the keyboard without sending command/ack to the keyboard. This is the reason that it only works with pure PS/2 keyboard. Also, the Caps/Num/Scroll Locks are not working because of the lack of two-way communication.

I suspect that most PS/2-compatible USB keyboards start as a low-speed USB device, with D+ low and D- high. However, ESP8266 requires both lines (GPIO0 and GPIO2) to stay high at boot. Therefore, the ESP will not start and keep resetting (hence the flashing light).

To solve this, we might need to figure out the command to be sent to the keyboard, and perhaps also need to use a different set of GPIOs for the keyboard.

  Are you sure? yes | no

Steve L wrote 12/26/2021 at 00:37 point

I had been thinking along the lines of using PSRAM when I stopped working on this, so I had added a PSRAM I got off of an ESP32 camera board (not a cheap way to get one, but I wanted a spare camera anyway, and at the time there was almost no other way to get a PSRAM).  I put in on a DIP adapter and tested it, it was good to SPI to 70 Mhz with my test code. I never integrated this into my code. I took the code you wrote here, modified my board to use the keyboard and PSRAM select pins that you used, and it worked at 70 Mhz. Then I tried it at 80 Mhz, and it also worked. Don't know why my test software was so demanding.

As of right now, I didn't implement the speaker or serial port hardware;  my board isn't really big enough for those so I might make a daughterboard for it, but your code worked! Congrats!


BTW, I thought that I would try "FreeDOS",  and there were some compatibility problems (or possibly the limitations of the emulation). MS-DOS 6.22 worked pretty well albeit slowly on INT driven input and output.


I was thinking of trying the IBM BIOS, but a problem with that is that AFAIK the only way to get into ROM Basic with an original XT is to have no other bootable devices. So, if I decide to try to use that, it will take some kind of emulation dependent key state to signal this for convenience. Also, the original PC BIOS wouldn't boot without a keyboard as I recall.

  Are you sure? yes | no

bob099 wrote 12/26/2021 at 01:48 point

ROMOS might give you some hints to solve some problems.

https://rayer.g6.cz/romos/romose.htm

  Are you sure? yes | no

WS wrote 12/29/2021 at 12:53 point

Thanks Steve and bob. 

I am glad that the PSRAM code works for your setup. 80MHz is the max clock freq for ESP8266 peripheral SPI (at both 80MHz and 160MHz clock speed). If we want to go faster, we will need to figure out how to change the SPI protocol to the QIO mode.

I have not tried "FreeDOS", since I have only been using MS-DOS since I first started using the original IBM PC. I agree that the incompatibility is likely a limitation of the emulation (FAKE86). 

Besides, I have been using the BIOS provided in the original code. Maybe the "FreeDOS" will work better with original IBM BIOS. I will look for a copy of the BIOS and FreeDOS to test out the emulator.  

  Are you sure? yes | no

Ken Yap wrote 12/17/2021 at 07:27 point

It's really quite amazing, when you think of the advances in computing. A MCU board costing a few bucks emulating a decades old machine that cost hundreds to thousands of bucks in its day. 🤔

  Are you sure? yes | no

WS wrote 12/17/2021 at 15:38 point

Yes, indeed! However, I must admit that we are only doing a partial emulation and there are so much more that original machine can do. I really admire those engineers who built the original PC-XT in the 1980s! 

  Are you sure? yes | no

Steve L wrote 12/16/2021 at 22:09 point

I lost interest in this with focus on other emulators that I was working on, and I wasn't sure if getting this working was technically possible by anyone, much less me. My code was too awful to share. Congratulations on making this work! I was working with the original XT BIOS and BASIC ROMS to make this emulation as authentic as possible.

The code originally written by MCUHacker01 has been invaluable for me in other projects.

  Are you sure? yes | no

WS wrote 12/17/2021 at 14:52 point

Thanks Steve! I find your other projects really interesting as well! I did try your term8008 project and it works really well.

If you have the time and opportunity to try out my code, please kindly provide me some feedback. I am planning to port the project to ESP32 too, but I guess it won't be too soon in the future...

  Are you sure? yes | no

aldolo wrote 12/11/2021 at 05:04 point

nice. is the source code available?

  Are you sure? yes | no

WS wrote 12/11/2021 at 05:52 point

Thanks. I will share the code very soon. Still trying to complete the description part...

Besides, I will need to tidy up the code- lots of comments which are actually meant for myself.

EDIT: Source Code is now uploaded.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates