This program implements a video tape catalog manager that stores up to 100 entries, each recording a title (20 characters), subject (7 characters), and tape number (3 characters) packed into a 32-character string array row. Navigation uses a computed GO TO (line 260: `GO TO 1000*B`) to dispatch menu choices to entry, display, save, clear, print, and sort routines. The sort routine at line 6200 implements a Shell sort (Shell’s diminishing-increment method), halving the gap size on each pass and comparing substrings of the 2D array. Data is persisted to tape via a SAVE command and can be verified immediately afterward using VERIFY at line 9999.
Program Analysis
Program Structure
The program is organized as a menu-driven application with six major functional areas dispatched via a computed GO TO at line 260 (GO TO 1000*B). Each menu choice multiplies the user’s input by 1000 to jump to the corresponding routine block.
| Line Range | Function |
|---|---|
| 10–260 | Initialization, splash screen, main menu |
| 1000–1540 | Enter new program records |
| 2000–2999 | View/edit program data (sub-menu with its own computed GO TO) |
| 3000–3080 | Save data to tape |
| 4000–4020 | Clear all data (via RUN) |
| 5000–5080 | Print data via LPRINT |
| 6000–6370 | Sort data (Shell sort) |
| 8650–8960 | Edit subject and tape number fields |
| 9000–9025 | Subroutine: wait for Enter keypress |
| 9600–9620 | Subroutine: animated border display |
| 9700–9790 | Subroutine: animated title display |
| 9998–9999 | Save and verify the program itself to tape |
Data Storage Layout
All catalog data is held in a single two-dimensional string array A$(100,32) declared at line 10. Each row stores exactly 32 characters, subdivided into fixed-width fields:
- Columns 1–20: Video title (up to 20 characters)
- Columns 22–28: Subject category (up to 7 characters)
- Columns 30–32: Tape number (up to 3 characters)
Column 21 and column 29 serve as implicit separators (spaces), making each row directly printable as a formatted line. The variable R1 tracks the count of used records and is initialized to 0 at line 11.
Menu Dispatch Technique
The main menu uses GO TO 1000*B (line 260), where B is a numeric input (1–6). This maps choices directly to line numbers 1000, 2000, 3000, 4000, 5000, and 6000 without any IF chain. The secondary “Program Data” sub-menu at line 2260 uses GO TO B*200+2100, dispatching to lines 2300, 2500, 2700, and 2900 for its four choices.
Shell Sort Implementation
Lines 6000–6370 implement a Shell sort on the array. The user selects the sort key by entering 1, 2, or 4, which sets variables A and B to the column slice boundaries for comparison. The gap (N) starts at half of R1 and is halved each outer pass (line 6220). Rows are swapped by copying the full 32-character row into B$ as a temporary variable.
Animated Introduction Routines
Two startup subroutines provide visual flair. Subroutine 9700 animates the title string character-by-character, dropping each letter down the screen from row 15 to row 20 while playing ascending and descending BEEP pitches simultaneously. Subroutine 9600 draws 21 rows of block-graphic characters (\ , the ▗ glyph) with an accompanying ascending tone sweep, creating a wipe-in curtain effect.
Keypress Wait Subroutine
The “press Enter to continue” subroutine at line 9000 uses a two-step technique: it first uses INPUT INK 8; to capture a keypress with invisible ink, then at line 9010 polls INKEY$ in a tight loop until CHR$ 13 (Enter) is detected. This double-check ensures the routine does not proceed spuriously. Three BEEP tones confirm acceptance.
Data Persistence
Option 3 (lines 3000–3080) prompts for a filename and issues a bare SAVE C$, which saves the entire program and its current variable state — including the populated A$ array — to tape. The user is warned to prepare the recorder before pressing Enter. Lines 9998–9999 provide a separate mechanism to save and immediately verify the program file named "VIDEO FILE" with a 240-frame pause between operations.
Bugs and Anomalies
- Line 1500 is referenced by
GO TO 1500(line 1070) but does not exist; execution falls through to line 1510, which is the intended exit path — a common deliberate technique. - Line 2544 is referenced at line 2755 (
GO TO 2544) but does not exist; the nearest line is 2542, causing an error rather than reaching the “not in file” message. This is likely a typo bug. - Line 2693 references
Z$in a PRINT statement.Z$is set at line 9700 to"VIDEO TAPE FILE ", so this will print that string — probably unintended as a confirmation display. - The sub-menu at line 2260 dispatches to line 2300 (choice 1), 2500 (choice 2), 2700 (choice 3), and 2900 (choice 4), but the sub-menu at line 2000 only presents options 1–4 without labeling option 3 correctly as “SEE ITEM DATA” corresponding to line 2700.
- Lines 8650–8660 print the header twice consecutively with no intervening display of the updated record, which appears to be unfinished edit confirmation logic.
- The sort option menu at line 6040 lists tape number as choice
(4)rather than(3), meaning choice 3 is absent — entering 3 would set neitherAnorB, causing an error or sorting by uninitialized values. - The
INPUT INK 8;at line 9000 uses a color attribute of 8 (transparent/no change in Spectrum BASIC), effectively making the prompt invisible — this appears intentional to hide the input cursor prompt text.
Content
Source Code
10 DIM A$(100,32)
11 LET R1=0
19 GO SUB 9700
20 BORDER 1: PAPER 6: INK 0
22 LET K$="--------------------------------"
25 CLS
40 GO SUB 9600
70 PAPER 6: INK 0: PRINT AT 2,7;" VIDEO TAPE FILE "
80 PRINT AT 5,1;"TO\::ENTER\::PROGRAMS";TAB 26;"-\::1"
90 PRINT AT 7,1;"TO\::SEE\::PROGRAMS";TAB 26;"-\::2"
100 PRINT AT 9,1;"TO\::SAVE\::DATA\::ON\::TAPE";TAB 26;"-\::3"
110 PRINT AT 11,1;"TO\::CLEAR\::ALL\::DATA ";AT 11,26;"-\::4"
120 PRINT AT 13,1;"TO\::PRINT\::DATA\::";TAB 26;"-\::5"
130 PRINT AT 15,1;"TO\::SORT\::DATA\::";TAB 26;"-\::6"
140 PRINT AT 18,1;"IF PROGRAM STOPS-ENTER GOTO 20"
150 INK 0: PRINT AT 21,1;"DO NOT ENTER 'RUN'!!!!!!!!!!!!"
180 INPUT "ENTER ONE OF ABOVE ";B
250 CLS
260 GO TO 1000*B
1000 FOR N=R1+1 TO 100
1010 PRINT AT 1,8;"FILE NUMBER ";N
1020 PRINT AT 5,5;" WHAT IS THE TITLE?"
1025 PRINT AT 6,5;"(20 CHARACTERS MAX)"
1030 PRINT
1040 PRINT AT 10,1;"TITLE: ";
1055
1060 INPUT B$
1065 PRINT B$
1070 IF B$="" THEN GO TO 1500
1080 LET A$(N, TO 20)=B$
1110
1120 PRINT AT 5,5;"WHAT'S THE PROGRAM SUBJECT?"
1126 PRINT AT 6,5;"( 7 CHARACTERS MAX)"
1130 PRINT AT 12,1;"SUBJECT: ";
1135
1140 INPUT B$
1142 PRINT B$
1145 IF LEN B$>7 THEN GO TO 1135
1150 LET A$(N,22 TO 28)=B$
1260 PRINT AT 5,5;"WHAT IS THE TAPE NUMBER? "
1270 PRINT AT 6,5;"( 3 CHARACTERS MAX.)"
1275 PRINT AT 14,1;"TAPE NO.: ";
1280 INPUT B$
1285 PRINT B$
1290 IF LEN B$>3 THEN GO TO 1275
1320 LET A$(N,30 TO 32)=B$
1340 GO SUB 9000
1351
1355
1365
1390 NEXT N
1510 CLS
1520 LET R1=N-1
1530
1540 GO TO 20
1999 STOP
2000
2010 CLS
2030 FOR N=1 TO 42
2035 BEEP .02,.005*N
2040 PRINT "\::\::\::\::\::\::\::\::\::\::\::\::\::\::\::\::";
2050 NEXT N
2060 PRINT AT 2,8;" PROGRAM DATA "
2070 PRINT AT 5,1;"TO\::SEE\::ALL\::PROGRAM\::DATA";TAB 28;"-\::1"
2080 PRINT AT 7,1;"TO\::CHANGE\::PROGRAM\::NAME";TAB 28;"-\::2"
2090 PRINT AT 9,1;"TO\::SEE\::ITEM\::DATA";TAB 28;"-\::3"
2100 PRINT AT 11,1;"TO\::EDIT\::DATA\::ITEMS";TAB 28;"-\::4"
2180 INPUT "ENTER ONE OF ABOVE :::";B
2190
2230
2250 CLS
2260 GO TO B*200+2100
2300
2310 FOR N=1 TO R1
2320
2340
2350 LET X$=" VIDEO TITLE SUBJECT NO."
2360 IF N<=1 THEN PRINT X$
2365 PRINT K$
2370
2380 PRINT A$(N)
2382
2384
2386
2388 NEXT N
2390 GO SUB 9000
2395 GO TO 20
2500 PRINT AT 10,0;" WHAT IS THE PROGRAM NAME?"
2505
2510 INPUT B$
2515
2520 FOR N=1 TO R1
2525
2530 IF A$(N, TO LEN B$)=B$ THEN GO TO 2560
2540 NEXT N
2542 CLS
2546 PRINT "PROGRAM NAME NOT IN FILE :::"
2548 GO SUB 9000
2550 GO TO 20
2660
2662 CLS
2666 PRINT " VIDEO TITLE SUBJECT NO."
2668
2670 PRINT K$
2672
2674 PRINT A$(N)
2678 PRINT AT 20,0;"IS THIS THE PROGRAM YOU ARE LOOKING FOR? Y/N"
2679
2680 INPUT Y$
2682
2683 IF Y$(1)="N" THEN GO TO 2540
2684
2685
2686 PRINT "WHAT IS THE NEW NAME?"
2687
2688 INPUT B$
2689
2690 LET A$(N, TO 20)=B$
2691
2692
2693 PRINT Z$
2694
2695 PRINT A$(N)
2696
2697 GO SUB 9000
2699 GO TO 20
2700 CLS
2705 PRINT AT 10,1;"WHAT IS THE PROGRAM NAME?"
2710
2715 INPUT B$
2720
2725 IF LEN B$>20 THEN GO TO 2710
2730 FOR N=1 TO R1
2735 IF A$(N, TO LEN B$)=B$ THEN GO TO 2760
2740 NEXT N
2745
2750 PRINT TAB 16-((LEN B$)/2);B$
2755 GO TO 2544
2760 CLS
2765 PRINT ,,,,"PROGRAM:";TAB 9;A$(N, TO 20)
2770 PRINT ,,"SUBJECT: ";TAB 9;A$(N,22 TO 28)
2780 PRINT ,,"TAPE NO.";TAB 10;A$(N,30 TO 32)
2790 GO SUB 9000
2820 GO TO 20
2900 CLS
2905 PRINT AT 10,1;" WHAT IS THE PROGRAM NAME?"
2910
2915 INPUT B$
2920
2925 IF LEN B$>20 THEN GO TO 2910
2930 FOR N=1 TO R1
2935 IF A$(N, TO LEN B$)=B$ THEN GO TO 2950
2940 NEXT N
2945 GO TO 2745
2950 CLS
2955 PRINT " VIDEO TITLE SUBJECT NO."
2960 PRINT K$;A$(N)
2965 PRINT ,,,,"<1> SUBJECT","<2> TAPE NO.": INPUT "CHOOSE ONE";B
2975 GO TO 8500+(200*B)
2999 GO TO 2999
3000
3002 CLS
3006 PRINT AT 10,10;"FILE NAME?"
3010
3020 INPUT C$
3030 PRINT AT 12,0;"PREPARE THE RECORDER AND THEN PRESS ENTER :::"
3050 SAVE C$
3060
3070 CLS
3080 GO TO 20
4000
4010 CLS
4020 RUN
5000 PRINT AT 10,0;"SET UP PRINTER AND PRESS ENTER."
5010 INPUT B$
5020 FOR N=1 TO R1
5030 LPRINT
5040 IF N<=1 THEN LPRINT " VIDEO TITLE SUBJECT NO."
5050 LPRINT "--------------------------------"
5060 LPRINT A$(N)
5070 NEXT N
5080 GO TO 20
6000 PRINT AT 8,0;"SORT BY?"
6010 PRINT ,"TITLE (1)"
6020 PRINT ,"SUBJECT (2)"
6040 PRINT ,"TAPE NO. (4)"
6055 INPUT "ENTER ONE OF ABOVE";B$
6070 IF B$="1" THEN LET A=1
6080 IF B$="1" THEN LET B=20
6090 IF B$="2" THEN LET A=22
6100 IF B$="2" THEN LET B=28
6130 IF B$="4" THEN LET A=30
6140 IF B$="4" THEN LET B=32
6200 CLS
6210 LET N=R1
6220 LET N=INT (N/2)
6230 IF N=0 THEN GO TO 20
6240 LET J=1
6250 LET K=R1-N
6260 LET I=J
6270 LET L=I+N
6280 IF A$(I,A TO B)<A$(L,A TO B) THEN GO TO 6350
6290 LET B$=A$(I)
6300 LET A$(I)=A$(L)
6310 LET A$(L)=B$
6320 LET I=I-N
6330 IF I<1 THEN GO TO 6350
6340 GO TO 6270
6350 LET J=J+1
6360 IF J>K THEN GO TO 6220
6370 GO TO 6260
8650 PRINT " VIDEO TITLE SUBJECT NO."
8660 PRINT " VIDEO TITLE SUBJECT NO."
8680 GO TO 20
8700 PRINT ,,"WHAT IS THE NEW SUBJECT?"
8710
8720 INPUT B$
8730
8740 IF LEN B$>7 THEN GO TO 8710
8750 LET A$(N,22 TO 28)=B$
8760 GO TO 8660
8900 PRINT ,,"WHAT IS THE NEW TAPE NO."
8910
8920 INPUT B$
8930
8940 IF LEN B$>3 THEN GO TO 8910
8950 LET A$(N,30 TO 32)=B$
8960 GO TO 8660
9000 INPUT INK 8;"PRESS <ENTER> TO CONTINUE";I$
9010 LET I$=INKEY$
9015 IF I$<>CHR$ 13 THEN GO TO 9010
9020 BEEP .05,2: BEEP .05,9: BEEP .05,20
9025 CLS : RETURN
9600 FOR I=1 TO 21
9605 BEEP .04,.005*I
9610 PAPER 0: INK 7: PRINT "\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "
9615 NEXT I
9620 RETURN
9700 LET Z$="VIDEO TAPE FILE "
9705 LET P=-1+15-LEN Z$/2
9720 FOR C=1 TO LEN Z$
9730 LET CP=P+C
9740 FOR L=15 TO 20
9745 BEEP .007,L-10: BEEP .007,60-L
9750 PRINT AT L-1,CP;" ";
9760 PRINT AT L,CP;Z$(C);
9770 NEXT L
9780 NEXT C
9790 RETURN
9998 SAVE "VIDEO FILE"
9999 CLS : PRINT AT 10,6;"REWIND TO VERIFY": PAUSE 240: VERIFY "VIDEO FILE"
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.


