2017-09-06 01:41:13 +00:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
|
2018-12-02 00:11:25 +00:00
|
|
|
my $org = $ARGV[0] || '2000';
|
2017-09-17 18:18:47 +00:00
|
|
|
|
|
|
|
print <<"END_HEADER";
|
2017-09-06 01:41:13 +00:00
|
|
|
GLOBAL {
|
2017-09-17 18:18:47 +00:00
|
|
|
STARTADDR \$$org;
|
2017-09-06 01:41:13 +00:00
|
|
|
PAGELENGTH 0; # No paging
|
2018-04-20 04:23:23 +00:00
|
|
|
CPU "6502";
|
2017-09-06 01:41:13 +00:00
|
|
|
};
|
2017-09-17 18:18:47 +00:00
|
|
|
END_HEADER
|
|
|
|
|
|
|
|
print <<'END_LABELS';
|
2017-09-06 01:41:13 +00:00
|
|
|
|
|
|
|
LABEL { NAME "RAMRDOFF"; ADDR $C002; };
|
|
|
|
LABEL { NAME "RAMRDON"; ADDR $C003; };
|
|
|
|
LABEL { NAME "RAMWRTOFF"; ADDR $C004; };
|
|
|
|
LABEL { NAME "RAMWRTON"; ADDR $C005; };
|
|
|
|
LABEL { NAME "ALTZPOFF"; ADDR $C008; };
|
|
|
|
LABEL { NAME "ALTZPON"; ADDR $C009; };
|
|
|
|
LABEL { NAME "LCBANK1"; ADDR $C08B; };
|
|
|
|
LABEL { NAME "AUXMOVE"; ADDR $C311; };
|
|
|
|
LABEL { NAME "XFER"; ADDR $C314; };
|
|
|
|
|
|
|
|
LABEL { NAME "A2D"; ADDR $4000; };
|
|
|
|
LABEL { NAME "UNKNOWN_CALL"; ADDR $8E00; };
|
|
|
|
LABEL { NAME "MLI"; ADDR $BF00; };
|
|
|
|
|
|
|
|
|
2017-09-17 18:18:47 +00:00
|
|
|
END_LABELS
|
2017-09-06 01:41:13 +00:00
|
|
|
|
2017-09-17 18:18:47 +00:00
|
|
|
print <<'END_SEGS';
|
2018-12-02 00:11:25 +00:00
|
|
|
#RANGE { START $8800; END $939E; TYPE ByteTable; };
|
|
|
|
#RANGE { START $DA20; END $DAFF; TYPE ByteTable; };
|
|
|
|
#RANGE { START $E690; END $E6BF; TYPE ByteTable; };
|
|
|
|
#RANGE { START $FB00; END $FFFF; TYPE ByteTable; };
|
2017-09-17 18:18:47 +00:00
|
|
|
END_SEGS
|
2017-09-06 01:41:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-09-17 18:18:47 +00:00
|
|
|
my $ptr = hex($org);
|
2017-09-06 01:41:13 +00:00
|
|
|
|
|
|
|
my @last = (-1, -1, -1);
|
|
|
|
my $b;
|
|
|
|
while (read(STDIN, $b, 1)) {
|
|
|
|
$b = ord($b);
|
|
|
|
#print sprintf("%04x: \$%02x\n", $ptr, $b);
|
|
|
|
++$ptr;
|
|
|
|
|
|
|
|
shift @last;
|
|
|
|
push @last, $b;
|
|
|
|
my $lastaddr = $last[1] | ($last[2] << 8);
|
|
|
|
|
|
|
|
if ($last[0] == 0x20 &&
|
|
|
|
($lastaddr == 0x4000 || $lastaddr == 0x8E00 || $lastaddr == 0xBF00)) {
|
|
|
|
die "expected 3 more\n" unless read(STDIN, $b, 3) == 3;
|
|
|
|
print sprintf(
|
|
|
|
"RANGE { START \$%04x; END \$%04x; TYPE ByteTable; };\n" .
|
|
|
|
"RANGE { START \$%04x; END \$%04x; TYPE AddrTable; };\n",
|
|
|
|
$ptr, $ptr, $ptr+1, $ptr+2
|
|
|
|
);
|
|
|
|
|
|
|
|
$ptr += 3;
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
}
|