diff --git a/src/devices/cpu/h8/h83217.cpp b/src/devices/cpu/h8/h83217.cpp index 45d66228eec..82f960ecdaf 100644 --- a/src/devices/cpu/h8/h83217.cpp +++ b/src/devices/cpu/h8/h83217.cpp @@ -88,6 +88,9 @@ void h83217_device::map(address_map &map) map(0xffaa, 0xffab).rw(m_watchdog, FUNC(h8_watchdog_device::wd_r), FUNC(h8_watchdog_device::wd_w)); + map(0xffac, 0xffac).rw(m_port[0], FUNC(h8_port_device::pcr_r), FUNC(h8_port_device::pcr_w)); + map(0xffad, 0xffad).rw(m_port[1], FUNC(h8_port_device::pcr_r), FUNC(h8_port_device::pcr_w)); + map(0xffae, 0xffae).rw(m_port[2], FUNC(h8_port_device::pcr_r), FUNC(h8_port_device::pcr_w)); map(0xffb0, 0xffb0).w(m_port[0], FUNC(h8_port_device::ddr_w)); map(0xffb1, 0xffb1).w(m_port[1], FUNC(h8_port_device::ddr_w)); map(0xffb2, 0xffb2).rw(m_port[0], FUNC(h8_port_device::port_r), FUNC(h8_port_device::dr_w)); diff --git a/src/devices/cpu/h8/h83337.cpp b/src/devices/cpu/h8/h83337.cpp index 9ff1c5ce11d..aeca8aee4ee 100644 --- a/src/devices/cpu/h8/h83337.cpp +++ b/src/devices/cpu/h8/h83337.cpp @@ -8,7 +8,11 @@ TODO: - 16-bit timer module is different from how it's implemented in h8_timer16.cpp + - PWM timer module + - Host Interface module - finish WSCR emulation, CKDBL flag would need support in peripherals + - finish STCR emulation + - finish SYSCR emulation ***************************************************************************/ @@ -38,7 +42,6 @@ h83337_device::h83337_device(const machine_config &mconfig, device_type type, co m_timer16(*this, "timer16"), m_timer16_0(*this, "timer16:0"), m_watchdog(*this, "watchdog"), - m_syscr(0), m_ram_start(start) { } @@ -193,12 +196,22 @@ void h83337_device::internal_update(u64 current_time) void h83337_device::device_start() { h8_device::device_start(); + + m_wscr = 0; + m_stcr = 0; + m_syscr = 0; + + save_item(NAME(m_wscr)); + save_item(NAME(m_stcr)); save_item(NAME(m_syscr)); } void h83337_device::device_reset() { h8_device::device_reset(); + + m_wscr = 0x08; + m_stcr = 0x00; m_syscr = 0x09; } @@ -209,30 +222,35 @@ u8 h83337_device::syscr_r() void h83337_device::syscr_w(u8 data) { - m_syscr = data; logerror("syscr = %02x\n", data); + m_syscr = (m_syscr & 0x08) | (data & 0xf7); } u8 h83337_device::wscr_r() { - return 0x00; + return m_wscr; } void h83337_device::wscr_w(u8 data) { logerror("wscr = %02x\n", data); + m_wscr = data; } u8 h83337_device::stcr_r() { - return 0x00; + return m_stcr; } void h83337_device::stcr_w(u8 data) { logerror("stcr = %02x\n", data); + + // ICKS0/1 m_timer8_0->set_extra_clock_bit(BIT(data, 0)); m_timer8_1->set_extra_clock_bit(BIT(data, 1)); + + m_stcr = data; } u8 h83337_device::mdcr_r() diff --git a/src/devices/cpu/h8/h83337.h b/src/devices/cpu/h8/h83337.h index b3b17ab97b3..27fda6cfd0f 100644 --- a/src/devices/cpu/h8/h83337.h +++ b/src/devices/cpu/h8/h83337.h @@ -83,8 +83,10 @@ protected: required_device m_timer16_0; required_device m_watchdog; - u8 m_syscr; u32 m_ram_start; + u8 m_wscr; + u8 m_stcr; + u8 m_syscr; virtual void update_irq_filter() override; virtual void interrupt_taken() override;