Retrochallenge 2014 Summer – Atari Strings and Cassette Storage

Having work with Microsoft BASIC most of the time, I have the clear idea how strings work in BASIC, but few moments after starting to work with Atari BASIC my world feel apart!

First, in Atari BASIC you have to declare string variables before using it, giving the maximum size that string will need and for that you have to use the syntax:

[code]DIM A$(10)[/code]

When I first saw that syntax I thought “oh, it is declaring an array of 10 strings” but in fact, it declares a single string with a length of 10 characters. As far I can see, there is no array in Atari BASIC and to use something similar you have to manipulate a big string as if it is an array of strings using the index. There are several places on internet with great explanations about Atari strings, so here I just want to point few things:

  • DIM A$(10) – Declares a string with 10 characters
  • PRINT A$(2,5) – Prints out a string containing the characters from 2 to 5 – the equivalent in MS BASIC would be PRINT MID$(A$,2,3)
  • A$(2) = “AWESOME” will add the “AWESOME” string from the position 2 onwards.

This all is actually pretty cool and way more versatile than the Microsoft way to do it, in my opinion.

The Cassette

One important part of the Retrochallenge is only use the actual computer and a cassette tape as storage unit. This alone turned out to be a very hard thing to do, because when I am learning something new, I like to keep
saving code snapshots with small tests all the time, and to manage several small programs in cassette is very difficult.

The main game itself is being saved in two different tapes to be safe, but the small programs where being saved in one of them, after the main program. I decided to give some “tape counters” room between the main program and the tests. For example, the game is recorded at position (tape-counter) zero, and the first test program at position 30. I didn’t realize that 30 is too little and my main program is quickly reaching this mark as it grows.

I will keep following this idea where I determine fixed gaps to save programs, but I will try to give way more room between the end of one and the beginning of the other. For that it is mandatory to keep a up to date directory on paper! That is so old school!

Author: Paulo Garcia

2 thoughts on “Retrochallenge 2014 Summer – Atari Strings and Cassette Storage

  1. Wow! I never checked string handling in Atari BASIC but it seems VERY much alike how Sinclair Spectrum BASIC does it – from the DIM of string length to substrings A$(2 TO 5).

    1. Yes, this is a surprise for me that never worked with Atari before. From Wikipedia: “The result was a rather different version of BASIC, known as ATARI BASIC. In particular, the new BASIC dealt with character strings more like Data General’s BASIC than Microsoft’s, Microsoft used strings similar to those from DEC BASIC.” – So I assume Spectrum’s BASIC had followed the same the Data General’s approach.

Leave a Reply

Your email address will not be published. Required fields are marked *