Running ChatGPT on a 1984 IBM PC: Building a DOS‑Based GPT Client

Developer Yeo Kheng Meng created doschgpt, a ChatGPT client that runs on a 1984 IBM 5155 MS‑DOS machine by using Open Watcom, a Packet Driver, manual HTTP POST construction, and a Go HTTPS proxy to bridge modern OpenAI services.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Running ChatGPT on a 1984 IBM PC: Building a DOS‑Based GPT Client

Overview

doschgpt is a ChatGPT client that runs on 16‑bit MS‑DOS systems, demonstrated on an IBM 5155 portable PC (Intel 8088 @ 4.77 MHz, 640 KB RAM, CGA graphics).

Toolchain

The program is compiled with the Open Watcom C/C++ compiler targeting 16‑bit DOS. Development is performed on Windows 11 using Open Watcom, while testing is done in a VirtualBox VM running DOS 6.22. After successful testing, the binaries are transferred to the physical IBM PC for final verification.

Networking

DOS lacks native TCP/IP, so the 1983 Packet Driver API is used via the open‑source MTCP library. MTCP provides low‑level socket‑like functions that communicate with a network‑card driver conforming to the Packet Driver specification, enabling Ethernet connectivity.

HTTP Request Construction

All HTTP/1.1 communication is built manually. The request line, headers, and JSON body are assembled with C string macros. Example macros:

#define API_CHAT_COMPLETION "POST /v1/chat/completions HTTP/1.1
" \
    "Content-Type: application/json
" \
    "Authorization: Bearer %s
" \
    "Host: api.openai.com
" \
    "Content-Length: %d
" \
    "Connection: close

%s"

#define API_BODY "{ \"model\": \"%s\", \"messages\": [{\"role\": \"user\", \"content\": \"%s\"}], \"temperature\": %.1f }"

The OpenAI response is a JSON payload. Because no JSON library exists for the environment, a tiny handcrafted parser extracts the content field from the returned message object.

HTTPS Work‑around

DOS cannot perform TLS. A small Go program runs on a modern machine, listening for plain HTTP from the DOS client, forwarding the request over HTTPS to api.openai.com, and relaying the raw response back. This proxy acts as a transparent man‑in‑the‑middle, enabling encrypted communication without TLS support on the DOS side.

Runtime Flow

User types a prompt at the DOS console.

The program formats the HTTP POST using the macros above.

The request is sent to the Go proxy via the MTCP network stack.

The proxy forwards it to OpenAI and returns the JSON reply.

The DOS client parses the reply and prints the assistant’s message.

Availability

The full source code, build scripts, and usage instructions are hosted at:

https://github.com/yeokm1/doschgpt

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

ChatGPTNetwork programmingLegacyDoSOpen Watcom
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.