Re: Adding to binary files
- From: "John B. Matthews" <nospam@xxxxxxxxxx>
- Date: Tue, 11 Jul 2006 04:56:17 GMT
In article
<Pine.GSO.3.95.iB1.0.1060710005256.23369A-100000@xxxxxxxxxxxxxxxxxxxxxx>
,
"Simon D. Williams" <bb065@xxxxxxxxxxxxxx> wrote:
On Mon, 10 Jul 2006, John B. Matthews wrote:[...]
In article
<Pine.GSO.3.95.iB1.0.1060709140223.10565A-100000@xxxxxxxxxxxxxxxxxxxxxx>
,
"Simon D. Williams" <bb065@xxxxxxxxxxxxxx> wrote:
I have an idea for a program that would output files larger than memory
will allow. Is it possible in ProDOS to either combine file segments on
disk, or append data to an existing file?
-s
_____
|[LD8]! :::::::: RetroChallenge 2006 Endurance Blog :::::::::
| o. | ::::::::::: " 8-bit to the Bitter End! " ::::::::::::
!__!__! ::::::::: http://www.chebucto.ns.ca/~bb065/ :::::::::
From assembly, you should be able to append to a file by doing OPEN
($C8), GET_EOF ($D1), SET_MARK ($CE), WRITE ($CB) and CLOSE ($CC).
From Basic, the APPEND command works with sequential text files.
John
Is there a way to do this with _binary_ files?
[...]
You don't mention whether you're working from assembly or Basic, so I'll
address both.
The assembly approach should work with either text or binary. If you
SET_EOF ($D0) past the current EOF and do a SET_MARK between the old EOF
and the new, you'll create a sparse file. Instead, get the EOF, set the
mark to it and write. The "ProDOS 8 Technical Reference Manual" is your
friend.
Basic APPEND under ProDOS accepts a T (type) and L (record length)
parameter, so you can try something like
10 d$=chr$(4)
20 print d$;"APPEND myfile,Tbin,L1"
30 print "Hello"
40 print d$;"CLOSE"
Because the type is specified, the file must already exist. Binary
output may be awkward. Also, print without a trailing semicolon will
output a carriage return. AFAIK, you don't need to know the file length
_a_priori_, as APPEND sets the mark to EOF.
If you're from moria:-), here's a pre-release version of the ProDOS
Basic programming documentation:
http://www.apple2.org.za/gswv/a2zine/Docs/ProDOS.txt
--
John Matthews
jmatthews at wright dot edu
www dot wright dot edu/~john.matthews/
.
- Follow-Ups:
- Re: Adding to binary files
- From: Simon D. Williams
- Re: Adding to binary files
- From: mdj
- Re: Adding to binary files
- References:
- Adding to binary files
- From: Simon D. Williams
- Re: Adding to binary files
- From: John B. Matthews
- Re: Adding to binary files
- From: Simon D. Williams
- Adding to binary files
- Prev by Date: Re: Adding to binary files
- Next by Date: Re: Adding to binary files
- Previous by thread: Re: Adding to binary files
- Next by thread: Re: Adding to binary files
- Index(es):
Relevant Pages
|