Label Maker

Date: 198x
Type: Program
Platform(s): TS 2068
Tags: Business, Home

This program is a label-making utility that collects four lines of text from the user and prints them centered on a printer. Each text field is validated to a maximum of 32 characters, and the centering calculation uses the formula TAB 16-(LEN string/2), placing each line symmetrically around column 16 of a 32-column printer output. After a screen preview with a flashing confirmation prompt, the user specifies a copy count and the program loops through LPRINT statements, adding blank lines between the third and fourth fields for spacing. The program also supports repeat runs for multiple label designs without restarting.


Program Analysis

Program Structure

The program is organized into three logical phases: data entry and screen preview (lines 10–54), printing (lines 100–132), and post-print flow control (lines 140–160). A SAVE/VERIFY routine at line 9000 handles program persistence. Each of the four label fields follows an identical pattern of INPUT, length validation, and centered PRINT.

Input and Validation

Each of the four string fields (a$, b$, c$, d$) is collected with INPUT and immediately tested with IF LEN x$>32 THEN GO TO back to the corresponding input line. This enforces a 32-character maximum matching the assumed printer column width, preventing overflow on output.

Centering Algorithm

Both the screen preview and the LPRINT output use the formula TAB 16-(LEN x$/2) to center text. This works correctly for a 32-column output device: subtracting half the string length from the midpoint column (16) gives the starting tab position. For odd-length strings, integer truncation shifts the text one character to the right of true center, which is a minor cosmetic effect inherent to integer arithmetic in BASIC.

Keypress Confirmation Idiom

Lines 51–54 implement a three-step keypress flush-and-wait sequence. Line 51 waits until no key is held (draining any residual keypress from the INPUT), line 52 waits until a key is pressed, and line 54 checks whether that key is "n" to restart. This pattern avoids the PAUSE 0/INKEY$ idiom but achieves the same effect through polling loops. Note that line 54 reads INKEY$ a second time — if the key has been released between lines 52 and 54, the condition will never trigger and the program will always proceed to printing regardless of the intended "n" response. This is a latent bug.

Print Layout

The LPRINT section (lines 120–130) outputs the four label fields with five blank lines between the third (c$) and fourth (d$) fields, and two blank lines after the fourth. This creates a visual separation between the main label body and a bottom line, suitable for a footer or price/barcode area. The copy loop uses a simple FOR i=1 TO x counter.

Post-Print Flow Control

After printing, the program offers two levels of re-entry. Line 142 allows reprinting the same label set with a new copy count by returning to line 100. Line 152 allows a completely new label to be designed by returning to line 10. This nested re-run structure avoids reloading the program for batch label jobs.

Notable Techniques and Anomalies

  • The screen preview uses PRINT #1; FLASH 1;"Correct? (y/n)", directing output to stream 1 (the lower display area) with flashing text to draw attention.
  • Line 100 prints 16 spaces at AT 21,8 before the copy-count input, clearing any previous content in that area of the screen.
  • The LPRINT statements at line 126 use five consecutive LPRINT calls on a single line separated by colons, a common line-count-saving idiom.
  • The confirmation keypress bug at line 54 (reading INKEY$ after the wait loop at 52 has already consumed the keypress) means the "n" branch may never be taken reliably if the key is released quickly.
  • The d$ field is described as “Bottom Line:” in the prompt but is separated from c$ by five blank lines in print output, suggesting it is intended as a distinct footer element.

Variable Summary

VariablePurpose
a$Program title / label line 1
b$Label line 2
c$Label line 3
d$Bottom line / footer
xNumber of copies to print
x$Yes/no response for repeat prompts
iCopy loop counter

Content

Appears On

Related Products

Related Articles

Related Content

Image Gallery

Label Maker

Source Code

   10 CLS : INPUT "Program Title:";a$
   12 IF LEN a$>32 THEN GO TO 10
   14 PRINT TAB 16-(LEN a$/2);a$
   20 INPUT "Line #2 Info:";b$
   22 IF LEN b$>32 THEN GO TO 20
   24 PRINT TAB 16-(LEN b$/2);b$
   30 INPUT "Line #3 Info:";c$
   32 IF LEN c$>32 THEN GO TO 30
   34 PRINT TAB 16-(LEN c$/2);c$
   40 INPUT "Bottom Line:";d$
   42 IF LEN d$>32 THEN GO TO 40
   44 PRINT TAB 16-(LEN d$/2);d$
   50 PRINT #1; FLASH 1;"Correct? (y/n)"
   51 IF INKEY$<>"" THEN GO TO 51
   52 IF INKEY$="" THEN GO TO 52
   54 IF INKEY$="n" THEN GO TO 10
  100 PRINT AT 21,8;"                ": INPUT "Number of copies? ";x
  110 FOR i=1 TO x
  120 LPRINT TAB 16-(LEN a$/2);a$
  122 LPRINT TAB 16-(LEN b$/2);b$
  124 LPRINT TAB 16-(LEN c$/2);c$
  126 LPRINT : LPRINT : LPRINT : LPRINT : LPRINT 
  128 LPRINT TAB 16-(LEN d$/2);d$
  130 LPRINT : LPRINT 
  132 NEXT i
  140 INPUT "More? (y/n):";x$
  142 IF x$="y" THEN GO TO 100
  150 INPUT "Another title? (y/n):";x$
  152 IF x$="y" THEN GO TO 10
  160 CLS : PRINT AT 10,8;"Work Complete": STOP 
 9000 SAVE "LABELMAKER": PRINT "Rewind & Key ENTER to VERIFY.": PAUSE 0: VERIFY "LABELMAKER"

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

People

No people associated with this content.

Scroll to Top