<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Thu, 16 Mar 2006 00:56:12 +0100
From   : John Kortink <kortink@...>
Subject: Re: Web site: Mainly Master 512

On 15 Mar 2006 22:25:32 +0000, Jonathan Graham Harston wrote:

>>Message-ID: <000601c6473d$903fb830$0301a8c0@...>
> 
>"David Harper" <dl.harper@...> wrote:
>> > Could you correct the Free Space Map info regarding the
>> > checksum. Most people don't seem to get this right. It's
>> > not a plain sum but a sum /with carry/, which means that
>> 
>> You're right. Correction made.
> 
>Additionally, you have to add the sector number to the checksum as
>well.
> 
>IE, checksum for sector zero is Sum(0:255), checksum for sector
>one is Sum(0:255)+1

No, no, no, that is incorrect.

>That was a *really* annoying gotcha when I was getting the IDE
>drive initialiser working.

That's because you didn't follow the correct algorithm for
the checksum before.

With reference to earlier emails, it's funny to see how
Acorn manages to save one more routine byte (with a TYA)
by using :

CLC
LDY #255
TYA
.loop
ADC addr-1,Y
DEY
BNE loop

for both sectors.

Why starting with 255 ends up with the same result as starting
with 0 (/except/ when all but the last sector byte added in is
zero !) is left as an exercise for the reader. It's sure to win
a prize in obscure programming.


John Kortink

-- 

Email    : kortink@...         
Homepage : http://www.inter.nl.net/users/J.Kortink

GoMMC, the ultimate BBC B/B+/Master storage system :
http://web.inter.nl.net/users/J.Kortink/home/hardware/gommc
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>