Skip to content

Instantly share code, notes, and snippets.

@houmei
Last active January 15, 2026 11:36
Show Gist options
  • Select an option

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

Select an option

Save houmei/aa34f49f4013bd910e01cb296d7510b4 to your computer and use it in GitHub Desktop.
Merge KANJI-ROM image (L-R)
-- 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