--- title: "LKDOS Disk to Tape" id: 72216 type: "computer_media" slug: "lkdos-disk-to-tape" url: "http://localhost/computer_media/lkdos-disk-to-tape/" markdown_url: "http://localhost/computer_media/lkdos-disk-to-tape.md" published_at: "2026-10-23T01:10:29+00:00" modified_at: "2026-10-23T01:10:29+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2026/10/dsktap-1.png" excerpt: "Copies every BASIC program on an LKDOS disk or RAMdisk to cassette in one pass, reading the filenames straight off the CAT display with SCREEN$." 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 2068" slug: "ts2068" taxonomy: "post_tag" url: "http://localhost/tag/ts2068/" model: - name: "Timex/Sinclair 2068" slug: "ts-2068" taxonomy: "model" url: "http://localhost/model/ts-2068/" indiv: - name: "Earl Dunnington" slug: "earl-dunnington" taxonomy: "indiv" url: "http://localhost/indiv/earl-dunnington/" genre: - name: "Utility" slug: "utility" taxonomy: "genre" url: "http://localhost/type/utility/" media_type: "Program" programmers: - name: "Earl Dunnington" slug: "earl-dunnington" taxonomy: "indiv" url: "http://localhost/indiv/earl-dunnington/" download_url: "https://archive.org/download/timex-sinclair-software-archive/LKDOS%20Disk%20to%20Tape%20%28198x%29%28Dunnington%2C%20Earl%29%28TS2068%29%28US%29%28Program%29.tap.zip" mediadate: "1988" images: - url: "http://localhost/wp-content/uploads/2026/10/dsktap-1.png" media_type_tags: "Utility" license: false --- # LKDOS Disk to Tape Copies every BASIC program on a Larken LKDOS disk to cassette in one unattended pass. You pick a drive from 0 to 3, or 4 for the RAMdisk, and the program catalogs the disk, picks out every file with a `.B` extension and saves each one to tape in turn. When the last program is done it erases its temporary file and prints "ALL BASIC PROGRAMS ON TAPE". Machine code and other file types are skipped. It needs the Larken disk interface and LKDOS. This is the cassette version (V1), by Earl Dunnington. It uses the "2068 Turboloader" machine code, loaded as `turbo.C2` (2066 bytes at 63380). A notice in the program says the Turboloader code is copyrighted and was published by special permission in the July/August 1988 issue of TDM (Time Designs Magazine), and that the code was modified by POKEing zero into addresses 64815 to 64817. ## Program Analysis ### Program Structure The tape holds three blocks: the startup program `DSKTAP.B1`, the `turbo.C2` code and the copier `DSKTAP.B3`. - **DSKTAP.B1**, lines 5–100: shows the TDM copyright notice and the title, runs `CLEAR 63379` and asks for a drive number. Line 30 selects the drive through LKDOS with `RANDOMIZE USR 100: OPEN #4,"dd": PRINT #4: GO TO A`. Line 50 asks for an unprotected disk, and line 60 asks for the write-protect switch to be off when the RAMdisk is chosen. Line 70 loads `turbo.C2` and `DSKTAP.B3` from tape. Subroutine 100 waits for a key. - **DSKTAP.B3**, line 10051: runs a disk `CAT` to the screen and dimensions `A$(44,9)`. - Lines 10052 and 10059: read the catalog back off the screen with `SCREEN$`, 22 rows from column 0 and 22 rows from column 16, nine characters each. - Lines 10053–10055: count the names containing `.B`, copy them into `B$`, shrink `A$` to free memory and wait for a key once a blank tape is running. - Lines 10056–10057: for each name, trim trailing spaces, save the copier itself to disk as `dsktap.B1` with `LINE 10058`, `MERGE` the disk program, call the machine code at 63600, `RUN 1500`, `SAVE` the program to tape under its disk name and reload `dsktap.B1` from disk. - Line 10058: the reloaded copier starts here and goes on to the next name. After the last one it `ERASE`s `dsktap.B1` and stops. ### Notable Techniques - The copier keeps its place in the file list by saving itself to disk, variables included, with an autostart line before each `MERGE`. Reloading that copy brings back `N`, `B$` and the loop and lands on `NEXT N` at line 10058. - Instead of reading the directory itself, the program displays the catalog and scrapes it with `SCREEN$`. - Every LKDOS command is preceded by `RANDOMIZE USR 100`, which hands the next disk statement to LKDOS. - `SIN PI` and `SGN PI` stand in for 0 and 1, and `VAL "nn"` is used for other constants, to save memory. `PAUSE SIN PI` acts as `PAUSE 0`. ### Potential Issues - Only the first 44 catalog entries can be seen, because the scan covers two columns of 22 rows. - The disk program is merged into the copier, which occupies lines 10050–10059. A program that uses any of those line numbers would overwrite part of the copier. - The disk must be writable, since the copier saves its temporary file there. - `RUN 1500` would normally clear the variables and run the merged program, so the `SAVE C$` that follows on line 10057 depends on what the Turboloader routine at 63600 does. That isn’t clear from the BASIC. ## Source Code ``` ## Program "DSKTAP.B1" (autostart 5) 1 REM THE MACHINE CODE USED IN THIS PROGRAM 2068 TURBOLOADER IS COPYWRITED AND WAS PUBLISHED BY SPECIAL PERMISSION IN THE JULY/AUG '88 ISSUE OF TDM. THEREFOR THE MACHINE CODE IN THIS PROGRAM CAN NOT BE PUBLISHED AND THE PROGRAM IN ITS ENTIRETY CAN ONLY BE PROVIDED TO SUBSCRIBERS OF TDM. THE MACHINE CODE WAS MODIFIED BY POKEING A ZERO INTO ADDRESSES 64815,64816, AND 64817. 5 PRINT FLASH 1;AT 9,10;"STOP THE TAPE": PAUSE 240: CLS 7 PRINT "THE MACHINE CODE USED IN THIS PROGRAM 2068 TURBOLOADER IS COPYWRITED AND WAS PUBLISHED BY SPECIAL PERMISSION IN THE JULY/AUG '88 ISSUE OF TDM. THEREFOR THE MACHINE CODE IN THIS PROGRAM CAN NOT BE PUBLISHED AND THE PROGRAM IN ITS ENTIRETY CAN ONLY BE PROVIDED TO SUBSCRIBERS OF TDM."'"THE MACHINE CODE WAS MODIFIED BY POKEING A ZERO INTO ADDRESSES 64815,64816, AND 64817": GO SUB 100 10 PRINT AT 9,7;"LKDOS DISK TO TAPE";AT 10,2;"(FOR PROGRAMS IN BASIC ONLY)";AT 11,6;"CASSETTE VERSION (V1)";AT 12,9;"BY DUNNINGTON": GO SUB 100 20 CLEAR 63379: PRINT AT 9,0;"PLEASE SPECIFY DRIVE NUMBER DESIRED FROM 0 TO 4 (4 IS RAMDISK)": INPUT "TYPE THE NUMBER,THEN PRESS ENTER ";A 30 RANDOMIZE USR 100: OPEN #4,"dd": PRINT #4: GO TO A 40 IF A=4 THEN GO TO 60 50 CLS : PRINT AT 9,0;"PLEASE INSERT UNPROTECTED DISK TO BE COPIED IN DRIVE #";A: GO SUB 100: GO TO 70 60 CLS : PRINT FLASH 1;AT 9,0;"IS THE WRITE PROTECT SWITCH OFF?": GO SUB 100 70 PRINT FLASH 1;AT 9,5;"START THE TAPE": LOAD "turbo.C2"CODE : CLS : LOAD "DSKTAP.B3" 100 PRINT #0;"TO CONTINUE PRESS ANY KEY": PAUSE 0: CLS : RETURN ## Program "DSKTAP.B3" (autostart 10051) 10050 CLS : STOP 10051 RANDOMIZE USR VAL "100": CAT "",: LET A=SIN PI: LET B=SIN PI: LET D=SIN PI: DIM A$(VAL "44",VAL "9") 10052 GO SUB VAL "10059": LET A=VAL "16": LET B=VAL "22": LET D=SIN PI: GO SUB VAL "10059": CLS 10053 LET A=SIN PI: FOR N=SGN PI TO VAL "44": FOR M=SGN PI TO VAL "8": IF A$(N,M)="." AND A$(N,M+SGN PI)="B" THEN LET A=A+SGN PI 10054 NEXT M: NEXT N: DIM B$(A,VAL "9"): LET B=SGN PI: FOR N=SGN PI TO VAL "44": FOR M=SGN PI TO VAL "8": IF A$(N,M)="." AND A$(N,M+SGN PI)="B" THEN LET B$(B)=A$(N): LET B=B+SGN PI 10055 NEXT M: NEXT N: DIM A$(1,1): PRINT #SIN PI;"LOAD A BLANK TAPE,START THE RECORDER, THEN PRESS A KEY": PAUSE SIN PI: FOR N=SGN PI TO A 10056 FOR M=VAL "9" TO VAL "4" STEP -SGN PI: IF B$(N,M)=" " THEN NEXT M 10057 LET C$=B$(N, TO M): PRINT C$: RANDOMIZE USR VAL "100": SAVE "dsktap.B1" LINE VAL "10058": RANDOMIZE USR VAL "100": MERGE C$: PAUSE VAL "400": RANDOMIZE USR VAL "63600": RUN 1500: SAVE C$: RANDOMIZE USR VAL "100": LOAD "dsktap.B1" 10058 NEXT N: RANDOMIZE USR VAL "100": ERASE "dsktap.B1",: PRINT "ALL BASIC PROGRAMS ON TAPE": STOP 10059 FOR N=B TO B+VAL "21": LET C=SGN PI: FOR M=A TO A+VAL "8": LET A$(N+SGN PI,C)=SCREEN$ (D,M): LET C=C+SGN PI: NEXT M: LET D=D+SGN PI: NEXT N: RETURN ```