mirror of
https://github.com/softwarejanitor/as65.git
synced 2024-06-14 13:29:31 +00:00
Added .byte support, fixed a couple bugs.
This commit is contained in:
parent
7c9c746642
commit
fbccd70b5b
46
as65.pl
46
as65.pl
|
@ -1031,6 +1031,9 @@ sub handle_8_bit_symbol {
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($opval =~ /^\$([0-9a-fA-F][0-9a-fA-F])/) {
|
||||||
|
$opval = hex(lc($1));
|
||||||
|
}
|
||||||
if ($opval > 255) {
|
if ($opval > 255) {
|
||||||
$opval -= 256;
|
$opval -= 256;
|
||||||
}
|
}
|
||||||
|
@ -2762,7 +2765,7 @@ print ">>>> IN CONDITIONAL\n";
|
||||||
$symbols{$symbol} = sprintf("\$%04x", $addr);
|
$symbols{$symbol} = sprintf("\$%04x", $addr);
|
||||||
}
|
}
|
||||||
##FIXME -- implement this
|
##FIXME -- implement this
|
||||||
} elsif ($ucmnemonic =~ /BYT/) {
|
} elsif ($ucmnemonic =~ /^BYT$/) {
|
||||||
if ($label ne '') {
|
if ($label ne '') {
|
||||||
my $symbol = $label;
|
my $symbol = $label;
|
||||||
$symbols{$symbol} = sprintf("\$%04x", $addr);
|
$symbols{$symbol} = sprintf("\$%04x", $addr);
|
||||||
|
@ -2774,6 +2777,13 @@ print ">>>> IN CONDITIONAL\n";
|
||||||
$symbols{$symbol} = sprintf("\$%04x", $addr);
|
$symbols{$symbol} = sprintf("\$%04x", $addr);
|
||||||
}
|
}
|
||||||
##FIXME -- implement this
|
##FIXME -- implement this
|
||||||
|
} elsif ($ucmnemonic =~ /BYTE/) {
|
||||||
|
if ($label ne '') {
|
||||||
|
my $symbol = $label;
|
||||||
|
$symbols{$symbol} = sprintf("\$%04x", $addr);
|
||||||
|
}
|
||||||
|
my @args = split /,/, $operand;
|
||||||
|
$addr += scalar @args * 2;
|
||||||
} elsif ($ucmnemonic =~ /OBJ|CHK|LST|END|SAV|\.TF|XC/) {
|
} elsif ($ucmnemonic =~ /OBJ|CHK|LST|END|SAV|\.TF|XC/) {
|
||||||
# Just ignore this
|
# Just ignore this
|
||||||
} elsif ($ucmnemonic =~ /MAC/) {
|
} elsif ($ucmnemonic =~ /MAC/) {
|
||||||
|
@ -3143,7 +3153,7 @@ print ">>>> DO $operand\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
##FIXME -- implement this
|
##FIXME -- implement this
|
||||||
} elsif ($ucmnemonic =~ /BYT/) {
|
} elsif ($ucmnemonic =~ /^BYT$/) {
|
||||||
if ($label ne '') {
|
if ($label ne '') {
|
||||||
my $symbol = $label;
|
my $symbol = $label;
|
||||||
$symbols{$symbol} = sprintf("\$%04x", $addr);
|
$symbols{$symbol} = sprintf("\$%04x", $addr);
|
||||||
|
@ -3155,6 +3165,13 @@ print ">>>> DO $operand\n";
|
||||||
$symbols{$symbol} = sprintf("\$%04x", $addr);
|
$symbols{$symbol} = sprintf("\$%04x", $addr);
|
||||||
}
|
}
|
||||||
##FIXME -- implement this
|
##FIXME -- implement this
|
||||||
|
} elsif ($ucmnemonic =~ /BYTE/) {
|
||||||
|
if ($label ne '') {
|
||||||
|
my $symbol = $label;
|
||||||
|
$symbols{$symbol} = sprintf("\$%04x", $addr);
|
||||||
|
}
|
||||||
|
my @args = split /,/, $operand;
|
||||||
|
$addr += scalar @args * 2;
|
||||||
} elsif ($ucmnemonic =~ /OBJ|CHK|LST|END|SAV|\.TF|XC/) {
|
} elsif ($ucmnemonic =~ /OBJ|CHK|LST|END|SAV|\.TF|XC/) {
|
||||||
# Just ignore this
|
# Just ignore this
|
||||||
} elsif ($ucmnemonic =~ /MAC/) {
|
} elsif ($ucmnemonic =~ /MAC/) {
|
||||||
|
@ -3286,8 +3303,12 @@ print ">>>> END CONDITIONAL\n";
|
||||||
# Parse input lines.
|
# Parse input lines.
|
||||||
my ($label, $mnemonic, $operand, $comment) = parse_line($line, $lineno);
|
my ($label, $mnemonic, $operand, $comment) = parse_line($line, $lineno);
|
||||||
|
|
||||||
next unless defined $mnemonic;
|
#next unless defined $mnemonic;
|
||||||
next if $mnemonic eq '';
|
#next if $mnemonic eq '';
|
||||||
|
if (!defined $mnemonic || $mnemonic eq '') {
|
||||||
|
print sprintf(" %-4d %s\n", $lineno, $line) if $code_listing;
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
my $ucmnemonic = uc($mnemonic);
|
my $ucmnemonic = uc($mnemonic);
|
||||||
|
|
||||||
|
@ -3526,7 +3547,6 @@ print ">>>> END CONDITIONAL\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# END GPH
|
# END GPH
|
||||||
|
|
||||||
} elsif ($ucmnemonic =~ /^DA$|^\.DA$|^DW$/) {
|
} elsif ($ucmnemonic =~ /^DA$|^\.DA$|^DW$/) {
|
||||||
# Handle binary.
|
# Handle binary.
|
||||||
if ($operand =~ /^%([01]{16})/) {
|
if ($operand =~ /^%([01]{16})/) {
|
||||||
|
@ -3586,10 +3606,24 @@ print ">>>> END CONDITIONAL\n";
|
||||||
#END GPH
|
#END GPH
|
||||||
} elsif ($ucmnemonic =~ /HBY/) {
|
} elsif ($ucmnemonic =~ /HBY/) {
|
||||||
##FIXME -- implement this
|
##FIXME -- implement this
|
||||||
} elsif ($ucmnemonic =~ /BYT/) {
|
print "NOT YET IMPLEMENTED!\n";
|
||||||
|
} elsif ($ucmnemonic =~ /^BYT$/) {
|
||||||
##FIXME -- implement this
|
##FIXME -- implement this
|
||||||
|
print "NOT YET IMPLEMENTED!\n";
|
||||||
} elsif ($ucmnemonic =~ /DFS/) {
|
} elsif ($ucmnemonic =~ /DFS/) {
|
||||||
##FIXME -- implement this
|
##FIXME -- implement this
|
||||||
|
print "NOT YET IMPLEMENTED!\n";
|
||||||
|
} elsif ($ucmnemonic =~ /BYTE/) {
|
||||||
|
my @args = split /,/, $operand;
|
||||||
|
my @bytes = ();
|
||||||
|
foreach my $opval (@args) {
|
||||||
|
if ($opval =~ /^\d+$/) {
|
||||||
|
push @bytes, $opval;
|
||||||
|
$addr++;
|
||||||
|
##FIXME -- probably should handle binary, hex and symbols here too.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
generate_bytes($ofh, $addr, \@bytes, $lineno, $line);
|
||||||
} elsif ($ucmnemonic =~ /MAC/) {
|
} elsif ($ucmnemonic =~ /MAC/) {
|
||||||
# Ignore on subsequent passes.
|
# Ignore on subsequent passes.
|
||||||
} elsif ($ucmnemonic =~ /\<\<\</) {
|
} elsif ($ucmnemonic =~ /\<\<\</) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user