I wrote a little python script which checks the checksum of a Bios.
In a previous post i used hexedit to play around changing a Bios dump.
Below posted python script calculates the checkum using the following:
Add all bytes in the file and do a modulo 256 on this number. The output should be 0.
My previous edit gave me a output of C2, so I changed an unused byte FF into (FF-C2) 3D. No more checksum errors when booting!
Next to do, get a Bios like Glabios or PcXtBios to start my own code from a secondary Eeprom.
import sys
# Bios sum modulo should be 0
# edit last or unused byte to fix
# python bios-checksum-test.py MYROM.edit.checksum
# 0
f = open(sys.argv[1],'rb')
m = f.read()
print '%x' % ( ( sum(ord(c) for c in m) & 0xFFFFFFFF ) % 256 )
Python3
import sys
# Bios sum modulo should be 0
# edit last or unused byte to fix
# python bios-checksum-test.py MYROM.edit.checksum
# 0
f = open(sys.argv[1],'rb')
m = f.read()
checksum = ( ( sum((c) for c in m) & 0xFFFFFFFF ) % 256 )
print(checksum, 'in hex =', hex(checksum))