#!/usr/local/bin/perl -w

print "\tORG\t\$8000\n";

LINE: while (<>) {
  if (/^\s*$/) { print "\n"; next LINE; }
  if (/^\s*;/) { print; next LINE; }
  if (/^\s*((loop|jump82|goto91):)/) { print "${1}_$.\n"; next LINE; }
  if (/^\s*(\w*:)/) { print "$1\n"; next LINE; }
  if (/^\t\.word\t([a-f0-9]{4})$/) { print "\tFDB\t\$\U$1\n"; next LINE; }
  if (/^([A-F0-9]{4}) ((([A-F0-9]{2}) )*[A-F0-9]{2})/) {
    print ";$_";
    @_=split(' ',$2);
    print "\tFCB\t\$".join(', $',@_)."\n";
    next LINE;
  }
  if (/^\cZ$/) { next LINE; }
  print ";$_";
}
