[comp.sys.amiga.tech] AmigaDOS Filing System Block Format

a275@mindlink.UUCP (Travers Naran) (08/08/90)

I have some questions about this:

1. What are the "words" refered to in the AmiDOS Tech manual? Long words or
normal 16 bit words?

2. The Checksum is confusing, the manual says "Each filing system block
contains a checksum, where the sum (ignoring overflow) of all the words in the
block is zero." Huh??? I thought a Checksum was the sum of all the words in the
block (not including the  Checksum) ignoring overflow? Or does that sentence
mean that when I add up all the words in the block including the Checksum, I
should get zero ingoring overflow?

3. T.SHORT and ST.ROOT, etc. where are these constants defined?

4. How do I get a subscription to AmigaMail? I live in Canada and the RKM's
only talk about the U.S. mailing address.
--
-------------------------------------------------------------------
Travers "T'aran" Naran (I am male)
Simon Fraser University, Computing Science (Burnaby, B.C., Canada)
New Westminster, British Columbia, Canada, North America, etc...
Whovian, Prober, Treker, Quantum Leaper....
Mailing addresses:
   Usenet  Travers_Naran@mindlink.UUCP
or      uunet!van-bc!rsoft!mindlink!Travers_Naran
------------------------------------------------------------------

lphillips@lpami.wimsey.bc.ca (Larry Phillips) (08/09/90)

In <2761@mindlink.UUCP>, a275@mindlink.UUCP (Travers Naran) writes:
>I have some questions about this:
>
>1. What are the "words" refered to in the AmiDOS Tech manual? Long words or
>normal 16 bit words?

A word is 16 bits. A longword is 32 bits. I never noticed any discrepancy in
the Amigados manual, though I suppose there could be.

>2. The Checksum is confusing, the manual says "Each filing system block
>contains a checksum, where the sum (ignoring overflow) of all the words in the
>block is zero." Huh??? I thought a Checksum was the sum of all the words in the
>block (not including the  Checksum) ignoring overflow? Or does that sentence
>mean that when I add up all the words in the block including the Checksum, I
>should get zero ingoring overflow?

A checksum can be whatever the author of a piece of software wants it to be.
If you add up all the _LONGWORDS_ in a block, including the checksum, and
ignore any overflow, the result will be zero if the checksum is correct.

The checksum can be calculated by adding all the LONGWORDS in the block, not
counting the checksum itself, and subtracting the calculated value from zero.


>3. T.SHORT and ST.ROOT, etc. where are these constants defined?

I have never seen them defined in any include files. You can find their values
by using a sector editor and looking at the various block types. This will
serve a dual purpose. While you are looking at those, you can see all the rest
of the stuff they talk about in the Amigados manuals, and see what the FFS
blocks look like too.

>4. How do I get a subscription to AmigaMail? I live in Canada and the RKM's
>only talk about the U.S. mailing address.

Commodore Business Machines Limited
3470 Pharmacy Avenue
Agincourt, Ontario
M1W 3G3

Send the request to the attention of either Alex Orgill or Paula Dawson.

-larry

--
Sex is better than logic, but I can't prove it.
+-----------------------------------------------------------------------+ 
|   //   Larry Phillips                                                 |
| \X/    lphillips@lpami.wimsey.bc.ca -or- uunet!van-bc!lpami!lphillips |
|        COMPUSERVE: 76703,4322  -or-  76703.4322@compuserve.com        |
+-----------------------------------------------------------------------+

new@ee.udel.edu (Darren New) (08/09/90)

In article <2761@mindlink.UUCP> a275@mindlink.UUCP (Travers Naran) writes:
>1. What are the "words" refered to in the AmiDOS Tech manual? Long words or
>normal 16 bit words?

32-bit words. 

>2. The Checksum is confusing, 

Only if you have preconceived notions of how a Checksum should be computed.
You must arrange the checksum word such that adding up all the words in
the block comes out to zero. This way, the same routine can be used to
check the checksum on any block regardless of where the actual checksum is.
To rebuild the checksum, you must know where to put the checksum, of course.

A little algebra should tell you how to compute the checksum of a block
given that you know the desired conditions. Basically, set the CS to zero,
add up all the words, subtract sum from zero, and that is the CS (I think).
I have code that does this, so I can look it up if this isn't right.
The code is offline right now, however.

>3. T.SHORT and ST.ROOT, etc. where are these constants defined?

Hmmm... I remembered seeing them somewhere in the stuff from CBM, but
here is what the Disk Mechanic manual says:

T.SHORT is 2, T.DATA is 8, and T.LIST is 16.
ST.ROOT is 1, ST.USERDIR is 2 and ST.FILE is -3.

That should be all of them.  Can't help you with AmigaMail.
	    -- Darren

cmcmanis@stpeter.Eng.Sun.COM (Chuck McManis) (08/10/90)

In article <2761@mindlink.UUCP> a275@mindlink.UUCP (Travers Naran) writes:
>1. What are the "words" refered to in the AmiDOS Tech manual? Long words or
>normal 16 bit words?

Each disk block is 128 32bit words. Normally words refer to 16 bit quanties.

>2. The Checksum is confusing, the manual says "Each filing system block
>contains a checksum, where the sum (ignoring overflow) of all the words in the
>block is zero." Huh??? I thought a Checksum was the sum of all the words in the
>block (not including the  Checksum) ignoring overflow? Or does that sentence
>mean that when I add up all the words in the block including the Checksum, I
>should get zero ingoring overflow?

It means that if you add together all of the 32 bit longwords in a block the
sum will be 0. One longword is allocated as the checksum and can have any
value so to calculate the checksum you do something like :
	block[CHECKSUM] = 0;
	for (i=0, sum=0; i<128; i++) {
		sum += block[i];
	}
	block[CHECKSUM] = -sum;

