Index

Developer(s): Dick Cultice
Date: 1985
Type: Program
Platform(s): TS 2068

A TS2068 card-filing system by R. D. Cultice (1985) that stores records — each consisting of a single-character category, a name, a modifier, and a 4-digit file number — in three packed string variables rather than arrays, with 10-character fixed-width entries in the name and modifier pools. A computed GO TO dispatches seven menu functions: search with optional category, name-prefix, and modifier-prefix filtering; record entry in a structured text format; single-level name and modifier editing; tape save and load of all three data strings; and a status report using the TS2068 FREE function to show remaining capacity. A separate 1,111-byte machine code block loaded at address 64256 provides an 80-column print driver, configured via POKEs to the system’s output channel vector. The program is distributed in two tape files — the BASIC loader and the machine code — with initialization handled at line 9992.


INDEX — a card-filing system by R. D. Cultice (1985) for cataloging items with a category code, a name, a modifier (secondary descriptor), and a 4-digit file number. Data is stored in three packed string variables rather than arrays. A separate machine code block (1,111 bytes at address 64256) provides an 80-column print driver.

Data model:

Three string variables serve as packed flat files:

  • D$ — the main directory. Each record is 7 bytes: 1-char category + CHR$ N (name pointer) + CHR$ A (modifier pointer) + 4-char file number.
  • N$ — name pool. Entries are fixed at 10 characters, packed end-to-end. The first 10 bytes are a blank sentinel. Position is encoded in D$ as CHR$ N; decoded as CODE D$(I+1)*10+9.
  • A$ — modifier pool. Same 10-character fixed-width structure as N$.

I$(10) (DIM’d at line 7010) is a fixed-length 10-character working buffer used to normalize tokens before comparing or inserting into N$ and A$.


Menu dispatch (line 1090):

GO TO 4000+VAL Q$*VAL "500" routes to:

KeyLineFunction
14500Search / locate
25000File entry
35500Save to tape
46000Edit menu
56500Status report
67000Initialize
77500Load from tape

Subroutines:

LinesNameFunction
2000COUNTScans F$ from position I1, extracts next space-delimited token, pads to 10 chars into I$()
2100CHECK N$Linear scan of N$ for I$() match; returns pointer J
2200CHECK A$Same for A$
2300LAST FILE NO.Scans D$ backwards for the highest 4-digit file number belonging to the current book
2500CHECK INPUTDisplays “ENTERY OK? Y/N” and PAUSE 0 for confirmation

File entry (lines 5000–5210):

The user types a record in the format: category, name, modifier, 4-digit number — separated by spaces. The program extracts the name and modifier tokens via subroutine 2000, checks whether each already exists in N$/A$, and inserts if not. The directory entry is then appended to D$ as the category character, CHR$ N, CHR$ A, and the 4-digit file number. After each entry the user can continue or return to the menu.

Search (lines 4500–4750):

Scans D$ backwards in 7-byte steps. Optionally filters by category, name prefix, and modifier prefix. Matching entries print category, name (10 chars from N$), modifier (10 chars from A$), and file number. When the E=1 flag is set (by the delete edit path), each match pauses and offers deletion with “D”.

Edit (lines 6000–6390):

Three sub-options: delete a file (routes through search with E=1), edit a name entry in N$, or edit a modifier entry in A$. Delete trims the 7-byte D$ record at position I. Name/modifier edits do a direct 10-character overwrite in N$ or A$ at the located position.

Machine code (line 9992):

CLEAR 64255 protects RAM from 64256 onward. POKEs to 26703/26704 patch in the jump address PRINTORG=64261 — almost certainly patching a system call vector for the ROM’s output channel to redirect through the custom driver. POKE MODE,1, POKE WIDTH,79 configure the driver for 80-column mode. The code block is 1,111 bytes. SAVE "PRCODE" CODE 64256,1111 at line 9984 saves it separately from the BASIC program.

Status (line 6500–6580):

Reports number of files (LEN D$/7), unique names (LEN N$/10-1), unique modifiers (LEN A$/10-1), bytes free (FREE), and remaining capacity for each.

Content

Appears On

Related Products

Related Articles

Related Content

Image Gallery

Index

