Changes to source listing.

This commit is contained in:
Leeland Heins 2018-12-19 07:57:51 -06:00 committed by GitHub
parent cf580d3982
commit 5f3789c651
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

24
as65.pl
View File

@ -12,8 +12,7 @@ use strict;
my $verbose = 1; # Print messages, default to on. my $verbose = 1; # Print messages, default to on.
my $debug = 0; # Debug mode, default to off. Very chatty if on. my $debug = 0; # Debug mode, default to off. Very chatty if on.
my $listing1 = 0; # Listing for pass 1. my $listing = 0; # Listing for pass 1.
my $listing2 = 0; # Listing for pass 2.
my $code_listing = 1; # Generated code listing. my $code_listing = 1; # Generated code listing.
my $symbol_table = 1; # Output symbol table. my $symbol_table = 1; # Output symbol table.
@ -35,9 +34,7 @@ sub usage {
print " -q : Quiet (default off)\n"; print " -q : Quiet (default off)\n";
print " -d : Debug (default off)\n"; print " -d : Debug (default off)\n";
print " -s : Symbol Table\n"; print " -s : Symbol Table\n";
print " -l : Listing (both passes) (default off)\n"; print " -l : Listing (source pass 1) (default off)\n";
print " -l1 : Listing (Pass 1) (default off)\n";
print " -l2 : Listing (Pass 2) (default off)\n";
print " -c : Generated code listing (default on)\n"; print " -c : Generated code listing (default on)\n";
print " -h : This help\n"; print " -h : This help\n";
} }
@ -75,18 +72,9 @@ while (defined $ARGV[0] && $ARGV[0] =~ /^-/) {
} elsif ($ARGV[0] eq '-s') { } elsif ($ARGV[0] eq '-s') {
$symbol_table = 0; $symbol_table = 0;
shift; shift;
# Listing (both passes). # Listing (pass 1).
} elsif ($ARGV[0] eq '-l') { } elsif ($ARGV[0] eq '-l') {
$listing1 = 1; $listing = 1;
$listing2 = 1;
shift;
# Pass 1 listing.
} elsif ($ARGV[0] eq '-l1') {
$listing1 = 1;
shift;
# Pass 2 listing.
} elsif ($ARGV[0] eq '-l2') {
$listing2 = 1;
shift; shift;
# Code listing. # Code listing.
} elsif ($ARGV[0] eq '-c') { } elsif ($ARGV[0] eq '-c') {
@ -2006,7 +1994,7 @@ if (open($ifh, "<$input_file")) {
$lineno++; $lineno++;
print sprintf("%4d %5d \$%04x | %s\n", $lineno, $addr, $addr, $line) if $listing1; print sprintf("%04x: %-4d %s\n", $addr, $lineno, $line) if $listing;
# Skip blank lines. # Skip blank lines.
next if $line =~ /^\s*$/; next if $line =~ /^\s*$/;
@ -2138,8 +2126,6 @@ if (open($ifh, "<$input_file")) {
$lineno++; $lineno++;
print sprintf("%4d %5d \$%04x | %s\n", $lineno, $addr, $addr, $line) if $listing2;
# Skip blank lines, comment lines, .org .alias. # Skip blank lines, comment lines, .org .alias.
if ($line =~ /^\s*$|^\s*;|^\s*\*|^\.org\s+.+|^\.alias\s+\S+\s+.+/) { if ($line =~ /^\s*$|^\s*;|^\s*\*|^\.org\s+.+|^\.alias\s+\S+\s+.+/) {
print sprintf(" %-4d $line\n", $lineno, $line) if $code_listing; print sprintf(" %-4d $line\n", $lineno, $line) if $code_listing;