Converting Tape Programs to Larken Disk Programs

Author(s): Bob Swoger
Publication: Nite-Times News
Pub Details: Nite-Times News v5 n2 (Volume 5, Issue 2)
Date: March - April 1991
Pages: 7-9

In a letter to ROD GOWEN and The PLOTTER Tom Skapinski of New York asked how to convert tape programs to disk programs.

What is needed first is Nazir Pashtoon’s program HEADER.BT, a tape header reader program he wrote while a member of list. This program will tell you the autostart line number of a BASIC program and the start address and lenght of the machine code filess.

Most programs for the TS2068 are made up of a BASIC driver program, a SCREEN save to add CLASS to the program, and the machine code program that does the greatest portion of the work to give the program high speed operation. The machine code programs which need load and save routines usually go back to the BASIC driver program for that type of support.

The BASIC driver program when loaded sets the keyboard parameters like CAPS LOCK and key click length, border, paper and ink colors, sets RAMTOP and loads in the screen file and the machine code file, then runs the machine code file. Variations might load in more than one screen file, more than one machine code file or even call in another BASIC program.

Most of the time these files all have headers on the tape to tell the TS2068 all the information needed for proper loading like auto-run line numbers of BASIC programs and start address and lenght of machine code files. We shall take as an example these simple types of tape programs first. The simplest program to move would be the BASIC only program. The second simplest would be a program containing a BASIC driver program, a screen file and a machine code file. We will take up this second kind. Let’s go thru step by step and see how to move tape programs to disk.

1) Gather HEADER.BT, pencil, paper, the taped program, and a newly formated disk.

2) Load HEADER.B1 into the TS2068, it will come up running.

3) Start the tape drive in the play mode and play the header of the first program on the tape into the TS2068.

4) Note the type of program (the first is usually BASIC) and the AUTO-RUN line number. If the program is machine code then note the start address and lenght of the file.

Do this for each file on the tape. Now it is time to copy the programs from tape to disk. Let us pretend that the three files had the names ‘bdriver’, ‘screen’ and ‘mcode’. Put your formated disk into drive 0.

5) Load the program ‘bdriver’ into the TS2068. After it loads in it will wait for the file ‘screen’ to load in. Turn off the tape drive before this happens. Use shift and break to halt the program.

6) Now type LIST 9990 to determine if there are any program lines in this area. For the sake of further discussion let us say we find none. Now add the following line to the program: 9992 RANDOMIZE USR 100: SAVE “BDRIVE.B1” LINE 1 (we are assumeing that LINE 1 is the auto-run line number found by using the HEADER.BT header reader program.

7) Type GOTO 9990 and hit ‘ENTER’ The program is now saved to disk. We shall work on it later.

8) Now the file ‘screen’ will be moved. Type in the following: LOAD””SCREEN:RANDOMIZE USR 100: SAVE “bdrive.C$”SCREEN and hit ‘ENTER’ The screen file is now on disk.

9) Now the file ‘mcode’ will be moved. Type in the following: LOAD””SCREEN:RANDOMIZE USR 100: SAVE “bdrive.C1″CODE 32768,2345 and hit ‘ENTER’ The screen file is now on disk. (we are assumeing that the start address of the code file is 32768 and its lenght is 2345 bytes long found by using the HEADER.BT header reader program.)

Now comes the time to go back and make the BASIC driver work. We will assume that there is enough room below RAM-TOP to add the lines needed to get the program to do all it is supposed to. This would not be the case with ZEBRA’s GREETING CARD DESIGNER. One would have to KRUNCH the program down a bit using NOT PI instead of 0, SGN PI instead of 1, PRINT #RND instead of PRINT #0 and so on. Just do a PRINT FREE to see how much room you have, over 1K will be fine.

A) LOAD “BDRIVE.B1” from disk back into the TS2068 and break into the program.

B) Find the line that loads in the screen file, it looks something like: LOAD “”SCREEN. Sometimes it may look like: LOAD “”CODE but it will be the first LOAD statement after the auto-run line number you found earlier with HEADER.BT.

C) Change LOAD “”SCREEN or LOAD “”CODE to read: RANDOMIZE USE 100: LOAD “bdrive.C$”SCREEN

D) Find the line that loads in the machine code file, it looks something like: LOAD “”CODE.

E) Change LOAD “”CODE to read: RANDOMIZE USE 100: LOAD “bdrive.C1″CODE

F) Add the line: 9998 RANDOMIZE USR 100:NEW. This will be used to get you back to LogiCall when you exit the program.

G) Use the LogiCall manual to further modify the program to do a clean exit to LogiCall.

H) Now type GOTO 9990 and the program will be saved to disk with all the modifications and will be ready to run on your LarKen Disk Operating System.

That should do it, use LogiCall to load it one more time into the TS2068. It should run now just as it did when you loaded it from tape, screen and all! It will just load in many times faster. If the screen file goes by too fast for you, just add :PAUSE 0 after the screen load and you will then have to hit a key to continue the machine code load.

HEADER.BT by Nazir Pashtoon

  10 REM <PROGRS. HEADER READER>
20 REM NAP AUG.,10,1984
30 INK 7: POKE 23658,0: CLEAR32764
40 LET j=32765: LET head=j+45
50 DEF FN g(x)=PEEK x+256*PEEK (x+1)
60 RESTORE
70 FOR n=0 TO 44: READ code
80 POKE (j+N),code: NEXT n
90 DATA 62,0,55,221,33,42,128,17,17,0,243,245,219,255,203,255,211,255,219,244,50,41,128,62,1,211,244,241,205,252,0,58,41,128,211,244,219,255,203,191,211,255,251,201,0
100 CLS
110 POKE head,4
120 PRINT AT 18,8;"start the tape"
130 RANDOMIZE USR j
140 CLS : LET hdtype=PEEK head
150 IF hdtype=4 THEN GO TO 1000
160 LET h$=""
170 FOR n=1 TO 10
180 LET h$=h$+CHR$ PEEK (head+n)
190 NEXT n
200 PRINT "Prog. Name > ";h$: PRINT : PRINT
205 LET a=head
210 LET hdlen=FN g(a+11): LET hdadr=FN g(a+13): LET hdvars=FNg(a+15)
220 LET vars=hdlen-hdvars
230 IF hdtype THEN GO SUB 500:GO TO 1010
300 PRINT "Program is in BASIC": PRINT
310 PRINT "Program area >";hdvars;" bytes": PRINT
320 PRINT "Variables area >";vars;" bytes": PRINT
330 IF hdadr>10000 THEN PRINT "There is no autostart !": GO TO 1010
340 PRINT "Line # for autostart >";hdadr: GO TO 1010
500 LET b$=""
510 IF hdtype=1 THEN LET b$="Number array"
520 IF hdtype=2 THEN LET b$="Character array"
521 IF hdtype=3 THEN LET b$="Machine Code file"
530 PRINT "Program is a ";b$: PRINT
540 IF hdtype=3 THEN PRINT "Binary code ,start adr >";hdadr: PRINT
550 PRINT "Block length is >";hdlen;" bytes"
560 RETURN
1000 PRINT FLASH 1;AT 18,8;" This is not a tape header"
1010 PRINT FLASH 0;AT 19,1;"Are you game for another try ?(y/n)"
1020 PAUSE 0: IF INKEY$="y" THEN GO TO 100
1030 STOP
9992 RANDOMIZE USR 100: SAVE "HEADER.BT" LINE 1
9998 RANDOMIZE USR 100: LOAD "L.B1"