From: kegs@provalid.com   
      
   In article <9997cf21-f786-4126-9f7d-4f3eb2b3eba9n@googlegroups.com>,   
   fadden wrote:   
   >On a totally unrelated note, ProDOS 8 tech note #30 reveals something   
   >interesting. It suggests the following P8 BASIC.System command for   
   >creating a massively sparse file:   
   >   
   > BSAVE SPARSE.FILE,A$300,L$1,B$FFFFFF   
   >   
   >Of course, if you write 1 byte to $ffffff, you create a file whose EOF   
   >should be $1000000, which is impossible. However, the write succeeds   
   >and you can even read it back, because it's actually storing the last   
   >byte at the end of the block. The GS/OS FST doesn't seem to allow this.   
      
   I changed the subject.   
      
   This is very interesting. It's funny that the technote creates an illegal   
   file. I did a bunch of experiments with BSAVE and   
   BLOAD, and PRODOS 8 appears to treat files of length $ffff00 and higher as if   
   the length was infinite. That's very interesting.   
      
   If you create a small file:   
      
   BSAVE SMALL,A$300,l100   
      
   Then if you try to load more than the file size, ProDOS stops you:   
      
   BLOAD SMALL,A$2000,b50,l256   
      
   It will only load 50 bytes at $2000. The rest of memory at $2032-$2100 is   
   unchanged, even though I tried to load 256 bytes from the file.   
      
   But if you've created a file with a length >= $ffff00, then you can read   
   far beyond it:   
      
   BSAVE SPARSE2,A$300,L1,B$FFFFFE   
   BLOAD SPARSE2,A$2000,b$ffff00,l$4000   
      
   will happily write all 0's from $2100-$5fff.   
      
   And, I find I cannot quite predict what it will do if you try to write over   
   16MB:   
      
   BSAVE SPARSE0,A$300,l$50,b$fffff0   
      
   It creates a file of length $fffff0, but doesn't write the data in properly.   
   It seems to show up in the first block at offset $0f0. This may just be   
   how ProDOS handles file "overflow".   
      
   The "wraparound" may mean when you read past 16MB, ProDOS is just returning   
   the first few bytes of the file instead. I didn't figure this out.   
      
   I assume ProDOS is the issue, but I guess it could be BASIC.SYSTEM, since   
   I was just using BLOAD and BSAVE.   
      
   Kent   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|