--- title: "Super Math" id: 51787 type: "computer_media" slug: "super-math" url: "http://localhost/computer_media/super-math/" markdown_url: "http://localhost/computer_media/super-math.md" published_at: "2023-08-13T23:14:32+00:00" modified_at: "2026-04-04T20:17:58+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2019/02/20230809-041332.jpg" excerpt: "A four-operation math drill that scales difficulty with a cubic formula, right-justifies problems on screen, and awards letter grades after ten questions." category: - name: "Archived Media" slug: "archived-media" taxonomy: "category" url: "http://localhost/category/archived-media/" post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "Timex Computer Corporation" slug: "timex-computer-corporation" taxonomy: "post_tag" url: "http://localhost/tag/timex-computer-corporation/" - name: "TS 1000" slug: "ts1000" taxonomy: "post_tag" url: "http://localhost/tag/ts1000/" model: - name: "Timex/Sinclair 1000" slug: "ts-1000" taxonomy: "model" url: "http://localhost/model/ts-1000/" genre: - name: "Education" slug: "education" taxonomy: "genre" url: "http://localhost/type/education/" media_type: "Cassette" download_url: "https://archive.org/download/timex-sinclair-software-archive/Super Math (1983)(Timex)(US)(TS1000)(Cassette).zip" mediadate: "1983" producer_company: - id: 11401 title: "Timex Computer Corporation" type: "company" url: "http://localhost/company/timex-computer-corporation/" related_products: - id: 14130 title: "Super Math" type: "product" url: "http://localhost/product/super-math/" media_type_tags: "Education" --- Super Math is an arithmetic drill program that presents 10 randomly generated problems in each of four operations: addition, subtraction, multiplication, and division. The user selects an operation and a difficulty factor (1–5), which scales problem size via the formula `X = 10 * D^3`, producing operands ranging from small single-digit values up to numbers in the millions. After all 10 problems, a letter grade (F through A+) is assigned based on the number correct. A notable feature is the use of POKEs to memory addresses 16707–16712 combined with `USR 16720` to drive a sound or display routine — subroutines 6000 and 7000 clear and set these bytes respectively, while subroutine 7030 plays a congratulatory tone pattern on correct answers. The display layout uses a column-alignment subroutine (lines 9000–9099) that computes `PRINT AT` column positions T, K, and G by checking the magnitude of S, H, and L, right-justifying operands and answers regardless of their digit count. *** ## Program Analysis ### Program Structure The program is organized into a main menu section and a collection of subroutines, broadly divided as follows: - Lines 100–199: Title screen, main menu, and operation dispatcher - Lines 200–308: Input validation error handlers for option and difficulty - Lines 900–999: Continue/quit prompt - Lines 1000–1299: Addition drill loop and grading call - Lines 1300–1320: Grading subroutine (assigns letter grade from correct count `C`) - Lines 1400–1499: Number generation subroutine (shared by all four operations) - Lines 2000–2099: Subtraction drill loop - Lines 3000–3099: Multiplication drill loop - Lines 4000–4088: Division drill loop (labeled “MULTIPLICATION” in its REM — a copy-paste error) - Lines 5000–5020: Score display subroutine - Lines 6000–6025: Clear-tone / silence subroutine (POKEs zeros) - Lines 7000–7055: Set-tone subroutine and correct-answer fanfare - Lines 8000–8050: Double screen-clear with tone flash - Lines 9000–9099: Column alignment calculation subroutine Lines 45–55 form a standalone POKE utility (entered via `GOTO 100` skip at line 45) that allows direct memory editing by entering address/value pairs — essentially a built-in memory patcher left in the listing. ### Number Generation and Difficulty Scaling Subroutine 1400 generates operands `S` and `H`. The maximum operand magnitude is controlled by `X = 10 * D * D * D`, a cubic scaling of the difficulty factor `D` (1–5). This yields maximums of 10, 80, 270, 640, and 1250 for D=1 through 5. `S` is chosen as `INT(RND * X)`, and `H` is derived as `S - INT(RND * S)`, ensuring `H <= S`. For multiplication (A=3), `H` is independently re-randomized as `INT(RND * X)`. For division (A=4), the code sets `S = S * H` (after ensuring `H <> 0`), so that the dividend is always an exact multiple of the divisor — guaranteeing integer answers. ### Column Alignment Subroutine (Lines 9000–9099) This subroutine right-justifies the display of operands and answers by computing `PRINT AT` column values `T`, `K`, and `G` based on the number of digits in `S`, `H`, and the expected answer `L` respectively. It works by starting at column 15 and stepping left one position per additional decimal digit using a cascade of `IF value > threshold THEN LET col = col - 1` checks for thresholds 9, 99, 999, … up to 999999. `K` is decremented by one extra position to leave room for the operator symbol (`+`, `-`, `X`, or `▌`). ### Sound/Hardware Subroutines Subroutines 6000, 7000, and 7030 interact with hardware by POKEing values into addresses 16707–16712, then calling `USR 16720` to execute a machine code routine. Subroutine 6000 writes zeros to silence or reset the hardware state. Subroutine 7000 writes 128 to all six bytes for a sustained tone. Subroutine 7030 writes the values 183, 174, 172, 173, 185, 136 — a distinct pitch pattern used as a correct-answer fanfare — followed by a short delay loop and a call to 6000 to silence it. ### Grading Logic (Lines 1301–1309) The grade is assigned by a cascade of `IF C > threshold THEN LET C$ = grade` statements. Because each line overwrites the previous assignment unconditionally, the final value of `C$` is determined by the last condition that fires. The thresholds are: | Correct (C) | Grade | | --- | --- | | 0 | F | | 3–5 | D- | | 6 | D | | 7 | C | | 8 | B | | 9 | A | | 10 | A+ | Note that scores of 1 or 2 correct will receive “F” because none of the `C > 0`, `C > 2` thresholds produce separate grades for those values — the grade stays at “F” set by line 1301. ### Delay Loops The program uses `FOR`/`NEXT` loops with no body as timing delays throughout. Loop counts of 25–100 iterations are used between screen transitions; count 30 is used after showing a correct/wrong result. These are placed in SLOW mode context so their timing is predictable relative to the display. ### FAST/SLOW Usage Each drill loop switches to `FAST` mode at the top of each problem iteration (lines 1014, 2011, 3011, 4012) for rapid screen drawing, then switches back to `SLOW` mode (lines 1037, 2037, 3037, 4037) immediately before the `INPUT` statement to re-enable the display for user interaction. ### Bugs and Anomalies - The REM at line 4000 reads “MULTIPLICATION” instead of “DIVISION” — a copy-paste oversight. - The division display code at line 4030 uses `PRINT AT 10, 12+(K-16); H`. Since `K` is initialized to 15 and decremented, `K-16` will typically be negative (-1 for a single-digit H), which could place the divisor at unexpected column positions. - The alignment subroutine (9000) computes `L` as the expected answer for all operations but does not handle negative results for subtraction — if `S < H`, `L` would be negative, and the digit-count cascade (which only checks `L > 0` etc.) would leave `G` at 15, potentially misaligning the answer display. - Line 1410 guards against division by zero only when `A=4`, which is correct, but the check `IF A=4 AND H=0 THEN GOTO 1407` re-rolls `S` rather than just `H`, potentially wasting valid `S` values. - The `W` (wrong count) variable is initialized in the drill subroutines but never displayed in the grading output — only `C` (correct) is used for grading and the score line only updates via subroutine 5000 which reads both `C` and `W` during the loop. ## Source Code ``` 10 REM N#▞ ▘ ██████ GOSUB #£RND< GOSUB #WINKEY$ Y▞MYINKEY$ Y-MRNDINKEY$ Y▌MINKEY$ INKEY$ GOSUB #YINKEY$ 5#INKEY$ GOSUB [K]UINKEY$ INKEY$ XTAB #INKEY$ EWINKEY$ )5 GOSUB #6WINKEY$ FOR URNDINKEY$ XMRNDINKEY$ W#▌TAB #INKEY$ TAN 45 GOTO 100 50 INPUT A 51 INPUT B 52 PRINT B 53 POKE A,B 54 LET A=A+1 55 GOTO 51 100 GOSUB 7000 101 PRINT AT 10,9;"SUPER/MATH" 105 FOR N=1 TO 30 106 NEXT N 107 GOSUB 7000 110 PRINT AT 1,1;"WELCOME TO SUPER/MATH" 120 PRINT AT 2,1;"PICK ONE OF THE OPTIONS" 122 PRINT AT 3,1;"LISTED BELOW" 124 PRINT AT 5,8;"1. ADDITION" 126 PRINT AT 6,8;"2. SUBTRACTION" 128 PRINT AT 7,8;"3. MULTIPLICATION" 130 PRINT AT 8,8;"4. DIVISION" 135 PRINT AT 12,1;"ENTER THE NUMBER OF THE" 137 PRINT AT 13,1;"OPTION YOU DESIRE." 140 INPUT A 142 PRINT AT 14,1;A 143 IF A<=0 OR A>=5 THEN GOTO 200 146 FOR N=1 TO 25 147 NEXT N 148 GOSUB 7000 150 PRINT AT 2,2;"CHOOSE YOUR DIFFICULTY" 151 PRINT AT 3,2;"FACTOR...1 THRU 5" 152 PRINT AT 4,2;"AND ENTER IT NOW" 156 INPUT D 157 PRINT AT 5,2;D 159 IF D<=0 OR D>=6 THEN GOTO 300 160 GOSUB 7000 162 PRINT AT 6,2;"I WILL GIVE YOU 10" 164 PRINT AT 7,2;"PROBLEMS TO SOLVE" 166 PRINT AT 9,2;"YOUR SCORE " 168 PRINT AT 10,2;"WILL BE SHOWN AFTER " 169 PRINT AT 11,2;"EACH PROBLEM " 170 FOR N=1 TO 100 172 NEXT N 174 IF A=1 THEN GOSUB 1000 176 IF A=2 THEN GOSUB 2000 178 IF A=3 THEN GOSUB 3000 180 IF A=4 THEN GOSUB 4000 199 GOTO 900 200 GOSUB 7000 204 PRINT "OPTION INVALID--" 205 PRINT "MUST BE 1,2,3, OR 4" 206 FOR N=1 TO 100 207 NEXT N 208 GOSUB 7000 210 GOTO 120 300 PRINT AT 6,2;"INVALID ENTRY---" 302 PRINT AT 7,2;"MUST BE 1 THRU 5" 304 FOR N=1 TO 100 305 NEXT N 306 GOSUB 7000 308 GOTO 150 900 PRINT AT 18,5;"SHALL WE CONTINUE--Y/N" 902 INPUT D$ 903 GOSUB 7000 904 IF D$="Y" THEN GOTO 110 999 STOP 1000 REM ADDITION 1005 GOSUB 6000 1006 LET C=0 1008 LET W=0 1010 FOR J=1 TO 10 1014 FAST 1015 GOSUB 5000 1020 PRINT AT 5,5;"PROBLEM NO. ";J 1024 GOSUB 1400 1031 PRINT AT 9,T;S 1032 PRINT AT 10,K;"+";H 1034 PRINT AT 11,11;"▄▄▄▄▄▄▄" 1035 PRINT AT 15,0;" " 1036 PRINT AT 14,5;"ENTER YOUR ANSWER" 1037 SLOW 1038 INPUT Q 1039 PRINT AT 12,12;" " 1040 PRINT AT 12,G;Q 1042 IF Q=S+H THEN LET C=C+1 1044 IF Q<>S+H THEN LET W=W+1 1046 IF Q=S+H THEN PRINT AT 17,2;"***** CORRECT" 1047 IF Q=S+H THEN GOSUB 7030 1048 IF Q=S+H THEN GOTO 1204 1050 PRINT AT 17,2;"SORRY, THAT IS WRONG" 1052 PRINT AT 18,2;"THE ANSWER IS ";S+H 1200 FOR N=1 TO 30 1202 NEXT N 1204 GOSUB 6000 1295 NEXT J 1298 GOSUB 1300 1299 RETURN 1300 REM 1301 IF C>=0 THEN LET C$="F" 1302 IF C>02 THEN LET C$="D-" 1303 IF C>05 THEN LET C$="D" 1304 IF C>06 THEN LET C$="C" 1306 IF C>07 THEN LET C$="B" 1307 IF C>8 THEN LET C$="A" 1309 IF C>9 THEN LET C$="A+" 1310 GOSUB 8000 1312 PRINT AT 5,2;"YOUR GRADE IS ---";C$ 1320 RETURN 1400 REM 1402 LET X=10*D*D*D 1407 LET S=INT (RND*X) 1409 LET H=(S-INT (RND*S)) 1410 IF A=4 AND H=0 THEN GOTO 1407 1411 IF A=4 THEN LET S=S*H 1414 IF A=3 THEN LET H=INT (RND*X) 1420 GOSUB 9000 1499 RETURN 2000 REM SUBTRACTION 2005 GOSUB 6000 2008 LET C=0 2009 LET W=0 2010 FOR J=1 TO 10 2011 FAST 2012 GOSUB 5000 2020 PRINT AT 5,5;"PROBLEM NO. ";J 2024 GOSUB 1400 2031 PRINT AT 9,T;S 2032 PRINT AT 10,K;"-";H 2034 PRINT AT 11,11;"▄▄▄▄▄▄▄" 2035 PRINT AT 15,0;" " 2036 PRINT AT 14,5;"ENTER YOUR ANSWER" 2037 SLOW 2038 INPUT Q 2039 PRINT AT 12,12;" " 2050 PRINT AT 12,G;Q 2062 IF Q=S-H THEN LET C=C+1 2064 IF Q<>S-H THEN LET W=W+1 2066 IF Q=S-H THEN PRINT AT 17,2;"***** CORRECT" 2067 IF Q=S-H THEN GOSUB 7030 2068 IF Q=S-H THEN GOTO 2078 2070 PRINT AT 17,2;"SORRY, THAT IS WRONG" 2072 PRINT AT 18,2;"THE ANSWER IS ";S-H 2075 FOR N=1 TO 30 2077 NEXT N 2078 GOSUB 6000 2085 NEXT J 2090 GOSUB 1300 2099 RETURN 3000 REM MULTIPLICATION 3005 GOSUB 6000 3008 LET C=0 3009 LET W=0 3010 FOR J=1 TO 10 3011 FAST 3012 GOSUB 5000 3020 PRINT AT 5,5;"PROBLEM NO. ";J 3024 GOSUB 1400 3031 PRINT AT 9,T;S 3032 PRINT AT 10,K;"X";H 3034 PRINT AT 11,11;"▄▄▄▄▄▄▄" 3035 PRINT AT 15,0;" " 3036 PRINT AT 14,5;"ENTER YOUR ANSWER" 3037 SLOW 3038 INPUT Q 3039 PRINT AT 12,12;" " 3050 PRINT AT 12,G;Q 3062 IF Q=S*H THEN LET C=C+1 3064 IF Q<>S*H THEN LET W=W+1 3066 IF Q=S*H THEN PRINT AT 17,2;"***** CORRECT" 3067 IF Q=S*H THEN GOSUB 7030 3068 IF Q=S*H THEN GOTO 3078 3070 PRINT AT 17,2;"SORRY, THAT IS WRONG" 3072 PRINT AT 18,2;"THE ANSWER IS ";S*H 3075 FOR N=1 TO 30 3077 NEXT N 3078 GOSUB 6000 3082 NEXT J 3084 GOSUB 1300 3099 RETURN 4000 REM MULTIPLICATION 4005 GOSUB 6000 4008 LET C=0 4010 LET W=0 4011 FOR J=1 TO 10 4012 FAST 4013 GOSUB 5000 4020 PRINT AT 5,5;"PROBLEM NO. ";J 4024 GOSUB 1400 4030 PRINT AT 10,12+(K-16);H 4031 PRINT AT 10,13;S 4032 PRINT AT 10,12;"▌" 4034 PRINT AT 09,12;"▄▄▄▄▄▄▄" 4035 PRINT AT 15,0;" " 4036 PRINT AT 14,5;"ENTER YOUR ANSWER" 4037 SLOW 4038 INPUT Q 4039 PRINT AT 8,G;" " 4050 PRINT AT 8,13+(G-T);Q 4062 IF Q=S/H THEN LET C=C+1 4064 IF Q<>S/H THEN LET W=W+1 4066 IF Q=S/H THEN PRINT AT 17,2;"***** CORRECT" 4067 IF Q=S/H THEN GOSUB 7030 4068 IF Q=S/H THEN GOTO 4079 4070 PRINT AT 17,2;"SORRY, THAT IS WRONG" 4072 PRINT AT 18,2;"THE ANSWER IS ";S/H 4075 FOR N=1 TO 30 4077 NEXT N 4079 GOSUB 6000 4082 NEXT J 4084 GOSUB 1300 4088 RETURN 5000 PRINT AT 0,3;"[C][O][R][R][E][C][T] ";C 5010 PRINT AT 0,15;"[W][R][O][N][G] ";W 5020 RETURN 6000 REM 6010 POKE 16707,0 6012 POKE 16708,0 6014 POKE 16709,0 6016 POKE 16710,0 6018 POKE 16711,0 6020 POKE 16712,0 6022 LET E=USR 16720 6025 RETURN 7000 REM 7010 POKE 16707,128 7012 POKE 16708,128 7014 POKE 16709,128 7016 POKE 16710,128 7018 POKE 16711,128 7020 POKE 16712,128 7025 LET E=USR 16720 7029 RETURN 7030 FOR N=1 TO 3 7031 NEXT N 7032 POKE 16707,183 7034 POKE 16708,174 7036 POKE 16709,172 7038 POKE 16710,173 7040 POKE 16711,185 7042 POKE 16712,136 7044 LET E=USR 16720 7046 FOR K=1 TO 10 7048 NEXT K 7052 GOSUB 6000 7055 RETURN 8000 REM 8010 FOR N=1 TO 2 8020 GOSUB 7000 8040 NEXT N 8050 RETURN 9000 REM 9002 LET T=15 9004 LET K=15 9006 LET G=15 9008 IF S>0 THEN LET T=15 9010 IF S>9 THEN LET T=14 9020 IF S>99 THEN LET T=13 9022 IF S>999 THEN LET T=12 9024 IF S>9999 THEN LET T=11 9026 IF S>99999 THEN LET T=10 9028 IF S>999999 THEN LET T=9 9030 IF H>0 THEN LET K=15 9032 IF H>9 THEN LET K=14 9034 IF H>99 THEN LET K=13 9036 IF H>999 THEN LET K=12 9038 IF H>9999 THEN LET K=11 9040 IF H>99999 THEN LET K=10 9042 IF H>999999 THEN LET K=9 9050 LET L=H+S 9052 IF A=2 THEN LET L=S-H 9054 IF A=3 THEN LET L=S*H 9056 IF A=4 THEN LET L=S/H 9060 LET K=K-1 9062 IF L>0 THEN LET G=15 9064 IF L>9 THEN LET G=14 9066 IF L>99 THEN LET G=13 9068 IF L>999 THEN LET G=12 9070 IF L>9999 THEN LET G=11 9072 IF L>99999 THEN LET G=10 9074 IF L>999999 THEN LET G=9 9099 RETURN ```