From 1c12f1f20d077c7c8536744c3bd30ccab4aecd42 Mon Sep 17 00:00:00 2001 From: angelosa Date: Tue, 27 Sep 2016 16:53:38 +0200 Subject: [PATCH] Don't need a trampoline for these and added bare-bones SCI --- src/devices/cpu/sh2/sh7604_bus.cpp | 14 +----- src/devices/cpu/sh2/sh7604_bus.h | 2 - src/devices/cpu/sh2/sh7604_sci.cpp | 78 ++++++++++++++++++++++++++++++ src/devices/cpu/sh2/sh7604_sci.h | 62 ++++++++++++++++++++++++ 4 files changed, 142 insertions(+), 14 deletions(-) create mode 100644 src/devices/cpu/sh2/sh7604_sci.cpp create mode 100644 src/devices/cpu/sh2/sh7604_sci.h diff --git a/src/devices/cpu/sh2/sh7604_bus.cpp b/src/devices/cpu/sh2/sh7604_bus.cpp index 47c7cdccefd..70705931d7f 100644 --- a/src/devices/cpu/sh2/sh7604_bus.cpp +++ b/src/devices/cpu/sh2/sh7604_bus.cpp @@ -150,20 +150,10 @@ void sh7604_bus_device::device_reset() // READ/WRITE HANDLERS //************************************************************************** -inline void sh7604_bus_device::writeword(offs_t address, UINT16 data) -{ - space().write_word(address, data); -} - -inline UINT16 sh7604_bus_device::readword(offs_t address) -{ - return space().read_word(address); -} - READ32_MEMBER( sh7604_bus_device::read ) { // 16 bit access only, TODO - return readword(offset); + return space.read_word(offset) & 0xffff; } WRITE32_MEMBER( sh7604_bus_device::write ) @@ -177,5 +167,5 @@ WRITE32_MEMBER( sh7604_bus_device::write ) throw emu_fatalerror("%s: making bus write with ID signature = %04x!\n", tag(),data >> 16); } - writeword(offset,data & 0xffff); + space.write_word(offset,data & 0xffff); } diff --git a/src/devices/cpu/sh2/sh7604_bus.h b/src/devices/cpu/sh2/sh7604_bus.h index cd97e9064c6..b663b4ee4de 100644 --- a/src/devices/cpu/sh2/sh7604_bus.h +++ b/src/devices/cpu/sh2/sh7604_bus.h @@ -61,8 +61,6 @@ protected: private: bool m_is_slave; const address_space_config m_space_config; - void writeword(offs_t address, UINT16 data); - UINT16 readword(offs_t address); UINT16 m_bcr1; UINT16 m_bcr2; diff --git a/src/devices/cpu/sh2/sh7604_sci.cpp b/src/devices/cpu/sh2/sh7604_sci.cpp new file mode 100644 index 00000000000..b341c88f509 --- /dev/null +++ b/src/devices/cpu/sh2/sh7604_sci.cpp @@ -0,0 +1,78 @@ +// license:BSD-3-Clause +// copyright-holders: +/*************************************************************************** + +Template for skeleton device + +***************************************************************************/ + +#include "emu.h" +#include "sh7604_sci.h" + + + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +// device type definition +const device_type SH7604_SCI = &device_creator; + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +static ADDRESS_MAP_START( sci_regs, AS_0, 8, sh7604_sci_device ) + +ADDRESS_MAP_END + +//------------------------------------------------- +// sh7604_sci_device - constructor +//------------------------------------------------- + +sh7604_sci_device::sh7604_sci_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, SH7604_SCI, "sh7604_sci_longname", tag, owner, clock, "sh7604_sci", __FILE__), + device_memory_interface(mconfig, *this), + m_space_config("regs", ENDIANNESS_BIG, 8, 4, 0, nullptr, *ADDRESS_MAP_NAME(sci_regs)) + +{ +} + + +const address_space_config *sh7604_sci_device::memory_space_config(address_spacenum spacenum) const +{ + return (spacenum == AS_0) ? &m_space_config : nullptr; +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void sh7604_sci_device::device_start() +{ +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void sh7604_sci_device::device_reset() +{ +} + + +//************************************************************************** +// READ/WRITE HANDLERS +//************************************************************************** + +READ8_MEMBER( sh7604_sci_device::read ) +{ + return space.read_byte(offset); +} + +WRITE8_MEMBER( sh7604_sci_device::write ) +{ + space.write_byte(offset,data); +} diff --git a/src/devices/cpu/sh2/sh7604_sci.h b/src/devices/cpu/sh2/sh7604_sci.h new file mode 100644 index 00000000000..a666d5c64e4 --- /dev/null +++ b/src/devices/cpu/sh2/sh7604_sci.h @@ -0,0 +1,62 @@ +// license:BSD-3-Clause +// copyright-holders: +/*************************************************************************** + +Template for skeleton device + +***************************************************************************/ + +#pragma once + +#ifndef __SH7604_SCIDEV_H__ +#define __SH7604_SCIDEV_H__ + + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_SH7604_SCI_ADD(_tag,_freq) \ + MCFG_DEVICE_ADD(_tag, SH7604_SCI, _freq) + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> sh7604_sci_device + +class sh7604_sci_device : public device_t, + public device_memory_interface +{ +public: + // construction/destruction + sh7604_sci_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // I/O operations + DECLARE_WRITE8_MEMBER( write ); + DECLARE_READ8_MEMBER( read ); + + virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override; +protected: + // device-level overrides +// virtual void device_validity_check(validity_checker &valid) const; + virtual void device_start() override; + virtual void device_reset() override; +private: + const address_space_config m_space_config; +}; + + +// device type definition +extern const device_type SH7604_SCI; + + + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + + + +#endif