Programming the Atari with BASIC
I mentioned in an earlier post that I learned to program on my Atari 400 and 800XL, starting with Atari BASIC.
Compared to other BASICs of that era, Atari BASIC was a little odd. Perhaps the biggest oddity was its string support. In other BASICs, you created a string by putting $ at the end of the variable name. So you could write something like this1:
10 HELLO$=”Hello, World”
Generally, strings had a maximum of 255 characters. In those BASICs, if you wanted a string array you would initialize it like any other array. To create a string array with 10 elements:
10 DIM NAMES$(10)
Atari BASIC treated strings more like arrays of characters. To create a string you had to initialize it like this:
10 DIM HELLO$(20):HELLO$=”Hello, World”
The size indicated the maximum number of characters you could have in the string. The limit could be as high as your free memory, maxing out around 32K I believe.
This made it tricky to convert BASIC programs from other systems to Atari BASIC because if there were any string arrays you had to come up with a workaround. This usually involved creating a large string and using parts of the large string to store substrings. So if you wanted to replicate the NAMES$ array from above you would do this:
10 DIM NAMES$(10*50)
20 POS=1:NAMES$(50*(POS-1)+1, 50)=”Paul”
30 POS=2:NAMES$(50*(POS-1)+1, 50)=”Lucas”
The above code reserved 50 characters for each item in the string array2. It then assigned the string value to the appropriate part of the larger string. It was tedious and error-prone.
Atari BASIC did have a couple cool and unique (I think) features, though. When you pressed return on a line, it would immediately check for syntax errors. Most other BASICs would only check for errors when you did a RUN.
In addition, you could use variables with GOTO and GOSUB to make your code slightly more readable. So instead of writing:
10 GOTO 21000
You could do this:
10 INIT=21000:GOTO INIT
Thanks for reading Goto 10! Subscribe for free to receive new posts and support my work.
I wrote a lot of programs in Atari BASIC. Some were pretty simple, like the one I shared earlier. One of the first “big” programs I wrote was called “HI CARD WINS” and it was a simple game of war. It was overlong and used random numbers instead of attempting to simulate a single deck of cards, but I was only 14. I’ll be highlighting some of these programs in future posts.
At some point we got the OSS BASIC XE cartridge which fixed these issues and added many more features. I really liked it, but it was not practical to share programs made with it because so few people had it. I no longer have BASIC XE as I sold the one I had a long time ago. Recently I was able to pick up its predecessor, OSS BASIC XL (in the bright orange cartridge) and was able to use it to type in a simple BASIC XE game I had written (and still had as a printout3).
I called the game Snowblower and the goal was to use a snowblower to clear snow out of your driveway while a strange-looking snowman chased you around. Periodically a snowmobile would race across the screen and throw snow back in the driveway.
This is the printout of the original, unfinished game. It is unfinished because it did not keep score, could end rather abruptly if the snowman touched you and generally was too hard. It fit on one page, though!
The printout above is for the BASIC XE version which didn’t quite work with BASIC XL. I think I had to change the Hitclr command on line 130, at least.
You can see that BASIC XL/XE allows lowercase characters, which even if you didn’t type it that way, got converted, making things easier to read, I think.
Here is a picture of the game:
Below are copies of my original design sketch of the game, some values for the sprite and some initial code, all of which was probably done during study hall or a boring class:
Soon after BASIC XE was released, Turbo BASIC XL was released as public domain through a German computer magazine. This was a disk-based BASIC that was compatible with Atari BASIC, but also added a lot more features. Since it was free to distribute it became much more popular. It even had a compiler!
There was also a Microsoft BASIC that was released for Atari, but I never used it. It would have had the benefit of being more compatible, to some extent, with BASICs on other platforms, but I don’t believe it ended up being all that popular.
Other popular languages for the Atari were assembly, Action! (also by OSS) and, for me at least, Pascal. I’ll talk a bit about those later.
Read More on Goto 10
Is this your first Goto 10 post? If so, check out others at goto10.substack.com. Other posts you might like:
Thanks for reading Goto 10! Subscribe for free to get new posts as soon as they are published!
Code was generally written in all UPPERCASE with BASIC back then. With Atari BASIC it was a syntax error if you used lowercase characters.
Apologies if the above code is not 100% correct. I’m going from memory here.
I still have a fair amount of printouts of various things I wrote, which I’ll be sharing over time here.