Date : Fri, 27 Oct 2006 00:58:04 +0100
From : jgh@... (Jonathan Graham Harston)
Subject: ADFS sector checksums
>Message-ID: <BAY124-W11062DB79C77FC7700BA52B2060@...>
Steve O'Leary <navalenigma@...> 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;
[snip]
> sum =42 or in Hex 2A
> routine (which I've done above) I cannot match your result, which as you've
> proven appears correct.
*BASIC
AUTO
DIM mem% 255
FOR A%=0 TO 255:mem%?A%=0:NEXT
mem%!0=&1FFFF9:mem%!&FB=&0300E627
PRINT ~FNsum(mem%)
END
DEFFNsum(sec%):LOCAL sum%
FOR A%=0 TO 254
sum%=sum%+sec%?A%:IF sum%>255:sum%=(sum%+1)AND255
NEXT:=sum%
<press ESCAPE>
RUN
...gives me 2A.
--
J.G.Harston - jgh@... - mdfs.net/User/JGH
There are three food groups: brown, green and ice cream.