Introduction To SmartBASIC
Lesson Three
by Charles A. Smith


Here is the third part of the series of lessons on SmartBASIC programming by our own Charles Smith. BDC.

Whatever you want to do on a computer (except use a mouse or a joystick) is going to involve typing. The better your typing skills the less frustrating the task of finding the right keys to tell ADAM what to do. So don't get discouraged - just keep at it. Two fingers on each hand is all I can manage but that gives me about 35 words a minute.

At this point you may want to dig out the SmartBASIC Manual that came with the ADAM. In my view it's not too well presented and is far from being a complete text on BASIC but you should be able to learn a lot from it after what you've covered here. There is really no end to the programming possibilities at your finger tips. I suggest you look at these areas-

 Arithmetic order of operations, p 29,30

 String variables, p 34,36

 IF / THEN commands, p 48,53

 DATA / READ commands, p 60,70

 FOR / NEXT commands, p 71,81

 Low resolution GRaphics, p 112,116

Not much is given on Hi Resolution GRaphics, p A-33, A-36 but you can have some fun with it. Hi-Res is the basis for Arcade games and other picture and action programs.

Something I have never seen in the Instruction books is what I call Program Housekeeping; one example - I always start a program by clearing the screen and giving it a nice neat title-

 ] 10 HOME : INVERSE

HOME clears the screen, INVERSE says make black letters on a white background. (Unless you have a colour-modified version of SmartBASIC.)



 ] 20 ?"**********************"
 ] 30 ?"*                    *"
 ] 40 ?"*    Program Title   *"
 ] 50 ?"*                    *"
 ] 60 ?"**********************"
 ] 70 NORMAL
 ] RUN


Line 70 returns the text back to white on black, (or your standard screen colours.)

Another trick that makes good programming sense is the REM statement-

 ]300 GOSUB 5000 REM April Schedule

Line 300 begins with a command to GO to a SUBroutine which in this case is an April Schedule of some sort. REM is not a program command and ADAM dutifully ignores it. It is simply a convenient REMinder to the programmer as to what the Subroutine at Line 5000 was all about. This can be very helpful in reviewing or changing a program at a later date.

If you are typing a long program it's smart to SAVE it from time to time - possible power failure - ADAM forgets very quickly when turned off. Every time you add more to a previously SAVEd program give it a slightly different name or ADAM will store the same name twice. Delete the old one if you want by typing DELETE followed by the old name.

Now and then ADAM will signal that you have typed an ERROR. That's something that he just can't handle. A popular one is SYNTAX ERROR. Look and you'll probably find the error (I have yet to win an argument with a computer on that subject). At other times ADAM will reprint your faulty Line with a statement below telling you he expected something else. Very helpful - the APPLE II doesn't have that feature.

There are, of course, many other areas to cover but the foregoing should be enough either to whet your appetite or turn you off forever against BASIC programming. I hope it is the former - best of luck.

Charles.

EDITOR'S NOTE.
I have a feeling that the following short program was intended to be printed with Lesson 2, which dealt with graphics. My apologies if that was the case. Better late than never. BDC.WC
SMARTBASIC PROGRAM LISTING.

RANDOMLINE

BY CHARLES A. SMITH.wA
 10 GR
 20 COLOR =INT(RND(1)*16)
 30 x=INT(RND(1)*40)
 40 y=INT(RND(1)*40)
 50 HLIN 0, x AT y
 60 COLOR =INT(RND(1)*16)
 70 VLIN 0, y AT x
 80 GOTO 20


 

Back to Top