mirror of
https://github.com/garrettsworkshop/MacIIROMDiskDriver.git
synced 2024-11-21 12:30:49 +00:00
12 lines
282 B
Python
12 lines
282 B
Python
import sys
|
|
import struct
|
|
|
|
with open(sys.argv[1], mode='rb') as file:
|
|
file.read(4) # discard first four bytes
|
|
rombin = file.read() # read rest of file
|
|
cksum = 0
|
|
for i in struct.unpack('>' + str(len(rombin)/2) + 'H', rombin):
|
|
cksum += i;
|
|
cksum &= 0xFFFFFFFF
|
|
print(hex(cksum))
|