I saw this nice post about learning to write programs on a TRS-80 computer.
I noted a number of comments on an aggregator site each suggesting using modern programming languages with interactive environments as an analogue to those days. While I agree that the interactive nature of BASIC made it approachable by the novice, I believe that the simplicity of the environment itself ( a self-contained, line-number-based editor ) and the spartan nature of the BASIC implementations of the 70’s and 80’s were also factors that allowed people to learn to code.
It’s fortunate that we have some BASIC implementations around that can still use the familiar 8-bit BASIC syntax. One of these is called Chipmunk BASIC. The author is programmer Ron Nicholson who worked for Apple and Amiga (among other prominent tech companies. ) Ron is currently an iOS developer.
One can download Chipmunk BASIC for Windows or for OS/X. For this post, I’ll be using the Windows version. I have been meaning to check out the newest OS/X version, but I just haven’t gotten around to it. Here’s the link to the Chipmunk BASIC area on Ron’s web site:
You’ll need to download the Windows version ( the one that states that it is for Windows 2000/XP). Unzip the files to a folder. Find that folder and click on the chipmunkbasic executable file ( the one with the Chipmunk icon ).
You should see a prompt like this:
Let’s type in our first program. We’ll print the numbers 1 through 10 using a “for-next loop.” Let’s start by typing in the following line:
10 for x = 1 to 10
Press ENTER at the end of the line.
Let’s now continue entering the rest of the program.
20 print x 30 next x
Now, let’s execute the program by typing in the word “run” followed by the ENTER key:
Let’s clear the screen by typing in the following:
Now, let’s look at the program we’ve entered by typing in “list” and ENTER:
The “new” command erases the program currently in memory. If we enter “new” and then enter “list”, you’ll see that no program listing is displayed. We erased it with the “new” command.
Let’s clear the screen with “cls”. Let’s type in “new” again ( in case you’ve tinkered a bit since the last “new” ) and let’s enter another simple program. This one will ask you for your first name, store your response in the string variable n$, and will then use n$ to greet you by the name you entered.
new 10 print "What's your first name"; 20 input n$ 30 print "Hello there, " ; n$ ; "!"
Let’s run the above code:
If we want to save this program for later use, we can use the “save” command.
This saves your BASIC program as a plain text file in the folder where you had installed Chipmunk BASIC. I’m afraid that Chipmunk BASIC doesn’t have a direct command for seeing the contents of the directory, but you can issue the Windows command-prompt’s “dir” command by using the “sys()” function:
Let’s erase the current program with a “new” followed by a “list” to make sure it’s gone:
Now, let’s re-load “greeting.bas”:
To exit Chipmunk BASIC, simply type “exit” and ENTER.
You’ll want to read through the accompanying manual BASIC_MANUAL.TXT which walks through Chipmunk BASIC’s commands, operators, and functions ( including features for opening the graphics screen and plotting points, lines, …etc. )
I think that the approach that classical BASIC takes is very friendly to the newcomer. I hope you have fun with this nice implementation of BASIC.