diff --git a/scripts/src/cpu.lua b/scripts/src/cpu.lua index 8fee43f4ab1..c6215752954 100644 --- a/scripts/src/cpu.lua +++ b/scripts/src/cpu.lua @@ -721,8 +721,10 @@ if CPUS["H8"] then MAME_DIR .. "src/devices/cpu/h8/h83337.h", MAME_DIR .. "src/devices/cpu/h8/h8s2245.cpp", MAME_DIR .. "src/devices/cpu/h8/h8s2245.h", - MAME_DIR .. "src/devices/cpu/h8/h8s2320.cpp", - MAME_DIR .. "src/devices/cpu/h8/h8s2320.h", + MAME_DIR .. "src/devices/cpu/h8/h8s2319.cpp", + MAME_DIR .. "src/devices/cpu/h8/h8s2319.h", + MAME_DIR .. "src/devices/cpu/h8/h8s2329.cpp", + MAME_DIR .. "src/devices/cpu/h8/h8s2329.h", MAME_DIR .. "src/devices/cpu/h8/h8s2357.cpp", MAME_DIR .. "src/devices/cpu/h8/h8s2357.h", MAME_DIR .. "src/devices/cpu/h8/h8s2655.cpp", diff --git a/src/devices/cpu/h8/h8.cpp b/src/devices/cpu/h8/h8.cpp index fa6985f1e98..4e9b43d3bb5 100644 --- a/src/devices/cpu/h8/h8.cpp +++ b/src/devices/cpu/h8/h8.cpp @@ -13,6 +13,10 @@ mode) and the power button triggers an IRQ to wake up instead of RES. Obviously, MAME always starts at reset-phase at power-on, so it's more like a 'known issue' instead of a TODO since it can't really be fixed. + - SSBY is supposed to halt the clock. But in MAME, peripherals remember + the last update time and will try to catch up (a lot) after the CPU + wakes up. For example, if h8_watchdog was enabled, it will immediately + trigger a reset after wake up. - add STBY pin (hardware standby mode, can only wake up with reset) ***************************************************************************/ diff --git a/src/devices/cpu/h8/h8_adc.cpp b/src/devices/cpu/h8/h8_adc.cpp index e88a0f015d2..116f20f5b83 100644 --- a/src/devices/cpu/h8/h8_adc.cpp +++ b/src/devices/cpu/h8/h8_adc.cpp @@ -11,7 +11,7 @@ static constexpr int V = 0; DEFINE_DEVICE_TYPE(H8_ADC_3337, h8_adc_3337_device, "h8_adc_3337", "H8/3337 ADC") DEFINE_DEVICE_TYPE(H8_ADC_3006, h8_adc_3006_device, "h8_adc_3006", "H8/3006 ADC") DEFINE_DEVICE_TYPE(H8_ADC_2245, h8_adc_2245_device, "h8_adc_2245", "H8/2245 ADC") -DEFINE_DEVICE_TYPE(H8_ADC_2320, h8_adc_2320_device, "h8_adc_2320", "H8/2320 ADC") +DEFINE_DEVICE_TYPE(H8_ADC_2319, h8_adc_2319_device, "h8_adc_2319", "H8/2319 ADC") DEFINE_DEVICE_TYPE(H8_ADC_2357, h8_adc_2357_device, "h8_adc_2357", "H8/2357 ADC") DEFINE_DEVICE_TYPE(H8_ADC_2655, h8_adc_2655_device, "h8_adc_2655", "H8/2655 ADC") @@ -358,13 +358,13 @@ void h8_adc_2245_device::mode_update() } -h8_adc_2320_device::h8_adc_2320_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : - h8_adc_device(mconfig, H8_ADC_2320, tag, owner, clock) +h8_adc_2319_device::h8_adc_2319_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + h8_adc_device(mconfig, H8_ADC_2319, tag, owner, clock) { m_register_mask = 3; } -int h8_adc_2320_device::conversion_time(bool first, bool poweron) +int h8_adc_2319_device::conversion_time(bool first, bool poweron) { int tm; if(first) @@ -380,7 +380,7 @@ int h8_adc_2320_device::conversion_time(bool first, bool poweron) return tm; } -void h8_adc_2320_device::mode_update() +void h8_adc_2319_device::mode_update() { m_trigger = 1 << ((m_adcr >> 6) & 3); diff --git a/src/devices/cpu/h8/h8_adc.h b/src/devices/cpu/h8/h8_adc.h index 8155f5bcd1d..0cc37a34e3b 100644 --- a/src/devices/cpu/h8/h8_adc.h +++ b/src/devices/cpu/h8/h8_adc.h @@ -135,11 +135,11 @@ protected: virtual void mode_update() override; }; -class h8_adc_2320_device : public h8_adc_device { +class h8_adc_2319_device : public h8_adc_device { public: - h8_adc_2320_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); - template h8_adc_2320_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&cpu, U &&intc, int vect) - : h8_adc_2320_device(mconfig, tag, owner, 0) + h8_adc_2319_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + template h8_adc_2319_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&cpu, U &&intc, int vect) + : h8_adc_2319_device(mconfig, tag, owner, 0) { set_info(cpu, intc, vect); } @@ -182,7 +182,7 @@ protected: DECLARE_DEVICE_TYPE(H8_ADC_3337, h8_adc_3337_device) DECLARE_DEVICE_TYPE(H8_ADC_3006, h8_adc_3006_device) DECLARE_DEVICE_TYPE(H8_ADC_2245, h8_adc_2245_device) -DECLARE_DEVICE_TYPE(H8_ADC_2320, h8_adc_2320_device) +DECLARE_DEVICE_TYPE(H8_ADC_2319, h8_adc_2319_device) DECLARE_DEVICE_TYPE(H8_ADC_2357, h8_adc_2357_device) DECLARE_DEVICE_TYPE(H8_ADC_2655, h8_adc_2655_device) diff --git a/src/devices/cpu/h8/h8_watchdog.cpp b/src/devices/cpu/h8/h8_watchdog.cpp index 76abcc68369..0569b1bf7ee 100644 --- a/src/devices/cpu/h8/h8_watchdog.cpp +++ b/src/devices/cpu/h8/h8_watchdog.cpp @@ -37,7 +37,7 @@ void h8_watchdog_device::tcnt_update(u64 cur_time) u64 spos = m_tcnt_cycle_base >> shift; u64 epos = cur_time >> shift; - int next_tcnt = m_tcnt + int(epos - spos); + u64 next_tcnt = m_tcnt + (epos - spos); m_tcnt = next_tcnt; m_tcnt_cycle_base = cur_time; //logerror("%10lld tcnt %02x -> %03x shift=%d\n", cur_time, m_tcnt, next_tcnt, shift); diff --git a/src/devices/cpu/h8/h8s2245.cpp b/src/devices/cpu/h8/h8s2245.cpp index f03e2d77a92..3d6e63b7483 100644 --- a/src/devices/cpu/h8/h8s2245.cpp +++ b/src/devices/cpu/h8/h8s2245.cpp @@ -189,36 +189,36 @@ void h8s2245_device::device_add_mconfig(machine_config &config) H8_PORT(config, m_porte, *this, h8_device::PORT_E, 0x00, 0x00); H8_PORT(config, m_portf, *this, h8_device::PORT_F, 0x00, 0x00); H8_PORT(config, m_portg, *this, h8_device::PORT_G, 0xe0, 0x00); - H8H_TIMER8_CHANNEL(config, m_timer8_0, *this, m_intc, 64, 65, 66, m_timer8_1, h8_timer8_channel_device::CHAIN_OVERFLOW, true, false); - H8H_TIMER8_CHANNEL(config, m_timer8_1, *this, m_intc, 68, 69, 70, m_timer8_0, h8_timer8_channel_device::CHAIN_A, false, false); + H8H_TIMER8_CHANNEL(config, m_timer8_0, *this, m_intc, 64, 65, 66, m_timer8_1, h8_timer8_channel_device::CHAIN_OVERFLOW, true, false); + H8H_TIMER8_CHANNEL(config, m_timer8_1, *this, m_intc, 68, 69, 70, m_timer8_0, h8_timer8_channel_device::CHAIN_A, false, false); H8_TIMER16(config, m_timer16, *this, 3, 0x00); H8S_TIMER16_CHANNEL(config, m_timer16_0, *this, 4, 0x60, m_intc, 32, - h8_timer16_channel_device::DIV_1, - h8_timer16_channel_device::DIV_4, - h8_timer16_channel_device::DIV_16, - h8_timer16_channel_device::DIV_64, - h8_timer16_channel_device::INPUT_A, - h8_timer16_channel_device::INPUT_B, - h8_timer16_channel_device::INPUT_C, - h8_timer16_channel_device::INPUT_D); + h8_timer16_channel_device::DIV_1, + h8_timer16_channel_device::DIV_4, + h8_timer16_channel_device::DIV_16, + h8_timer16_channel_device::DIV_64, + h8_timer16_channel_device::INPUT_A, + h8_timer16_channel_device::INPUT_B, + h8_timer16_channel_device::INPUT_C, + h8_timer16_channel_device::INPUT_D); H8S_TIMER16_CHANNEL(config, m_timer16_1, *this, 2, 0x4c, m_intc, 40, - h8_timer16_channel_device::DIV_1, - h8_timer16_channel_device::DIV_4, - h8_timer16_channel_device::DIV_16, - h8_timer16_channel_device::DIV_64, - h8_timer16_channel_device::INPUT_A, - h8_timer16_channel_device::INPUT_B, - h8_timer16_channel_device::DIV_256, - h8_timer16_channel_device::CHAIN).set_chain(m_timer16_2); + h8_timer16_channel_device::DIV_1, + h8_timer16_channel_device::DIV_4, + h8_timer16_channel_device::DIV_16, + h8_timer16_channel_device::DIV_64, + h8_timer16_channel_device::INPUT_A, + h8_timer16_channel_device::INPUT_B, + h8_timer16_channel_device::DIV_256, + h8_timer16_channel_device::CHAIN).set_chain(m_timer16_2); H8S_TIMER16_CHANNEL(config, m_timer16_2, *this, 2, 0x4c, m_intc, 44, - h8_timer16_channel_device::DIV_1, - h8_timer16_channel_device::DIV_4, - h8_timer16_channel_device::DIV_16, - h8_timer16_channel_device::DIV_64, - h8_timer16_channel_device::INPUT_A, - h8_timer16_channel_device::INPUT_B, - h8_timer16_channel_device::INPUT_C, - h8_timer16_channel_device::DIV_1024); + h8_timer16_channel_device::DIV_1, + h8_timer16_channel_device::DIV_4, + h8_timer16_channel_device::DIV_16, + h8_timer16_channel_device::DIV_64, + h8_timer16_channel_device::INPUT_A, + h8_timer16_channel_device::INPUT_B, + h8_timer16_channel_device::INPUT_C, + h8_timer16_channel_device::DIV_1024); H8_SCI(config, m_sci[0], 0, *this, m_intc, 80, 81, 82, 83); H8_SCI(config, m_sci[1], 1, *this, m_intc, 84, 85, 86, 87); H8_SCI(config, m_sci[2], 2, *this, m_intc, 88, 89, 90, 91); diff --git a/src/devices/cpu/h8/h8s2319.cpp b/src/devices/cpu/h8/h8s2319.cpp new file mode 100644 index 00000000000..a0ec66e212e --- /dev/null +++ b/src/devices/cpu/h8/h8s2319.cpp @@ -0,0 +1,444 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert, hap +/*************************************************************************** + + h8s2319.cpp + + H8S-2319 family emulation + +***************************************************************************/ + +#include "emu.h" +#include "h8s2319.h" + +DEFINE_DEVICE_TYPE(H8S2310, h8s2310_device, "h8s2310", "Hitachi H8S/2310") +DEFINE_DEVICE_TYPE(H8S2311, h8s2311_device, "h8s2311", "Hitachi H8S/2311") +DEFINE_DEVICE_TYPE(H8S2312, h8s2312_device, "h8s2312", "Hitachi H8S/2312") +DEFINE_DEVICE_TYPE(H8S2313, h8s2313_device, "h8s2313", "Hitachi H8S/2313") +DEFINE_DEVICE_TYPE(H8S2315, h8s2315_device, "h8s2315", "Hitachi H8S/2315") +DEFINE_DEVICE_TYPE(H8S2316, h8s2316_device, "h8s2316", "Hitachi H8S/2316") +DEFINE_DEVICE_TYPE(H8S2317, h8s2317_device, "h8s2317", "Hitachi H8S/2317") +DEFINE_DEVICE_TYPE(H8S2318, h8s2318_device, "h8s2318", "Hitachi H8S/2318") +DEFINE_DEVICE_TYPE(H8S2319, h8s2319_device, "h8s2319", "Hitachi H8S/2319") + + +h8s2319_device::h8s2319_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, address_map_constructor map_delegate, u32 start) : + h8s2000_device(mconfig, type, tag, owner, clock, map_delegate), + m_intc(*this, "intc"), + m_adc(*this, "adc"), + m_dtc(*this, "dtc"), + m_portn(*this, "port%u", 1), + m_porta(*this, "port%c", 'a'), + m_timer8(*this, "timer8_%u", 0), + m_timer16(*this, "timer16"), + m_timer16c(*this, "timer16:%u", 0), + m_watchdog(*this, "watchdog"), + m_ram_view(*this, "ram_view"), + m_ram_start(start) +{ +} + +h8s2319_device::h8s2319_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u32 start) : + h8s2319_device(mconfig, type, tag, owner, clock, address_map_constructor(FUNC(h8s2319_device::map), this), start) +{ +} + +h8s2319_device::h8s2319_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + h8s2319_device(mconfig, H8S2319, tag, owner, clock, 0xffdc00) +{ +} + +h8s2310_device::h8s2310_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + h8s2319_device(mconfig, H8S2310, tag, owner, clock, 0xfff400) +{ +} + +h8s2311_device::h8s2311_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + h8s2319_device(mconfig, H8S2311, tag, owner, clock, 0xfff400) +{ +} + +h8s2312_device::h8s2312_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + h8s2319_device(mconfig, H8S2312, tag, owner, clock, 0xffdc00) +{ +} + +h8s2313_device::h8s2313_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + h8s2319_device(mconfig, H8S2313, tag, owner, clock, 0xfff400) +{ +} + +h8s2315_device::h8s2315_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + h8s2319_device(mconfig, H8S2315, tag, owner, clock, 0xffdc00) +{ +} + +h8s2316_device::h8s2316_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + h8s2319_device(mconfig, H8S2316, tag, owner, clock, 0xffdc00) +{ +} + +h8s2317_device::h8s2317_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + h8s2319_device(mconfig, H8S2317, tag, owner, clock, 0xffdc00) +{ +} + +h8s2318_device::h8s2318_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + h8s2319_device(mconfig, H8S2318, tag, owner, clock, 0xffdc00) +{ +} + +void h8s2319_device::map(address_map &map) +{ + map(m_ram_start, 0xfffbff).view(m_ram_view); + m_ram_view[0](m_ram_start, 0xfffbff).ram().share(m_internal_ram); + + map(0xfffe80, 0xfffe80).rw(m_timer16c[3], FUNC(h8_timer16_channel_device::tcr_r), FUNC(h8_timer16_channel_device::tcr_w)); + map(0xfffe81, 0xfffe81).rw(m_timer16c[3], FUNC(h8_timer16_channel_device::tmdr_r), FUNC(h8_timer16_channel_device::tmdr_w)); + map(0xfffe82, 0xfffe83).rw(m_timer16c[3], FUNC(h8_timer16_channel_device::tior_r), FUNC(h8_timer16_channel_device::tior_w)); + map(0xfffe84, 0xfffe84).rw(m_timer16c[3], FUNC(h8_timer16_channel_device::tier_r), FUNC(h8_timer16_channel_device::tier_w)); + map(0xfffe85, 0xfffe85).rw(m_timer16c[3], FUNC(h8_timer16_channel_device::tsr_r), FUNC(h8_timer16_channel_device::tsr_w)); + map(0xfffe86, 0xfffe87).rw(m_timer16c[3], FUNC(h8_timer16_channel_device::tcnt_r), FUNC(h8_timer16_channel_device::tcnt_w)); + map(0xfffe88, 0xfffe8f).rw(m_timer16c[3], FUNC(h8_timer16_channel_device::tgr_r), FUNC(h8_timer16_channel_device::tgr_w)); + map(0xfffe90, 0xfffe90).rw(m_timer16c[4], FUNC(h8_timer16_channel_device::tcr_r), FUNC(h8_timer16_channel_device::tcr_w)); + map(0xfffe91, 0xfffe91).rw(m_timer16c[4], FUNC(h8_timer16_channel_device::tmdr_r), FUNC(h8_timer16_channel_device::tmdr_w)); + map(0xfffe92, 0xfffe92).rw(m_timer16c[4], FUNC(h8_timer16_channel_device::tior_r), FUNC(h8_timer16_channel_device::tior_w)); + map(0xfffe94, 0xfffe94).rw(m_timer16c[4], FUNC(h8_timer16_channel_device::tier_r), FUNC(h8_timer16_channel_device::tier_w)); + map(0xfffe95, 0xfffe95).rw(m_timer16c[4], FUNC(h8_timer16_channel_device::tsr_r), FUNC(h8_timer16_channel_device::tsr_w)); + map(0xfffe96, 0xfffe97).rw(m_timer16c[4], FUNC(h8_timer16_channel_device::tcnt_r), FUNC(h8_timer16_channel_device::tcnt_w)); + map(0xfffe98, 0xfffe9b).rw(m_timer16c[4], FUNC(h8_timer16_channel_device::tgr_r), FUNC(h8_timer16_channel_device::tgr_w)); + map(0xfffea0, 0xfffea0).rw(m_timer16c[5], FUNC(h8_timer16_channel_device::tcr_r), FUNC(h8_timer16_channel_device::tcr_w)); + map(0xfffea1, 0xfffea1).rw(m_timer16c[5], FUNC(h8_timer16_channel_device::tmdr_r), FUNC(h8_timer16_channel_device::tmdr_w)); + map(0xfffea2, 0xfffea2).rw(m_timer16c[5], FUNC(h8_timer16_channel_device::tior_r), FUNC(h8_timer16_channel_device::tior_w)); + map(0xfffea4, 0xfffea4).rw(m_timer16c[5], FUNC(h8_timer16_channel_device::tier_r), FUNC(h8_timer16_channel_device::tier_w)); + map(0xfffea5, 0xfffea5).rw(m_timer16c[5], FUNC(h8_timer16_channel_device::tsr_r), FUNC(h8_timer16_channel_device::tsr_w)); + map(0xfffea6, 0xfffea7).rw(m_timer16c[5], FUNC(h8_timer16_channel_device::tcnt_r), FUNC(h8_timer16_channel_device::tcnt_w)); + map(0xfffea8, 0xfffeab).rw(m_timer16c[5], FUNC(h8_timer16_channel_device::tgr_r), FUNC(h8_timer16_channel_device::tgr_w)); + + map(0xfffeb0, 0xfffeb0).w(m_portn[0], FUNC(h8_port_device::ddr_w)); + map(0xfffeb1, 0xfffeb1).w(m_portn[1], FUNC(h8_port_device::ddr_w)); + map(0xfffeb2, 0xfffeb2).w(m_portn[2], FUNC(h8_port_device::ddr_w)); + map(0xfffeb9, 0xfffeb9).w(m_porta[0], FUNC(h8_port_device::ddr_w)); + map(0xfffeba, 0xfffeba).w(m_porta[1], FUNC(h8_port_device::ddr_w)); + map(0xfffebb, 0xfffebb).w(m_porta[2], FUNC(h8_port_device::ddr_w)); + map(0xfffebc, 0xfffebc).w(m_porta[3], FUNC(h8_port_device::ddr_w)); + map(0xfffebd, 0xfffebd).w(m_porta[4], FUNC(h8_port_device::ddr_w)); + map(0xfffebe, 0xfffebe).w(m_porta[5], FUNC(h8_port_device::ddr_w)); + map(0xfffebf, 0xfffebf).w(m_porta[6], FUNC(h8_port_device::ddr_w)); + + map(0xfffec4, 0xfffece).rw(m_intc, FUNC(h8s_intc_device::ipr_r), FUNC(h8s_intc_device::ipr_w)); + map(0xffff2c, 0xffff2c).rw(m_intc, FUNC(h8s_intc_device::iscrh_r), FUNC(h8s_intc_device::iscrh_w)); + map(0xffff2d, 0xffff2d).rw(m_intc, FUNC(h8s_intc_device::iscrl_r), FUNC(h8s_intc_device::iscrl_w)); + map(0xffff2e, 0xffff2e).rw(m_intc, FUNC(h8s_intc_device::ier_r), FUNC(h8s_intc_device::ier_w)); + map(0xffff2f, 0xffff2f).rw(m_intc, FUNC(h8s_intc_device::isr_r), FUNC(h8s_intc_device::isr_w)); + map(0xffff30, 0xffff34).rw(m_dtc, FUNC(h8_dtc_device::dtcer_r), FUNC(h8_dtc_device::dtcer_w)); + map(0xffff37, 0xffff37).rw(m_dtc, FUNC(h8_dtc_device::dtvecr_r), FUNC(h8_dtc_device::dtvecr_w)); + map(0xffff38, 0xffff38).rw(FUNC(h8s2319_device::sbycr_r), FUNC(h8s2319_device::sbycr_w)); + map(0xffff39, 0xffff39).rw(FUNC(h8s2319_device::syscr_r), FUNC(h8s2319_device::syscr_w)); + + map(0xffff50, 0xffff50).r(m_portn[0], FUNC(h8_port_device::port_r)); + map(0xffff51, 0xffff51).r(m_portn[1], FUNC(h8_port_device::port_r)); + map(0xffff52, 0xffff52).r(m_portn[2], FUNC(h8_port_device::port_r)); + map(0xffff53, 0xffff53).r(m_portn[3], FUNC(h8_port_device::port_r)); + map(0xffff59, 0xffff59).r(m_porta[0], FUNC(h8_port_device::port_r)); + map(0xffff5a, 0xffff5a).r(m_porta[1], FUNC(h8_port_device::port_r)); + map(0xffff5b, 0xffff5b).r(m_porta[2], FUNC(h8_port_device::port_r)); + map(0xffff5c, 0xffff5c).r(m_porta[3], FUNC(h8_port_device::port_r)); + map(0xffff5d, 0xffff5d).r(m_porta[4], FUNC(h8_port_device::port_r)); + map(0xffff5e, 0xffff5e).r(m_porta[5], FUNC(h8_port_device::port_r)); + map(0xffff5f, 0xffff5f).r(m_porta[6], FUNC(h8_port_device::port_r)); + map(0xffff60, 0xffff60).rw(m_portn[0], FUNC(h8_port_device::dr_r), FUNC(h8_port_device::dr_w)); + map(0xffff61, 0xffff61).rw(m_portn[1], FUNC(h8_port_device::dr_r), FUNC(h8_port_device::dr_w)); + map(0xffff62, 0xffff62).rw(m_portn[2], FUNC(h8_port_device::dr_r), FUNC(h8_port_device::dr_w)); + map(0xffff69, 0xffff69).rw(m_porta[0], FUNC(h8_port_device::dr_r), FUNC(h8_port_device::dr_w)); + map(0xffff6a, 0xffff6a).rw(m_porta[1], FUNC(h8_port_device::dr_r), FUNC(h8_port_device::dr_w)); + map(0xffff6b, 0xffff6b).rw(m_porta[2], FUNC(h8_port_device::dr_r), FUNC(h8_port_device::dr_w)); + map(0xffff6c, 0xffff6c).rw(m_porta[3], FUNC(h8_port_device::dr_r), FUNC(h8_port_device::dr_w)); + map(0xffff6d, 0xffff6d).rw(m_porta[4], FUNC(h8_port_device::dr_r), FUNC(h8_port_device::dr_w)); + map(0xffff6e, 0xffff6e).rw(m_porta[5], FUNC(h8_port_device::dr_r), FUNC(h8_port_device::dr_w)); + map(0xffff6f, 0xffff6f).rw(m_porta[6], FUNC(h8_port_device::dr_r), FUNC(h8_port_device::dr_w)); + map(0xffff70, 0xffff70).rw(m_porta[0], FUNC(h8_port_device::pcr_r), FUNC(h8_port_device::pcr_w)); + map(0xffff71, 0xffff71).rw(m_porta[1], FUNC(h8_port_device::pcr_r), FUNC(h8_port_device::pcr_w)); + map(0xffff72, 0xffff72).rw(m_porta[2], FUNC(h8_port_device::pcr_r), FUNC(h8_port_device::pcr_w)); + map(0xffff73, 0xffff73).rw(m_porta[3], FUNC(h8_port_device::pcr_r), FUNC(h8_port_device::pcr_w)); + map(0xffff74, 0xffff74).rw(m_porta[4], FUNC(h8_port_device::pcr_r), FUNC(h8_port_device::pcr_w)); + map(0xffff76, 0xffff76).rw(m_portn[2], FUNC(h8_port_device::odr_r), FUNC(h8_port_device::odr_w)); + map(0xffff77, 0xffff77).rw(m_porta[0], FUNC(h8_port_device::odr_r), FUNC(h8_port_device::odr_w)); + + map(0xffff78, 0xffff78).rw(m_sci[0], FUNC(h8_sci_device::smr_r), FUNC(h8_sci_device::smr_w)); + map(0xffff79, 0xffff79).rw(m_sci[0], FUNC(h8_sci_device::brr_r), FUNC(h8_sci_device::brr_w)); + map(0xffff7a, 0xffff7a).rw(m_sci[0], FUNC(h8_sci_device::scr_r), FUNC(h8_sci_device::scr_w)); + map(0xffff7b, 0xffff7b).rw(m_sci[0], FUNC(h8_sci_device::tdr_r), FUNC(h8_sci_device::tdr_w)); + map(0xffff7c, 0xffff7c).rw(m_sci[0], FUNC(h8_sci_device::ssr_r), FUNC(h8_sci_device::ssr_w)); + map(0xffff7d, 0xffff7d).r(m_sci[0], FUNC(h8_sci_device::rdr_r)); + map(0xffff7e, 0xffff7e).rw(m_sci[0], FUNC(h8_sci_device::scmr_r), FUNC(h8_sci_device::scmr_w)); + map(0xffff80, 0xffff80).rw(m_sci[1], FUNC(h8_sci_device::smr_r), FUNC(h8_sci_device::smr_w)); + map(0xffff81, 0xffff81).rw(m_sci[1], FUNC(h8_sci_device::brr_r), FUNC(h8_sci_device::brr_w)); + map(0xffff82, 0xffff82).rw(m_sci[1], FUNC(h8_sci_device::scr_r), FUNC(h8_sci_device::scr_w)); + map(0xffff83, 0xffff83).rw(m_sci[1], FUNC(h8_sci_device::tdr_r), FUNC(h8_sci_device::tdr_w)); + map(0xffff84, 0xffff84).rw(m_sci[1], FUNC(h8_sci_device::ssr_r), FUNC(h8_sci_device::ssr_w)); + map(0xffff85, 0xffff85).r(m_sci[1], FUNC(h8_sci_device::rdr_r)); + map(0xffff86, 0xffff86).rw(m_sci[1], FUNC(h8_sci_device::scmr_r), FUNC(h8_sci_device::scmr_w)); + + map(0xffff90, 0xffff97).r(m_adc, FUNC(h8_adc_device::addr8_r)); + map(0xffff98, 0xffff98).rw(m_adc, FUNC(h8_adc_device::adcsr_r), FUNC(h8_adc_device::adcsr_w)); + map(0xffff99, 0xffff99).rw(m_adc, FUNC(h8_adc_device::adcr_r), FUNC(h8_adc_device::adcr_w)); + + map(0xffffb0, 0xffffb0).rw(m_timer8[0], FUNC(h8_timer8_channel_device::tcr_r), FUNC(h8_timer8_channel_device::tcr_w)); + map(0xffffb1, 0xffffb1).rw(m_timer8[1], FUNC(h8_timer8_channel_device::tcr_r), FUNC(h8_timer8_channel_device::tcr_w)); + map(0xffffb2, 0xffffb2).rw(m_timer8[0], FUNC(h8_timer8_channel_device::tcsr_r), FUNC(h8_timer8_channel_device::tcsr_w)); + map(0xffffb3, 0xffffb3).rw(m_timer8[1], FUNC(h8_timer8_channel_device::tcsr_r), FUNC(h8_timer8_channel_device::tcsr_w)); + map(0xffffb4, 0xffffb7).rw(m_timer8[0], FUNC(h8_timer8_channel_device::tcor_r), FUNC(h8_timer8_channel_device::tcor_w)).umask16(0xff00); + map(0xffffb4, 0xffffb7).rw(m_timer8[1], FUNC(h8_timer8_channel_device::tcor_r), FUNC(h8_timer8_channel_device::tcor_w)).umask16(0x00ff); + map(0xffffb8, 0xffffb8).rw(m_timer8[0], FUNC(h8_timer8_channel_device::tcnt_r), FUNC(h8_timer8_channel_device::tcnt_w)); + map(0xffffb9, 0xffffb9).rw(m_timer8[1], FUNC(h8_timer8_channel_device::tcnt_r), FUNC(h8_timer8_channel_device::tcnt_w)); + + map(0xffffbc, 0xffffbd).rw(m_watchdog, FUNC(h8_watchdog_device::wd_r), FUNC(h8_watchdog_device::wd_w)); + map(0xffffbe, 0xffffbf).rw(m_watchdog, FUNC(h8_watchdog_device::rst_r), FUNC(h8_watchdog_device::rst_w)); + map(0xffffc0, 0xffffc0).rw(m_timer16, FUNC(h8_timer16_device::tstr_r), FUNC(h8_timer16_device::tstr_w)); + map(0xffffc1, 0xffffc1).rw(m_timer16, FUNC(h8_timer16_device::tsyr_r), FUNC(h8_timer16_device::tsyr_w)); + + map(0xffffd0, 0xffffd0).rw(m_timer16c[0], FUNC(h8_timer16_channel_device::tcr_r), FUNC(h8_timer16_channel_device::tcr_w)); + map(0xffffd1, 0xffffd1).rw(m_timer16c[0], FUNC(h8_timer16_channel_device::tmdr_r), FUNC(h8_timer16_channel_device::tmdr_w)); + map(0xffffd2, 0xffffd3).rw(m_timer16c[0], FUNC(h8_timer16_channel_device::tior_r), FUNC(h8_timer16_channel_device::tior_w)); + map(0xffffd4, 0xffffd4).rw(m_timer16c[0], FUNC(h8_timer16_channel_device::tier_r), FUNC(h8_timer16_channel_device::tier_w)); + map(0xffffd5, 0xffffd5).rw(m_timer16c[0], FUNC(h8_timer16_channel_device::tsr_r), FUNC(h8_timer16_channel_device::tsr_w)); + map(0xffffd6, 0xffffd7).rw(m_timer16c[0], FUNC(h8_timer16_channel_device::tcnt_r), FUNC(h8_timer16_channel_device::tcnt_w)); + map(0xffffd8, 0xffffdf).rw(m_timer16c[0], FUNC(h8_timer16_channel_device::tgr_r), FUNC(h8_timer16_channel_device::tgr_w)); + map(0xffffe0, 0xffffe0).rw(m_timer16c[1], FUNC(h8_timer16_channel_device::tcr_r), FUNC(h8_timer16_channel_device::tcr_w)); + map(0xffffe1, 0xffffe1).rw(m_timer16c[1], FUNC(h8_timer16_channel_device::tmdr_r), FUNC(h8_timer16_channel_device::tmdr_w)); + map(0xffffe2, 0xffffe2).rw(m_timer16c[1], FUNC(h8_timer16_channel_device::tior_r), FUNC(h8_timer16_channel_device::tior_w)); + map(0xffffe4, 0xffffe4).rw(m_timer16c[1], FUNC(h8_timer16_channel_device::tier_r), FUNC(h8_timer16_channel_device::tier_w)); + map(0xffffe5, 0xffffe5).rw(m_timer16c[1], FUNC(h8_timer16_channel_device::tsr_r), FUNC(h8_timer16_channel_device::tsr_w)); + map(0xffffe6, 0xffffe7).rw(m_timer16c[1], FUNC(h8_timer16_channel_device::tcnt_r), FUNC(h8_timer16_channel_device::tcnt_w)); + map(0xffffe8, 0xffffeb).rw(m_timer16c[1], FUNC(h8_timer16_channel_device::tgr_r), FUNC(h8_timer16_channel_device::tgr_w)); + map(0xfffff0, 0xfffff0).rw(m_timer16c[2], FUNC(h8_timer16_channel_device::tcr_r), FUNC(h8_timer16_channel_device::tcr_w)); + map(0xfffff1, 0xfffff1).rw(m_timer16c[2], FUNC(h8_timer16_channel_device::tmdr_r), FUNC(h8_timer16_channel_device::tmdr_w)); + map(0xfffff2, 0xfffff2).rw(m_timer16c[2], FUNC(h8_timer16_channel_device::tior_r), FUNC(h8_timer16_channel_device::tior_w)); + map(0xfffff4, 0xfffff4).rw(m_timer16c[2], FUNC(h8_timer16_channel_device::tier_r), FUNC(h8_timer16_channel_device::tier_w)); + map(0xfffff5, 0xfffff5).rw(m_timer16c[2], FUNC(h8_timer16_channel_device::tsr_r), FUNC(h8_timer16_channel_device::tsr_w)); + map(0xfffff6, 0xfffff7).rw(m_timer16c[2], FUNC(h8_timer16_channel_device::tcnt_r), FUNC(h8_timer16_channel_device::tcnt_w)); + map(0xfffff8, 0xfffffb).rw(m_timer16c[2], FUNC(h8_timer16_channel_device::tgr_r), FUNC(h8_timer16_channel_device::tgr_w)); +} + +void h8s2319_device::device_add_mconfig(machine_config &config) +{ + H8S_INTC(config, m_intc, *this); + H8_ADC_2319(config, m_adc, *this, m_intc, 28); + H8_DTC(config, m_dtc, *this, m_intc, 24); + H8_PORT(config, m_portn[0], *this, h8_device::PORT_1, 0x00, 0x00); + H8_PORT(config, m_portn[1], *this, h8_device::PORT_2, 0x00, 0x00); + H8_PORT(config, m_portn[2], *this, h8_device::PORT_3, 0x00, 0xc0); + H8_PORT(config, m_portn[3], *this, h8_device::PORT_4, 0x00, 0x00); + H8_PORT(config, m_porta[0], *this, h8_device::PORT_A, 0x00, 0xf0); + H8_PORT(config, m_porta[1], *this, h8_device::PORT_B, 0x00, 0x00); + H8_PORT(config, m_porta[2], *this, h8_device::PORT_C, 0x00, 0x00); + H8_PORT(config, m_porta[3], *this, h8_device::PORT_D, 0x00, 0x00); + H8_PORT(config, m_porta[4], *this, h8_device::PORT_E, 0x00, 0x00); + H8_PORT(config, m_porta[5], *this, h8_device::PORT_F, 0x00, 0x00); + H8_PORT(config, m_porta[6], *this, h8_device::PORT_G, 0x00, 0xe0); + H8H_TIMER8_CHANNEL(config, m_timer8[0], *this, m_intc, 64, 65, 66, m_timer8[1], h8_timer8_channel_device::CHAIN_OVERFLOW, true, false); + H8H_TIMER8_CHANNEL(config, m_timer8[1], *this, m_intc, 68, 69, 70, m_timer8[0], h8_timer8_channel_device::CHAIN_A, false, false); + H8_TIMER16(config, m_timer16, *this, 6, 0x00); + H8S_TIMER16_CHANNEL(config, m_timer16c[0], *this, 4, 0x60, m_intc, 32, + h8_timer16_channel_device::DIV_1, + h8_timer16_channel_device::DIV_4, + h8_timer16_channel_device::DIV_16, + h8_timer16_channel_device::DIV_64, + h8_timer16_channel_device::INPUT_A, + h8_timer16_channel_device::INPUT_B, + h8_timer16_channel_device::INPUT_C, + h8_timer16_channel_device::INPUT_D); + H8S_TIMER16_CHANNEL(config, m_timer16c[1], *this, 2, 0x4c, m_intc, 40, + h8_timer16_channel_device::DIV_1, + h8_timer16_channel_device::DIV_4, + h8_timer16_channel_device::DIV_16, + h8_timer16_channel_device::DIV_64, + h8_timer16_channel_device::INPUT_A, + h8_timer16_channel_device::INPUT_B, + h8_timer16_channel_device::DIV_256, + h8_timer16_channel_device::CHAIN).set_chain(m_timer16c[2]); + H8S_TIMER16_CHANNEL(config, m_timer16c[2], *this, 2, 0x4c, m_intc, 44, + h8_timer16_channel_device::DIV_1, + h8_timer16_channel_device::DIV_4, + h8_timer16_channel_device::DIV_16, + h8_timer16_channel_device::DIV_64, + h8_timer16_channel_device::INPUT_A, + h8_timer16_channel_device::INPUT_B, + h8_timer16_channel_device::INPUT_C, + h8_timer16_channel_device::DIV_1024); + H8S_TIMER16_CHANNEL(config, m_timer16c[3], *this, 4, 0x60, m_intc, 48, + h8_timer16_channel_device::DIV_1, + h8_timer16_channel_device::DIV_4, + h8_timer16_channel_device::DIV_16, + h8_timer16_channel_device::DIV_64, + h8_timer16_channel_device::INPUT_A, + h8_timer16_channel_device::DIV_1024, + h8_timer16_channel_device::DIV_256, + h8_timer16_channel_device::DIV_4096); + H8S_TIMER16_CHANNEL(config, m_timer16c[4], *this, 2, 0x4c, m_intc, 56, + h8_timer16_channel_device::DIV_1, + h8_timer16_channel_device::DIV_4, + h8_timer16_channel_device::DIV_16, + h8_timer16_channel_device::DIV_64, + h8_timer16_channel_device::INPUT_A, + h8_timer16_channel_device::INPUT_C, + h8_timer16_channel_device::DIV_1024, + h8_timer16_channel_device::CHAIN).set_chain(m_timer16c[5]); + H8S_TIMER16_CHANNEL(config, m_timer16c[5], *this, 2, 0x4c, m_intc, 60, + h8_timer16_channel_device::DIV_1, + h8_timer16_channel_device::DIV_4, + h8_timer16_channel_device::DIV_16, + h8_timer16_channel_device::DIV_64, + h8_timer16_channel_device::INPUT_A, + h8_timer16_channel_device::INPUT_C, + h8_timer16_channel_device::DIV_256, + h8_timer16_channel_device::INPUT_D); + H8_SCI(config, m_sci[0], 0, *this, m_intc, 80, 81, 82, 83); + H8_SCI(config, m_sci[1], 1, *this, m_intc, 84, 85, 86, 87); + H8_WATCHDOG(config, m_watchdog, *this, m_intc, 25, h8_watchdog_device::S); +} + +void h8s2319_device::execute_set_input(int inputnum, int state) +{ + m_intc->set_input(inputnum, state); +} + +bool h8s2319_device::exr_in_stack() const +{ + return m_syscr & 0x20; +} + +int h8s2319_device::trace_setup() +{ + m_CCR |= F_I; + m_EXR &= ~EXR_T; + return 5; +} + +int h8s2319_device::trapa_setup() +{ + m_CCR |= F_I; + if(m_syscr & 0x20) + m_EXR &= ~EXR_T; + return 8; +} + +void h8s2319_device::irq_setup() +{ + switch(m_syscr & 0x30) { + case 0x00: + m_CCR |= F_I; + break; + case 0x20: + m_EXR = m_EXR & (EXR_NC); + if(m_taken_irq_level == 8) + m_EXR |= 7; + else + m_EXR |= m_taken_irq_level; + break; + } +} + +void h8s2319_device::update_irq_filter() +{ + switch(m_syscr & 0x30) { + case 0x00: + if(m_CCR & F_I) + m_intc->set_filter(2, -1); + else + m_intc->set_filter(0, -1); + break; + case 0x20: + m_intc->set_filter(0, m_EXR & 7); + break; + } +} + +void h8s2319_device::interrupt_taken() +{ + standard_irq_callback(m_intc->interrupt_taken(m_taken_irq_vector), m_NPC); +} + +void h8s2319_device::internal_update(u64 current_time) +{ + u64 event_time = 0; + + add_event(event_time, m_adc->internal_update(current_time)); + add_event(event_time, m_sci[0]->internal_update(current_time)); + add_event(event_time, m_sci[1]->internal_update(current_time)); + + // SCI2 used by H8S-2329 + if (m_sci[2]) + add_event(event_time, m_sci[2]->internal_update(current_time)); + + add_event(event_time, m_timer8[0]->internal_update(current_time)); + add_event(event_time, m_timer8[1]->internal_update(current_time)); + add_event(event_time, m_timer16c[0]->internal_update(current_time)); + add_event(event_time, m_timer16c[1]->internal_update(current_time)); + add_event(event_time, m_timer16c[2]->internal_update(current_time)); + add_event(event_time, m_timer16c[3]->internal_update(current_time)); + add_event(event_time, m_timer16c[4]->internal_update(current_time)); + add_event(event_time, m_timer16c[5]->internal_update(current_time)); + add_event(event_time, m_watchdog->internal_update(current_time)); + + recompute_bcount(event_time); +} + +void h8s2319_device::device_start() +{ + h8s2000_device::device_start(); + m_dtc_device = m_dtc; + + m_sbycr = 0; + m_syscr = 0; + + save_item(NAME(m_sbycr)); + save_item(NAME(m_syscr)); +} + +void h8s2319_device::device_reset() +{ + h8s2000_device::device_reset(); + + m_sbycr = 0x08; + m_syscr = 0x01; + m_ram_view.select(0); +} + +u8 h8s2319_device::sbycr_r() +{ + return m_sbycr; +} + +void h8s2319_device::sbycr_w(u8 data) +{ + logerror("sbycr = %02x\n", data); + + // SSBY + m_standby_pending = bool(data & 0x80); + + m_sbycr = data & 0xf9; +} + +u8 h8s2319_device::syscr_r() +{ + return m_syscr; +} + +void h8s2319_device::syscr_w(u8 data) +{ + logerror("syscr = %02x\n", data); + + // RAME + if (data & 1) + m_ram_view.select(0); + else + m_ram_view.disable(); + + // NMIEG + m_intc->set_nmi_edge(BIT(data, 3)); + + m_syscr = data; + update_irq_filter(); +} diff --git a/src/devices/cpu/h8/h8s2319.h b/src/devices/cpu/h8/h8s2319.h new file mode 100644 index 00000000000..ab1ba0bb264 --- /dev/null +++ b/src/devices/cpu/h8/h8s2319.h @@ -0,0 +1,157 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert, hap +/*************************************************************************** + + h8s2319.h + + H8S-2319 family emulation + + H8S/2000-based mcus. + + Variant ROM RAM + H8S/2310 - 2K + H8S/2311 32K 2K + H8S/2312 - 8K + H8S/2313 64K 2K + H8S/2315 384K 8K + H8S/2316 64K 8K + H8S/2317 128K 8K + H8S/2318 256K 8K + H8S/2319 512K 8K + +***************************************************************************/ + +#ifndef MAME_CPU_H8_H8S2319_H +#define MAME_CPU_H8_H8S2319_H + +#pragma once + +#include "h8s2000.h" +#include "h8_intc.h" +#include "h8_adc.h" +#include "h8_dtc.h" +#include "h8_port.h" +#include "h8_timer8.h" +#include "h8_timer16.h" +#include "h8_sci.h" +#include "h8_watchdog.h" + +class h8s2319_device : public h8s2000_device { +public: + h8s2319_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + // I/O ports + auto read_port1() { return m_read_port [PORT_1].bind(); } + auto write_port1() { return m_write_port[PORT_1].bind(); } + auto read_port2() { return m_read_port [PORT_2].bind(); } + auto write_port2() { return m_write_port[PORT_2].bind(); } + auto read_port3() { return m_read_port [PORT_3].bind(); } + auto write_port3() { return m_write_port[PORT_3].bind(); } + auto read_port4() { return m_read_port [PORT_4].bind(); } + + auto read_porta() { return m_read_port [PORT_A].bind(); } + auto write_porta() { return m_write_port[PORT_A].bind(); } + auto read_portb() { return m_read_port [PORT_B].bind(); } + auto write_portb() { return m_write_port[PORT_B].bind(); } + auto read_portc() { return m_read_port [PORT_C].bind(); } + auto write_portc() { return m_write_port[PORT_C].bind(); } + auto read_portd() { return m_read_port [PORT_D].bind(); } + auto write_portd() { return m_write_port[PORT_D].bind(); } + auto read_porte() { return m_read_port [PORT_E].bind(); } + auto write_porte() { return m_write_port[PORT_E].bind(); } + auto read_portf() { return m_read_port [PORT_F].bind(); } + auto write_portf() { return m_write_port[PORT_F].bind(); } + auto read_portg() { return m_read_port [PORT_G].bind(); } + auto write_portg() { return m_write_port[PORT_G].bind(); } + + u8 sbycr_r(); + void sbycr_w(u8 data); + u8 syscr_r(); + void syscr_w(u8 data); + +protected: + required_device m_intc; + required_device m_adc; + required_device m_dtc; + required_device_array m_portn; + required_device_array m_porta; + required_device_array m_timer8; + required_device m_timer16; + required_device_array m_timer16c; + required_device m_watchdog; + + memory_view m_ram_view; + + u32 m_ram_start; + u8 m_sbycr; + u8 m_syscr; + + h8s2319_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, address_map_constructor map_delegate, u32 start); + h8s2319_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u32 start); + + virtual bool exr_in_stack() const override; + virtual void update_irq_filter() override; + virtual void interrupt_taken() override; + virtual int trace_setup() override; + virtual int trapa_setup() override; + virtual void irq_setup() override; + virtual void internal_update(u64 current_time) override; + virtual void device_add_mconfig(machine_config &config) override; + void map(address_map &map); + + virtual void device_start() override; + virtual void device_reset() override; + virtual void execute_set_input(int inputnum, int state) override; +}; + +class h8s2310_device : public h8s2319_device { +public: + h8s2310_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); +}; + +class h8s2311_device : public h8s2319_device { +public: + h8s2311_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); +}; + +class h8s2312_device : public h8s2319_device { +public: + h8s2312_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); +}; + +class h8s2313_device : public h8s2319_device { +public: + h8s2313_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); +}; + +class h8s2315_device : public h8s2319_device { +public: + h8s2315_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); +}; + +class h8s2316_device : public h8s2319_device { +public: + h8s2316_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); +}; + +class h8s2317_device : public h8s2319_device { +public: + h8s2317_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); +}; + +class h8s2318_device : public h8s2319_device { +public: + h8s2318_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); +}; + +DECLARE_DEVICE_TYPE(H8S2310, h8s2310_device) +DECLARE_DEVICE_TYPE(H8S2311, h8s2311_device) +DECLARE_DEVICE_TYPE(H8S2312, h8s2312_device) +DECLARE_DEVICE_TYPE(H8S2313, h8s2313_device) +DECLARE_DEVICE_TYPE(H8S2315, h8s2315_device) +DECLARE_DEVICE_TYPE(H8S2316, h8s2316_device) +DECLARE_DEVICE_TYPE(H8S2317, h8s2317_device) +DECLARE_DEVICE_TYPE(H8S2318, h8s2318_device) +DECLARE_DEVICE_TYPE(H8S2319, h8s2319_device) + +#endif // MAME_CPU_H8_H8S2319_H diff --git a/src/devices/cpu/h8/h8s2320.cpp b/src/devices/cpu/h8/h8s2320.cpp deleted file mode 100644 index 8b22d7ebd9c..00000000000 --- a/src/devices/cpu/h8/h8s2320.cpp +++ /dev/null @@ -1,461 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Olivier Galibert -#include "emu.h" -#include "h8s2320.h" - -DEFINE_DEVICE_TYPE(H8S2320, h8s2320_device, "h8s2320", "Hitachi H8S/2320") -DEFINE_DEVICE_TYPE(H8S2321, h8s2321_device, "h8s2321", "Hitachi H8S/2321") -DEFINE_DEVICE_TYPE(H8S2322, h8s2322_device, "h8s2322", "Hitachi H8S/2322") -DEFINE_DEVICE_TYPE(H8S2323, h8s2323_device, "h8s2323", "Hitachi H8S/2323") -DEFINE_DEVICE_TYPE(H8S2324, h8s2324_device, "h8s2324", "Hitachi H8S/2324") -DEFINE_DEVICE_TYPE(H8S2326, h8s2326_device, "h8s2326", "Hitachi H8S/2326") -DEFINE_DEVICE_TYPE(H8S2327, h8s2327_device, "h8s2327", "Hitachi H8S/2327") -DEFINE_DEVICE_TYPE(H8S2328, h8s2328_device, "h8s2328", "Hitachi H8S/2328") -DEFINE_DEVICE_TYPE(H8S2329, h8s2329_device, "h8s2329", "Hitachi H8S/2329") - - -h8s2320_device::h8s2320_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u32 start) : - h8s2000_device(mconfig, type, tag, owner, clock, address_map_constructor(FUNC(h8s2320_device::map), this)), - m_intc(*this, "intc"), - m_adc(*this, "adc"), - m_dma(*this, "dma"), - m_dma0(*this, "dma:0"), - m_dma1(*this, "dma:1"), - m_dtc(*this, "dtc"), - m_port1(*this, "port1"), - m_port2(*this, "port2"), - m_port3(*this, "port3"), - m_port4(*this, "port4"), - m_port5(*this, "port5"), - m_port6(*this, "port6"), - m_porta(*this, "porta"), - m_portb(*this, "portb"), - m_portc(*this, "portc"), - m_portd(*this, "portd"), - m_porte(*this, "porte"), - m_portf(*this, "portf"), - m_portg(*this, "portg"), - m_timer8_0(*this, "timer8_0"), - m_timer8_1(*this, "timer8_1"), - m_timer16(*this, "timer16"), - m_timer16_0(*this, "timer16:0"), - m_timer16_1(*this, "timer16:1"), - m_timer16_2(*this, "timer16:2"), - m_timer16_3(*this, "timer16:3"), - m_timer16_4(*this, "timer16:4"), - m_timer16_5(*this, "timer16:5"), - m_watchdog(*this, "watchdog"), - m_tend_cb(*this), - m_ram_start(start), - m_syscr(0) -{ -} - -h8s2320_device::h8s2320_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : - h8s2320_device(mconfig, H8S2320, tag, owner, clock, 0xffec00) -{ -} - -h8s2321_device::h8s2321_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : - h8s2320_device(mconfig, H8S2321, tag, owner, clock, 0xffec00) -{ -} - -h8s2322_device::h8s2322_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : - h8s2320_device(mconfig, H8S2322, tag, owner, clock, 0xffdc00) -{ -} - -h8s2323_device::h8s2323_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : - h8s2320_device(mconfig, H8S2323, tag, owner, clock, 0xffdc00) -{ -} - -h8s2324_device::h8s2324_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : - h8s2320_device(mconfig, H8S2324, tag, owner, clock, 0xff7c00) -{ -} - -h8s2326_device::h8s2326_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : - h8s2320_device(mconfig, H8S2326, tag, owner, clock, 0xffdc00) -{ -} - -h8s2327_device::h8s2327_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : - h8s2320_device(mconfig, H8S2327, tag, owner, clock, 0xffdc00) -{ -} - -h8s2328_device::h8s2328_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : - h8s2320_device(mconfig, H8S2328, tag, owner, clock, 0xffdc00) -{ -} - -h8s2329_device::h8s2329_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : - h8s2320_device(mconfig, H8S2329, tag, owner, clock, 0xff7c00) -{ -} - -void h8s2320_device::map(address_map &map) -{ - map(m_ram_start, 0xfffbff).ram(); - - map(0xfffe80, 0xfffe80).rw(m_timer16_3, FUNC(h8_timer16_channel_device::tcr_r), FUNC(h8_timer16_channel_device::tcr_w)); - map(0xfffe81, 0xfffe81).rw(m_timer16_3, FUNC(h8_timer16_channel_device::tmdr_r), FUNC(h8_timer16_channel_device::tmdr_w)); - map(0xfffe82, 0xfffe83).rw(m_timer16_3, FUNC(h8_timer16_channel_device::tior_r), FUNC(h8_timer16_channel_device::tior_w)); - map(0xfffe84, 0xfffe84).rw(m_timer16_3, FUNC(h8_timer16_channel_device::tier_r), FUNC(h8_timer16_channel_device::tier_w)); - map(0xfffe85, 0xfffe85).rw(m_timer16_3, FUNC(h8_timer16_channel_device::tsr_r), FUNC(h8_timer16_channel_device::tsr_w)); - map(0xfffe86, 0xfffe87).rw(m_timer16_3, FUNC(h8_timer16_channel_device::tcnt_r), FUNC(h8_timer16_channel_device::tcnt_w)); - map(0xfffe88, 0xfffe8f).rw(m_timer16_3, FUNC(h8_timer16_channel_device::tgr_r), FUNC(h8_timer16_channel_device::tgr_w)); - map(0xfffe90, 0xfffe90).rw(m_timer16_4, FUNC(h8_timer16_channel_device::tcr_r), FUNC(h8_timer16_channel_device::tcr_w)); - map(0xfffe91, 0xfffe91).rw(m_timer16_4, FUNC(h8_timer16_channel_device::tmdr_r), FUNC(h8_timer16_channel_device::tmdr_w)); - map(0xfffe92, 0xfffe92).rw(m_timer16_4, FUNC(h8_timer16_channel_device::tior_r), FUNC(h8_timer16_channel_device::tior_w)); - map(0xfffe94, 0xfffe94).rw(m_timer16_4, FUNC(h8_timer16_channel_device::tier_r), FUNC(h8_timer16_channel_device::tier_w)); - map(0xfffe95, 0xfffe95).rw(m_timer16_4, FUNC(h8_timer16_channel_device::tsr_r), FUNC(h8_timer16_channel_device::tsr_w)); - map(0xfffe96, 0xfffe97).rw(m_timer16_4, FUNC(h8_timer16_channel_device::tcnt_r), FUNC(h8_timer16_channel_device::tcnt_w)); - map(0xfffe98, 0xfffe9b).rw(m_timer16_4, FUNC(h8_timer16_channel_device::tgr_r), FUNC(h8_timer16_channel_device::tgr_w)); - map(0xfffea0, 0xfffea0).rw(m_timer16_5, FUNC(h8_timer16_channel_device::tcr_r), FUNC(h8_timer16_channel_device::tcr_w)); - map(0xfffea1, 0xfffea1).rw(m_timer16_5, FUNC(h8_timer16_channel_device::tmdr_r), FUNC(h8_timer16_channel_device::tmdr_w)); - map(0xfffea2, 0xfffea2).rw(m_timer16_5, FUNC(h8_timer16_channel_device::tior_r), FUNC(h8_timer16_channel_device::tior_w)); - map(0xfffea4, 0xfffea4).rw(m_timer16_5, FUNC(h8_timer16_channel_device::tier_r), FUNC(h8_timer16_channel_device::tier_w)); - map(0xfffea5, 0xfffea5).rw(m_timer16_5, FUNC(h8_timer16_channel_device::tsr_r), FUNC(h8_timer16_channel_device::tsr_w)); - map(0xfffea6, 0xfffea7).rw(m_timer16_5, FUNC(h8_timer16_channel_device::tcnt_r), FUNC(h8_timer16_channel_device::tcnt_w)); - map(0xfffea8, 0xfffeab).rw(m_timer16_5, FUNC(h8_timer16_channel_device::tgr_r), FUNC(h8_timer16_channel_device::tgr_w)); - map(0xfffeb0, 0xfffeb0).w(m_port1, FUNC(h8_port_device::ddr_w)); - map(0xfffeb1, 0xfffeb1).w(m_port2, FUNC(h8_port_device::ddr_w)); - map(0xfffeb2, 0xfffeb2).w(m_port3, FUNC(h8_port_device::ddr_w)); - map(0xfffeb4, 0xfffeb4).w(m_port5, FUNC(h8_port_device::ddr_w)); - map(0xfffeb5, 0xfffeb5).w(m_port6, FUNC(h8_port_device::ddr_w)); - map(0xfffeb9, 0xfffeb9).w(m_porta, FUNC(h8_port_device::ddr_w)); - map(0xfffeba, 0xfffeba).w(m_portb, FUNC(h8_port_device::ddr_w)); - map(0xfffebb, 0xfffebb).w(m_portc, FUNC(h8_port_device::ddr_w)); - map(0xfffebc, 0xfffebc).w(m_portd, FUNC(h8_port_device::ddr_w)); - map(0xfffebd, 0xfffebd).w(m_porte, FUNC(h8_port_device::ddr_w)); - map(0xfffebe, 0xfffebe).w(m_portf, FUNC(h8_port_device::ddr_w)); - map(0xfffebf, 0xfffebf).w(m_portg, FUNC(h8_port_device::ddr_w)); - map(0xfffec4, 0xfffece).rw(m_intc, FUNC(h8s_intc_device::ipr_r), FUNC(h8s_intc_device::ipr_w)); - - if(type() != H8S2321) { - map(0xfffee0, 0xfffee1).rw(m_dma0, FUNC(h8s_dma_channel_device::marah_r), FUNC(h8s_dma_channel_device::marah_w)); - map(0xfffee2, 0xfffee3).rw(m_dma0, FUNC(h8s_dma_channel_device::maral_r), FUNC(h8s_dma_channel_device::maral_w)); - map(0xfffee4, 0xfffee5).rw(m_dma0, FUNC(h8s_dma_channel_device::ioara_r), FUNC(h8s_dma_channel_device::ioara_w)); - map(0xfffee6, 0xfffee7).rw(m_dma0, FUNC(h8s_dma_channel_device::etcra_r), FUNC(h8s_dma_channel_device::etcra_w)); - map(0xfffee8, 0xfffee9).rw(m_dma0, FUNC(h8s_dma_channel_device::marbh_r), FUNC(h8s_dma_channel_device::marbh_w)); - map(0xfffeea, 0xfffeeb).rw(m_dma0, FUNC(h8s_dma_channel_device::marbl_r), FUNC(h8s_dma_channel_device::marbl_w)); - map(0xfffeec, 0xfffeed).rw(m_dma0, FUNC(h8s_dma_channel_device::ioarb_r), FUNC(h8s_dma_channel_device::ioarb_w)); - map(0xfffeee, 0xfffeef).rw(m_dma0, FUNC(h8s_dma_channel_device::etcrb_r), FUNC(h8s_dma_channel_device::etcrb_w)); - map(0xfffef0, 0xfffef1).rw(m_dma1, FUNC(h8s_dma_channel_device::marah_r), FUNC(h8s_dma_channel_device::marah_w)); - map(0xfffef2, 0xfffef3).rw(m_dma1, FUNC(h8s_dma_channel_device::maral_r), FUNC(h8s_dma_channel_device::maral_w)); - map(0xfffef4, 0xfffef5).rw(m_dma1, FUNC(h8s_dma_channel_device::ioara_r), FUNC(h8s_dma_channel_device::ioara_w)); - map(0xfffef6, 0xfffef7).rw(m_dma1, FUNC(h8s_dma_channel_device::etcra_r), FUNC(h8s_dma_channel_device::etcra_w)); - map(0xfffef8, 0xfffef9).rw(m_dma1, FUNC(h8s_dma_channel_device::marbh_r), FUNC(h8s_dma_channel_device::marbh_w)); - map(0xfffefa, 0xfffefb).rw(m_dma1, FUNC(h8s_dma_channel_device::marbl_r), FUNC(h8s_dma_channel_device::marbl_w)); - map(0xfffefc, 0xfffefd).rw(m_dma1, FUNC(h8s_dma_channel_device::ioarb_r), FUNC(h8s_dma_channel_device::ioarb_w)); - map(0xfffefe, 0xfffeff).rw(m_dma1, FUNC(h8s_dma_channel_device::etcrb_r), FUNC(h8s_dma_channel_device::etcrb_w)); - map(0xffff00, 0xffff00).rw(m_dma, FUNC(h8s_dma_device::dmawer_r), FUNC(h8s_dma_device::dmawer_w)); - map(0xffff01, 0xffff01).rw(m_dma, FUNC(h8s_dma_device::dmatcr_r), FUNC(h8s_dma_device::dmatcr_w)); - map(0xffff02, 0xffff03).rw(m_dma0, FUNC(h8s_dma_channel_device::dmacr_r), FUNC(h8s_dma_channel_device::dmacr_w)); - map(0xffff04, 0xffff05).rw(m_dma1, FUNC(h8s_dma_channel_device::dmacr_r), FUNC(h8s_dma_channel_device::dmacr_w)); - map(0xffff06, 0xffff07).rw(m_dma, FUNC(h8s_dma_device::dmabcr_r), FUNC(h8s_dma_device::dmabcr_w)); - } - map(0xffff2c, 0xffff2c).rw(m_intc, FUNC(h8s_intc_device::iscrh_r), FUNC(h8s_intc_device::iscrh_w)); - map(0xffff2d, 0xffff2d).rw(m_intc, FUNC(h8s_intc_device::iscrl_r), FUNC(h8s_intc_device::iscrl_w)); - map(0xffff2e, 0xffff2e).rw(m_intc, FUNC(h8s_intc_device::ier_r), FUNC(h8s_intc_device::ier_w)); - map(0xffff2f, 0xffff2f).rw(m_intc, FUNC(h8s_intc_device::isr_r), FUNC(h8s_intc_device::isr_w)); - map(0xffff30, 0xffff35).rw(m_dtc, FUNC(h8_dtc_device::dtcer_r), FUNC(h8_dtc_device::dtcer_w)); - map(0xffff37, 0xffff37).rw(m_dtc, FUNC(h8_dtc_device::dtvecr_r), FUNC(h8_dtc_device::dtvecr_w)); - map(0xffff39, 0xffff39).rw(FUNC(h8s2320_device::syscr_r), FUNC(h8s2320_device::syscr_w)); - - map(0xffff50, 0xffff50).r(m_port1, FUNC(h8_port_device::port_r)); - map(0xffff51, 0xffff51).r(m_port2, FUNC(h8_port_device::port_r)); - map(0xffff52, 0xffff52).r(m_port3, FUNC(h8_port_device::port_r)); - map(0xffff53, 0xffff53).r(m_port4, FUNC(h8_port_device::port_r)); - map(0xffff54, 0xffff54).r(m_port5, FUNC(h8_port_device::port_r)); - map(0xffff55, 0xffff55).r(m_port6, FUNC(h8_port_device::port_r)); - map(0xffff59, 0xffff59).r(m_porta, FUNC(h8_port_device::port_r)); - map(0xffff5a, 0xffff5a).r(m_portb, FUNC(h8_port_device::port_r)); - map(0xffff5b, 0xffff5b).r(m_portc, FUNC(h8_port_device::port_r)); - map(0xffff5c, 0xffff5c).r(m_portd, FUNC(h8_port_device::port_r)); - map(0xffff5d, 0xffff5d).r(m_porte, FUNC(h8_port_device::port_r)); - map(0xffff5e, 0xffff5e).r(m_portf, FUNC(h8_port_device::port_r)); - map(0xffff5f, 0xffff5f).r(m_portg, FUNC(h8_port_device::port_r)); - map(0xffff60, 0xffff60).rw(m_port1, FUNC(h8_port_device::dr_r), FUNC(h8_port_device::dr_w)); - map(0xffff61, 0xffff61).rw(m_port2, FUNC(h8_port_device::dr_r), FUNC(h8_port_device::dr_w)); - map(0xffff62, 0xffff62).rw(m_port3, FUNC(h8_port_device::dr_r), FUNC(h8_port_device::dr_w)); - map(0xffff64, 0xffff64).rw(m_port5, FUNC(h8_port_device::dr_r), FUNC(h8_port_device::dr_w)); - map(0xffff65, 0xffff65).rw(m_port6, FUNC(h8_port_device::dr_r), FUNC(h8_port_device::dr_w)); - map(0xffff69, 0xffff69).rw(m_porta, FUNC(h8_port_device::dr_r), FUNC(h8_port_device::dr_w)); - map(0xffff6a, 0xffff6a).rw(m_portb, FUNC(h8_port_device::dr_r), FUNC(h8_port_device::dr_w)); - map(0xffff6b, 0xffff6b).rw(m_portc, FUNC(h8_port_device::dr_r), FUNC(h8_port_device::dr_w)); - map(0xffff6c, 0xffff6c).rw(m_portd, FUNC(h8_port_device::dr_r), FUNC(h8_port_device::dr_w)); - map(0xffff6d, 0xffff6d).rw(m_porte, FUNC(h8_port_device::dr_r), FUNC(h8_port_device::dr_w)); - map(0xffff6e, 0xffff6e).rw(m_portf, FUNC(h8_port_device::dr_r), FUNC(h8_port_device::dr_w)); - map(0xffff6f, 0xffff6f).rw(m_portg, FUNC(h8_port_device::dr_r), FUNC(h8_port_device::dr_w)); - map(0xffff70, 0xffff70).rw(m_porta, FUNC(h8_port_device::pcr_r), FUNC(h8_port_device::pcr_w)); - map(0xffff71, 0xffff71).rw(m_portb, FUNC(h8_port_device::pcr_r), FUNC(h8_port_device::pcr_w)); - map(0xffff72, 0xffff72).rw(m_portc, FUNC(h8_port_device::pcr_r), FUNC(h8_port_device::pcr_w)); - map(0xffff73, 0xffff73).rw(m_portd, FUNC(h8_port_device::pcr_r), FUNC(h8_port_device::pcr_w)); - map(0xffff74, 0xffff74).rw(m_porte, FUNC(h8_port_device::pcr_r), FUNC(h8_port_device::pcr_w)); - map(0xffff76, 0xffff76).rw(m_port3, FUNC(h8_port_device::odr_r), FUNC(h8_port_device::odr_w)); - map(0xffff77, 0xffff77).rw(m_porta, FUNC(h8_port_device::odr_r), FUNC(h8_port_device::odr_w)); - map(0xffff78, 0xffff78).rw(m_sci[0], FUNC(h8_sci_device::smr_r), FUNC(h8_sci_device::smr_w)); - map(0xffff79, 0xffff79).rw(m_sci[0], FUNC(h8_sci_device::brr_r), FUNC(h8_sci_device::brr_w)); - map(0xffff7a, 0xffff7a).rw(m_sci[0], FUNC(h8_sci_device::scr_r), FUNC(h8_sci_device::scr_w)); - map(0xffff7b, 0xffff7b).rw(m_sci[0], FUNC(h8_sci_device::tdr_r), FUNC(h8_sci_device::tdr_w)); - map(0xffff7c, 0xffff7c).rw(m_sci[0], FUNC(h8_sci_device::ssr_r), FUNC(h8_sci_device::ssr_w)); - map(0xffff7d, 0xffff7d).r(m_sci[0], FUNC(h8_sci_device::rdr_r)); - map(0xffff7e, 0xffff7e).rw(m_sci[0], FUNC(h8_sci_device::scmr_r), FUNC(h8_sci_device::scmr_w)); - map(0xffff80, 0xffff80).rw(m_sci[1], FUNC(h8_sci_device::smr_r), FUNC(h8_sci_device::smr_w)); - map(0xffff81, 0xffff81).rw(m_sci[1], FUNC(h8_sci_device::brr_r), FUNC(h8_sci_device::brr_w)); - map(0xffff82, 0xffff82).rw(m_sci[1], FUNC(h8_sci_device::scr_r), FUNC(h8_sci_device::scr_w)); - map(0xffff83, 0xffff83).rw(m_sci[1], FUNC(h8_sci_device::tdr_r), FUNC(h8_sci_device::tdr_w)); - map(0xffff84, 0xffff84).rw(m_sci[1], FUNC(h8_sci_device::ssr_r), FUNC(h8_sci_device::ssr_w)); - map(0xffff85, 0xffff85).r(m_sci[1], FUNC(h8_sci_device::rdr_r)); - map(0xffff86, 0xffff86).rw(m_sci[1], FUNC(h8_sci_device::scmr_r), FUNC(h8_sci_device::scmr_w)); - map(0xffff88, 0xffff88).rw(m_sci[2], FUNC(h8_sci_device::smr_r), FUNC(h8_sci_device::smr_w)); - map(0xffff89, 0xffff89).rw(m_sci[2], FUNC(h8_sci_device::brr_r), FUNC(h8_sci_device::brr_w)); - map(0xffff8a, 0xffff8a).rw(m_sci[2], FUNC(h8_sci_device::scr_r), FUNC(h8_sci_device::scr_w)); - map(0xffff8b, 0xffff8b).rw(m_sci[2], FUNC(h8_sci_device::tdr_r), FUNC(h8_sci_device::tdr_w)); - map(0xffff8c, 0xffff8c).rw(m_sci[2], FUNC(h8_sci_device::ssr_r), FUNC(h8_sci_device::ssr_w)); - map(0xffff8d, 0xffff8d).r(m_sci[2], FUNC(h8_sci_device::rdr_r)); - map(0xffff8e, 0xffff8e).rw(m_sci[2], FUNC(h8_sci_device::scmr_r), FUNC(h8_sci_device::scmr_w)); - map(0xffff90, 0xffff97).r(m_adc, FUNC(h8_adc_device::addr8_r)); - map(0xffff98, 0xffff98).rw(m_adc, FUNC(h8_adc_device::adcsr_r), FUNC(h8_adc_device::adcsr_w)); - map(0xffff99, 0xffff99).rw(m_adc, FUNC(h8_adc_device::adcr_r), FUNC(h8_adc_device::adcr_w)); - - map(0xffffb0, 0xffffb0).rw(m_timer8_0, FUNC(h8_timer8_channel_device::tcr_r), FUNC(h8_timer8_channel_device::tcr_w)); - map(0xffffb1, 0xffffb1).rw(m_timer8_1, FUNC(h8_timer8_channel_device::tcr_r), FUNC(h8_timer8_channel_device::tcr_w)); - map(0xffffb2, 0xffffb2).rw(m_timer8_0, FUNC(h8_timer8_channel_device::tcsr_r), FUNC(h8_timer8_channel_device::tcsr_w)); - map(0xffffb3, 0xffffb3).rw(m_timer8_1, FUNC(h8_timer8_channel_device::tcsr_r), FUNC(h8_timer8_channel_device::tcsr_w)); - map(0xffffb4, 0xffffb7).rw(m_timer8_0, FUNC(h8_timer8_channel_device::tcor_r), FUNC(h8_timer8_channel_device::tcor_w)).umask16(0xff00); - map(0xffffb4, 0xffffb7).rw(m_timer8_1, FUNC(h8_timer8_channel_device::tcor_r), FUNC(h8_timer8_channel_device::tcor_w)).umask16(0x00ff); - map(0xffffb8, 0xffffb8).rw(m_timer8_0, FUNC(h8_timer8_channel_device::tcnt_r), FUNC(h8_timer8_channel_device::tcnt_w)); - map(0xffffb9, 0xffffb9).rw(m_timer8_1, FUNC(h8_timer8_channel_device::tcnt_r), FUNC(h8_timer8_channel_device::tcnt_w)); - map(0xffffbc, 0xffffbd).rw(m_watchdog, FUNC(h8_watchdog_device::wd_r), FUNC(h8_watchdog_device::wd_w)); - map(0xffffbe, 0xffffbf).rw(m_watchdog, FUNC(h8_watchdog_device::rst_r), FUNC(h8_watchdog_device::rst_w)); - map(0xffffc0, 0xffffc0).rw(m_timer16, FUNC(h8_timer16_device::tstr_r), FUNC(h8_timer16_device::tstr_w)); - map(0xffffc1, 0xffffc1).rw(m_timer16, FUNC(h8_timer16_device::tsyr_r), FUNC(h8_timer16_device::tsyr_w)); - - map(0xffffd0, 0xffffd0).rw(m_timer16_0, FUNC(h8_timer16_channel_device::tcr_r), FUNC(h8_timer16_channel_device::tcr_w)); - map(0xffffd1, 0xffffd1).rw(m_timer16_0, FUNC(h8_timer16_channel_device::tmdr_r), FUNC(h8_timer16_channel_device::tmdr_w)); - map(0xffffd2, 0xffffd3).rw(m_timer16_0, FUNC(h8_timer16_channel_device::tior_r), FUNC(h8_timer16_channel_device::tior_w)); - map(0xffffd4, 0xffffd4).rw(m_timer16_0, FUNC(h8_timer16_channel_device::tier_r), FUNC(h8_timer16_channel_device::tier_w)); - map(0xffffd5, 0xffffd5).rw(m_timer16_0, FUNC(h8_timer16_channel_device::tsr_r), FUNC(h8_timer16_channel_device::tsr_w)); - map(0xffffd6, 0xffffd7).rw(m_timer16_0, FUNC(h8_timer16_channel_device::tcnt_r), FUNC(h8_timer16_channel_device::tcnt_w)); - map(0xffffd8, 0xffffdf).rw(m_timer16_0, FUNC(h8_timer16_channel_device::tgr_r), FUNC(h8_timer16_channel_device::tgr_w)); - map(0xffffe0, 0xffffe0).rw(m_timer16_1, FUNC(h8_timer16_channel_device::tcr_r), FUNC(h8_timer16_channel_device::tcr_w)); - map(0xffffe1, 0xffffe1).rw(m_timer16_1, FUNC(h8_timer16_channel_device::tmdr_r), FUNC(h8_timer16_channel_device::tmdr_w)); - map(0xffffe2, 0xffffe2).rw(m_timer16_1, FUNC(h8_timer16_channel_device::tior_r), FUNC(h8_timer16_channel_device::tior_w)); - map(0xffffe4, 0xffffe4).rw(m_timer16_1, FUNC(h8_timer16_channel_device::tier_r), FUNC(h8_timer16_channel_device::tier_w)); - map(0xffffe5, 0xffffe5).rw(m_timer16_1, FUNC(h8_timer16_channel_device::tsr_r), FUNC(h8_timer16_channel_device::tsr_w)); - map(0xffffe6, 0xffffe7).rw(m_timer16_1, FUNC(h8_timer16_channel_device::tcnt_r), FUNC(h8_timer16_channel_device::tcnt_w)); - map(0xffffe8, 0xffffeb).rw(m_timer16_1, FUNC(h8_timer16_channel_device::tgr_r), FUNC(h8_timer16_channel_device::tgr_w)); - map(0xfffff0, 0xfffff0).rw(m_timer16_2, FUNC(h8_timer16_channel_device::tcr_r), FUNC(h8_timer16_channel_device::tcr_w)); - map(0xfffff1, 0xfffff1).rw(m_timer16_2, FUNC(h8_timer16_channel_device::tmdr_r), FUNC(h8_timer16_channel_device::tmdr_w)); - map(0xfffff2, 0xfffff2).rw(m_timer16_2, FUNC(h8_timer16_channel_device::tior_r), FUNC(h8_timer16_channel_device::tior_w)); - map(0xfffff4, 0xfffff4).rw(m_timer16_2, FUNC(h8_timer16_channel_device::tier_r), FUNC(h8_timer16_channel_device::tier_w)); - map(0xfffff5, 0xfffff5).rw(m_timer16_2, FUNC(h8_timer16_channel_device::tsr_r), FUNC(h8_timer16_channel_device::tsr_w)); - map(0xfffff6, 0xfffff7).rw(m_timer16_2, FUNC(h8_timer16_channel_device::tcnt_r), FUNC(h8_timer16_channel_device::tcnt_w)); - map(0xfffff8, 0xfffffb).rw(m_timer16_2, FUNC(h8_timer16_channel_device::tgr_r), FUNC(h8_timer16_channel_device::tgr_w)); -} - -void h8s2320_device::device_add_mconfig(machine_config &config) -{ - H8S_INTC(config, m_intc, *this); - H8_ADC_2320(config, m_adc, *this, m_intc, 28); - if(type() != H8S2321) { - H8S_DMA(config, m_dma, *this); - H8S_DMA_CHANNEL(config, m_dma0, *this, m_dma, m_intc); - H8S_DMA_CHANNEL(config, m_dma1, *this, m_dma, m_intc); - } - H8_DTC(config, m_dtc, *this, m_intc, 24); - H8_PORT(config, m_port1, *this, h8_device::PORT_1, 0x00, 0x00); - H8_PORT(config, m_port2, *this, h8_device::PORT_2, 0x00, 0x00); - H8_PORT(config, m_port3, *this, h8_device::PORT_3, 0xc0, 0xc0); - H8_PORT(config, m_port4, *this, h8_device::PORT_4, 0x00, 0x00); - H8_PORT(config, m_port5, *this, h8_device::PORT_5, 0xf0, 0xf0); - H8_PORT(config, m_port6, *this, h8_device::PORT_6, 0x00, 0x00); - H8_PORT(config, m_porta, *this, h8_device::PORT_A, 0x00, 0x00); - H8_PORT(config, m_portb, *this, h8_device::PORT_B, 0x00, 0x00); - H8_PORT(config, m_portc, *this, h8_device::PORT_C, 0x00, 0x00); - H8_PORT(config, m_portd, *this, h8_device::PORT_D, 0x00, 0x00); - H8_PORT(config, m_porte, *this, h8_device::PORT_E, 0x00, 0x00); - H8_PORT(config, m_portf, *this, h8_device::PORT_F, 0x00, 0x00); - H8_PORT(config, m_portg, *this, h8_device::PORT_G, 0xe0, 0xe0); - H8H_TIMER8_CHANNEL(config, m_timer8_0, *this, m_intc, 64, 65, 66, m_timer8_1, h8_timer8_channel_device::CHAIN_OVERFLOW, true, false); - H8H_TIMER8_CHANNEL(config, m_timer8_1, *this, m_intc, 68, 69, 70, m_timer8_0, h8_timer8_channel_device::CHAIN_A, false, false); - H8_TIMER16(config, m_timer16, *this, 6, 0x00); - H8S_TIMER16_CHANNEL(config, m_timer16_0, *this, 4, 0x60, m_intc, 32, - h8_timer16_channel_device::DIV_1, - h8_timer16_channel_device::DIV_4, - h8_timer16_channel_device::DIV_16, - h8_timer16_channel_device::DIV_64, - h8_timer16_channel_device::INPUT_A, - h8_timer16_channel_device::INPUT_B, - h8_timer16_channel_device::INPUT_C, - h8_timer16_channel_device::INPUT_D); - H8S_TIMER16_CHANNEL(config, m_timer16_1, *this, 2, 0x4c, m_intc, 40, - h8_timer16_channel_device::DIV_1, - h8_timer16_channel_device::DIV_4, - h8_timer16_channel_device::DIV_16, - h8_timer16_channel_device::DIV_64, - h8_timer16_channel_device::INPUT_A, - h8_timer16_channel_device::INPUT_B, - h8_timer16_channel_device::DIV_256, - h8_timer16_channel_device::CHAIN).set_chain(m_timer16_2); - H8S_TIMER16_CHANNEL(config, m_timer16_2, *this, 2, 0x4c, m_intc, 44, - h8_timer16_channel_device::DIV_1, - h8_timer16_channel_device::DIV_4, - h8_timer16_channel_device::DIV_16, - h8_timer16_channel_device::DIV_64, - h8_timer16_channel_device::INPUT_A, - h8_timer16_channel_device::INPUT_B, - h8_timer16_channel_device::INPUT_C, - h8_timer16_channel_device::DIV_1024); - H8S_TIMER16_CHANNEL(config, m_timer16_3, *this, 4, 0x60, m_intc, 48, - h8_timer16_channel_device::DIV_1, - h8_timer16_channel_device::DIV_4, - h8_timer16_channel_device::DIV_16, - h8_timer16_channel_device::DIV_64, - h8_timer16_channel_device::INPUT_A, - h8_timer16_channel_device::DIV_1024, - h8_timer16_channel_device::DIV_256, - h8_timer16_channel_device::DIV_4096); - H8S_TIMER16_CHANNEL(config, m_timer16_4, *this, 2, 0x4c, m_intc, 56, - h8_timer16_channel_device::DIV_1, - h8_timer16_channel_device::DIV_4, - h8_timer16_channel_device::DIV_16, - h8_timer16_channel_device::DIV_64, - h8_timer16_channel_device::INPUT_A, - h8_timer16_channel_device::INPUT_C, - h8_timer16_channel_device::DIV_1024, - h8_timer16_channel_device::CHAIN).set_chain(m_timer16_5); - H8S_TIMER16_CHANNEL(config, m_timer16_5, *this, 2, 0x4c, m_intc, 60, - h8_timer16_channel_device::DIV_1, - h8_timer16_channel_device::DIV_4, - h8_timer16_channel_device::DIV_16, - h8_timer16_channel_device::DIV_64, - h8_timer16_channel_device::INPUT_A, - h8_timer16_channel_device::INPUT_C, - h8_timer16_channel_device::DIV_256, - h8_timer16_channel_device::INPUT_D); - H8_SCI(config, m_sci[0], 0, *this, m_intc, 80, 81, 82, 83); - H8_SCI(config, m_sci[1], 1, *this, m_intc, 84, 85, 86, 87); - H8_SCI(config, m_sci[2], 2, *this, m_intc, 88, 89, 90, 91); - H8_WATCHDOG(config, m_watchdog, *this, m_intc, 25, h8_watchdog_device::H); -} - -void h8s2320_device::execute_set_input(int inputnum, int state) -{ - if(inputnum == H8_INPUT_LINE_TEND0 || inputnum == H8_INPUT_LINE_TEND1) - m_tend_cb[inputnum - H8_INPUT_LINE_TEND0](state); - else if(inputnum == H8_INPUT_LINE_DREQ0 || inputnum == H8_INPUT_LINE_DREQ1) - m_dma->set_input(inputnum, state); - else - m_intc->set_input(inputnum, state); -} - -bool h8s2320_device::exr_in_stack() const -{ - return m_syscr & 0x20; -} - -int h8s2320_device::trace_setup() -{ - m_CCR |= F_I; - m_EXR &= ~EXR_T; - return 5; -} - -int h8s2320_device::trapa_setup() -{ - m_CCR |= F_I; - if(m_syscr & 0x20) - m_EXR &= ~EXR_T; - return 8; -} - -void h8s2320_device::irq_setup() -{ - switch(m_syscr & 0x30) { - case 0x00: - m_CCR |= F_I; - break; - case 0x20: - m_EXR = m_EXR & (EXR_NC); - if(m_taken_irq_level == 8) - m_EXR |= 7; - else - m_EXR |= m_taken_irq_level; - break; - } -} - -void h8s2320_device::update_irq_filter() -{ - switch(m_syscr & 0x30) { - case 0x00: - if(m_CCR & F_I) - m_intc->set_filter(2, -1); - else - m_intc->set_filter(0, -1); - break; - case 0x20: - m_intc->set_filter(0, m_EXR & 7); - break; - } -} - -void h8s2320_device::interrupt_taken() -{ - standard_irq_callback(m_intc->interrupt_taken(m_taken_irq_vector), m_NPC); -} - -void h8s2320_device::internal_update(u64 current_time) -{ - u64 event_time = 0; - - add_event(event_time, m_adc->internal_update(current_time)); - add_event(event_time, m_sci[0]->internal_update(current_time)); - add_event(event_time, m_sci[1]->internal_update(current_time)); - add_event(event_time, m_sci[2]->internal_update(current_time)); - add_event(event_time, m_timer8_0->internal_update(current_time)); - add_event(event_time, m_timer8_1->internal_update(current_time)); - add_event(event_time, m_timer16_0->internal_update(current_time)); - add_event(event_time, m_timer16_1->internal_update(current_time)); - add_event(event_time, m_timer16_2->internal_update(current_time)); - add_event(event_time, m_timer16_3->internal_update(current_time)); - add_event(event_time, m_timer16_4->internal_update(current_time)); - add_event(event_time, m_timer16_5->internal_update(current_time)); - add_event(event_time, m_watchdog->internal_update(current_time)); - - recompute_bcount(event_time); -} - -void h8s2320_device::device_start() -{ - h8s2000_device::device_start(); - m_dma_device = m_dma; - m_dtc_device = m_dtc; - - save_item(NAME(m_syscr)); -} - -void h8s2320_device::device_reset() -{ - h8s2000_device::device_reset(); - m_syscr = 0x01; -} - -u8 h8s2320_device::syscr_r() -{ - return m_syscr; -} - -void h8s2320_device::syscr_w(u8 data) -{ - m_syscr = data; - m_mac_saturating = m_syscr & 0x80; - update_irq_filter(); - logerror("syscr = %02x\n", data); -} diff --git a/src/devices/cpu/h8/h8s2320.h b/src/devices/cpu/h8/h8s2320.h deleted file mode 100644 index 7caea73ae4f..00000000000 --- a/src/devices/cpu/h8/h8s2320.h +++ /dev/null @@ -1,181 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Olivier Galibert -/*************************************************************************** - - h8s2320.h - - H8S-2320 family emulation - - H8S/2600-based mcus. - - Variant ROM RAM - H8S/2320 - 4K - H8S/2321 - 4K - H8S/2322 - 8K - H8S/2323 32K 8K - H8S/2324 - 32K - H8S/2326 512K 8K - H8S/2327 128K 8K - H8S/2328 256K 8K - H8S/2329 384K 32K - - - -***************************************************************************/ - -#ifndef MAME_CPU_H8_H8S2320_H -#define MAME_CPU_H8_H8S2320_H - -#pragma once - -#include "h8s2000.h" -#include "h8_intc.h" -#include "h8_adc.h" -#include "h8_dma.h" -#include "h8_dtc.h" -#include "h8_port.h" -#include "h8_timer8.h" -#include "h8_timer16.h" -#include "h8_sci.h" -#include "h8_watchdog.h" - -class h8s2320_device : public h8s2000_device { -public: - h8s2320_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); - - auto read_port1() { return m_read_port [PORT_1].bind(); } - auto write_port1() { return m_write_port[PORT_1].bind(); } - auto read_port2() { return m_read_port [PORT_2].bind(); } - auto write_port2() { return m_write_port[PORT_2].bind(); } - auto read_port3() { return m_read_port [PORT_3].bind(); } - auto write_port3() { return m_write_port[PORT_3].bind(); } - auto read_port4() { return m_read_port [PORT_4].bind(); } - auto read_port5() { return m_read_port [PORT_5].bind(); } - auto write_port5() { return m_write_port[PORT_5].bind(); } - auto read_port6() { return m_read_port [PORT_6].bind(); } - auto write_port6() { return m_write_port[PORT_6].bind(); } - auto read_porta() { return m_read_port [PORT_A].bind(); } - auto write_porta() { return m_write_port[PORT_A].bind(); } - auto read_portb() { return m_read_port [PORT_B].bind(); } - auto write_portb() { return m_write_port[PORT_B].bind(); } - auto read_portc() { return m_read_port [PORT_C].bind(); } - auto write_portc() { return m_write_port[PORT_C].bind(); } - auto read_portd() { return m_read_port [PORT_D].bind(); } - auto write_portd() { return m_write_port[PORT_D].bind(); } - auto read_porte() { return m_read_port [PORT_E].bind(); } - auto write_porte() { return m_write_port[PORT_E].bind(); } - auto read_portf() { return m_read_port [PORT_F].bind(); } - auto write_portf() { return m_write_port[PORT_F].bind(); } - auto read_portg() { return m_read_port [PORT_G].bind(); } - auto write_portg() { return m_write_port[PORT_G].bind(); } - - auto tend0_cb() { return m_tend_cb[0].bind(); } - auto tend1_cb() { return m_tend_cb[1].bind(); } - - u8 syscr_r(); - void syscr_w(u8 data); - -protected: - required_device m_intc; - required_device m_adc; - optional_device m_dma; - optional_device m_dma0; - optional_device m_dma1; - required_device m_dtc; - required_device m_port1; - required_device m_port2; - required_device m_port3; - required_device m_port4; - required_device m_port5; - required_device m_port6; - required_device m_porta; - required_device m_portb; - required_device m_portc; - required_device m_portd; - required_device m_porte; - required_device m_portf; - required_device m_portg; - required_device m_timer8_0; - required_device m_timer8_1; - required_device m_timer16; - required_device m_timer16_0; - required_device m_timer16_1; - required_device m_timer16_2; - required_device m_timer16_3; - required_device m_timer16_4; - required_device m_timer16_5; - required_device m_watchdog; - - devcb_write_line::array<2> m_tend_cb; - - u32 m_ram_start; - u8 m_syscr; - - h8s2320_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u32 start); - - virtual bool exr_in_stack() const override; - virtual void update_irq_filter() override; - virtual void interrupt_taken() override; - virtual int trace_setup() override; - virtual int trapa_setup() override; - virtual void irq_setup() override; - virtual void internal_update(u64 current_time) override; - virtual void device_add_mconfig(machine_config &config) override; - void map(address_map &map); - - virtual void device_start() override; - virtual void device_reset() override; - virtual void execute_set_input(int inputnum, int state) override; -}; - -class h8s2321_device : public h8s2320_device { -public: - h8s2321_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); -}; - -class h8s2322_device : public h8s2320_device { -public: - h8s2322_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); -}; - -class h8s2323_device : public h8s2320_device { -public: - h8s2323_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); -}; - -class h8s2324_device : public h8s2320_device { -public: - h8s2324_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); -}; - -class h8s2326_device : public h8s2320_device { -public: - h8s2326_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); -}; - -class h8s2327_device : public h8s2320_device { -public: - h8s2327_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); -}; - -class h8s2328_device : public h8s2320_device { -public: - h8s2328_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); -}; - -class h8s2329_device : public h8s2320_device { -public: - h8s2329_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); -}; - -DECLARE_DEVICE_TYPE(H8S2320, h8s2320_device) -DECLARE_DEVICE_TYPE(H8S2321, h8s2321_device) -DECLARE_DEVICE_TYPE(H8S2322, h8s2322_device) -DECLARE_DEVICE_TYPE(H8S2323, h8s2323_device) -DECLARE_DEVICE_TYPE(H8S2324, h8s2324_device) -DECLARE_DEVICE_TYPE(H8S2326, h8s2326_device) -DECLARE_DEVICE_TYPE(H8S2327, h8s2327_device) -DECLARE_DEVICE_TYPE(H8S2328, h8s2328_device) -DECLARE_DEVICE_TYPE(H8S2329, h8s2329_device) - -#endif // MAME_CPU_H8_H8S2320_H diff --git a/src/devices/cpu/h8/h8s2329.cpp b/src/devices/cpu/h8/h8s2329.cpp new file mode 100644 index 00000000000..f816a6ba4d6 --- /dev/null +++ b/src/devices/cpu/h8/h8s2329.cpp @@ -0,0 +1,173 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert +/*************************************************************************** + + h8s2329.cpp + + H8S-2329 family emulation + Subdevice of h8s2319.cpp + +***************************************************************************/ + +#include "emu.h" +#include "h8s2329.h" + +DEFINE_DEVICE_TYPE(H8S2320, h8s2320_device, "h8s2320", "Hitachi H8S/2320") +DEFINE_DEVICE_TYPE(H8S2321, h8s2321_device, "h8s2321", "Hitachi H8S/2321") +DEFINE_DEVICE_TYPE(H8S2322, h8s2322_device, "h8s2322", "Hitachi H8S/2322") +DEFINE_DEVICE_TYPE(H8S2323, h8s2323_device, "h8s2323", "Hitachi H8S/2323") +DEFINE_DEVICE_TYPE(H8S2324, h8s2324_device, "h8s2324", "Hitachi H8S/2324") +DEFINE_DEVICE_TYPE(H8S2326, h8s2326_device, "h8s2326", "Hitachi H8S/2326") +DEFINE_DEVICE_TYPE(H8S2327, h8s2327_device, "h8s2327", "Hitachi H8S/2327") +DEFINE_DEVICE_TYPE(H8S2328, h8s2328_device, "h8s2328", "Hitachi H8S/2328") +DEFINE_DEVICE_TYPE(H8S2329, h8s2329_device, "h8s2329", "Hitachi H8S/2329") + + +h8s2321_device::h8s2321_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, address_map_constructor map_delegate, u32 start) : + h8s2319_device(mconfig, type, tag, owner, clock, map_delegate, start), + m_port5(*this, "port5"), + m_port6(*this, "port6") +{ +} + +h8s2321_device::h8s2321_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + h8s2321_device(mconfig, H8S2321, tag, owner, clock, address_map_constructor(FUNC(h8s2321_device::map_2321), this), 0xffec00) +{ +} + + +h8s2320_device::h8s2320_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u32 start) : + h8s2321_device(mconfig, type, tag, owner, clock, address_map_constructor(FUNC(h8s2320_device::map_2320), this), start), + m_dma(*this, "dma"), + m_dmac(*this, "dma:%u", 0), + m_tend_cb(*this) +{ +} + +h8s2320_device::h8s2320_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + h8s2320_device(mconfig, H8S2320, tag, owner, clock, 0xffec00) +{ +} + + +h8s2322_device::h8s2322_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + h8s2320_device(mconfig, H8S2322, tag, owner, clock, 0xffdc00) +{ +} + +h8s2323_device::h8s2323_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + h8s2320_device(mconfig, H8S2323, tag, owner, clock, 0xffdc00) +{ +} + +h8s2324_device::h8s2324_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + h8s2320_device(mconfig, H8S2324, tag, owner, clock, 0xff7c00) +{ +} + +h8s2326_device::h8s2326_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + h8s2320_device(mconfig, H8S2326, tag, owner, clock, 0xffdc00) +{ +} + +h8s2327_device::h8s2327_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + h8s2320_device(mconfig, H8S2327, tag, owner, clock, 0xffdc00) +{ +} + +h8s2328_device::h8s2328_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + h8s2320_device(mconfig, H8S2328, tag, owner, clock, 0xffdc00) +{ +} + +h8s2329_device::h8s2329_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + h8s2320_device(mconfig, H8S2329, tag, owner, clock, 0xff7c00) +{ +} + +void h8s2321_device::map_2321(address_map &map) +{ + h8s2319_device::map(map); + + map(0xfffeb4, 0xfffeb4).w(m_port5, FUNC(h8_port_device::ddr_w)); + map(0xfffeb5, 0xfffeb5).w(m_port6, FUNC(h8_port_device::ddr_w)); + + map(0xffff30, 0xffff35).rw(m_dtc, FUNC(h8_dtc_device::dtcer_r), FUNC(h8_dtc_device::dtcer_w)); + + map(0xffff54, 0xffff54).r(m_port5, FUNC(h8_port_device::port_r)); + map(0xffff55, 0xffff55).r(m_port6, FUNC(h8_port_device::port_r)); + map(0xffff64, 0xffff64).rw(m_port5, FUNC(h8_port_device::dr_r), FUNC(h8_port_device::dr_w)); + map(0xffff65, 0xffff65).rw(m_port6, FUNC(h8_port_device::dr_r), FUNC(h8_port_device::dr_w)); + + map(0xffff88, 0xffff88).rw(m_sci[2], FUNC(h8_sci_device::smr_r), FUNC(h8_sci_device::smr_w)); + map(0xffff89, 0xffff89).rw(m_sci[2], FUNC(h8_sci_device::brr_r), FUNC(h8_sci_device::brr_w)); + map(0xffff8a, 0xffff8a).rw(m_sci[2], FUNC(h8_sci_device::scr_r), FUNC(h8_sci_device::scr_w)); + map(0xffff8b, 0xffff8b).rw(m_sci[2], FUNC(h8_sci_device::tdr_r), FUNC(h8_sci_device::tdr_w)); + map(0xffff8c, 0xffff8c).rw(m_sci[2], FUNC(h8_sci_device::ssr_r), FUNC(h8_sci_device::ssr_w)); + map(0xffff8d, 0xffff8d).r(m_sci[2], FUNC(h8_sci_device::rdr_r)); + map(0xffff8e, 0xffff8e).rw(m_sci[2], FUNC(h8_sci_device::scmr_r), FUNC(h8_sci_device::scmr_w)); +} + +void h8s2320_device::map_2320(address_map &map) +{ + map_2321(map); + + map(0xfffee0, 0xfffee1).rw(m_dmac[0], FUNC(h8s_dma_channel_device::marah_r), FUNC(h8s_dma_channel_device::marah_w)); + map(0xfffee2, 0xfffee3).rw(m_dmac[0], FUNC(h8s_dma_channel_device::maral_r), FUNC(h8s_dma_channel_device::maral_w)); + map(0xfffee4, 0xfffee5).rw(m_dmac[0], FUNC(h8s_dma_channel_device::ioara_r), FUNC(h8s_dma_channel_device::ioara_w)); + map(0xfffee6, 0xfffee7).rw(m_dmac[0], FUNC(h8s_dma_channel_device::etcra_r), FUNC(h8s_dma_channel_device::etcra_w)); + map(0xfffee8, 0xfffee9).rw(m_dmac[0], FUNC(h8s_dma_channel_device::marbh_r), FUNC(h8s_dma_channel_device::marbh_w)); + map(0xfffeea, 0xfffeeb).rw(m_dmac[0], FUNC(h8s_dma_channel_device::marbl_r), FUNC(h8s_dma_channel_device::marbl_w)); + map(0xfffeec, 0xfffeed).rw(m_dmac[0], FUNC(h8s_dma_channel_device::ioarb_r), FUNC(h8s_dma_channel_device::ioarb_w)); + map(0xfffeee, 0xfffeef).rw(m_dmac[0], FUNC(h8s_dma_channel_device::etcrb_r), FUNC(h8s_dma_channel_device::etcrb_w)); + map(0xfffef0, 0xfffef1).rw(m_dmac[1], FUNC(h8s_dma_channel_device::marah_r), FUNC(h8s_dma_channel_device::marah_w)); + map(0xfffef2, 0xfffef3).rw(m_dmac[1], FUNC(h8s_dma_channel_device::maral_r), FUNC(h8s_dma_channel_device::maral_w)); + map(0xfffef4, 0xfffef5).rw(m_dmac[1], FUNC(h8s_dma_channel_device::ioara_r), FUNC(h8s_dma_channel_device::ioara_w)); + map(0xfffef6, 0xfffef7).rw(m_dmac[1], FUNC(h8s_dma_channel_device::etcra_r), FUNC(h8s_dma_channel_device::etcra_w)); + map(0xfffef8, 0xfffef9).rw(m_dmac[1], FUNC(h8s_dma_channel_device::marbh_r), FUNC(h8s_dma_channel_device::marbh_w)); + map(0xfffefa, 0xfffefb).rw(m_dmac[1], FUNC(h8s_dma_channel_device::marbl_r), FUNC(h8s_dma_channel_device::marbl_w)); + map(0xfffefc, 0xfffefd).rw(m_dmac[1], FUNC(h8s_dma_channel_device::ioarb_r), FUNC(h8s_dma_channel_device::ioarb_w)); + map(0xfffefe, 0xfffeff).rw(m_dmac[1], FUNC(h8s_dma_channel_device::etcrb_r), FUNC(h8s_dma_channel_device::etcrb_w)); + map(0xffff00, 0xffff00).rw(m_dma, FUNC(h8s_dma_device::dmawer_r), FUNC(h8s_dma_device::dmawer_w)); + map(0xffff01, 0xffff01).rw(m_dma, FUNC(h8s_dma_device::dmatcr_r), FUNC(h8s_dma_device::dmatcr_w)); + map(0xffff02, 0xffff03).rw(m_dmac[0], FUNC(h8s_dma_channel_device::dmacr_r), FUNC(h8s_dma_channel_device::dmacr_w)); + map(0xffff04, 0xffff05).rw(m_dmac[1], FUNC(h8s_dma_channel_device::dmacr_r), FUNC(h8s_dma_channel_device::dmacr_w)); + map(0xffff06, 0xffff07).rw(m_dma, FUNC(h8s_dma_device::dmabcr_r), FUNC(h8s_dma_device::dmabcr_w)); +} + +void h8s2321_device::device_add_mconfig(machine_config &config) +{ + h8s2319_device::device_add_mconfig(config); + + H8_PORT(config, m_port5, *this, h8_device::PORT_5, 0x00, 0xf0); + H8_PORT(config, m_port6, *this, h8_device::PORT_6, 0x00, 0x00); + H8_PORT(config.replace(), m_porta[0], *this, h8_device::PORT_A, 0x00, 0x00); + + H8_SCI(config, m_sci[2], 2, *this, m_intc, 88, 89, 90, 91); +} + +void h8s2320_device::device_add_mconfig(machine_config &config) +{ + h8s2321_device::device_add_mconfig(config); + + H8S_DMA(config, m_dma, *this); + H8S_DMA_CHANNEL(config, m_dmac[0], *this, m_dma, m_intc); + H8S_DMA_CHANNEL(config, m_dmac[1], *this, m_dma, m_intc); +} + +void h8s2320_device::execute_set_input(int inputnum, int state) +{ + // TEND and DREQ pins are not supported on H8S/2321 + if(inputnum == H8_INPUT_LINE_TEND0 || inputnum == H8_INPUT_LINE_TEND1) + m_tend_cb[inputnum - H8_INPUT_LINE_TEND0](state); + else if(inputnum == H8_INPUT_LINE_DREQ0 || inputnum == H8_INPUT_LINE_DREQ1) + m_dma->set_input(inputnum, state); + else + h8s2319_device::execute_set_input(inputnum, state); +} + +void h8s2320_device::device_start() +{ + h8s2319_device::device_start(); + m_dma_device = m_dma; +} diff --git a/src/devices/cpu/h8/h8s2329.h b/src/devices/cpu/h8/h8s2329.h new file mode 100644 index 00000000000..a03755f3e16 --- /dev/null +++ b/src/devices/cpu/h8/h8s2329.h @@ -0,0 +1,120 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert +/*************************************************************************** + + h8s2329.h + + H8S-2329 family emulation + (compared to H8S-2319 family: adds DMA, 1 more SCI) + + H8S/2000-based mcus. + + Variant ROM RAM note + H8S/2320 - 4K + H8S/2321 - 4K no DMA + H8S/2322 - 8K + H8S/2323 32K 8K + H8S/2324 - 32K + H8S/2326 512K 8K + H8S/2327 128K 8K + H8S/2328 256K 8K + H8S/2329 384K 32K + +***************************************************************************/ + +#ifndef MAME_CPU_H8_H8S2329_H +#define MAME_CPU_H8_H8S2329_H + +#pragma once + +#include "h8s2319.h" +#include "h8_dma.h" + +class h8s2321_device : public h8s2319_device { +public: + h8s2321_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + // see h8s2319.h for more + auto read_port5() { return m_read_port [PORT_5].bind(); } + auto write_port5() { return m_write_port[PORT_5].bind(); } + auto read_port6() { return m_read_port [PORT_6].bind(); } + auto write_port6() { return m_write_port[PORT_6].bind(); } + +protected: + h8s2321_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, address_map_constructor map_delegate, u32 start); + + required_device m_port5; + required_device m_port6; + + virtual void device_add_mconfig(machine_config &config) override; + void map_2321(address_map &map); +}; + +class h8s2320_device : public h8s2321_device { +public: + h8s2320_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + auto tend0_cb() { return m_tend_cb[0].bind(); } + auto tend1_cb() { return m_tend_cb[1].bind(); } + +protected: + required_device m_dma; + required_device_array m_dmac; + + devcb_write_line::array<2> m_tend_cb; + + h8s2320_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u32 start); + + virtual void device_add_mconfig(machine_config &config) override; + void map_2320(address_map &map); + + virtual void device_start() override; + virtual void execute_set_input(int inputnum, int state) override; +}; + +class h8s2322_device : public h8s2320_device { +public: + h8s2322_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); +}; + +class h8s2323_device : public h8s2320_device { +public: + h8s2323_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); +}; + +class h8s2324_device : public h8s2320_device { +public: + h8s2324_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); +}; + +class h8s2326_device : public h8s2320_device { +public: + h8s2326_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); +}; + +class h8s2327_device : public h8s2320_device { +public: + h8s2327_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); +}; + +class h8s2328_device : public h8s2320_device { +public: + h8s2328_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); +}; + +class h8s2329_device : public h8s2320_device { +public: + h8s2329_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); +}; + +DECLARE_DEVICE_TYPE(H8S2320, h8s2320_device) +DECLARE_DEVICE_TYPE(H8S2321, h8s2321_device) +DECLARE_DEVICE_TYPE(H8S2322, h8s2322_device) +DECLARE_DEVICE_TYPE(H8S2323, h8s2323_device) +DECLARE_DEVICE_TYPE(H8S2324, h8s2324_device) +DECLARE_DEVICE_TYPE(H8S2326, h8s2326_device) +DECLARE_DEVICE_TYPE(H8S2327, h8s2327_device) +DECLARE_DEVICE_TYPE(H8S2328, h8s2328_device) +DECLARE_DEVICE_TYPE(H8S2329, h8s2329_device) + +#endif // MAME_CPU_H8_H8S2329_H diff --git a/src/devices/cpu/h8/h8s2357.cpp b/src/devices/cpu/h8/h8s2357.cpp index 73a9a8f06ea..50bb908f0d9 100644 --- a/src/devices/cpu/h8/h8s2357.cpp +++ b/src/devices/cpu/h8/h8s2357.cpp @@ -249,63 +249,63 @@ void h8s2357_device::device_add_mconfig(machine_config &config) H8_PORT(config, m_porte, *this, h8_device::PORT_E, 0x00, 0x00); H8_PORT(config, m_portf, *this, h8_device::PORT_F, 0x00, 0x00); H8_PORT(config, m_portg, *this, h8_device::PORT_G, 0xe0, 0xe0); - H8H_TIMER8_CHANNEL(config, m_timer8_0, *this, m_intc, 64, 65, 66, m_timer8_1, h8_timer8_channel_device::CHAIN_OVERFLOW, true, false); - H8H_TIMER8_CHANNEL(config, m_timer8_1, *this, m_intc, 68, 69, 70, m_timer8_0, h8_timer8_channel_device::CHAIN_A, false, false); + H8H_TIMER8_CHANNEL(config, m_timer8_0, *this, m_intc, 64, 65, 66, m_timer8_1, h8_timer8_channel_device::CHAIN_OVERFLOW, true, false); + H8H_TIMER8_CHANNEL(config, m_timer8_1, *this, m_intc, 68, 69, 70, m_timer8_0, h8_timer8_channel_device::CHAIN_A, false, false); H8_TIMER16(config, m_timer16, *this, 6, 0x00); H8S_TIMER16_CHANNEL(config, m_timer16_0, *this, 4, 0x60, m_intc, 32, - h8_timer16_channel_device::DIV_1, - h8_timer16_channel_device::DIV_4, - h8_timer16_channel_device::DIV_16, - h8_timer16_channel_device::DIV_64, - h8_timer16_channel_device::INPUT_A, - h8_timer16_channel_device::INPUT_B, - h8_timer16_channel_device::INPUT_C, - h8_timer16_channel_device::INPUT_D); + h8_timer16_channel_device::DIV_1, + h8_timer16_channel_device::DIV_4, + h8_timer16_channel_device::DIV_16, + h8_timer16_channel_device::DIV_64, + h8_timer16_channel_device::INPUT_A, + h8_timer16_channel_device::INPUT_B, + h8_timer16_channel_device::INPUT_C, + h8_timer16_channel_device::INPUT_D); H8S_TIMER16_CHANNEL(config, m_timer16_1, *this, 2, 0x4c, m_intc, 40, - h8_timer16_channel_device::DIV_1, - h8_timer16_channel_device::DIV_4, - h8_timer16_channel_device::DIV_16, - h8_timer16_channel_device::DIV_64, - h8_timer16_channel_device::INPUT_A, - h8_timer16_channel_device::INPUT_B, - h8_timer16_channel_device::DIV_256, - h8_timer16_channel_device::CHAIN).set_chain(m_timer16_2); + h8_timer16_channel_device::DIV_1, + h8_timer16_channel_device::DIV_4, + h8_timer16_channel_device::DIV_16, + h8_timer16_channel_device::DIV_64, + h8_timer16_channel_device::INPUT_A, + h8_timer16_channel_device::INPUT_B, + h8_timer16_channel_device::DIV_256, + h8_timer16_channel_device::CHAIN).set_chain(m_timer16_2); H8S_TIMER16_CHANNEL(config, m_timer16_2, *this, 2, 0x4c, m_intc, 44, - h8_timer16_channel_device::DIV_1, - h8_timer16_channel_device::DIV_4, - h8_timer16_channel_device::DIV_16, - h8_timer16_channel_device::DIV_64, - h8_timer16_channel_device::INPUT_A, - h8_timer16_channel_device::INPUT_B, - h8_timer16_channel_device::INPUT_C, - h8_timer16_channel_device::DIV_1024); + h8_timer16_channel_device::DIV_1, + h8_timer16_channel_device::DIV_4, + h8_timer16_channel_device::DIV_16, + h8_timer16_channel_device::DIV_64, + h8_timer16_channel_device::INPUT_A, + h8_timer16_channel_device::INPUT_B, + h8_timer16_channel_device::INPUT_C, + h8_timer16_channel_device::DIV_1024); H8S_TIMER16_CHANNEL(config, m_timer16_3, *this, 4, 0x60, m_intc, 48, - h8_timer16_channel_device::DIV_1, - h8_timer16_channel_device::DIV_4, - h8_timer16_channel_device::DIV_16, - h8_timer16_channel_device::DIV_64, - h8_timer16_channel_device::INPUT_A, - h8_timer16_channel_device::DIV_1024, - h8_timer16_channel_device::DIV_256, - h8_timer16_channel_device::DIV_4096); + h8_timer16_channel_device::DIV_1, + h8_timer16_channel_device::DIV_4, + h8_timer16_channel_device::DIV_16, + h8_timer16_channel_device::DIV_64, + h8_timer16_channel_device::INPUT_A, + h8_timer16_channel_device::DIV_1024, + h8_timer16_channel_device::DIV_256, + h8_timer16_channel_device::DIV_4096); H8S_TIMER16_CHANNEL(config, m_timer16_4, *this, 2, 0x4c, m_intc, 56, - h8_timer16_channel_device::DIV_1, - h8_timer16_channel_device::DIV_4, - h8_timer16_channel_device::DIV_16, - h8_timer16_channel_device::DIV_64, - h8_timer16_channel_device::INPUT_A, - h8_timer16_channel_device::INPUT_C, - h8_timer16_channel_device::DIV_1024, - h8_timer16_channel_device::CHAIN).set_chain(m_timer16_5); + h8_timer16_channel_device::DIV_1, + h8_timer16_channel_device::DIV_4, + h8_timer16_channel_device::DIV_16, + h8_timer16_channel_device::DIV_64, + h8_timer16_channel_device::INPUT_A, + h8_timer16_channel_device::INPUT_C, + h8_timer16_channel_device::DIV_1024, + h8_timer16_channel_device::CHAIN).set_chain(m_timer16_5); H8S_TIMER16_CHANNEL(config, m_timer16_5, *this, 2, 0x4c, m_intc, 60, - h8_timer16_channel_device::DIV_1, - h8_timer16_channel_device::DIV_4, - h8_timer16_channel_device::DIV_16, - h8_timer16_channel_device::DIV_64, - h8_timer16_channel_device::INPUT_A, - h8_timer16_channel_device::INPUT_C, - h8_timer16_channel_device::DIV_256, - h8_timer16_channel_device::INPUT_D); + h8_timer16_channel_device::DIV_1, + h8_timer16_channel_device::DIV_4, + h8_timer16_channel_device::DIV_16, + h8_timer16_channel_device::DIV_64, + h8_timer16_channel_device::INPUT_A, + h8_timer16_channel_device::INPUT_C, + h8_timer16_channel_device::DIV_256, + h8_timer16_channel_device::INPUT_D); H8_SCI(config, m_sci[0], 0, *this, m_intc, 80, 81, 82, 83); H8_SCI(config, m_sci[1], 1, *this, m_intc, 84, 85, 86, 87); H8_SCI(config, m_sci[2], 2, *this, m_intc, 88, 89, 90, 91); diff --git a/src/devices/cpu/h8/h8s2655.cpp b/src/devices/cpu/h8/h8s2655.cpp index ba2423ce859..d6657ff3ce3 100644 --- a/src/devices/cpu/h8/h8s2655.cpp +++ b/src/devices/cpu/h8/h8s2655.cpp @@ -228,63 +228,63 @@ void h8s2655_device::device_add_mconfig(machine_config &config) H8_PORT(config, m_porte, *this, h8_device::PORT_E, 0x00, 0x00); H8_PORT(config, m_portf, *this, h8_device::PORT_F, 0x00, 0x00); H8_PORT(config, m_portg, *this, h8_device::PORT_G, 0xe0, 0xe0); - H8H_TIMER8_CHANNEL(config, m_timer8_0, *this, m_intc, 64, 65, 66, m_timer8_1, h8_timer8_channel_device::CHAIN_OVERFLOW, true, false); - H8H_TIMER8_CHANNEL(config, m_timer8_1, *this, m_intc, 68, 69, 70, m_timer8_0, h8_timer8_channel_device::CHAIN_A, false, false); + H8H_TIMER8_CHANNEL(config, m_timer8_0, *this, m_intc, 64, 65, 66, m_timer8_1, h8_timer8_channel_device::CHAIN_OVERFLOW, true, false); + H8H_TIMER8_CHANNEL(config, m_timer8_1, *this, m_intc, 68, 69, 70, m_timer8_0, h8_timer8_channel_device::CHAIN_A, false, false); H8_TIMER16(config, m_timer16, *this, 6, 0x00); H8S_TIMER16_CHANNEL(config, m_timer16_0, *this, 4, 0x60, m_intc, 32, - h8_timer16_channel_device::DIV_1, - h8_timer16_channel_device::DIV_4, - h8_timer16_channel_device::DIV_16, - h8_timer16_channel_device::DIV_64, - h8_timer16_channel_device::INPUT_A, - h8_timer16_channel_device::INPUT_B, - h8_timer16_channel_device::INPUT_C, - h8_timer16_channel_device::INPUT_D); + h8_timer16_channel_device::DIV_1, + h8_timer16_channel_device::DIV_4, + h8_timer16_channel_device::DIV_16, + h8_timer16_channel_device::DIV_64, + h8_timer16_channel_device::INPUT_A, + h8_timer16_channel_device::INPUT_B, + h8_timer16_channel_device::INPUT_C, + h8_timer16_channel_device::INPUT_D); H8S_TIMER16_CHANNEL(config, m_timer16_1, *this, 2, 0x4c, m_intc, 40, - h8_timer16_channel_device::DIV_1, - h8_timer16_channel_device::DIV_4, - h8_timer16_channel_device::DIV_16, - h8_timer16_channel_device::DIV_64, - h8_timer16_channel_device::INPUT_A, - h8_timer16_channel_device::INPUT_B, - h8_timer16_channel_device::DIV_256, - h8_timer16_channel_device::CHAIN).set_chain(m_timer16_2); + h8_timer16_channel_device::DIV_1, + h8_timer16_channel_device::DIV_4, + h8_timer16_channel_device::DIV_16, + h8_timer16_channel_device::DIV_64, + h8_timer16_channel_device::INPUT_A, + h8_timer16_channel_device::INPUT_B, + h8_timer16_channel_device::DIV_256, + h8_timer16_channel_device::CHAIN).set_chain(m_timer16_2); H8S_TIMER16_CHANNEL(config, m_timer16_2, *this, 2, 0x4c, m_intc, 44, - h8_timer16_channel_device::DIV_1, - h8_timer16_channel_device::DIV_4, - h8_timer16_channel_device::DIV_16, - h8_timer16_channel_device::DIV_64, - h8_timer16_channel_device::INPUT_A, - h8_timer16_channel_device::INPUT_B, - h8_timer16_channel_device::INPUT_C, - h8_timer16_channel_device::DIV_1024); + h8_timer16_channel_device::DIV_1, + h8_timer16_channel_device::DIV_4, + h8_timer16_channel_device::DIV_16, + h8_timer16_channel_device::DIV_64, + h8_timer16_channel_device::INPUT_A, + h8_timer16_channel_device::INPUT_B, + h8_timer16_channel_device::INPUT_C, + h8_timer16_channel_device::DIV_1024); H8S_TIMER16_CHANNEL(config, m_timer16_3, *this, 4, 0x60, m_intc, 48, - h8_timer16_channel_device::DIV_1, - h8_timer16_channel_device::DIV_4, - h8_timer16_channel_device::DIV_16, - h8_timer16_channel_device::DIV_64, - h8_timer16_channel_device::INPUT_A, - h8_timer16_channel_device::DIV_1024, - h8_timer16_channel_device::DIV_256, - h8_timer16_channel_device::DIV_4096); + h8_timer16_channel_device::DIV_1, + h8_timer16_channel_device::DIV_4, + h8_timer16_channel_device::DIV_16, + h8_timer16_channel_device::DIV_64, + h8_timer16_channel_device::INPUT_A, + h8_timer16_channel_device::DIV_1024, + h8_timer16_channel_device::DIV_256, + h8_timer16_channel_device::DIV_4096); H8S_TIMER16_CHANNEL(config, m_timer16_4, *this, 2, 0x4c, m_intc, 56, - h8_timer16_channel_device::DIV_1, - h8_timer16_channel_device::DIV_4, - h8_timer16_channel_device::DIV_16, - h8_timer16_channel_device::DIV_64, - h8_timer16_channel_device::INPUT_A, - h8_timer16_channel_device::INPUT_C, - h8_timer16_channel_device::DIV_1024, - h8_timer16_channel_device::CHAIN).set_chain(m_timer16_5); + h8_timer16_channel_device::DIV_1, + h8_timer16_channel_device::DIV_4, + h8_timer16_channel_device::DIV_16, + h8_timer16_channel_device::DIV_64, + h8_timer16_channel_device::INPUT_A, + h8_timer16_channel_device::INPUT_C, + h8_timer16_channel_device::DIV_1024, + h8_timer16_channel_device::CHAIN).set_chain(m_timer16_5); H8S_TIMER16_CHANNEL(config, m_timer16_5, *this, 2, 0x4c, m_intc, 60, - h8_timer16_channel_device::DIV_1, - h8_timer16_channel_device::DIV_4, - h8_timer16_channel_device::DIV_16, - h8_timer16_channel_device::DIV_64, - h8_timer16_channel_device::INPUT_A, - h8_timer16_channel_device::INPUT_C, - h8_timer16_channel_device::DIV_256, - h8_timer16_channel_device::INPUT_D); + h8_timer16_channel_device::DIV_1, + h8_timer16_channel_device::DIV_4, + h8_timer16_channel_device::DIV_16, + h8_timer16_channel_device::DIV_64, + h8_timer16_channel_device::INPUT_A, + h8_timer16_channel_device::INPUT_C, + h8_timer16_channel_device::DIV_256, + h8_timer16_channel_device::INPUT_D); H8_SCI(config, m_sci[0], 0, *this, m_intc, 80, 81, 82, 83); H8_SCI(config, m_sci[1], 1, *this, m_intc, 84, 85, 86, 87); H8_SCI(config, m_sci[2], 2, *this, m_intc, 88, 89, 90, 91); diff --git a/src/mame/cybiko/cybiko.h b/src/mame/cybiko/cybiko.h index 4be92ca6f84..d7f865b77cf 100644 --- a/src/mame/cybiko/cybiko.h +++ b/src/mame/cybiko/cybiko.h @@ -20,7 +20,7 @@ #include "bus/rs232/rs232.h" #include "cpu/h8/h8s2245.h" -#include "cpu/h8/h8s2320.h" +#include "cpu/h8/h8s2329.h" #include "imagedev/snapquik.h" diff --git a/src/mame/korg/microkorg.cpp b/src/mame/korg/microkorg.cpp index 4d69500f29a..0cd0595471a 100644 --- a/src/mame/korg/microkorg.cpp +++ b/src/mame/korg/microkorg.cpp @@ -9,7 +9,7 @@ ****************************************************************************/ #include "emu.h" -#include "cpu/h8/h8s2320.h" +#include "cpu/h8/h8s2329.h" #include "machine/intelfsh.h" diff --git a/src/mame/layout/novag_mentor16.lay b/src/mame/layout/novag_mentor16.lay index 8ff15f4b77b..eed791d85e5 100644 --- a/src/mame/layout/novag_mentor16.lay +++ b/src/mame/layout/novag_mentor16.lay @@ -377,9 +377,9 @@ authors:hap - + - + @@ -413,40 +413,33 @@ authors:hap - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - + + - - + + - - - - - - - @@ -484,14 +477,14 @@ authors:hap - - - - - - - - + + + + + + + + @@ -504,14 +497,41 @@ authors:hap - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/novadesitec/novadesitec_fr004.cpp b/src/mame/novadesitec/novadesitec_fr004.cpp index 969ef00e040..58204f9691d 100644 --- a/src/mame/novadesitec/novadesitec_fr004.cpp +++ b/src/mame/novadesitec/novadesitec_fr004.cpp @@ -19,7 +19,7 @@ Not much can be done until the MCU is somehow dumped. #include "emu.h" -#include "cpu/h8/h8s2320.h" +#include "cpu/h8/h8s2319.h" #include "sound/okim6376.h" #include "screen.h" @@ -92,7 +92,7 @@ INPUT_PORTS_END void novadesitec_fr004_state::fr004(machine_config &config) { // basic machine hardware - H8S2328(config, m_maincpu, 50_MHz_XTAL); // actually H8S2318, divisor? + H8S2318(config, m_maincpu, 50_MHz_XTAL); // divisor? m_maincpu->set_addrmap(AS_PROGRAM, &novadesitec_fr004_state::main_map); // video hardware diff --git a/src/mame/novadesitec/novadesitec_fr009.cpp b/src/mame/novadesitec/novadesitec_fr009.cpp index 77739fc79e3..20dd6f584da 100644 --- a/src/mame/novadesitec/novadesitec_fr009.cpp +++ b/src/mame/novadesitec/novadesitec_fr009.cpp @@ -19,7 +19,7 @@ Not much can be done until the MCU is somehow dumped. #include "emu.h" -#include "cpu/h8/h8s2320.h" +#include "cpu/h8/h8s2319.h" #include "screen.h" #include "speaker.h" @@ -91,7 +91,7 @@ INPUT_PORTS_END void novadesitec_fr009_state::fr009(machine_config &config) { // basic machine hardware - H8S2328(config, m_maincpu, 32_MHz_XTAL); // actually H8S2318, divisor? + H8S2318(config, m_maincpu, 32_MHz_XTAL); // divisor? m_maincpu->set_addrmap(AS_PROGRAM, &novadesitec_fr009_state::main_map); // video hardware diff --git a/src/mame/novag/mentor16.cpp b/src/mame/novag/mentor16.cpp index 5e8db50f628..1076df1cd99 100644 --- a/src/mame/novag/mentor16.cpp +++ b/src/mame/novag/mentor16.cpp @@ -179,19 +179,18 @@ void mentor16_state::update_piezo(s32 param) void mentor16_state::p2_w(u8 data) { // P20-P27: input mux, led data - m_inp_mux = bitswap<8>(~data,0,1,2,3,4,5,6,7); - m_led_pwm->write_mx(m_inp_mux); + m_inp_mux = ~data; + m_led_pwm->write_mx(~data); } u8 mentor16_state::p5_r() { - // P50-P57: read chessboard u8 data = 0; - // read chessboard + // P50-P57: read chessboard for (int i = 0; i < 8; i++) if (BIT(m_inp_mux, i)) - data |= m_board->read_rank(i); + data |= m_board->read_rank(i ^ 7); return ~data; } @@ -231,24 +230,24 @@ void mentor16_state::p6_w(u8 data) static INPUT_PORTS_START( mentor16 ) PORT_START("IN.0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_1) PORT_NAME("Take Back") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_2) PORT_NAME("Set Level") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_3) PORT_NAME("Autoplay / Pawn") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_4) PORT_NAME("Depth Search / Rook") - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_5) PORT_NAME("Solve Mate / Knight") - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_6) PORT_NAME("Sound / Bishop") - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_7) PORT_NAME("Random / Queen") - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_8) PORT_NAME("Player/Player / King") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_8) PORT_NAME("Player/Player / King") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_7) PORT_NAME("Random / Queen") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_6) PORT_NAME("Sound / Bishop") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_5) PORT_NAME("Solve Mate / Knight") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_4) PORT_NAME("Depth Search / Rook") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_3) PORT_NAME("Autoplay / Pawn") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_2) PORT_NAME("Set Level") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_1) PORT_NAME("Take Back") PORT_START("IN.1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Q) PORT_NAME("Go") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_W) PORT_NAME("Hint / Show Moves") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_E) PORT_NAME("Move Time") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_R) PORT_NAME("Acc. Time") - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_T) PORT_NAME("Clear Board") - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Y) PORT_NAME("Change Color") - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_U) PORT_NAME("Set Up / Verify") - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_I) PORT_CODE(KEYCODE_N) PORT_NAME("New Game") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_I) PORT_CODE(KEYCODE_N) PORT_NAME("New Game") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_U) PORT_NAME("Set Up / Verify") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Y) PORT_NAME("Change Color") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_T) PORT_NAME("Clear Board") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_R) PORT_NAME("Acc. Time") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_E) PORT_NAME("Move Time") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_W) PORT_NAME("Hint / Show Moves") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Q) PORT_NAME("Go") PORT_START("POWER") // needs to be triggered for nvram to work PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_CODE(KEYCODE_F1) PORT_CHANGED_MEMBER(DEVICE_SELF, mentor16_state, power_off, 0) PORT_NAME("Power Off") diff --git a/src/mame/seta/seta2.cpp b/src/mame/seta/seta2.cpp index b409a195a2c..3df4e7d4478 100644 --- a/src/mame/seta/seta2.cpp +++ b/src/mame/seta/seta2.cpp @@ -86,7 +86,6 @@ wschampb: funcube series: - Hacked to run, as they use a ColdFire CPU. - Pay-out key causes "unknown error" after coin count reaches 0. -- Keeps getting H8 internal watchdog resets, which causes unresponsive touchscreen. ***************************************************************************/