--- title: "The Starter" id: 51797 type: "computer_media" slug: "the-starter" url: "http://localhost/computer_media/the-starter/" markdown_url: "http://localhost/computer_media/the-starter.md" published_at: "2023-08-13T23:14:32+00:00" modified_at: "2026-04-04T20:18:00+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2019/02/20230809-041332.jpg" excerpt: "Two programs: a data-entry histogram plotter with mean and median display, plus a randomized arithmetic quiz with selectable operation and difficulty level." 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/" - name: "Mathematics" slug: "mathematics" taxonomy: "genre" url: "http://localhost/type/mathematics/" media_type: "Cassette" download_url: "https://archive.org/download/timex-sinclair-software-archive/The Starter (1981)(Timex)(US)(TS1000)(Cassette).zip" mediadate: "1981" producer_company: - id: 11401 title: "Timex Computer Corporation" type: "company" url: "http://localhost/company/timex-computer-corporation/" related_products: - id: 35309 title: "The Starter" type: "product" url: "http://localhost/product/the-starter/" media_type_tags: "Education, Mathematics" --- “The Starter” is actually two separate BASIC programs. The first program collects a user-defined number of data points within a specified range and renders a bar chart using PLOT, while also computing and displaying the mean and median of the entered values. It uses a 10-element array E to bin each input value into one of ten equal-width intervals calculated from the max and min range bounds, and tracks the modal bin to determine the median display string. The second program is an arithmetic quiz that tests addition, subtraction, multiplication, or division at three difficulty levels using random operands scaled by powers of ten, scoring out of 10 correct answers. *** ## Program Analysis ### Overall Structure The listing contains two independent BASIC programs. The first (lines 5–730) is a statistical graphing tool called “The Starter.” The second (lines 2–220) is an arithmetic quiz. They share a line-number space but are logically separate programs. Line 100 appears twice: once as a genuine `REM` containing encoded data or machine code bytes, and once as the start of the quiz’s main loop. ### Program 1: Statistical Histogram Lines 5–200 collect user-specified data points, bin them into a histogram, and compute descriptive statistics. The workflow is: 1. Lines 5–51: Initialize variables and prompt for the number of points (`A`), maximum value (`B`), and minimum value (`C`). 2. Lines 75–90: Print a vertical scale along the left edge using `PRINT AT`, showing the 10 bin boundary values from min to max. 3. Lines 100–180: Main input loop. For each entered value `D`, compute its bin index `E` with the formula `1 + INT(9.9 * ((D-C)/(B-C)))`, increment the bin counter `E(E)`, track the maximum bin count in `M` and the corresponding bin label in `P$`, then plot a dot with `PLOT E(E)+8, 21-2*E` to build the bar chart horizontally. The running total `T` accumulates for the mean. 4. Lines 190–200: Display the mean (`T/A`) and the modal bin label stored in `P$`, which is described as the median but is actually the mode — a functional bug in the statistical labeling. ### Histogram and Plotting Technique The `PLOT` statement at line 160 uses the bin count as the horizontal coordinate and the bin index to set the vertical position. Each successive point in the same bin extends the bar one pixel further right, creating a dot-accumulation histogram. The scale on the left is printed at rows 12–21 using `PRINT AT 11+N,0`, neatly aligning with the plotted bars whose Y positions are `21-2*E`. ### Bin Index Formula The bin calculation `1 + INT(9.9 * ((D-C)/(B-C)))` maps normalized values in [0,1) to integers 1–10. Using 9.9 rather than 10 prevents an out-of-bounds index of 11 when `D` exactly equals `B`, since `INT(9.9)` = 9, giving index 10. This is a deliberate boundary-guard technique. ### Line 100 REM Block The `REM` at line 100 contains a long sequence of BASIC keywords, block graphics, and special characters. On the ZX81, a `REM` line is inert to the interpreter but its content occupies real memory. This region is often used to store machine code routines or pre-encoded data accessed via `USR`. Line 700 calls `USR 16570`, confirming that machine code is embedded somewhere in memory, likely within or near this REM block. ### Lines 400–730: Secondary Routine These lines implement a simple grid-based input interface. A vertical line of spaces is printed at column 15 (lines 520–540), and the user inputs strings: if the string is `"G"`, control jumps to the machine code call at line 700; otherwise, line 630 uses `CODE A$(2)-36` and `CODE A$-38` to convert two characters of the input string into row and column coordinates, printing `"O"` at that position. This is a compact coordinate-encoding scheme using ASCII arithmetic. | Line | Purpose | | --- | --- | | `700` | Call machine code at address 16570 via `USR` | | `710` | `PAUSE 60` — approximately 1-second delay | | `712` | `POKE 16437,255` — resets the display frame counter | | `715` | Branch to line 400 if `INKEY$` is `"X"` | | `720` | Loop back to 700 unless `INKEY$` is `"M"` | | `730` | Return to input loop at line 600 | ### Program 2: Arithmetic Quiz The quiz (lines 2–220) tests one of four arithmetic operations (+, -, *, /) chosen by the user, at levels 1–3 controlling the magnitude of operands via `10**B`. Ten questions are presented per session, and the score `F` is displayed at the end before looping back to line 3. - Line 5: `A$="+-*/"` stores the operator characters for indexed selection. - Line 90: For multiply and divide (`A>2`), the divisor `D` is rescaled to avoid zero or trivially small values: `INT(D/(10**(B-1)))+1`. - Line 100: Constructs the question string `B$` as `STR$ C+" "+A$(A)+" "+STR$ D`, then evaluates the answer using `VAL B$` — a clever technique that reuses the display string as an expression for numeric evaluation. - Line 130: Uses `ABS(VAL B$-D)>0.01` for floating-point tolerance comparison, avoiding exact equality checks. ### Notable Bugs and Anomalies - Line 200 labels `P$` as “MEDIAN” but `P$` holds the label of the most-filled bin, which is the **mode**, not the median. - Line 155 computes the bin label as `STR$(E*(B-C)/10+C)` where `E` at that point is the bin index (a scalar), not the array element — this works because the scalar `E` holds the current bin number, but the variable naming is potentially confusing given that `E()` is the bin-count array. - The two programs share line number space and the duplicate line 100 would cause the second definition to overwrite the first if both were loaded simultaneously — they must be used as separate loads. ## Source Code ``` 5 DIM E(11) 7 LET T=0 10 LET M=0 20 PRINT "[N][O][.]█[O][F]█[P][O][I][N][T][S]"; 30 INPUT A 31 PRINT A 40 PRINT ,,"[M][A][X]█[V][A][L][U][E]"; 50 INPUT B 51 PRINT B 60 PRINT ,,"[M][I][N]█[V][A][L][U][E]"; 70 INPUT C 72 CLS 75 FOR N=1 TO 10 80 PRINT AT 11+N,0;N*(B-C)/10+C 90 NEXT N 100 FOR N=1 TO A 110 PRINT AT 0,0;"[E][N][T][E][R]█[V][A][L][U][E] ";N 120 INPUT D 130 LET E=1+INT (9.9*((D-C)/(B-C))) 140 LET E(E)=E(E)+1 145 IF E(E)<=M THEN GOTO 160 150 LET M=E(E) 155 LET P$=STR$ (E*(B-C)/10+C) 160 PLOT E(E)+8,21-2*E 170 LET T=T+D 180 NEXT N 190 PRINT AT 0,0;"[M][E][A][N] = ";T/A;" " 200 PRINT ,,"[M][E][D][I][A][N] = ";P$ 100 REM ▘ Y [S]4▝▞([T]4▝:(Y)[S]4▝▞▘[T]4▝:▘A #ACS 9ACS 9ACS 9ACS 9ACS =#- ;#; GOSUB #£RND;)▘ ;TAN ▘((LN ▐RND# RETURNOSH$LN ▐RNDO▖LN ▐RNDO£LN ▐RNDO£LN ▐RNDO▌LN ▐RNDO▌LN ▐RNDO$LN ▐RNDO$LN ▐RNDO▖£LN ▐RND(TAN ▞($4CODE ▘((LN ▐RND# RETURN▀C▒ RETURNQC▖ RETURNR4▖YO/▝Y #( SCROLL▞($4 LLIST TAN 0000000 400 CLS 420 LET A$="" 430 LET C=0 500 PRINT AT 0,15;" " 520 FOR K=2 TO 17 530 PRINT AT K,15;" " 540 NEXT K 600 INPUT A$ 620 IF A$="G" THEN GOTO 700 630 PRINT AT CODE A$(2)-36,CODE A$-38;"O" 680 GOTO 600 700 LET C=USR 16570 710 PAUSE 60 712 POKE 16437,255 715 IF INKEY$ ="X" THEN GOTO 400 720 IF INKEY$ <>"M" THEN GOTO 700 730 GOTO 600 2 RAND 3 SLOW 4 LET F=0 5 LET A$="+-*/" 6 CLS 10 PRINT "[F][U][N][C][T][I][O][N] 1=+; 2=-; 3=*; 4=/" 20 INPUT A 30 PRINT ,,"[L][E][V][E][L] 1-3" 40 INPUT B 50 FOR N=1 TO 10 60 CLS 65 PRINT "[Q][U][E][S][T][I][O][N] ";N,F;" [C][O][R][R][E][C][T]" 70 LET C=INT (10**B*RND) 80 LET D=INT (10**B*RND) 90 IF A>2 THEN LET D=INT (D/(10**(B-1)))+1 100 LET B$=STR$ C+" "+A$(A)+" "+STR$ D 110 PRINT ,,B$;" = "; 120 INPUT D 125 PRINT D 130 IF ABS (VAL B$-D)>.01 THEN GOTO 170 140 PRINT ,,"[C][O][R][R][E][C][T] PRESS N/L" 150 LET F=F+1 160 GOTO 180 170 PRINT ,,"[W][R][O][N][G] PRESS N/L" 180 INPUT D$ 190 NEXT N 200 PRINT ,,"[S][C][O][R][E] ";F;" [O][U][T]█[O][F] 10" 210 INPUT D$ 220 GOTO 3 ```