Created
February 24, 2025 09:55
-
-
Save houmei/4e56f67d6475676c2749de0f9f97def3 to your computer and use it in GitHub Desktop.
32KB binary sum (get Kanji-ROM checksum)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- 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