h83337: add readback of wscr and stcr

This commit is contained in:
hap 2024-02-25 22:07:36 +01:00
parent 8528c4c14b
commit 8d8da3e93a
3 changed files with 28 additions and 5 deletions

View File

@ -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));

View File

@ -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()

View File

@ -83,8 +83,10 @@ protected:
required_device<h8_timer16_channel_device> m_timer16_0;
required_device<h8_watchdog_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;