Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indirect indexed addressing error #24

Closed
mjwurtz opened this issue Mar 22, 2023 · 3 comments
Closed

Indirect indexed addressing error #24

mjwurtz opened this issue Mar 22, 2023 · 3 comments

Comments

@mjwurtz
Copy link

mjwurtz commented Mar 22, 2023

instruction LDA [-1,X] (hex code A698FF) is translated by LDA [$FF,X], which is interpreted (at least by a09) as a 16 bits positive number and produce A69900FF :

0003 A69900FF LDA [$FF,X] ;0003: A6 98 FF '...'

The correct translation should be either LDA [-1,X] either LDA [<$99,X]
This is the case for all instruction with this addressing mode (JMP [-1,Y], etc.)

@mjwurtz
Copy link
Author

mjwurtz commented Mar 23, 2023

I had a quick look at the code. Maybe this change is enough to correct the problem ?

diff --git a/f9dasm.c b/f9dasm.c
index 0700d60..a115be5 100644
--- a/f9dasm.c
+++ b/f9dasm.c
@@ -2155,7 +2155,7 @@ if (T & 0x80)
     case 0x18:
       T = ARGBYTE(PC);
       PC++;
-      sprintf(buf,"[%s,%c]",
+      sprintf(buf,"[<%s,%c]",
               number_string(T, 2, (word)(PC - 1)),
               R);
       break;

@Arakula
Copy link
Owner

Arakula commented Jul 4, 2023

I'll add the following change to the next version instead:

    case 0x18:
      {
      signed char c = (signed char)ARGBYTE(PC);
      PC++;
      sprintf(buf,"[%s,%c]",
              signed_string(c, 2, (word)(PC - 1)),
              R);
      }
      break;

That should do it nicely, as it's always a signed value.
The "signed char" might be an overspecification, but who knows what compiler options are used ...
Sorry that it took so long, I'm just too busy with other tasks at the moment.

Arakula added a commit that referenced this issue Jul 4, 2023
@Arakula
Copy link
Owner

Arakula commented Jul 4, 2023

OK, V1.83 is online now that should fix this.

@Arakula Arakula closed this as completed Jul 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants