mirror of
https://github.com/david-schmidt/gsport.git
synced 2025-02-15 17:30:52 +00:00
Fix from Kent Dickey on the WAI instruction
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; } ``` Kent
This commit is contained in:
parent
3e26fb1ecd
commit
d1b556c5c5
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
GSport - an Apple //gs Emulator
|
GSport - an Apple //gs Emulator
|
||||||
Copyright (C) 2010 by GSport contributors
|
Copyright (C) 2010 - 2020 by GSport contributors
|
||||||
|
|
||||||
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
|
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
|
||||||
|
|
||||||
@ -2231,8 +2231,12 @@ instcb_SYM /* WAI */
|
|||||||
b dispatch
|
b dispatch
|
||||||
stw scratch2,r%g_wait_pending(scratch1)
|
stw scratch2,r%g_wait_pending(scratch1)
|
||||||
#else
|
#else
|
||||||
|
if(g_irq_pending) {
|
||||||
|
g_wait_pending = 0;
|
||||||
|
INC_KPC_1;
|
||||||
|
} else {
|
||||||
g_wait_pending = 1;
|
g_wait_pending = 1;
|
||||||
CYCLES_FINISH
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
instcc_SYM /* CPY abs */
|
instcc_SYM /* CPY abs */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user