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
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 (http://www.bombjack.org/commodore/books.htm/pdf/Inside_Commodore_Dos.pdf)
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!