ChatGPT is now a buzzword. It’s in the news and adding users daily. OpenAI also provides APIs for chatbot integration. Programmer and antique computer enthusiast Yeo Kheng Meng is the latest example. He attempted to run ChatGPT on his 1984 IBM 5155 Handheld PC, his oldest piece of gear.
Integrated floppy disks and a display made the 5155 portable. It’s not great by today’s standards. The IBM PC had an Intel 8088 2.77MHz CPU, 640KB of memory, CGA ISA graphics, a NE2000-compatible ISA ethernet adaptor, and MS-DOS 6.22.
ChatGPT runs on a 1984 IBM PC running MS-DOS.
Yeo’s initial difficulty was machine development. Open Watcom C/C++ targets the machine. It generates DOS, OS/2, Windows, and Linux executable code. To avoid porting binaries to the IBM PC, a DOS virtual machine was employed.
Networking the gadget was the next issue. Packet Driver API, a 1983 low-level API, lets developers speak to network hardware. mTCP DHCP, an open-source networking library, lets DOS computers get IP addresses through DHCP. Modern PCs use DHCP to receive IP addresses and configuration information from local routers. Network stack code was built after establishing networking connectivity.
ChatGPT was contacted next. OpenAI APIs allow this. This instance utilizes the Chat Completion API. A C POST request sends messages to ChatGPT. The API returns JSON data. A C function was built to find the key in the provided JSON data and extract the needed data (ChatGPT responses in this case).
Printing output on the screen and collecting user feedback were the final steps. Printing data to the screen is easy with the standard prinf() C function. Extracting user input was harder. As scanf() pauses the application for user input, it cannot be utilized. As the CPU cannot multi-thread like current CPUs, this would also stop networking communications. A BIOS keyboard interrupt was used to save key presses in a local buffer without halting the application.
Yeo’s IBM PC DOS application hosted a ChatGPT client. The ancient machine also impressed him. He requested a DOS ChatGPT client after finishing the job. “Keep in mind that building a DOS ChatGPT client may be tough, as DOS is an ancient operating system and may not have the required tools and resources to construct current applications.”