From f9de60c4354ef27d8ca7c7922668511a7f2426e9 Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Sun, 17 Dec 2023 19:57:09 +0100 Subject: sh: start adding the sh7042 --- scripts/src/cpu.lua | 2 ++ src/devices/cpu/sh/sh7042.cpp | 29 +++++++++++++++++++++++++++++ src/devices/cpu/sh/sh7042.h | 28 ++++++++++++++++++++++++++++ src/mame/yamaha/ympsr540.cpp | 18 +++++++++++++++--- 4 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 src/devices/cpu/sh/sh7042.cpp create mode 100644 src/devices/cpu/sh/sh7042.h diff --git a/scripts/src/cpu.lua b/scripts/src/cpu.lua index 2e76666aee0..5d691418f08 100644 --- a/scripts/src/cpu.lua +++ b/scripts/src/cpu.lua @@ -891,6 +891,8 @@ if CPUS["SH"] then MAME_DIR .. "src/devices/cpu/sh/sh7021.h", MAME_DIR .. "src/devices/cpu/sh/sh7032.cpp", MAME_DIR .. "src/devices/cpu/sh/sh7032.h", + MAME_DIR .. "src/devices/cpu/sh/sh7042.cpp", + MAME_DIR .. "src/devices/cpu/sh/sh7042.h", MAME_DIR .. "src/devices/cpu/sh/sh7604_bus.cpp", MAME_DIR .. "src/devices/cpu/sh/sh7604_bus.h", MAME_DIR .. "src/devices/cpu/sh/sh7604_sci.cpp", diff --git a/src/devices/cpu/sh/sh7042.cpp b/src/devices/cpu/sh/sh7042.cpp new file mode 100644 index 00000000000..7c3f7d2fba1 --- /dev/null +++ b/src/devices/cpu/sh/sh7042.cpp @@ -0,0 +1,29 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert + +// SH7042, sh2 variant + +#include "emu.h" +#include "sh7042.h" + +DEFINE_DEVICE_TYPE(SH7042, sh7042_device, "sh7042", "Hitachi SH-2 (SH7042)") + +sh7042_device::sh7042_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + sh2_device(mconfig, SH7042, tag, owner, clock, CPU_TYPE_SH2, address_map_constructor(FUNC(sh7042_device::map), this), 32, 0xffffffff) +{ +} + +void sh7042_device::device_start() +{ + sh2_device::device_start(); +} + +void sh7042_device::device_reset() +{ + sh2_device::device_reset(); +} + +void sh7042_device::map(address_map &map) +{ + map(0xfffff000, 0xffffffff).ram(); +} diff --git a/src/devices/cpu/sh/sh7042.h b/src/devices/cpu/sh/sh7042.h new file mode 100644 index 00000000000..b47242013b4 --- /dev/null +++ b/src/devices/cpu/sh/sh7042.h @@ -0,0 +1,28 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert + +// SH7042, sh2 variant + +#ifndef MAME_CPU_SH_SH7042_H +#define MAME_CPU_SH_SH7042_H + +#pragma once + +#include "sh2.h" + +class sh7042_device : public sh2_device +{ +public: + sh7042_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + +protected: + virtual void device_start() override; + virtual void device_reset() override; + +private: + void map(address_map &map); +}; + +DECLARE_DEVICE_TYPE(SH7042, sh7042_device) + +#endif // MAME_CPU_SH_SH7042_H diff --git a/src/mame/yamaha/ympsr540.cpp b/src/mame/yamaha/ympsr540.cpp index dc6339e936f..89050ff257f 100644 --- a/src/mame/yamaha/ympsr540.cpp +++ b/src/mame/yamaha/ympsr540.cpp @@ -5,7 +5,7 @@ #include "bus/midi/midiinport.h" #include "bus/midi/midioutport.h" -#include "cpu/sh/sh7014.h" +#include "cpu/sh/sh7042.h" #include "debugger.h" #include "speaker.h" @@ -33,7 +33,7 @@ void psr540_state::machine_start() void psr540_state::psr540(machine_config &config) { - SH7014(config, m_maincpu, 7_MHz_XTAL); + SH7042(config, m_maincpu, 7_MHz_XTAL*4); // internal mask rom active, pll x4 m_maincpu->set_addrmap(AS_PROGRAM, &psr540_state::map); SPEAKER(config, "lspeaker").front_left(); @@ -42,9 +42,21 @@ void psr540_state::psr540(machine_config &config) void psr540_state::map(address_map &map) { - map(0x0000000, 0x001ffff).rom().region("kernel", 0); + map(0x0000000, 0x001ffff).rom().region("kernel", 0).mirror(0x1e0000); + + // 200000-3fffff: cs0 space + // 200000 fdc map(0x0280000, 0x029ffff).ram(); // sram + // 2a0000 leds + // 2c0000 lcd + + // 400000-7fffff: cs1 space map(0x0400000, 0x07fffff).rom().region("program_rom", 0); + + // c00000-ffffff: cs3 space + // c00000: sxw00 + + // Dedicated dram space map(0x1000000, 0x13fffff).ram(); // dram } -- cgit v1.2.3