diff options
author | B. Watson <yalhcru@gmail.com> | 2016-02-04 16:22:30 -0500 |
---|---|---|
committer | B. Watson <yalhcru@gmail.com> | 2016-02-04 16:22:30 -0500 |
commit | 00d78b9f401ec6f1ba0a1c900e382ec323058337 (patch) | |
tree | bfd715450f27f901516ff174fecf52c623bafb0d | |
parent | a6ef892a3c562641dcca20ef7fac966ecffb0c67 (diff) | |
download | taipan-00d78b9f401ec6f1ba0a1c900e382ec323058337.tar.gz |
support BROKEN xex loaders that can't handle markers after the 1st segment
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | multixex.pl | 25 |
2 files changed, 26 insertions, 1 deletions
@@ -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; +} |