ESP8266 PCXT Emulator Build Notes (In Progress)
I saw this project here on Hackaday ( https://hackaday.com/2018/02/26/pc-xt-emulator-on-esp8266/ ) and I just had to try it, to complement my 8008 and 8080 ESP8266 emulators. For you "kids", the original PC or PCXT with any kind of RAM or disks was very expensive, way beyond what a young person would buy straight out of college such as myself. The only way I could afford one was to solder up a bare board with parts, install it into a wooden box, build a (linear) power supply for it (I didn't have a prayer of building a switcher from scratch 35 years ago), get a (quite expensive) CGA card for it, and hook it up to a surplus black and white "monitor" that I had (which was basically de-contented, tuner-less 9" Admiral TV guts inside from the late 1960's). So, this machine emulates my first PC fairly closely.
The emulator works, and it's amazing. The video is pretty darned good on my 9" Sony studio monitor. The circuit on MCUhacker's website is missing a value for the output cap; I used 100uF and the video was fine. The video code itself will be very useful for me in other projects, although I can't believe that it would be compatible with highly interrupt driven WiFi (but, who knows). The emulator version posted on MCUhacker's site is incomplete and has a few oddities and bugs. I thought that I'd try to "fix" (i.e., "hack") it with my limited skills.
I had a bit of compiling trouble due to some formatting issues in the code, but I straightened those out. I could not get the boot to MS-DOS working, but I'm saving that for last.
I knew that the keyboard was missing, so I thought that I'd put together some PS/2 code, and then combine it with a PCXT converter (both of which exist on GitHub). This was trickier than expected. The PCXT code was missing some key translations, so to speak, so I added them; a bigger problem was the levels between the +5 keyboard and the 3.3V of the ESP8266. Nonetheless, with 200 ohms between them and 4.7K pull downs at the ESP8266, I believe that I got this to (mostly) work, by making "fake open collector" outputs at the ESP8266. The keyboard pulls up to +5 through probably 10K resistors; when I want a "1" on the line, I turn the ESP8266 into an input and those resistors pull up to +5; when I want a 0, I turn it into an output which "shorts" the resistors to low. The keyboard to ESP communication works OK, but I cannot get the communication working yet from the ESP to the keyboard. Nonetheless , it worked, although the code is "big" and pushed the already strained size of the emulator up to using 88% of the RAM (although the tables are in ROM). I will work on shrinking this later.
The keyboard code was integrated into the emulator code via new "ports" for 0x60 and 0x61 (the 8155). I removed the fake int 16 handler. The "boot self test" 0xAA keycode creating procedure was also written.
After doing this, I can report that the emulator's speed is rather good computationally and good in writing video through int 10h (through direct RAM access, it's extremely fast and flicker free).
The second problem I tackled (not really a "problem") were the funny squiggles on the BIOS screen next to the "equipment list" (CPU, video) upon boot-up. I noticed this also when running ROM BASIC. It occurred to me that this involved line drawing characters, which were missing in the emulator's table. I actually found a source for these that I believe to be accurate, added this to the preexisting character lookup (only up to 0x7F) and now I could see the proper line drawing characters and BASIC didn't have them anymore either. I'm unsure if this is a BIOS shortcoming or an emulator shortcoming (there is an interrupt that points to the location of this table in RAM, but in the BIOS, AFAIK, it points to zero, nonexistent). So, I wonder what this BIOS looks like when installed in a real machine with a CGA board - but who would do that even in the late...Read more »