I am Rob
2018-02-10 05:05:10 UTC
I wrote a very short routine (26 bytes) to check if a block is all zeros (sparse) and is very fast. It can know if a block is non-sparse in as little as checking one byte or goes through the loop only 256 times. The way I figure it, within Prodos the routine needs to be called just before a WRITE call is sent to the firmware, or just before the volume bitmap is updated so that the block that is all zeroes, doesn't get protected.
or the alternate method from an ML program and takes a little more code is,
check the entire file in memory using this routine, and if a sparse block in memory is located, make a map of sparse blocks. Then all that has to be done is to set the write for data up to just before each sparse block, advance the SETMARK to just past the the sparse block then continue writing data up til the next sparse block and so on.
I have implemented this into a copy program that works good. Although, I don't see much use for sparse files on Prodos 8 files. Most files that are sparse that I come across are mostly IIGS SHR graphics files.
So I don't know if there would be a real need to implement sparse files under Prodos 8. Anyone else see how sparse files may be a benefit to Prodos 8?