LKDOS Demo

Developer(s): Larry Kenny
Date: 198x
Type: Cassette
Platform(s): TS 2068

Introduces LKDOS, a new DOS for the Larken disk system that takes the standard Sinclair cassette commands. A series of screens explains the new commands, with examples of each: LOAD, SAVE, CAT, FORMAT, ERASE and OPEN. It also covers the error messages and the differences from the older LDOS. The tape loads two versions of the DOS, one at 50000 for double-sided disks and one at 59000 for single-sided disks. Each is 3,400 bytes and needs a 2K buffer after it, 5,500 bytes in all. At the end, the program offers a drive motor test or to format a blank disk and copy itself and both DOS files onto it. Anything beyond the information screens needs the Larken disk interface and drive.

The opening screen reads "NEW FROM LARKEN ELECTRONICS". Larken Electronics of Canada was run by Larry Kenny. The tape holds the BASIC program LKdemo (autostart line 1300) and the code files LKDS50.CZ and LKDS59.CZ. In the TAP file, block 6 (one of the code blocks) has a bad checksum; the TZX file in the same archive may be the better copy.

Program Analysis

Program Structure

  • Lines 1300–1305: the autostart loader. It loads both DOS code blocks and then RUNs the program.
  • Lines 3–70: CLEAR 49999, the title, and a six-note BEEP fanfare read from DATA.
  • Lines 100–520: the information screens, each ending with a "PRESS ANY KEY" prompt printed to the lower screen by the subroutine at line 90.
  • Lines 650–860: instructions for saving the DOS files to disk, then the choice between the drive test and making a new disk.
  • Lines 1200–1255: a tape SAVE of the program and both code blocks.

What the Screens Describe

  • Commands are sent to the DOS after RAND USR 50000:, or with PRINT #n: once a channel 4–15 has been opened with OPEN #n,"dd". Variables and expressions are allowed in any command, for example SAVE a$( TO 6)+".C"+STR$ a CODE A+1,B-A.
  • File names keep the LDOS type suffixes: .B1 for BASIC, .C1 for code and .A1/.A$ for numeric and string arrays. Arrays can be loaded under a different name, and do not have to exist in memory first.
  • CAT on the 2068 takes a search string and a ^ wild card. On a Spectrum, CAT alone lists the whole directory.
  • The new error codes are S Protect Error, T File Not Found, U Disk Full, V Wrong File Type and W Invalid Command.
  • LKDOS saves only the BASIC program, not the system variables as LDOS did, so BASIC files can move between the 2068 and the Spectrum. LKDOS and LDOS cannot load each other’s BASIC files. Code saved by LDOS can be loaded by LKDOS if the start and length are given.
  • OUT 87,0 and OUT 87,2 select drive 1 or drive 2. Disks formatted on a 2068 for use on a ZX81 should hold no file longer than 22 blocks.

Notable Techniques

  • The drive test (lines 720–780) turns the motor and LED on and off with OUT 69,8 and OUT 69,0. If nothing happens, the screen says to check the motor jumpers on the drive.
  • The disk-making routine opens channel 4 on the DOS chosen for the number of sides, then does FORMAT, three SAVEs and a CAT, each prefixed with PRINT #4:.

Potential Issues

  • Line 710 tests for "s" again instead of "t". As a result, any answer other than S goes on to the drive test.
  • The program ends with GO TO 2000, a line that doesn’t exist, so it simply stops after the new disk is catalogued.
  • The disk copy is saved with LINE 1, but the program’s first line is 3, and it does not reload the DOS code on its own the way the tape version does at line 1300.

Image Gallery

