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 /multixex.pl | |
parent | a6ef892a3c562641dcca20ef7fac966ecffb0c67 (diff) | |
download | taipan-00d78b9f401ec6f1ba0a1c900e382ec323058337.tar.gz |
support BROKEN xex loaders that can't handle markers after the 1st segment
Diffstat (limited to 'multixex.pl')
-rw-r--r-- | multixex.pl | 25 |
1 files changed, 25 insertions, 0 deletions
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; +} |