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

Fix for WAI behavior (Fantavision) #103

Open
digarok opened this issue Jul 4, 2020 · 0 comments
Open

Fix for WAI behavior (Fantavision) #103

digarok opened this issue Jul 4, 2020 · 0 comments

Comments

@digarok
Copy link
Owner

digarok commented Jul 4, 2020

From https://groups.google.com/forum/#!topic/comp.sys.apple2/NWjJ1_ytewQ
(Thanks fatdog)

Kent Dickey writes:
Fantavision hangs when it starts on KEGS-based emulators (which includes
GSport and GSplus) due to a bug in the way KEGS handles the WAI instruction.
Fantavision masks interrupts with SEI, sets a SHR line interrupt, and then
does a WAI instruction. This hangs KEGS since it expects an actual interrupt
to end the WAI, but there won't be one since interrupts are masked. I never
realized this was a valid WAI use case.

The fix is easy. In instable.h, change:

instcb_SYM              /*  WAI */
        g_wait_pending = 1;
        CYCLES_FINISH

(There may be some stale #ifdef ASM code, just ignore that) to:

instcb_SYM              /*  WAI */
        if(g_irq_pending) {
                g_wait_pending = 0;
                INC_KPC_1;
        } else {
                g_wait_pending = 1;
        }
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

1 participant