Date : Wed, 25 Oct 2006 16:17:55 +0100
From : dl.harper@... (David Harper)
Subject: ADFS sector checksums
Steve O'Leary wrote:
> Mmmm... Ignoring the code snippets, doing this on paper gives me 2A if I
> add with Carry and 27 if I don't, unless I've added up wrong; Here's my
> working, converting the values to decimal;
> sum = $FF (255), carry is zero
> ... <snip>
>
> Now I know I'm miss-interpreting somewhere but can you point out where.
> Also in my code I was clearing sum to 0 before starting the loop but you
> set it to 255, even adding that part into the "add all bytes with carry"
> routine (which I've done above) I cannot match your result, which as
> you've proven appears correct.
The problem is that you have started from the bottom rather than the top,
and the algorithm is not symmetrical this way. You have to start with the 03
(in position FE) and go down towards the beginning. You have gone the other
way, and it doesn't work. (As in this case, you can get a final carry going
one way but not the other.)
Se my previous post.
David Harper