mac128.cpp: Fix VIA-related regression by driving PB6 through timer callbacks (nw)

This commit is contained in:
AJR 2018-12-30 08:06:28 -05:00
parent 48a83d5c2f
commit c7a4099676

View File

@ -220,6 +220,7 @@ private:
int m_last_was_x;
int m_screen_buffer;
emu_timer *m_scan_timer;
emu_timer *m_hblank_timer;
// interrupts
int m_scc_interrupt, m_via_interrupt, m_scsi_interrupt, m_last_taken_interrupt;
@ -246,6 +247,7 @@ private:
DECLARE_WRITE_LINE_MEMBER(set_scc_interrupt);
TIMER_CALLBACK_MEMBER(mac_scanline);
TIMER_CALLBACK_MEMBER(mac_hblank);
DECLARE_VIDEO_START(mac);
uint32_t screen_update_mac(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
#ifndef MAC_USE_EMULATED_KBD
@ -291,8 +293,8 @@ void mac128_state::machine_start()
m_ram_mask = m_ram_size - 1;
m_rom_ptr = (u16*)memregion("bootrom")->base();
if (!m_scan_timer)
m_scan_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mac128_state::mac_scanline), this));
m_scan_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mac128_state::mac_scanline), this));
m_hblank_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mac128_state::mac_hblank), this));
}
void mac128_state::machine_reset()
@ -320,6 +322,8 @@ void mac128_state::machine_reset()
const int next_vpos = m_screen->vpos() + 1;
m_scan_timer->adjust(m_screen->time_until_pos(next_vpos), next_vpos);
if (m_screen->vblank())
m_via->write_pb6(0);
}
READ16_MEMBER(mac128_state::ram_r)
@ -451,6 +455,13 @@ TIMER_CALLBACK_MEMBER(mac128_state::mac_scanline)
vblank_irq();
}
/* video beam in display (! VBLANK && ! HBLANK basically) */
if (scanline < MAC_V_VIS)
{
m_via->write_pb6(1);
m_hblank_timer->adjust(m_screen->time_until_pos(scanline, MAC_H_VIS));
}
if (!(scanline % 10))
{
mouse_callback();
@ -469,6 +480,11 @@ TIMER_CALLBACK_MEMBER(mac128_state::mac_scanline)
m_scan_timer->adjust(m_screen->time_until_pos(scanline+1), (scanline+1) % m_screen->height());
}
TIMER_CALLBACK_MEMBER(mac128_state::mac_hblank)
{
m_via->write_pb6(0);
}
WRITE_LINE_MEMBER(mac128_state::mac_scsi_irq)
{
}
@ -734,10 +750,7 @@ READ8_MEMBER(mac128_state::mac_via_in_a)
READ8_MEMBER(mac128_state::mac_via_in_b)
{
int val = 0;
/* video beam in display (! VBLANK && ! HBLANK basically) */
if (m_screen->vpos() >= MAC_V_VIS)
val |= 0x40;
int val = 0x40;
if (m_mouse_bit_y) /* Mouse Y2 */
val |= 0x20;