diff options
Diffstat (limited to 'src/devices/video/315_5313.cpp')
| -rw-r--r-- | src/devices/video/315_5313.cpp | 46 |
1 files changed, 26 insertions, 20 deletions
diff --git a/src/devices/video/315_5313.cpp b/src/devices/video/315_5313.cpp index 86c3436de01..e42e322ec94 100644 --- a/src/devices/video/315_5313.cpp +++ b/src/devices/video/315_5313.cpp @@ -585,30 +585,37 @@ void sega315_5313_device::vdp_set_register(int regnum, u8 value) { //osd_printf_debug("setting reg 0, irq enable is now %d\n", MEGADRIVE_REG0_IRQ4_ENABLE); - // fatalrew and sesame are very fussy about pending interrupts. - // Former in particular will quickly enable both after the EA logo (cfr. killshow at PC=0x2267a), - // and irq 6 will jump to illegal addresses because the correlated routine isn't set in stack - // but delayed a bit. - // Note that irq 6 is masked for about 5 frames, leaving the assumption that it mustn't - // be left on during all this time. - if (m_irq4_pending) + // fatalrew/killshow and sesame are very fussy about pending interrupts. + // https://jsgroth.dev/blog/posts/emulator-bugs-fatal-rewind/ + // https://gendev.spritesmind.net/forum/viewtopic.php?t=2202 + // this gets 1 cycle delay on both HINT and VINT for gen_test_int_delay.bin + // TODO: first time around said test prints HINT=20, pressing start gives the correct value + if (m_irq4_pending && MEGADRIVE_REG0_IRQ4_ENABLE) { - if (MEGADRIVE_REG0_IRQ4_ENABLE) - m_lv4irqline_callback(true); - else - m_lv4irqline_callback(false); + m_irq4_on_timer->adjust(attotime::from_ticks(16, clock() / 4)); +// if (MEGADRIVE_REG0_IRQ4_ENABLE) +// m_lv4irqline_callback(true); +// else +// m_lv4irqline_callback(false); } + else + m_lv4irqline_callback(false); + } if (regnum == 0x01) { - if (m_irq6_pending) + if (m_irq6_pending && MEGADRIVE_REG01_IRQ6_ENABLE) { - if (MEGADRIVE_REG01_IRQ6_ENABLE) - m_lv6irqline_callback(true); - else - m_lv6irqline_callback(false); + m_irq6_on_timer->adjust(attotime::from_ticks(16, clock() / 4)); + +// if (MEGADRIVE_REG01_IRQ6_ENABLE) +// m_lv6irqline_callback(true); +// else +// m_lv6irqline_callback(false); } + else + m_lv6irqline_callback(false); } // if (regnum == 0x0a) @@ -2254,7 +2261,7 @@ void sega315_5313_device::vdp_handle_scanline_callback(int scanline) if (get_scanline_counter() == m_irq6_scanline) { // osd_printf_debug("x %d", get_scanline_counter()); - m_irq6_on_timer->adjust(attotime::from_usec(6)); + m_irq6_on_timer->adjust(attotime::from_ticks(16, clock() / 4)); m_irq6_pending = 1; m_vblank_flag = 1; @@ -2276,8 +2283,7 @@ void sega315_5313_device::vdp_handle_scanline_callback(int scanline) if (MEGADRIVE_REG0_IRQ4_ENABLE) { - // TODO: arbitrary timing - m_irq4_on_timer->adjust(attotime::from_usec(1)); + m_irq4_on_timer->adjust(attotime::from_ticks(16, clock() / 4)); //osd_printf_debug("irq4 on scanline %d reload %d\n", get_scanline_counter(), MEGADRIVE_REG0A_HINT_VALUE); } else @@ -2320,7 +2326,7 @@ void sega315_5313_device::vdp_handle_eof() m_vblank_flag = 0; // Not here, breaks warlock - //m_irq6_pending = 0; +// m_irq6_pending = 0; /* Set it to -1 here, so it becomes 0 when the first timer kicks in */ if (!m_use_alt_timing) m_scanline_counter = -1; |
