Last active
January 15, 2026 11:36
-
-
Save houmei/aa34f49f4013bd910e01cb296d7510b4 to your computer and use it in GitHub Desktop.
Merge KANJI-ROM image (L-R)
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
| -- shuffle ROM image | |
| if arg[3] == nil then | |
| print("Usage: ",arg[0]," L-image R-image outputfile");os.exit(-1) | |
| end | |
| -- | |
| FL=io.open(arg[1],"rb") | |
| if FL == nil then | |
| print (arg[1]," not found");os.exit(-2) | |
| end | |
| -- | |
| FR=io.open(arg[2],"rb") | |
| if FR == nil then | |
| print (arg[2]," not found");os.exit(-2) | |
| end | |
| -- | |
| FW=io.open(arg[3],"wb") | |
| if FW == nil then | |
| print (arg[3]," open error");os.exit(-2) | |
| end | |
| -- | |
| while true do | |
| t=FL:read(1) | |
| if t == nil then | |
| break | |
| end | |
| l=string.byte(t) | |
| r=string.byte(FR:read(1)) | |
| FW:write(string.char(l)) | |
| FW:write(string.char(r)) | |
| end | |
| -- | |
| io.close(FL) | |
| io.close(FR) | |
| io.close(FW) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment