[Coco] Programming help needed

Arthur Flexser flexser at fiu.edu
Sun Dec 2 01:11:22 EST 2018


I haven't used random access disk files, so my knowledge here is somewhat
limited.

One work-around would be to just store and retrieve the data using DSKO$
and DSKI$ to work with raw sector input and output, though this would be
less storage-efficient than your present code.  Still, storing a 240-byte
string into a 256-byte sector wouldn't be all that wasteful.  I don't think
there would be any troublesome character values using that method.  (DSKI$
and DSKO$ break up the sector into two 128-byte strings.  Alternately, you
could call DSKCON directly to input or output the entire 256-byte sector
into a single memory block, such as making a sector buffer at $600 and
grabbing it back to A$ from there.)

It is not clear to me why the method you tried didn't work properly.  If
you PRINT#-2 (or WRITE) a character like CHR$(0), it would still get sent
to the printer, since this is the method that non-printing printer control
codes use to convey printer control commands (referring to old-timey
printers, of course.)  I would think writing to a disk file using WRITE
would have the same property.

I would investigate further to find out where your present code is
failing.  Have you made a detailed comparison between the value of A$
before disk storage and after retrieval from disk?  Is the as-retrieved A$
shorter than the original, as assessed by the LEN function?  Do you have a
means of looking directly at the disk contents to see if A$ got written to
disk properly?

Art

On Sat, Dec 1, 2018 at 8:19 PM Paul Shoemaker <paulfe3 at swbell.net> wrote:

> Need some advice. I am trying to store to a disk file a 48x40 section from
> a PMODE 4 screen.
> The method I am attempting to use is to peek the byte values using a
> nested loop and save them as a string. For example, A$ = A$ + CHR$
> (PEEK(&HE00+X+(Y*32))). Note I am storing the byte value as a CHR$ because
> doing so makes the completed string length only 240 bytes long. Creating
> the string is working fine; I have validated that.
> Saving the string to a disk file is not working, however. When I execute a
> WRITE #1,A$ followed by a PUT #1,<record #>, Disk BASIC is not saving
> entire contents of A$. I believe it is parsing the string as it goes or
> something, as it seems to be ignoring or even stopping on some "special"
> CHR$ codes.. like CHR$(0).
> Is there a way around this?
> Thanks!
> -Paul
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco
>


More information about the Coco mailing list