Marketing Performance

This file is part of Timex Sinclair Public Domain Library Tape 1001 . Download the collection to get this file.
Date: 198x
Type: Program
Platform(s): TS 1000
Tags: Business

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

LineIssue
7Typo: “COMPARAATIVE” (double A) in the introductory text.
130No lower-bound validation; negative inputs are silently accepted and result in an empty bar.
375–500Unreachable during normal execution; these lines serve only as a save-and-autorun block and have no effect on program flow.

Content

Appears On

Assembled by Tim Ward from many sources. Contains programs 10001 – 10050.

Related Products

Related Articles

Related Content

Image Gallery

Marketing Performance

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 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top