C64IntroBASIC2The course this post is about

Unit 21 is all about strings, using the commands LEN to get the length of strings, extracting parts of strings with MID$, LEFT$, and RIGHT$, converting strings to numbers with VAL, and numbers to strings with STR$. This unit contains lots of flowcharts. There’s also a program to extract surnames from full names, but I soon realised in 1984 that this program didn’t work on Dutch names such as Jan van den Heuvel, where the surname is van den Heuvel and even my Commodore 64 group leader couldn’t see a solution to that. I doubt it would work on the surname van Dyke, which is a version of van Dijk or van Dyk, either. Hungarian names usually have the surname first, so it wouldn’t work with them either. Later on, there’s a program based on a comedy sketch by Ronnie Barker, which replaces every occurrence of the letter e with the letter o in any sentence which the user inputs. Following this, there’s a program which produces anagrams or permutations of words. This may be useful for cracking codes or passwords. Later still, the author lies to the reader by saying that because the Commodore 64 can display 40 column text, that this was “as good as any other home computer and better than most”, although 40 column text was more or less standard, while the BBC Micro and Acorn Electron could display 80 column text, which I saw in shops could even be read using a TV screen.

Unit 22 is about searching and sorting, including arrays, the bubble sort, and the quick sort. There’s a program which compares prices at supermarkets, then recommends which one supermarket to go to for the lowest total price for all the items the user wants. The unit ends with a look at the concepts behind “The Game of Life”, with the problem of writing a version of this program, possibly after loading a partial program from cassette.

Unit 23 starts off with “A closer look at the Commodore 64” saying that it’s OK just to think of it as a machine that plays games that come on cassettes or plug in cartridges! What a thing to say, even though this is near the end of a programming course! It also says it’s OK not to want to know about programming! It goes on to say we’re about to delve deeper into the Commodore 64, namely by finding out more about those dreaded PEEK and POKE commands! The reader is warned that this knowledge can’t be transferred onto other computers, because on any other computers using POKE and PEEK to the same locations will have different effects. The reader is further warned that using PEEK and POKE could make the keyboard stop responding, display rubbish on the screen, or disable any BASIC commands, even LIST and RUN, but that no matter what goes wrong, users could regain control by turning the C64 off for 30 seconds, then turning it on again. This is followed by sections called “Bits Bytes and Addresses”, then “The Structure of the 64”, explaining what components make up the C64 itself, as well as a storage device such as a data recorder or disk drive. This is accompanied by a diagram of the system, as well as a diagram of the Commodore VIC-20 memory map, calling it “a machine with a one layer store”, showing how this is much simpler than the messy C64 memory map, with some locations that could be either RAM or ROM, etc. I think that most “home computers” of this era had what this unit calls “a one layer store”, as shown in INPUT magazine, to keep things simpler for their programmers. Only 48K RAM was really needed for 8 bit computers, as proven by all the software written for the Sinclair Spectrum 48K and Atari computers fitted with 48K. We then get an explanation of the C64 screen RAM, colour RAM, character bit patterns, and character codes. This is followed by a program called MONDRIAN, which uses these principles to drawn a pattern similar to artwork done by the Dutch artist Piet Mondrian (1872-1944), because this would be far too difficult to achieve in hires graphics in Commodore BASIC V2, although it would be fairly easy on the Sinclair Spectrum using PLOT and DRAW, the BBC Micro and Acorn Electron using MODE n, PLOT x,y and DRAW x,y, Atari 8 bit computers using GRAPHICS n, PLOT x,y and DRAWTO x,y, Dragon or Tandy using SCREEN n, PMODE n1,n2, PSET x,y, and LINE (x1,y2)-(x2,y2),colour, or MSX using SCREEN 2 or SCREEN 3, PSET x,y, and LINE (x1,y2)-(x2,y2),colour. This is followed by a section about the two character sets on the C64, switching between them with the C= and SHIFT keys, and defining your own characters such as the Russian Я reverse R character called yat. I was soon able to use this knowledge to define a German character set. This is one of the facilities where surprisingly Commodore BASIC V2 was no worse off than most other computers of the time, although it was easier in BBC BASIC and Amstrad’s Locomotive BASIC on the Amstrad CPC computers had the dedicated command SYMBOL ascii code,bit pattern list. This is followed up by a program to define the four Russian characters Я , З , Ы , and К , making up the word ЯЗЫК, pronounced yazuik, meaning language or tongue. Back in 1984, just changing the bit patterns in the DATA statements gave me the German characters Ä , Ö , Ü , and ß .

FINALLY, Unit 23 shows the reader a short game to load from tape, also listed in this unit, called “Wasp Shooter”! This is made up of about 136 lines of Commodore BASIC V2 with line numbers running from 1-5100. It’s probably the most advanced program in the whole course!! In this game, the player has to try and kill all the wasps before their fly spray runs out, using keyboard controls without any joystick option, because using a joystick in Commodore BASIC V2, obviously requires PEEK and POKE commands. The game is all in character graphics, though. This game contains about 37 POKE commands and it seems only one PEEK command. I think a lot of the POKE commands are just printing characters on the screen but this is still at the speed of BASIC so there’s no need. This could be done just by using PRINT AT y,x on the Spectrum, PRINT TAB(x,y) in BBC BASIC, POSITION x,y:PRINT in Atari BASIC, or LOCATE x,y:PRINT in MSX BASIC. I think the PEEK command detects whether or not there’s a bee at a certain position, but the amazing Sinclair Spectrum could do this with PRINT POINT(0,0) , colour=POINT(x,y) in BBC BASIC, or LOCATE x,y,c in Atari BASIC. After this, the reader is set a problem of trying to write their own game using the same principles, with suggestions that it could be based around shooting aliens from outer space, searching a maze with a monster chasing you, or catching randomly thrown balls. As for me, I felt lost in a whirlpool of POKE commands and certainly didn’t feel that just the one example given here prepared me to write my own, simple, character graphics based game. If there had been more than one example or even more than one unit in this course about writing this kind of game I don’t know if that would have helped much either, because Commodore BASIC V2 is crap!

That’s all for now. Another instalment in this series about “An Introduction to BASIC” will follow very soon!

Posted September 24, 2014 by C64hater in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: