Author Topic: How to show SCRATCHED files?  (Read 663 times)

0 Members and 1 Guest are viewing this topic.

Offline MIRKOSOFT

  • C128 user
  • ******
  • Posts: 809
  • Age: 33
  • Location: Zvolen
  • Activity:
    4.8%
  • Country: sk
  • Reputation: 188
  • Gender: Male
  • C128 programmer
  • With us since: 13/02/2009
    YearsYearsYearsYears
    • View Profile
    • MIRKOSOFT
How to show SCRATCHED files?
« on: February 23, 2010, 03:08 PM »
Hi!

As everybody know, if file is scratched, it's only not visible in directory, it's disk-allocated space is free until is overwritten.

So, I want to ask that how to show SCRATCHED files which are still not overwritten in directory?

Commodore has standard files PRG, SEQ, USR, REL, DEL, CBM files, but I want to show these files as SCR - scratched, of course locked files have < char as indicator.

Can anybody help me?

Thanks for every help.

Miro
MIRKOSOFT of megabytes

Commodore 64 was great, Commodore 128 is bigger, better, faster, more intelligent and more powerful... is targetted to programmation...

64ever 128her
sixty-for-ever one-twenty-either

C128 = C64² + more

http://www.mirkosoft.sk

Offline pearsoe

  • PET user
  • ***
  • Posts: 51
  • Age: 47
  • Location: Hyde Park, NY
  • Activity:
    0%
  • Reputation: 9
  • Gender: Male
  • With us since: 07/11/2007
    YearsYearsYearsYearsYearsYears
    • View Profile
Re: How to show SCRATCHED files?
« Reply #1 on: February 27, 2010, 11:30 AM »
Scratched file have their file-type byte in the directory set to $00 and sectors associated with the file are freed in BAM.

I'd recommend looking at "Inside Commodore DOS".  The BASIC 'Virtual Directory' program identifies scratched files.

http://www.bombjack.org/commodore/books.htm/pdf/Inside_Commodore_Dos.pdf
My rig: C-128 w/JD SCPU, uIEC/SD, CMD-HD (500 MB), CMD-HD ZIP drive, CMD RAMLink, 1750XL 2 MB REU, FD-2000, 1581, Turbo232

Offline Hydrophilic

  • 128D user
  • *******
  • Posts: 1225
  • Age: 41
  • Location: Earth... still!
  • Activity:
    2.2%
  • Reputation: 232
  • Gender: Male
  • With us since: 25/01/2007
    YearsYearsYearsYearsYearsYears
    • View Profile
    • H2Obsesson
Re: How to show SCRATCHED files?
« Reply #2 on: March 01, 2010, 05:33 PM »
Sorry it took so long for me to respond.  I saw this several days ago and started a response but then got busy with other things...
 
Unfortunately, directory command "$0:*= D" does not work.  I'm thinking it should show only Deleted (scratched) files, but it actually will show all files!  (at least on 1541/71)
 
The way I've always seen it done is like pearsoe says:  find directory entries with filetype byte of $00.  The usual way is to block read (U1 command) each sector of directory.  In each sector do this:
 
Check byte 2, 34, 66, 98, 130, 162, 194 and 226 to get filetype of entries 1 to 8 (there are 8 entries per sector).
 
If the byte is $00, then the entry is either scratched file, or is an unused entry.  So in this case check the next byte (3, 35, 67, etc.).  If this value is also $00, then it is unused entry.  Otherwise this is a scratched file entry and the non-zero value is the starting track of scratched file.
 
After checking all 8 entries in the sector, check byte 0 and 1 for next directory block.  If byte 0 is $00 then you are done, otherwise read next directory block from track of byte 0 and sector of byte 1, and repeat whole process.
 
I hope this helps!
I'm kupo for kupo nuts!

 



Back to top