Skip to content

Instantly share code, notes, and snippets.

@houmei
Created February 24, 2025 09:55
Show Gist options
  • Select an option

  • Save houmei/4e56f67d6475676c2749de0f9f97def3 to your computer and use it in GitHub Desktop.

Select an option

Save houmei/4e56f67d6475676c2749de0f9f97def3 to your computer and use it in GitHub Desktop.
32KB binary sum (get Kanji-ROM checksum)
-- 32KB KROM SUM
if arg[1]==nil then
print("Usage: arg[0] file")
os.exit(-1)
end
--
FH=io.open(arg[1],"rb")
if FH==nil then
print (arg[1]," not found")
os.exit(-2)
end
--
sum = 0
for i = 0,32767 do
b = string.byte(FH:read(1))
sum = sum + b
end
print(string.format("%X",sum))
io.close(FH)
--
-- MB83256-019 1287E1
-- MB83256-020 1A6676
-- MB83256-021 21775F
-- MB83256-022 2B8374
--
-- MB83256-027 236506
-- MB83256-028 2EF920
-- MB83256-029 1D307D
-- MB83256-030 23026E
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment