DOCTYPE html> Andrew Farmer Commodore PET Interview

Andrew Farmer Interview

Andrew Farmer - Author of A.F. Asteroids

Asteroids by Andrew Farmer
Asteroids by Andrew Farmer

I discovered an 8 year old video on YouTube showcasing a video game I'd never seen before – a machine-language version of *Asteroids* for the Commodore PET. I wondered if I could get in touch with the author, given how old the video was. And even if I did, would the author still have the game file? To my surprise, Andrew Farmer, the author, responded quickly and sent me a copy of the game. The game came in the form of scanned code, as Andrew had handwritten the data on paper, which was common at the time.

In the early days of the PET, many programmers didn’t have assemblers and often had to input opcodes manually using a machine language monitor. My first attempt to compile the code didn't work because some of the characters had been scanned wrong (example: D instead of 0). After an hour of debugging, I had a working game. By that time, Andrew had sent me the binary files he'd uncovered with several versions of the game in progress.

"It was really amazing how people were creating these games in such a limited environment, but it was also a time of real creativity and resourcefulness!" – Andrew

Interview Questions

Q: Did you write any other games for the PET?

A: I wrote all sorts of things for the PET, some in BASIC and then a number in 6502 machine code. Asteroids was the best of them – I actually had it for sale in PC World, or a magazine similar to that, and a few copies were sold at the time. I also wrote an assembler/disassembler at one point, though we all coded in hex back then using the monitor built into the PET that you could drop into by typing SYS 1024, if I recall correctly. A friend wrote a version of Galaga, and I also started writing versions of Defender and Missile Command, but did not finish them.

Q: How did you learn 6502 code? Did you start on the PET or another machine?

A: The High School had two PETs – the original 8K one and then a later one with 16K and floppy discs. There was a club at lunchtime and after school, and myself and friends used to go there. Initially, we watched the more senior kids writing stuff in BASIC. We then started to learn to program on the TI programmable calculators – things like noughts and crosses and something called “Hunt the Hurkle.” Then we started writing things in BASIC on the PETs. Problem with BASIC is it is very slow...

At the start of one school year, we had a breakthrough. One of my friends had been to the USA on holiday (I’m a Brit) and came back with a version of Space Invaders for the PET. We were also so excited to play it – it was amazing. What really intrigued us was that it only had a single line of code: “10 SYS 1040”. On investigation, we discovered that the game itself was written in machine code. This opened a whole new world, and we learned how to access the monitor and start writing code in hex. This is what ultimately led to the writing of Asteroids.


Some of the other things we did a lot was to write our own BASIC commands. This could be done by breaking into the routine that reads the lines of the BASIC program and adding in your own routine to parse the text. The way BASIC worked is it tokenized the commands and the interpreter read the tokens and used a lookup table to get the subroutine for the particular function. You could make your own commands by using words but with something like “!” at the front, so for example one that I wrote was called: “!explode(x,y)”. You could have a routine that would look for the “!”. If it was found, then the code would go off to parse the rest of the line and handle the commands you had added, else it would return to the interpreter. !explode(x,y)” used x and y as screen coordinates and would then set an IRQ routine to run that would start an explosion graphic – similar to the one in Missile command – that would play out on the screen over a series of seconds via the IRQ, so the BASIC program could actually keep running. This made it possible for beginners to add some cool effects to the BASIC code.

Editor: I also remember listing programs and wondering why there was only a single line :)

Q: What inspired you to create Asteroids, and did you distribute it to others?

A: I loved the game itself – and played it in the amusement arcades when it came out. I thought it would be interesting to write on the PET as the graphics were challenging, and also you had to think about the asteroids going off the screen on all sides, but wrapping around. As mentioned at the top, it was actually sold – I made a few hundred pounds selling it, so I think quite a few copies were out there. Actually, when I submitted it for sale, I was originally turned down by the magazine as it had no demo mode – so the demo mode that you see is actually an add-on that I put in after the fact. If you look at the code, this might be fairly obvious as you will see that it is very heavily patched into the original game structure.

Thank you to Andrew for sharing this lost game. You may download it HERE.