Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!rutgers!cbmvax!hedley From: hedley@cbmvax.UUCP Newsgroups: comp.sys.cbm Subject: Re: Changing sequential files to program files Message-ID: <1304@cbmvax.cbmvax.cbm.UUCP> Date: Wed, 28-Jan-87 04:37:15 EST Article-I.D.: cbmvax.1304 Posted: Wed Jan 28 04:37:15 1987 Date-Received: Thu, 29-Jan-87 06:06:21 EST Reply-To: hedley@cbmvax.UUCP (Hedley Davis) Organization: Commodore Technology, West Chester, PA Lines: 34 Keywords: SEQ -> PRG In article <592@rayssd.RAY.COM> msf@rayssd.RAY.COM (Michael S. Frank) writes: >Does anyone out there know how I can convert a sequential file (which is how >my terminal program downloads) into a program file (so I can load and run it) >I've tried to look at Track 18/Block 1 etc, but can't seem to get the hang >of it. A program file is similar to a sequential type file. The difference is that the first two bytes in a program file contain the 16 bit load address of the file. This determines where in memory the file will be loaded if the ,1 option is used in the LOAD command, LOAD "FILENAME",8,1 Of course, there is also a byte in the directory entry for the file which indicates the filetype. See the 15xx users manual for details on directory structure. The point is that you cannot easily patch the disk because you need to insert two bytes at the start of the file which will cause the rest of bytes to shift back. Therefore you might consider using a short basic program that goes sort of like this: 10 OPEN 8,8,8,"NEWPROGFILE,P,W" 20 OPEN 9,8,9,"OLDSEQFILE,S,R" 30 PRINT#8,CHR$(LOADADDRESSLOW)+CHR$(LOADADDRESSHIGH); 40 GET#9,A$ : S=ST : PRINT#8,A$; : IF S=0 THEN 40 50 CLOSE 8 : CLOSE 9 This is untested, and needs some interpretaion to fit your needs. Just becareful not to forget the semicolons at the end of your print# statements. You also should add error channel checking after the opens and closes to verify that the program runs properly. Hedley