mirror of
https://github.com/softwarejanitor/as65.git
synced 2024-11-24 20:32:54 +00:00
Bug fix for DS
This commit is contained in:
parent
2db741e827
commit
88e61b8f22
34
as65.pl
34
as65.pl
@ -2484,8 +2484,23 @@ if (open($ifh, "<$input_file")) {
|
|||||||
$symbols{$symbol} = '$' . sprintf("%02x", unpack('C', pack("B8", $1))) . sprintf("%02x", unpack('C', pack("B8", $2)));
|
$symbols{$symbol} = '$' . sprintf("%02x", unpack('C', pack("B8", $1))) . sprintf("%02x", unpack('C', pack("B8", $2)));
|
||||||
# Handle symbol
|
# Handle symbol
|
||||||
} elsif ($operand =~ /^([<>]*)([A-Za-z\.\?:][A-Za-z0-9_\.\?:]*)$/) {
|
} elsif ($operand =~ /^([<>]*)([A-Za-z\.\?:][A-Za-z0-9_\.\?:]*)$/) {
|
||||||
##FIXME -- need to handle < and > here
|
my $symval = $symbols{$2};
|
||||||
$symbols{$symbol} = $symbols{$2};
|
if (defined $symval) {
|
||||||
|
# Handle < and >.
|
||||||
|
if (defined $1 && $1 eq '<') {
|
||||||
|
if ($symval =~ /\$([0-9a-fA-F]{1,2})/) {
|
||||||
|
$symbols{$symbol} = $1;
|
||||||
|
}
|
||||||
|
} elsif (defined $1 && $1 eq '>') {
|
||||||
|
if ($symval =~ /\$[0-9a-fA-F]*([0-9a-fA-F]{1,2})/) {
|
||||||
|
$symbols{$symbol} = $1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$symbols{$symbol} = $symval;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print "**** $lineno - Unknown symbol '$2' in '$line'\n";
|
||||||
|
}
|
||||||
# Allow arithmetic on symbol
|
# Allow arithmetic on symbol
|
||||||
} elsif ($operand =~ /^([<>]*)([A-Za-z\.\?:][A-Za-z0-9_\.\?:]*)\s*[+]\s*(\$*[0-9a-fA-F]+)$/) {
|
} elsif ($operand =~ /^([<>]*)([A-Za-z\.\?:][A-Za-z0-9_\.\?:]*)\s*[+]\s*(\$*[0-9a-fA-F]+)$/) {
|
||||||
# Add
|
# Add
|
||||||
@ -2504,14 +2519,14 @@ if (open($ifh, "<$input_file")) {
|
|||||||
if ($operand =~ /([0-9a-fA-F]+)/) {
|
if ($operand =~ /([0-9a-fA-F]+)/) {
|
||||||
$addr += (length($1) / 2);
|
$addr += (length($1) / 2);
|
||||||
}
|
}
|
||||||
} elsif ($ucmnemonic =~ /^DS$/i) {
|
} elsif ($ucmnemonic =~ /^DS$/) {
|
||||||
if ($label ne '') {
|
if ($label ne '') {
|
||||||
my $symbol = $label;
|
my $symbol = $label;
|
||||||
$symbols{$symbol} = sprintf("\$%04x", $addr);
|
$symbols{$symbol} = sprintf("\$%04x", $addr);
|
||||||
}
|
}
|
||||||
if ($operand =~ /\$([0-9a-fA-F]+)/) {
|
if ($operand =~ /\$([0-9a-fA-F]+)/) {
|
||||||
$addr += hex(lc($1));
|
$addr += hex(lc($1));
|
||||||
} elsif ($operand =~ /(\d+)/) {
|
} elsif ($operand =~ /^(\d+)/) {
|
||||||
$addr += $1;
|
$addr += $1;
|
||||||
}
|
}
|
||||||
} elsif ($ucmnemonic =~ /^DB$/i) {
|
} elsif ($ucmnemonic =~ /^DB$/i) {
|
||||||
@ -2793,10 +2808,17 @@ if (open($ifh, "<$input_file")) {
|
|||||||
# Decimal
|
# Decimal
|
||||||
my $strlen = 0;
|
my $strlen = 0;
|
||||||
my $val = 0x00;
|
my $val = 0x00;
|
||||||
if ($operand =~ /^(\d+)/) {
|
if ($operand =~ /^(\d+)$/) {
|
||||||
$strlen = $1;
|
$strlen = $1;
|
||||||
} elsif ($operand =~ /^(\d+),"(.)["]*/) {
|
} elsif ($operand =~ /^(\d+),"(.)["]*/) {
|
||||||
$val = ord($1);
|
$strlen = $1;
|
||||||
|
$val = ord($2);
|
||||||
|
} elsif ($operand =~ /^(\d+),'(.)[']*/) {
|
||||||
|
$strlen = $1;
|
||||||
|
$val = ord($2);
|
||||||
|
} elsif ($operand =~ /^(\d+),\$([0-9a-fA-F][0-9a-fA-F])/) {
|
||||||
|
$strlen = $1;
|
||||||
|
$val = hex(lc($2));
|
||||||
# Hex
|
# Hex
|
||||||
} elsif ($operand =~ /^\$([0-9a-fA-F][0-9a-fA-F])/) {
|
} elsif ($operand =~ /^\$([0-9a-fA-F][0-9a-fA-F])/) {
|
||||||
$strlen = hex(lc($1));
|
$strlen = hex(lc($1));
|
||||||
|
Loading…
Reference in New Issue
Block a user