Silent Q

Azog's little slice of the world. Whee.

Commodore PET web . . . server?

Posted By on August 16, 2013

So is this the first web server running on a Commodore PET 4032?


Retroswitch released a new firmware for the Commodore PET Flyer Internet Modem which allows for inbound connections. So, of course, the first thing to do was was to whip up a crude web server.


The BASIC code is simplicity itself:

First, listen for a connection on port 80. A loop between lines 30 thru 60 reads the connection status (stored in variable D). When D=1, a connection is made.

Next, grab out the IP address, so I can display it both on the console and on the web page, and then spew out the raw HTML. Close the socket, and start all over again.

   10 open2,7,2,"listen:80"
   20 open7,7,15
   30 print#7,"n-s:2"
   40 input#7,a,b$,c,d
   60 if d=0 goto 30
   70 print#7,"c-i:2"
   80 input#7,a,b$,c,d
   90 printb$
  100 print#2,"<html>"
  110 print#2,"<head>"
  120 print#2,"welcome to a commodore pet 4032 web server!"
  130 print#2,"</head>"
  140 print#2,"<p><b>welcome to the"
  150 print#2,"world's first"
  160 print#2,"web server running"
  170 print#2,"on a commodore pet 4032!"
  175 print#2,"</b>"
  180 print#2,"<p>your ip address is ";b$
  190 print#2,"<p>"
  200 print#2,"thank you for visiting"
  205 print#2,"</html>"
  210 close2
  220 close7
  230 goto10

Unfortunately, I cannot run this “live” for a few reasons… One, is because the PET is set up in my general work-area, which I use for a variety of purposes, and can’t really dedicate this to run full-time. Second, I’d be concerned about screen burn, but I guess I could put a cut-off switch on whatever line provides the CRT high voltage, but that’s kinda nasty.


8 Responses to “Commodore PET web . . . server?”

  1. Soren says:

    I tried running the code on my c64 with my newly updated flyer modem but I keep getting “no channel available” blinking on the display of the flyer – tried printing b$ and it also output this.

    admittedly i don’t know what i’m doing, so I’m sure i’ve missed some obvious difference that needs to be made in the basic code

  2. azog says:

    I’ve never tried the Flyer on a C64, so I’m not sure what, if any, differences there might be. I’ll hook things up later and see what happens.

  3. azog says:

    So I’ve tested it on a C64 with no issues. The program ran without modification. Can you provide a bit more information? Does your Flyer have an IP address, and can you ping it from somewhere on your network? Does the BASIC program throw an error code, and if so, at which line?

  4. Soren says:

    Yes my flyer has got an IP address and I can ping it no problem. The code runs without error – but while the code is running the flyer display is blinking “NO FREE CHANNEL” every 3 seconds. If i print the b variable it will also output NO FREE CHANNEL

    Here is a screenshot of the code typed in, not sure if I’ve made a stupid mistake somewhere.

  5. Soren says:

    Hm, i don’t think my flyer was updated correctly. just ran the update procedure again and now it works!

  6. Volker Birk says:

    The first web server on a Commodore 64 is many years ago, see

    But nice hack ;-)

  7. azog says:

    Of course, Commodore 64 != PET 4032 :p

    But thanks for visiting.

  8. Very good inspiration. I did use your code to put it on my CBM 8032 and it works now like a charm. I had the same issues as Soren, and it was resolved the same way as Soren.

    Maybe it is worth noting that for the web text you have to use lower case characters, which are than displayed upper case at the web site.

Leave a Reply

Please note: Comment moderation is currently enabled so there will be a delay between when you post your comment and when it shows up. Patience is a virtue; there is no need to re-submit your comment.