Fix a bug for Accumulator mode identification.

This commit is contained in:
Leeland Heins 2019-02-20 15:57:19 -06:00 committed by GitHub
parent fbccd70b5b
commit d6c2f4d123
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

17
as65.pl
View File

@ -1176,6 +1176,10 @@ sub generate_Immediate {
# TSB Zpg 04 # TSB Zpg 04
sub is_Zero_Page { sub is_Zero_Page {
my ($operand, $lineno) = @_; my ($operand, $lineno) = @_;
# Don't mistake Accumulator mode for instructions like LSR.
return 0 if $operand =~ /^[Aa]$/;
# Parse hex # Parse hex
if ($operand =~ /^\$[0-9a-fA-F]{0,1}[0-9a-fA-F]$/) { if ($operand =~ /^\$[0-9a-fA-F]{0,1}[0-9a-fA-F]$/) {
return 2; return 2;
@ -1279,6 +1283,10 @@ sub generate_Zero_Page {
# STZ Zpg,X 74 # STZ Zpg,X 74
sub is_Zero_Page_X { sub is_Zero_Page_X {
my ($operand, $lineno) = @_; my ($operand, $lineno) = @_;
# Don't mistake Accumulator mode for instructions like LSR.
return 0 if $operand =~ /^[Aa]$/;
# Parse hex # Parse hex
if ($operand =~ /^\$[0-9a-fA-F]{0,1}[0-9a-fA-F],[Xx]$/) { if ($operand =~ /^\$[0-9a-fA-F]{0,1}[0-9a-fA-F],[Xx]$/) {
return 2; return 2;
@ -1477,6 +1485,10 @@ sub generate_Zero_Page_Y {
# TSB Abs 0C # TSB Abs 0C
sub is_Absolute { sub is_Absolute {
my ($operand, $lineno) = @_; my ($operand, $lineno) = @_;
# Don't mistake Accumulator mode for instructions like LSR.
return 0 if $operand =~ /^[Aa]$/;
# Parse hex # Parse hex
if ($operand =~ /^\$[0-9a-fA-F]{0,1}[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]$/) { if ($operand =~ /^\$[0-9a-fA-F]{0,1}[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]$/) {
return 2; return 2;
@ -1688,6 +1700,10 @@ sub generate_Indirect_Absolute_X {
# STZ Abs,X 9E # STZ Abs,X 9E
sub is_Absolute_X { sub is_Absolute_X {
my ($operand, $lineno) = @_; my ($operand, $lineno) = @_;
# Don't mistake Accumulator mode for instructions like LSR.
return 0 if $operand =~ /^[Aa]$/;
# Parse hex # Parse hex
if ($operand =~ /^\$[0-9a-fA-F]{0,1}[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F],[Xx]$/) { if ($operand =~ /^\$[0-9a-fA-F]{0,1}[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F],[Xx]$/) {
return 2; return 2;
@ -2292,6 +2308,7 @@ sub generate_Implied {
# ROR A 6A # ROR A 6A
sub is_Accumulator { sub is_Accumulator {
my ($operand, $lineno) = @_; my ($operand, $lineno) = @_;
if ($operand =~ /^[Aa]$/ || $operand eq '') { if ($operand =~ /^[Aa]$/ || $operand eq '') {
return 1; return 1;
} }