About the Atari 800 web server

The Atari800 was recently de-comissioned to return it to service as my game machine :)


by Kevin Loch

Update 1/31/2000: After being Slashdotted, I realized that the terminal server is not up to the task! The TCP/IP stack on the terminal server keeps freezing, requiring a reboot. The Atari however, is doing just fine.

About the Computer

The Atari 800 is an 8 bit 6502 based computer manufactured from 1979-1982(?). My unit came with 48k ram (fully tricked out!). The Atari uses a 19.2kbit serial io (SIO) system to communicate with external perepherals, like disk drives, printers and serial ports. I also have the rare 850 interface box that provides 1 paralell and four serial ports, and connects to the computer via the SIO line. The maximum speed of the serial ports is 9600 baud.

The Challenge

To serve web pages from the Atari 800, it first must be connected to the net. It would be difficult but not impossible to write a TCP/IP stack that would fit in (less than) 48k of ram and run on the 1.7 MHz processor. Even then TCP/IP connections over the 9600 baud link would be _very_ slow and would not support many simultaneous users.

The Solution

The solution is to use a terminal server as the TCP/IP interface. I used an old Bridge Communications (now 3Com) CS-210 Terminal Server (circa 1989). The terminal server has an ip address assigned to the port the Atari is connected to and sets CD on when an incoming connection is made. A simple BASIC program running on the Atari detects the CD on condition and immediately spits out the hard coded web page. With our example program no attempt is made to interpret the clients request, though there is no reason why you couldn't. As soon as the output buffer is empty the BASIC prgram drops DTR, which causes the terminal server to drop the TCP connection. With an HTML page of only 250 bytes, this process can support several hits per second on the 9600 baud link! The html and the BASIC code is kept to an absolute minimum to maximize throughput. You could of course write a more full featured web server, with a performance penalty.


The terminal server originally would only listen on ports 23 (telnet) and 513 (rlogin). It now listens on port 80 (http).

Source Code

5 CLOSE #1
10 A=0
15 XIO 36,#1,14,0,"R1:"
20 XIO 34,#1,(192+48),0,"R1:"
30 XIO 38,#1,64,0,"R1:"
40 OPEN #1,9,0,"R1:"
1000 STATUS #1,C
1010 IF PEEK(747)<2 THEN GOTO 1000
1015 XIO 40,#1,0,0,"R1:"
1030 PRINT #1;"HTTP/1.1 200 OK"
1040 PRINT #1;"Content-type: text/html"
1050 PRINT #1;
1060 PRINT #1;"<HTML><HEAD><TITLE>Atari 800 web server</TITLE></HEAD>"
1071 PRINT #1;"<H2>Welcome to the Atari 800 web server</H2>"
1075 A=A+1
1080 PRINT #1;"<P>Hits since last reset:";A
1800 PRINT #1;"</FONT></CENTER></BODY></HTML>"
1900 STATUS #1,C
1910 IF PEEK(749)>0 THEN GOTO 1900
1920 CLOSE #1
1930 OPEN #1,9,0,"R1:"
1940 XIO 34,#1,128,0,"R1:"
1970 STATUS #1,C
1980 IF PEEK(747)>1 THEN GOTO 1970
1990 XIO 34,#1,192,0,"R1:"
1999 GOTO 1000
You may of course use,modify and distribute this source code freely.

Copyright © 2000 Kevin M. Loch All Rights Reserved.
Atari is a trade mark of Hasbro Interactive, Inc. which does not
sponsor, authorize or endorse this site.