Skip to content

Instantly share code, notes, and snippets.

@McZonk
Created May 11, 2025 07:25
Show Gist options
  • Save McZonk/1e643871186dc486845c1012c66592c7 to your computer and use it in GitHub Desktop.
Save McZonk/1e643871186dc486845c1012c66592c7 to your computer and use it in GitHub Desktop.
import os
import sys
romName = sys.argv[1]
checksum = 0
with open(romName, 'rb') as rom:
while True:
byte = rom.read(1)
if len(byte) == 0:
break
checksum += byte[0]
if romName.endswith('prom1.cpu'):
rom.seek(0x1ff8, os.SEEK_SET)
checksumBytes = rom.read(2)
for byte in checksumBytes:
checksum -= byte
checksum += 0x01fe
checksum %= 65536
print(f'Checksum {hex(checksum)}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment