Created
December 10, 2019 18:59
-
-
Save blark/78375002420af6e3816990c489d93755 to your computer and use it in GitHub Desktop.
A quick and dirty Python 3 script to byteswap an Amiga ROM
This file contains 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
#!/usr/bin/env python3 | |
import argparse | |
parser = argparse.ArgumentParser(description="Byteswap an Amiga 500 ROM file") | |
parser.add_argument("infile", type=str, help="the ROM file to convert") | |
parser.add_argument("outfile", type=str, help="filename to output") | |
args = parser.parse_args() | |
with open(args.infile, "rb") as f: | |
data = f.read() | |
data = bytearray(data) | |
for i in range(0, len(data), 2): | |
data[i], data[i+1] = data[i+1], data[i] | |
with open(args.outfile, "wb") as f: | |
f.write(bytes(data)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment