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

Misemulation of RTI #10

Open
EtchedPixels opened this issue Mar 20, 2024 · 1 comment
Open

Misemulation of RTI #10

EtchedPixels opened this issue Mar 20, 2024 · 1 comment

Comments

@EtchedPixels
Copy link

The code as implemented looks at the current E flag in order to decide whether it is doing a fast or slow interrupt return. The processor pops cc then looks at E to decide what the rest of the frame is.

So it should be something like

        /* rti */
        case 0x3b:
                reg_cc = pull8(sp);
                cycles += 1;
                if (get_cc (FLAG_E)) {
                        inst_pul (0xfe, &reg_s, &reg_u, &cycles);
                } else {
                        inst_pul (0x80, &reg_s, &reg_u, &cycles);
                }
                cycles += 3;
                break;

Found because I've been using the e6809 code for another project and hit a case where it mattered.

@gtoal
Copy link

gtoal commented Mar 20, 2024

Appears to be correct according to https://www.maddes.net/m6809pm/appendix_a.htm#RTI - hard to believe that in all these years no-one has emulated any code that uses RTI, or at least hasn't noticed a problem with it, but that does appear to be the case. This is going to cause a lot of frantic editing as there are many emulators out there all based on the underlying code from vecx!

Thank you for finding this - well spotted!

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