--- title: "GRID 9X" id: 54571 type: "computer_media" slug: "grid-9x" url: "http://localhost/computer_media/grid-9x/" markdown_url: "http://localhost/computer_media/grid-9x.md" published_at: "2024-06-02T17:42:37+00:00" modified_at: "2026-03-30T21:42:54+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2019/02/20230809-041332.jpg" excerpt: "A BASIC program that draws a precision 24×24 pixel grid with registration marks and tick decorations, then sends it to a printer for graphics design work." 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: "TS 2068" slug: "ts2068" taxonomy: "post_tag" url: "http://localhost/tag/ts2068/" model: - name: "Timex/Sinclair 2068" slug: "ts-2068" taxonomy: "model" url: "http://localhost/model/ts-2068/" genre: - name: "Graphics" slug: "graphics" taxonomy: "genre" url: "http://localhost/type/graphics/" media_contents: - id: 51214 title: "CATS Library Tape 8" type: "computer_media" url: "http://localhost/computer_media/cats-library-tape-8/" media_type: "Program" mediadate: "198x" images: - url: "http://localhost/wp-content/uploads/2024/06/SCR-20260330-nped.png" media_type_tags: "Graphics" --- # GRID 9X This program draws a detailed pixel grid on the high-resolution graphics screen intended as a design aid for creating graphics. It constructs a 24-column by 24-row grid using PLOT and DRAW commands, dividing the 240×176 pixel display area into equal cells by computing coordinates as multiples of X/24 and 176/24. Special tick marks, bracket shapes, and corner decorations are drawn with sequences of small DRAW steps to mark every eighth column boundary (at columns 9 and 17) and every eighth row boundary. After drawing the grid, the program uses a subroutine at line 2500 to complete the right-hand vertical lines, then jumps to line 2550 to add decorative registration marks and margin symbols. The completed grid is then sent to a printer 20 times via a FOR/NEXT loop using COPY at line 2805, with line 2800 preserved as a REMmed-out alternative that also adds line feeds between copies. *** ## Program Analysis ### Program Structure The program is organized into several logical sections spread across a wide line-number range. Execution begins at line `5` with a `GO TO 2000`, jumping past the informational header block at lines `100`–`105`, which describes the program’s purpose and prints the available FREE memory before halting. The main drawing code starts at line `2028` and runs sequentially through to line `2169`, with a subroutine call to `2500` partway through and a skip via `GO TO 2550` at line `2499`. The subroutine at lines `2500`–`2535` draws the rightmost vertical grid lines (columns 18–25). Lines `2550`–`2736` draw all the decorative registration marks, tick marks, and border symbols. The program ends with a print loop at line `2805` and a `SAVE` at line `9999`. ### Grid Construction The grid dimensions are anchored by variables `X=240` and `Y=175`, representing the horizontal and vertical pixel extents. Vertical lines are drawn by repeatedly computing `N*(X/24)` for columns 1 through 25, yielding a 24-column grid with 10-pixel spacing. Horizontal lines are similarly computed as `N*(176/24)` for rows 0 through 23, giving approximately 7.33-pixel spacing. The grid starts at x-offset `P=10` from the left edge (`PLOT P, row: DRAW XX, 0`), which partially misaligns the horizontal lines from the vertical ones — a minor geometric inconsistency in the design. ### Notable Techniques - The formula `N*(X/24)` recalculates the column width each time rather than storing it in a variable, which is slightly less efficient but avoids rounding accumulation. - Certain key column boundaries (at `9*(X/24)` and `17*(X/24)`) receive extra tick marks drawn with small multi-step DRAW sequences, visually dividing the grid into thirds. - Registration marks at the grid intersections (lines `2550`–`2736`) are drawn entirely with PLOT/DRAW sequences mimicking small geometric symbols such as crosses, arrowheads, and brackets — all constructed without any character output. - The `GO SUB 2500` at line `2137` is used to complete the right-hand column group (columns 18–25), then `GO TO 2550` at line `2499` skips the subroutine body on the fall-through path. - Line `2105` re-initializes `X=240` after lines `2028`–`2037` use it, suggesting those early lines were written or edited separately. ### Printer Output Line `2805` loops 20 times, issuing a `COPY` command on each iteration to send the screen to a printer, producing 20 copies of the grid for use as paper design templates. The REMmed-out alternative at line `2800` shows a previous version that also added `LPRINT` line feeds between copies for physical paper separation. The active version omits these, so copies would be printed contiguously. ### Bugs and Anomalies - Line `2029` and `2037` both reference `(25*(X/24))-1`, drawing the same vertical line twice, which is redundant. Line `2037` also has a REMmed-out third PLOT/DRAW that was apparently removed. - The horizontal lines at lines `2140`–`2169` start at `P=10`, but the vertical lines at lines `2110`–`2535` start at `X/24 = 10` (same x value), then extend to `25*(X/24) = 250`. The horizontal lines draw for `XX=240` pixels, ending at x=250, which is consistent, but the left anchor at x=10 is hardcoded rather than derived from the grid formula. - Line `2661` references `PLOT 0,23` which appears to be a copy-paste error from line `2660` — the paired right-hand version should use an x-coordinate near 252–255, not 0. - Line `105` prints `FREE` using the `FREE` keyword (rendered as `~` in the token encoding) to show available memory, suggesting the program was large enough that memory usage was a concern. ### Variable Summary | Variable | Value | Purpose | | --- | --- | --- | | `X` | 240 | Horizontal pixel span; column width = X/24 = 10 | | `Y` | 175 | Vertical pixel span for vertical grid lines | | `P` | 10 | Left x-offset for horizontal lines | | `XX` | 240 | Length of horizontal DRAW strokes | | `n` | 1–20 | Loop counter for printer COPY repetitions | ## Source Code ``` 5 GO TO 2000 100 PRINT "This program prints a grid for designing graphics"''"With printer on, the number of screens printed is controlled by Line 2805. It now is set for 20" 103 PRINT ''"Use RUN to print grid" 105 PRINT '"FREE "; FREE : STOP 2028 LET Y=175: LET X=240 2029 PLOT 9*(X/24)-1,0: DRAW 0,Y: PLOT (25*(X/24))-1,0: DRAW 0,Y 2030 PLOT 11,60: DRAW 240,0: PLOT 11,118: DRAW 240,0 2037 PLOT 17*(X/24)-1,0: DRAW 0,Y: PLOT (25*(X/24))-1,0: DRAW 0,Y: REM PLOT 11,0: DRAW 0,Y 2105 LET X=240 2106 LET Y=175 2110 PLOT X/24,0: DRAW 0,Y 2120 PLOT 2*(X/24),0: DRAW 0,Y 2123 PLOT 3*(X/24),0: DRAW 0,Y 2124 PLOT 4*(X/24),0: DRAW 0,Y 2125 PLOT 5*(X/24),0: DRAW 0,Y 2126 PLOT 6*(X/24),0: DRAW 0,Y 2127 PLOT 7*(X/24),0: DRAW 0,Y 2128 PLOT 8*(X/24),0: DRAW 0,Y 2129 PLOT 9*(X/24),0: DRAW 0,Y: PLOT (9*(X/24))-2,1: DRAW 4,0: PLOT 11,57: DRAW 0,4: PLOT (25*(X/24))-1,57: DRAW 0,4 2130 PLOT 10*(X/24),0: DRAW 0,Y 2131 PLOT 11*(X/24),0: DRAW 0,Y 2132 PLOT 12*(X/24),0: DRAW 0,Y 2133 PLOT 13*(X/24),0: DRAW 0,Y 2134 PLOT 14*(X/24),0: DRAW 0,Y 2135 PLOT 15*(X/24),0: DRAW 0,Y 2136 PLOT 16*(X/24),0: DRAW 0,Y 2137 PLOT 17*(X/24),0: DRAW 0,Y: PLOT (17*(X/24))-2,1: DRAW 4,0: PLOT (25*(X/24))-1,115: DRAW 0,4: PLOT 11,115: DRAW 0,4: GO SUB 2500 2138 LET P=10 2139 LET XX=240 2140 PLOT P,0: DRAW XX,0 2141 PLOT P,176/24: DRAW XX,0 2142 PLOT P,2*(176/24): DRAW XX,0 2143 PLOT P,3*(176/24): DRAW XX,0 2144 PLOT P,4*(176/24): DRAW XX,0 2145 PLOT P,5*(176/24): DRAW XX,0 2146 PLOT P,6*(176/24): DRAW XX,0 2147 PLOT P,7*(176/24): DRAW XX,0 2148 PLOT P,8*(176/24): DRAW XX,0 2149 PLOT P,9*(176/24): DRAW XX,0 2150 PLOT P,10*(176/24): DRAW XX,0 2151 PLOT P,11*(176/24): DRAW XX,0 2152 PLOT P,12*(176/24): DRAW XX,0 2153 PLOT P,13*(176/24): DRAW XX,0 2154 PLOT P,14*(176/24): DRAW XX,0 2155 PLOT P,15*(176/24): DRAW XX,0 2156 PLOT P,16*(176/24): DRAW XX,0 2157 PLOT P,17*(176/24): DRAW XX,0 2158 PLOT P,18*(176/24): DRAW XX,0 2159 PLOT P,19*(176/24): DRAW XX,0 2160 PLOT P,20*(176/24): DRAW XX,0 2161 PLOT P,21*(176/24): DRAW XX,0 2162 PLOT P,22*(176/24): DRAW XX,0 2163 PLOT P,(23*(176/24))-1: DRAW XX,0 2169 PLOT P,175: DRAW XX,0 2499 GO TO 2550 2500 PLOT 18*(X/24),0: DRAW 0,Y 2505 PLOT 19*(X/24),0: DRAW 0,Y 2510 PLOT 20*(X/24),0: DRAW 0,Y 2515 PLOT 21*(X/24),0: DRAW 0,Y 2520 PLOT 22*(X/24),0: DRAW 0,Y 2525 PLOT 23*(X/24),0: DRAW 0,Y 2530 PLOT 24*(X/24),0: DRAW 0,Y 2535 PLOT 25*(X/24),0: DRAW 0,Y: RETURN 2550 PLOT (9*(X/24))-1,8*(176/24): DRAW 0,1: DRAW 2,0: DRAW 0,-2: DRAW -2,0: DRAW 2,0 2570 PLOT (9*(X/24))-1,16*(176/24): DRAW 0,1: DRAW 2,0: DRAW 0,-2: DRAW -2,0: DRAW 2,0 2580 PLOT (9*(X/24))-2,(23*(176/24))+5: DRAW 4,0 2590 PLOT (17*(X/24))-1,(8*(176/24))+1: DRAW 2,0: DRAW 0,-2: DRAW -2,0 2591 PLOT (17*(X/24))-1,(16*(176/24))+1: DRAW 2,0: DRAW 0,-2: DRAW -2,0 2592 PLOT (17*(X/24))-2,(23*(176/24))+5: DRAW 4,0 2600 PLOT 3,0: DRAW -3,0: DRAW 3,3: DRAW 0,1: DRAW -1,1: DRAW -1,0: DRAW -1,-1 2603 PLOT 255,0: DRAW -3,0: DRAW 3,3: DRAW 0,1: DRAW -1,1: DRAW -1,0: DRAW -1,-1 2605 PLOT 3,60: DRAW -3,0: DRAW 3,3: DRAW 0,1: DRAW -1,1: DRAW -1,0: DRAW -1,-1 2606 PLOT 255,60: DRAW -3,0: DRAW 3,3: DRAW 0,1: DRAW -1,1: DRAW -1,0: DRAW -1,-1 2610 PLOT 3,118: DRAW -3,0: DRAW 3,3: DRAW 0,1: DRAW -1,1: DRAW -1,0: DRAW -1,-1 2611 PLOT 255,118: DRAW -3,0: DRAW 3,3: DRAW 0,1: DRAW -1,1: DRAW -1,0: DRAW -1,-1 2615 PLOT 4,2: DRAW 0,-1: DRAW 1,-1: DRAW 1,0: DRAW 1,1: DRAW 0,1: DRAW -1,1: DRAW -1,0: DRAW -1,1: DRAW 1,1: DRAW 1,0: DRAW 1,-1 2616 PLOT 252,2: DRAW 0,-1: DRAW 1,-1: DRAW 1,0: DRAW 1,1: DRAW 0,1: DRAW -1,1: DRAW -1,0: DRAW -1,1: DRAW 1,1: DRAW 1,0: DRAW 1,-1 2620 PLOT 4,62: DRAW 0,-1: DRAW 1,-1: DRAW 1,0: DRAW 1,1: DRAW 0,1: DRAW -1,1: DRAW -1,0: DRAW -1,1: DRAW 1,1: DRAW 1,0: DRAW 1,-1 2621 PLOT 252,62: DRAW 0,-1: DRAW 1,-1: DRAW 1,0: DRAW 1,1: DRAW 0,1: DRAW -1,1: DRAW -1,0: DRAW -1,1: DRAW 1,1: DRAW 1,0: DRAW 1,-1 2625 PLOT 4,120: DRAW 0,-1: DRAW 1,-1: DRAW 1,0: DRAW 1,1: DRAW 0,1: DRAW -1,1: DRAW -1,0: DRAW -1,1: DRAW 1,1: DRAW 1,0: DRAW 1,-1 2626 PLOT 252,120: DRAW 0,-1: DRAW 1,-1: DRAW 1,0: DRAW 1,1: DRAW 0,1: DRAW -1,1: DRAW -1,0: DRAW -1,1: DRAW 1,1: DRAW 1,0: DRAW 1,-1 2630 PLOT 2,13: DRAW -1,0: DRAW -1,-1: DRAW 0,-3: DRAW 1,-1: DRAW 1,0: DRAW 1,1: DRAW 0,1: DRAW -1,1: DRAW -1,0: PLOT 7,8: DRAW 0,5: DRAW -3,-4: DRAW 2,0 2631 PLOT 254,13: DRAW -1,0: DRAW -1,-1: DRAW 0,-3: DRAW 1,-1: DRAW 1,0: DRAW 1,1: DRAW 0,1: DRAW -1,1: DRAW -1,0: PLOT 7,8: DRAW 0,5: DRAW -3,-4: DRAW 2,0 2635 PLOT 2,72: DRAW -1,0: DRAW -1,-1: DRAW 0,-3: DRAW 1,-1: DRAW 1,0: DRAW 1,1: DRAW 0,1: DRAW -1,1: DRAW -1,0: PLOT 7,67: DRAW 0,5: DRAW -3,-4: DRAW 2,0 2636 PLOT 254,72: DRAW -1,0: DRAW -1,-1: DRAW 0,-3: DRAW 1,-1: DRAW 1,0: DRAW 1,1: DRAW 0,1: DRAW -1,1: DRAW -1,0: PLOT 7,67: DRAW 0,5: DRAW -3,-4: DRAW 2,0 2640 PLOT 2,131: DRAW -1,0: DRAW -1,-1: DRAW 0,-3: DRAW 1,-1: DRAW 1,0: DRAW 1,1: DRAW 0,1: DRAW -1,1: DRAW -1,0: PLOT 7,126: DRAW 0,5: DRAW -3,-4: DRAW 2,0 2641 PLOT 254,131: DRAW -1,0: DRAW -1,-1: DRAW 0,-3: DRAW 1,-1: DRAW 1,0: DRAW 1,1: DRAW 0,1: DRAW -1,1: DRAW -1,0: PLOT 255,126: DRAW 0,5: DRAW -3,-4: DRAW 2,0 2645 PLOT 0,17: DRAW 1,-1: DRAW 1,0: DRAW 1,1: DRAW 0,1: DRAW -1,1: DRAW 1,1: DRAW -1,1: DRAW -1,0: DRAW -1,-1: PLOT 7,16: DRAW -3,0: DRAW 3,3: DRAW 0,1: DRAW -1,1: DRAW -1,0: DRAW -1,-1 2646 PLOT 252,17: DRAW 1,-1: DRAW 1,0: DRAW 1,1: DRAW 0,1: DRAW -1,1: DRAW 1,1: DRAW -1,1: DRAW -1,0: DRAW -1,-1: PLOT 255,16: DRAW -3,0: DRAW 3,3: DRAW 0,1: DRAW -1,1: DRAW -1,0: DRAW -1,-1 2650 PLOT 0,75: DRAW 1,-1: DRAW 1,0: DRAW 1,1: DRAW 0,1: DRAW -1,1: DRAW 1,1: DRAW -1,1: DRAW -1,0: DRAW -1,-1: PLOT 7,74: DRAW -3,0: DRAW 3,3: DRAW 0,1: DRAW -1,1: DRAW -1,0: DRAW -1,-1 2651 PLOT 252,75: DRAW 1,-1: DRAW 1,0: DRAW 1,1: DRAW 0,1: DRAW -1,1: DRAW 1,1: DRAW -1,1: DRAW -1,0: DRAW -1,-1: PLOT 255,74: DRAW -3,0: DRAW 3,3: DRAW 0,1: DRAW -1,1: DRAW -1,0: DRAW -1,-1 2655 PLOT 0,134: DRAW 1,-1: DRAW 1,0: DRAW 1,1: DRAW 0,1: DRAW -1,1: DRAW 1,1: DRAW -1,1: DRAW -1,0: DRAW -1,-1: PLOT 7,133: DRAW -3,0: DRAW 3,3: DRAW 0,1: DRAW -1,1: DRAW -1,0: DRAW -1,-1 2656 PLOT 252,134: DRAW 1,-1: DRAW 1,0: DRAW 1,1: DRAW 0,1: DRAW -1,1: DRAW 1,1: DRAW -1,1: DRAW -1,0: DRAW -1,-1: PLOT 255,133: DRAW -3,0: DRAW 3,3: DRAW 0,1: DRAW -1,1: DRAW -1,0: DRAW -1,-1 2660 PLOT 0,27: DRAW 1,1: DRAW 0,-4: PLOT 0,23: DRAW 2,0: PLOT 6,28: DRAW -1,0: DRAW -1,-1: DRAW 0,-3: DRAW 1,-1: DRAW 1,0: DRAW 1,1: DRAW 0,1: DRAW -1,1: DRAW -1,0 2661 PLOT 252,27: DRAW 1,1: DRAW 0,-4: PLOT 0,23: DRAW 2,0: PLOT 254,28: DRAW -1,0: DRAW -1,-1: DRAW 0,-3: DRAW 1,-1: DRAW 1,0: DRAW 1,1: DRAW 0,1: DRAW -1,1: DRAW -1,0 2665 PLOT 0,86: DRAW 1,1: DRAW 0,-4: PLOT 0,82: DRAW 2,0: PLOT 6,87: DRAW -1,0: DRAW -1,-1: DRAW 0,-3: DRAW 1,-1: DRAW 1,0: DRAW 1,1: DRAW 0,1: DRAW -1,1: DRAW -1,0 2666 PLOT 254,86: DRAW 1,1: DRAW 0,-4: PLOT 253,82: DRAW 2,0: PLOT 254,87: DRAW -1,0: DRAW -1,-1: DRAW 0,-3: DRAW 1,-1: DRAW 1,0: DRAW 1,1: DRAW 0,1: DRAW -1,1: DRAW -1,0 2670 PLOT 0,145: DRAW 1,1: DRAW 0,-4: PLOT 0,141: DRAW 2,0: PLOT 6,146: DRAW -1,0: DRAW -1,-1: DRAW 0,-3: DRAW 1,-1: DRAW 1,0: DRAW 1,1: DRAW 0,1: DRAW -1,1: DRAW -1,0 2671 PLOT 254,145: DRAW 1,1: DRAW 0,-4: PLOT 253,141: DRAW 2,0: PLOT 254,146: DRAW -1,0: DRAW -1,-1: DRAW 0,-3: DRAW 1,-1: DRAW 1,0: DRAW 1,1: DRAW 0,1: DRAW -1,1: DRAW -1,0 2675 PLOT 4,32: DRAW 0,-1: DRAW 1,-1: DRAW 1,0: DRAW 1,1: DRAW 0,1: DRAW -1,1: DRAW -1,0: DRAW -1,1: DRAW 1,1: DRAW 1,0: DRAW 1,-1 2676 PLOT 252,32: DRAW 0,-1: DRAW 1,-1: DRAW 1,0: DRAW 1,1: DRAW 0,1: DRAW -1,1: DRAW -1,0: DRAW -1,1: DRAW 1,1: DRAW 1,0: DRAW 1,-1 2680 PLOT 4,91: DRAW 0,-1: DRAW 1,-1: DRAW 1,0: DRAW 1,1: DRAW 0,1: DRAW -1,1: DRAW -1,0: DRAW -1,1: DRAW 1,1: DRAW 1,0: DRAW 1,-1 2681 PLOT 252,91: DRAW 0,-1: DRAW 1,-1: DRAW 1,0: DRAW 1,1: DRAW 0,1: DRAW -1,1: DRAW -1,0: DRAW -1,1: DRAW 1,1: DRAW 1,0: DRAW 1,-1 2685 PLOT 4,150: DRAW 0,-1: DRAW 1,-1: DRAW 1,0: DRAW 1,1: DRAW 0,1: DRAW -1,1: DRAW -1,0: DRAW -1,1: DRAW 1,1: DRAW 1,0: DRAW 1,-1 2686 PLOT 252,150: DRAW 0,-1: DRAW 1,-1: DRAW 1,0: DRAW 1,1: DRAW 0,1: DRAW -1,1: DRAW -1,0: DRAW -1,1: DRAW 1,1: DRAW 1,0: DRAW 1,-1 2690 PLOT 7,38: DRAW 0,5: DRAW -3,-4: DRAW 2,0 2691 PLOT 255,38: DRAW 0,5: DRAW -3,-4: DRAW 2,0 2700 PLOT 7,96: DRAW 0,5: DRAW -3,-4: DRAW 2,0 2701 PLOT 255,96: DRAW 0,5: DRAW -3,-4: DRAW 2,0 2705 PLOT 7,155: DRAW 0,5: DRAW -3,-4: DRAW 2,0 2706 PLOT 255,155: DRAW 0,5: DRAW -3,-4: DRAW 2,0 2710 PLOT 7,45: DRAW -3,0: DRAW 3,3: DRAW 0,1: DRAW -1,1: DRAW -1,0: DRAW -1,-1 2711 PLOT 255,45: DRAW -3,0: DRAW 3,3: DRAW 0,1: DRAW -1,1: DRAW -1,0: DRAW -1,-1 2715 PLOT 7,104: DRAW -3,0: DRAW 3,3: DRAW 0,1: DRAW -1,1: DRAW -1,0: DRAW -1,-1 2716 PLOT 255,104: DRAW -3,0: DRAW 3,3: DRAW 0,1: DRAW -1,1: DRAW -1,0: DRAW -1,-1 2720 PLOT 7,162: DRAW -3,0: DRAW 3,3: DRAW 0,1: DRAW -1,1: DRAW -1,0: DRAW -1,-1 2721 PLOT 255,162: DRAW -3,0: DRAW 3,3: DRAW 0,1: DRAW -1,1: DRAW -1,0: DRAW -1,-1 2725 PLOT 4,169: DRAW 2,0: PLOT 5,170: DRAW 0,4: DRAW -1,-1 2726 PLOT 253,169: DRAW 2,0: PLOT 255,170: DRAW 0,4: DRAW -1,-1 2730 PLOT 4,111: DRAW 2,0: PLOT 5,112: DRAW 0,4: DRAW -1,-1 2731 PLOT 253,111: DRAW 2,0: PLOT 255,112: DRAW 0,4: DRAW -1,-1 2735 PLOT 4,53: DRAW 2,0: PLOT 5,54: DRAW 0,4: DRAW -1,-1 2736 PLOT 253,53: DRAW 2,0: PLOT 255,54: DRAW 0,4: DRAW -1,-1 2800 REM FOR n=1 TO 20: COPY : LPRINT : LPRINT : LPRINT : NEXT n: STOP 2805 FOR n=1 TO 20: COPY : NEXT n: STOP 9998 STOP 9999 SAVE "GRID9X" LINE 100 ```