Source Code

    1 REM **** NAME "INDEX" ****
   10 REM *** COPYWRITE 1985 ****
   20 REM **** R. D. CULTICE ****
 1000 REM **** MENU ****
 1002 CLS 
 1005 PRINT TAB 9;"************";AT 1,9;"**  MENU  **";AT 2,9;"************",,,
 1010 PRINT "   1.  LOCATE FILE"
 1015 PRINT "   2.  ENTER FILE"
 1020 PRINT "   3.  SAVE FILE"
 1025 PRINT "   4.  EDIT"
 1030 PRINT "   5.  STATUS"
 1035 PRINT "   6.  INITIALIZE"
 1040 PRINT "   7.  LOAD FILES"
 1060 INPUT Q$
 1065 IF Q$>CHR$ 48 AND Q$<CHR$ 56 THEN GO TO 1090
 1075 PRINT AT 12,11;AT 12,11;" PARDON "
 1085 GO TO 1060
 1090 GO TO 4000+VAL Q$*VAL "500"                                                              
 2000 REM **** COUNT ****
 2010 FOR I=I1 TO LEN F$-4
 2020 IF F$(I)=" " THEN RETURN 
 2030 LET I$()=F$(I1 TO I)+"         "
 2040 NEXT I
 2050 RETURN                                                                                    
 2100 REM **** CHECK N$ ****
 2110 FOR J=10 TO LEN N$-9 STEP 10
 2120 IF N$(J-9 TO J)=I$() THEN GO TO 2160
 2130 NEXT J
 2140 IF J>=2560 THEN GO TO 6500
 2150 RETURN 
 2160 LET N=(LEN N$-J)/10
 2170 RETURN                                                                                    
 2200 REM **** CHECK A$ ****
 2210 FOR J=10 TO LEN A$-9 STEP 10
 2220 IF A$(J-9 TO J)=I$() THEN GO TO 2260
 2230 NEXT J
 2240 IF J>=2560 THEN GO TO 6500
 2250 RETURN 
 2260 LET A=(LEN A$-J)/10
 2270 RETURN                                                                                    
 2300 REM **** LAST FILE NO. ****
 2305 LET L$="0": IF D$="" THEN RETURN 
 2310 FOR I=LEN D$-3 TO 4 STEP -7
 2320 IF D$(I-3)=F$ AND VAL L$<VAL D$(I TO I+3) THEN LET L$=D$(I TO I+3)
 2330 NEXT I
 2340 RETURN                                                                                    
 2500 REM **** CHECK INPUT ****
 2510 PRINT AT 14,0;"ENTERY OK? Y/N"
 2520 PAUSE 0
 2530 RETURN                                                                                    
 4500 REM **** SEARCH ****
 4510 CLS 
 4520 PRINT "  FILES TO BE LOCATED",,,
 4530 PRINT "CATAGORY H,I OR C ?",,,
 4540 INPUT F$
 4550 PRINT "NAME ?",,,,
 4560 INPUT B$
 4570 PRINT "MODIFIER ?",,,,
 4580 INPUT C$
 4585 CLS 
 4590 PRINT "    SEARCHING",,,,
 4600 FOR I=LEN D$-6 TO 1 STEP -7
 4610 IF F$="" THEN GO TO 4630
 4620 IF F$<>D$(I) THEN GO TO 4730
 4630 LET N=LEN N$-(CODE D$(I+1)*10+9)
 4640 IF B$="" THEN GO TO 4660
 4650 IF B$<>N$(N TO N+LEN B$-1) THEN GO TO 4730
 4660 LET A=LEN A$-(CODE D$(I+2)*10+9)
 4670 IF C$="" THEN GO TO 4700
 4680 IF C$<>A$(A TO A+LEN C$-1) THEN GO TO 4730
 4700 PRINT D$(I);" ";N$(N TO N+9);A$(A TO A+9);D$(I+3 TO I+6)
 4720 IF E=1 THEN GO TO 6120
 4730 NEXT I
 4740 IF INKEY$="" THEN GO TO 4740
 4750 GO TO 1000                                                                                
 5000 REM **** FILE ENTRY ****
 5005 CLS : INPUT "BOOK # ";F$
 5010 GO SUB 2300
 5015 PRINT "LAST FILE NO. ";L$
 5020 PRINT "ENTER FILE NAME IN THE FORM OF  ""I N$ A$ NNNN"""
 5030 INPUT F$
 5035 PRINT F$
 5040 GO SUB 2500
 5045 IF INKEY$<>"Y" THEN GO TO 5000
 5050 LET I1=3
 5060 GO SUB 2000
 5070 GO SUB 2100
 5080 IF N$(J-9 TO J)=I$() THEN GO TO 5110
 5090 LET N$=I$()+N$
 5100 LET N=J/10
 5110 LET I1=I+1
 5120 GO SUB 2000
 5130 GO SUB 2200
 5140 IF A$(J-9 TO J)=I$() THEN GO TO 5170
 5150 LET A$=I$()+A$
 5160 LET A=J/10
 5170 LET D$=D$+F$(1)+CHR$ N+CHR$ A+F$(LEN F$-3 TO )
 5180 PRINT AT 16,0;"FINNISED ? Y/N"
 5190 IF INKEY$="" THEN GO TO 5190
 5200 IF INKEY$="Y" THEN GO TO 1000
 5210 GO TO 5000                                                                                
 5500 REM **** SAVE FILES ****
 5510 CLS : IF S$<>"" THEN GO TO 5530
 5520 PRINT "ENTER FILE NAME ": INPUT S$
 5530 PRINT "FILE NAME """;S$;"""": PRINT "START RECORDER THEN ENTER,      3-SAVES."
 5540 SAVE S$ DATA D$(): SAVE S$ DATA N$(): SAVE S$ DATA A$()
 5550 GO TO 1000
 5560 PAUSE 0
 5570 PAUSE 600
 5580 SAVE S$ LINE 1000
 5590 GO TO 1000                                                                                
 6000 REM **** EDIT ****
 6010 CLS 
 6020 PRINT "1. DELETE FILE"'"2. EDIT NAME"'"3. EDIT MODIFIER"
 6030 INPUT Q$
 6040 GO TO 6000+VAL Q$*100
 6050 GO TO 6000
 6100 LET E=1
 6110 GO TO 4520
 6120 PRINT """D"" DELETES"
 6130 PAUSE 4E4
 6140 IF INKEY$<>"D" THEN GO TO 6180
 6150 IF I=1 THEN LET D$=D$(I+7 TO )
 6160 IF I=LEN D$-6 THEN LET D$=D$( TO I-1)
 6170 IF I<>1 AND I<>LEN D$-6 THEN LET D$=D$( TO I-1)+D$(I+7 TO )
 6180 LET E=0
 6190 GO TO 1000                                                                                
 6200 PRINT "ENTER FILE NAME"
 6210 INPUT F$
 6220 LET I$()=F$
 6230 GO SUB 2100
 6240 PRINT N$(J-9 TO J)
 6250 PRINT "CHANGE TO ?"
 6260 INPUT F$
 6270 LET I$()=F$
 6280 LET N$(J-9 TO J)=I$()
 6290 GO TO 1000                                                                                
 6300 PRINT "ENTER MODIFIER"
 6310 INPUT F$
 6320 LET I$()=F$
 6330 GO SUB 2200
 6340 PRINT A$(J-9 TO J)
 6350 PRINT "CHANGE TO ?"
 6360 INPUT F$
 6370 LET I$()=F$
 6380 LET A$(J-9 TO J)=I$()
 6390 GO TO 1000                                                                                
 6500 REM **** STATUS ****
 6510 CLS 
 6520 PRINT "FILES...... ";LEN D$/7
 6530 PRINT "NAMES...... ";LEN N$/10-1
 6540 PRINT "MODIFIERS.. ";LEN A$/10-1
 6550 PRINT "BYTES FREE. ";FREE ,,,
 6560 PRINT "ROOM LEFT FOR ";INT (FREE /7);" FILES, ",256-LEN N$/10;" NAMES, ";256-LEN A$/10;" MODIFIES."
 6570 PAUSE 0
 6580 GO TO 1000                                                                                
 7000 REM **** INITIALIZE ****
 7010 DIM I$(10)
 7020 LET N$="          "
 7030 LET A$="          "
 7040 LET D$=""
 7050 LET A=0
 7060 LET N=0
 7080 LET S$=""
 7085 LET E=0
 7090 GO TO 1000
 7500 REM **** LOAD FILES ****
 7510 CLS : PRINT "FILE NAME": IF S$="" THEN INPUT S$
 7520 PRINT """";S$;"""": PRINT "START RECORDER"
 7530 LOAD S$ DATA D$(): LOAD S$ DATA N$(): LOAD S$ DATA A$()
 7540 GO TO 1000
 9980 STOP 
 9983 REM *** save starts here *
 9984 SAVE "INDEX1" LINE 9990: SAVE "PRCODE"CODE 64256,1111
 9988 GO TO 1000
 9990 REM GOTO here to initialize BASIC and load machine code PRINT DRIVER
 9992 CLEAR 64255: LET PRINTORG=64261: POKE 26704,INT (PRINTORG/256): POKE 26703,PRINTORG-(INT (PRINTORG/256))*256: LET MODE=64256: LET TRASH=MODE+1: LET POS=TRASH+1: LET WIDTH=POS+1: POKE MODE,1: POKE POS,0: POKE TRASH,0: POKE WIDTH,79: LOAD ""CODE 64256,1111
 9994 REM  Jump to start of your BASIC program
 9996 GO TO 1000
 9998 CLS : PRINT AT 8,0;"Looking for program from tape...",,,,,,,,"Start Tape Recorder": LOAD ""

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

Scroll to Top