Hacker News new | past | comments | ask | show | jobs | submit login
Programming in BASIC on the TRS-80 (baugues.com)
64 points by gregorymichael on Dec 29, 2015 | hide | past | favorite | 41 comments

Ahhh, a most timely article, from my perspective. I've recently being writing a computer game for my first computer, which was a contemporary of the trash-80 (http://www.compucolor.org/emu/ccemu.html). The guy that made the emulator was working for NVIDIA last time I talked to him, and he thoughtfully provided most of the programming manuals for Compucolor II on the site.

Why? Well I was mostly expired from a story in "Surely You're Joking, Mr Feynman" where he talks about being bored with physics, and he gets back into it by playing around with toy problems that he had to work out from first principles (the way that the wobble in a spinning plate precesses around the axis). So I've started programming in an emulator of this old 1980s computer. It seems to be working for me too - I'm finding myself to be much more engaged in my day job since I've started.

Same here, that growing feeling that we have lost something during the 90's when home-computers were replaced by 'business PCs' drove me to write an emulator to preserve some of the magic in the past few months: http://floooh.github.io/virtualkc/, here's how to write a 'Hello World!' program on it in BASIC, FORTH, machine code and assembler: http://floooh.github.io/virtualkc/p035_helloworld.html

In my opinion, the RaspberryPi is the closest thing to a home-computer we have today, it encourages to learn, experiment and create things, it would be nice if it had a simpler, more home-computer-like standard operating system though. Linux (or any other current desktop or mobile OS) is simply too complex and scary. In contrast to that, smartphones and tablets are closed ecosystems optimized for consumption. I don't see how these closed-off platforms encourage kids to explore and learn to create something on their own.

The RISC OS people have produced a custom ROM that runs only BBC Basic at boot: https://www.riscosopen.org/content/sales/risc-os-pico

There's also some stuff here on the RPi site on other BASIC options: https://www.raspberrypi.org/blog/celebrating-50-years-of-bas...

I would actually love to re-case an RPi in it's own retro keyboard unit and turn it into a proper TV-computer of old. Alas I don't really have anything in the way of that kind of solder/hardware skills.

EDIT: Actually, following some of my own links, it looks like someone's beat me to it: http://www.fuze.co.uk/

The second link to the docs really degrades poorly on mobile. Almost impossible to read.

The REPL still lives! You need Racket. There's a lot of great programs now using Racket/WeScheme in education for younger kids.

Another project though I think really seems to be gunning for that old-school feel with some modern conveniences is PICO-8, which is a retro Lua VM meant mainly for designing games, complete with REPL, built in editors, and even PEEK and POKE. :D

To be honest though, I also kinda wonder how well you'd do just plunking a kid down in front of one of those older machines. Especially the Tandy ones. The Color Computer came with an amazing manual, that's pretty much what got me into programming all on my own as a kid.

As a fun side note, here's a Lisp in 1.5 pages of Tandy Color Basic: https://twitter.com/J_Arcane/status/668545293164683264

Pretty sure that is Randy Beer's model 1 and model 3 lisp from 80 micro, part of a multi article series beginning March of '83, see page 176 or so of:


It may very well run on a coco unchanged (they were very close) or someone modified it to work on a coco without changing the version remarks. I'm not motivated enough to do a biological meat powered DIFF between the tweet and the magazine.

I tried typing it in (in probably summer of 83), LOL thats not happening without typos, ended up convincing my Dad to get the load-80 for that month (essentially load 80 was a cassette tape delivered monthly with the code from the magazine so you don't have to type stuff in). Later Load-80 was a floppy disk. The future being very unevenly distributed it was at least half a decade before IBM PC clone users finally had "big blue disk" (which I enjoyed monthly)

It was my first experience with a LISP. I would advise that LISP and magazine series were very interesting but highly non-optimal way to introduce a roughly ten year old kid to LISP.

From memory by the third month or so of the series he had a crude database set up and implemented MATCH. Performance was slow, the REPL took maybe a minute to think about complicated things.

Its fun to page thru the ads. Dynamic ram had dropped below a buck per kilobyte. 80 micro was going thru a computer science phase, interesting to read the APL article a few pages later.

Edited to add, this is Randy Beer's home page today:


To give proper credit, that's actually a port of the Model I/III Lisp to the CoCo, as printed in Hot Coco magazine.

I'm still idle in a few bits of the CoCo scene and someone dug it up a while back so I snapped the code just because I was impressed that 1) it was pulled off in BASIC, and 2) in so little space.

Probably indeed not the best introduction to Lisp. I do wish I had had some intro to Lisp, or perhaps more ideally Scheme, back when I was that young though. I honestly believe I'd've stuck with programming if I'd discovered Lisp & FP when I was just starting to look beyond BASIC/QBasic. Instead all I saw was everyone telling me I should learn Assembly or C if I wanted to be a "real programmer", while Python and JavaScript were sneered at as mere "scripting languages," save for those like Perl that were intelligible only to other Perl hackers.

Once Java came along and I took two glances at that, I just gave up on programming for another decade, resigned to the idea that coding for a living was nothing more than a life of tedium and irritation.

I'm still not always sure I was wrong.

Another vote for Racket. I used it in an after school program [0] I once taught and it was quite easy for the kids to pick up.

[0] http://bootstrapworld.org

I've had surprising luck with doing simple Logo with my daughter (4-1/2). Actually I feel a bit guilty as she'd like to do more. So far we're just doing drawing (no loops or anything), but with all the tedium of finding the keys and getting the commands just right. I helped her make one routine that randomly changes the color, which she likes. (She named the routine after herself – kids don't need to stress over proper naming ;)

