aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--multixex.pl25
2 files changed, 26 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 3920b8d..dc8a21a 100644
--- a/Makefile
+++ b/Makefile
@@ -132,7 +132,7 @@ taipan.atr: all
# The game binary is a multi-part binary load file. This rule
# depends on all the pieces, and just concatenates them.
$(XEX): taimain.xex taifont.xex newtitle.xex comptitle.xex
- cat comptitle.xex newtitle.xex taifont.xex taimain.xex > $(XEX)
+ perl multixex.pl comptitle.xex newtitle.xex taifont.xex taimain.xex > $(XEX)
perl size.pl $(TAIMAIN_ADDR) $(STACK_SIZE)
# Bitmap data for the title screen, 256x184 = 47104 pixels, 8 bits
diff --git a/multixex.pl b/multixex.pl
new file mode 100644
index 0000000..e843cab
--- /dev/null
+++ b/multixex.pl
@@ -0,0 +1,25 @@
+#!/usr/bin/perl -w
+
+# concatenate 2 or more atari binary load files, removing the $FFFF
+# headers from the 2nd and further ones.
+
+# this shouldn't be necessary: Atari DOS 2.0S can handle the extra
+# $FFFF headers, and it sets the gold standard for Atari executables.
+# any loader that can't handle them, is broken. however, people apparently
+# use these broken loaders a lot these days, so we'll be nice and
+# support them.
+
+use bytes;
+
+die "Usage: $0 <xex-file> [<xex-file>] ... > output.xex\n" unless @ARGV;
+
+undef $/;
+$header_emitted = 0;
+
+for(@ARGV) {
+ open my $fh, "<$_" or die "$0: $_: $!\n";
+ my $data = <$fh>;
+ substr($data, 0, 2) = "" if substr($data, 0, 2) eq "\xff\xff";
+ $header_emitted++, print "\xff\xff" unless $header_emitted;
+ print $data;
+}