[BBC-Micro] ADFS sector checksums
Jonathan Graham Harston
jgh at arcade.demon.co.uk
Fri Oct 27 00:58:04 BST 2006
>Message-ID: <3lcuj2dthslh96i0qbfkkp0eb4q7dd86fc at 4ax.com>
John Kortink <kortink at inter.nl.net> wrote:
> >Sector 1: F9 FF 1F 00 00 .... 00 27 E6 00 03 xx
> >FNsum returns &2A, but actual checksum is &2B.
>
> No, the actual checksum is &29.
>
> The proof of the pudding : putting the relevant harddisc
> images on GoMMC : &2B for sector 1, as expected, gives a
> 'Bad FS map' error. &29, as expected, doesn't.
Ah. Knowing that helps. I suspect that the proble is related to
my code starting sum=0, whereas your C code starts sum=255,
which none of the documentation tells you.
The Master Reference Manaul just says "checksum". The PRM
v2p200 says "8-bit ADCs on the bytes of the map, starting
with value 0", and the zero is repeated in the next paragraph
and in the code sample. That to me clearly says
0++mem[0]++mem[1]++mem[2]++mem[3]...etc where '++' means ADC.
Your code says 255++mem[0]++mem[1]...etc.
> >Well, that gives me &21 instead of &2B.
>
> No, it gives &29. Which is the correct answer. You
> either forgot to properly zero out the rest of the
> sector or your 6502 has forgotten how to add.
My 6502 must have forgotten how to count, as I typed that code in,
spooled the output, listed it and ran it, then read the spool
output directly into the email.
Anyway. I'll have to get around to plugging my GoMMC back in and
making some sample blank disks and getting the BASIC code working
properly.
--
J.G.Harston - jgh at arcade.demon.co.uk - mdfs.net/User/JGH
Sheffield Boundary Review at http://mdfs.net/User/JGH/Docs/Politics/ParlReview
More information about the bbc-micro
mailing list