| |
lA-sTYLe
Registered: Sep 2003 Posts: 63 |
Blocks free on Disk
I am searching for a way to detect the free Blocks on a Disk.
Since i need to get that value everytime before i start saving it might happen that this routine needs to be executed 30 times in a save process. So loading the Directory and Parsing for the last line and calculating the Blocks free is way to slow.
Or detecting if there are atleast x Blocks free would help aswell.
Anybody knows a decent way to get the wanted Result ?
Cheers,
Mario
|
|
... 1 post hidden. Click here to view all posts.... |
| |
lA-sTYLe
Registered: Sep 2003 Posts: 63 |
Quote: load track 18:0 and check the BAM ... will only work on 1541 ofcourse.
however, i would just start saving and add proper error checking after that, you can see "disk full". any imagineable way to find out the number of free blocks is doomed to fail on non 1541 drives or screws up on simple directory manipulations.
thats exactly the problem, i want to be drive independant but still use kernal routines.
I have already installed error checking and could check for error #72 but hope that somebody has an idea to check the free blocks in a decent way.
|
| |
Sorex Account closed
Registered: Nov 2003 Posts: 43 |
Like Groepaz wrote, the BAM keeps track of which blocks are being used or not.
But you can mess around with the BAM, and dir file structure.
You could do a verify which rebuilds the BAM based on what's left in the directory or scan/count file blocks but if you have hidden files or non standard file structures files on that disk you will risk overwriting that data.
What's the purpose of this anyway?
why not just prompt with a "insert next disk" when you bump into a "Disk is full" error?
I know it a timeloss if you just wrote 200 blocks at kernal speed and need to do it again because you only had 195 left but it's the easiest method.
You could also start with a fresh 1581 disk ;)
that's 3000-something bytes which should be enough for most "common" tasks |
| |
Krill
Registered: Apr 2002 Posts: 2980 |
Just do what Groepaz said. Using plain KERNAL calls is only useful for modern drives which usually have enough space available anyways (it's just too slow on 1541 et al.). You can then detect supported drives and run custom-made fast routines on them. |
| |
Graham Account closed
Registered: Dec 2002 Posts: 990 |
You could read the directory with a filename which is not on the disk, this way you will only get the header/id and the blocks free message.
|
| |
Mace
Registered: May 2002 Posts: 1799 |
Or you could parse the free blocks once and then calculate and keep tracks of used blocks inside your program.
This, of course, only works when you don't change the floppy between saves. |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
"You could read the directory with a filename which is not on the disk, this way you will only get the header/id and the blocks free message."
wont be much faster though... on a 1541 anyway |
| |
MagerValp
Registered: Dec 2001 Posts: 1078 |
Quoting GrahamYou could read the directory with a filename which is not on the disk, this way you will only get the header/id and the blocks free message.
This is nice, simple, and portable, thumbs up. |
| |
MagerValp
Registered: Dec 2001 Posts: 1078 |
Quoting GroepazQuoting GrahamYou could read the directory with a filename which is not on the disk, this way you will only get the header/id and the blocks free message.
wont be much faster though... on a 1541 anyway
With 144 files in the directory:
@$:flarghleblargh 4.9 seconds
@$ 16.2 seconds
With 8 files in the directory:
@$:flarghleblargh 1.0 seconds
@$ 1.5 seconds
|
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
and now, if you are saving those 30 files at kernal speed, how much of the total time would these 16 seconds be so that it matters ? =P |
| |
iAN CooG
Registered: May 2002 Posts: 3194 |
sorry if i sneak in, but load"$:",8 is enough, no need to specify a non existant name =) ":" is already a non existant name/pattern |
Previous - 1 | 2 - Next |