diff options
author | 2014-09-18 01:07:22 +0000 | |
---|---|---|
committer | 2014-09-18 01:07:22 +0000 | |
commit | ace8c59d1afb538933892681e0a2408c8466cf3f (patch) | |
tree | ee702115a0c5c240d445dc12586f80833fdbeaf6 /src/emu/cpu/m37710 | |
parent | 5dbedfbf1867e962a1e25fd551860d59bbc47663 (diff) |
Memory system and Namco improvements: [Alex Jackson]
Explicit regions in address maps (AM_REGION) are now looked up relative to the
device rather than as siblings when in an internal address map (similar to
devices and shared pointers) Besides being more orthogonal than before, this
allows internal ROMs of MCUs and similar devices to be hooked up in a nicer
and more foolproof way. Updated the m37710 and m5074x (m6502 derivative)
to take advantage of this.
Divided the M37702/M37710 into specific models, with each model having its own
internal address map containing the correct amounts of internal RAM and ROM.
M37702 MCUs found on various Namco PCBs are now all unique devices and have
their respective internal ROMs loaded as device ROMs.
(nw)
Also did some spring (fall) cleaning in addrmap.c/memory.c/dimemory.c
m_devbase (the base device used for tagmap lookup when late-binding handlers and
finding memory regions and shares) is now a reference rather than a pointer,
since we know what it is when the address_map_entry is constructed and it
doesn't change (it depends solely on whether it's an entry in an MCFG-provided
address map or an internal one) And for the same reason, there's now only one
m_devbase per address_map_entry rather than individual copies for
read/write/setoffset/sharedptr.
Removed mysterious unused address_map_entry member "m_region_string", along
with a silly assert probably left over from when Aaron was replacing AM_BASE
with AM_SHARE years ago.
Added a comment noting that "make sure all devices exist" in
device_memory_interface::interface_validity_check() actually does nothing,
like the proverbial goggles. The reason there's just a comment and not a fix
is I haven't figured out how to fix it yet
(is it possible to extract the original device tag that was given to a
proto-delegate? Sorry, the template hell in devdelegate.h and
lib/util/delegate.h makes me want to run screaming like a little girl)
Diffstat (limited to 'src/emu/cpu/m37710')
-rw-r--r-- | src/emu/cpu/m37710/m37710.c | 57 | ||||
-rw-r--r-- | src/emu/cpu/m37710/m37710.h | 33 |
2 files changed, 71 insertions, 19 deletions
diff --git a/src/emu/cpu/m37710/m37710.c b/src/emu/cpu/m37710/m37710.c index d9baadd6779..c50f09512bc 100644 --- a/src/emu/cpu/m37710/m37710.c +++ b/src/emu/cpu/m37710/m37710.c @@ -60,35 +60,66 @@ #define M37710_DEBUG (0) // enables verbose logging for peripherals, etc. -const device_type M37710 = &device_creator<m37710_cpu_device>; -const device_type M37702 = &device_creator<m37702_cpu_device>; +const device_type M37702M2 = &device_creator<m37702m2_device>; +const device_type M37702S1 = &device_creator<m37702s1_device>; +const device_type M37710S4 = &device_creator<m37710s4_device>; -// On-board RAM and peripherals -static ADDRESS_MAP_START( m37710_internal_map, AS_PROGRAM, 16, m37710_cpu_device ) +// On-board RAM, ROM, and peripherals + +// M37702M2: 512 bytes internal RAM, 16K internal mask ROM +// (M37702E2: same with EPROM instead of mask ROM) +DEVICE_ADDRESS_MAP_START( map, 16, m37702m2_device ) + AM_RANGE(0x000000, 0x00007f) AM_READWRITE(m37710_internal_word_r, m37710_internal_word_w) + AM_RANGE(0x000080, 0x00027f) AM_RAM + AM_RANGE(0x00c000, 0x00ffff) AM_ROM AM_REGION("internal", 0) +ADDRESS_MAP_END + + +// M37702S1: 512 bytes internal RAM, no internal ROM +DEVICE_ADDRESS_MAP_START( map, 16, m37702s1_device ) AM_RANGE(0x000000, 0x00007f) AM_READWRITE(m37710_internal_word_r, m37710_internal_word_w) AM_RANGE(0x000080, 0x00027f) AM_RAM ADDRESS_MAP_END -m37710_cpu_device::m37710_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : cpu_device(mconfig, M37710, "M37710", tag, owner, clock, "m37710", __FILE__) - , m_program_config("program", ENDIANNESS_LITTLE, 16, 24, 0, ADDRESS_MAP_NAME(m37710_internal_map)) +// M37710S4: 2048 bytes internal RAM, no internal ROM +DEVICE_ADDRESS_MAP_START( map, 16, m37710s4_device ) + AM_RANGE(0x000000, 0x00007f) AM_READWRITE(m37710_internal_word_r, m37710_internal_word_w) + AM_RANGE(0x000080, 0x00087f) AM_RAM +ADDRESS_MAP_END + +// many other combinations of RAM and ROM size exist + + +m37710_cpu_device::m37710_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source, address_map_delegate map_delegate) + : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source) + , m_program_config("program", ENDIANNESS_LITTLE, 16, 24, 0, map_delegate) , m_io_config("io", ENDIANNESS_LITTLE, 8, 16, 0) { } -m37710_cpu_device::m37710_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) - : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source) - , m_program_config("program", ENDIANNESS_LITTLE, 16, 24, 0, ADDRESS_MAP_NAME(m37710_internal_map)) - , m_io_config("io", ENDIANNESS_LITTLE, 8, 16, 0) +m37702m2_device::m37702m2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : m37710_cpu_device(mconfig, M37702M2, "M37702M2", tag, owner, clock, "m37702m2", __FILE__, address_map_delegate(FUNC(m37702m2_device::map), this)) +{ +} + + +m37702m2_device::m37702m2_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) + : m37710_cpu_device(mconfig, type, name, tag, owner, clock, shortname, source, address_map_delegate(FUNC(m37702m2_device::map), this)) +{ +} + + +m37702s1_device::m37702s1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : m37710_cpu_device(mconfig, M37702S1, "M37702S1", tag, owner, clock, "m37702s1", __FILE__, address_map_delegate(FUNC(m37702s1_device::map), this)) { } -m37702_cpu_device::m37702_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : m37710_cpu_device(mconfig, M37702, "M37702", tag, owner, clock, "m37702", __FILE__) +m37710s4_device::m37710s4_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : m37710_cpu_device(mconfig, M37710S4, "M37710S4", tag, owner, clock, "m37710s4", __FILE__, address_map_delegate(FUNC(m37710s4_device::map), this)) { } diff --git a/src/emu/cpu/m37710/m37710.h b/src/emu/cpu/m37710/m37710.h index bcbb6a34315..e2b6e82521a 100644 --- a/src/emu/cpu/m37710/m37710.h +++ b/src/emu/cpu/m37710/m37710.h @@ -88,8 +88,7 @@ class m37710_cpu_device : public cpu_device { public: // construction/destruction - m37710_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - m37710_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); + m37710_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source, address_map_delegate map_delegate); DECLARE_READ16_MEMBER( m37710_internal_word_r ); DECLARE_WRITE16_MEMBER( m37710_internal_word_w ); @@ -2005,16 +2004,38 @@ private: }; -class m37702_cpu_device : public m37710_cpu_device +class m37702s1_device : public m37710_cpu_device { public: // construction/destruction - m37702_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + m37702s1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + DECLARE_ADDRESS_MAP(map, 16); +}; + +class m37702m2_device : public m37710_cpu_device +{ +public: + // construction/destruction + m37702m2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + m37702m2_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); +protected: + DECLARE_ADDRESS_MAP(map, 16); +}; + +class m37710s4_device : public m37710_cpu_device +{ +public: + // construction/destruction + m37710s4_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + DECLARE_ADDRESS_MAP(map, 16); }; -extern const device_type M37710; -extern const device_type M37702; +extern const device_type M37702M2; +extern const device_type M37702S1; +extern const device_type M37710S4; /* ======================================================================== */ |