mirror of
https://github.com/softwarejanitor/as65.git
synced 2024-09-28 11:54:44 +00:00
Fixed bug in generate_byte sub.
This commit is contained in:
parent
1152bcd84d
commit
b4598da69c
34
as65.pl
34
as65.pl
@ -771,6 +771,16 @@ sub generate_24 {
|
|||||||
calc_checksum($opval2);
|
calc_checksum($opval2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub generate_bytes {
|
||||||
|
my ($ofh, $addr, $bytes, $lineno, $line) = @_;
|
||||||
|
my $tmpline = $line;
|
||||||
|
foreach my $byte (@{$bytes}) {
|
||||||
|
next unless $byte =~ /^[0-9a-fA-F]+/;
|
||||||
|
generate_8($ofh, $addr, hex(lc($byte)), $lineno, $tmpline);
|
||||||
|
$tmpline = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sub sym_add {
|
sub sym_add {
|
||||||
my ($symval, $offset) = @_;
|
my ($symval, $offset) = @_;
|
||||||
|
|
||||||
@ -2307,22 +2317,14 @@ if (open($ifh, "<$input_file")) {
|
|||||||
} elsif ($ucmnemonic eq 'HEX') {
|
} elsif ($ucmnemonic eq 'HEX') {
|
||||||
# Unpack hex data.
|
# Unpack hex data.
|
||||||
my @bytes = map { pack('C', hex($_)) } ($operand =~ /(..)/g);
|
my @bytes = map { pack('C', hex($_)) } ($operand =~ /(..)/g);
|
||||||
my $tmpline = $line;
|
generate_bytes($ofh, $addr, \@bytes, $lineno, $line);
|
||||||
foreach my $byte (@bytes) {
|
$addr += scalar(@bytes);
|
||||||
generate_8($ofh, $addr, ord($byte), $lineno, $tmpline);
|
|
||||||
$tmpline = '';
|
|
||||||
$addr++;
|
|
||||||
}
|
|
||||||
} elsif ($ucmnemonic eq 'ASC') {
|
} elsif ($ucmnemonic eq 'ASC') {
|
||||||
# Unpack string dats.
|
# Unpack string dats.
|
||||||
my ($str) = $operand =~ /^\"(.+)\"$/;
|
my ($str) = $operand =~ /^\"(.+)\"$/;
|
||||||
my @bytes = map { pack('C', ord($_)) } ($str =~ /(.)/g);
|
my @bytes = map { pack('C', ord($_)) } ($str =~ /(.)/g);
|
||||||
my $tmpline = $line;
|
generate_bytes($ofh, $addr, \@bytes, $lineno, $line);
|
||||||
foreach my $byte (@bytes) {
|
$addr += scalar(@bytes);
|
||||||
generate_8($ofh, $addr, ord($byte) + 128, $lineno, $tmpline);
|
|
||||||
$tmpline = '';
|
|
||||||
$addr++;
|
|
||||||
}
|
|
||||||
} elsif ($ucmnemonic =~ /DFB/i) {
|
} elsif ($ucmnemonic =~ /DFB/i) {
|
||||||
if ($operand =~ /^%([01]{8})/) {
|
if ($operand =~ /^%([01]{8})/) {
|
||||||
my $byte = unpack('C', pack("B8", $1));
|
my $byte = unpack('C', pack("B8", $1));
|
||||||
@ -2330,12 +2332,8 @@ if (open($ifh, "<$input_file")) {
|
|||||||
$addr++;
|
$addr++;
|
||||||
} elsif ($operand =~ /[0-9a-fA-F][0-9a-fA-F],*/) {
|
} elsif ($operand =~ /[0-9a-fA-F][0-9a-fA-F],*/) {
|
||||||
my @bytes = split(',', $operand);
|
my @bytes = split(',', $operand);
|
||||||
my $tmpline = $line;
|
generate_bytes($ofh, $addr, \@bytes, $lineno, $line);
|
||||||
foreach my $byte (@bytes) {
|
$addr += scalar(@bytes);
|
||||||
generate_8($ofh, $addr, hex(lc($byte)), $lineno, $tmpline);
|
|
||||||
$tmpline = '';
|
|
||||||
$addr++;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
print "$line - Bad byte definition '$operand'\n";
|
print "$line - Bad byte definition '$operand'\n";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user