4 min read

Programming in BASIC on the TRS-80

Programming in BASIC on the TRS-80

I started programming when I was six years old. If that sounds impressive, you probably don’t realize how easy it was to get started programming in the ’80s.

In 1985, my parents bought a Radio Shack TRS-80. I’m not sure why. My dad’s a pastor and my mom’s a nurse. There was no professional reason for them to drop today’s equivalent of $2,500 on a machine that, frankly, didn’t do much.

The stock model came with 16k of RAM, though my dad drove three hours to Nashville to upgrade it to 48k. There was no internal storage. At first we didn’t even have floppies, just a cassette drive.

Image from Extinguished Scholar

Whatever their reason, my parent’s decision to have a computer in the house fundamentally changed the trajectory of my life. And while our TRS-80 is long gone, I was thrilled to discover that there’s an emulator for OSX.

I booted it up, then spent 20 minutes trying to remember how to launch BASIC, my first programming language. After a couple reboots, I read the welcome text more carefully.

That’s right. The TRS-80 boots into a BASIC REPL. To use a TRS-80 is to program.

Radio Shack Model III Basic is case insensitive, which is to say that it doesn’t give a shit what case you want – you’re getting uppercase. Variables are declared with LET. Or not. Either way. BASIC’s forgiving like that.

There is some type enforcement though.

If you’re in a REPL and you don’t have a text editor, how do you write a multi-line program? Line numbers.

BASIC is its own IDE. It keeps a single program in memory. LIST shows the program. NEW wipes the memory and starts from scratch. Best practice is to number your lines in multiples of ten so that you can go back and insert a line, or nine. God help you if you need more than that. To edit a line, retype it using the same line number.

I remember sitting with my dad at the TRS-80, practicing multiplication tables. I imagine we wrote something like this:

Maybe we would have then made it interactive:

Graphics are easy too. It’s a 128 x 48 monochromatic display. You turn on a pixel with SET(X,Y). Combine that with a nested loop, an IF statement and a random number, and you can create modern art:

Anyone who owned a personal computer in the 80s had at least conversational knowledge of BASIC. It was the programming language of hobbyists. Magazines like Enter and 3-2-1 Contact published programs for readers to copy. Not copy and paste – just copy.

This was my first exposure to Free Open Source Software.

(You really should flip through an issue of Enter.)

There were different flavors of BASIC. The programs would be published for for the most popular machines (Apple, of course) with exceptions listed for the others.

I’ve been thinking about this stuff lately since we just celebrated our daughter’s first birthday. I’d very much like to pass on the gift that my parents gave to me but can’t help but feel sad at how much harder it is to learn to program today. Back then, with a few lines of code I could write a program that ran on practically any home computer. Compare that with what a new developer encounters the first time they boot up, say, Android Studio.

If you meet a six year who learned how to program an Android app – now that’s impressive.

There’s so many more steps to reach “Hello World” in any of today’s major languages. There’s so much more distraction too. Back when I had no Internet, no video games, and little TV, programming was offered me the most instant gratification. If my first computer had been a MacBook Air instead of a TRS-80, six year old me would have found other things to do with his time.

To be clear, if you’re doing anything more trivial than flipping pixels, programming is way easier today than thirty years ago. But getting started is way harder. We need some low effort, low risk, high reward ways to introduce folks young and old to the magical power of programming.

There’s lots of great comments on teaching kids to code in the Hacker News discussion