10! Ian Hawkins, IDH@UMIST.AC.UK 20! 30! LIF2DOS is free-ware, and has no guarantees. 40! 50! LIF2DOS translates ASCII files on LIF disks to DOS ASCII text files. 60! 70! In addition it can translate binary files from a couple of obscure instruments, 80! the HP4145B semiconductor parameter analyser and the single sided HP86B data 90! files produced by the old Biorad electrochemical semiconductor profiler. 100! 110! It is not possible to write a program to translate all binary data files 120! generated by HP BASIC as the variable types and counts can not be deduced 130! from the file alone. For specific HP BASIC binary data files with a known 140! data layout it is possible to translate to formatted DOS text. 150! 160! LIF2DOS runs on most PC clones. If you have problems try a different make of PC. 170! The following is a simple program that demonstrates how a LIF file of just the right 180! length, and then writes an Id$ and a few two dimentional arrays to disk 190! in a form suitable for transfer using the LIF2DOS.EXE program. 200 INTEGER Tmp(800,7),A(800,7),B(800,7),Np(7),Nr 210 REAL Filesize! Has to be real as can be >32000 220 DIM A$[300] 230 Diskid$=":,700,1"! use disk 1 at address 700 240 Nr=4 250 FOR J=1 TO Nr 260 Np(J)=J*10 270 FOR K=1 TO Np(J) 280 Tmp(K,J)=30000*K/Np(J) 290 A(K,J)=30000*SIN(K/Np(J)*2*PI) 300 B(K,J)=30000*COS(K/Np(J)*2*PI) 310 NEXT K 320 NEXT J 330 Id$="Test data" 340 PRINT Id$ 350 F$="" 360 LINPUT "ENTER A FILE NAME (UP TO 10 CHARACTERS) eg Banana",F$ 370 INTEGER Jack 380 Filesize=0 390 ! this version does a dummy run first to find out how big the data 400 ! file needs to be (Jack=1) , creates the file, and then writes 410 ! data into it (Jack=2). This saves disk space. 420 ! 430 FOR Jack=1 TO 2 440 IF Jack=1 THEN 450 PRINT "Calculating file length, please wait." 460 ELSE 470 PRINT "Writing ASCII file, please wait" 480 END IF 490 A$="SAMPLE IDENTITY: "&Id$ 500 GOSUB Wlen 510 A$=" " 520 GOSUB Wlen 530 A$="Number data sets : "&VAL$(Nr) 540 GOSUB Wlen 550 ! 560 FOR J=1 TO Nr 570 A$=" " 580 GOSUB Wlen 590 A$="Data set no : "&VAL$(J) 600 GOSUB Wlen 610 A$="Number of points for data set : "&VAL$(Np(J)) 620 GOSUB Wlen 630 A$="Tmp A B" 640 GOSUB Wlen 650 FOR I=1 TO Np(J) 660 A$=VAL$(Tmp(I,J))&" "&VAL$(A(I,J))&" "&VAL$(B(I,J)) 670 GOSUB Wlen 680 NEXT I 690 NEXT J 700 ! 710 IF Jack=1 THEN 720 Filesname$=F$ 730 IF Dataflg=1 THEN Filesname$=F$&Diskid$ 740 CREATE ASCII Filesname$,INT(Filesize/256)+1 750 ASSIGN @File TO Filesname$;FORMAT ON 760 END IF 770 NEXT Jack 780 ! 790 GOTO Skipped_wlen 800 ! 810 Wlen: ! Subroutine to work out file length or write to file 820 IF Jack=1 THEN 830 Filesize=Filesize+LEN(A$)+4 ! Allow for integer header and Cr Lf on the end. 840 ELSE 850 OUTPUT @File;A$[1,LEN(A$)] 860 END IF 870 RETURN 880 ! 890 Skipped_wlen:ASSIGN @File TO * 900 PRINT "Finished writing ASCII file." 910 END