When I got my C64 back in my early teens, I did what every kid back then must’ve done and put a cassette in the tape drive and typed in LOAD “” and watched the screen mesmerised by the scrolling lines of text as I waited for the game to load..
However, eventually I started looking a that blue screen and the blinking cursor and wondered what else it could do. For me I was helped on that journey of discovery from various magazines – one series in particular called INPUT.
This series didn’t have any fancy games glued to the front cover, but rather contains lines and lines of BASIC. That you had to enter.
I was hooked and after a month I decided to have a go at creating my own program. It was rather basic (pun intended) and all it did was output all the colours available on the C64, along with its name and, more importantly, that all important POKE code that went with that number…
So here I am, 30 years later – and have recreated that very same program.
For those who don’t know what this does here’s a rough breakdown
- Line 10 clears the screen
- Line 20 prints the text at cursor position 13
- Line 30 uses PETSCII codes to create an underline to create a title
- Line 40-44 print a brief description
- Line 50 beings a loop that will run 16 times, starting at 0 and then stopping after the 16th run
- Line 60 reads some data into variables A and A$ – we’ll come back to that
- Lines 70 through 80 deal with printing the values of A and A$ as well as a demo of what that colour looked like, before repeating the loop in line 90 and moving to the next colour
- lines 1000 to 1030 are DATA statements – remember line 60 where we told it to read A and A$? well that is done here – and if you look at the code, you should see a pattern – there is a paring of a number, and a word. Starting with 0 followed by “BLACK” – then “1” followed by “WHITE”.
- Each time we increase A, the READ statement on line 60 will find the corresponding number in the data lines, and then assigns the word that follows it to A$ – so on the first loop, A and A$, read “0” and “Black”, on loop 2, “1” and “White”, and so on until it gets to the end of loop with A being 15 and A$ being “Light Grey”
So when we run the program we should see this:
And that was it – that was my first foray into BASIC programming on the C64.. for little ol’ me at the time – this was impressive and I quickly grabbed a spare cassette tape, put it into my datasette, and saved it to that tape.
At that point all I could think of was – Now what do I write?