[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Darn!!
On Wed, 17 May 2000 21:47:17 -0800, processoroverclocked@33mhz.com
(Jon Bettencourt) wrote:
>I'm not exactly sure, but I think it goes like this:
>
>CATALOG
><note the endfile of the file to copy>
>BLOAD <filename>,A$2000,T<file type>
>BSAVE <filename 2>,A$2000,L<length noted>,T<file type>
Close. You might want to note that it is easier to figure out the
ENDFILE if you do the catalog while in 80 column mode.
Also, the ENDFILE is not always the number of bytes in the file. For
instance, all the S16 (16 bit program) files that I just looked at
have an ENFILE of 512 regardless of whether the number of blocks in
the file is 14 or 207. Mind you, most S16 programs can't be dealt
with this way because they are extended files (files with resource
forks) that ProDOS 8 won't touch.
Finally, as Greg mentioned you need to create the new file first if
the file you are copying isn't a binary file and you have to do
multiple bloads/bsaves if the file is larger than available memory.
So, to summarize, here is how to copy a file using bload/bsave if the
file is less than about 32KB:
PR#3
CATALOG
<note the endfile of the file to copy if it is a type that you can>
CREATE <pathname of new copy>,T<file type>
BLOAD <pathname of original>,A$1000,T<file type>
BSAVE <pathname of new copy>,A$1000,L<endfile>,T<file type>
If the file is larger than will fit in memory you can copy it in
approximately 30KB chunks like so:
PR#3
CATALOG
<note the endfile of the file to copy if it is a type that you can>
CREATE <pathname of new copy>,T<file type>
<loop>
BLOAD <pathname of original>,A$1000,L30000,T<file type>
BSAVE <pathname of new copy>,A$1000,L30000,B0,T<file type>
<keep going back to loop until there is less than 30000 bytes to copy
incrementing the B value by 30000 each time>
BLOAD <pathname of original>,A$1000,L<bytes left>,B<n>,T<file type>
BSAVE <pathname of new copy>,A$1000,L<bytes left>,B<n>,T<file type>
This is a little convoluted but you can easily write an Applesoft
program that will do this for you. In fact, here is one that will do
so but it doesn't have much error checking and the file name you enter
is case sensitive so be sure to put your caps lock on:
10 D$ = CHR$(4)
20 PRINT D$;"PREFIX"
30 INPUT PF$
40 PRINT D$;"PR#3"
50 PRINT D$;"CATALOG"
60 INPUT "Copy which file: ";OF$
70 INPUT " New path name: ";NF$
80 IF OF$ = "" OR NF$ = "" THEN END
90 IF LEN(OF$)<15 THEN OF$=OF$+LEFT$(" ",15-LEN(OF$))
100 PRINT D$;"OPEN ";PF$;",TDIR"
110 PRINT D$;"READ ";PF$
120 INPUT A$: INPUT A$: INPUT A$
130 INPUT A$: IF LEFT$(A$,12) = "BLOCKS FREE:" THEN PRINT D$;"CLOSE":
PRINT "The file ";OF$;" doesn't exist in ";PF$: END
140 IF MID$(A$,2,15) <> OF$ THEN 130
150 PRINT D$;"CLOSE"
160 EF = VAL(MID$(A$,64,8)):FT$ = MID$(A$,18,3)
170 PRINT D$;"CREATE ";NF$;",T";FT$
180 IF EF <= 30000 THEN Z = 0: GOTO 240
190 FOR Z = 0 TO (INT(EF / 30000) - 1)
200 PRINT D$;"BLOAD ";OF$;",A$1000,L30000,B";Z * 30000;",T";FT$
210 PRINT D$;"BSAVE ";NF$;",A$1000,L30000,B";Z * 30000;",T";FT$
220 NEXT Z
230 EF = EF - Z * 30000
240 PRINT D$;"BLOAD ";OF$;",A$1000,L";EF;",B";Z * 30000;",T";FT$
250 PRINT D$;"BSAVE ";NF$;",A$1000,L";EF;",B";Z * 30000;",T";FT$
Note: Line 130 will most likely have a carriage return after the
second colon so if you are trying to exec this file on an Apple II
you'll have to fix that one line first.
>The same thing is used to change the file type of a file.
Yes. All you need to do is change the file type parameter of the
create and bsave commands in my instructions above. I'll leave
modifying my program above as an exercise for the reader. :-)
+------------------------------------------------------------------------+
| Jeff Blakeney - Dean of the Apple II University in A2Pro on Delphi |
| Delphi Apple II Forums Web Pages |
| A2: http://www.delphi.com/apple2 A2Pro: http://www.delphi.com/a2pro |
+------------------------------------------------------------------------+
- References:
- Darn!!
- From: Ruud Dingemans <rdingema@xs4all.nl>
- Re: Darn!!
- From: processoroverclocked@33mhz.com (Jon Bettencourt)
- Re: Darn!!
- From: Greg Buchner <nobody@wavetech.net>
- Re: Darn!!
- From: processoroverclocked@33mhz.com (Jon Bettencourt)