Skip to content

Commit a23fbab

Browse files
authored
apple2gs: Improve IRQ emulation (#14277)
* g65816: fix IRQ to be level triggered Followup b3f2535: stop clearing LINE_IRQ when jumping to the IRQ vector. Properly written IRQ handlers won't notice any difference, but this fixes the behavior for software which (possibly intentionally) fails to clear an IRQ source; in that case the IRQ should continue to trigger (probably leading to a system hang.) LINE_SO is generally not hooked up, but if it is, it doesn't raise IRQ. Also delete unused G65816_INT_* macros. * apple2gs: improve VGC/MegaII IRQ emulation All of the VGC and MegaII IRQ sources set their status bits even when the corresponding IRQ is not enabled (this was only implemented for SCB). Clearing enable bits works differently between VGC and MegaII: the MegaII can lower the IRQ line (when all sources are clear), the VGC does not. Neither clears their corresponding status bits. VGCINTCLEAR reads the floating bus. Status bits (and IRQs) are only cleared when writing a zero. ADB reset needs to clear (at least) m_irqmask. Also cleanup CLRVBLINT into do_io(). * apple2gs: implement undocumented MegaII interaction Reading the C02E/C02F counters resets the SCB status bit in C023 (the same as writing to C032). This behavior is not documented by Apple, but was verified on hardware. Move the relevant logic into a helper, to avoid code duplication. * apple2gs: improve C019 VBL behavior Ensure that VBL is cleared on scanline 0 and set on scanline 192, even in SHR. * apple2gs: remove IOUDIS, fix AN3 and paddle Followup 6a4854b: IOUDIS only exists on the IIc and IIc+. AN2/3 are set by ROM during boot, and AN3 is readable via C046. Also followup 23904ff: paddle only triggers on r/w of C070, and it reads the floating bus. * apple2gs: reduce do_io() log spam 16-bit writes in demos were tripping "unknown switch". No functional change. * apple2gs: update stale link
1 parent 1233769 commit a23fbab

File tree

4 files changed

+75
-156
lines changed

4 files changed

+75
-156
lines changed

src/devices/cpu/g65816/g65816.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,6 @@ void g65816_device::g65816i_check_maskable_interrupt()
725725
{
726726
g65816i_interrupt_hardware((FLAG_E) ? VECTOR_IRQ_E : VECTOR_IRQ_N);
727727
CPU_STOPPED &= ~STOP_LEVEL_WAI;
728-
LINE_IRQ=0; // FIXME: IRQ is level triggered, this makes it act as a HOLD_LINE
729728
}
730729
}
731730

src/devices/cpu/g65816/g65816.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,9 @@ Copyright Karl Stenerud
2727
/* =============================== DEFINES ================================ */
2828
/* ======================================================================== */
2929

30-
/* Interrupt lines - used with g65816_set_irq_line() */
30+
/* Interrupt lines - used with g65816_set_line() */
3131
enum
3232
{
33-
G65816_LINE_NONE, // FIXME: there is no such pin
3433
G65816_LINE_IRQ,
3534
G65816_LINE_NMI,
3635
G65816_LINE_ABORT,
@@ -39,10 +38,6 @@ enum
3938
G65816_LINE_RESET
4039
};
4140

42-
#define G65816_INT_NONE G65816_LINE_NONE
43-
#define G65816_INT_IRQ G65816_LINE_IRQ
44-
#define G65816_INT_NMI G65816_LINE_NMI
45-
4641

4742
class g65816_device : public cpu_device, public g65816_disassembler::config
4843
{

src/devices/cpu/g65816/g65816op.ipp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1830,7 +1830,6 @@ TABLE_FUNCTION(void, set_line, (int line, int state))
18301830
{
18311831
CPU_STOPPED &= ~STOP_LEVEL_WAI;
18321832
}
1833-
return;
18341833
}
18351834
return;
18361835
case G65816_LINE_NMI:
@@ -1855,8 +1854,6 @@ TABLE_FUNCTION(void, set_line, (int line, int state))
18551854
case G65816_LINE_RDY:
18561855
return;
18571856
}
1858-
1859-
LINE_IRQ=1; // FIXME: this can't be right!
18601857
}
18611858

18621859

0 commit comments

Comments
 (0)