A hobbyist software developer and retro computing enthusiast has succeeded in bridging the ChatGPT and IBM PC-XT computing divide. On the lookout for a challenge, Yo Kheng Meng wondered if he could write a ChatGPT client for MS-DOS. Specifically, he targeted a 1984 vintage IBM 5155 Portable PC, which is powered by a 4.77 MHz Intel 8088 CPU and has 640KB of RAM (enough for anyone, right?). Several technological obstacles needed to be surmounted to make the project a success.
Typically, most people access ChatGPT via a web browser, but it seems to be a growing trend to access this AI resource via a client. We have reported on some notable and fun clients like a ChatGPT Smartwatch powered by a Raspberry Pi and Microsoft’s much maligned Clippy with an AI brain transplant. However, getting ChatGPT to work on one of the most ancient of PCs might be even more ambitious.
Meng started his quest by finding a compiler which could span the 40 years or so gap between the target computer and ChatGPT. The Open Watcom C/C++ compiler fit the bill. To test the DOS application during development he decided to run it in a virtual machine (Virtualbox virtual machine running DOS 6.22) on a modern PC.
One of the biggest hurdles with DOS was with the networking required to connect to the ChatGPT service. Meng found that MTCP, written by Michael B. Brutman, would facilitate the connection to ChatGPT’s Chat Completion API. However, to communicate with this API required the developer to “construct the entire POST request by hand in C.”
A few further hurdles the developer had to pass included JSON parsing, changing the ChatGPT output from HTTPS to HTTP, and working with the lack of multi-threading in DOS. You can read more about how this was achieved in his full blog post.
OpenAI’s conversational AI ChatGPT (Chat Generative Pre-Trained Transformer) has gained lots of attention in and outside of the tech world since its debut late last year. It has spurred intense new competition between web titans like Google and Microsoft, it has helped clarify the potential of AI (and some downsides), and it has caused a mini-boom for many related businesses.
I don't really get the point about threading. If I were writing a simple, command line network client app on Linux, it probably wouldn't be multi-threaded.
Also, I'd be surprised if there isn't some C89-compliant JSON parser out there, somewhere. It's easy enough to parse, but I'd still try to use a library, if I could.
Do the Commodore C64 next!