From 0ebc012c9ebe6698d94d25ec1ad82764df777402 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Sun, 28 Apr 2019 19:38:16 +0200 Subject: [PATCH] Add mode $8800 tilemap conversion tool --- Makefile | 4 ++++ src/tools/bit7ify.py | 8 ++++++++ 2 files changed, 12 insertions(+) create mode 100644 src/tools/bit7ify.py diff --git a/Makefile b/Makefile index 2a9b77f..78ba118 100644 --- a/Makefile +++ b/Makefile @@ -48,6 +48,10 @@ ASMFILES := $(wildcard $(SRCDIR)/*.asm) %.pb16: % src/tools/pb16.py $< $@ +# RGBGFX generates tilemaps with sequential tile IDs, which works fine for $8000 mode but not $8800 mode; `bit7ify.py` takes care to flip bit 7 so maps become $8800-compliant +%.bit7.tilemap: src/tools/bit7ify.py %.tilemap + $^ $@ + CLEANTARGETS := $(BINDIR) $(DEPSDIR) $(OBJDIR) dummy # The list of things that must be cleared; expanded by the resource Makefiles INITTARGETS := diff --git a/src/tools/bit7ify.py b/src/tools/bit7ify.py new file mode 100644 index 0000000..f830383 --- /dev/null +++ b/src/tools/bit7ify.py @@ -0,0 +1,8 @@ +#!/usr/bin/env python3 + +from sys import argv + + +with open(argv[1], "rb") as input: + with open(argv[2], "wb") as output: + output.write(bytes((byte ^ 0x80 for byte in input.read())))