Date : Wed, 30 Aug 2006 20:18:07 +0100
From : "Ian Wolstenholme" <BBCMailingList@...>
Subject: Re: *INFO
I said it was a botched job!
The earlier version didn't have the rounding and I was pulling my
hair out trying to figure out why it didn't give the same answer as
*FREE until I remembered that you have to work using complete
disc sectors.
Then when I'd done that it started adding on an extra sector to files
whose length was an exact multiple of 256...
But I got there in the end!
Best wishes,
Ian
----- Original Message -----
From: Sprow
To: <bbc-micro@...>
Sent: Wed, 30 Aug 2006 18:55:18 +0100
Subject: Re: [BBC-Micro] *INFO
In article <E1GIOG4-0000x5-00@...>,
Ian Wolstenholme <BBCMailingList@...> wrote:
> Curses, foiled again!
[snip]
> 5 machines later (BBC DFS>>FileStore>>Master 512 ADFS 640K>>Acorn
> A5000 DOS 720K>>PC) it's here:
>
> http://www.BeebMaster.co.uk/Downloads/8271spl.txt
350IF(length MOD256=0) THEN round=length ELSE round=((length DIV256)+1)*256
360used=used+round
You can round up to the nearest power of two with devious ANDing:
350REM Round and add
360used=used+((length+255)ANDNOT255)
which is one of the few uses of arithmetic NOT,
Sprow.