This month we have a short, if not one line, tip for all of you new programmers out there in readerland. This is the easiest method to set up a SELF-RUNNING program and to make sure that you do not lose any of the program variables by accidentally RUNning a program. The lines are:
9998 SAVE "PROGRAM NAME"
9999 GOTO 100
In line 9999 the number after GOTO indicates the first line in the program that will RUM the routine without erasing any of the program variables. Use this routine at the end of any program you may write and when it is LOADed, it will automatically start.
This month for our program section, we thought that we would try to show some of you newer programmers what can be accomplished by a novice hacker with only 1K or RAM to work with. These three simple math routines were the very first programs written by yours truly right after reading the ZX81 manual. The routines were designed to help my daughters in routine MATH SKILLS. They really did help. They also show that some nice things can be accomplished with very little knowhow and/or memory.
5 REM "MATH DRILL M"
6 SLOW
7 PRINT "MULTIPICATION DRILL"
8 PRINT
10 LET X=INT (RND*20)+1
20 LET Y=INT (RND*20)+1
40 PRINT AT 10,0;X;" TIMES ";Y;;"=",;"ANSWER?"
70 INPUT Z
80 PRINT AT 10,15;,Z;" "
82 PAUSE 200
85 CLS
90 IF Z=X*Y THEN PRINT AT 5,0;"GREAT ***** SUPER";,,,;"NEXT?"
95 IF Z=X*Y THEN GOTO 10
110 IF Z<>X*Y THEN PRINT AT 5,0;"NOPE, SORRY,",,,, "TRY AGAIN"
115 PRINT
120 IF Z<>X*Y THEN GOTO 40
130 CLS
5 REM "MATH DRILL A"
6 SLOW
10 PRINT "ADDITION"
30 LET X=INT (RND*500)+1
40 LET Y=INT (RND*500)+1
50 PRINT AT 10,0;X;" PLUS ";Y;"=","ANSWER"
70 INPUT Z
80 PRINT AT 10,16;Z;" "
85 PAUSE 200
87 CLS
90 IF Z=X+Y THEN PRINT AT 5,0;"HOORAY >>>> GO ON"
110 IF Z=X+Y THEN GOTO 30
120 IF Z<>X+Y THEN PRINT AT 5,0;"NO, NO, NINNY",,,,"TRY AGAIN"
140 IF Z<>X+Y THEN GOTO 50
5 REM "MATH DRILL S"
6 SLOW
7 PRINT "MATH DRILL 4"
10 PRINT "SUBTRACTION"
30 LET X=INT (RND*500)+1
40 LET Y=INT (RND*500)+1
45 IF X<Y THEN GOTO 30
50 PRINT AT 10,0;X;" MINUS ";Y;"= ";" ANSWER?"
70 INPUT Z
80 PRINT AT 10,17;Z;" "
82 PAUSE 200
85 CLS
90 IF Z=X-Y THEN PRINT AT 5,0;"RIGHT ON,",,,,"GO ON TO NEXT"
110 IF Z=X-Y THEN GOTO 30
120 IF Z<>X-Y THEN PRINT AT 5,0;"NOT SO FAST,",,,,"DO IT OVER"
140 IF Z<>X-Y THEN GOTO 50
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.