But I really wish there was material to get her started. I haven't found any introductory Logo books – finding an old book and updating it to a new dialect would be fine, but I'd appreciate some structure and thoughtfulness about the order of introduction. I probably should print out some primers too, so I don't have to remind her of RT and LT and FD every time.

I've been using this Logo interpreter: http://www.calormen.com/jslogo/ – it does all the traditional stuff pretty well, but it could also use this same sense of structure and content. A kid should be able to sit down and think: here's a thing I could try to do. And here's all the tools I need to do it. Really that's just content.

On the fancy side Hopscotch has been really impressive (significantly better than Scratch), but being iPad-only has been a problem. That said, my daughter still appreciates Logo even compared to something fancy.

(One important thing about my daughter's interest: I talk to her in detail about what I do. The importance of this occurred to me during a parent education event I was at, where they noted: when you ask your kid how their day was and they disappointingly say "fine", have you been telling them how your day was? Parents need to demonstrate that kind of storytelling and engagement, and in my experience kids suck it up more than you'd expect, even stories about seemingly boring work stuff.)

I, too, wrote my first programs on a trash-80, sitting in the store and saving the things to a high-performance cassette drive ;)

But I no longer think that's the thing...the point back then was, to me at least, "here is something big that no one else I know is doing but its so obviously very cool, empowering, and in a way, secret".

Nowadays, with so many devices intruding on every aspect of our lives, there is just very little of that secret anymore, and while of course its hard for me to know how modern tech is affecting kids nowadays, I just cannot imagine they can feel the same way as I did, sitting alone in a Radio Shack in 1978, writing BASIC programs in wonderment.

I have just started teaching my daughter to program. I would certainly agree that starting off is not nearly as easy as it used to be.

Kids love interactive and graphical environments and trying to do this in any mainstream language quickly becomes non trivial.

I chose Python and pygame but it gets confusing for the child to see things like:

   from pygame.locals import *

   for event in pygame.event.get():
     if event.type == QUIT:

   size = (120, 640)
   screen = pygame.display.set_mode(size)   
One can tell her to ignore these and just accept they are necessary but it does cause issues and looks very intimidating to a beginner.

processing may be a nice alternative. very small boilerplate to have a graphical/interactive program running, and a cute ide to keep your sketches. https://processing.org/

Love your username.

It's as easy as it used to be because these old computers still work well and are relatively inexpensive. I own and keep operational both an Apple IIc and a Commodore 64 and my children have easy access to them.

For a beginner I'd say Pascal is more approachable than Python and even BASIC. Free Pascal 3.0 (http://www.freepascal.org/) runs on lots of platforms and Lazarus (http://www.lazarus-ide.org/) gives you a visual development environment.

Pascal was the third language I learned growing up (right after Commodore BASIC and assembly). I highly recommend Pascal even today. It's a simple, yet powerful learning language.

I had really good luck with old school Visual Basic 6 teaching my daughter to program. It was already obsolete but still ran at that time.

It was far easier and more straight forward to get something done in that than any other language. It's probably still the case.

if you want to stick with Python, try looking at the turtle library (https://docs.python.org/3.5/library/turtle.html). Right in the documentation is a 10 line program that creates a yellow and red starburst. It even supports entering the commands in the REPL so she can see the commands running as they are entered.

Scratch is the only thing I've gotten my kids interested in: https://scratch.mit.edu/

Unfortunately, it didn't last long.

Very happy memories. I spent so much time in Radio Shack when I was a teenager that it started to feel like home. Friend of mine wrote the first machine-language program I ever saw, "Mountain Mission". You basically controlled the elevation of a cannon and it shot at things on a mountain. Radio Shack put it in their software catalog. I think he made several hundred bucks.

I feel sorry for folks learning to code today. I was thinking about creating a course to teach folks to program, and it occurred to me that a more useful course might be along the lines of "How to set up and run 'hello world' in various configurations" You could have a section on each O/S, and then exercises would cover the top 5 or 6 languages.

Microcomputer BASIC is what inspired Glass Table for Gambit Scheme: https://github.com/bitwize/glasstable

It's basically a development environment you operate from the REPL. Every time you define something, GT memorizes your definition; you can then save this "workspace" of definitions to a program file or load prior work into the workspace.

It's a shame that there are almost no programming environments that work the way BASIC did, where the command language for the development toolset is the same as the programming language itself.

Strictly speaking, most Common Lisps can do this too out of the box. It's how "compiling" even works under most CL implementations.

Neat article, I miss the simplicity of the old machines as well.

I teach a weekend programming class for middle schoolers and the setup is a real pain. There's just too much stuff that gets in the way of learning to code. Our setup is Python 3 with Pycharm EDU2 installed on each child's laptop. for some lessons we have a Raspberry Pi (gopigo and minecraft) that the kids can control remotely using Python.

We tried using Idle but it crashes too much and is a bit of a pain to navigate with the multi-window display. Pycharm EDU is pretty good, but I haven't had much luck using it with lessons. The lessons take a lot of time to setup and sometimes just crash Pycharm or become unusable, holding up class. So we use Pycharm EDU just as an IDE.

I thought of using something remote like Koding or codio (I really like these options), but we have some lessons that require us to be local so we can reach out to our bot and rpi. A more lightweight IDE would be nice, something with nice debug capability like Pycharm EDU. These kids are sporting some really old laptops, hammy downs from older siblings mostly. Ideas welcome.

>> I can’t help but feel a little 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.

Pop open Chrome and you can write almost the same program from that magazine in Javascript. You'll have to figure out how to do the input, though.

Magazines like Linux Format even have multi-page coding tutorials for different languages all the time.


>> There’s so many more steps to reach “Hello World” in any of today’s major languages

>> There’s also so much more distraction. With no Internet, no video games

There were TONS of games for the TRS-80. I used to sit in Radio Shack as a kid playing them all day long. You didn't have the Internet back then but you could dial into BBS's. That was a real time-waster.

Basic is still alive and well, providing a simple programming environment for beginners.

It has returned to being a hobbyist scene, just like in the 80s. Basic compilers are written by hobbyists for hobbyists.

For native applications my favourite is PureBasic: http://www.purebasic.com/

It's a nice variant that compiles to a tiny, dependency free executables for Windows, Linux and OSX.

It also provides a nice gateway to the underlying assembler. http://www.purebasic.com/documentation/reference/inlinedasm....

It also has an online version called Spider Basic that compiles to JavaScript: http://www.spiderbasic.com/

Monkey X is by far the best BASIC compiler available to date. Purebasic is still good for GUI stuff, but it's not OOP like Monkey X. And Monkey X can support native GUIs if a library or wrapper were created (and may already exist).

Hmm. Maybe I should take another look at Purebasic then. "Not OOP" is a selling point for me, and rare as hen's teeth where GUI software is concerned.

> rare as hen's teeth where GUI software is concerned.

You can still write native Win32 and Xlib apps in C not to mention all of the languages where OOP is an optional bolt-on.

For an Applesoft BASIC interpreter, check out http://discorunner.com

It comes with close to a thousand BASIC listings.

The pixels are rendered in OpenGL 3D and you can play original games in a 3D perspective.

It's not about BASIC though - it really is about the fact that computers literally booted into a REPL. That REPL being a BASIC REPL was probably something that set people back - I remember having a really hard time grokking how the computer knew in what order Pascal programmes had to be executed.

I remember typing in games on the TI-99/4A without understanding how to edit a program in TI Basic. If I mistyped I couldn't go back and edit the line so was screwed. With some guidance back in the day I would have had a lot more fun.

I remember as a teenager in the mid 2000s my sweet old grandmother gave me this book she found lying around because she didn't understand it but she knows I'm into "those computer things". It was the manual that came with the TRS 80 explaining how to use BASIC. It came with some example programs. It was an amusing glimpse into a bygone era but ultimately I declared the book to be hopelessly outdated trash. I kind of wish I had kept it.

Was it this one?


My introduction to programming was this via this book in the back of my sixth grade math class in 1982. Been hooked ever since.

That looks right.

You might be able to find it here: http://www.colorcomputerarchive.com/

It's a huge repository of Color Computer and TRS-80 software, books and magazines.

Somewhere around 1991 or so we got a 386SX with DOS and Q-BASIC. Here I was stuck with all these Apple II and Commodore books from the library, most of the games wouldn't work because the peeks and pokes and functions that weren't available.

I later found some GW-BASIC books which helped a little bit, but I wish the library had some newer stuff. C compilers were $500 back then so BASIC was all I had.

Wow nostalgia taking me back to learning level 1 basic on a TRS-80 Model I at the Radio Shack store.

But the ease of learning BASIC is alive and well today, you can write a PHP program with as much ease (then you can learn to write better code later but the point is the barrier to entry is very very low).

You can even run PHP as an interpreter in a DOS-like command window in Windows, very easy.

  POKE 16407, 43
This wrote a value into an absolute memory address. 16407 was one of the registers of the video controller. Poking various values into it would cause various funky things to happen on screen. 43 was one of the best values to put in there, but others were interesting too.

Sometimes you had to reboot the machine to recover, though...

My second computer (after the Timex Sinclair 1000) was a TRS-80 MC-10. I liked that it had the same BASIC commands mapped to keys like the TS/1000 and so it was a great upgrade into a computer that had colour and sound... and since I was 6 the small keyboard was okay =)

The first computer I had access to and learned to program on :)

Oh, this is fun. Nice piece.

Time to turn my Apple 2e on and play for a while.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact