Tweet |
A Vogon (-esque) Poetry Generator for your Classic Computer
Introduction
Even though my collection is diminished from what it used to be, I still have six classic models in the stash. Every now and again I like to "exercise" these machines by turning them on and letting them run for a few hours. This keeps the capacitors from drying out, and it can show up any emerging problems.
Exercising these computers usually meant displaying the boot screen, or PEEKING at RAM in a FOR...NEXT loop, while I did something else. Occasionally I'd glance over to make sure nothing funky was going on such as wisps of smoke or a crashed system. Seeing the machines sitting at idle or scrolling hex wasn't particularly interesting though. I wanted to write some kind of "screen saver" so that when I checked on them, they were at least doing something more engaging.
Vogon Poetry
Vogon Poetry comes from that classic work of Douglas Adams namely "The Hitchhikers Guide to the Galaxy". The Vogons as a race are "bad-tempered, bureaucratic, officious and callous". They also consider themselves as great poets. In reality their poetry is horrible and listening to it is literally torture. I figured it would be fun to have my classic computers generate screens of Vogon-like poetry while they were marking time. This appealed to my wistful sense of humour and was also a programming project I could get my teeth into.
Figure 1. Groop, I implore thee, my foonting turlingdromes
Now true Vogon poetry contains many words in Vogon, along with English. As I'm not a fluent speaker of Vogon, I decided I would attempt code that generated "Vogon-like" poetry, reflecting the spirit and structure of the genre, but using English words only.
The text below details my programming "adventure". However If you want to skip all that and see what I wrote and/or download some code, just skip to here.
Development
(i) The MS-DOS version for my IBM XT (With a little help from my friends)
It had been many, many years since I last programmed in BASIC. To say I was rusty was an understatement! However, following the latest Zeitgeist, I made this a "Vibe coding" project and sought help from a Large Language Model (LLM.) There are many to choose from but Qwen 3-30b, a recently released freely downloadable LLM, was installed on my gaming machine hence available at no cost for a long session. I was curious to see just how well this modest LLM would perform writing an ancient language from scratch so I gave it a go!
After ascertaining that Qwen 3-30b was fully aware of the concept of Vogon Poetry, I ask it to produce a script in GW-BASIC/BASICA suitable for my IBM XT.
The first draft was quite promising. Qwen 3-30b chose suitable words, loaded them into arrays and worked out appropriate phrasing and how to deliver it with randomisation. Given it was a small LLM, I was quite impressed. However there were errors (like GOTOs to nonexistent line numbers) which needed to be fixed. Eventually though I had a working program.
This first effort ran ok but I wasn't entirely satisfied with it. The poetry was quite limited in that most lines were short and not as "Vogon" as I would like. My appetite having been wetted with Qwen, I wondered if the newly released Chat-GPT 5 could do better? To answer the question I put the same task to that much larger model.
Chat-GPT 5's poetry was better but surprisingly, unlike Qwen, it struggled with versions of BASIC reaching as far back as GW-BASIC/BASICA. For example, it used DO...LOOP and CASE structures. These are present in later versions of Microsoft BASIC like QuickBASIC and QBASIC, but not in earlier versions like GW-BASIC/BASICA. On pointing this out, CHAT-GPT tried workarounds but as it tried to fix existing problems, the LLM introduced new ones! Things were getting worse not better. I tried Anthropic's Claude as an alternative but it couldn't reliably downgrade Chat-GPT's initial code to GW-BASIC either!
Finally, I decided to fix things myself! I went back to the first iteration given by Chat-GPT 5. Even as QuickBASIC code this initial program still had errors but I manually fixed them, and eventually got it running in QuickBASIC 4.5 to my satisfaction. I decided to compile the program to an executable, so I didn't need to boot up the BASIC interpreter first just to run it on the XT.
Figure 2. Vogon text on the IBM XT
I tested the code using a virtual XT machine I'd built with the 86Box emulator. However, I wanted this version of the program to be useable on any MS-DOS/PC-DOS machine. A Pentium II is much faster than an IBM XT so I added a user-inputted speed control variable to regulate the speed of poetry generation. This allowed the code to accommodate differing processor speeds.
Moving the code from my virtual machine to the real one was achieved by using Winimage to extract the files from a virtual floppy previously attached to the virtual XT, then copying the files via USB to an MS-DOS 6 machine with a suitable 360KB drive. The code was copied onto a 360k disk, that disk inserted into the IBM XT and the file copied to its hard drive.
(ii) TRS-80 Model I/III (and System 80) version
One machine down but more to go. TRS-80 Level II BASIC is essentially a subset of QuickBASIC, and code converted to the former would run on both my System 80 and TRS-80 Model 4 (in Model III mode). However given Level II BASIC was much a smaller interpreter (just 12k) than QuickBASIC, there were limitations. First, variables could only consist of two letters. Secondly, IF statements could not be nested, so keywords like ELSEIF and ENDIF were not available. Neither was WHILE...WEND. The RND command was treated differently. There were other differences also but these could be accommodated. It just meant stepping through the program modifying it accordingly. In the end, it was fairly straightforward.
The "Space Bar" was used as a terminator rather then ESC as the latter key isn't on the TRS-80 keyboard. One other thing to consider was the TRS-80 Model I/III only shows 64 characters across the screen rather than 80, so sentences had to be shortened to suit.
Figure 3. Vogon text on the TRS-80 Model 4 (in Model III mode)
I tested the code in the excellent trs80gp emulator then ported it to the Model 4 by using David Keil's TRS80 emulator running under MS-DOS on the same machine as above i.e. the one with the 360k 5.25 inch floppy drive. Trs80gp disk images can be read by the Keil emulator, which I then used to write the image out to a real 5.25 inch floppy disk for use on the Model 4 or System 80.
(iii) Amstrad 6128
Porting to this machine was quite straightforward as it has a good 8-bit version of BASIC containing all the string and flow commands of TRS80 Level II BASIC. I simply used the latter version, hard-coded the speed variable to suit, amended the RND parameter (which was treated differently in Level II BASIC) and added a command to make the display 80 columns, reverting to the line length of the original QuickBASIC/QBASIC version.
Figure 4. Vogon text on the Amstrad 6128
The code was tested in The Retrovirtual Machine , then copied to a disk image. This image was then written to a real 3.5" disk using CPCDiskXP under Windows XP. I then transferred the program to a 3 inch disk on the Amstrad using an external floppy drive attached to that machine (as seen in Figure 8 in my article here).
(iv) Commodore 64
This was by far the hardest conversion. Commodore BASIC is only 8k in size and has no ELSE statement in the IF...THEN construct. This meant adding lots of GOTOs leading to a fair amount of spaghetti code. Lines of code needed to be relatively short as there is only an 80 character buffer. Some other keywords needed to be substituted too, like using GET instead of INKEY$ to check a keyboard press. As there was only 40 columns on the screen I needed to write a word wrap routine so a sentence could be displayed over two lines. Also I made the border the same colour as the main screen, just to give the words room to breathe.
Figure 5. Vogon text on the Commodore 64
I used the TRS-80 code as a base and modified down from this. The biggest pain came from the C64 using the PETSCII character set rather than standard ASCII. Using the VICE emulator, I could paste the draft code in, but it resulted in everything being capitalised. I didn't want to retype in all the string values as lower case on the real computer. As a work-around I coded a subroutine to display all characters as lower case except for the first word of every sentence, even though it was capitalised in the code.
After testing in VICE, the program was exported as a file using D64 Editor then copied to an SD card for my SD2IEC device. The C64 could run the program from there.
(v) Apple Mac SE/30
As BASIC was never designed with a GUI in mind the language was really never a thing on the Apple Macintosh. MBASIC was available for very early Macs but Microsoft never developed it much further than the mid-1980s. However, I found a BASIC interpreter called Chipmunk BASIC which had a version for System 7, so I decided to port the QuickBASIC/QBASIC version of the software into that.
The software partially worked when first pasted in but there were issues. For example Chipmunk BASIC used END IF rather than ENDIF to finish a nested IF...THEN...ELSE block, and ELSEIF wasn't an option either. Some tweaking was needed therefore.
Figure 6. Vogon text on the Apple Macintosh SE/30
For this port I used the Basilisk II emulator, saved the whole Chipmunk BASIC folder (with the vogon program) as a .SIT in an HQX archive. From there I copied it to a 1.44MB Macintosh disk on a PC using Transmac, then copied the files from this into my Mac SE/30 and unpacked it all.
(vi) Javascript for this web page
Knowing that readers of this post might actually want to SEE the Vogon screen saver in action, I asked Chat-GPT 5 to convert the QuickBASIC/QBASIC version to Javascript. This it did with aplomb within seconds. It obviously knows the modern languages better than the older ones! You can see it here... (Note: this section is not optimised for mobile devices)
The programs
Click on the links to download the scripts. Please appreciate that I'm not a programmer, this code is not optimised, poorly commented and is bound to include hidden errors and examples of questionable logic. It's sure to make some veteran coders shake their heads but I make it available anyway for your own amusement, and/or if you want to run it on your own machines. Enjoy!
- Any PC-DOS/MS-DOS machine (as an executable (vogonQB.zip))
- TRS-80 Model 1/III (as a BASIC program (vogonTRS80M1-III.zip))
- Amstrad 6128 (as an Amstrad CPC disk image (vogon.dsk))
- Commodore 64 (as a D64 disk image (vogon.d64))
- Macintosh (System 7) (as a HQX archive (vogon.hqx))
(Note: Made available under a Creative Commons Attribution (CC BY) license)
Final thoughts
Now my machines have something amusing to display when getting their regular exercise (Figure 7).
I enjoyed this project. It was good to reacquaint myself with various dialects of BASIC. In addition there was the challenge of transferring the code to a real machine once I was satisfied with it in an emulator. It was also fun to try out the coding prowess (or not!) of some of the small and larger LLMs. They were certainly a help but they weren't quite there yet as far as vintage BASIC was concerned.
Figure 7. Vogon text on the whole lineup (minus the System 80)!
All in all, the exercise was lots of fun. Such projects are a net benefit both for my machines and my little gray cells.
Terry Stewart (Tez)
22nd August, 2025
Tweet |