Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!ames!ucbcad!ucbvax!hplabs!hp-pcd!hpcvlo!bill From: bill@hpcvlo.HP.COM (Bill Frolik) Newsgroups: comp.sys.ibm.pc Subject: Re: IBM ROM Format??? Message-ID: <1610012@hpcvlo.HP.COM> Date: Thu, 23-Apr-87 11:16:44 EST Article-I.D.: hpcvlo.1610012 Posted: Thu Apr 23 11:16:44 1987 Date-Received: Sat, 25-Apr-87 23:59:22 EST References: <4342@beta.UUCP> Organization: Hewlett-Packard Co., Corvallis, OR, USA Lines: 30 The checksum is the one-byte sum of the bytes in however many 512-byte blocks the ROM claims to contain. A valid ROM has a zero checksum, which can be tested as follows: mov ax,; mov ds,ax ;DS:SI -> xor si,si ; start of ROM xor ah,ah ;Clear checksum accumulator mov dl,ds:[si+2] ;DL = Number of 512-byte blocks Sum1: mov cx,512 ;In AH, sum up Sum2: lodsb ; all the bytes in add ah,al ; this 512-byte loop Sum2 ; block. dec dl ;Sum up as many 512-byte blocks jnz Sum1 ; as the ROM claims it contains test ah,ah ;Is the sum zero? jz GoodROM ;If yes, checksum passes You can get the checksum to work out to zero on a new ROM by just setting any unused byte (within the region of however many 512-byte blocks you're using) to whatever value it takes to get the total to become zero. Bill Frolik hp-pcd!bill Hewlett-Packard Portable Computer Division Corvallis, Oregon