This Is a beginner’s program that capabilities of the Timex-Sinclair computers and will run on the ZX 80 (8K), ZX 81, TS 1000 (all with 16K RAM attached), TS 1500, and the TS 2068. For convenience, lets call these the 1000 and the 2068. The convention is to number in increments of 10. Do not be afraid to experiment! A lot can be learned about the art of programming from experimenting.
SAVEing is the most important consideration for a beginning programmer. Read the User Manual chapter on SAVEing. Type 9991 SAVE “smily face” ENTER. Do you know why the ‘e was left out of smily face”? Insert the ‘e’ and type GOTO 9991 ENTER. See why? DELETE the ‘e’. Type GOTO 9991 ENTER. -Note, I will type all key-words in CAPITALS so they can be entered with one keystroke from the keyboard.
To make the program auto-run upon loading, type 9995 GOTO 1 on the 1000. On the 2068, type 9991 SAVE “smily face” LINE 1 ENTER (LINE 1 auto-runs on the 2068). For the 2068, type 9992 INPUT “Verify? y/n “in$ ENTER, 9993 IF n$=”n” THEN STOP ENTER, 9994 VERIFY “* ENTER. After SAVEing you will be asked: Verify? y/n. Typing ‘n’ will stop the program. Any other key (except BREAK or spacebar) will verify your program. SAVE the program to tape for future use.
Lets develop a simple, straight forward arithmetic program, such as x + y = z. X 1s the augend, y 1s the addend and z is the sum. x and y enter the problem into the computer. Z enters the answer of the student.
LOAD your SAVE routine from tape and type 3310 INPUT * ENTER, 3320 INPUT y ENTER, GOTO 1 ENTER. Answer the INPUTs. Surprised? Hold down both the CAPS SHIFT and BREAK keys until the program BREAKs. A barrier is needed between the program and the save routine. Type 9990 STOP ENTER, GOTO 1 ENTER.
To present the problem to the student, type 3350 PRINT AT 6,0 ; x; • + “;y;” = ?” Enter. 3360 INPUT z ENTER. Type 3380 PRINT AT 6,0;x;” + “;y;” = “;z ENTER. -Note: the computer does just what you tell it to so the answer may be wrong! Run the program and input 7 for x, 8 for y, and 13 for z. When 7 + 8 = 13 ls presented on the screen, type PRINT x+y ENTER. The correct answer will be printed on the next line. To make the program repeat, type 3490 goto 3300 ENTER.
We now have a usable progam. If you wish a complete math program, EDIT each line and make the following changes in lines 3310-3490. Add 200 to each line number and change the ‘+ to a “-‘. Then take this set of program lines, add 200 to each line number and change the ‘- to a ‘*’ Then take this set and add 200 to each line number and change the ‘*’ to a “/’ so that you have a program that looks like the one below. SAVE the program by typing in GOTO 9991 ENTER. Study ways to make this program more user friendly.
Next month we will add a menu, make the insertion of x and y automatic, number the problems, and continue general improvements making the program more useful. In the meantime, EXPERIMENT!