Re: (Help needed) Word processor save routine.

From: Rhialto <rhialto_at_falu.nl>
Date: Sun, 17 May 2020 17:28:23 +0200
Message-ID: <20200517152823.GA12169_at_falu.nl>
On Sat 16 May 2020 at 19:23:06 -0500, Syntax error wrote:
> Hi everyone, I'm looking for advice on how I would go about making this
> word processor save routine more efficient.
...
> My question is why is this routine causing a save to happen long before the
> 192 byte cassette buffer is full?
...
> And this is the routine.
> 
> *405 open1,1,1:fora=6168to7168:x=peek(a):print#1,x:next:close1 *

That may be easy. There are at least 2 things here that make fewer
characters fit in a buffer than you may think.

- You're printing each of the peek-ed values (x) as a decimal number.
  So that will take 1, 2 or 3 digits per character.
  Plus, there will be a space before (where a minus sign could be), and
  a cursor-right after (although I think for non-screen output that is
  replaced by a space). Together that makes for 3, 4 or 5 characters
  already.
- Further, you're not using a semicolon ; a the end of the print#
  statement. That means that you get an extra CR and LF character added
  as well. So each character on your screen will take between 5 and 7
  characters in the file in total.
  (Aside on CR+LF: that is inherited from Microsoft. Other systems
  where their Basic is used routinely used CR+LF. Commodore suppressed
  this for screen output but not for files. Only from Basic 4 on they
  did it there too, IIRC.)

There is an additional problem with tape files on Basic 1. In some cases
(or always? I never did look into it in that much detal) the gap between
tape blocks was written shorter than intended. It would work if you
continuously read the file so the tape could keep going. But if you
needed to stop and re-start the motor between blocks, the gap was too
short and you would miss the next tape block.

I'm not sure what you mean with "strings" in your text before, so I
won't comment on that for now. Hopefully this helps you enough already.

> Text listing listing of the program is here
> https://planet.davewylie.uk/technology/pet/listings/wpros.txt
> <https://planet.davewylie.uk/technology/pet/listings/wpros.txt>  

-Olaf.
-- 
Olaf 'Rhialto' Seibert -- rhialto at falu dot nl
___  Anyone who is capable of getting themselves made President should on
\X/  no account be allowed to do the job.       --Douglas Adams, "THGTTG"


Received on 2020-05-30 01:45:54

Archive generated by hypermail 2.3.0.