Fixes for assembling Michael Packard's code

This commit is contained in:
Leeland Heins 2019-07-24 08:57:10 -05:00 committed by GitHub
parent 353839f276
commit c70485fc8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

37
as65.pl
View File

@ -1096,6 +1096,8 @@ sub is_Immediate {
# Parse ASCII # Parse ASCII
} elsif ($operand =~ /^#"(.)["]*$/) { } elsif ($operand =~ /^#"(.)["]*$/) {
return 2; return 2;
} elsif ($operand =~ /^#'(.)[']*$/) {
return 2;
# Handle symbols. # Handle symbols.
} elsif ($operand =~ /^#[<>]*\(*([0-9A-Za-z_\.\?:][A-Za-z0-9_\.\?:]*)\)*$/) { } elsif ($operand =~ /^#[<>]*\(*([0-9A-Za-z_\.\?:][A-Za-z0-9_\.\?:]*)\)*$/) {
return 2; return 2;
@ -1130,6 +1132,8 @@ sub generate_Immediate {
# Parse ASCII # Parse ASCII
} elsif ($operand =~ /^#"(.)["]*$/) { } elsif ($operand =~ /^#"(.)["]*$/) {
generate_16($ofh, $addr, $opcode, ord($1), $lineno, $line); generate_16($ofh, $addr, $opcode, ord($1), $lineno, $line);
} elsif ($operand =~ /^#'(.)[']*$/) {
generate_16($ofh, $addr, $opcode, ord($1), $lineno, $line);
# Handle symbol # Handle symbol
} elsif ($operand =~ /^#([<>]*)\(*([0-9A-Za-z_\.\?:][A-Za-z0-9_\.\?:]*)\)*/) { } elsif ($operand =~ /^#([<>]*)\(*([0-9A-Za-z_\.\?:][A-Za-z0-9_\.\?:]*)\)*/) {
handle_8_bit_symbol($ofh, $lineno, $addr, $opcode, $1, $2, undef, undef, $line); handle_8_bit_symbol($ofh, $lineno, $addr, $opcode, $1, $2, undef, undef, $line);
@ -2334,6 +2338,30 @@ sub parse_line {
$mnemonic = $2; $mnemonic = $2;
$operand = $3; $operand = $3;
$comment = $4; $comment = $4;
# Fix fir LABEL ASC 'text' ; comment
} elsif ($line =~ /^(\S+)\s+(\S+)\s+(['].+['])\s*(;.*)$/) {
$label = $1;
$mnemonic = $2;
$operand = $3;
$comment = $4;
# Fix fir ASC 'text' ; comment
} elsif ($line =~ /^\s+(\S+)\s+(['].+['])\s*(;.*)$/) {
$label = $1;
$mnemonic = $2;
$operand = $3;
$comment = $4;
# Fix fir LABEL ASC 'text'
} elsif ($line =~ /^(\S+)\s+(\S+)\s+(['].+['])\s*$/) {
$label = $1;
$mnemonic = $2;
$operand = $3;
$comment = '';
# Fix fir ASC 'text'
} elsif ($line =~ /^\s+(\S+)\s+(['].+['])\s*$/) {
$label = '';
$mnemonic = $1;
$operand = $2;
$comment = '';
} elsif ($line =~ /^(\S+)\s+(\S+)\s+(\S+)\s*$/) { } elsif ($line =~ /^(\S+)\s+(\S+)\s+(\S+)\s*$/) {
$label = $1; $label = $1;
$mnemonic = $2; $mnemonic = $2;
@ -2773,6 +2801,9 @@ print ">>>> IN CONDITIONAL\n";
} elsif ($operand =~ /^'(.+)'([0-9a-fA-F]*)$/) { } elsif ($operand =~ /^'(.+)'([0-9a-fA-F]*)$/) {
$str = $1; $str = $1;
$trl = $2; $trl = $2;
} elsif ($operand =~ /^'(.+)'\s*$/) {
$str = $1;
$trl = '';
} }
$addr += (length($str) - 1); $addr += (length($str) - 1);
$addr++ if defined $trl; $addr++ if defined $trl;
@ -3378,6 +3409,12 @@ print ">>>> END CONDITIONAL\n";
} elsif ($operand =~ /^'(.+)'([0-9a-fA-F]*)$/) { } elsif ($operand =~ /^'(.+)'([0-9a-fA-F]*)$/) {
$str = $1; $str = $1;
$trl = $2; $trl = $2;
} elsif ($operand =~ /^'(.+)'\s*$/) {
$str = $1;
$trl = '';
} elsif ($operand =~ /^'(.+)'\s*$/) {
$str = $1;
$trl = '';
} elsif ($operand =~ /^\"(.+)\",([0-9a-fA-F]*)$/) { } elsif ($operand =~ /^\"(.+)\",([0-9a-fA-F]*)$/) {
$str = $1; $str = $1;
$trl = $2; $trl = $2;