CPCWiki forum

General Category => Programming => Topic started by: zhulien on 18:49, 24 July 21

Title: programming massive files on CPC
Post by: zhulien on 18:49, 24 July 21
Hi Everyone,


If I wanted to read/write and create massive files on the CPC, how is the best way to do it.


eg: if I wanted to create a 4mb file (don't care of the content for most part, but do want to write markers at 16kb splits - so essentially 256 sections), do i need to write every byte from the CPC or can the CPC just create a 4mb file?  If I wanted to read/write any selected 16kb chunk of that file, how do i seek to any bit to read or write?


From a performance point of view, is it likely faster to have 1 4mb file with 16kb seeks, or 256 x 16kb files within a folder?  (yes, on an X-Mass or M4 card).


Has anyone done such things before? @TFM (https://www.cpcwiki.eu/forum/index.php?action=profile;u=179) ?
Title: Re: programming massive files on CPC
Post by: m_dr_m on 23:23, 24 July 21
Prodatron has posted some routines to read/write by bloc.
It's still sequential, has the same speed than cas_in_bloc/cas_out_bloc, without the memory limitations.



Orgams use similar ones.


To go further (skip uninteresting parts), check Unidos SEEK routines: https://unidos.cpcscene.net/doku.php?id=fr:devel#cmd_cas_in_seek_6



Title: Re: programming massive files on CPC
Post by: GUNHED on 19:00, 27 July 21
Has anyone done such things before? @TFM (https://www.cpcwiki.eu/forum/index.php?action=profile;u=179) ?
From a performance POV the single 16 KB blocks are a little bit more efficient, because they can be loaded in one run into a 16 KB expansion RAM block. Also it has advantages if you use crunching.
For the 4 MB 'demo' I made I used 256x 16 KB files.

However it's not a problem to make a 4 MB file out of 256 files of 16 KB. Just adapt the directory content to it.

What I use too is to combine 30 blocks of 16 KB to 480 KB of GFX data, to be loaded in one rush.

Well, it shouldn't be hard to write a tool for that. But the more powerful such a tool is, the more time it takes to be developed of course.