Path: utzoo!utgpu!watmath!isishq!f171.n221.z1.FIDONET.ORG!izot From: izot@f171.n221.z1.FIDONET.ORG (Geoffrey Welsh) Newsgroups: comp.sys.cbm Subject: Re: Can REL files be copied? Message-ID: <2030.2442CAD5@isishq.FIDONET.ORG> Date: 11 Apr 89 15:22:21 GMT Sender: ufgate@isishq.FIDONET.ORG (newsout1.25) Organization: FidoNet node 1:221/171 - Izot's Swamp, Kitchener ON Lines: 73 > From: dwtamkin@chinet.chi.il.us (David W. Tamkin) > Message-ID: <8190@chinet.chi.il.us> > One difficulty in copying relative files is that EOI (st=64) is sent at the > end of every record. The only way to know when to stop reading is an error > 50 (record not present) from the source disk. The other is that BASIC's > INPUT#, GET#, and PRINT# commands respectively untalk, untalk, and unlisten > the addressed device when they are done, and unlistening or untalking a > disk > drive with an open relative file bumps the record pointer to the start of > the next higher record. Sorry to say this, but that serves you right for doing this in BASIC. File copying accross devices is slow enough without introducing the fun of a BASIC interpreter. And, as you say, the BASIC commands do things you don't want them to. That's always the risk when using a high-level language. > One possible algorithm is this: read the block count and record length of > the > source file from its directory entry on the source disk. Allow for side > sectors and take an estimate of how many records there are (empty as well > as > used). Try to position to that record in the source file, and if you get > an > error 50, try one record lower; if you get an ok from the drive, try one > record higher. Keep going until you've had at least one 50 and one ok so > that you have the proper count of records in the source file. Sounds like a good technique to me. Using a record buffer (only need one page, since records won't exceed 255 bytes in length), an ML program could copy the files quickly & easily: Open the files; LDX INCHAN ; secondary address used for input file JSR CHKIN LDY #0 while not EOI { JSR $FFE4 STA BUFFER,Y INY } STY RECLEN JSR CLRCHN ; untalk LDX OUTCHA ; secondary adderss used for output file JSR CHKOUT LDY #0 WRLOOP LDA BUFFER,Y JSR $FFD2 CPY RECLEN BNE WRLOOP JSR CLRCHN ; unlisten Repeat that for as many records as you need; Close the files. In this way, commas, quotes, CRs, etc. all get copied into the new REL file record. No intermediate untalks to foul up record pointers. > But yes, relative files can be copied. The c: DOS command in dual drives > (both from Commodore and from MSD) did it flawlessly. I have dumps of those ROMs in my Toronto office; perhaps it would be worth seeing how they did it (it may not always be the best way, but it works well (therefore always a good candidate for "best" anyways). -- Geoffrey Welsh - via FidoNet node 1:221/162 UUCP: ...!watmath!isishq!171!izot Internet: izot@f171.n221.z1.FIDONET.ORG