>3. T.SHORT and ST.ROOT, etc. where are these constants defined?

I just used diskedit (sectorama works as well) to figure them out. Also
check include:libraries/filehandler.h (or .i) 


>4. How do I get a subscription to AmigaMail? I live in Canada and the RKM's
>only talk about the U.S. mailing address.

I would presume you mail to CATS in West Chester and ask for one. It is
about $25 US and there might be an extra charge for sending it to Canada.
Of course CBM Canada might get offended by the Commodore/Amiga encroaching
on its "turf" so there may be some internal political problems but that 
is generally out of people like your and mine's control. I HIGHLY
reccomend the AmigaMail subscription. Around here it is known as the
"fourth" ROM Kernel Manual. 

--
--Chuck McManis						    Sun Microsystems
uucp: {anywhere}!sun!cmcmanis   BIX: <none>   Internet: cmcmanis@Eng.Sun.COM
These opinions are my own and no one elses, but you knew that didn't you.
"I tell you this parrot is bleeding deceased!"

jesup@cbmvax.commodore.com (Randell Jesup) (08/10/90)

In article <2761@mindlink.UUCP> a275@mindlink.UUCP (Travers Naran) writes:
>1. What are the "words" refered to in the AmiDOS Tech manual? Long words or
>normal 16 bit words?

	32 bits.  BCPL (original language of AmigaDos) doesn't know about
anything but longwords (without trouble).

>2. The Checksum is confusing, the manual says "Each filing system block
>contains a checksum, where the sum (ignoring overflow) of all the words in the
>block is zero." Huh??? I thought a Checksum was the sum of all the words in the
>block (not including the  Checksum) ignoring overflow? Or does that sentence
>mean that when I add up all the words in the block including the Checksum, I
>should get zero ingoring overflow?

	The checksum is the value such that adding up the entire sector gives
a result of 0.  Normally calculated by adding up the sector with checksum as
0, then taking the result and negating it for the checksum.

>3. T.SHORT and ST.ROOT, etc. where are these constants defined?

	They aren't.  Easy to figure out with any disk utility.

>4. How do I get a subscription to AmigaMail? I live in Canada and the RKM's
>only talk about the U.S. mailing address.

	Call or write to CATS (should be in the monthly posting that just
went by.)

-- 
Randell Jesup, Keeper of AmigaDos, Commodore Engineering.
{uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.cbm.commodore.com  BIX: rjesup  
Common phrase heard at Amiga Devcon '89: "It's in there!"

djh@neuromancer.metaphor.com (Dallas J. Hodgson) (08/11/90)

In article <2761@mindlink.UUCP> a275@mindlink.UUCP (Travers Naran) writes:

<various items deleted>

>2. The Checksum is confusing, the manual says "Each filing system block
>contains a checksum, where the sum (ignoring overflow) of all the words in the
>block is zero." Huh??? I thought a Checksum was the sum of all the words in the
>block (not including the  Checksum) ignoring overflow? Or does that sentence
>mean that when I add up all the words in the block including the Checksum, I
>should get zero ingoring overflow?

Somewhat common trick I've seen in other places: reset the word where the
checksum is stored to 0. Checksum the entire block. NEG the checksum, and
place it in it's proper position in the block. Later you can checksum the
whole thing, checksum 'n all - and will it come out 0.

>4. How do I get a subscription to AmigaMail? I live in Canada and the RKM's
>only talk about the U.S. mailing address.

So, is Canada so far away? Write CATS-Info in WestChester,PA and sign up for
the Certified Developer program. Well worth the $50 (US).

>--
>-------------------------------------------------------------------
>Travers "T'aran" Naran (I am male)
>Simon Fraser University, Computing Science (Burnaby, B.C., Canada)
>New Westminster, British Columbia, Canada, North America, etc...
>Whovian, Prober, Treker, Quantum Leaper....
>Mailing addresses:
>   Usenet  Travers_Naran@mindlink.UUCP
>or      uunet!van-bc!rsoft!mindlink!Travers_Naran
>------------------------------------------------------------------

+----------------------------------------------------------------------------+
| Dallas J. Hodgson               |     "This here's the wattle,             |
| Metaphor Computer Systems       |      It's the emblem of our land.        |
| Mountain View, Ca.              |      You can put it in a bottle,         |
| USENET : djh@metaphor.com       |      You can hold it in your hand."      |
+============================================================================+
| "The views I express are my own, and not necessarily those of my employer" |
+----------------------------------------------------------------------------+

ahh@glyph.UUCP (Andy Heffernan) (08/12/90)

In article <1859@lpami.wimsey.bc.ca> lphillips@lpami.wimsey.bc.ca (Larry Phillips) writes:
>In <2761@mindlink.UUCP>, a275@mindlink.UUCP (Travers Naran) writes:
>>I have some questions about this:
>>
>>1. What are the "words" refered to in the AmiDOS Tech manual? Long words or
>>normal 16 bit words?
>
>A word is 16 bits. A longword is 32 bits. I never noticed any discrepancy in
>the Amigados manual, though I suppose there could be.

Just a quick note to say that the meaning of the term "word" is somewhat
architecture-dependent.  The standard M68000 (and thus, Amiga) definition
is "word == 16 bits", except for AmigaDOS ("word == 32 bits") due to some 
interesting BCPL implementation issues.  M88000 guys have a different definition
(32 bits), as do DEC-20 guys (36 bits), as do... etc.

Of course, I'm sure Larry understands all this; he was just the last
reply to this topic in today's news batch, so he gets picked on.

-- 
-------------------------------------------------------------------------
  Andy Heffernan					uunet!glyph!ahh
"`The... monkeys...' he croaked, gasping for air.  `Send in... the monkeys...'"