--- title: "Marketing Performance" id: 56994 type: "computer_media" slug: "marketing-performance" url: "http://localhost/computer_media/marketing-performance/" markdown_url: "http://localhost/computer_media/marketing-performance.md" published_at: "2024-10-02T06:53:55+00:00" modified_at: "2026-03-30T21:20:23+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2024/10/19_Mark.png" excerpt: "Enter up to eight quarters of marketing figures and watch this program draw a comparative horizontal bar chart — capped at 22 units each — using block graphics." 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 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: "Business" slug: "business" taxonomy: "genre" url: "http://localhost/type/business/" media_contents: - id: 56732 title: "Timex Sinclair Public Domain Library Tape 1001" type: "computer_media" url: "http://localhost/computer_media/timex-sinclair-public-domain-library-tape-1001/" media_type: "Program" mediadate: "198x" images: - url: "http://localhost/wp-content/uploads/2024/10/19_Mark.png" media_type_tags: "Business" --- # Marketing Performance This program collects marketing performance data for eight quarters and displays a horizontal bar chart comparing the values. Each quarter’s data is entered as a number from 0 to 22, representing units of 1,000, and validated at line 130 to prevent values exceeding 22. The bar chart is rendered using CHR$ 128, producing a continuous filled bar. After displaying the chart with a “X 1000” label, the program waits for a keypress via a busy-loop INKEY$ poll at line 300, then clears and restarts the data-entry cycle. *** ## Program Analysis ### Program Structure The program is divided into four logical phases: 1. **Introduction** (lines 1–8): Displays a title and description of the program’s purpose. 2. **Initialisation and data entry** (lines 10–150): Clears memory, dimensions the array, and loops eight times to collect and validate quarter data. 3. **Chart display** (lines 200–290): Iterates over the stored values and prints a horizontal bar for each quarter. 4. **Keypress wait and restart** (lines 300–320): Polls `INKEY$` in a tight loop, then clears and jumps back to line 10. Lines 375–500 form a separate save/auto-run block: line 375 clears memory, line 400 saves the program under the name `1001%9`, and line 500 issues `RUN`. These lines are not reachable during normal execution. ### Data Entry and Validation The array `N(8)` holds one integer per quarter. Line 130 enforces an upper bound of 22 with `IF N(P)>22 THEN GOTO 120`, re-prompting on invalid input. There is no lower-bound check, so negative values are accepted without complaint and would cause the `FOR L=0 TO N(P)-1` loop at line 220 to execute zero iterations (harmlessly producing an empty bar). A lower-bound guard such as `IF N(P)<0 THEN GOTO 120` is absent. The limit of 22 is chosen to fit within the 32-column display: the label `QRTER X` (8 characters including the trailing space) plus up to 22 block characters equals 30 characters — leaving a small margin before the right edge. ### Bar Chart Rendering Each bar is drawn by printing `CHR$ 128` repeatedly in a `FOR` loop. CHR$ 128 is the solid block graphic, giving a filled horizontal bar appearance. Two `PRINT` statements at lines 250–260 produce a blank line between each quarter’s row, spacing the chart for readability. The label `QRTER` (an abbreviated form of “QUARTER”) is printed with a trailing semicolon so that the bar begins on the same line. ### Notable Techniques and Idioms - **Busy-loop keypress wait**: Line 300 (`IF INKEY$="" THEN GOTO 300`) spins until any key is pressed before restarting. This is a standard BASIC idiom in place of `PAUSE 0`. - **In-loop CLS**: Line 140 clears the screen after each quarter’s entry, keeping the display uncluttered during input. - **Continuous operation**: Line 320 (`GOTO 10`) causes the program to loop indefinitely, re-entering data after each chart is viewed. - **Scale label**: Line 290 prints `X 1000` at `TAB 10` beneath the chart, indicating each bar unit represents 1,000 — effectively giving a range of 0–22,000. ### Anomalies and Minor Issues | Line | Issue | | --- | --- | | `7` | Typo: “COMPARAATIVE” (double A) in the introductory text. | | `130` | No lower-bound validation; negative inputs are silently accepted and result in an empty bar. | | `375–500` | Unreachable during normal execution; these lines serve only as a save-and-autorun block and have no effect on program flow. | ## Source Code ``` 1 REM MARKETING PERFORMANCE 5 PRINT "MARKETING PERFORMANCE" 6 PRINT 7 PRINT "THIS PROGRAM WILL TAKE DATA FOR 8 QUARTERS AND DISPLAY A GRAPH SHOWING COMPARAATIVE DATA." 8 PRINT 10 CLEAR 20 DIM N(8) 100 FOR P=1 TO 8 110 PRINT "DATA FOR QUARTER NUMBER ";P;" ?" 120 INPUT N(P) 130 IF N(P)>22 THEN GOTO 120 140 CLS 150 NEXT P 200 FOR P=1 TO 8 210 PRINT "QRTER ";P; 220 FOR L=0 TO N(P)-1 230 PRINT CHR$ 128; 240 NEXT L 250 PRINT 260 PRINT 270 NEXT P 280 PRINT 290 PRINT TAB 10;"X 1000" 300 IF INKEY$="" THEN GOTO 300 310 CLS 320 GOTO 10 375 CLEAR 400 SAVE "1001%9" 500 RUN ```