Source Code

    3 CLEAR 49999
    4 PRINT "       "; FLASH 1;"NEW"; FLASH 0;" FROM": PRINT 
    5 PRINT "    LARKEN ELECTRONICS"
   10 FOR A=1 TO 6: READ C: READ B: BEEP C,B: NEXT A
   20 DATA .15,-3,.15,2,.15,6,.3,9,.15,6,.5,9
   40 PRINT AT 8,2; BRIGHT 1;"A NEW LDOS THAT SUPPORTS"
   50 PRINT AT 10,1;"STANDARD CASSETTE COMMANDS"
   60 PRINT : PRINT "     FOR THE LARKEN DISK"
   70 GO SUB 90: GO TO 100
   90 PRINT #0;TAB 5;"PRESS ANY KEY": PAUSE 0: CLS : RETURN 
   95 PRINT #0;"  Press any key when ready": PAUSE 0: RETURN 
  100 PRINT "Two Dos's are now loaded in     memory"
  101 PRINT : PRINT "One is loaded at 50000   and    One is loaded at 59000": PRINT : PRINT "They are 3400 bytes long but    they use a 2 k buffer following the dos so they use a total of  5500 bytes"
  110 PRINT : PRINT " IT SUPPORTS  :: ": PRINT 
  115 PRINT "LOAD","SAVE": PRINT : PRINT "CAT","FORMAT": PRINT : PRINT "ERASE","OPEN": PRINT 
  120 PRINT : PRINT " Its Spectrum Compatible"
  130 GO SUB 90
  135 PRINT " LDOS TYPE FILE NAMES ARE STILL USED  eg: Progrm.B1"
  136 PRINT 
  140 PRINT "     ALL VARIATIONS OF           LOAD AND SAVE ARE SUPPORTED"
  145 PRINT : PRINT "ALSO VARIABLES AND FORMULAS ARE ALLOWED IN ANY COMMAND"
  150 PRINT : PRINT "eg:  SAVE a$( TO 6)+";CHR$ 34;".C";CHR$ 34;"+STR$ a CODE A+1,B-A" 
  155 PRINT : PRINT " FORMAT A$,","CAT A$,"
  159 GO SUB 90
  160 PRINT "RAND USR 50000: OR": PRINT : PRINT "PRINT #N :  is used to  enable  the DOS to  interpret the command immediatly following it"
  170 PRINT : PRINT "eg: RAND USR 50000: LOAD 'Progrm.B1'"
  180 PRINT : PRINT "eg: PRINT #4: CAT '.C',"
  190 PRINT : PRINT : PRINT "TO USE THE  'PRINT #N ' COMMAND YOU MUST OPEN THE CHANNEL WITH  A  RAND USR 50000: OPEN #N,'dd'": PRINT : PRINT "   N  can be 4 - 15"
  195 GO SUB 90
  200 PRINT BRIGHT 1;"LOAD commands": PRINT : PRINT 
  210 PRINT "LOAD 'XXXXX.B1'                 LOAD 'XXXXX.C1'CODE             LOAD 'XXXXX.C1'CODE start       LOAD 'XXXXX.C1'CODE start,length"
  220 PRINT "LOAD 'XXXXX.A1'DATA z()         LOAD 'XXXXX.A$'DATA z$()"
  230 PRINT : PRINT "THE '$' MUST BE IN THE FILENAME AFTER THE 'A' FOR STRING ARRAYS": PRINT : PRINT "ARRAYS ARE NOT SAVED AS A SPECIFIC VARIABLE SO AN ARRAY THAT    WAS SAVED AS A$() CAN BE LOADED AS Z$()"
  232 PRINT : PRINT BRIGHT 1;"ARRAYS NOW DON'T HAVE TO BE     ALREADY IN MEMORY AND SIZE IS   NOT A FACTOR"
  235 GO SUB 90
  240 PRINT BRIGHT 1;"SAVE commands": PRINT 
  250 PRINT : PRINT "SAVE 'XXXXX.B1'                 SAVE 'XXXXX.B1' LINE #          SAVE 'XXXXX.C1' CODE start,lenthSAVE 'XXXXX.C1' SCREEN$         SAVE 'XXXXX.A1' DATA a()        SAVE 'XXXXX.A$' DATA a$()"
  260 GO SUB 90
  270 PRINT BRIGHT 1;"CATALOG": PRINT 
  280 PRINT : PRINT "For 2068                        CAT '',     lists all directory CAT 'abc',  list all files with the string 'abc' in them        CAT 'a^c',  lists all files with 'a',any character,and 'c'": PRINT : PRINT "'^' is a 'wild card' character  eg: if a disk had files :       'prog1.B1','prog2.B1','prog1.C1 ": PRINT " CAT 'prog^.B1',  would list     prog1.B1    and  prog2.B1"
  284 PRINT AT 13,0;"                               "
  285: PRINT " CAT 'prog^.B1',  would list     prog1.B1    and  prog2.B1"
  290 PRINT : PRINT : PRINT "For Spectrum": PRINT "CAT   lists all directory"
  300 GO SUB 90
  310 PRINT BRIGHT 1;"FORMAT"
  320 PRINT : PRINT : PRINT "FORMAT 'Disk Name',    2068                                     FORMAT 'Disk Name'     Spectrum"
  330 PRINT : PRINT "Disk name is 0 - 9 characters"
  333 PRINT : PRINT "LKDS50.CZ  formats DOUBLE SIDED LKDS59.CZ  formats SINGLE SIDED":
  338 PRINT : PRINT "Note - Disks formated on a 2068 for use on a ZX81 should not    hold files longer than 22 Blocks"
  340 PRINT : PRINT BRIGHT 1;"ERASE"
  350 PRINT : PRINT "ERASE 'Filename',         2068                                  ERASE 'Filename'        Spectrum "
  360 PRINT "   File name in erase is not      checked for syntax"
  395 GO SUB 90
  400 PRINT BRIGHT 1;"NEW ERROR MESSAGES"
  410 PRINT : PRINT "S  Protect Error                T  File Not Found               U  Disk Full                    V  Wrong File Type              W  Invalid Command"
  420 PRINT : PRINT "Error V occurs when .A or .C    dosn't corrospond with CODE or  DATA                             Also when array type is wrong"
  430 PRINT : PRINT " LKDOS checks for free memory   before loading Basic and Arrays                                                                 Standard Sinclair Error messagesare used when apropriate"
  440 GO SUB 90
  450 PRINT BRIGHT 1;" Differences between :           LDOS (2068,ZX-81)  and  LKDOS  "
  460 PRINT : PRINT BRIGHT 1;"BASIC Programs": PRINT "LKDOS saves only the program so programs can be loaded between  the 2068 and Spectrum           LKDOS cannot load BASIC programssaved by LDOS and vice versa "
  470 PRINT "LDOS saved all system variables and stack pointer "
  480 PRINT : PRINT BRIGHT 1;"CODE": PRINT "The start and length of the codemust be stated when loading codewith LKDOS that was saved  with LDOS. After it is resaved with  LKDOS it is compatible between  both   Dos's"
  490 GO SUB 90
  500 PRINT BRIGHT 1;"ARRAYS": PRINT 
  510 PRINT " String arrays will need to have the '$' added after the .A"
  520 PRINT : PRINT BRIGHT 1;"DUAL DRIVES ": PRINT "OUT 87,0  will select drive 1   OUT 87,2  will select drive 2   (this will be the GOTO command )"
  650 PRINT : PRINT "The Dos at 50000 should be savedto disk as 'LKDS50.CZ'          The Dos at 59000 should be savedto disk as 'LKDS59.CZ'"
  660 GO SUB 90
  665 CLS 
  670 PRINT "Do you want to test your drive  to make sure the jumpers are    correct                         Input 'T' to test drive": PRINT : PRINT "OR"
  700 PRINT : PRINT "Do you want to save this and theLKDOS's to a new disk": PRINT : PRINT "Press 'S' to save": INPUT a$: IF a$="s" OR a$="S" THEN GO TO 800
  710 IF a$="s" OR a$="S" THEN GO TO 720: STOP 
  720 CLS : PRINT "Press '1' to turn drive motor   and LED on                                                      Press '2) to turn drive motor   and LED off"
  722 PRINT "Press 'c' to continue"
  725 PRINT AT 14,0;"If motor and LED are not being   activated then check motor      jumpers on drive"
  730 LET a$=INKEY$: IF a$="" THEN GO TO 730
  740 IF a$="1" THEN OUT 69,8: PRINT AT 10,0; BRIGHT 1;"Motor ON             "
  750 IF a$="2" THEN OUT 69,0: PRINT AT 10,0; BRIGHT 1;"            Motor OFF"
  770 IF a$="c" THEN GO TO 665
  780 GO TO 730
  800 CLS : PRINT "Put a blank disk in Drive 1": PRINT :
  804 PRINT : PRINT : PRINT "Is the disk drive 1 sided  or   2 sided (Enter 1 or 2 )": INPUT "Sides  ";a
  808 IF a=1 THEN RANDOMIZE USR 59000: OPEN #4,"dd"
  809 IF a=2 THEN RANDOMIZE USR 50000: OPEN #4,"dd"
  810 IF a>=3 THEN GO TO 800
  815 PRINT : PRINT "    Enter Name of Disk to be        FORMATed"
  820 INPUT "Disk Name ";a$
  830 PRINT #4: FORMAT a$,
  840 PRINT #4: SAVE "LKdemo.B1" LINE 1: PRINT #4: SAVE "LKDS50.CZ"CODE 50000,3400
  845 PRINT #4: SAVE "LKDS59.CZ"CODE 59000,3400
  850 CLS : PRINT #4: CAT "",
  860 GO TO 2000
 1100 RUN 
 1200 REM  TAPE  SAVE
 1210 SAVE "LKdemo" LINE 1300:
 1250 SAVE "LKDS50.CZ"CODE 50000,3400
 1251 SAVE "LKDS59.CZ"CODE 59000,3400
 1255 STOP 
 1300 LOAD "LKDS50.CZ"CODE 50000:
 1305 LOAD "LKDS59.CZ"CODE 59000: RUN

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