Re: (Help needed) Word processor save routine.

From: Marko Mäkelä <msmakela_at_gmail.com>
Date: Wed, 27 May 2020 07:35:21 +0300
Message-ID: <20200527043521.GA1186822_at_jyty>
On Tue, May 26, 2020 at 11:04:36PM -0500, Syntax error wrote:
>A few days ago I was looking at a .tap image  with Final TAP  and the 
>buffer is filling to 192 bytes before recording.

The OPEN/CLOSE format for tape I/O differs from the format used by SAVE 
in that the data is always divided into blocks of 192 bytes. Between 
those blocks, there should be a synchronization signal, to allow the 
tape motor to stop and start. This is because the BASIC program can 
spend an arbitrary amount of time between reading the blocks.

I do not know that program. The .tap format is lower level than needed.  
A more straightforward tape image format would be one that is sometimes 
called .cas or .csm. It consists of 192-byte blocks (file names, or 
blocks used by the OPEN/CLOSE format) as well as arbitrary-size blocks 
(only for the SAVE format, and always preceded by a 192-byte header). In 
the physical format that is reflected by .tap files, each of these 
logical blocks is written twice, and there will be a sequence of 
synchronization pulses before the first copy.

The timings slightly vary between CBM machines, and on the 264 series 
the format is completely different (even less efficient). I implemented 
support for all those formats when I developed the C2N232 interface 
almost 20 years ago.

In the SAVE format, there is one 192-byte header that contains the file 
name and the start and end addresses. Most of this mandatory 192-byte 
block is normally unused, but also it can be filled with payload, like I 
did in the c2nload driver of my C2N232 interface. Its entire fastloader 
routine is actually stored in the mandatory header, and the payload is 2 
bytes that overwrites a jump vector, auto-starting the fastloader.

For your word processor program, you should be able to invoke the
SAVE and LOAD routines in the KERNAL even from BASIC. You might want to 
invoke them via SYS in order to have better control. If I remember 
correctly, LOAD will cause a jump to the start of the program buffer.

On the PET (at least before BASIC 4), the interface between the BASIC 
interpreter and the KERNAL is not as clean as in the Vic-20 and later 
computers.

	Marko
Received on 2020-05-30 01:55:13

Archive generated by hypermail 2.3.0.