!!! Create DATA Statements from binary load files {{{ 1 REM BINDATA: A CONVERSION PROGRAM TO CONVERT BINARY LOAD FILES TO BASIC DATA STATEMENTS 2 REM BY STEVEN S. WESTON; JANUARY 24, 1983; POB 868, DEL MAR, CA 92014 3 REM WILL HANDLE SIMPLE & COMPOUND BINARY FILES. LINE # INCREMENT IS 10 UNLESS INPUT BY USER. 4 REM FILE NAMES MUST BE COMPLETE: Dn:FILENAME.EXT. 10 DIM C$(1),S$(110),N$(3),D$(6),DBIN$(15),DBAS$(15),ZZ$(30) 20 C$=",":D$=" DATA " 30 TRAP 40000:? "ENTER BEGINNING LINE NUMBER OF":? "BASIC DATA STATEMENTS":INPUT ZZ$:IF LEN(ZZ$)=0 THEN 30 40 TRAP 30:LN=VAL(ZZ$) 50 TRAP 40000:? "ENTER LINE NUMBER INCREMENT":INPUT ZZ$:IF LEN(ZZ$)=0 THEN INC=10:GOTO 70 60 TRAP 50:INC=VAL(ZZ$) 70 ? "ENTER BINARY FILE NAME":INPUT DBIN$:TRAP 230:OPEN #1,4,0,DBIN$ 80 ? "ENTER LISTED BASIC OUTPUT FILE NAME":INPUT DBAS$:TRAP 240:OPEN #2,8,0,DBAS$:TRAP 250 90 FOR I=1 TO 2:GET #1,X:IF X<>255 THEN ? "INPUT FILE NOT IN BINARY FORMAT":GOTO 220 100 NEXT I 110 GET #1,X:STR=X:GET #1,X:STR=STR+256*X 120 GET #1,X:STP=X:GET #1,X:STP=STP+256*X 130 BYTS=1+STP-STR:? BYTS;" BYTES TO BE PROCESSED":TRAP 260:CNT=0:? "STARTING BINARY FILE AT LINE # ";LN 140 S$=STR$(LN):J=LEN(S$)+1:S$(J,5+J)=D$:J=6+J:FLG=0 150 IF BYTS=CNT THEN 270 160 GET #1,X:CNT=CNT+1:N$=STR$(X):I=LEN(N$) 170 IF FLG THEN S$(J,J)=C$:J=J+1 180 S$(J,J+I-1)=N$:J=J+I:FLG=1:IF J>100 THEN 200 190 GOTO 150 200 ? #2;S$:LN=LN+INC:GOTO 140 210 ? #2;S$ 220 CLOSE #1:CLOSE #2:END 230 ? "UNABLE TO OPEN INPUT FILE":CLOSE #1:TRAP 40000:GOTO 70 240 ? "UNABLE TO OPEN OUTPUT FILE":CLOSE #2:TRAP 40000:GOTO 80 250 ? "UNABLE TO PROCESS BINARY FILE":? "HEADER ERROR":GOTO 220 260 ? "PREMATURE END OF BINARY FILE":? CNT;" BYTES PROCESSED":? "EXPECTED ";BYTS:GOTO 220 270 ? #2;S$:LN=LN+INC:TRAP 220:GOTO 90 }}}