Math Wizardry II is a two-part educational program consisting of a multiplication table tester and a long-division trainer aimed at young children. The multiplication component generates 20 randomized questions drawn from tables up to 12×12, with the option to test a single table or a mixed range, and displays a progressive train graphic that gains carriages as the score increases. The long-division module walks pupils through each digit of a two-digit-by-two-digit division step by step, accepting single keystrokes and providing detailed on-screen hints when a wrong digit is entered, with optional remainders. Both modules use UDG characters defined via DATA statements and POKEd into memory for the train and other graphical elements, and employ ON ERR handling for error recovery.
Program Analysis
Program Structure
The listing is two separate programs concatenated. The first program (lines 2–9999) is the multiplication table tester (“train” table tester); the second (lines 2–9910) is the long-division trainer. Each has its own initialization routine near line 9000, its own ON ERR scaffolding at line 2, and its own title screen.
Multiplication Tester – Flow
- Lines 2, 5: ON ERR handler and entry jump.
- Line 9900: Title/splash screen with block-graphic “MATHS” heading.
- Lines 610–680: UDG initialization — 16 custom characters (‘a’–’p’) are defined by POKEing pixel data from DATA statements at lines 820–970.
- Lines 9930–9985: User chooses single-table or mixed-table mode; sets
b(max table) andi(single-table flag). - Lines 20–260: Main question loop (20 questions). Line 50 uses the expression
(2+INT(RND*(b-1)) AND NOT i)+(b AND i)to pick either a random multiplier or force the chosen table depending on flagi. - Lines 280–350: End-of-game scoring and verbal feedback.
- Lines 412–445: Score celebration — scrolling train animation across rows 0–2 using string slicing of
t$andb$. - Lines 460–490: Wrong-answer branch — displays the full times-table for the relevant multiplier.
- Lines 510–590: Utility subroutines (ENTER-to-continue, single-keypress, numeric-input validation).
Long-Division Trainer – Flow
- Lines 2, 5: ON ERR handler; BEEP and jump to initialization.
- Line 9000–9050: Title screen, variable aliases (
g=1250,i=1010,u=1,o=0,h=16). - Line 9900: Asks whether to include remainders; sets flag
rf. - Lines 15–310: Ten-question loop. Each question generates a dividend (
a, two-digit, not divisible by 10) and divisor (d), then steps the pupil through each digit of the quotient and each subtraction step one keystroke at a time. - Lines 320–380: End-of-session score display, fireworks PLOT/DRAW animation, replay prompt.
- Lines 470–520: Detailed wrong-answer subroutines, one per algorithmic step.
- Lines 1000–1180: Utility routines — single-key entry (line 1010), ENTER-to-continue (line 1060), screen-clear (line 1110), hint overlay (lines 1160–1180).
- Lines 2010–2060: Correct-answer reward — random colored DRAW lines in the upper screen.
UDG Definitions (Multiplication Tester)
Sixteen UDGs (‘a’–’p’) are defined in the DATA block at lines 820–970 and installed by the loop at lines 620–640 using POKE USR s$+m,a. These form the components of the animated train: engine parts (\k, \l, \m, \n, \o), carriage body (\b–\i), wheels (\j), and track (\p).
Train Animation
String variables t$ and b$ are built in lines 650–660 to hold a full train scene roughly 128 characters wide (doubled with concatenation). The animation loop at line 435 slices a 32-character window that advances by index n from 1 to 96, creating a scrolling effect. The variable e (computed at line 412 from the score) controls how many carriages appear in the top-string slice, so better scores produce a longer train.
Score-Progressive Carriage Display (Multiplication Tester)
During the question loop, lines 190–230 add a new carriage graphic to the screen at score milestones of 4, 8, 12, 16, and 20 correct answers, printing UDG sequences at decreasing column positions. This gives children a visual incentive to maintain accuracy.
Variable Aliases in Long-Division Trainer
The long-division program uses short numeric variables as readable aliases to avoid retyping line numbers and magic numbers throughout:
| Variable | Value | Meaning |
|---|---|---|
u | 1 | Units flag / constant 1 |
o | 0 | Zero constant |
h | 16 | Hint column / hundreds flag |
i | 1010 | GO SUB target for single-key input |
g | 1250 | GO SUB target for wrong-answer flag increment |
Using GO SUB i and GO SUB g allows these targets to be called like named subroutines, which also slightly reduces tokenized program size.
Input Validation
The multiplication tester uses a two-stage validation subroutine at lines 550–590: it first loops over each character of the input string checking that CODE z$(n) is in the range 48–57, then checks for an empty string. This approach handles the case where VAL "" would cause an error. In the long-division trainer, input is restricted to a single keypress via the subroutine at line 1010, which polls INKEY$ and rejects non-digit keys, eliminating the need for a separate validation pass.
Duplicate-Question Avoidance
At lines 55–62 of the multiplication tester, a rolling window of the last six answers is checked: FOR n=(q-6) OR (q<7) TO q-1. The expression (q-6) OR (q<7) evaluates to 1 when q<7 (since the boolean is –1 in two’s complement, but the OR with a small positive value resolves to 1 or the computed start), effectively clamping the look-back to the available history. If a duplicate product is found the question is regenerated.
ON ERR Scaffolding
Both programs open with an ON ERR triplet at lines 2, and again inline near line 62 (long-division) / lines 12–15 (multiplication). The pattern — ON ERR GO TO, PAUSE 100, ON ERR GO TO (same), ON ERR CONTINUE — is a standard defensive technique: the first handler catches the error, a short pause allows transient conditions to clear, the second re-arms the handler, and CONTINUE resumes normal execution.
Notable Techniques
- String building by repeated self-concatenation (
u$=u$+u$+u$+u$) efficiently produces a 128-character repeating pattern from an 8-character seed. - The long-division trainer draws a physical long-division layout on screen using PLOT/DRAW for the division bracket and subtraction lines, coordinating pixel positions with PRINT AT character positions.
- In the long-division wrong-answer subroutines (e.g. lines 480, 485, 500, 505), the program distinguishes between “too small,” “too large,” and “completely wrong” and provides the partial product as a concrete hint.
- Line 9999 of the multiplication tester (
PRINT PEEK 23653+256*PEEK 23654) reads the RAMTOP system variable — a developer diagnostic fragment that was not removed before publication. - The fireworks end-sequence in the long-division trainer (lines 342–348) uses random-direction DRAW with
(-u OR RND>.5)*RND*150to produce both positive and negative displacements, with bounds checking to keep PLOTs on screen.
Potential Bugs and Anomalies
- Line 9999 (
PRINT PEEK 23653+256*PEEK 23654) is an unreachable diagnostic line in the multiplication tester; it can only execute if the program counter somehow reaches it, which does not happen in normal flow. - In the long-division trainer,
r$=" "(line 9005) initializes a 4-character work string. Individual characters are later assigned by index; if the computed string representation of an intermediate result ever exceeds the allocated positions, a subscript error could occur, though the dividend/divisor ranges chosen make this unlikely in practice. - Lines 1210 and 1999 in the long-division trainer are both identical BEEP subroutines that are defined but never called (the active correct-answer sound is at line 2010); they appear to be dead code from an earlier revision.
Content
Source Code
2 ON ERR GO TO 12
5 GO TO 9900
10 REM \* J J Warren 1982 "train" table tester
11 GO TO 20
12 ON ERR RESET
13 PAUSE 100
14 ON ERR GO TO 12
15 ON ERR CONTINUE
20 DIM z(20)
30 LET s=0: PRINT AT 2,0;"\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f"
35 PRINT AT 0,0; INK 4;t$( TO 32);b$( TO 32)
40 FOR q=1 TO 20
45 LET x=2+INT (RND*11)
50 LET y=(2+INT (RND*(b-1)) AND NOT i)+(b AND i): LET z(q)=x*y
55 FOR n=(q-6) OR (q<7) TO q-1
60 IF x*y=z(n) THEN GO TO 45
62 NEXT n
65 LET ap=16+LEN STR$ x+LEN STR$ y
70 PRINT AT 5,0; PAPER 6;"Question ";q
80 PRINT AT 10,10;x;" x ";y;" = ?"
90 INPUT "Type answer; press ENTER. "; LINE z$
100 GO SUB 550
150 LET z=VAL z$
160 IF z<1 OR z>144 THEN INPUT PAPER 6;"All answers will be between 1 and 144. Try again. ";z$: GO TO 100
170 IF z<>x*y THEN GO TO 460
180 PRINT AT 10,ap;x*y: PLOT INK 4;184,88: DRAW INK 4;2,-4: DRAW INK 4;16,20: LET s=s+1
185 FOR m=1 TO 15: BEEP .01,m: NEXT m: BEEP .1,20
190 IF s=4 THEN PRINT AT 1,20; INK 5; PAPER 6;"\b\b\b"; INK 0; PAPER 7;"\a";AT 2,20;"\g\g\g\i"
200 IF s=8 THEN PRINT AT 2,17;"\g\f\h";AT 1,17; INK 1;"\e\d\c"
210 IF s=12 THEN PRINT AT 2,14;"\g\f\h";AT 1,14; INK 1;"\e\d\c"
220 IF s=16 THEN PRINT AT 2,11;"\g\f\h";AT 1,11; INK 1;"\e\d\c"
230 IF s=20 THEN PRINT AT 2,8;"\g\f\h";AT 1,8; INK 2;"\e\d\c"
240 GO SUB 510
250 FOR n=5 TO 21: PRINT AT n,0;e$: NEXT n
260 NEXT q
280 PRINT AT 10,0;
290 IF s=20 THEN PRINT "Excellent.": GO TO 350
300 IF s>17 THEN PRINT "Very good.": GO TO 350
310 IF s>14 THEN PRINT "Well done.": GO TO 350
320 IF s>12 THEN PRINT "Good.": GO TO 350
330 IF s>8 THEN PRINT "You need more practice.": GO TO 350
340 PRINT "your low score shows that you need to spend more time learningyour tables."
350 PRINT ''"Your score was ";("only " AND (s>0 AND s<=8));s;" out of 20.": GO TO 410
360 CLS
370 PRINT PAPER 6;"Do you want another go? Type y or n. "
380 GO SUB 525
390 IF z$="y" THEN CLS : GO TO 9940
395 IF z$<>"n" THEN GO TO 380
400 CLS : ON ERR RESET : STOP
412 LET e=7+4*(s<4)+3*((s<8)+(s<12)+(s<16)+(s<20))
414 FOR n=0 TO 10: FOR m=4 TO 8 STEP .5: BEEP .01,m*s/3: NEXT m: NEXT n
415 PRINT AT 2,0; OVER 1;" \p\p\p\p \p\p\p\p \p\p\p\p \p\p\p\p"
430 LET u$=" \p \p \p \p \p \p \p \p": LET u$=u$+u$+u$+u$
433 PRINT AT 21,0; PAPER 6;"Press ENTER to finish."
435 FOR n=1 TO 96: PRINT AT 0,0; INK 4;t$(n TO n+31);AT 1,0;b$(n TO n+e);AT 1,24;b$(n+24 TO n+31);AT 2,0; INK 0; OVER 1;u$(n TO n+31): IF CODE INKEY$=13 THEN GO TO 360
440 NEXT n
445 GO TO 435
460 PRINT AT 10,0;e$;AT 10,0;z;" was wrong.": BEEP .5,-10: GO SUB 510
470 PRINT AT 10,0;e$
480 FOR n=1 TO 12: PRINT AT n+6,8; PAPER (n=x)*6+(n<>x)*7;(" " AND n<10);n;" x ";y,"= ";(" " AND n*y<10)+(" " AND n*y<100);n*y: NEXT n
490 GO TO 240
510 PRINT AT 21,0; PAPER 6;" Press ENTER to continue. ": GO SUB 525
515 IF CODE z$=13 THEN RETURN
520 GO TO 510
525 IF INKEY$<>"" THEN GO TO 525
530 IF INKEY$="" THEN GO TO 530
535 LET z$=INKEY$: RETURN
550 LET l=LEN z$
560 FOR n=1 TO l: IF CODE z$(n)<48 OR CODE z$(n)>57 THEN INPUT PAPER 6;"You must type a number, and then press ENTER. ";z$: GO TO 550
570 NEXT n
580 IF z$="" THEN INPUT PAPER 6;"Type a number before pressing ENTER. Try again. ";z$: GO TO 550
590 RETURN
610 RANDOMIZE : LET e$=" "
620 RESTORE : FOR n=1 TO 16: READ s$
630 FOR m=0 TO 7: READ a: POKE USR s$+m,a
640 NEXT m: NEXT n
650 LET t$=" \l\m\k\o \l\m\k\o": LET g$="\k\::\o \k\o\l\n\k\m\n\k\::\::\m\n ": LET t$=t$+g$+t$
660 LET b$=" \j \k\::\::\::\::\o \j \j\j \j\j\j\j \k\::\::\::\::": LET g$="\::\::\::\o \j \j \j \j \k\::\::\::\::\::\::\::\::\::\::\::\::\o \j \j \j \j\j ": LET b$=b$+g$+b$
670 LET u$=" \p \p \p \p \p \p \p \p": LET u$=u$+u$+u$+u$
680 GO TO 9930
820 DATA "a",192,224,48,24,252,254,252,248
830 DATA "b",255,255,0,0,255,255,255,255
840 DATA "c",254,254,146,146,254,254,255,254
850 DATA "d",255,255,36,36,255,255,255,255
860 DATA "e",127,127,73,73,127,127,255,127
870 DATA "f",0,0,255,255,255,255,255,255
880 DATA "g",51,51,255,255,255,255,255,255
890 DATA "h",204,204,255,255,255,255,255,255
900 DATA "i",48,48,255,255,255,255,255,255
910 DATA "j",60,126,255,126,60,24,24,24
920 DATA "k",7,15,15,31,63,127,127,255
930 DATA "l",0,0,0,0,1,3,3,7
940 DATA "m",64,192,228,236,254,255,255,255
950 DATA "n",0,0,0,0,128,192,192,224
960 DATA "o",224,224,240,248,252,252,254,255
970 DATA "p",0,0,0,0,255,255,255,255
9900 CLS : BORDER 5: PRINT PAPER 6; INK 7;" \::\::\:: \::\::\:: \:: \::\::\:: \::\::\:: \::\::\:: \:: \:: \:: \:: \:: \:: \:: \:: \:: \:: \::\::\:: \:: \::\::\:: \::\::\:: \:: \::\::\:: \:: \:: \::\::\:: \:: \:: \:: \::\::\:: "; INK 0;" Educational Software "
9910 PRINT AT 11,0;" Multiplication table tester. "
9920 PRINT AT 16,0; PAPER 6;" \* 1982 J J Warren BSc ARCS Cert Ed "
9925 GO TO 610
9930 GO SUB 510
9935 BORDER 7: CLS
9940 PRINT "You can test multiplication"'"tables up to 12 x 12 with this program."''"The TS2000 will set twenty questions for you to answer."''"You can either choose to have questions on a single times-"'"table, or you can have questionson all of the tables up to a"'"maximum which you select."
9945 PRINT AT 19,0;"Do you want questions on a"'"single table only? Type y or n.": GO SUB 525
9950 IF z$="y" THEN LET i=1: CLS : GO TO 9980
9955 IF z$<>"n" THEN GO TO 9945
9960 LET i=0: CLS : PRINT "Type in the maximum table to be tested (from 2 to 12), and then press ENTER."
9965 INPUT LINE z$: GO SUB 550
9970 LET b=VAL z$: IF b<2 OR b>12 THEN PRINT PAPER 6;AT 13,0;"Please type a number from 2 to 12(inclusive), then press ENTER.": GO TO 9965
9975 CLS : GO TO 10
9980 INPUT "Which table do you want to"'"choose? Type a number from 2 to 12, then press ENTER.";z$: GO SUB 550
9983 LET b=VAL z$: IF b<2 OR b>12 THEN PRINT PAPER 6;AT 13,0;"The number must be from 2 to 12.": GO TO 9980
9985 CLS : GO TO 10
9999 PRINT PEEK 23653+256*PEEK 23654
2 ON ERR GO TO 62
5 BEEP .5,40: GO TO 9000
10 REM RESET 1983 J J Warren
15 LET c=o: PAPER o: GO SUB 1110: PAPER 7: LET s=o: FOR q=u TO 10: LET c=9: GO SUB 1110: LET l$="": LET m=o
20 LET d=INT (11+RND*88)
25 LET a=INT (11+RND*88): IF a/10=INT (a/10) THEN GO TO 25
30 LET r=INT (u+RND*(d-u)): LET t=a*d+(r AND rf=u): IF t>999 THEN GO TO 20
40 LET a$=STR$ a: LET d$=STR$ d: LET t$=STR$ t
50 PRINT AT 10,o; PAPER 5;"Question ";q
60 PRINT AT 14,8;d;" ";t: PLOT 111,68: DRAW -28,o: DRAW o,-12,-u
61 GO TO 70
62 ON ERR RESET
63 PAUSE 100
64 ON ERR GO TO 62
65 ON ERR CONTINUE
70 PRINT AT 12,11;"?": GO SUB i: IF k$<>"0" THEN GO SUB 470
80 PRINT AT 12,11;" ?": GO SUB i: LET a=VAL a$(u): LET t=VAL t$( TO 2): IF k<>a THEN GO SUB 480
90 PRINT AT 12,12;a;AT 15,2; BRIGHT u;a;" x ";d;" = ?": PLOT 88,44: DRAW 16,o
100 LET r$( TO 2)=STR$ (VAL a$(1)*d): LET n=VAL t$( TO 2)-VAL r$( TO 2): LET n$=STR$ n: LET r$(4)=n$(LEN n$): LET r$(3)=n$(1) AND n>9: IF n<10 THEN LET r$(3)="0"
110 GO SUB i: LET b=u: LET a=VAL r$(2): LET t=VAL a$(u): IF k<>a THEN GO SUB 500
120 PRINT AT 15,11;"?";r$(2)
130 GO SUB i: LET b=o: LET a=VAL r$(u): LET t=VAL a$(u): IF k<>a THEN GO SUB 500
140 PRINT AT 15,2;" ";r$(u)
150 PRINT BRIGHT u; OVER u;AT 14,11;" ";AT 15,10;"- ";AT 17,12;"?": GO SUB i: LET b=u: LET t=VAL t$( TO 2): LET n=VAL r$( TO 2): LET l$=r$(4): LET a=VAL l$: IF k<>a THEN GO SUB 510
160 PRINT AT 17,11;"?";r$(4): GO SUB i: LET t=VAL t$( TO 2): LET n=VAL r$( TO 2): LET a=VAL r$(3): LET b=o: IF k<>a THEN GO SUB 510
170 PRINT AT 17,11;(" " AND r$(3)="0")+(r$(3) AND r$(3)<>"0"); OVER u;AT 14,11;" ";AT 15,10;"- "
180 PRINT AT 21,o;e$: INK u: PLOT 108,55: DRAW o,-15: DRAW -2,4: DRAW 4,o: DRAW -2,-4: INK o: PRINT AT 17,13;"?": GO SUB i: IF k$<>t$(3) THEN GO SUB 520
190 PRINT AT 15,13;" ";AT 16,13;" ";AT 17,13;t$(3);AT 12,13;"?": GO SUB i: LET a=VAL a$(2): LET t=VAL (r$(3 TO 4)+t$(3)): IF k<>a THEN GO SUB 480
200 LET n=d*VAL a$(2): LET n$=STR$ n: LET n$=("0" AND LEN n$=2)+n$: PRINT AT 12,13;a$(2);AT 18,2; BRIGHT u;a$(2);" x ";d;" = ?": GO SUB i: LET b=u: LET a=VAL n$(3): LET t=VAL a$(2): IF k<>a THEN GO SUB 500
210 PRINT AT 18,12;"?";n$(3): GO SUB i: LET b=o: LET a=VAL n$(2): LET t=VAL a$(2): IF k<>a THEN GO SUB 500
220 PRINT AT 18,12;n$(2): IF n$(1)="0" THEN PRINT AT 18,2;" ": PLOT 96,20: DRAW 16,o: GO TO 250
230 PRINT AT 18,11;"?": GO SUB 1010: LET b=h: LET a=VAL n$(u): LET t=VAL a$(2): IF k<>a THEN GO SUB 500
240 PRINT AT 18,2;" "+(n$(u) AND n$(u)<>"0")+(" " AND n$(u)="0"): PLOT 88,20: DRAW 24,o: LET n=VAL n$
250 LET n=VAL n$: IF rf=o THEN GO TO 300
260 PRINT AT 20,13;"?": GO SUB i: LET a$=("0" AND LEN STR$ r=u)+STR$ r: LET b=u: LET t=VAL (r$(3 TO 4)+t$(3)): LET n=VAL n$: LET a=VAL a$(2): IF k<>a THEN GO SUB 510
270 PRINT AT 20,12;"?";a$(2): GO SUB i: LET b=o: LET a=VAL a$(u): LET n=VAL n$: LET l$=a$(2): IF k<>a THEN GO SUB 510
275 PRINT AT 20,12;a$ AND r>9
280 IF r$(3)<>"0" THEN PRINT AT 20,11;"?";a$(1): GO SUB i: LET b=h: LET l$=a$: LET n=VAL n$: LET a=o: IF k$<>"0" THEN GO SUB 510
290 PRINT AT 20,11;" "+(" " AND a$(u)="0");AT 12,15;"remainder ";r
300 LET s=s+NOT m: INK 4: PLOT 144,40: DRAW 8,-16: DRAW 24,48: DRAW -24,-40: DRAW -8,8: INK o: IF m=0 THEN GO SUB 2010
310 GO SUB 1060: NEXT q
320 BORDER o: PAPER o: LET c=8: GO SUB 1110
325 FOR n=0 TO 5: BEEP .1,30: BEEP .05,35: BEEP .15,28: NEXT n
330 PRINT AT 20,o; INK 7;" Your score was ";s;" completely"'" correct out of 10.": INPUT " "
342 FOR n=u TO 50
344 LET xi=(-u OR RND>.5)*RND*150: IF 127+xi<o OR 127+xi>255 THEN GO TO 344
346 LET yi=RND*100
348 PLOT 127,17: DRAW INK INT (u+RND*7);xi,yi: NEXT n
349 PAPER 7: GO SUB 1060
350 BORDER 7: CLS : INK o: PRINT AT 4,o;"Do you want another try?"''"please type y or n."
360 LET k$=INKEY$: IF k$="y" THEN GO TO 5
370 IF k$<>"n" THEN GO TO 360
380 CLS : ON ERR RESET : STOP
470 GO SUB g: PRINT AT 13,h;k$;" was wrong.";AT 15,h;"How many times";AT h,h;"will ";d;" go";AT 17,h;"into ";t$(1);"?": GO SUB 1160: GO SUB i: IF k$="0" THEN GO SUB 1170: RETURN
475 GO SUB g: GO SUB 1170: PRINT AT 13,h;d;" is too large";AT 14,h;"to go into ";t$(u);".";AT h,h;"You should have";AT 17,h;"entered 0.": GO SUB 1160: GO SUB 1060: GO SUB 1170: RETURN
480 IF k<a THEN GO SUB g: PRINT AT 12,h;k;" is too small.";AT 14,h;d;" will go into";AT 15,h;t;" more times";AT h,h;"than that.";AT 18,h;k;" x ";d;" = ";d*k;AT 20,h;"Try again.": GO SUB 1160: GO SUB i: IF k=a THEN GO SUB 1170: RETURN
485 IF k>a THEN GO SUB g: PRINT AT 12,h;k;" is too large.";AT 14,h;d;" will not go";AT 15,h;"into ";t;" that";AT h,h;"many times.";AT 18,h;k;" x ";d;" = ";d*k;AT 20,h;"Try again.": GO SUB 1160: GO SUB i: IF k=a THEN GO SUB 1170: RETURN
490 GO SUB g: GO SUB 1170: PRINT AT 12,h;k$;" was wrong.";AT 14,h;d;" will go";AT 15,h;"into ";t: GO SUB 1160: PRINT AT 17,19; BRIGHT u;" ";a;" time"+("s" AND a>u)+".";AT 19,18;a;" x ";d;" = ";a*d: GO SUB 1060: GO SUB 1170: RETURN
500 GO SUB g: PRINT AT 12,h;k;" was wrong.";AT 14,h;t;" x ";d;" = ?";AT h,h;"What must you";AT 17,h;"enter in the";AT 18,h;("units" AND b=u)+("tens" AND b=o)+("hundreds" AND b=h)+" column?": GO SUB 1160: GO SUB i: GO SUB 1170: IF k=a THEN RETURN
505 GO SUB g: PRINT AT 12,h;k$;" was wrong.";AT 14,h;t;" x ";d;" = ";t*d;AT h,h;"You should";AT 17,h;"have entered ";AT 18,h;"in the "+("units" AND b=u)+("tens" AND b=o)+("hundreds" AND b=h);AT 19,h;"column.": GO SUB 1160: PRINT AT 17,29; BRIGHT u;a: GO SUB 1060: GO SUB 1170: RETURN
510 GO SUB g: PRINT AT 12,h;k;" was wrong.";AT 14,20;" " AND t<100;t;AT 15,19;" " AND t<100;"-";" " AND (n<100 AND t>99);n;AT 17,20;(" ?" AND b=u)+((" ?"+l$) AND b=o)+(("?"+l$) AND b=h);AT 19,h;"Try again.": PLOT 164,44: DRAW 20,o: GO SUB 1160: GO SUB i: GO SUB 1170: IF k=a THEN RETURN
515 GO SUB g: PRINT AT 12,h;k;" was wrong.";AT 14,20;" " AND t<100;t;AT 15,19;" " AND t<100;"-";" " AND (n<100 AND t>99);n;AT 19,h;"You should have";AT 20,h;"entered ";a;AT 17,21;" " AND (t-n)<10;t-n: PLOT 164,44: DRAW 20,o: GO SUB 1160: PRINT AT 17,20+(u AND b=o)+(2 AND b=u); BRIGHT u; OVER u;" ": GO SUB 1060: GO SUB 1170: RETURN
520 GO SUB g: PRINT AT 12,h;k;" was wrong.";AT 14,h;"You should have";AT 15,h;"taken down ";t$(3);AT 16,h;"from above.": GO SUB 1160: GO SUB 1060: GO SUB 1170: RETURN
1000 REM single key entry
1010 IF INKEY$<>"" THEN GO TO 1010
1020 IF INKEY$="" THEN GO TO 1020
1030 LET k$=INKEY$: IF CODE k$<48 OR CODE k$>57 THEN PRINT AT 21,0;" Please press a number key. ": GO TO 1010
1040 PRINT AT 21,0;e$: BEEP .01,25: LET k=VAL k$: RETURN
1050 REM enter to continue
1060 POKE 23659,u: PRINT AT 22,o;" Press ENTER to continue. "
1070 IF INKEY$<>"" THEN GO TO 1070
1075 IF INKEY$="" THEN GO TO 1075
1080 LET k$=INKEY$: IF CODE k$<>13 THEN GO TO 1060
1090 PRINT AT 22,o;e$: POKE 23659,2: RETURN
1100 REM clear lower screen
1110 FOR n=c TO 21: PRINT AT n,o;e$: NEXT n: RETURN
1160 PAPER 6: OVER 1
1170 FOR c=11 TO 21: PRINT AT c,15;" ": NEXT c
1180 PAPER 7: OVER 0: RETURN
1210 FOR n=1 TO 4: BEEP .1,15: BEEP .05,25: BEEP .1,30: NEXT n: RETURN
1250 LET m=m+u: RETURN
1999 FOR n=1 TO 4: BEEP .1,15: BEEP .05,25: BEEP .1,30: NEXT n: RETURN
2010 FOR n=1 TO 3: BEEP .1,15: BEEP .05,25: BEEP .1,30: NEXT n
2020 LET x=RND*255: LET y=112+RND*63
2025 FOR n=u TO 19-m
2030 LET xi=(-u OR RND>.5)*RND*30: IF x+xi<o OR x+xi>255 THEN GO TO 2030
2040 LET yi=(-u OR RND>.5)*RND*30: IF y+yi<112 OR y+yi>175 THEN GO TO 2040
2050 PLOT x,y: DRAW INK INT (u+RND*7);xi,yi
2060 NEXT n: BEEP .01,h: RETURN
9000 REM initial. and title
9005 LET r$=" ": LET e$=" "
9010 BORDER 4: PAPER 2: CLS : PRINT INK 7;e$;" \::\::\:: \::\::\:: \:: \::\::\:: \::\::\:: \::\::\:: \:: \:: \:: \:: \:: \:: \:: \:: \:: \:: \::\::\:: \:: \::\::\:: \::\::\:: \:: \::\::\:: \:: \:: \::\::\:: \:: \:: \:: \::\::\:: ";AT 6,4; PAPER 7; INK 0;" Educational Software "
9020 LET g=1250: LET i=1010: LET u=1: LET o=0: LET h=16: LET c=8: PAPER u: GO SUB 1100: PRINT AT 12,6; PAPER 6; INK o;" Long Division. "
9030 LET c=17: PAPER 2: GO SUB 1100: PAPER 7: INK o: PRINT AT 18,5;" \* 1983 J J Warren ";AT 19,5;" BSc ARCS Cert Ed "
9050 GO SUB 1060: BORDER 7: CLS
9900 PRINT AT 4,o;"Do you want sums which include remainders?"''"Please type y or n.": IF INKEY$<>"y" AND INKEY$<>"n" THEN GO TO 9900
9910 LET rf=1 AND INKEY$="y": CLS : GO TO 10
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.



