AN INTRODUCTION TO BASIC: TRAMIEL TORTURE – PART 2   Leave a comment

AN INTRODUCTION TO BASIC: TRAMIEL TORTURE – PART 2

C64IntroBASIC1The Commodore 64 BASIC course in question

Before continuing with this series, I need to remind you all of the following very important and influential facts. I was told by Commodore by their C64 startup screen, their BASIC course I’m writing about here, as well as the BBC computer literacy campaign that the way to learn how to program computers was in BASIC. Machine Code definitely wasn’t a language for beginners and that you were supposed to learn how to do things in BASIC before learning how to do them in Machine Code. Unfortunately, this approach wasn’t possible on the Commodore 64 with its plethora of PEEK and POKE commands, which were needed to use the colour, graphics, and sound facilities, unless only coloured text was enough. I now know that older computers such as the Commodore KIM1 couldn’t even support BASIC due to lack of enough RAM for this language, so had to be programmed in Machine Code, but were little more than programmable calculators, much less complicated than the Commodore 64 with its VIC-II graphics and SID sound chips.

Re reading the Commodore 64 course “An Introduction to BASIC – Part 1” tells me that Part 1 is made up of 15 units or chapters, with the first program being “TESTCARD”, which somehow enables the user to set up their TV properly. It also includes full details of how to set up and plug in the C64. This particular course or this version of it was published by Commodore UK, because most mentions of money are prefixed with the Pound sign £ and one clue to when it was written is given by a chart showing support or votes cast for various political parties, including the SDP (Social Democratic Party).

Experiment 2.3 on page 13 tells the reader how to create a screen full of graphics characters to keep them interested. This is actually be the only type of graphics covered in Part 1, because hires graphics of 160×200 or 320×200 pixels requires a user of Commodore BASIC V2 to PEEK and POKE themselves and the C64 half to death!

Unit 3 introduces coloured text using the CTRL key and the C= key in combination with the numbered keys, as well as changing the screen background and border colours with the first two dreaded POKE commands to locations 53280 and 53281, followed by any number from 0-15. At this stage, lucky Sinclair Spectrum users would have learnt the commands BORDER n and PAPER n:CLS, lucky Atari users would have learnt about SETCOLOR n,n,n while lucky Dragon and Tandy users would have learnt CLSn, and lucky MSX users would have learnt COLOR n,n,n. After this, the book tries to keep readers interested by showing them how they can create pictures of national flags, just by using graphics characters in various colours, as well as inverse or “reverse field” video as they put it. The unit admits that the Union Jack flag is “formidably difficult to draw”, but fails to point out that this is because Commodore BASIC V2 readers studying this course will be more or less stuck with character graphics, while users of other computers could draw it using hires graphics commands, such as DRAW, DRAWTO, LINE, PLOT, PSET, and PAINT.

Units 4 and 5 seem to be no more than just short explanations about using the RETURN key, PRINT commands, keeping scores of a football match, variables and how to assign them, as well as creating programs, instead of just typing direct commands, creating loops and building up strings.

Unit 6 starts off with some advice aimed at disk users only on how to organise their files. After this the reader learns about a program to generate random nonsensical sentences, as well as how to list parts of the program, using the REM command to write comments and how to edit programs. It then goes on to explain in which lines of DATA to put particular types of words for the program to generate sentences that make any kind of sense. After this the reader is told how to SAVE programs to tape or disk and what precautions to take while doing this.

Unit 7 is about IF…THEN and STOP. Of course, I was keen to get through all this, which I thought would lead to me composing some music, then using it in my own programs. It goes on to demonstrate currency conversion and there’s an exercise where the reader is supposed to write a program to print a pattern of asterisks. There’s also an anachronistic program designed to convert between Celsius and Fahrenheit. This is pointless, because Fahrenheit was obsolete even in 1982 when this book was published, so no one should have been encouraged to use it. Unfortunately, lots of other authors of books about C programming, Java, Javascript, etc later made the same mistake. This program should have been replaced by a program to print phrases such as “The Celsius System”, “0 degrees is freezing”, “10 degrees is cold”, “17 degrees is neither hot nor cold”, “20 degrees is fine”, “25 degrees is warm”, “30 degrees is hot”, “35 degrees is a heatwave”, “40 degrees is when people are dropping like flies”, “100 degrees is the boiling point of water”. After this there could have been a multiple choice quiz about the effects of each of these temperatures.

Unit 8 starts with an exercise in tracing errors in Commodore BASIC V2 programs. I think this shows the need for a special command to help do this, such as TRON, TRAP, or some automatic syntax error detection, as with Atari BASIC and Commodore BASIC 3.5. After this, there’s another anachronistic program to convert between Gallons and Litres, although Gallons were already obsolete when this book was written.

Unit 9 starts by showing people how to use the C64 quotes mode with all the tedium of embedding control codes for coloured text into PRINT statements, while Sinclair Spectrum users could just use PEN n, Atari users could use COLOR n, and MSX users could also use COLOR n. We’re also introduced to using the dreaded cursor control codes, while Sinclair Spectrum users could just use PRINT AT y,x , BBC BASIC users could use PRINT TAB(x,y), Atari users could use POSITION x,y:PRINT and MSX users could use LOCATE x,y:PRINT. This is followed by an explanation of how to time things or tell the time using TI$. Unit 9 ends with a short program to draw the French flag using character graphics, including two POKE commands for screen and border colours, and lots of embedded control codes in PRINT commands. The reader is then encouraged to write a program to draw another flag, but also warned to avoid any flags with diagonal lines!

Unit 10 really doesn’t teach the reader anything much at all. It starts by telling people that it’s a good idea to ask a user for an exchange rate before using the earlier currency conversion program, then shows how to do that with PRINT and INPUT commands. Of course, this wouldn’t be necessary with currencies that had fixed exchange rates, which were possibly pegged to another currency. It also points out the difference between numbers and strings. After this, the reader is encouraged to write a very discriminatory program that assumes the user is a married man, then prints out his full name and his wife’s full name! There’s still no explanation of how to program sound or hires graphics, though.

Unit 11 starts by saying that so far the only commands which can be used within programs this course has taught are PRINT, LET (optional in Commodore BASIC V2 and most other BASICs), GOTO, IF, INPUT, STOP, and POKE. This is followed by a program which tries to encourage people to not only get married, but also tells them exactly how old their partner should be, according to some archaic code! There’s also the first flowchart in the book, based around this program and an explanation of the shapes used in flowcharts. I get the impression that almost the whole of the course thus far is just an edited version of a course previously published for the Commodore PET. After this, there’s a section on error checking, which points out that if the user types any answer except “MALE”, such as “M” or “BOY”, the program assumes they’re female and tells them to look for a male partner, which it describes as “idiotic”. It also explains the concept of checking for minimum and maximum ages as well as showing how to set them. Finally, the user is encouraged to create a flowchart and write a program to calculate house taxes or rates for a fictitious country called Ruritania, based on the features each house was made up of. This country was mentioned in various stories as in central or eastern Europe, German speaking and the scene for the story “The Prisoner of Zenda”.

Unit 12 tells us more about FOR…NEXT loops, as well as keeping scores of sporting events and working out the prices of buying lots of postage stamps of different values in bulk. By this stage, I think the suspense of when I was going to be able to program any hires graphics or sound was killing me!

Unit 13 finally gets on to the subject of using the C64’s SID sound chip! There’s a program called “SOUND DEMO”, which the user can load from tape, that produces various sound effects, including a heartbeat, a pip, and a raspberry. Users were told they could copy the relevant program lines for these sounds into their own programs and reuse them. There’s also a chart listing the parameters to create some more sound effects, such as a harp, a ship’s siren, an explosion, a jet passing, and a trumpet. Unfortunately, none of these sounds, with the possible exception of a trumpet, were any use to me in making electronic music sounding anything like Electro Funk, Rap/Hip Hop, Japanese Technopop, Depeche Mode, or a mixture of all of these, but it looked like a start. This article introduces us to a whole series of dreaded 5 digit locations to POKE with any number from 0 to 255, including calculations instead of just numbers, as well as making use of the AND command. I think this may have been when I started to realise why anyone would want to buy a special language for programming music, such as “Synthy”, as reviewed in “Your 64” magazine Issue No. 1. Of course, music like this has been created on the C64, but I doubt if it was in Commodore BASIC V2, and I don’t know how this was done.

If Commodore had made cars it was like they thought “Here’s our fantastic new car which can do things that most other cars can’t do. We haven’t provided the controls drivers need to make our new car do all these things, we’ve reused the controls we first used five years ago, but if they’re clever enough, they’ll work out how to use these new facilities. If not, then there’s no need to worry, because we’ll provide this as an optional extra, and some OTHER company is also bound to bring out an up to date replacement set of controls which enable drivers to use the new facilities on OUR car”, but they never bothered to tell potential buyers of their new car about these limitations.

Returning to the subject of making music, you can hear a Depeche Mode compilation created with the C64, but probably not in Commodore BASIC V2, on http://www.youtube.com/watch?v=SoAYge8Jzd4

Unit 14 takes a break from POKE commands to start talking about balancing a bank account. After this, it moves on to simulating tossing a coin, then lists 8 POKE commands which can be added to this program to produce sound effects. Unit 14 ends with a problem about working out a type of sales tax on clocks according to a certain formula, depending on the price of the clocks themselves.

Unit 15 claims to consist of routines which could be useful in games, the very thing most would be Commodore 64 programmers were probably interested in producing to make some money! First of all, there’s a program to time the user’s reaction, another one to simulate throwing dice, and a problem given to be solved is to write a program to simulate any game of chance, such as “craps, pontoon, etc”, preferably with graphics characters for dice, suits of cards, etc. There’s a footnote that Appendix B contains a listing for a “craps” program. I think this is quite a suitable choice to program because Commodore BASIC V2 is crap!

The Appendix congratulates the reader for having got to the end and goes on to talk about mathematical functions. There are also program listings of solutions to the problems set in each of the units.

After all of this programming, limited to programming text based applications, drawing character graphics screens of national flags and just a handful of sound effects, it was time for me to progress to “An Introduction to BASIC – Part 2”, where I was doomed to find out just how crappy Commodore BASIC V2 is and how I’d bought a pig in a POKE!

That’s all for now! Look forward to the next instalment in this series, whch will be about Part 2 of the course “An Introduction to BASIC” by Commodore.

Advertisements

Posted September 19, 2014 by C64hater in Uncategorized

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: