Skip to content

Beginning with BASIC

(PAC Editor’s Note: I misplaced the newsletter that we got this article from, so all we can do is credit the author. My apologies to the editor of whatever newsletter this came from.)

🕹️ Note from the editors at Atari Basics: This program was written by William R. Morrison, a teacher at Curtis Jr. High School in Sudbury, Massachusetts. It was originally featured in The Best of Creative Computing Volume 1 (published 1976).

The following program and accompanying assignments have been used in my classes to teach beginning BASIC programing to high school students for a few years. There is no one set of assignments that will teach BASIC best, but these seem to work well for most students.

This program can also serve as a self-teaching device for beginners and provides ways to teach simple math. My only regret about this approach to learning BASIC is the emphasis on math, I think that when people first learn programing in a math atmosphere, they may feel that they must be a math whiz to be successful. With that possible shortcoming in mind, here is the program and the assignments.

Cover of The Best of Creative Computing, Volume 1, edited by David H. Ahl, featuring a pixelated image of Mr. Spock from Star Trek, showcasing early computer-generated art.

The Program

					5  DIM A$(3):REM DIMENSION ATARI STRINGS  
10 PRINT "THIS IS AN ADDITION GAME"  
20 PRINT "ENTER A NUMBER"  
30 INPUT A  
40 PRINT "ENTER A SECOND NUMBER"  
50 INPUT B  
60 C=A+B  
70 PRINT "WHAT IS THE SUM OF ";A;"+";B;"=?"  
80 INPUT G  
90 IF C=G THEN 120  
100 PRINT "WRONG!! TRY AGAIN"  
110 GOTO 70  
120 PRINT "THAT'S RIGHT!!! WANT TO TRY AGAIN"  
130 INPUT A$  
140 IF A$="YES" THEN 20  
150 PRINT "THAT'S ALL, GOOD-BYE!"  
160 END
				

Assignment 1

  1. Enter THE PROGRAM and RUN it.
  2. Change the program to an operation other than addition. (It might be suggested to try division or powers at this point.)
  3. Add PRINT CHR$(125) to line 5 to clear the screen, it makes a neater program. Be sure to put a : between the two statements.
  4. Debug the program and get it to run.
  5. SAVE the new program.

Assignment 2

  1. LOAD in your program from Assignment 1.
  2. RUN it to be sure there are no bugs in it.
  3. Replace lines 20-50 with the following lines:
					20 DATA 2,4,56,32,91,76  
30 DATA -1,2,-4,-5,0,0  
40 READ A,B  
50 IF A=0 THEN 150
				
  1. Also, change line 140 to go to line 40, not line 20.
  2. RUN the program to understand how it works. Run the program at least once until it stops itself.
  3. Change the program to another operation.
  4. Debug & RUN the new program.

Assignment 3

  1. RELOAD your program, debug if necessary.
  2. Replace lines 20-50 with:
					20 PRINT "LET ME PICK TWO NUMBERS"  
30 FOR T=1 TO 2000:NEXT T  
40 A=INT(25*RND(1)+1)  
50 B=INT(10*RND(1)+1)
				
  1. RUN the new program, debug it and try to understand what happens in lines 30-50.
  2. Change the program to another operation.
  3. Change 2000 in line 30 to various other numbers to see what happens.
  4. SAVE your new program.

Assignment 4

  1. Reenter your program from Assignment 3.
  2. Replace lines 20-40 with:
					20 PRINT "WHAT IS YOUR NAME?"  
25 INPUT N$  
30 PRINT "HELLO ";N$;"."  
40 A=INT(10*RND(1)+1)
				
  1. Change line 5 to be: 
					5 DIM A$(3),N$(20):PRINT CHR$(125)
				
  1. Change line 120 to:
					120 PRINT "THAT'S RIGHT ";N$;"! WANT TO TRY AGAIN?"
				
  1. Add these lines:
					125 N=N+1  
135 PRINT "YOU HAVE ANSWERED ";N;" PROBLEMS CORRECTLY."
				
  1. Change line 140 to …THEN 40.
  2. RUN the program & debug it if necessary.
  3. Change the program to do multiplication or subtraction.
  4. Add a personal touch, N$, to the wrong responses.
  5. Add a counter, like N=N+1 for the wrong responses.
  6. RUN, debug and SAVE your program.

Assignment 5

  1. LOAD your program from Assignment 4, RUN & debug it.
  2. Make the following changes to the program:
					120 GOSUB 200
128 PRINT "WANT TO TRY AGAIN?"
200 X=INT(5*RND(1)+1)
210 IF X=1 THEN 300
220 IF X=2 THEN 320
230 IF X=3 THEN 340
240 IF X=4 THEN 360
250 IF X=5 THEN 380
300 PRINT "GOOD WORK, ";N$
310 RETURN
320 PRINT "FANTASTIC, ";N$
330 RETURN
340 PRINT "YOU ARE GETTING THE IDEA, ";N$
350 RETURN
360 PRINT "YOU ARE HOT, ";N$
370 RETURN
380 PRINT "THAT IS CORRECT, ";N$
390 RETURN
				
  1. Debug & RUN the new program.
  2. Change the program to a different operation, and
  3. Put in comments for wrong answers, similar to lines 300-390.

Programming Notes

  1. If you have not discovered by now, you may use ? for PRINT in those lines that have a PRINT statement.
  2. If you do not understand RND(1), type ? RND(1) and hit the RETURN key to see the result. 
  3. Also, try ? INT(10*RND(1)) a few times to see the resulting random numbers.
  4. The last step in every assignment in the classroom is to show it to the teacher. This is important, because sometimes students forge ahead without really finishing an assignment.
  5. The Atari can use ?,”, ESC, shift-CLEAR (these are the key strokes) at the beginning of a PRINT statement instead of CHR$(125) to clear the screen.
  6. BASIC commands, like RUN, are capitalized in the directions.
  7. Within the ” ” of a PRINT statement you may choose to use U/L case for better readability.

(PAC Editor’s Note: The RND statement in ATARI BASIC is really RND(0). RND(1) works, but it isn’t used as it is in non-Atari BASIC’s. These other BASIC’s allow you to specify a number in the () to tell them to give you a number from 0 to the number specified. Atari BASIC’s RND function always gives you a number between 0 and 1. Another way to get a random number on the Atari is to PEEK location 53770. This will give you a random number between 0 and 255.)

PHOTO CREDITS: