Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!nrl-cmf!ames!elroy!cit-vax!ucla-cs!zen!ucbvax!hoser.berkeley.edu!bryce From: bryce@hoser.berkeley.edu (Bryce Nesbitt) Newsgroups: comp.sys.amiga Subject: Re: bootblock checksum Message-ID: <21815@ucbvax.BERKELEY.EDU> Date: Mon, 16-Nov-87 23:36:54 EST Article-I.D.: ucbvax.21815 Posted: Mon Nov 16 23:36:54 1987 Date-Received: Thu, 19-Nov-87 05:27:10 EST References: <2041@umd5.umd.edu> Sender: usenet@ucbvax.BERKELEY.EDU Distribution: comp.sys.amiga Organization: University of California at Berkeley Lines: 31 In article <2041@umd5.umd.edu> gsmith@umd5 (Gordon H. Smith) writes: >How do you compute the bootblock checksum? I have a program >that calculates it, but apparently it is not working correctly. This will work: move.l #128+127,d3 moveq #0,d0 move.l d0,4(a0) ;Zero out checksum area move.w #0,CCR ;Set extend to zero chksum move.l (a1)+,d1 addx.l d1,d0 dbra d3,chksum neg.l d0 subq.l #1,d0 move.l d0,4(a0) ;Set sum The critical thing is that it adds in the extend bit (same as carry for this example). You could do this from C also, but it look kind of ugly. If you are writing bootblock mangling code, check for a custom bootblock and warn the user before killing it, ok? The standard bootblock is about 20 bytes of code followed by 1K-about 20 bytes of whatever happended to be in memory at the time the block was written. |\ /| . Ack! (NAK, SOH, EOT) {o O} . bryce@hoser.berkeley.EDU -or- ucbvax!hoser!bryce (") U