Skip to content

Instantly share code, notes, and snippets.

@luisfcorreia
Created December 20, 2022 20:22
Show Gist options
  • Save luisfcorreia/eaab589005e795d566a5a889f3f3f94e to your computer and use it in GitHub Desktop.
Save luisfcorreia/eaab589005e795d566a5a889f3f3f94e to your computer and use it in GitHub Desktop.
an Amiga 1200 splitter and swapper for kickstart roms
#!/usr/bin/env python3
import argparse
parser = argparse.ArgumentParser(description="Byteswap and split an Amiga 1200 ROM file")
parser.add_argument("infile", type=str, help="the ROM file to convert")
parser.add_argument("lo", type=str, help="filename for LO rom")
parser.add_argument("hi", type=str, help="filename for HI rom")
args = parser.parse_args()
with open(args.infile, "rb") as f:
data = f.read()
lo=open(args.lo, "wb")
hi=open(args.hi, "wb")
for i in range(0, len(data), 4):
lo.write((data[i+1]).to_bytes())
lo.write((data[i]).to_bytes())
hi.write((data[i+3]).to_bytes())
hi.write((data[i+2]).to_bytes())
lo.close()
hi.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment