Created
January 15, 2026 13:26
-
-
Save houmei/69ef224cb06d5d4e13711bdb394792f9 to your computer and use it in GitHub Desktop.
dump KANJI-ROM
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
| -- dump ROM image | |
| if arg[1] == nil then | |
| print("Usage: ",arg[0]," KANJI-ROM");os.exit(-1) | |
| end | |
| -- | |
| FL=io.open(arg[1],"rb") | |
| if FL == nil then | |
| print (arg[1]," not found");os.exit(-2) | |
| end | |
| -- | |
| local function fdot(b) -- b:byte 8bit | |
| local p=0x80 | |
| local s="" | |
| while p>0 do | |
| if (b & p)==0 then | |
| s=s .. "." | |
| else | |
| s=s .. "#" | |
| end | |
| p=p>>1 | |
| end | |
| return s | |
| end | |
| -- | |
| ct=0 | |
| -- | |
| while true do | |
| t=FL:read(1) | |
| if t == nil then | |
| break | |
| end | |
| l=string.byte(t) | |
| c=string.char(l) | |
| if (ct%32)==0 then | |
| print(string.format("\n%04x",ct/32)) | |
| end | |
| if (ct%2)==0 then | |
| r=fdot(l) | |
| else | |
| r=r .. fdot(l) | |
| print(r) | |
| end | |
| ct=ct+1 | |
| end | |
| -- | |
| io.close(FL) | |
| -- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment