First post, by jdredd
--
--
I haven't looked at an ISA IBM PS/2 BIOS but have looked at AMIBIOS and others before.
Because the checksum calculation sums the whole BIOS and then checks whether it's zero, you don't necessarily know where the checksum is stored. Sometimes you just have to know, such as a byte checksum at F000:FFFE. But, as long as you don't clobber some byte that's actually used, you could theoretically adjust any byte(s) in the image to fix up the checksum.
As for how the checksum is calculated, you could disassemble and try to look for code that looks something like this, e.g. by looking for the immediates f000h and 8000h nearby, or perhaps add reg,ax or even a lodsw/add/loop:
cldmov ax,0f000hmov ds,axmov cx,8000hxor bx,bxxor si,sisum: lodswadd bx,axloop sumjnz BadChecksum
Every vendor's checksum loop might be different. That's one for a 16-bit, little-endian checksum, others might checksum only at the byte level, or only checksum the top 32KB, etc.
The Hex-Editor HxD can do this calculation for you if it's on byte level. It's called Checksum 8 or Checksum 16, depending on which size of the result you want