summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--.gitattributes2
-rw-r--r--src/emu/devfind.c110
-rw-r--r--src/emu/devfind.h385
-rw-r--r--src/emu/device.c67
-rw-r--r--src/emu/device.h362
-rw-r--r--src/emu/emu.h1
-rw-r--r--src/emu/emu.mak1
-rw-r--r--src/emu/machine/netlist.h2
-rw-r--r--src/emu/memory.c2
-rw-r--r--src/emu/memory.h7
-rw-r--r--src/emu/save.h6
-rw-r--r--src/emu/tilelgcy.h26
-rw-r--r--src/emu/tilemap.c527
-rw-r--r--src/emu/tilemap.h254
-rw-r--r--src/mame/drivers/atarig1.c8
-rw-r--r--src/mame/drivers/atarig42.c8
-rw-r--r--src/mame/drivers/atarigt.c9
-rw-r--r--src/mame/drivers/atarigx2.c7
-rw-r--r--src/mame/drivers/atarisy1.c7
-rw-r--r--src/mame/drivers/atarisy2.c3
-rw-r--r--src/mame/drivers/badlands.c8
-rw-r--r--src/mame/drivers/batman.c12
-rw-r--r--src/mame/drivers/blstroid.c4
-rw-r--r--src/mame/drivers/cyberbal.c45
-rw-r--r--src/mame/drivers/eprom.c21
-rw-r--r--src/mame/drivers/foodf.c4
-rw-r--r--src/mame/drivers/gauntlet.c7
-rw-r--r--src/mame/drivers/klax.c6
-rw-r--r--src/mame/drivers/namcoic.c18
-rw-r--r--src/mame/drivers/offtwall.c6
-rw-r--r--src/mame/drivers/relief.c9
-rw-r--r--src/mame/drivers/shuuz.c6
-rw-r--r--src/mame/drivers/skullxbo.c18
-rw-r--r--src/mame/drivers/subsino2.c11
-rw-r--r--src/mame/drivers/thunderj.c12
-rw-r--r--src/mame/drivers/toobin.c7
-rw-r--r--src/mame/drivers/vindictr.c7
-rw-r--r--src/mame/drivers/xybots.c7
-rw-r--r--src/mame/includes/atarig1.h4
-rw-r--r--src/mame/includes/atarig42.h5
-rw-r--r--src/mame/includes/atarigt.h5
-rw-r--r--src/mame/includes/atarigx2.h7
-rw-r--r--src/mame/includes/atarisy1.h4
-rw-r--r--src/mame/includes/atarisy2.h5
-rw-r--r--src/mame/includes/badlands.h5
-rw-r--r--src/mame/includes/batman.h5
-rw-r--r--src/mame/includes/blstroid.h6
-rw-r--r--src/mame/includes/cave.h3
-rw-r--r--src/mame/includes/cyberbal.h8
-rw-r--r--src/mame/includes/dooyong.h2
-rw-r--r--src/mame/includes/eprom.h4
-rw-r--r--src/mame/includes/foodf.h2
-rw-r--r--src/mame/includes/gauntlet.h7
-rw-r--r--src/mame/includes/klax.h6
-rw-r--r--src/mame/includes/namcona1.h3
-rw-r--r--src/mame/includes/namcos1.h4
-rw-r--r--src/mame/includes/namcos2.h1
-rw-r--r--src/mame/includes/namcos86.h3
-rw-r--r--src/mame/includes/skullxbo.h11
-rw-r--r--src/mame/includes/taito_f3.h3
-rw-r--r--src/mame/includes/thunderj.h2
-rw-r--r--src/mame/includes/toobin.h6
-rw-r--r--src/mame/includes/vindictr.h4
-rw-r--r--src/mame/includes/xybots.h7
-rw-r--r--src/mame/machine/atarigen.c195
-rw-r--r--src/mame/machine/atarigen.h49
-rw-r--r--src/mame/video/atarig1.c19
-rw-r--r--src/mame/video/atarig42.c19
-rw-r--r--src/mame/video/atarigt.c25
-rw-r--r--src/mame/video/atarigx2.c26
-rw-r--r--src/mame/video/atarisy1.c11
-rw-r--r--src/mame/video/atarisy2.c26
-rw-r--r--src/mame/video/badlands.c5
-rw-r--r--src/mame/video/batman.c51
-rw-r--r--src/mame/video/blstroid.c43
-rw-r--r--src/mame/video/cave.c17
-rw-r--r--src/mame/video/cischeat.c4
-rw-r--r--src/mame/video/cyberbal.c133
-rw-r--r--src/mame/video/dooyong.c24
-rw-r--r--src/mame/video/eprom.c28
-rw-r--r--src/mame/video/foodf.c6
-rw-r--r--src/mame/video/gauntlet.c11
-rw-r--r--src/mame/video/klax.c7
-rw-r--r--src/mame/video/m107.c2
-rw-r--r--src/mame/video/m92.c2
-rw-r--r--src/mame/video/megasys1.c4
-rw-r--r--src/mame/video/namcona1.c24
-rw-r--r--src/mame/video/namcos1.c26
-rw-r--r--src/mame/video/namcos86.c17
-rw-r--r--src/mame/video/offtwall.c9
-rw-r--r--src/mame/video/relief.c19
-rw-r--r--src/mame/video/segaic16.c12
-rw-r--r--src/mame/video/segas32.c2
-rw-r--r--src/mame/video/shuuz.c9
-rw-r--r--src/mame/video/skullxbo.c34
-rw-r--r--src/mame/video/system1.c2
-rw-r--r--src/mame/video/taito_f3.c20
-rw-r--r--src/mame/video/thunderj.c37
-rw-r--r--src/mame/video/toobin.c20
-rw-r--r--src/mame/video/unico.c4
-rw-r--r--src/mame/video/vindictr.c21
-rw-r--r--src/mame/video/xybots.c11
-rw-r--r--src/mame/video/ygv608.c7
103 files changed, 1828 insertions, 1277 deletions
diff --git a/.gitattributes b/.gitattributes
index a2b5fb1564d..b50df7e3856 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1021,6 +1021,8 @@ src/emu/devcpu.c svneol=native#text/plain
src/emu/devcpu.h svneol=native#text/plain
src/emu/devdelegate.c svneol=native#text/plain
src/emu/devdelegate.h svneol=native#text/plain
+src/emu/devfind.c svneol=native#text/plain
+src/emu/devfind.h svneol=native#text/plain
src/emu/device.c svneol=native#text/plain
src/emu/device.h svneol=native#text/plain
src/emu/devlegcy.h svneol=native#text/plain
diff --git a/src/emu/devfind.c b/src/emu/devfind.c
new file mode 100644
index 00000000000..f5834a9a45d
--- /dev/null
+++ b/src/emu/devfind.c
@@ -0,0 +1,110 @@
+/***************************************************************************
+
+ devfind.c
+
+ Device finding template helpers.
+
+****************************************************************************
+
+ Copyright Aaron Giles
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ * Neither the name 'MAME' nor the names of its contributors may be
+ used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND ANY EXPRESS OR
+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+
+***************************************************************************/
+
+#include "emu.h"
+
+
+//**************************************************************************
+// BASE FINDER CLASS
+//**************************************************************************
+
+//-------------------------------------------------
+// finder_base - constructor
+//-------------------------------------------------
+
+finder_base::finder_base(device_t &base, const char *tag)
+ : m_next(base.register_auto_finder(*this)),
+ m_base(base),
+ m_tag(tag)
+{
+}
+
+
+//-------------------------------------------------
+// ~finder_base - destructor
+//-------------------------------------------------
+
+finder_base::~finder_base()
+{
+}
+
+
+//-------------------------------------------------
+// find_memory - find memory
+//-------------------------------------------------
+
+void *finder_base::find_memory(UINT8 width, size_t &bytes, bool required)
+{
+ // look up the share and return NULL if not found
+ memory_share *share = m_base.memshare(m_tag);
+ if (share == NULL)
+ return NULL;
+
+ // check the width and warn if not correct
+ if (width != 0 && share->width() != width)
+ {
+ if (required)
+ mame_printf_warning("Shared ptr '%s' found but is width %d, not %d as requested\n", m_tag, share->width(), width);
+ return NULL;
+ }
+
+ // return results
+ bytes = share->bytes();
+ return share->ptr();
+}
+
+
+//-------------------------------------------------
+// report_missing - report missing objects and
+// return true if it's ok
+//-------------------------------------------------
+
+bool finder_base::report_missing(bool found, const char *objname, bool required)
+{
+ // just pass through in the found case
+ if (found)
+ return true;
+
+ // otherwise, report
+ if (required)
+ mame_printf_error("Required %s '%s' not found\n", objname, m_tag);
+ else
+ mame_printf_verbose("Optional %s '%s' not found\n", objname, m_tag);
+ return !required;
+}
diff --git a/src/emu/devfind.h b/src/emu/devfind.h
new file mode 100644
index 00000000000..006373fcff8
--- /dev/null
+++ b/src/emu/devfind.h
@@ -0,0 +1,385 @@
+/***************************************************************************
+
+ devfind.h
+
+ Device finding template helpers.
+
+****************************************************************************
+
+ Copyright Aaron Giles
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ * Neither the name 'MAME' nor the names of its contributors may be
+ used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND ANY EXPRESS OR
+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+
+***************************************************************************/
+
+#pragma once
+
+#ifndef __EMU_H__
+#error Dont include this file directly; include emu.h instead.
+#endif
+
+#ifndef __DEVFIND_H__
+#define __DEVFIND_H__
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> finder_base
+
+// helper class to request auto-object discovery in the constructor of a derived class
+class finder_base
+{
+ friend class device_t;
+
+public:
+ // construction/destruction
+ finder_base(device_t &base, const char *tag);
+ virtual ~finder_base();
+
+ // getters
+ virtual bool findit(bool isvalidation = false) = 0;
+
+protected:
+ // helpers
+ void *find_memory(UINT8 width, size_t &bytes, bool required);
+ bool report_missing(bool found, const char *objname, bool required);
+
+ // internal state
+ finder_base *m_next;
+ device_t &m_base;
+ const char *m_tag;
+};
+
+
+// ======================> object_finder_base
+
+// helper class to find objects of a particular type
+template<class _ObjectClass>
+class object_finder_base : public finder_base
+{
+public:
+ // construction/destruction
+ object_finder_base(device_t &base, const char *tag)
+ : finder_base(base, tag),
+ m_target(NULL) { }
+
+ // operators to make use transparent
+ operator _ObjectClass *() const { return m_target; }
+ _ObjectClass *operator->() const { assert(m_target != NULL); return m_target; }
+
+ // getter for explicit fetching
+ _ObjectClass *target() const { return m_target; }
+
+ // setter for setting the object
+ void set_target(_ObjectClass *target) { m_target = target; }
+
+protected:
+ // internal state
+ _ObjectClass *m_target;
+};
+
+
+// ======================> device_finder
+
+// device finder template
+template<class _DeviceClass, bool _Required>
+class device_finder : public object_finder_base<_DeviceClass>
+{
+public:
+ // construction/destruction
+ device_finder(device_t &base, const char *tag)
+ : object_finder_base<_DeviceClass>(base, tag) { }
+
+ // make reference use transparent as well
+ operator _DeviceClass &() { assert(object_finder_base<_DeviceClass>::m_target != NULL); return *object_finder_base<_DeviceClass>::m_target; }
+
+ // finder
+ virtual bool findit(bool isvalidation = false)
+ {
+ device_t *device = this->m_base.subdevice(this->m_tag);
+ this->m_target = dynamic_cast<_DeviceClass *>(device);
+ if (device != NULL && this->m_target == NULL)
+ {
+ void mame_printf_warning(const char *format, ...) ATTR_PRINTF(1,2);
+ mame_printf_warning("Device '%s' found but is of incorrect type (actual type is %s)\n", this->m_tag, device->name());
+ }
+ return this->report_missing(this->m_target != NULL, "device", _Required);
+ }
+};
+
+// optional device finder
+template<class _DeviceClass>
+class optional_device : public device_finder<_DeviceClass, false>
+{
+public:
+ optional_device(device_t &base, const char *tag) : device_finder<_DeviceClass, false>(base, tag) { }
+};
+
+// required devices are similar but throw an error if they are not found
+template<class _DeviceClass>
+class required_device : public device_finder<_DeviceClass, true>
+{
+public:
+ required_device(device_t &base, const char *tag) : device_finder<_DeviceClass, true>(base, tag) { }
+};
+
+
+// ======================> memory_region_finder
+
+// device finder template
+template<bool _Required>
+class memory_region_finder : public object_finder_base<memory_region>
+{
+public:
+ // construction/destruction
+ memory_region_finder(device_t &base, const char *tag)
+ : object_finder_base<memory_region>(base, tag) { }
+
+ // make reference use transparent as well
+ operator memory_region &() { assert(object_finder_base<memory_region>::m_target != NULL); return *object_finder_base<memory_region>::m_target; }
+
+ // finder
+ virtual bool findit(bool isvalidation = false)
+ {
+ if (isvalidation) return true;
+ m_target = m_base.memregion(m_tag);
+ return this->report_missing(m_target != NULL, "memory region", _Required);
+ }
+};
+
+// optional device finder
+class optional_memory_region : public memory_region_finder<false>
+{
+public:
+ optional_memory_region(device_t &base, const char *tag) : memory_region_finder<false>(base, tag) { }
+};
+
+// required devices are similar but throw an error if they are not found
+class required_memory_region : public memory_region_finder<true>
+{
+public:
+ required_memory_region(device_t &base, const char *tag) : memory_region_finder<true>(base, tag) { }
+};
+
+
+// ======================> memory_bank_finder
+
+// device finder template
+template<bool _Required>
+class memory_bank_finder : public object_finder_base<memory_bank>
+{
+public:
+ // construction/destruction
+ memory_bank_finder(device_t &base, const char *tag)
+ : object_finder_base<memory_bank>(base, tag) { }
+
+ // make reference use transparent as well
+ operator memory_bank &() { assert(object_finder_base<memory_bank>::m_target != NULL); return *object_finder_base<memory_bank>::m_target; }
+
+ // finder
+ virtual bool findit(bool isvalidation = false)
+ {
+ if (isvalidation) return true;
+ m_target = m_base.membank(m_tag);
+ return this->report_missing(m_target != NULL, "memory bank", _Required);
+ }
+};
+
+// optional device finder
+class optional_memory_bank : public memory_bank_finder<false>
+{
+public:
+ optional_memory_bank(device_t &base, const char *tag) : memory_bank_finder<false>(base, tag) { }
+};
+
+// required devices are similar but throw an error if they are not found
+class required_memory_bank : public memory_bank_finder<true>
+{
+public:
+ required_memory_bank(device_t &base, const char *tag) : memory_bank_finder<true>(base, tag) { }
+};
+
+
+// ======================> ioport_finder
+
+// device finder template
+template<bool _Required>
+class ioport_finder : public object_finder_base<ioport_port>
+{
+public:
+ // construction/destruction
+ ioport_finder(device_t &base, const char *tag)
+ : object_finder_base<ioport_port>(base, tag) { }
+
+ // make reference use transparent as well
+ operator ioport_port &() { assert(object_finder_base<ioport_port>::m_target != NULL); return *object_finder_base<ioport_port>::m_target; }
+
+ // finder
+ virtual bool findit(bool isvalidation = false)
+ {
+ if (isvalidation) return true;
+ m_target = m_base.ioport(m_tag);
+ return this->report_missing(m_target != NULL, "I/O port", _Required);
+ }
+};
+
+// optional device finder
+class optional_ioport : public ioport_finder<false>
+{
+public:
+ optional_ioport(device_t &base, const char *tag) : ioport_finder<false>(base, tag) { }
+};
+
+// required devices are similar but throw an error if they are not found
+class required_ioport : public ioport_finder<true>
+{
+public:
+ required_ioport(device_t &base, const char *tag) : ioport_finder<true>(base, tag) { }
+};
+
+
+// ======================> shared_ptr_finder
+
+// shared pointer finder template
+template<typename _PointerType, bool _Required>
+class shared_ptr_finder : public object_finder_base<_PointerType>
+{
+public:
+ // construction/destruction
+ shared_ptr_finder(device_t &base, const char *tag, UINT8 width = sizeof(_PointerType) * 8)
+ : object_finder_base<_PointerType>(base, tag),
+ m_bytes(0),
+ m_allocated(false),
+ m_width(width) { }
+
+ virtual ~shared_ptr_finder() { if (m_allocated) global_free(this->m_target); }
+
+ // operators to make use transparent
+ _PointerType operator[](int index) const { return this->m_target[index]; }
+ _PointerType &operator[](int index) { return this->m_target[index]; }
+
+ // getter for explicit fetching
+ UINT32 bytes() const { return m_bytes; }
+
+ // setter for setting the object
+ void set_target(_PointerType *target, size_t bytes) { this->m_target = target; m_bytes = bytes; }
+
+ // dynamic allocation of a shared pointer
+ void allocate(UINT32 entries)
+ {
+ assert(!m_allocated);
+ m_allocated = true;
+ this->m_target = global_alloc_array_clear(_PointerType, entries);
+ m_bytes = entries * sizeof(_PointerType);
+ this->m_base.save_pointer(this->m_target, this->m_tag, entries);
+ }
+
+ // finder
+ virtual bool findit(bool isvalidation = false)
+ {
+ if (isvalidation) return true;
+ this->m_target = reinterpret_cast<_PointerType *>(this->find_memory(m_width, m_bytes, _Required));
+ return this->report_missing(this->m_target != NULL, "shared pointer", _Required);
+ }
+
+protected:
+ // internal state
+ size_t m_bytes;
+ bool m_allocated;
+ UINT8 m_width;
+};
+
+// optional shared pointer finder
+template<class _PointerType>
+class optional_shared_ptr : public shared_ptr_finder<_PointerType, false>
+{
+public:
+ optional_shared_ptr(device_t &base, const char *tag, UINT8 width = sizeof(_PointerType) * 8) : shared_ptr_finder<_PointerType, false>(base, tag, width) { }
+};
+
+// required shared pointer finder
+template<class _PointerType>
+class required_shared_ptr : public shared_ptr_finder<_PointerType, true>
+{
+public:
+ required_shared_ptr(device_t &base, const char *tag, UINT8 width = sizeof(_PointerType) * 8) : shared_ptr_finder<_PointerType, true>(base, tag, width) { }
+};
+
+
+// ======================> shared_ptr_array_finder
+
+// shared pointer array finder template
+template<typename _PointerType, int _Count, bool _Required>
+class shared_ptr_array_finder
+{
+ typedef shared_ptr_finder<_PointerType, _Required> shared_ptr_type;
+
+public:
+ // construction/destruction
+ shared_ptr_array_finder(device_t &base, const char *basetag, UINT8 width = sizeof(_PointerType) * 8)
+ {
+ for (int index = 0; index < _Count; index++)
+ m_array[index] = global_alloc(shared_ptr_type(base, m_tag[index].format("%s.%d", basetag, index), width));
+ }
+
+ virtual ~shared_ptr_array_finder()
+ {
+ for (int index = 0; index < _Count; index++)
+ global_free(m_array[index]);
+ }
+
+ // array accessors
+ const shared_ptr_type &operator[](int index) const { assert(index < _Count); return *m_array[index]; }
+ shared_ptr_type &operator[](int index) { assert(index < _Count); return *m_array[index]; }
+
+protected:
+ // internal state
+ shared_ptr_type *m_array[_Count+1];
+ astring m_tag[_Count+1];
+};
+
+// optional shared pointer array finder
+template<class _PointerType, int _Count>
+class optional_shared_ptr_array : public shared_ptr_array_finder<_PointerType, _Count, false>
+{
+public:
+ optional_shared_ptr_array(device_t &base, const char *tag, UINT8 width = sizeof(_PointerType) * 8) : shared_ptr_array_finder<_PointerType, _Count, false>(base, tag, width) { }
+};
+
+// required shared pointer array finder
+template<class _PointerType, int _Count>
+class required_shared_ptr_array : public shared_ptr_array_finder<_PointerType, _Count, true>
+{
+public:
+ required_shared_ptr_array(device_t &base, const char *tag, UINT8 width = sizeof(_PointerType) * 8) : shared_ptr_array_finder<_PointerType, _Count, true>(base, tag, width) { }
+};
+
+
+#endif /* __DEVFIND_H__ */
diff --git a/src/emu/device.c b/src/emu/device.c
index bc0bb770729..5d6f399fdf2 100644
--- a/src/emu/device.c
+++ b/src/emu/device.c
@@ -852,7 +852,7 @@ void device_t::remove_subdevice(device_t &device)
// list of stuff to find after we go live
//-------------------------------------------------
-device_t::finder_base *device_t::register_auto_finder(finder_base &autodev)
+finder_base *device_t::register_auto_finder(finder_base &autodev)
{
// add to this list
finder_base *old = m_auto_finder_list;
@@ -861,71 +861,6 @@ device_t::finder_base *device_t::register_auto_finder(finder_base &autodev)
}
-//-------------------------------------------------
-// finder_base - constructor
-//-------------------------------------------------
-
-device_t::finder_base::finder_base(device_t &base, const char *tag)
- : m_next(base.register_auto_finder(*this)),
- m_base(base),
- m_tag(tag)
-{
-}
-
-
-//-------------------------------------------------
-// ~finder_base - destructor
-//-------------------------------------------------
-
-device_t::finder_base::~finder_base()
-{
-}
-
-
-//-------------------------------------------------
-// find_memory - find memory
-//-------------------------------------------------
-
-void *device_t::finder_base::find_memory(UINT8 width, size_t &bytes, bool required)
-{
- // look up the share and return NULL if not found
- memory_share *share = m_base.memshare(m_tag);
- if (share == NULL)
- return NULL;
-
- // check the width and warn if not correct
- if (width != 0 && share->width() != width)
- {
- if (required)
- mame_printf_warning("Shared ptr '%s' found but is width %d, not %d as requested\n", m_tag, share->width(), width);
- return NULL;
- }
-
- // return results
- bytes = share->bytes();
- return share->ptr();
-}
-
-
-//-------------------------------------------------
-// report_missing - report missing objects and
-// return true if it's ok
-//-------------------------------------------------
-
-bool device_t::finder_base::report_missing(bool found, const char *objname, bool required)
-{
- // just pass through in the found case
- if (found)
- return true;
-
- // otherwise, report
- if (required)
- mame_printf_error("Required %s '%s' not found\n", objname, m_tag);
- else
- mame_printf_verbose("Optional %s '%s' not found\n", objname, m_tag);
- return !required;
-}
-
//**************************************************************************
// LIVE DEVICE INTERFACES
diff --git a/src/emu/device.h b/src/emu/device.h
index 7ac2a349a9e..355af924609 100644
--- a/src/emu/device.h
+++ b/src/emu/device.h
@@ -43,8 +43,8 @@
#error Dont include this file directly; include emu.h instead.
#endif
-#ifndef __DEVINTRF_H__
-#define __DEVINTRF_H__
+#ifndef __DEVICE_H__
+#define __DEVICE_H__
@@ -99,7 +99,7 @@ struct rom_entry;
class machine_config;
class emu_timer;
struct input_device_default;
-
+class finder_base;
// exception classes
@@ -142,6 +142,7 @@ class device_t : public delegate_late_bind
friend class device_list;
friend class machine_config;
friend class running_machine;
+ friend class finder_base;
protected:
// construction/destruction
@@ -242,28 +243,6 @@ public:
bool findit(bool isvalidation = false);
protected:
- // internal helper classes (defined below)
- class finder_base;
- template<class _ObjectClass> class object_finder_base;
- template<class _DeviceClass, bool _Required> class device_finder;
- template<class _DeviceClass> class optional_device;
- template<class _DeviceClass> class required_device;
- template<bool _Required> class memory_region_finder;
- class optional_memory_region;
- class required_memory_region;
- template<bool _Required> class memory_bank_finder;
- class optional_memory_bank;
- class required_memory_bank;
- template<bool _Required> class ioport_finder;
- class optional_ioport;
- class required_ioport;
- template<typename _PointerType, bool _Required> class shared_ptr_finder;
- template<typename _PointerType> class optional_shared_ptr;
- template<typename _PointerType> class required_shared_ptr;
- template<typename _PointerType, int _Count, bool _Required> class shared_ptr_array_finder;
- template<typename _PointerType, int _Count> class optional_shared_ptr_array;
- template<typename _PointerType, int _Count> class required_shared_ptr_array;
-
// miscellaneous helpers
void set_machine(running_machine &machine);
void start();
@@ -346,337 +325,6 @@ private:
};
-// ======================> finder_base
-
-// helper class to request auto-object discovery in the constructor of a derived class
-class device_t::finder_base
-{
- friend class device_t;
-
-public:
- // construction/destruction
- finder_base(device_t &base, const char *tag);
- virtual ~finder_base();
-
- // getters
- virtual bool findit(bool isvalidation = false) = 0;
-
-protected:
- // helpers
- void *find_memory(UINT8 width, size_t &bytes, bool required);
- bool report_missing(bool found, const char *objname, bool required);
-
- // internal state
- finder_base *m_next;
- device_t &m_base;
- const char *m_tag;
-};
-
-
-// ======================> object_finder_base
-
-// helper class to find objects of a particular type
-template<class _ObjectClass>
-class device_t::object_finder_base : public device_t::finder_base
-{
-public:
- // construction/destruction
- object_finder_base(device_t &base, const char *tag)
- : finder_base(base, tag),
- m_target(NULL) { }
-
- // operators to make use transparent
- operator _ObjectClass *() const { return m_target; }
- _ObjectClass *operator->() const { assert(m_target != NULL); return m_target; }
-
- // getter for explicit fetching
- _ObjectClass *target() const { return m_target; }
-
- // setter for setting the object
- void set_target(_ObjectClass *target) { m_target = target; }
-
-protected:
- // internal state
- _ObjectClass *m_target;
-};
-
-
-// ======================> device_finder
-
-// device finder template
-template<class _DeviceClass, bool _Required>
-class device_t::device_finder : public device_t::object_finder_base<_DeviceClass>
-{
-public:
- // construction/destruction
- device_finder(device_t &base, const char *tag)
- : object_finder_base<_DeviceClass>(base, tag) { }
-
- // make reference use transparent as well
- operator _DeviceClass &() { assert(object_finder_base<_DeviceClass>::m_target != NULL); return *object_finder_base<_DeviceClass>::m_target; }
-
- // finder
- virtual bool findit(bool isvalidation = false)
- {
- device_t *device = this->m_base.subdevice(this->m_tag);
- this->m_target = dynamic_cast<_DeviceClass *>(device);
- if (device != NULL && this->m_target == NULL)
- {
- void mame_printf_warning(const char *format, ...) ATTR_PRINTF(1,2);
- mame_printf_warning("Device '%s' found but is of incorrect type (actual type is %s)\n", this->m_tag, device->name());
- }
- return this->report_missing(this->m_target != NULL, "device", _Required);
- }
-};
-
-// optional device finder
-template<class _DeviceClass>
-class device_t::optional_device : public device_t::device_finder<_DeviceClass, false>
-{
-public:
- optional_device(device_t &base, const char *tag) : device_finder<_DeviceClass, false>(base, tag) { }
-};
-
-// required devices are similar but throw an error if they are not found
-template<class _DeviceClass>
-class device_t::required_device : public device_t::device_finder<_DeviceClass, true>
-{
-public:
- required_device(device_t &base, const char *tag) : device_finder<_DeviceClass, true>(base, tag) { }
-};
-
-
-// ======================> memory_region_finder
-
-// device finder template
-template<bool _Required>
-class device_t::memory_region_finder : public device_t::object_finder_base<memory_region>
-{
-public:
- // construction/destruction
- memory_region_finder(device_t &base, const char *tag)
- : object_finder_base<memory_region>(base, tag) { }
-
- // make reference use transparent as well
- operator memory_region &() { assert(object_finder_base<memory_region>::m_target != NULL); return *object_finder_base<memory_region>::m_target; }
-
- // finder
- virtual bool findit(bool isvalidation = false)
- {
- if (isvalidation) return true;
- m_target = m_base.memregion(m_tag);
- return this->report_missing(m_target != NULL, "memory region", _Required);
- }
-};
-
-// optional device finder
-class device_t::optional_memory_region : public device_t::memory_region_finder<false>
-{
-public:
- optional_memory_region(device_t &base, const char *tag) : memory_region_finder<false>(base, tag) { }
-};
-
-// required devices are similar but throw an error if they are not found
-class device_t::required_memory_region : public device_t::memory_region_finder<true>
-{
-public:
- required_memory_region(device_t &base, const char *tag) : memory_region_finder<true>(base, tag) { }
-};
-
-
-// ======================> memory_bank_finder
-
-// device finder template
-template<bool _Required>
-class device_t::memory_bank_finder : public device_t::object_finder_base<memory_bank>
-{
-public:
- // construction/destruction
- memory_bank_finder(device_t &base, const char *tag)
- : object_finder_base<memory_bank>(base, tag) { }
-
- // make reference use transparent as well
- operator memory_bank &() { assert(object_finder_base<memory_bank>::m_target != NULL); return *object_finder_base<memory_bank>::m_target; }
-
- // finder
- virtual bool findit(bool isvalidation = false)
- {
- if (isvalidation) return true;
- m_target = m_base.membank(m_tag);
- return this->report_missing(m_target != NULL, "memory bank", _Required);
- }
-};
-
-// optional device finder
-class device_t::optional_memory_bank : public device_t::memory_bank_finder<false>
-{
-public:
- optional_memory_bank(device_t &base, const char *tag) : memory_bank_finder<false>(base, tag) { }
-};
-
-// required devices are similar but throw an error if they are not found
-class device_t::required_memory_bank : public device_t::memory_bank_finder<true>
-{
-public:
- required_memory_bank(device_t &base, const char *tag) : memory_bank_finder<true>(base, tag) { }
-};
-
-
-// ======================> ioport_finder
-
-// device finder template
-template<bool _Required>
-class device_t::ioport_finder : public device_t::object_finder_base<ioport_port>
-{
-public:
- // construction/destruction
- ioport_finder(device_t &base, const char *tag)
- : object_finder_base<ioport_port>(base, tag) { }
-
- // make reference use transparent as well
- operator ioport_port &() { assert(object_finder_base<ioport_port>::m_target != NULL); return *object_finder_base<ioport_port>::m_target; }
-
- // finder
- virtual bool findit(bool isvalidation = false)
- {
- if (isvalidation) return true;
- m_target = m_base.ioport(m_tag);
- return this->report_missing(m_target != NULL, "I/O port", _Required);
- }
-};
-
-// optional device finder
-class device_t::optional_ioport : public device_t::ioport_finder<false>
-{
-public:
- optional_ioport(device_t &base, const char *tag) : ioport_finder<false>(base, tag) { }
-};
-
-// required devices are similar but throw an error if they are not found
-class device_t::required_ioport : public device_t::ioport_finder<true>
-{
-public:
- required_ioport(device_t &base, const char *tag) : ioport_finder<true>(base, tag) { }
-};
-
-
-// ======================> shared_ptr_finder
-
-// shared pointer finder template
-template<typename _PointerType, bool _Required>
-class device_t::shared_ptr_finder : public device_t::object_finder_base<_PointerType>
-{
-public:
- // construction/destruction
- shared_ptr_finder(device_t &base, const char *tag, UINT8 width = sizeof(_PointerType) * 8)
- : object_finder_base<_PointerType>(base, tag),
- m_bytes(0),
- m_allocated(false),
- m_width(width) { }
-
- virtual ~shared_ptr_finder() { if (m_allocated) global_free(this->m_target); }
-
- // operators to make use transparent
- _PointerType operator[](int index) const { return this->m_target[index]; }
- _PointerType &operator[](int index) { return this->m_target[index]; }
-
- // getter for explicit fetching
- UINT32 bytes() const { return m_bytes; }
-
- // setter for setting the object
- void set_target(_PointerType *target, size_t bytes) { this->m_target = target; m_bytes = bytes; }
-
- // dynamic allocation of a shared pointer
- void allocate(UINT32 entries)
- {
- assert(!m_allocated);
- m_allocated = true;
- this->m_target = global_alloc_array_clear(_PointerType, entries);
- m_bytes = entries * sizeof(_PointerType);
- this->m_base.save_pointer(this->m_target, this->m_tag, entries);
- }
-
- // finder
- virtual bool findit(bool isvalidation = false)
- {
- if (isvalidation) return true;
- this->m_target = reinterpret_cast<_PointerType *>(this->find_memory(m_width, m_bytes, _Required));
- return this->report_missing(this->m_target != NULL, "shared pointer", _Required);
- }
-
-protected:
- // internal state
- size_t m_bytes;
- bool m_allocated;
- UINT8 m_width;
-};
-
-// optional shared pointer finder
-template<class _PointerType>
-class device_t::optional_shared_ptr : public device_t::shared_ptr_finder<_PointerType, false>
-{
-public:
- optional_shared_ptr(device_t &base, const char *tag, UINT8 width = sizeof(_PointerType) * 8) : shared_ptr_finder<_PointerType, false>(base, tag, width) { }
-};
-
-// required shared pointer finder
-template<class _PointerType>
-class device_t::required_shared_ptr : public device_t::shared_ptr_finder<_PointerType, true>
-{
-public:
- required_shared_ptr(device_t &base, const char *tag, UINT8 width = sizeof(_PointerType) * 8) : shared_ptr_finder<_PointerType, true>(base, tag, width) { }
-};
-
-
-// ======================> shared_ptr_array_finder
-
-// shared pointer array finder template
-template<typename _PointerType, int _Count, bool _Required>
-class device_t::shared_ptr_array_finder
-{
- typedef shared_ptr_finder<_PointerType, _Required> shared_ptr_type;
-
-public:
- // construction/destruction
- shared_ptr_array_finder(device_t &base, const char *basetag, UINT8 width = sizeof(_PointerType) * 8)
- {
- for (int index = 0; index < _Count; index++)
- m_array[index] = global_alloc(shared_ptr_type(base, m_tag[index].format("%s.%d", basetag, index), width));
- }
-
- virtual ~shared_ptr_array_finder()
- {
- for (int index = 0; index < _Count; index++)
- global_free(m_array[index]);
- }
-
- // array accessors
- const shared_ptr_type &operator[](int index) const { assert(index < _Count); return *m_array[index]; }
- shared_ptr_type &operator[](int index) { assert(index < _Count); return *m_array[index]; }
-
-protected:
- // internal state
- shared_ptr_type *m_array[_Count+1];
- astring m_tag[_Count+1];
-};
-
-// optional shared pointer array finder
-template<class _PointerType, int _Count>
-class device_t::optional_shared_ptr_array : public device_t::shared_ptr_array_finder<_PointerType, _Count, false>
-{
-public:
- optional_shared_ptr_array(device_t &base, const char *tag, UINT8 width = sizeof(_PointerType) * 8) : shared_ptr_array_finder<_PointerType, _Count, false>(base, tag, width) { }
-};
-
-// required shared pointer array finder
-template<class _PointerType, int _Count>
-class device_t::required_shared_ptr_array : public device_t::shared_ptr_array_finder<_PointerType, _Count, true>
-{
-public:
- required_shared_ptr_array(device_t &base, const char *tag, UINT8 width = sizeof(_PointerType) * 8) : shared_ptr_array_finder<_PointerType, _Count, true>(base, tag, width) { }
-};
-
-
// ======================> device_interface
// device_interface represents runtime information for a particular device interface
@@ -1004,4 +652,4 @@ inline device_t *device_t::siblingdevice(const char *tag) const
return (tag[0] == ':') ? subdevice(tag) : NULL;
}
-#endif /* __DEVINTRF_H__ */
+#endif /* __DEVICE_H__ */
diff --git a/src/emu/emu.h b/src/emu/emu.h
index 8a40b961c70..f7d8ee6bdb7 100644
--- a/src/emu/emu.h
+++ b/src/emu/emu.h
@@ -92,6 +92,7 @@ typedef device_t * (*machine_config_constructor)(machine_config &config, device_
// devices and callbacks
#include "device.h"
+#include "devfind.h"
#include "distate.h"
#include "dimemory.h"
#include "diexec.h"
diff --git a/src/emu/emu.mak b/src/emu/emu.mak
index 5324e065e1d..03012f7c80b 100644
--- a/src/emu/emu.mak
+++ b/src/emu/emu.mak
@@ -58,6 +58,7 @@ EMUOBJS = \
$(EMUOBJ)/devcb.o \
$(EMUOBJ)/devcb2.o \
$(EMUOBJ)/devcpu.o \
+ $(EMUOBJ)/devfind.o \
$(EMUOBJ)/device.o \
$(EMUOBJ)/didisasm.o \
$(EMUOBJ)/diexec.o \
diff --git a/src/emu/machine/netlist.h b/src/emu/machine/netlist.h
index 41572cdd705..3530247e9a7 100644
--- a/src/emu/machine/netlist.h
+++ b/src/emu/machine/netlist.h
@@ -1165,7 +1165,7 @@ public:
// device finder template
template<bool _Required, class _NETClass>
-class netlist_mame_device::output_finder : public device_t::object_finder_base<_NETClass>,
+class netlist_mame_device::output_finder : public object_finder_base<_NETClass>,
netlist_mame_device::on_device_start
{
public:
diff --git a/src/emu/memory.c b/src/emu/memory.c
index 3232be1a26f..55aca2847d4 100644
--- a/src/emu/memory.c
+++ b/src/emu/memory.c
@@ -1811,7 +1811,7 @@ void address_space::prepare_map()
if (manager().m_sharelist.find(device().siblingtag(fulltag, entry->m_share).cstr()) == NULL)
{
VPRINTF(("Creating share '%s' of length 0x%X\n", fulltag.cstr(), entry->m_byteend + 1 - entry->m_bytestart));
- memory_share *share = auto_alloc(machine(), memory_share(m_map->m_databits, entry->m_byteend + 1 - entry->m_bytestart));
+ memory_share *share = auto_alloc(machine(), memory_share(m_map->m_databits, entry->m_byteend + 1 - entry->m_bytestart, endianness()));
manager().m_sharelist.append(fulltag, *share);
}
}
diff --git a/src/emu/memory.h b/src/emu/memory.h
index a88586fc140..4dffb5868d7 100644
--- a/src/emu/memory.h
+++ b/src/emu/memory.h
@@ -730,17 +730,19 @@ class memory_share
public:
// construction/destruction
- memory_share(UINT8 width, size_t bytes, void *ptr = NULL)
+ memory_share(UINT8 width, size_t bytes, endianness_t endianness, void *ptr = NULL)
: m_next(NULL),
m_ptr(ptr),
m_bytes(bytes),
- m_width(width) { }
+ m_width(width),
+ m_endianness(endianness) { }
// getters
memory_share *next() const { return m_next; }
void *ptr() const { if (this == NULL) return NULL; return m_ptr; }
size_t bytes() const { return m_bytes; }
UINT8 width() const { return m_width; }
+ endianness_t endianness() const { return m_endianness; }
// setters
void set_ptr(void *ptr) { m_ptr = ptr; }
@@ -751,6 +753,7 @@ private:
void * m_ptr; // pointer to the memory backing the region
size_t m_bytes; // size of the shared region in bytes
UINT8 m_width; // width of the shared region
+ endianness_t m_endianness; // endianness of the memory
};
diff --git a/src/emu/save.h b/src/emu/save.h
index b0e3d6a1eff..9daf7636be9 100644
--- a/src/emu/save.h
+++ b/src/emu/save.h
@@ -307,6 +307,12 @@ inline void save_manager::save_item(const char *module, const char *tag, int ind
}
template<>
+inline void save_manager::save_item(const char *module, const char *tag, int index, dynamic_array<INT32> &value, const char *name)
+{
+ save_memory(module, tag, index, name, &value[0], sizeof(INT32), value.count());
+}
+
+template<>
inline void save_manager::save_item(const char *module, const char *tag, int index, dynamic_array<UINT32> &value, const char *name)
{
save_memory(module, tag, index, name, &value[0], sizeof(UINT32), value.count());
diff --git a/src/emu/tilelgcy.h b/src/emu/tilelgcy.h
index db0bb33d207..71707d10b6b 100644
--- a/src/emu/tilelgcy.h
+++ b/src/emu/tilelgcy.h
@@ -42,6 +42,28 @@
#ifndef __TILELGCY_H__
#define __TILELGCY_H__
+
+//**************************************************************************
+// MACROS
+//**************************************************************************
+
+#define TILE_GET_INFO(_name) void _name(driver_device &device, tilemap_t &tilemap, tile_data &tileinfo, tilemap_memory_index tile_index)
+#define TILEMAP_MAPPER(_name) tilemap_memory_index _name(driver_device &device, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows)
+
+#define SET_TILE_INFO(GFX,CODE,COLOR,FLAGS) tileinfo.set(device.machine(), GFX, CODE, COLOR, FLAGS)
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// legacy callbacks
+typedef void (*tile_get_info_func)(driver_device &device, tilemap_t &tilemap, tile_data &tileinfo, tilemap_memory_index tile_index);
+typedef tilemap_memory_index (*tilemap_mapper_func)(driver_device &device, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows);
+
+
+
//**************************************************************************
// FUNCTION PROTOTYPES
//**************************************************************************
@@ -51,9 +73,9 @@
// create a new tilemap; note that tilemaps are tracked by the core so there is no dispose
inline tilemap_t *tilemap_create(running_machine &machine, tile_get_info_func tile_get_info, tilemap_mapper_func mapper, int tilewidth, int tileheight, int cols, int rows)
-{ return &machine.tilemap().create(tilemap_get_info_delegate(tile_get_info, "", &machine), tilemap_mapper_delegate(mapper, "", &machine), tilewidth, tileheight, cols, rows); }
+{ return &machine.tilemap().create(tilemap_get_info_delegate(tile_get_info, "", machine.driver_data()), tilemap_mapper_delegate(mapper, "", machine.driver_data()), tilewidth, tileheight, cols, rows); }
inline tilemap_t *tilemap_create(running_machine &machine, tile_get_info_func tile_get_info, tilemap_standard_mapper mapper, int tilewidth, int tileheight, int cols, int rows)
-{ return &machine.tilemap().create(tilemap_get_info_delegate(tile_get_info, "", &machine), mapper, tilewidth, tileheight, cols, rows); }
+{ return &machine.tilemap().create(tilemap_get_info_delegate(tile_get_info, "", machine.driver_data()), mapper, tilewidth, tileheight, cols, rows); }
#endif /* __TILELGCY_H__ */
diff --git a/src/emu/tilemap.c b/src/emu/tilemap.c
index 61b3a27725f..a11380f78ef 100644
--- a/src/emu/tilemap.c
+++ b/src/emu/tilemap.c
@@ -359,47 +359,73 @@ inline void tilemap_t::scanline_draw_masked_rgb32_alpha(UINT32 *dest, const UINT
//**************************************************************************
//-------------------------------------------------
-// tilemap_create_common - shared creation
-// function
-//-------------------------------------------------
-
-tilemap_t::tilemap_t(tilemap_manager &manager, tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, int tilewidth, int tileheight, int cols, int rows)
- : m_next(NULL),
- m_rows(rows),
- m_cols(cols),
- m_tilewidth(tilewidth),
- m_tileheight(tileheight),
- m_width(cols * tilewidth),
- m_height(rows * tileheight),
- m_mapper(mapper),
- m_memory_to_logical(NULL),
- m_max_logical_index(0),
- m_logical_to_memory(NULL),
- m_max_memory_index(0),
- m_tile_get_info(tile_get_info),
- m_user_data(NULL),
- m_enable(true),
- m_attributes(0),
- m_all_tiles_dirty(true),
- m_all_tiles_clean(false),
- m_palette_offset(0),
- m_pen_data_offset(0),
- m_gfx_used(0),
- m_scrollrows(1),
- m_scrollcols(1),
- m_rowscroll(auto_alloc_array_clear(manager.machine(), INT32, m_height)),
- m_colscroll(auto_alloc_array_clear(manager.machine(), INT32, m_width)),
- m_dx(0),
- m_dx_flipped(0),
- m_dy(0),
- m_dy_flipped(0),
- m_pixmap(m_width, m_height),
- m_flagsmap(m_width, m_height),
- m_tileflags(NULL),
- m_manager(manager)
-{
- // reset internal arrays
+// tilemap_t - constructor
+//-------------------------------------------------
+
+tilemap_t::tilemap_t()
+{
+ // until init() is called, data is floating; this is deliberate
+}
+
+
+//-------------------------------------------------
+// init - initialize the tilemap
+//-------------------------------------------------
+
+tilemap_t &tilemap_t::init(tilemap_manager &manager, tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, int tilewidth, int tileheight, int cols, int rows)
+{
+ // populate managers and devices
+ m_manager = &manager;
+ m_device = dynamic_cast<tilemap_device *>(this);
+ m_next = NULL;
+ m_user_data = NULL;
+
+ // populate tilemap metrics
+ m_rows = rows;
+ m_cols = cols;
+ m_tilewidth = tilewidth;
+ m_tileheight = tileheight;
+ m_width = cols * tilewidth;
+ m_height = rows * tileheight;
+
+ // populate logical <-> memory mappings
+ m_mapper = mapper;
+ m_memory_to_logical = NULL;
+ m_max_logical_index = 0;
+ m_logical_to_memory = NULL;
+ m_max_memory_index = 0;
+
+ // initialize tile information geters
+ m_tile_get_info = tile_get_info;
+
+ // reset global states
+ m_enable = true;
+ m_attributes = 0;
+ m_all_tiles_dirty = true;
+ m_all_tiles_clean = false;
+ m_palette_offset = 0;
+ m_pen_data_offset = 0;
+ m_gfx_used = 0;
memset(m_gfx_dirtyseq, 0, sizeof(m_gfx_dirtyseq));
+
+ // reset scroll information
+ m_scrollrows = 1;
+ m_scrollcols = 1;
+ m_rowscroll.resize(m_height);
+ memset(&m_rowscroll[0], 0, m_height * sizeof(m_rowscroll[0]));
+ m_colscroll.resize(m_width);
+ memset(&m_colscroll[0], 0, m_width * sizeof(m_rowscroll[0]));
+ m_dx = 0;
+ m_dx_flipped = 0;
+ m_dy = 0;
+ m_dy_flipped = 0;
+
+ // allocate pixmap
+ m_pixmap.allocate(m_width, m_height);
+
+ // allocate transparency mapping
+ m_flagsmap.allocate(m_width, m_height);
+ m_tileflags = NULL;
memset(m_pen_to_flags, 0, sizeof(m_pen_to_flags));
// create the initial mappings
@@ -423,8 +449,8 @@ tilemap_t::tilemap_t(tilemap_manager &manager, tilemap_get_info_delegate tile_ge
machine().save().save_item("tilemap", NULL, instance, NAME(m_pen_data_offset));
machine().save().save_item("tilemap", NULL, instance, NAME(m_scrollrows));
machine().save().save_item("tilemap", NULL, instance, NAME(m_scrollcols));
- machine().save().save_pointer("tilemap", NULL, instance, NAME(m_rowscroll), rows * tileheight);
- machine().save().save_pointer("tilemap", NULL, instance, NAME(m_colscroll), cols * tilewidth);
+ machine().save().save_item("tilemap", NULL, instance, NAME(m_rowscroll));
+ machine().save().save_item("tilemap", NULL, instance, NAME(m_colscroll));
machine().save().save_item("tilemap", NULL, instance, NAME(m_dx));
machine().save().save_item("tilemap", NULL, instance, NAME(m_dx_flipped));
machine().save().save_item("tilemap", NULL, instance, NAME(m_dy));
@@ -432,6 +458,7 @@ tilemap_t::tilemap_t(tilemap_manager &manager, tilemap_get_info_delegate tile_ge
// reset everything after a load
machine().save().register_postload(save_prepost_delegate(FUNC(tilemap_t::postload), this));
+ return *this;
}
@@ -548,22 +575,22 @@ void tilemap_t::set_transmask(int group, UINT32 fgmask, UINT32 bgmask)
// order with optional flipping
//-------------------------------------------------
-tilemap_memory_index tilemap_t::scan_rows(running_machine &machine, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows)
+tilemap_memory_index tilemap_t::scan_rows(driver_device &device, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows)
{
return row * num_cols + col;
}
-tilemap_memory_index tilemap_t::scan_rows_flip_x(running_machine &machine, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows)
+tilemap_memory_index tilemap_t::scan_rows_flip_x(driver_device &device, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows)
{
return row * num_cols + (num_cols - 1 - col);
}
-tilemap_memory_index tilemap_t::scan_rows_flip_y(running_machine &machine, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows)
+tilemap_memory_index tilemap_t::scan_rows_flip_y(driver_device &device, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows)
{
return (num_rows - 1 - row) * num_cols + col;
}
-tilemap_memory_index tilemap_t::scan_rows_flip_xy(running_machine &machine, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows)
+tilemap_memory_index tilemap_t::scan_rows_flip_xy(driver_device &device, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows)
{
return (num_rows - 1 - row) * num_cols + (num_cols - 1 - col);
}
@@ -577,22 +604,22 @@ tilemap_memory_index tilemap_t::scan_rows_flip_xy(running_machine &machine, UINT
// major order with optional flipping
//-------------------------------------------------
-tilemap_memory_index tilemap_t::scan_cols(running_machine &machine, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows)
+tilemap_memory_index tilemap_t::scan_cols(driver_device &device, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows)
{
return col * num_rows + row;
}
-tilemap_memory_index tilemap_t::scan_cols_flip_x(running_machine &machine, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows)
+tilemap_memory_index tilemap_t::scan_cols_flip_x(driver_device &device, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows)
{
return (num_cols - 1 - col) * num_rows + row;
}
-tilemap_memory_index tilemap_t::scan_cols_flip_y(running_machine &machine, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows)
+tilemap_memory_index tilemap_t::scan_cols_flip_y(driver_device &device, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows)
{
return col * num_rows + (num_rows - 1 - row);
}
-tilemap_memory_index tilemap_t::scan_cols_flip_xy(running_machine &machine, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows)
+tilemap_memory_index tilemap_t::scan_cols_flip_xy(driver_device &device, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows)
{
return (num_cols - 1 - col) * num_rows + (num_rows - 1 - row);
}
@@ -737,7 +764,7 @@ g_profiler.start(PROFILER_TILEMAP_UPDATE);
// call the get info callback for the associated memory index
tilemap_memory_index memindex = m_logical_to_memory[logindex];
- m_tile_get_info(m_tileinfo, memindex, m_user_data);
+ m_tile_get_info(*this, m_tileinfo, memindex);
// apply the global tilemap flip to the returned flip flags
UINT32 flags = m_tileinfo.flags ^ (m_attributes & 0x03);
@@ -1462,6 +1489,170 @@ void tilemap_t::draw_debug(bitmap_rgb32 &dest, UINT32 scrollx, UINT32 scrolly)
//**************************************************************************
+// TILEMAP MEMORY HELPER
+//**************************************************************************
+
+//-------------------------------------------------
+// tilemap_memory - constructor
+//-------------------------------------------------
+
+tilemap_memory::tilemap_memory()
+ : m_base(NULL),
+ m_bytes(0),
+ m_membits(0),
+ m_bytes_per_entry(0)
+{
+}
+
+
+//-------------------------------------------------
+// set - configure the parameters
+//-------------------------------------------------
+
+void tilemap_memory::set(void *base, UINT32 bytes, int membits, endianness_t endianness, int bpe)
+{
+ // validate inputs
+ assert(base != NULL);
+ assert(bytes > 0);
+ assert(membits == 8 || membits == 16 || membits == 32 || membits == 64);
+ assert(bpe == 1 || bpe == 2 || bpe == 4);
+
+ // populate direct data
+ m_base = base;
+ m_bytes = bytes;
+ m_membits = membits;
+ m_endianness = endianness;
+ m_bytes_per_entry = bpe;
+
+ // derive data
+ switch (bpe*1000 + membits*10 + endianness)
+ {
+ case 1*1000 + 8*10 + ENDIANNESS_LITTLE: m_reader = &tilemap_memory::read8_from_8; m_writer = &tilemap_memory::write8_to_8; break;
+ case 1*1000 + 8*10 + ENDIANNESS_BIG: m_reader = &tilemap_memory::read8_from_8; m_writer = &tilemap_memory::write8_to_8; break;
+ case 1*1000 + 16*10 + ENDIANNESS_LITTLE: m_reader = &tilemap_memory::read8_from_16le; m_writer = &tilemap_memory::write8_to_16le; break;
+ case 1*1000 + 16*10 + ENDIANNESS_BIG: m_reader = &tilemap_memory::read8_from_16be; m_writer = &tilemap_memory::write8_to_16be; break;
+ case 1*1000 + 32*10 + ENDIANNESS_LITTLE: m_reader = &tilemap_memory::read8_from_32le; m_writer = &tilemap_memory::write8_to_32le; break;
+ case 1*1000 + 32*10 + ENDIANNESS_BIG: m_reader = &tilemap_memory::read8_from_32be; m_writer = &tilemap_memory::write8_to_32be; break;
+ case 1*1000 + 64*10 + ENDIANNESS_LITTLE: m_reader = &tilemap_memory::read8_from_64le; m_writer = &tilemap_memory::write8_to_64le; break;
+ case 1*1000 + 64*10 + ENDIANNESS_BIG: m_reader = &tilemap_memory::read8_from_64be; m_writer = &tilemap_memory::write8_to_64be; break;
+
+ case 2*1000 + 8*10 + ENDIANNESS_LITTLE: m_reader = &tilemap_memory::read16_from_8le; m_writer = &tilemap_memory::write16_to_8le; break;
+ case 2*1000 + 8*10 + ENDIANNESS_BIG: m_reader = &tilemap_memory::read16_from_8be; m_writer = &tilemap_memory::write16_to_8be; break;
+ case 2*1000 + 16*10 + ENDIANNESS_LITTLE: m_reader = &tilemap_memory::read16_from_16; m_writer = &tilemap_memory::write16_to_16; break;
+ case 2*1000 + 16*10 + ENDIANNESS_BIG: m_reader = &tilemap_memory::read16_from_16; m_writer = &tilemap_memory::write16_to_16; break;
+ case 2*1000 + 32*10 + ENDIANNESS_LITTLE: m_reader = &tilemap_memory::read16_from_32le; m_writer = &tilemap_memory::write16_to_32le; break;
+ case 2*1000 + 32*10 + ENDIANNESS_BIG: m_reader = &tilemap_memory::read16_from_32be; m_writer = &tilemap_memory::write16_to_32be; break;
+ case 2*1000 + 64*10 + ENDIANNESS_LITTLE: m_reader = &tilemap_memory::read16_from_64le; m_writer = &tilemap_memory::write16_to_64le; break;
+ case 2*1000 + 64*10 + ENDIANNESS_BIG: m_reader = &tilemap_memory::read16_from_64be; m_writer = &tilemap_memory::write16_to_64be; break;
+
+ case 4*1000 + 8*10 + ENDIANNESS_LITTLE: m_reader = &tilemap_memory::read32_from_8le; m_writer = &tilemap_memory::write32_to_8le; break;
+ case 4*1000 + 8*10 + ENDIANNESS_BIG: m_reader = &tilemap_memory::read32_from_8be; m_writer = &tilemap_memory::write32_to_8be; break;
+ case 4*1000 + 16*10 + ENDIANNESS_LITTLE: m_reader = &tilemap_memory::read32_from_16le; m_writer = &tilemap_memory::write32_to_16le; break;
+ case 4*1000 + 16*10 + ENDIANNESS_BIG: m_reader = &tilemap_memory::read32_from_16be; m_writer = &tilemap_memory::write32_to_16be; break;
+ case 4*1000 + 32*10 + ENDIANNESS_LITTLE: m_reader = &tilemap_memory::read32_from_32; m_writer = &tilemap_memory::write32_to_32; break;
+ case 4*1000 + 32*10 + ENDIANNESS_BIG: m_reader = &tilemap_memory::read32_from_32; m_writer = &tilemap_memory::write32_to_32; break;
+ case 4*1000 + 64*10 + ENDIANNESS_LITTLE: m_reader = &tilemap_memory::read32_from_64le; m_writer = &tilemap_memory::write32_to_64le; break;
+ case 4*1000 + 64*10 + ENDIANNESS_BIG: m_reader = &tilemap_memory::read32_from_64be; m_writer = &tilemap_memory::write32_to_64be; break;
+
+ default: throw emu_fatalerror("Illegal memory bits/bus width combo in tilemap_memory");
+ }
+}
+
+
+//-------------------------------------------------
+// set - additional setter variants
+//-------------------------------------------------
+
+void tilemap_memory::set(const address_space &space, void *base, UINT32 bytes, int bpe)
+{
+ set(base, bytes, space.data_width(), space.endianness(), bpe);
+}
+
+void tilemap_memory::set(const memory_share &share, int bpe)
+{
+ set(share.ptr(), share.bytes(), share.width(), share.endianness(), bpe);
+}
+
+void tilemap_memory::set(const tilemap_memory &helper)
+{
+ set(helper.base(), helper.bytes(), helper.membits(), helper.endianness(), helper.bytes_per_entry());
+}
+
+
+//-------------------------------------------------
+// read8_from_*/write8_to_* - entry read/write
+// heleprs for 1 byte-per-entry
+//-------------------------------------------------
+
+UINT32 tilemap_memory::read8_from_8(int index) { return reinterpret_cast<UINT8 *>(m_base)[index]; }
+void tilemap_memory::write8_to_8(int index, UINT32 data) { reinterpret_cast<UINT8 *>(m_base)[index] = data; }
+
+UINT32 tilemap_memory::read8_from_16le(int index) { return reinterpret_cast<UINT8 *>(m_base)[BYTE_XOR_LE(index)]; }
+void tilemap_memory::write8_to_16le(int index, UINT32 data) { reinterpret_cast<UINT8 *>(m_base)[BYTE_XOR_LE(index)] = data; }
+UINT32 tilemap_memory::read8_from_16be(int index) { return reinterpret_cast<UINT8 *>(m_base)[BYTE_XOR_BE(index)]; }
+void tilemap_memory::write8_to_16be(int index, UINT32 data) { reinterpret_cast<UINT8 *>(m_base)[BYTE_XOR_BE(index)] = data; }
+
+UINT32 tilemap_memory::read8_from_32le(int index) { return reinterpret_cast<UINT8 *>(m_base)[BYTE4_XOR_BE(index)]; }
+void tilemap_memory::write8_to_32le(int index, UINT32 data) { reinterpret_cast<UINT8 *>(m_base)[BYTE4_XOR_BE(index)] = data; }
+UINT32 tilemap_memory::read8_from_32be(int index) { return reinterpret_cast<UINT8 *>(m_base)[BYTE4_XOR_BE(index)]; }
+void tilemap_memory::write8_to_32be(int index, UINT32 data) { reinterpret_cast<UINT8 *>(m_base)[BYTE4_XOR_BE(index)] = data; }
+
+UINT32 tilemap_memory::read8_from_64le(int index) { return reinterpret_cast<UINT8 *>(m_base)[BYTE8_XOR_BE(index)]; }
+void tilemap_memory::write8_to_64le(int index, UINT32 data) { reinterpret_cast<UINT8 *>(m_base)[BYTE8_XOR_BE(index)] = data; }
+UINT32 tilemap_memory::read8_from_64be(int index) { return reinterpret_cast<UINT8 *>(m_base)[BYTE8_XOR_BE(index)]; }
+void tilemap_memory::write8_to_64be(int index, UINT32 data) { reinterpret_cast<UINT8 *>(m_base)[BYTE8_XOR_BE(index)] = data; }
+
+
+//-------------------------------------------------
+// read16_from_*/write16_to_* - entry read/write
+// heleprs for 2 bytes-per-entry
+//-------------------------------------------------
+
+UINT32 tilemap_memory::read16_from_8le(int index) { return read8_from_8(index*2) | (read8_from_8(index*2+1) << 8); }
+void tilemap_memory::write16_to_8le(int index, UINT32 data) { write8_to_8(index*2, data); write8_to_8(index*2+1, data >> 8); }
+UINT32 tilemap_memory::read16_from_8be(int index) { return (read8_from_8(index*2) << 8) | read8_from_8(index*2+1); }
+void tilemap_memory::write16_to_8be(int index, UINT32 data) { write8_to_8(index*2, data >> 8); write8_to_8(index*2+1, data); }
+
+UINT32 tilemap_memory::read16_from_16(int index) { return reinterpret_cast<UINT16 *>(m_base)[index]; }
+void tilemap_memory::write16_to_16(int index, UINT32 data) { reinterpret_cast<UINT16 *>(m_base)[index] = data; }
+
+UINT32 tilemap_memory::read16_from_32le(int index) { return reinterpret_cast<UINT16 *>(m_base)[BYTE_XOR_LE(index)]; }
+void tilemap_memory::write16_to_32le(int index, UINT32 data) { reinterpret_cast<UINT16 *>(m_base)[BYTE_XOR_LE(index)] = data; }
+UINT32 tilemap_memory::read16_from_32be(int index) { return reinterpret_cast<UINT16 *>(m_base)[BYTE_XOR_BE(index)]; }
+void tilemap_memory::write16_to_32be(int index, UINT32 data) { reinterpret_cast<UINT16 *>(m_base)[BYTE_XOR_BE(index)] = data; }
+
+UINT32 tilemap_memory::read16_from_64le(int index) { return reinterpret_cast<UINT16 *>(m_base)[BYTE4_XOR_LE(index)]; }
+void tilemap_memory::write16_to_64le(int index, UINT32 data) { reinterpret_cast<UINT16 *>(m_base)[BYTE4_XOR_LE(index)] = data; }
+UINT32 tilemap_memory::read16_from_64be(int index) { return reinterpret_cast<UINT16 *>(m_base)[BYTE4_XOR_BE(index)]; }
+void tilemap_memory::write16_to_64be(int index, UINT32 data) { reinterpret_cast<UINT16 *>(m_base)[BYTE4_XOR_BE(index)] = data; }
+
+
+//-------------------------------------------------
+// read32_from_*/write32_to_* - entry read/write
+// heleprs for 4 bytes-per-entry
+//-------------------------------------------------
+
+UINT32 tilemap_memory::read32_from_8le(int index) { return read16_from_8le(index*2) | (read16_from_8le(index*2+1) << 16); }
+void tilemap_memory::write32_to_8le(int index, UINT32 data) { write16_to_8le(index*2, data); write16_to_8le(index*2+1, data >> 16); }
+UINT32 tilemap_memory::read32_from_8be(int index) { return (read16_from_8be(index*2) << 16) | read16_from_8be(index*2+1); }
+void tilemap_memory::write32_to_8be(int index, UINT32 data) { write16_to_8be(index*2, data >> 16); write16_to_8be(index*2+1, data); }
+
+UINT32 tilemap_memory::read32_from_16le(int index) { return read16_from_16(index*2) | (read16_from_16(index*2+1) << 16); }
+void tilemap_memory::write32_to_16le(int index, UINT32 data) { write16_to_16(index*2, data); write16_to_16(index*2+1, data >> 16); }
+UINT32 tilemap_memory::read32_from_16be(int index) { return (read16_from_16(index*2) << 16) | read16_from_16(index*2+1); }
+void tilemap_memory::write32_to_16be(int index, UINT32 data) { write16_to_16(index*2, data >> 16); write16_to_16(index*2+1, data); }
+
+UINT32 tilemap_memory::read32_from_32(int index) { return reinterpret_cast<UINT32 *>(m_base)[index]; }
+void tilemap_memory::write32_to_32(int index, UINT32 data) { reinterpret_cast<UINT32 *>(m_base)[index] = data; }
+
+UINT32 tilemap_memory::read32_from_64le(int index) { return reinterpret_cast<UINT32 *>(m_base)[BYTE_XOR_LE(index)]; }
+void tilemap_memory::write32_to_64le(int index, UINT32 data) { reinterpret_cast<UINT32 *>(m_base)[BYTE_XOR_LE(index)] = data; }
+UINT32 tilemap_memory::read32_from_64be(int index) { return reinterpret_cast<UINT32 *>(m_base)[BYTE_XOR_BE(index)]; }
+void tilemap_memory::write32_to_64be(int index, UINT32 data) { reinterpret_cast<UINT32 *>(m_base)[BYTE_XOR_BE(index)] = data; }
+
+
+
+//**************************************************************************
// TILEMAP MANAGER
//**************************************************************************
@@ -1486,7 +1677,7 @@ tilemap_manager::tilemap_manager(running_machine &machine)
static const struct
{
- tilemap_memory_index (*func)(running_machine &, UINT32, UINT32, UINT32, UINT32);
+ tilemap_memory_index (*func)(driver_device &, UINT32, UINT32, UINT32, UINT32);
const char *name;
} s_standard_mappers[TILEMAP_STANDARD_COUNT] =
{
@@ -1500,24 +1691,18 @@ static const struct
{ FUNC(tilemap_t::scan_cols_flip_xy) }
};
-tilemap_t &tilemap_manager::create(tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, int tilewidth, int tileheight, int cols, int rows)
+tilemap_t &tilemap_manager::create(tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, int tilewidth, int tileheight, int cols, int rows, tilemap_t *allocated)
{
- return m_tilemap_list.append(*auto_alloc(machine(), tilemap_t(*this, tile_get_info, mapper, tilewidth, tileheight, cols, rows)));
+ if (allocated == NULL)
+ allocated = auto_alloc(machine(), tilemap_t);
+ return m_tilemap_list.append(allocated->init(*this, tile_get_info, mapper, tilewidth, tileheight, cols, rows));
}
-tilemap_t &tilemap_manager::create(tilemap_get_info_delegate tile_get_info, tilemap_standard_mapper mapper, int tilewidth, int tileheight, int cols, int rows)
+tilemap_t &tilemap_manager::create(tilemap_get_info_delegate tile_get_info, tilemap_standard_mapper mapper, int tilewidth, int tileheight, int cols, int rows, tilemap_t *allocated)
{
- return m_tilemap_list.append(*auto_alloc(machine(), tilemap_t(*this, tile_get_info, tilemap_mapper_delegate(s_standard_mappers[mapper].func, s_standard_mappers[mapper].name, &machine()), tilewidth, tileheight, cols, rows)));
-}
-
-tilemap_t &tilemap_manager::create(tile_get_info_func tile_get_info, tilemap_mapper_func mapper, int tilewidth, int tileheight, int cols, int rows)
-{
- return m_tilemap_list.append(*auto_alloc(machine(), tilemap_t(*this, tilemap_get_info_delegate(tile_get_info, "", &machine()), tilemap_mapper_delegate(mapper, "", &machine()), tilewidth, tileheight, cols, rows)));
-}
-
-tilemap_t &tilemap_manager::create(tile_get_info_func tile_get_info, tilemap_standard_mapper mapper, int tilewidth, int tileheight, int cols, int rows)
-{
- return m_tilemap_list.append(*auto_alloc(machine(), tilemap_t(*this, tilemap_get_info_delegate(tile_get_info, "", &machine()), tilemap_mapper_delegate(s_standard_mappers[mapper].func, s_standard_mappers[mapper].name, &machine()), tilewidth, tileheight, cols, rows)));
+ if (allocated == NULL)
+ allocated = auto_alloc(machine(), tilemap_t);
+ return m_tilemap_list.append(allocated->init(*this, tile_get_info, tilemap_mapper_delegate(s_standard_mappers[mapper].func, s_standard_mappers[mapper].name, machine().driver_data()), tilewidth, tileheight, cols, rows));
}
@@ -1543,3 +1728,213 @@ void tilemap_manager::mark_all_dirty()
for (tilemap_t *tmap = m_tilemap_list.first(); tmap != NULL; tmap = tmap->next())
tmap->mark_all_dirty();
}
+
+
+
+//**************************************************************************
+// TILEMAP DEVICE
+//**************************************************************************
+
+// device type definition
+const device_type TILEMAP = &device_creator<tilemap_device>;
+
+//-------------------------------------------------
+// tilemap_device - constructor
+//-------------------------------------------------
+
+tilemap_device::tilemap_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : device_t(mconfig, TILEMAP, "Tilemap", tag, owner, clock, "tilemap", __FILE__),
+ m_standard_mapper(TILEMAP_STANDARD_COUNT),
+ m_tile_width(8),
+ m_tile_height(8),
+ m_num_columns(64),
+ m_num_rows(64),
+ m_transparent_pen_set(false),
+ m_transparent_pen(0)
+{
+}
+
+
+//-------------------------------------------------
+// static_set_bytes_per_entry: Set the
+// transparent pen
+//-------------------------------------------------
+
+void tilemap_device::static_set_bytes_per_entry(device_t &device, int bpe)
+{
+ downcast<tilemap_device &>(device).m_bytes_per_entry = bpe;
+}
+
+
+//-------------------------------------------------
+// static_set_info_callback: Set the get info
+// callback delegate
+//-------------------------------------------------
+
+void tilemap_device::static_set_info_callback(device_t &device, tilemap_get_info_delegate get_info)
+{
+ downcast<tilemap_device &>(device).m_get_info = get_info;
+}
+
+
+//-------------------------------------------------
+// static_set_layout: Set the tilemap size and
+// layout
+//-------------------------------------------------
+
+void tilemap_device::static_set_layout(device_t &device, tilemap_standard_mapper mapper, int columns, int rows)
+{
+ tilemap_device &target = downcast<tilemap_device &>(device);
+ target.m_standard_mapper = mapper;
+ target.m_num_columns = columns;
+ target.m_num_rows = rows;
+}
+
+void tilemap_device::static_set_layout(device_t &device, tilemap_mapper_delegate mapper, int columns, int rows)
+{
+ tilemap_device &target = downcast<tilemap_device &>(device);
+ target.m_standard_mapper = TILEMAP_STANDARD_COUNT;
+ target.m_mapper = mapper;
+ target.m_num_columns = columns;
+ target.m_num_rows = rows;
+}
+
+
+//-------------------------------------------------
+// static_set_tile_size: Set the tile size
+//-------------------------------------------------
+
+void tilemap_device::static_set_tile_size(device_t &device, int width, int height)
+{
+ tilemap_device &target = downcast<tilemap_device &>(device);
+ target.m_tile_width = width;
+ target.m_tile_height = height;
+}
+
+
+//-------------------------------------------------
+// static_set_transparent_pen: Set the
+// transparent pen
+//-------------------------------------------------
+
+void tilemap_device::static_set_transparent_pen(device_t &device, pen_t pen)
+{
+ tilemap_device &target = downcast<tilemap_device &>(device);
+ target.m_transparent_pen_set = true;
+ target.m_transparent_pen = pen;
+}
+
+
+//-------------------------------------------------
+// write: Main memory writes
+//-------------------------------------------------
+
+WRITE8_HANDLER(tilemap_device::write)
+{
+ reinterpret_cast<UINT8 *>(m_basemem.base())[offset] = data;
+ offset /= m_bytes_per_entry;
+ mark_tile_dirty(offset);
+}
+
+WRITE16_HANDLER(tilemap_device::write)
+{
+ COMBINE_DATA(&reinterpret_cast<UINT16 *>(m_basemem.base())[offset]);
+ offset = offset * 2 / m_bytes_per_entry;
+ mark_tile_dirty(offset);
+ if (m_bytes_per_entry < 2)
+ mark_tile_dirty(offset + 1);
+}
+
+WRITE32_HANDLER(tilemap_device::write)
+{
+ COMBINE_DATA(&reinterpret_cast<UINT32 *>(m_basemem.base())[offset]);
+ offset = offset * 4 / m_bytes_per_entry;
+ mark_tile_dirty(offset);
+ if (m_bytes_per_entry < 4)
+ {
+ mark_tile_dirty(offset + 1);
+ if (m_bytes_per_entry < 2)
+ {
+ mark_tile_dirty(offset + 2);
+ mark_tile_dirty(offset + 3);
+ }
+ }
+}
+
+
+//-------------------------------------------------
+// write_entry_ext: Extension memory writes
+//-------------------------------------------------
+
+WRITE8_HANDLER(tilemap_device::write_ext)
+{
+ reinterpret_cast<UINT8 *>(m_extmem.base())[offset] = data;
+ offset /= m_bytes_per_entry;
+ mark_tile_dirty(offset);
+}
+
+WRITE16_HANDLER(tilemap_device::write_ext)
+{
+ COMBINE_DATA(&reinterpret_cast<UINT16 *>(m_extmem.base())[offset]);
+ offset = offset * 2 / m_bytes_per_entry;
+ mark_tile_dirty(offset);
+ if (m_bytes_per_entry < 2)
+ mark_tile_dirty(offset + 1);
+}
+
+WRITE32_HANDLER(tilemap_device::write_ext)
+{
+ COMBINE_DATA(&reinterpret_cast<UINT32 *>(m_extmem.base())[offset]);
+ offset = offset * 4 / m_bytes_per_entry;
+ mark_tile_dirty(offset);
+ if (m_bytes_per_entry < 4)
+ {
+ mark_tile_dirty(offset + 1);
+ if (m_bytes_per_entry < 2)
+ {
+ mark_tile_dirty(offset + 2);
+ mark_tile_dirty(offset + 3);
+ }
+ }
+}
+
+
+//-------------------------------------------------
+// device_start: Start up the device
+//-------------------------------------------------
+
+void tilemap_device::device_start()
+{
+ // check configuration
+ if (m_get_info.isnull())
+ throw emu_fatalerror("Tilemap device '%s' has no get info callback!");
+ if (m_standard_mapper == TILEMAP_STANDARD_COUNT && m_mapper.isnull())
+ throw emu_fatalerror("Tilemap device '%s' has no mapper callback!");
+
+ // bind our callbacks
+ m_get_info.bind_relative_to(*owner());
+ m_mapper.bind_relative_to(*owner());
+
+ // allocate the tilemap
+ if (m_standard_mapper == TILEMAP_STANDARD_COUNT)
+ machine().tilemap().create(m_get_info, m_mapper, m_tile_width, m_tile_height, m_num_columns, m_num_rows, this);
+ else
+ machine().tilemap().create(m_get_info, m_standard_mapper, m_tile_width, m_tile_height, m_num_columns, m_num_rows, this);
+
+ // find the memory, if present
+ const memory_share *share = memshare(tag());
+ if (share != NULL)
+ {
+ m_basemem.set(*share, m_bytes_per_entry);
+
+ // look for an extension entry
+ astring tag_ext(tag(), "_ext");
+ share = memshare(tag_ext.cstr());
+ if (share != NULL)
+ m_extmem.set(*share, m_bytes_per_entry);
+ }
+
+ // configure the device and set the pen
+ if (m_transparent_pen_set)
+ set_transparent_pen(m_transparent_pen);
+}
diff --git a/src/emu/tilemap.h b/src/emu/tilemap.h
index 3d6551d4436..ac4b2ae0cd3 100644
--- a/src/emu/tilemap.h
+++ b/src/emu/tilemap.h
@@ -382,12 +382,70 @@ enum tilemap_standard_mapper
//**************************************************************************
+// DEVICE CONFIGURATION MACROS
+//**************************************************************************
+
+// primitives
+#define MCFG_TILEMAP_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, TILEMAP, 0)
+#define MCFG_TILEMAP_BYTES_PER_ENTRY(_bpe) \
+ tilemap_device::static_set_bytes_per_entry(*device, _bpe);
+#define MCFG_TILEMAP_INFO_CB_DRIVER(_class, _method) \
+ tilemap_device::static_set_info_callback(*device, tilemap_get_info_delegate(&_class::_method, #_class "::" #_method, NULL, (_class *)0));
+#define MCFG_TILEMAP_INFO_CB_DEVICE(_device, _class, _method) \
+ tilemap_device::static_set_info_callback(*device, tilemap_get_info_delegate(&_class::_method, #_class "::" #_method, _device, (_class *)0));
+#define MCFG_TILEMAP_LAYOUT_STANDARD(_standard, _columns, _rows) \
+ tilemap_device::static_set_layout(*device, TILEMAP_##_standard, _columns, _rows);
+#define MCFG_TILEMAP_LAYOUT_CB_DRIVER(_class, _method, _columns, _rows) \
+ tilemap_device::static_set_layout(*device, tilemap_mapper_delegate(&_class::_method, #_class "::" #_method, NULL, (_class *)0), _columns, _rows);
+#define MCFG_TILEMAP_LAYOUT_CB_DEVICE(_device, _class, _method, _columns, _rows) \
+ tilemap_device::static_set_layout(*device, tilemap_mapper_delegate(&_class::_method, #_class "::" #_method, _device, (_class *)0), _columns, _rows);
+#define MCFG_TILEMAP_TILE_SIZE(_width, _height) \
+ tilemap_device::static_set_tile_size(*device, _width, _height);
+#define MCFG_TILEMAP_TRANSPARENT_PEN(_pen) \
+ tilemap_device::static_set_transparent_pen(*device, _pen);
+
+// common cases
+#define MCFG_TILEMAP_ADD_STANDARD(_tag, _bytes_per_entry, _class, _method, _tilewidth, _tileheight, _mapper, _columns, _rows) \
+ MCFG_TILEMAP_ADD(_tag) \
+ MCFG_TILEMAP_BYTES_PER_ENTRY(_bytes_per_entry) \
+ MCFG_TILEMAP_INFO_CB_DRIVER(_class, _method) \
+ MCFG_TILEMAP_LAYOUT_STANDARD(_mapper, _columns, _rows) \
+ MCFG_TILEMAP_TILE_SIZE(_tilewidth, _tileheight) \
+
+#define MCFG_TILEMAP_ADD_CUSTOM(_tag, _bytes_per_entry, _class, _method, _tilewidth, _tileheight, _mapper, _columns, _rows) \
+ MCFG_TILEMAP_ADD(_tag) \
+ MCFG_TILEMAP_BYTES_PER_ENTRY(_bytes_per_entry) \
+ MCFG_TILEMAP_INFO_CB_DRIVER(_class, _method) \
+ MCFG_TILEMAP_LAYOUT_CB_DRIVER(_class, _mapper, _columns, _rows) \
+ MCFG_TILEMAP_TILE_SIZE(_tilewidth, _tileheight) \
+
+#define MCFG_TILEMAP_ADD_STANDARD_TRANSPEN(_tag, _bytes_per_entry, _class, _method, _tilewidth, _tileheight, _mapper, _columns, _rows, _transpen) \
+ MCFG_TILEMAP_ADD(_tag) \
+ MCFG_TILEMAP_BYTES_PER_ENTRY(_bytes_per_entry) \
+ MCFG_TILEMAP_INFO_CB_DRIVER(_class, _method) \
+ MCFG_TILEMAP_LAYOUT_STANDARD(_mapper, _columns, _rows) \
+ MCFG_TILEMAP_TILE_SIZE(_tilewidth, _tileheight) \
+ MCFG_TILEMAP_TRANSPARENT_PEN(_transpen) \
+
+#define MCFG_TILEMAP_ADD_CUSTOM_TRANSPEN(_tag, _bytes_per_entry, _class, _method, _tilewidth, _tileheight, _mapper, _columns, _rows, _transpen) \
+ MCFG_TILEMAP_ADD(_tag) \
+ MCFG_TILEMAP_BYTES_PER_ENTRY(_bytes_per_entry) \
+ MCFG_TILEMAP_INFO_CB_DRIVER(_class, _method) \
+ MCFG_TILEMAP_LAYOUT_CB_DRIVER(_columns, _mapper, _rows, _class) \
+ MCFG_TILEMAP_TILE_SIZE(_tilewidth, _tileheight) \
+ MCFG_TILEMAP_TRANSPARENT_PEN(_transpen) \
+
+
+
+//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// forward declarations
class tilemap_t;
class tilemap_manager;
+class tilemap_device;
// global types
@@ -427,20 +485,85 @@ struct tile_data
// modern delegates
-typedef delegate<void (tile_data &, tilemap_memory_index, void *)> tilemap_get_info_delegate;
-typedef delegate<tilemap_memory_index (UINT32, UINT32, UINT32, UINT32)> tilemap_mapper_delegate;
+typedef device_delegate<void (tilemap_t &, tile_data &, tilemap_memory_index)> tilemap_get_info_delegate;
+typedef device_delegate<tilemap_memory_index (UINT32, UINT32, UINT32, UINT32)> tilemap_mapper_delegate;
+
+
+// ======================> tilemap_memory
+
+// memory information
+class tilemap_memory
+{
+ friend class tilemap_t;
+ // construction/destruction
+ tilemap_memory();
+
+public:
+ // configuration
+ void set(void *base, UINT32 bytes, int membits, endianness_t endianness, int bpe);
+ void set(const address_space &space, void *base, UINT32 bytes, int bpe);
+ void set(const memory_share &share, int bpe);
+ void set(const tilemap_memory &helper);
+
+ // getters
+ void *base() const { return m_base; }
+ UINT32 bytes() const { return m_bytes; }
+ int membits() const { return m_membits; }
+ endianness_t endianness() const { return m_endianness; }
+ int bytes_per_entry() const { return m_bytes_per_entry; }
+
+private:
+ // readers and writers
+ UINT32 read(int index) { return (this->*m_reader)(index); }
+ void write(int index, UINT32 data) { (this->*m_writer)(index, data); }
+
+ // internal read/write helpers for 1 byte entries
+ UINT32 read8_from_8(int index); void write8_to_8(int index, UINT32 data);
+ UINT32 read8_from_16le(int index); void write8_to_16le(int index, UINT32 data);
+ UINT32 read8_from_16be(int index); void write8_to_16be(int index, UINT32 data);
+ UINT32 read8_from_32le(int index); void write8_to_32le(int index, UINT32 data);
+ UINT32 read8_from_32be(int index); void write8_to_32be(int index, UINT32 data);
+ UINT32 read8_from_64le(int index); void write8_to_64le(int index, UINT32 data);
+ UINT32 read8_from_64be(int index); void write8_to_64be(int index, UINT32 data);
+
+ // internal read/write helpers for 2 byte entries
+ UINT32 read16_from_8le(int index); void write16_to_8le(int index, UINT32 data);
+ UINT32 read16_from_8be(int index); void write16_to_8be(int index, UINT32 data);
+ UINT32 read16_from_16(int index); void write16_to_16(int index, UINT32 data);
+ UINT32 read16_from_32le(int index); void write16_to_32le(int index, UINT32 data);
+ UINT32 read16_from_32be(int index); void write16_to_32be(int index, UINT32 data);
+ UINT32 read16_from_64le(int index); void write16_to_64le(int index, UINT32 data);
+ UINT32 read16_from_64be(int index); void write16_to_64be(int index, UINT32 data);
+
+ // internal read/write helpers for 4 byte entries
+ UINT32 read32_from_8le(int index); void write32_to_8le(int index, UINT32 data);
+ UINT32 read32_from_8be(int index); void write32_to_8be(int index, UINT32 data);
+ UINT32 read32_from_16le(int index); void write32_to_16le(int index, UINT32 data);
+ UINT32 read32_from_16be(int index); void write32_to_16be(int index, UINT32 data);
+ UINT32 read32_from_32(int index); void write32_to_32(int index, UINT32 data);
+ UINT32 read32_from_64le(int index); void write32_to_64le(int index, UINT32 data);
+ UINT32 read32_from_64be(int index); void write32_to_64be(int index, UINT32 data);
-// legacy callbacks
-typedef void (*tile_get_info_func)(running_machine &machine, tile_data &tileinfo, tilemap_memory_index tile_index, void *param);
-typedef tilemap_memory_index (*tilemap_mapper_func)(running_machine &machine, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows);
+ // internal state
+ void * m_base;
+ UINT32 m_bytes;
+ int m_membits;
+ endianness_t m_endianness;
+ int m_bytes_per_entry;
+ UINT32 (tilemap_memory::*m_reader)(int);
+ void (tilemap_memory::*m_writer)(int, UINT32);
+};
+// ======================> tilemap_t
+
// core tilemap structure
class tilemap_t
{
DISABLE_COPYING(tilemap_t);
+ friend class tilemap_device;
friend class tilemap_manager;
friend class simple_list<tilemap_t>;
friend resource_pool_object<tilemap_t>::~resource_pool_object();
@@ -457,14 +580,21 @@ class tilemap_t
// maximum index in each array
static const int MAX_PEN_TO_FLAGS = 256;
+protected:
// tilemap_manager controlls our allocations
- tilemap_t(tilemap_manager &manager, tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, int tilewidth, int tileheight, int cols, int rows);
- ~tilemap_t();
+ tilemap_t();
+ virtual ~tilemap_t();
+
+ tilemap_t &init(tilemap_manager &manager, tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, int tilewidth, int tileheight, int cols, int rows);
public:
// getters
running_machine &machine() const;
+ tilemap_device *device() const { return m_device; }
tilemap_t *next() const { return m_next; }
+ void *user_data() const { return m_user_data; }
+ tilemap_memory &basemem() { return m_basemem; }
+ tilemap_memory &extmem() { return m_extmem; }
UINT32 width() const { return m_width; }
UINT32 height() const { return m_height; }
bool enabled() const { return m_enable; }
@@ -510,16 +640,22 @@ public:
// mappers
// scan in row-major order with optional flipping
- static tilemap_memory_index scan_rows(running_machine &machine, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows);
- static tilemap_memory_index scan_rows_flip_x(running_machine &machine, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows);
- static tilemap_memory_index scan_rows_flip_y(running_machine &machine, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows);
- static tilemap_memory_index scan_rows_flip_xy(running_machine &machine, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows);
+ static tilemap_memory_index scan_rows(driver_device &device, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows);
+ static tilemap_memory_index scan_rows_flip_x(driver_device &device, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows);
+ static tilemap_memory_index scan_rows_flip_y(driver_device &device, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows);
+ static tilemap_memory_index scan_rows_flip_xy(driver_device &device, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows);
// scan in column-major order with optional flipping
- static tilemap_memory_index scan_cols(running_machine &machine, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows);
- static tilemap_memory_index scan_cols_flip_x(running_machine &machine, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows);
- static tilemap_memory_index scan_cols_flip_y(running_machine &machine, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows);
- static tilemap_memory_index scan_cols_flip_xy(running_machine &machine, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows);
+ static tilemap_memory_index scan_cols(driver_device &device, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows);
+ static tilemap_memory_index scan_cols_flip_x(driver_device &device, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows);
+ static tilemap_memory_index scan_cols_flip_y(driver_device &device, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows);
+ static tilemap_memory_index scan_cols_flip_xy(driver_device &device, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows);
+
+ // optional memory accessors
+ UINT32 basemem_read(int index) { return m_basemem.read(index); }
+ UINT32 extmem_read(int index) { return m_extmem.read(index); }
+ void basemem_write(int index, UINT32 data) { m_basemem.write(index, data); mark_tile_dirty(index); }
+ void extmem_write(int index, UINT32 data) { m_extmem.write(index, data); mark_tile_dirty(index); }
private:
// internal set of transparency states for rendering
@@ -539,7 +675,7 @@ private:
UINT8 value;
UINT8 alpha;
};
-
+
// inline helpers
INT32 effective_rowscroll(int index, UINT32 screen_width);
INT32 effective_colscroll(int index, UINT32 screen_height);
@@ -572,8 +708,17 @@ private:
template<class _BitmapClass> void draw_instance(_BitmapClass &dest, const blit_parameters &blit, int xpos, int ypos);
template<class _BitmapClass> void draw_roz_core(_BitmapClass &destbitmap, const blit_parameters &blit, UINT32 startx, UINT32 starty, int incxx, int incxy, int incyx, int incyy, bool wraparound);
- // basic tilemap metrics
+ // managers and devices
+ tilemap_manager * m_manager; // reference to the owning manager
+ tilemap_device * m_device; // pointer to our owning device
tilemap_t * m_next; // pointer to next tilemap
+ void * m_user_data; // user data value
+
+ // optional memory info
+ tilemap_memory m_basemem; // info about base memory
+ tilemap_memory m_extmem; // info about extension memory
+
+ // basic tilemap metrics
UINT32 m_rows; // number of tile rows
UINT32 m_cols; // number of tile columns
UINT32 m_tilewidth; // width of a single tile in pixels
@@ -591,7 +736,6 @@ private:
// callback to interpret video RAM for the tilemap
tilemap_get_info_delegate m_tile_get_info; // callback to get information about a tile
tile_data m_tileinfo; // structure to hold the data for a tile
- void * m_user_data; // user data value passed to the callback
// global tilemap states
bool m_enable; // true if we are enabled
@@ -606,8 +750,8 @@ private:
// scroll information
UINT32 m_scrollrows; // number of independently scrolled rows
UINT32 m_scrollcols; // number of independently scrolled columns
- INT32 * m_rowscroll; // array of rowscroll values
- INT32 * m_colscroll; // array of colscroll values
+ dynamic_array<INT32> m_rowscroll; // array of rowscroll values
+ dynamic_array<INT32> m_colscroll; // array of colscroll values
INT32 m_dx; // global horizontal scroll offset
INT32 m_dx_flipped; // global horizontal scroll offset when flipped
INT32 m_dy; // global vertical scroll offset
@@ -619,13 +763,12 @@ private:
// transparency mapping
bitmap_ind8 m_flagsmap; // per-pixel flags
UINT8 * m_tileflags; // per-tile flags
- UINT8 m_pen_to_flags[MAX_PEN_TO_FLAGS * TILEMAP_NUM_GROUPS]; // mapping of pens to flags
-
-private:
- tilemap_manager & m_manager; // reference to the owning manager
+ UINT8 m_pen_to_flags[MAX_PEN_TO_FLAGS * TILEMAP_NUM_GROUPS]; // mapping of pens to flags
};
+// ======================> tilemap_manager
+
// tilemap manager
class tilemap_manager
{
@@ -639,10 +782,8 @@ public:
running_machine &machine() const { return m_machine; }
// tilemap creation
- tilemap_t &create(tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, int tilewidth, int tileheight, int cols, int rows);
- tilemap_t &create(tilemap_get_info_delegate tile_get_info, tilemap_standard_mapper mapper, int tilewidth, int tileheight, int cols, int rows);
- tilemap_t &create(tile_get_info_func tile_get_info, tilemap_mapper_func mapper, int tilewidth, int tileheight, int cols, int rows); // legacy
- tilemap_t &create(tile_get_info_func tile_get_info, tilemap_standard_mapper mapper, int tilewidth, int tileheight, int cols, int rows); // legacy
+ tilemap_t &create(tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, int tilewidth, int tileheight, int cols, int rows, tilemap_t *allocated = NULL);
+ tilemap_t &create(tilemap_get_info_delegate tile_get_info, tilemap_standard_mapper mapper, int tilewidth, int tileheight, int cols, int rows, tilemap_t *allocated = NULL);
// tilemap list information
tilemap_t *find(int index) { return m_tilemap_list.find(index); }
@@ -663,6 +804,56 @@ private:
};
+// ======================> tilemap_device
+
+// device type definition
+extern const device_type TILEMAP;
+
+class tilemap_device : public device_t,
+ public tilemap_t
+{
+public:
+ // construction/destruction
+ tilemap_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // static configuration
+ static void static_set_bytes_per_entry(device_t &device, int bpe);
+ static void static_set_info_callback(device_t &device, tilemap_get_info_delegate tile_get_info);
+ static void static_set_layout(device_t &device, tilemap_standard_mapper mapper, int columns, int rows);
+ static void static_set_layout(device_t &device, tilemap_mapper_delegate mapper, int columns, int rows);
+ static void static_set_tile_size(device_t &device, int width, int height);
+ static void static_set_transparent_pen(device_t &device, pen_t pen);
+
+ // write handlers
+ DECLARE_WRITE8_HANDLER(write);
+ DECLARE_WRITE16_HANDLER(write);
+ DECLARE_WRITE32_HANDLER(write);
+ DECLARE_WRITE8_HANDLER(write_ext);
+ DECLARE_WRITE16_HANDLER(write_ext);
+ DECLARE_WRITE32_HANDLER(write_ext);
+
+ // pick one to use to avoid ambiguity errors
+ using device_t::machine;
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+
+private:
+ // configuration state
+ tilemap_get_info_delegate m_get_info;
+ tilemap_standard_mapper m_standard_mapper;
+ tilemap_mapper_delegate m_mapper;
+ int m_bytes_per_entry;
+ int m_tile_width;
+ int m_tile_height;
+ int m_num_columns;
+ int m_num_rows;
+ bool m_transparent_pen_set;
+ pen_t m_transparent_pen;
+};
+
+
//**************************************************************************
// MACROS
@@ -673,15 +864,12 @@ private:
#define TILEMAP_DRAW_ALPHA(x) (TILEMAP_DRAW_ALPHA_FLAG | (rgb_clamp(x) << 24))
// function definition for a get info callback
-#define TILE_GET_INFO(_name) void _name(running_machine &machine, tile_data &tileinfo, tilemap_memory_index tile_index, void *param)
-#define TILE_GET_INFO_MEMBER(_name) void _name(tile_data &tileinfo, tilemap_memory_index tile_index, void *param)
+#define TILE_GET_INFO_MEMBER(_name) void _name(tilemap_t &tilemap, tile_data &tileinfo, tilemap_memory_index tile_index)
// function definition for a logical-to-memory mapper
-#define TILEMAP_MAPPER(_name) tilemap_memory_index _name(running_machine &machine, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows)
#define TILEMAP_MAPPER_MEMBER(_name) tilemap_memory_index _name(UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows)
// useful macro inside of a TILE_GET_INFO callback to set tile information
-#define SET_TILE_INFO(GFX,CODE,COLOR,FLAGS) tileinfo.set(machine, GFX, CODE, COLOR, FLAGS)
#define SET_TILE_INFO_MEMBER(GFX,CODE,COLOR,FLAGS) tileinfo.set(machine(), GFX, CODE, COLOR, FLAGS)
// Macros for setting tile attributes in the TILE_GET_INFO callback:
@@ -698,7 +886,7 @@ private:
inline running_machine &tilemap_t::machine() const
{
- return m_manager.machine();
+ return m_manager->machine();
}
diff --git a/src/mame/drivers/atarig1.c b/src/mame/drivers/atarig1.c
index 1a9ac5862f1..6fbdfe9a47d 100644
--- a/src/mame/drivers/atarig1.c
+++ b/src/mame/drivers/atarig1.c
@@ -213,8 +213,8 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, atarig1_state )
AM_RANGE(0xfe8000, 0xfe89ff) AM_RAM_WRITE(paletteram_666_w) AM_SHARE("paletteram")
AM_RANGE(0xff0000, 0xff0fff) AM_DEVREADWRITE_LEGACY("rle", atarirle_spriteram_r, atarirle_spriteram_w)
AM_RANGE(0xff2000, 0xff2001) AM_WRITE(mo_command_w) AM_SHARE("mo_command")
- AM_RANGE(0xff4000, 0xff5fff) AM_WRITE(playfield_w) AM_SHARE("playfield")
- AM_RANGE(0xff6000, 0xff6fff) AM_WRITE(alpha_w) AM_SHARE("alpha")
+ AM_RANGE(0xff4000, 0xff5fff) AM_DEVWRITE("playfield", tilemap_device, write) AM_SHARE("playfield")
+ AM_RANGE(0xff6000, 0xff6fff) AM_DEVWRITE("alpha", tilemap_device, write) AM_SHARE("alpha")
AM_RANGE(0xff0000, 0xffffff) AM_RAM
ADDRESS_MAP_END
@@ -452,6 +452,10 @@ static MACHINE_CONFIG_START( atarig1, atarig1_state )
MCFG_GFXDECODE(atarig1)
MCFG_PALETTE_LENGTH(1280)
+ /* initialize the playfield */
+ MCFG_TILEMAP_ADD_STANDARD("playfield", 2, atarig1_state, get_playfield_tile_info, 8,8, SCAN_ROWS, 64,64)
+ MCFG_TILEMAP_ADD_STANDARD_TRANSPEN("alpha", 2, atarig1_state, get_alpha_tile_info, 8,8, SCAN_ROWS, 64,32, 0)
+
MCFG_SCREEN_ADD("screen", RASTER)
/* note: these parameters are from published specs, not derived */
MCFG_SCREEN_RAW_PARAMS(ATARI_CLOCK_14MHz/2, 456, 0, 336, 262, 0, 240)
diff --git a/src/mame/drivers/atarig42.c b/src/mame/drivers/atarig42.c
index 8f12cd85164..82d69d5dfe6 100644
--- a/src/mame/drivers/atarig42.c
+++ b/src/mame/drivers/atarig42.c
@@ -348,8 +348,8 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, atarig42_state )
AM_RANGE(0xfa0000, 0xfa0fff) AM_READWRITE(eeprom_r, eeprom_w) AM_SHARE("eeprom")
AM_RANGE(0xfc0000, 0xfc0fff) AM_RAM_WRITE(paletteram_666_w) AM_SHARE("paletteram")
AM_RANGE(0xff0000, 0xff0fff) AM_DEVREADWRITE_LEGACY("rle", atarirle_spriteram_r, atarirle_spriteram_w)
- AM_RANGE(0xff2000, 0xff5fff) AM_WRITE(playfield_w) AM_SHARE("playfield")
- AM_RANGE(0xff6000, 0xff6fff) AM_WRITE(alpha_w) AM_SHARE("alpha")
+ AM_RANGE(0xff2000, 0xff5fff) AM_DEVWRITE("playfield", tilemap_device, write) AM_SHARE("playfield")
+ AM_RANGE(0xff6000, 0xff6fff) AM_DEVWRITE("alpha", tilemap_device, write) AM_SHARE("alpha")
AM_RANGE(0xff7000, 0xff7001) AM_WRITE(mo_command_w) AM_SHARE("mo_command")
AM_RANGE(0xff0000, 0xffffff) AM_RAM
ADDRESS_MAP_END
@@ -557,6 +557,9 @@ static MACHINE_CONFIG_START( atarig42, atarig42_state )
MCFG_GFXDECODE(atarig42)
MCFG_PALETTE_LENGTH(2048)
+ MCFG_TILEMAP_ADD_CUSTOM("playfield", 2, atarig42_state, get_playfield_tile_info, 8,8, atarig42_playfield_scan, 128,64)
+ MCFG_TILEMAP_ADD_STANDARD_TRANSPEN("alpha", 2, atarig42_state, get_alpha_tile_info, 8,8, SCAN_ROWS, 64,32, 0)
+
MCFG_SCREEN_ADD("screen", RASTER)
/* note: these parameters are from published specs, not derived */
/* the board uses an SOS chip to generate video signals */
@@ -591,7 +594,6 @@ MACHINE_CONFIG_END
*
*************************************/
-
ROM_START( roadriot )
ROM_REGION( 0x80004, "maincpu", 0 ) /* 68000 code */
ROM_LOAD16_BYTE( "136089-3114.8d", 0x00000, 0x20000, CRC(a2bd949c) SHA1(f96064d491b4d488cadebd3a63a6d3edf9236046) )
diff --git a/src/mame/drivers/atarigt.c b/src/mame/drivers/atarigt.c
index 865af792e39..191635b6751 100644
--- a/src/mame/drivers/atarigt.c
+++ b/src/mame/drivers/atarigt.c
@@ -618,8 +618,8 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 32, atarigt_state )
AM_RANGE(0xd0001c, 0xd0001f) AM_READ(analog_port1_r)
AM_RANGE(0xd20000, 0xd20fff) AM_READWRITE(eeprom_upper32_r, eeprom32_w) AM_SHARE("eeprom")
AM_RANGE(0xd40000, 0xd4ffff) AM_WRITE16(eeprom_enable_w, 0xffffffff)
- AM_RANGE(0xd72000, 0xd75fff) AM_WRITE(playfield32_w) AM_SHARE("playfield32")
- AM_RANGE(0xd76000, 0xd76fff) AM_WRITE(alpha32_w) AM_SHARE("alpha32")
+ AM_RANGE(0xd72000, 0xd75fff) AM_DEVWRITE("playfield", tilemap_device, write) AM_SHARE("playfield")
+ AM_RANGE(0xd76000, 0xd76fff) AM_DEVWRITE("alpha", tilemap_device, write) AM_SHARE("alpha")
AM_RANGE(0xd78000, 0xd78fff) AM_DEVREADWRITE_LEGACY("rle", atarirle_spriteram32_r, atarirle_spriteram32_w)
AM_RANGE(0xd7a200, 0xd7a203) AM_WRITE(mo_command_w) AM_SHARE("mo_command")
AM_RANGE(0xd70000, 0xd7ffff) AM_RAM
@@ -835,6 +835,9 @@ static MACHINE_CONFIG_START( atarigt, atarigt_state )
MCFG_GFXDECODE(atarigt)
MCFG_PALETTE_LENGTH(32768)
+ MCFG_TILEMAP_ADD_CUSTOM("playfield", 2, atarigt_state, get_playfield_tile_info, 8,8, atarigt_playfield_scan, 128,64)
+ MCFG_TILEMAP_ADD_STANDARD("alpha", 2, atarigt_state, get_alpha_tile_info, 8,8, SCAN_ROWS, 64, 32)
+
MCFG_SCREEN_ADD("screen", RASTER)
/* note: these parameters are from published specs, not derived */
/* the board uses a pair of GALs to determine H and V parameters */
@@ -1299,7 +1302,7 @@ WRITE32_MEMBER(atarigt_state::tmek_pf_w)
if (pc == 0x25834 || pc == 0x25860)
logerror("%06X:PFW@%06X = %08X & %08X (src=%06X)\n", space.device().safe_pc(), 0xd72000 + offset*4, data, mem_mask, (UINT32)space.device().state().state_int(M68K_A3) - 2);
- playfield32_w(space, offset, data, mem_mask);
+ m_playfield_tilemap->write(space, offset, data, mem_mask);
}
DRIVER_INIT_MEMBER(atarigt_state,tmek)
diff --git a/src/mame/drivers/atarigx2.c b/src/mame/drivers/atarigx2.c
index 5f274ba1eaa..71db72291aa 100644
--- a/src/mame/drivers/atarigx2.c
+++ b/src/mame/drivers/atarigx2.c
@@ -1137,8 +1137,8 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 32, atarigx2_state )
AM_RANGE(0xd00000, 0xd1ffff) AM_READ(a2d_data_r)
AM_RANGE(0xd20000, 0xd20fff) AM_READWRITE(eeprom_upper32_r, eeprom32_w) AM_SHARE("eeprom")
AM_RANGE(0xd40000, 0xd40fff) AM_RAM_WRITE(paletteram32_666_w) AM_SHARE("paletteram")
- AM_RANGE(0xd72000, 0xd75fff) AM_WRITE(playfield32_w) AM_SHARE("playfield32")
- AM_RANGE(0xd76000, 0xd76fff) AM_WRITE(alpha32_w) AM_SHARE("alpha32")
+ AM_RANGE(0xd72000, 0xd75fff) AM_DEVWRITE("playfield", tilemap_device, write) AM_SHARE("playfield")
+ AM_RANGE(0xd76000, 0xd76fff) AM_DEVWRITE("alpha", tilemap_device, write) AM_SHARE("alpha")
AM_RANGE(0xd78000, 0xd78fff) AM_DEVREADWRITE_LEGACY("rle", atarirle_spriteram32_r, atarirle_spriteram32_w)
AM_RANGE(0xd7a200, 0xd7a203) AM_WRITE(mo_command_w) AM_SHARE("mo_command")
AM_RANGE(0xd70000, 0xd7ffff) AM_RAM
@@ -1421,6 +1421,9 @@ static MACHINE_CONFIG_START( atarigx2, atarigx2_state )
MCFG_GFXDECODE(atarigx2)
MCFG_PALETTE_LENGTH(2048)
+ MCFG_TILEMAP_ADD_CUSTOM("playfield", 2, atarigx2_state, get_playfield_tile_info, 8,8, atarigx2_playfield_scan, 128,64)
+ MCFG_TILEMAP_ADD_STANDARD_TRANSPEN("alpha", 2, atarigx2_state, get_alpha_tile_info, 8,8, SCAN_ROWS, 64,32, 0)
+
MCFG_SCREEN_ADD("screen", RASTER)
/* note: these parameters are from published specs, not derived */
/* the board uses a pair of GALs to determine H and V parameters */
diff --git a/src/mame/drivers/atarisy1.c b/src/mame/drivers/atarisy1.c
index 520f8a92aaa..366c9c2afb8 100644
--- a/src/mame/drivers/atarisy1.c
+++ b/src/mame/drivers/atarisy1.c
@@ -452,9 +452,9 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, atarisy1_state )
AM_RANGE(0x8a0000, 0x8a0001) AM_WRITE(video_int_ack_w)
AM_RANGE(0x8c0000, 0x8c0001) AM_WRITE(eeprom_enable_w)
AM_RANGE(0x900000, 0x9fffff) AM_RAM
- AM_RANGE(0xa00000, 0xa01fff) AM_RAM_WRITE(playfield_w) AM_SHARE("playfield")
+ AM_RANGE(0xa00000, 0xa01fff) AM_RAM_DEVWRITE("playfield", tilemap_device, write) AM_SHARE("playfield")
AM_RANGE(0xa02000, 0xa02fff) AM_READ_LEGACY(atarimo_0_spriteram_r) AM_WRITE(atarisy1_spriteram_w)
- AM_RANGE(0xa03000, 0xa03fff) AM_RAM_WRITE(alpha_w) AM_SHARE("alpha")
+ AM_RANGE(0xa03000, 0xa03fff) AM_RAM_DEVWRITE("alpha", tilemap_device, write) AM_SHARE("alpha")
AM_RANGE(0xb00000, 0xb007ff) AM_RAM_WRITE(paletteram_IIIIRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
AM_RANGE(0xf00000, 0xf00fff) AM_READWRITE(eeprom_r, eeprom_w) AM_SHARE("eeprom")
AM_RANGE(0xf20000, 0xf20007) AM_READ(trakball_r)
@@ -743,6 +743,9 @@ static MACHINE_CONFIG_START( atarisy1, atarisy1_state )
MCFG_GFXDECODE(atarisy1)
MCFG_PALETTE_LENGTH(1024)
+ MCFG_TILEMAP_ADD_STANDARD("playfield", 2, atarisy1_state, get_playfield_tile_info, 8,8, SCAN_ROWS, 64,64)
+ MCFG_TILEMAP_ADD_STANDARD_TRANSPEN("alpha", 2, atarisy1_state, get_alpha_tile_info, 8,8, SCAN_ROWS, 64,32, 0)
+
MCFG_SCREEN_ADD("screen", RASTER)
/* note: these parameters are from published specs, not derived */
/* video timing comes from an 82S163 (H) and an 82S129 (V) */
diff --git a/src/mame/drivers/atarisy2.c b/src/mame/drivers/atarisy2.c
index fcf6e960380..8a65afdb1d2 100644
--- a/src/mame/drivers/atarisy2.c
+++ b/src/mame/drivers/atarisy2.c
@@ -1242,6 +1242,9 @@ static MACHINE_CONFIG_START( atarisy2, atarisy2_state )
MCFG_GFXDECODE(atarisy2)
MCFG_PALETTE_LENGTH(256)
+ MCFG_TILEMAP_ADD_STANDARD("playfield", 2, atarisy2_state, get_playfield_tile_info, 8,8, SCAN_ROWS, 128,64)
+ MCFG_TILEMAP_ADD_STANDARD_TRANSPEN("alpha", 2, atarisy2_state, get_alpha_tile_info, 8,8, SCAN_ROWS, 64,48, 0)
+
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(VIDEO_CLOCK/2, 640, 0, 512, 416, 0, 384)
MCFG_SCREEN_UPDATE_DRIVER(atarisy2_state, screen_update_atarisy2)
diff --git a/src/mame/drivers/badlands.c b/src/mame/drivers/badlands.c
index 5b1e32d0d00..8b3e688e6b7 100644
--- a/src/mame/drivers/badlands.c
+++ b/src/mame/drivers/badlands.c
@@ -382,7 +382,7 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, badlands_state )
AM_RANGE(0xfec000, 0xfedfff) AM_WRITE(badlands_pf_bank_w)
AM_RANGE(0xfee000, 0xfeffff) AM_WRITE(eeprom_enable_w)
AM_RANGE(0xffc000, 0xffc3ff) AM_RAM_WRITE(expanded_paletteram_666_w) AM_SHARE("paletteram")
- AM_RANGE(0xffe000, 0xffefff) AM_RAM_WRITE(playfield_w) AM_SHARE("playfield")
+ AM_RANGE(0xffe000, 0xffefff) AM_RAM_DEVWRITE("playfield", tilemap_device, write) AM_SHARE("playfield")
AM_RANGE(0xfff000, 0xfff1ff) AM_READWRITE_LEGACY(atarimo_0_spriteram_r, atarimo_0_spriteram_expanded_w)
AM_RANGE(0xfff200, 0xffffff) AM_RAM
ADDRESS_MAP_END
@@ -507,6 +507,8 @@ static MACHINE_CONFIG_START( badlands, badlands_state )
MCFG_GFXDECODE(badlands)
MCFG_PALETTE_LENGTH(256)
+ MCFG_TILEMAP_ADD_STANDARD("playfield", 2, badlands_state, get_playfield_tile_info, 8,8, SCAN_ROWS, 64,32)
+
MCFG_SCREEN_ADD("screen", RASTER)
/* note: these parameters are from published specs, not derived */
/* the board uses an SOS-2 chip to generate video signals */
@@ -643,7 +645,7 @@ static ADDRESS_MAP_START( bootleg_map, AS_PROGRAM, 16, badlands_state )
AM_RANGE(0xfec000, 0xfedfff) AM_WRITE(badlands_pf_bank_w)
AM_RANGE(0xfee000, 0xfeffff) AM_WRITE(eeprom_enable_w)
AM_RANGE(0xffc000, 0xffc3ff) AM_RAM_WRITE(expanded_paletteram_666_w) AM_SHARE("paletteram")
- AM_RANGE(0xffe000, 0xffefff) AM_RAM_WRITE(playfield_w) AM_SHARE("playfield")
+ AM_RANGE(0xffe000, 0xffefff) AM_RAM_DEVWRITE("playfield", tilemap_device, write) AM_SHARE("playfield")
AM_RANGE(0xfff000, 0xfff1ff) AM_READWRITE_LEGACY(atarimo_0_spriteram_r, atarimo_0_spriteram_expanded_w)
AM_RANGE(0xfff200, 0xffffff) AM_RAM
ADDRESS_MAP_END
@@ -695,6 +697,8 @@ static MACHINE_CONFIG_START( badlandsb, badlands_state )
MCFG_GFXDECODE(badlandsb)
MCFG_PALETTE_LENGTH(256)
+ MCFG_TILEMAP_ADD_STANDARD("playfield", 2, badlands_state, get_playfield_tile_info, 8,8, SCAN_ROWS, 64,32)
+
MCFG_SCREEN_ADD("screen", RASTER)
/* note: these parameters are from published specs, not derived */
/* the board uses an SOS-2 chip to generate video signals */
diff --git a/src/mame/drivers/batman.c b/src/mame/drivers/batman.c
index 1a08aeb2ce3..a25401669b2 100644
--- a/src/mame/drivers/batman.c
+++ b/src/mame/drivers/batman.c
@@ -127,11 +127,11 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, batman_state )
AM_RANGE(0x2a0000, 0x2a0001) AM_MIRROR(0x11fffe) AM_WRITE(watchdog_reset16_w)
AM_RANGE(0x3e0000, 0x3e0fff) AM_MIRROR(0x100000) AM_RAM_WRITE(paletteram_666_w) AM_SHARE("paletteram")
AM_RANGE(0x3effc0, 0x3effff) AM_MIRROR(0x100000) AM_READWRITE(batman_atarivc_r, batman_atarivc_w) AM_SHARE("atarivc_data")
- AM_RANGE(0x3f0000, 0x3f1fff) AM_MIRROR(0x100000) AM_WRITE(playfield2_latched_msb_w) AM_SHARE("playfield2")
- AM_RANGE(0x3f2000, 0x3f3fff) AM_MIRROR(0x100000) AM_WRITE(playfield_latched_lsb_w) AM_SHARE("playfield")
- AM_RANGE(0x3f4000, 0x3f5fff) AM_MIRROR(0x100000) AM_WRITE(playfield_dual_upper_w) AM_SHARE("playfield_up")
+ AM_RANGE(0x3f0000, 0x3f1fff) AM_MIRROR(0x100000) AM_WRITE(atarivc_playfield2_latched_msb_w) AM_SHARE("playfield2")
+ AM_RANGE(0x3f2000, 0x3f3fff) AM_MIRROR(0x100000) AM_WRITE(atarivc_playfield_latched_lsb_w) AM_SHARE("playfield")
+ AM_RANGE(0x3f4000, 0x3f5fff) AM_MIRROR(0x100000) AM_WRITE(atarivc_playfield_dual_upper_w) AM_SHARE("playfield_ext")
AM_RANGE(0x3f6000, 0x3f7fff) AM_MIRROR(0x100000) AM_READWRITE_LEGACY(atarimo_0_spriteram_r, atarimo_0_spriteram_w)
- AM_RANGE(0x3f8000, 0x3f8eff) AM_MIRROR(0x100000) AM_WRITE(alpha_w) AM_SHARE("alpha")
+ AM_RANGE(0x3f8000, 0x3f8eff) AM_MIRROR(0x100000) AM_DEVWRITE("alpha", tilemap_device, write) AM_SHARE("alpha")
AM_RANGE(0x3f8f00, 0x3f8f7f) AM_MIRROR(0x100000) AM_SHARE("atarivc_eof")
AM_RANGE(0x3f8f80, 0x3f8fff) AM_MIRROR(0x100000) AM_READWRITE_LEGACY(atarimo_0_slipram_r, atarimo_0_slipram_w)
AM_RANGE(0x3f0000, 0x3fffff) AM_MIRROR(0x100000) AM_RAM
@@ -228,6 +228,10 @@ static MACHINE_CONFIG_START( batman, batman_state )
MCFG_GFXDECODE(batman)
MCFG_PALETTE_LENGTH(2048)
+ MCFG_TILEMAP_ADD_STANDARD("playfield", 2, batman_state, get_playfield_tile_info, 8,8, SCAN_COLS, 64,64)
+ MCFG_TILEMAP_ADD_STANDARD_TRANSPEN("playfield2", 2, batman_state, get_playfield2_tile_info, 8,8, SCAN_COLS, 64,64, 0)
+ MCFG_TILEMAP_ADD_STANDARD_TRANSPEN("alpha", 2, batman_state, get_alpha_tile_info, 8,8, SCAN_ROWS, 64,32, 0)
+
MCFG_SCREEN_ADD("screen", RASTER)
/* note: these parameters are from published specs, not derived */
/* the board uses a VAD chip to generate video signals */
diff --git a/src/mame/drivers/blstroid.c b/src/mame/drivers/blstroid.c
index 402ad25fb3b..4d593ec19a2 100644
--- a/src/mame/drivers/blstroid.c
+++ b/src/mame/drivers/blstroid.c
@@ -78,7 +78,7 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, blstroid_state )
AM_RANGE(0xff9c02, 0xff9c03) AM_MIRROR(0x7f83fc) AM_READ_PORT("IN1")
AM_RANGE(0xffa000, 0xffa3ff) AM_MIRROR(0x7f8c00) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
AM_RANGE(0xffb000, 0xffb3ff) AM_MIRROR(0x7f8c00) AM_READWRITE(eeprom_r, eeprom_w) AM_SHARE("eeprom")
- AM_RANGE(0xffc000, 0xffcfff) AM_MIRROR(0x7f8000) AM_RAM_WRITE(playfield_w) AM_SHARE("playfield")
+ AM_RANGE(0xffc000, 0xffcfff) AM_MIRROR(0x7f8000) AM_RAM_DEVWRITE("playfield", tilemap_device, write) AM_SHARE("playfield")
AM_RANGE(0xffd000, 0xffdfff) AM_MIRROR(0x7f8000) AM_READWRITE_LEGACY(atarimo_0_spriteram_r, atarimo_0_spriteram_w)
AM_RANGE(0xffe000, 0xffffff) AM_MIRROR(0x7f8000) AM_RAM
ADDRESS_MAP_END
@@ -184,6 +184,8 @@ static MACHINE_CONFIG_START( blstroid, blstroid_state )
MCFG_GFXDECODE(blstroid)
MCFG_PALETTE_LENGTH(512)
+ MCFG_TILEMAP_ADD_STANDARD("playfield", 2, blstroid_state, get_playfield_tile_info, 16,8, SCAN_ROWS, 64,64)
+
MCFG_SCREEN_ADD("screen", RASTER)
/* note: these parameters are from published specs, not derived */
/* the board uses an SOS-2 chip to generate video signals */
diff --git a/src/mame/drivers/cyberbal.c b/src/mame/drivers/cyberbal.c
index 0ded2e978b5..fce28026b6d 100644
--- a/src/mame/drivers/cyberbal.c
+++ b/src/mame/drivers/cyberbal.c
@@ -127,16 +127,16 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, cyberbal_state )
AM_RANGE(0xfe1000, 0xfe1fff) AM_READ_PORT("IN1")
AM_RANGE(0xfe8000, 0xfe8fff) AM_RAM_WRITE(paletteram_1_w) AM_SHARE("paletteram_1")
AM_RANGE(0xfec000, 0xfecfff) AM_RAM_WRITE(paletteram_0_w) AM_SHARE("paletteram_0")
- AM_RANGE(0xff0000, 0xff1fff) AM_RAM_WRITE(playfield2_w) AM_SHARE("playfield2")
- AM_RANGE(0xff2000, 0xff2fff) AM_RAM_WRITE(alpha2_w) AM_SHARE("alpha2")
+ AM_RANGE(0xff0000, 0xff1fff) AM_RAM_DEVWRITE("playfield2", tilemap_device, write) AM_SHARE("playfield2")
+ AM_RANGE(0xff2000, 0xff2fff) AM_RAM_DEVWRITE("alpha2", tilemap_device, write) AM_SHARE("alpha2")
AM_RANGE(0xff3000, 0xff37ff) AM_READWRITE_LEGACY(atarimo_1_spriteram_r, atarimo_1_spriteram_w)
- AM_RANGE(0xff3800, 0xff3fff) AM_RAM AM_SHARE("share6")
- AM_RANGE(0xff4000, 0xff5fff) AM_RAM_WRITE(playfield_w) AM_SHARE("playfield")
- AM_RANGE(0xff6000, 0xff6fff) AM_RAM_WRITE(alpha_w) AM_SHARE("alpha")
+ AM_RANGE(0xff3800, 0xff3fff) AM_RAM AM_SHARE("ff3800")
+ AM_RANGE(0xff4000, 0xff5fff) AM_RAM_DEVWRITE("playfield", tilemap_device, write) AM_SHARE("playfield")
+ AM_RANGE(0xff6000, 0xff6fff) AM_RAM_DEVWRITE("alpha", tilemap_device, write) AM_SHARE("alpha")
AM_RANGE(0xff7000, 0xff77ff) AM_READWRITE_LEGACY(atarimo_0_spriteram_r, atarimo_0_spriteram_w)
- AM_RANGE(0xff7800, 0xff9fff) AM_RAM AM_SHARE("share10")
- AM_RANGE(0xffa000, 0xffbfff) AM_READONLY AM_WRITENOP AM_SHARE("share11")
- AM_RANGE(0xffc000, 0xffffff) AM_RAM AM_SHARE("share12")
+ AM_RANGE(0xff7800, 0xff9fff) AM_RAM AM_SHARE("sharedram")
+ AM_RANGE(0xffa000, 0xffbfff) AM_READONLY AM_WRITENOP AM_SHARE("extraram")
+ AM_RANGE(0xffc000, 0xffffff) AM_RAM AM_SHARE("mainram")
ADDRESS_MAP_END
@@ -154,16 +154,16 @@ static ADDRESS_MAP_START( extra_map, AS_PROGRAM, 16, cyberbal_state )
AM_RANGE(0xfe1000, 0xfe1fff) AM_READ_PORT("IN1")
AM_RANGE(0xfe8000, 0xfe8fff) AM_RAM_WRITE(paletteram_1_w) AM_SHARE("paletteram_1")
AM_RANGE(0xfec000, 0xfecfff) AM_RAM_WRITE(paletteram_0_w) AM_SHARE("paletteram_0")
- AM_RANGE(0xff0000, 0xff1fff) AM_RAM_WRITE(playfield2_w) AM_SHARE("playfield2")
- AM_RANGE(0xff2000, 0xff2fff) AM_RAM_WRITE(alpha2_w) AM_SHARE("alpha2")
+ AM_RANGE(0xff0000, 0xff1fff) AM_RAM_DEVWRITE("playfield2", tilemap_device, write) AM_SHARE("playfield2")
+ AM_RANGE(0xff2000, 0xff2fff) AM_RAM_DEVWRITE("alpha2", tilemap_device, write) AM_SHARE("alpha2")
AM_RANGE(0xff3000, 0xff37ff) AM_READWRITE_LEGACY(atarimo_1_spriteram_r, atarimo_1_spriteram_w)
- AM_RANGE(0xff3800, 0xff3fff) AM_RAM AM_SHARE("share6")
- AM_RANGE(0xff4000, 0xff5fff) AM_RAM_WRITE(playfield_w) AM_SHARE("playfield")
- AM_RANGE(0xff6000, 0xff6fff) AM_RAM_WRITE(alpha_w) AM_SHARE("alpha")
+ AM_RANGE(0xff3800, 0xff3fff) AM_RAM AM_SHARE("ff3800")
+ AM_RANGE(0xff4000, 0xff5fff) AM_RAM_DEVWRITE("playfield", tilemap_device, write) AM_SHARE("playfield")
+ AM_RANGE(0xff6000, 0xff6fff) AM_RAM_DEVWRITE("alpha", tilemap_device, write) AM_SHARE("alpha")
AM_RANGE(0xff7000, 0xff77ff) AM_READWRITE_LEGACY(atarimo_0_spriteram_r, atarimo_0_spriteram_w)
- AM_RANGE(0xff7800, 0xff9fff) AM_RAM AM_SHARE("share10")
- AM_RANGE(0xffa000, 0xffbfff) AM_RAM AM_SHARE("share11")
- AM_RANGE(0xffc000, 0xffffff) AM_READONLY AM_WRITENOP AM_SHARE("share12")
+ AM_RANGE(0xff7800, 0xff9fff) AM_RAM AM_SHARE("sharedram")
+ AM_RANGE(0xffa000, 0xffbfff) AM_RAM AM_SHARE("extraram")
+ AM_RANGE(0xffc000, 0xffffff) AM_READONLY AM_WRITENOP AM_SHARE("mainram")
ADDRESS_MAP_END
@@ -228,8 +228,8 @@ static ADDRESS_MAP_START( cyberbal2p_map, AS_PROGRAM, 16, cyberbal_state )
AM_RANGE(0xfd6000, 0xfd6003) AM_WRITE(video_int_ack_w)
AM_RANGE(0xfd8000, 0xfd8003) AM_DEVWRITE8("jsa", atari_jsa_ii_device, main_command_w, 0xff00)
AM_RANGE(0xfe0000, 0xfe0003) AM_READ(sound_state_r)
- AM_RANGE(0xff0000, 0xff1fff) AM_RAM_WRITE(playfield_w) AM_SHARE("playfield")
- AM_RANGE(0xff2000, 0xff2fff) AM_RAM_WRITE(alpha_w) AM_SHARE("alpha")
+ AM_RANGE(0xff0000, 0xff1fff) AM_RAM_DEVWRITE("playfield", tilemap_device, write) AM_SHARE("playfield")
+ AM_RANGE(0xff2000, 0xff2fff) AM_RAM_DEVWRITE("alpha", tilemap_device, write) AM_SHARE("alpha")
AM_RANGE(0xff3000, 0xff37ff) AM_READWRITE_LEGACY(atarimo_0_spriteram_r, atarimo_0_spriteram_w)
AM_RANGE(0xff3800, 0xffffff) AM_RAM
ADDRESS_MAP_END
@@ -411,6 +411,12 @@ static MACHINE_CONFIG_START( cyberbal, cyberbal_state )
MCFG_GFXDECODE(interleaved)
MCFG_PALETTE_LENGTH(4096)
+ MCFG_TILEMAP_ADD_STANDARD("playfield", 2, cyberbal_state, get_playfield_tile_info, 16,8, SCAN_ROWS, 64,64)
+ MCFG_TILEMAP_ADD_STANDARD_TRANSPEN("alpha", 2, cyberbal_state, get_alpha_tile_info, 16,8, SCAN_ROWS, 64,32, 0)
+
+ MCFG_TILEMAP_ADD_STANDARD("playfield2", 2, cyberbal_state, get_playfield_tile_info, 16,8, SCAN_ROWS, 64,64)
+ MCFG_TILEMAP_ADD_STANDARD_TRANSPEN("alpha2", 2, cyberbal_state, get_alpha_tile_info, 16,8, SCAN_ROWS, 64,32, 0)
+
MCFG_SCREEN_ADD("lscreen", RASTER)
/* note: these parameters are from published specs, not derived */
/* the board uses an SOS-2 chip to generate video signals */
@@ -458,6 +464,9 @@ static MACHINE_CONFIG_START( cyberbal2p, cyberbal_state )
MCFG_GFXDECODE(cyberbal)
MCFG_PALETTE_LENGTH(2048)
+ MCFG_TILEMAP_ADD_STANDARD("playfield", 2, cyberbal_state, get_playfield_tile_info, 16,8, SCAN_ROWS, 64,64)
+ MCFG_TILEMAP_ADD_STANDARD_TRANSPEN("alpha", 2, cyberbal_state, get_alpha_tile_info, 16,8, SCAN_ROWS, 64,32, 0)
+
MCFG_SCREEN_ADD("screen", RASTER)
/* note: these parameters are from published specs, not derived */
/* the board uses an SOS-2 chip to generate video signals */
diff --git a/src/mame/drivers/eprom.c b/src/mame/drivers/eprom.c
index bdc9222e17c..185604e53f7 100644
--- a/src/mame/drivers/eprom.c
+++ b/src/mame/drivers/eprom.c
@@ -153,11 +153,11 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, eprom_state )
AM_RANGE(0x360020, 0x360021) AM_DEVWRITE("jsa", atari_jsa_base_device, sound_reset_w)
AM_RANGE(0x360030, 0x360031) AM_DEVWRITE8("jsa", atari_jsa_base_device, main_command_w, 0x00ff)
AM_RANGE(0x3e0000, 0x3e0fff) AM_RAM AM_SHARE("paletteram")
- AM_RANGE(0x3f0000, 0x3f1fff) AM_WRITE(playfield_w) AM_SHARE("playfield")
+ AM_RANGE(0x3f0000, 0x3f1fff) AM_DEVWRITE("playfield", tilemap_device, write) AM_SHARE("playfield")
AM_RANGE(0x3f2000, 0x3f3fff) AM_READWRITE_LEGACY(atarimo_0_spriteram_r, atarimo_0_spriteram_w)
- AM_RANGE(0x3f4000, 0x3f4f7f) AM_WRITE(alpha_w) AM_SHARE("alpha")
+ AM_RANGE(0x3f4000, 0x3f4f7f) AM_DEVWRITE("alpha", tilemap_device, write) AM_SHARE("alpha")
AM_RANGE(0x3f4f80, 0x3f4fff) AM_READWRITE_LEGACY(atarimo_0_slipram_r, atarimo_0_slipram_w)
- AM_RANGE(0x3f8000, 0x3f9fff) AM_WRITE(playfield_upper_w) AM_SHARE("playfield_up")
+ AM_RANGE(0x3f8000, 0x3f9fff) AM_DEVWRITE("playfield", tilemap_device, write_ext) AM_SHARE("playfield_ext")
AM_RANGE(0x3f0000, 0x3f9fff) AM_RAM
ADDRESS_MAP_END
@@ -178,10 +178,10 @@ static ADDRESS_MAP_START( guts_map, AS_PROGRAM, 16, eprom_state )
AM_RANGE(0x360020, 0x360021) AM_DEVWRITE("jsa", atari_jsa_ii_device, sound_reset_w)
AM_RANGE(0x360030, 0x360031) AM_DEVWRITE8("jsa", atari_jsa_ii_device, main_command_w, 0x00ff)
AM_RANGE(0x3e0000, 0x3e0fff) AM_RAM AM_SHARE("paletteram")
- AM_RANGE(0xff0000, 0xff1fff) AM_WRITE(playfield_upper_w) AM_SHARE("playfield_up")
- AM_RANGE(0xff8000, 0xff9fff) AM_WRITE(playfield_w) AM_SHARE("playfield")
+ AM_RANGE(0xff0000, 0xff1fff) AM_DEVWRITE("playfield", tilemap_device, write_ext) AM_SHARE("playfield_ext")
+ AM_RANGE(0xff8000, 0xff9fff) AM_DEVWRITE("playfield", tilemap_device, write) AM_SHARE("playfield")
AM_RANGE(0xffa000, 0xffbfff) AM_READWRITE_LEGACY(atarimo_0_spriteram_r, atarimo_0_spriteram_w)
- AM_RANGE(0xffc000, 0xffcf7f) AM_WRITE(alpha_w) AM_SHARE("alpha")
+ AM_RANGE(0xffc000, 0xffcf7f) AM_DEVWRITE("alpha", tilemap_device, write) AM_SHARE("alpha")
AM_RANGE(0xffcf80, 0xffcfff) AM_READWRITE_LEGACY(atarimo_0_slipram_r, atarimo_0_slipram_w)
AM_RANGE(0xff0000, 0xff1fff) AM_RAM
AM_RANGE(0xff8000, 0xffffff) AM_RAM
@@ -398,6 +398,9 @@ static MACHINE_CONFIG_START( eprom, eprom_state )
MCFG_GFXDECODE(eprom)
MCFG_PALETTE_LENGTH(2048)
+ MCFG_TILEMAP_ADD_STANDARD("playfield", 2, eprom_state, get_playfield_tile_info, 8,8, SCAN_COLS, 64,64)
+ MCFG_TILEMAP_ADD_STANDARD_TRANSPEN("alpha", 2, eprom_state, get_alpha_tile_info, 8,8, SCAN_ROWS, 64,32, 0)
+
MCFG_SCREEN_ADD("screen", RASTER)
/* note: these parameters are from published specs, not derived */
/* the board uses a SYNGEN chip to generate video signals */
@@ -433,6 +436,9 @@ static MACHINE_CONFIG_START( klaxp, eprom_state )
MCFG_GFXDECODE(eprom)
MCFG_PALETTE_LENGTH(2048)
+ MCFG_TILEMAP_ADD_STANDARD("playfield", 2, eprom_state, get_playfield_tile_info, 8,8, SCAN_COLS, 64,64)
+ MCFG_TILEMAP_ADD_STANDARD_TRANSPEN("alpha", 2, eprom_state, get_alpha_tile_info, 8,8, SCAN_ROWS, 64,32, 0)
+
MCFG_SCREEN_ADD("screen", RASTER)
/* note: these parameters are from published specs, not derived */
/* the board uses a SYNGEN chip to generate video signals */
@@ -467,6 +473,9 @@ static MACHINE_CONFIG_START( guts, eprom_state )
MCFG_GFXDECODE(guts)
MCFG_PALETTE_LENGTH(2048)
+ MCFG_TILEMAP_ADD_STANDARD("playfield", 2, eprom_state, guts_get_playfield_tile_info, 8,8, SCAN_COLS, 64,64)
+ MCFG_TILEMAP_ADD_STANDARD_TRANSPEN("alpha", 2, eprom_state, get_alpha_tile_info, 8,8, SCAN_ROWS, 64,32, 0)
+
MCFG_SCREEN_ADD("screen", RASTER)
/* note: these parameters are from published specs, not derived */
/* the board uses a SYNGEN chip to generate video signals */
diff --git a/src/mame/drivers/foodf.c b/src/mame/drivers/foodf.c
index 608eb9a4204..66caf5f5f55 100644
--- a/src/mame/drivers/foodf.c
+++ b/src/mame/drivers/foodf.c
@@ -209,7 +209,7 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, foodf_state )
AM_RANGE(0x014000, 0x014fff) AM_MIRROR(0x3e3000) AM_RAM
AM_RANGE(0x018000, 0x018fff) AM_MIRROR(0x3e3000) AM_RAM
AM_RANGE(0x01c000, 0x01c0ff) AM_MIRROR(0x3e3f00) AM_RAM AM_SHARE("spriteram")
- AM_RANGE(0x800000, 0x8007ff) AM_MIRROR(0x03f800) AM_RAM_WRITE(playfield_w) AM_SHARE("playfield")
+ AM_RANGE(0x800000, 0x8007ff) AM_MIRROR(0x03f800) AM_RAM_DEVWRITE("playfield", tilemap_device, write) AM_SHARE("playfield")
AM_RANGE(0x900000, 0x9001ff) AM_MIRROR(0x03fe00) AM_DEVREADWRITE8("nvram", x2212_device, read, write, 0x00ff)
AM_RANGE(0x940000, 0x940007) AM_MIRROR(0x023ff8) AM_READ(analog_r)
AM_RANGE(0x944000, 0x944007) AM_MIRROR(0x023ff8) AM_WRITE(analog_w)
@@ -366,6 +366,8 @@ static MACHINE_CONFIG_START( foodf, foodf_state )
/* video hardware */
MCFG_GFXDECODE(foodf)
MCFG_PALETTE_LENGTH(256)
+
+ MCFG_TILEMAP_ADD_STANDARD_TRANSPEN("playfield", 2, foodf_state, get_playfield_tile_info, 8,8, SCAN_COLS, 32,32, 0)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/2, 384, 0, 256, 259, 0, 224)
diff --git a/src/mame/drivers/gauntlet.c b/src/mame/drivers/gauntlet.c
index 7eb1635fb50..63025345d9c 100644
--- a/src/mame/drivers/gauntlet.c
+++ b/src/mame/drivers/gauntlet.c
@@ -300,11 +300,11 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, gauntlet_state )
AM_RANGE(0x803170, 0x803171) AM_MIRROR(0x2fce8e) AM_DEVWRITE8("soundcomm", atari_sound_comm_device, main_command_w, 0x00ff)
/* VBUS */
- AM_RANGE(0x900000, 0x901fff) AM_MIRROR(0x2c8000) AM_RAM_WRITE(playfield_w) AM_SHARE("playfield")
+ AM_RANGE(0x900000, 0x901fff) AM_MIRROR(0x2c8000) AM_RAM_DEVWRITE("playfield", tilemap_device, write) AM_SHARE("playfield")
AM_RANGE(0x902000, 0x903fff) AM_MIRROR(0x2c8000) AM_READWRITE_LEGACY(atarimo_0_spriteram_r, atarimo_0_spriteram_w)
AM_RANGE(0x904000, 0x904fff) AM_MIRROR(0x2c8000) AM_RAM
AM_RANGE(0x905f6e, 0x905f6f) AM_MIRROR(0x2c8000) AM_RAM_WRITE(gauntlet_yscroll_w) AM_SHARE("yscroll")
- AM_RANGE(0x905000, 0x905f7f) AM_MIRROR(0x2c8000) AM_RAM_WRITE(alpha_w) AM_SHARE("alpha")
+ AM_RANGE(0x905000, 0x905f7f) AM_MIRROR(0x2c8000) AM_RAM_DEVWRITE("alpha", tilemap_device, write) AM_SHARE("alpha")
AM_RANGE(0x905f80, 0x905fff) AM_MIRROR(0x2c8000) AM_READWRITE_LEGACY(atarimo_0_slipram_r, atarimo_0_slipram_w)
AM_RANGE(0x910000, 0x9107ff) AM_MIRROR(0x2cf800) AM_RAM_WRITE(paletteram_IIIIRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
AM_RANGE(0x930000, 0x930001) AM_MIRROR(0x2cfffe) AM_WRITE(gauntlet_xscroll_w) AM_SHARE("xscroll")
@@ -509,6 +509,9 @@ static MACHINE_CONFIG_START( gauntlet, gauntlet_state )
MCFG_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK)
MCFG_GFXDECODE(gauntlet)
MCFG_PALETTE_LENGTH(1024)
+
+ MCFG_TILEMAP_ADD_STANDARD("playfield", 2, gauntlet_state, get_playfield_tile_info, 8,8, SCAN_COLS, 64,64)
+ MCFG_TILEMAP_ADD_STANDARD_TRANSPEN("alpha", 2, gauntlet_state, get_alpha_tile_info, 8,8, SCAN_ROWS, 64,32, 0)
MCFG_SCREEN_ADD("screen", RASTER)
/* note: these parameters are from published specs, not derived */
diff --git a/src/mame/drivers/klax.c b/src/mame/drivers/klax.c
index 30d8fddfaae..8948c0c065c 100644
--- a/src/mame/drivers/klax.c
+++ b/src/mame/drivers/klax.c
@@ -83,9 +83,9 @@ static ADDRESS_MAP_START( klax_map, AS_PROGRAM, 16, klax_state )
AM_RANGE(0x2e0000, 0x2e0001) AM_WRITE(watchdog_reset16_w)
AM_RANGE(0x360000, 0x360001) AM_WRITE(interrupt_ack_w)
AM_RANGE(0x3e0000, 0x3e07ff) AM_RAM_WRITE(expanded_paletteram_666_w) AM_SHARE("paletteram")
- AM_RANGE(0x3f0000, 0x3f0f7f) AM_RAM_WRITE(playfield_w) AM_SHARE("playfield")
+ AM_RANGE(0x3f0000, 0x3f0f7f) AM_RAM_DEVWRITE("playfield", tilemap_device, write) AM_SHARE("playfield")
AM_RANGE(0x3f0f80, 0x3f0fff) AM_READWRITE_LEGACY(atarimo_0_slipram_r, atarimo_0_slipram_w)
- AM_RANGE(0x3f1000, 0x3f1fff) AM_RAM_WRITE(playfield_upper_w) AM_SHARE("playfield_up")
+ AM_RANGE(0x3f1000, 0x3f1fff) AM_RAM_DEVWRITE("playfield", tilemap_device, write_ext) AM_SHARE("playfield_ext")
AM_RANGE(0x3f2000, 0x3f27ff) AM_READWRITE_LEGACY(atarimo_0_spriteram_r, atarimo_0_spriteram_w)
AM_RANGE(0x3f2800, 0x3f3fff) AM_RAM
ADDRESS_MAP_END
@@ -170,6 +170,8 @@ static MACHINE_CONFIG_START( klax, klax_state )
MCFG_GFXDECODE(klax)
MCFG_PALETTE_LENGTH(512)
+ MCFG_TILEMAP_ADD_STANDARD("playfield", 2, klax_state, get_playfield_tile_info, 8,8, SCAN_COLS, 64,32)
+
MCFG_SCREEN_ADD("screen", RASTER)
/* note: these parameters are from published specs, not derived */
/* the board uses an SOS-2 chip to generate video signals */
diff --git a/src/mame/drivers/namcoic.c b/src/mame/drivers/namcoic.c
index db09a149e9b..7d155486379 100644
--- a/src/mame/drivers/namcoic.c
+++ b/src/mame/drivers/namcoic.c
@@ -43,20 +43,20 @@ void namco_tilemap_invalidate( void )
}
} /* namco_tilemap_invalidate */
-INLINE void get_tile_info(running_machine &machine,tile_data &tileinfo,int tile_index,UINT16 *vram)
+inline void namcos2_shared_state::namcoic_get_tile_info(tile_data &tileinfo,int tile_index,UINT16 *vram)
{
int tile, mask;
- mTilemapInfo.cb( machine, vram[tile_index], &tile, &mask );
+ mTilemapInfo.cb( machine(), vram[tile_index], &tile, &mask );
tileinfo.mask_data = mTilemapInfo.maskBaseAddr+mask*8;
- SET_TILE_INFO(mTilemapInfo.gfxbank,tile,0,0);
+ SET_TILE_INFO_MEMBER(mTilemapInfo.gfxbank,tile,0,0);
} /* get_tile_info */
-TILE_GET_INFO_MEMBER( namcos2_shared_state::get_tile_info0 ) { get_tile_info(machine(),tileinfo,tile_index,&mTilemapInfo.videoram[0x0000]); }
-TILE_GET_INFO_MEMBER( namcos2_shared_state::get_tile_info1 ) { get_tile_info(machine(),tileinfo,tile_index,&mTilemapInfo.videoram[0x1000]); }
-TILE_GET_INFO_MEMBER( namcos2_shared_state::get_tile_info2 ) { get_tile_info(machine(),tileinfo,tile_index,&mTilemapInfo.videoram[0x2000]); }
-TILE_GET_INFO_MEMBER( namcos2_shared_state::get_tile_info3 ) { get_tile_info(machine(),tileinfo,tile_index,&mTilemapInfo.videoram[0x3000]); }
-TILE_GET_INFO_MEMBER( namcos2_shared_state::get_tile_info4 ) { get_tile_info(machine(),tileinfo,tile_index,&mTilemapInfo.videoram[0x4008]); }
-TILE_GET_INFO_MEMBER( namcos2_shared_state::get_tile_info5 ) { get_tile_info(machine(),tileinfo,tile_index,&mTilemapInfo.videoram[0x4408]); }
+TILE_GET_INFO_MEMBER( namcos2_shared_state::get_tile_info0 ) { namcoic_get_tile_info(tileinfo,tile_index,&mTilemapInfo.videoram[0x0000]); }
+TILE_GET_INFO_MEMBER( namcos2_shared_state::get_tile_info1 ) { namcoic_get_tile_info(tileinfo,tile_index,&mTilemapInfo.videoram[0x1000]); }
+TILE_GET_INFO_MEMBER( namcos2_shared_state::get_tile_info2 ) { namcoic_get_tile_info(tileinfo,tile_index,&mTilemapInfo.videoram[0x2000]); }
+TILE_GET_INFO_MEMBER( namcos2_shared_state::get_tile_info3 ) { namcoic_get_tile_info(tileinfo,tile_index,&mTilemapInfo.videoram[0x3000]); }
+TILE_GET_INFO_MEMBER( namcos2_shared_state::get_tile_info4 ) { namcoic_get_tile_info(tileinfo,tile_index,&mTilemapInfo.videoram[0x4008]); }
+TILE_GET_INFO_MEMBER( namcos2_shared_state::get_tile_info5 ) { namcoic_get_tile_info(tileinfo,tile_index,&mTilemapInfo.videoram[0x4408]); }
void namcos2_shared_state::namco_tilemap_init( int gfxbank, void *maskBaseAddr,
void (*cb)( running_machine &machine, UINT16 code, int *gfx, int *mask) )
diff --git a/src/mame/drivers/offtwall.c b/src/mame/drivers/offtwall.c
index e07ed8c8c8b..72a2a84860e 100644
--- a/src/mame/drivers/offtwall.c
+++ b/src/mame/drivers/offtwall.c
@@ -268,10 +268,10 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, offtwall_state )
AM_RANGE(0x2a0000, 0x2a0001) AM_WRITE(watchdog_reset16_w)
AM_RANGE(0x3e0000, 0x3e0fff) AM_RAM_WRITE(paletteram_666_w) AM_SHARE("paletteram")
AM_RANGE(0x3effc0, 0x3effff) AM_READWRITE(offtwall_atarivc_r, offtwall_atarivc_w) AM_SHARE("atarivc_data")
- AM_RANGE(0x3f4000, 0x3f5eff) AM_RAM_WRITE(playfield_latched_msb_w) AM_SHARE("playfield")
+ AM_RANGE(0x3f4000, 0x3f5eff) AM_RAM_WRITE(atarivc_playfield_latched_msb_w) AM_SHARE("playfield")
AM_RANGE(0x3f5f00, 0x3f5f7f) AM_RAM AM_SHARE("atarivc_eof")
AM_RANGE(0x3f5f80, 0x3f5fff) AM_READWRITE_LEGACY(atarimo_0_slipram_r, atarimo_0_slipram_w)
- AM_RANGE(0x3f6000, 0x3f7fff) AM_RAM_WRITE(playfield_upper_w) AM_SHARE("playfield_up")
+ AM_RANGE(0x3f6000, 0x3f7fff) AM_RAM_WRITE(atarivc_playfield_upper_w) AM_SHARE("playfield_ext")
AM_RANGE(0x3f8000, 0x3fcfff) AM_RAM
AM_RANGE(0x3fd000, 0x3fd7ff) AM_READWRITE_LEGACY(atarimo_0_spriteram_r, atarimo_0_spriteram_w)
AM_RANGE(0x3fd800, 0x3fffff) AM_RAM
@@ -390,6 +390,8 @@ static MACHINE_CONFIG_START( offtwall, offtwall_state )
MCFG_GFXDECODE(offtwall)
MCFG_PALETTE_LENGTH(2048)
+ MCFG_TILEMAP_ADD_STANDARD("playfield", 2, offtwall_state, get_playfield_tile_info, 8,8, SCAN_COLS, 64, 64)
+
MCFG_SCREEN_ADD("screen", RASTER)
/* note: these parameters are from published specs, not derived */
/* the board uses a VAD chip to generate video signals */
diff --git a/src/mame/drivers/relief.c b/src/mame/drivers/relief.c
index dfde94b55a7..02b14196b87 100644
--- a/src/mame/drivers/relief.c
+++ b/src/mame/drivers/relief.c
@@ -148,9 +148,9 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, relief_state )
AM_RANGE(0x2a0000, 0x2a0001) AM_WRITE(watchdog_reset16_w)
AM_RANGE(0x3e0000, 0x3e0fff) AM_RAM_WRITE(paletteram_666_w) AM_SHARE("paletteram")
AM_RANGE(0x3effc0, 0x3effff) AM_READWRITE(relief_atarivc_r, relief_atarivc_w) AM_SHARE("atarivc_data")
- AM_RANGE(0x3f0000, 0x3f1fff) AM_RAM_WRITE(playfield2_latched_msb_w) AM_SHARE("playfield2")
- AM_RANGE(0x3f2000, 0x3f3fff) AM_RAM_WRITE(playfield_latched_lsb_w) AM_SHARE("playfield")
- AM_RANGE(0x3f4000, 0x3f5fff) AM_RAM_WRITE(playfield_dual_upper_w) AM_SHARE("playfield_up")
+ AM_RANGE(0x3f0000, 0x3f1fff) AM_RAM_WRITE(atarivc_playfield2_latched_msb_w) AM_SHARE("playfield2")
+ AM_RANGE(0x3f2000, 0x3f3fff) AM_RAM_WRITE(atarivc_playfield_latched_lsb_w) AM_SHARE("playfield")
+ AM_RANGE(0x3f4000, 0x3f5fff) AM_RAM_WRITE(atarivc_playfield_dual_upper_w) AM_SHARE("playfield_ext")
AM_RANGE(0x3f6000, 0x3f67ff) AM_READWRITE_LEGACY(atarimo_0_spriteram_r, atarimo_0_spriteram_w)
AM_RANGE(0x3f6800, 0x3f8eff) AM_RAM
AM_RANGE(0x3f8f00, 0x3f8f7f) AM_RAM AM_SHARE("atarivc_eof")
@@ -293,6 +293,9 @@ static MACHINE_CONFIG_START( relief, relief_state )
MCFG_GFXDECODE(relief)
MCFG_PALETTE_LENGTH(2048)
+ MCFG_TILEMAP_ADD_STANDARD("playfield", 2, relief_state, get_playfield_tile_info, 8,8, SCAN_COLS, 64,64)
+ MCFG_TILEMAP_ADD_STANDARD_TRANSPEN("playfield2", 2, relief_state, get_playfield2_tile_info, 8,8, SCAN_COLS, 64,64, 0)
+
MCFG_SCREEN_ADD("screen", RASTER)
/* note: these parameters are from published specs, not derived */
/* the board uses a VAD chip to generate video signals */
diff --git a/src/mame/drivers/shuuz.c b/src/mame/drivers/shuuz.c
index 3f5f919e710..7b7a49f46c0 100644
--- a/src/mame/drivers/shuuz.c
+++ b/src/mame/drivers/shuuz.c
@@ -139,10 +139,10 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, shuuz_state )
AM_RANGE(0x107000, 0x107007) AM_NOP
AM_RANGE(0x3e0000, 0x3e087f) AM_RAM_WRITE(paletteram_666_w) AM_SHARE("paletteram")
AM_RANGE(0x3effc0, 0x3effff) AM_READWRITE(shuuz_atarivc_r, shuuz_atarivc_w) AM_SHARE("atarivc_data")
- AM_RANGE(0x3f4000, 0x3f5eff) AM_RAM_WRITE(playfield_latched_msb_w) AM_SHARE("playfield")
+ AM_RANGE(0x3f4000, 0x3f5eff) AM_RAM_WRITE(atarivc_playfield_latched_msb_w) AM_SHARE("playfield")
AM_RANGE(0x3f5f00, 0x3f5f7f) AM_RAM AM_SHARE("atarivc_eof")
AM_RANGE(0x3f5f80, 0x3f5fff) AM_READWRITE_LEGACY(atarimo_0_slipram_r, atarimo_0_slipram_w)
- AM_RANGE(0x3f6000, 0x3f7fff) AM_RAM_WRITE(playfield_upper_w) AM_SHARE("playfield_up")
+ AM_RANGE(0x3f6000, 0x3f7fff) AM_RAM_WRITE(atarivc_playfield_upper_w) AM_SHARE("playfield_ext")
AM_RANGE(0x3f8000, 0x3fcfff) AM_RAM
AM_RANGE(0x3fd000, 0x3fd3ff) AM_READWRITE_LEGACY(atarimo_0_spriteram_r, atarimo_0_spriteram_w)
AM_RANGE(0x3fd400, 0x3fffff) AM_RAM
@@ -262,6 +262,8 @@ static MACHINE_CONFIG_START( shuuz, shuuz_state )
MCFG_GFXDECODE(shuuz)
MCFG_PALETTE_LENGTH(1024)
+ MCFG_TILEMAP_ADD_STANDARD("playfield", 2, shuuz_state, get_playfield_tile_info, 8,8, SCAN_COLS, 64,64)
+
MCFG_SCREEN_ADD("screen", RASTER)
/* note: these parameters are from published specs, not derived */
/* the board uses a VAD chip to generate video signals */
diff --git a/src/mame/drivers/skullxbo.c b/src/mame/drivers/skullxbo.c
index abd402b4649..cfc6e7681be 100644
--- a/src/mame/drivers/skullxbo.c
+++ b/src/mame/drivers/skullxbo.c
@@ -46,11 +46,10 @@ TIMER_DEVICE_CALLBACK_MEMBER(skullxbo_state::scanline_timer)
void skullxbo_state::scanline_update(screen_device &screen, int scanline)
{
- UINT16 *check = &m_alpha[(scanline / 8) * 64 + 42];
-
/* check for interrupts in the alpha ram */
/* the interrupt occurs on the HBLANK of the 6th scanline following */
- if (check < &m_alpha[0x7c0] && (*check & 0x8000))
+ int offset = (scanline / 8) * 64 + 42;
+ if (offset < 0x7c0 && (m_alpha_tilemap->basemem_read(offset) & 0x8000))
{
int width = screen.width();
attotime period = screen.time_until_pos(screen.vpos() + 6, width * 0.9);
@@ -103,11 +102,11 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, skullxbo_state )
AM_RANGE(0xff1000, 0xff13ff) AM_WRITE(video_int_ack_w)
AM_RANGE(0xff1400, 0xff17ff) AM_DEVWRITE8("jsa", atari_jsa_ii_device, main_command_w, 0x00ff)
AM_RANGE(0xff1800, 0xff1bff) AM_DEVWRITE("jsa", atari_jsa_ii_device, sound_reset_w)
- AM_RANGE(0xff1c00, 0xff1c7f) AM_WRITE(skullxbo_playfieldlatch_w)
+ AM_RANGE(0xff1c00, 0xff1c7f) AM_WRITE(playfield_latch_w)
AM_RANGE(0xff1c80, 0xff1cff) AM_WRITE(skullxbo_xscroll_w) AM_SHARE("xscroll")
AM_RANGE(0xff1d00, 0xff1d7f) AM_WRITE(scanline_int_ack_w)
AM_RANGE(0xff1d80, 0xff1dff) AM_WRITE(watchdog_reset16_w)
- AM_RANGE(0xff1e00, 0xff1e7f) AM_WRITE(skullxbo_playfieldlatch_w)
+ AM_RANGE(0xff1e00, 0xff1e7f) AM_WRITE(playfield_latch_w)
AM_RANGE(0xff1e80, 0xff1eff) AM_WRITE(skullxbo_xscroll_w)
AM_RANGE(0xff1f00, 0xff1f7f) AM_WRITE(scanline_int_ack_w)
AM_RANGE(0xff1f80, 0xff1fff) AM_WRITE(watchdog_reset16_w)
@@ -119,9 +118,9 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, skullxbo_state )
AM_RANGE(0xff5800, 0xff5801) AM_READ_PORT("FF5800")
AM_RANGE(0xff5802, 0xff5803) AM_READ_PORT("FF5802")
AM_RANGE(0xff6000, 0xff6fff) AM_READ(eeprom_r)
- AM_RANGE(0xff8000, 0xff9fff) AM_RAM_WRITE(playfield_latched_lsb_w) AM_SHARE("playfield")
- AM_RANGE(0xffa000, 0xffbfff) AM_RAM_WRITE(playfield_upper_w) AM_SHARE("playfield_up")
- AM_RANGE(0xffc000, 0xffcf7f) AM_RAM_WRITE(alpha_w) AM_SHARE("alpha")
+ AM_RANGE(0xff8000, 0xff9fff) AM_RAM_WRITE(playfield_latched_w) AM_SHARE("playfield")
+ AM_RANGE(0xffa000, 0xffbfff) AM_RAM_DEVWRITE("playfield", tilemap_device, write_ext) AM_SHARE("playfield_ext")
+ AM_RANGE(0xffc000, 0xffcf7f) AM_RAM_DEVWRITE("alpha", tilemap_device, write) AM_SHARE("alpha")
AM_RANGE(0xffcf80, 0xffcfff) AM_READWRITE_LEGACY(atarimo_0_slipram_r, atarimo_0_slipram_w)
AM_RANGE(0xffd000, 0xffdfff) AM_READWRITE_LEGACY(atarimo_0_spriteram_r, atarimo_0_spriteram_w)
AM_RANGE(0xffe000, 0xffffff) AM_RAM
@@ -238,6 +237,9 @@ static MACHINE_CONFIG_START( skullxbo, skullxbo_state )
MCFG_GFXDECODE(skullxbo)
MCFG_PALETTE_LENGTH(2048)
+ MCFG_TILEMAP_ADD_STANDARD("playfield", 2, skullxbo_state, get_playfield_tile_info, 16,8, SCAN_COLS, 64,64)
+ MCFG_TILEMAP_ADD_STANDARD_TRANSPEN("alpha", 2, skullxbo_state, get_alpha_tile_info, 16,8, SCAN_ROWS, 64,32, 0)
+
MCFG_SCREEN_ADD("screen", RASTER)
/* note: these parameters are from published specs, not derived */
/* the board uses an SOS-2 chip to generate video signals */
diff --git a/src/mame/drivers/subsino2.c b/src/mame/drivers/subsino2.c
index 939d2529128..8bd23321056 100644
--- a/src/mame/drivers/subsino2.c
+++ b/src/mame/drivers/subsino2.c
@@ -172,6 +172,9 @@ public:
TIMER_DEVICE_CALLBACK_MEMBER(h8_timer_irq);
required_device<cpu_device> m_maincpu;
optional_device<okim6295_device> m_oki;
+
+private:
+ inline void ss9601_get_tile_info(layer_t *l, tile_data &tileinfo, tilemap_memory_index tile_index);
};
@@ -180,7 +183,7 @@ public:
Tilemaps Access
***************************************************************************/
-INLINE void ss9601_get_tile_info(layer_t *l, running_machine &machine, tile_data &tileinfo, tilemap_memory_index tile_index, void *param)
+inline void subsino2_state::ss9601_get_tile_info(layer_t *l, tile_data &tileinfo, tilemap_memory_index tile_index)
{
int addr;
UINT16 offs;
@@ -191,19 +194,19 @@ INLINE void ss9601_get_tile_info(layer_t *l, running_machine &machine, tile_data
case TILE_8x32: addr = tile_index & (~0x180); offs = (tile_index/0x80) & 3; break;
case TILE_64x32: addr = tile_index & (~0x187); offs = ((tile_index/0x80) & 3) + (tile_index & 7) * 4; break;
}
- SET_TILE_INFO(0, (l->videorams[VRAM_HI][addr] << 8) + l->videorams[VRAM_LO][addr] + offs, 0, 0);
+ SET_TILE_INFO_MEMBER(0, (l->videorams[VRAM_HI][addr] << 8) + l->videorams[VRAM_LO][addr] + offs, 0, 0);
}
// Layer 0
TILE_GET_INFO_MEMBER(subsino2_state::ss9601_get_tile_info_0)
{
- ss9601_get_tile_info(&m_layers[0], machine(), tileinfo, tile_index, param);
+ ss9601_get_tile_info(&m_layers[0], tileinfo, tile_index);
}
// Layer 1
TILE_GET_INFO_MEMBER(subsino2_state::ss9601_get_tile_info_1)
{
- ss9601_get_tile_info(&m_layers[1], machine(), tileinfo, tile_index, param);
+ ss9601_get_tile_info(&m_layers[1], tileinfo, tile_index);
}
diff --git a/src/mame/drivers/thunderj.c b/src/mame/drivers/thunderj.c
index cc222294c93..cbc2ce91499 100644
--- a/src/mame/drivers/thunderj.c
+++ b/src/mame/drivers/thunderj.c
@@ -151,11 +151,11 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, thunderj_state )
AM_RANGE(0x360030, 0x360031) AM_DEVWRITE8("jsa", atari_jsa_ii_device, main_command_w, 0x00ff)
AM_RANGE(0x3e0000, 0x3e0fff) AM_RAM_WRITE(paletteram_666_w) AM_SHARE("paletteram")
AM_RANGE(0x3effc0, 0x3effff) AM_READWRITE(thunderj_atarivc_r, thunderj_atarivc_w) AM_SHARE("atarivc_data")
- AM_RANGE(0x3f0000, 0x3f1fff) AM_RAM_WRITE(playfield2_latched_msb_w) AM_SHARE("playfield2")
- AM_RANGE(0x3f2000, 0x3f3fff) AM_RAM_WRITE(playfield_latched_lsb_w) AM_SHARE("playfield")
- AM_RANGE(0x3f4000, 0x3f5fff) AM_RAM_WRITE(playfield_dual_upper_w) AM_SHARE("playfield_up")
+ AM_RANGE(0x3f0000, 0x3f1fff) AM_RAM_WRITE(atarivc_playfield2_latched_msb_w) AM_SHARE("playfield2")
+ AM_RANGE(0x3f2000, 0x3f3fff) AM_RAM_WRITE(atarivc_playfield_latched_lsb_w) AM_SHARE("playfield")
+ AM_RANGE(0x3f4000, 0x3f5fff) AM_RAM_WRITE(atarivc_playfield_dual_upper_w) AM_SHARE("playfield_ext")
AM_RANGE(0x3f6000, 0x3f7fff) AM_READWRITE_LEGACY(atarimo_0_spriteram_r, atarimo_0_spriteram_w)
- AM_RANGE(0x3f8000, 0x3f8eff) AM_RAM_WRITE(alpha_w) AM_SHARE("alpha")
+ AM_RANGE(0x3f8000, 0x3f8eff) AM_RAM_DEVWRITE("alpha", tilemap_device, write) AM_SHARE("alpha")
AM_RANGE(0x3f8f00, 0x3f8f7f) AM_RAM AM_SHARE("atarivc_eof")
AM_RANGE(0x3f8f80, 0x3f8fff) AM_READWRITE_LEGACY(atarimo_0_slipram_r, atarimo_0_slipram_w)
AM_RANGE(0x3f9000, 0x3fffff) AM_RAM
@@ -288,6 +288,10 @@ static MACHINE_CONFIG_START( thunderj, thunderj_state )
MCFG_GFXDECODE(thunderj)
MCFG_PALETTE_LENGTH(2048)
+ MCFG_TILEMAP_ADD_STANDARD("playfield", 2, thunderj_state, get_playfield_tile_info, 8,8, SCAN_COLS, 64,64)
+ MCFG_TILEMAP_ADD_STANDARD_TRANSPEN("playfield2", 2, thunderj_state, get_playfield2_tile_info, 8,8, SCAN_COLS, 64,64, 0)
+ MCFG_TILEMAP_ADD_STANDARD_TRANSPEN("alpha", 2, thunderj_state, get_alpha_tile_info, 8,8, SCAN_ROWS, 64,32, 0)
+
MCFG_SCREEN_ADD("screen", RASTER)
/* note: these parameters are from published specs, not derived */
/* the board uses a VAD chip to generate video signals */
diff --git a/src/mame/drivers/toobin.c b/src/mame/drivers/toobin.c
index 2da4e60f666..0e53313fc63 100644
--- a/src/mame/drivers/toobin.c
+++ b/src/mame/drivers/toobin.c
@@ -80,8 +80,8 @@ WRITE16_MEMBER(toobin_state::interrupt_scan_w)
static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, toobin_state )
ADDRESS_MAP_GLOBAL_MASK(0xc7ffff)
AM_RANGE(0x000000, 0x07ffff) AM_ROM
- AM_RANGE(0xc00000, 0xc07fff) AM_RAM_WRITE(playfield_large_w) AM_SHARE("playfield")
- AM_RANGE(0xc08000, 0xc097ff) AM_MIRROR(0x046000) AM_RAM_WRITE(alpha_w) AM_SHARE("alpha")
+ AM_RANGE(0xc00000, 0xc07fff) AM_RAM_DEVWRITE("playfield", tilemap_device, write) AM_SHARE("playfield")
+ AM_RANGE(0xc08000, 0xc097ff) AM_MIRROR(0x046000) AM_RAM_DEVWRITE("alpha", tilemap_device, write) AM_SHARE("alpha")
AM_RANGE(0xc09800, 0xc09fff) AM_MIRROR(0x046000) AM_READWRITE_LEGACY(atarimo_0_spriteram_r, atarimo_0_spriteram_w)
AM_RANGE(0xc10000, 0xc107ff) AM_MIRROR(0x047800) AM_RAM_WRITE(toobin_paletteram_w) AM_SHARE("paletteram")
AM_RANGE(0xff6000, 0xff6001) AM_READNOP /* who knows? read at controls time */
@@ -205,6 +205,9 @@ static MACHINE_CONFIG_START( toobin, toobin_state )
/* video hardware */
MCFG_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK)
+ MCFG_TILEMAP_ADD_STANDARD("playfield", 4, toobin_state, get_playfield_tile_info, 8,8, SCAN_ROWS, 128,64)
+ MCFG_TILEMAP_ADD_STANDARD_TRANSPEN("alpha", 2, toobin_state, get_alpha_tile_info, 8,8, SCAN_ROWS, 64,48, 0)
+
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/2, 640, 0, 512, 416, 0, 384)
MCFG_SCREEN_UPDATE_DRIVER(toobin_state, screen_update_toobin)
diff --git a/src/mame/drivers/vindictr.c b/src/mame/drivers/vindictr.c
index 565a53ad839..561ff4bcfad 100644
--- a/src/mame/drivers/vindictr.c
+++ b/src/mame/drivers/vindictr.c
@@ -82,9 +82,9 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, vindictr_state )
AM_RANGE(0x360020, 0x360021) AM_DEVWRITE("jsa", atari_jsa_i_device, sound_reset_w)
AM_RANGE(0x360030, 0x360031) AM_DEVWRITE8("jsa", atari_jsa_i_device, main_command_w, 0x00ff)
AM_RANGE(0x3e0000, 0x3e0fff) AM_RAM_WRITE(vindictr_paletteram_w) AM_SHARE("paletteram")
- AM_RANGE(0x3f0000, 0x3f1fff) AM_MIRROR(0x8000) AM_RAM_WRITE(playfield_w) AM_SHARE("playfield")
+ AM_RANGE(0x3f0000, 0x3f1fff) AM_MIRROR(0x8000) AM_RAM_DEVWRITE("playfield", tilemap_device, write) AM_SHARE("playfield")
AM_RANGE(0x3f2000, 0x3f3fff) AM_MIRROR(0x8000) AM_READWRITE_LEGACY(atarimo_0_spriteram_r, atarimo_0_spriteram_w)
- AM_RANGE(0x3f4000, 0x3f4f7f) AM_MIRROR(0x8000) AM_RAM_WRITE(alpha_w) AM_SHARE("alpha")
+ AM_RANGE(0x3f4000, 0x3f4f7f) AM_MIRROR(0x8000) AM_RAM_DEVWRITE("alpha", tilemap_device, write) AM_SHARE("alpha")
AM_RANGE(0x3f4f80, 0x3f4fff) AM_MIRROR(0x8000) AM_READWRITE_LEGACY(atarimo_0_slipram_r, atarimo_0_slipram_w)
AM_RANGE(0x3f5000, 0x3f7fff) AM_MIRROR(0x8000) AM_RAM
ADDRESS_MAP_END
@@ -191,6 +191,9 @@ static MACHINE_CONFIG_START( vindictr, vindictr_state )
MCFG_GFXDECODE(vindictr)
MCFG_PALETTE_LENGTH(2048*8)
+ MCFG_TILEMAP_ADD_STANDARD("playfield", 2, vindictr_state, get_playfield_tile_info, 8,8, SCAN_COLS, 64,64)
+ MCFG_TILEMAP_ADD_STANDARD_TRANSPEN("alpha", 2, vindictr_state, get_alpha_tile_info, 8,8, SCAN_ROWS, 64,32, 0)
+
MCFG_SCREEN_ADD("screen", RASTER)
/* note: these parameters are from published specs, not derived */
/* the board uses a SYNGEN chip to generate video signals */
diff --git a/src/mame/drivers/xybots.c b/src/mame/drivers/xybots.c
index 38d2af753f1..4e29ae5d2ca 100644
--- a/src/mame/drivers/xybots.c
+++ b/src/mame/drivers/xybots.c
@@ -72,10 +72,10 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, xybots_state )
AM_RANGE(0x000000, 0x007fff) AM_MIRROR(0x7c0000) AM_ROM
AM_RANGE(0x008000, 0x00ffff) AM_MIRROR(0x7c0000) AM_ROM /* slapstic maps here */
AM_RANGE(0x010000, 0x03ffff) AM_MIRROR(0x7c0000) AM_ROM
- AM_RANGE(0xff8000, 0xff8fff) AM_MIRROR(0x7f8000) AM_RAM_WRITE(alpha_w) AM_SHARE("alpha")
+ AM_RANGE(0xff8000, 0xff8fff) AM_MIRROR(0x7f8000) AM_RAM_DEVWRITE("alpha", tilemap_device, write) AM_SHARE("alpha")
AM_RANGE(0xff9000, 0xffadff) AM_MIRROR(0x7f8000) AM_RAM
AM_RANGE(0xffae00, 0xffafff) AM_MIRROR(0x7f8000) AM_READWRITE_LEGACY(atarimo_0_spriteram_r, atarimo_0_spriteram_w)
- AM_RANGE(0xffb000, 0xffbfff) AM_MIRROR(0x7f8000) AM_RAM_WRITE(playfield_w) AM_SHARE("playfield")
+ AM_RANGE(0xffb000, 0xffbfff) AM_MIRROR(0x7f8000) AM_RAM_DEVWRITE("playfield", tilemap_device, write) AM_SHARE("playfield")
AM_RANGE(0xffc000, 0xffc7ff) AM_MIRROR(0x7f8800) AM_RAM_WRITE(paletteram_IIIIRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
AM_RANGE(0xffd000, 0xffdfff) AM_MIRROR(0x7f8000) AM_READWRITE(eeprom_r, eeprom_w) AM_SHARE("eeprom")
AM_RANGE(0xffe000, 0xffe0ff) AM_MIRROR(0x7f8000) AM_DEVREAD8("jsa", atari_jsa_i_device, main_response_r, 0x00ff)
@@ -191,6 +191,9 @@ static MACHINE_CONFIG_START( xybots, xybots_state )
MCFG_GFXDECODE(xybots)
MCFG_PALETTE_LENGTH(1024)
+ MCFG_TILEMAP_ADD_STANDARD("playfield", 2, xybots_state, get_playfield_tile_info, 8,8, SCAN_ROWS, 64,32)
+ MCFG_TILEMAP_ADD_STANDARD_TRANSPEN("alpha", 2, xybots_state, get_alpha_tile_info, 8,8, SCAN_ROWS, 64,32, 0)
+
MCFG_SCREEN_ADD("screen", RASTER)
/* note: these parameters are from published specs, not derived */
/* the board uses a SYNGEN chip to generate video signals */
diff --git a/src/mame/includes/atarig1.h b/src/mame/includes/atarig1.h
index aba90b35398..a729f24810e 100644
--- a/src/mame/includes/atarig1.h
+++ b/src/mame/includes/atarig1.h
@@ -15,10 +15,14 @@ public:
: atarigen_state(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_jsa(*this, "jsa"),
+ m_playfield_tilemap(*this, "playfield"),
+ m_alpha_tilemap(*this, "alpha"),
m_mo_command(*this, "mo_command") { }
required_device<cpu_device> m_maincpu;
required_device<atari_jsa_ii_device> m_jsa;
+ required_device<tilemap_device> m_playfield_tilemap;
+ required_device<tilemap_device> m_alpha_tilemap;
bool m_is_pitfight;
diff --git a/src/mame/includes/atarig42.h b/src/mame/includes/atarig42.h
index 51c9b5533bc..913d7e94978 100644
--- a/src/mame/includes/atarig42.h
+++ b/src/mame/includes/atarig42.h
@@ -15,11 +15,16 @@ public:
: atarigen_state(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_jsa(*this, "jsa"),
+ m_playfield_tilemap(*this, "playfield"),
+ m_alpha_tilemap(*this, "alpha"),
m_mo_command(*this, "mo_command") { }
required_device<cpu_device> m_maincpu;
required_device<atari_jsa_iii_device> m_jsa;
+ required_device<tilemap_device> m_playfield_tilemap;
+ required_device<tilemap_device> m_alpha_tilemap;
+
UINT16 m_playfield_base;
UINT16 m_current_control;
diff --git a/src/mame/includes/atarigt.h b/src/mame/includes/atarigt.h
index a86a5ff91a0..d7418644233 100644
--- a/src/mame/includes/atarigt.h
+++ b/src/mame/includes/atarigt.h
@@ -19,10 +19,15 @@ public:
atarigt_state(const machine_config &mconfig, device_type type, const char *tag)
: atarigen_state(mconfig, type, tag),
m_colorram(*this, "colorram", 32),
+ m_playfield_tilemap(*this, "playfield"),
+ m_alpha_tilemap(*this, "alpha"),
m_mo_command(*this, "mo_command") { }
UINT8 m_is_primrage;
required_shared_ptr<UINT16> m_colorram;
+
+ required_device<tilemap_device> m_playfield_tilemap;
+ required_device<tilemap_device> m_alpha_tilemap;
bitmap_ind16 * m_pf_bitmap;
bitmap_ind16 * m_an_bitmap;
diff --git a/src/mame/includes/atarigx2.h b/src/mame/includes/atarigx2.h
index a961edb83a5..50ea95d0d21 100644
--- a/src/mame/includes/atarigx2.h
+++ b/src/mame/includes/atarigx2.h
@@ -14,7 +14,9 @@ public:
: atarigen_state(mconfig, type, tag),
m_jsa(*this, "jsa"),
m_mo_command(*this, "mo_command"),
- m_protection_base(*this, "protection_base") { }
+ m_protection_base(*this, "protection_base"),
+ m_playfield_tilemap(*this, "playfield"),
+ m_alpha_tilemap(*this, "alpha") { }
UINT16 m_playfield_base;
@@ -22,6 +24,9 @@ public:
required_shared_ptr<UINT32> m_mo_command;
required_shared_ptr<UINT32> m_protection_base;
+
+ required_device<tilemap_device> m_playfield_tilemap;
+ required_device<tilemap_device> m_alpha_tilemap;
UINT16 m_current_control;
UINT8 m_playfield_tile_bank;
diff --git a/src/mame/includes/atarisy1.h b/src/mame/includes/atarisy1.h
index 41c8ca6fcd7..8751c212cc5 100644
--- a/src/mame/includes/atarisy1.h
+++ b/src/mame/includes/atarisy1.h
@@ -13,6 +13,8 @@ public:
: atarigen_state(mconfig, type, tag),
m_bankselect(*this, "bankselect"),
m_joystick_timer(*this, "joystick_timer"),
+ m_playfield_tilemap(*this, "playfield"),
+ m_alpha_tilemap(*this, "alpha"),
m_yscroll_reset_timer(*this, "yreset_timer"),
m_scanline_timer(*this, "scan_timer"),
m_int3off_timer(*this, "int3off_timer") { }
@@ -28,6 +30,8 @@ public:
UINT8 m_joystick_value;
/* playfield parameters */
+ required_device<tilemap_device> m_playfield_tilemap;
+ required_device<tilemap_device> m_alpha_tilemap;
UINT16 m_playfield_lookup[256];
UINT8 m_playfield_tile_bank;
UINT16 m_playfield_priority_pens;
diff --git a/src/mame/includes/atarisy2.h b/src/mame/includes/atarisy2.h
index 978a861eb23..c199b92746e 100644
--- a/src/mame/includes/atarisy2.h
+++ b/src/mame/includes/atarisy2.h
@@ -17,6 +17,8 @@ public:
m_audiocpu(*this, "audiocpu"),
m_slapstic_base(*this, "slapstic_base"),
m_bankselect(*this, "bankselect"),
+ m_playfield_tilemap(*this, "playfield"),
+ m_alpha_tilemap(*this, "alpha"),
m_rombank1(*this, "rombank1"),
m_rombank2(*this, "rombank2") { }
@@ -26,6 +28,9 @@ public:
UINT8 m_interrupt_enable;
required_shared_ptr<UINT16> m_bankselect;
+
+ required_device<tilemap_device> m_playfield_tilemap;
+ required_device<tilemap_device> m_alpha_tilemap;
INT8 m_pedal_count;
diff --git a/src/mame/includes/badlands.h b/src/mame/includes/badlands.h
index 59916ebdfd9..bfd4a7101f6 100644
--- a/src/mame/includes/badlands.h
+++ b/src/mame/includes/badlands.h
@@ -10,7 +10,10 @@ class badlands_state : public atarigen_state
{
public:
badlands_state(const machine_config &mconfig, device_type type, const char *tag)
- : atarigen_state(mconfig, type, tag) { }
+ : atarigen_state(mconfig, type, tag),
+ m_playfield_tilemap(*this, "playfield") { }
+
+ required_device<tilemap_device> m_playfield_tilemap;
UINT8 m_pedal_value[2];
diff --git a/src/mame/includes/batman.h b/src/mame/includes/batman.h
index f636824d53b..7255437bccb 100644
--- a/src/mame/includes/batman.h
+++ b/src/mame/includes/batman.h
@@ -12,9 +12,12 @@ class batman_state : public atarigen_state
public:
batman_state(const machine_config &mconfig, device_type type, const char *tag)
: atarigen_state(mconfig, type, tag),
- m_jsa(*this, "jsa") { }
+ m_jsa(*this, "jsa"),
+ m_alpha_tilemap(*this, "alpha") { }
required_device<atari_jsa_iii_device> m_jsa;
+
+ required_device<tilemap_device> m_alpha_tilemap;
UINT16 m_latch_data;
diff --git a/src/mame/includes/blstroid.h b/src/mame/includes/blstroid.h
index 30acf65411e..95806f97638 100644
--- a/src/mame/includes/blstroid.h
+++ b/src/mame/includes/blstroid.h
@@ -18,9 +18,11 @@ public:
blstroid_state(const machine_config &mconfig, device_type type, const char *tag)
: atarigen_state(mconfig, type, tag),
+ m_playfield_tilemap(*this, "playfield"),
m_jsa(*this, "jsa"),
m_priorityram(*this, "priorityram") { }
+ required_device<tilemap_device> m_playfield_tilemap;
required_device<atari_jsa_i_device> m_jsa;
required_shared_ptr<UINT16> m_priorityram;
virtual void update_interrupts();
@@ -37,7 +39,3 @@ public:
protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};
-
-
-/*----------- defined in video/blstroid.c -----------*/
-void blstroid_scanline_update(screen_device &screen, int scanline);
diff --git a/src/mame/includes/cave.h b/src/mame/includes/cave.h
index 8652520e326..74d28b36fbe 100644
--- a/src/mame/includes/cave.h
+++ b/src/mame/includes/cave.h
@@ -216,4 +216,7 @@ public:
DECLARE_WRITE_LINE_MEMBER(irqhandler);
DECLARE_WRITE_LINE_MEMBER(sound_irq_gen);
optional_device<eeprom_device> m_eeprom;
+
+private:
+ inline void get_tile_info( tile_data &tileinfo, int tile_index, int GFX );
};
diff --git a/src/mame/includes/cyberbal.h b/src/mame/includes/cyberbal.h
index d4cf66e94cc..b52b795cbaf 100644
--- a/src/mame/includes/cyberbal.h
+++ b/src/mame/includes/cyberbal.h
@@ -22,6 +22,10 @@ public:
m_dac1(*this, "dac1"),
m_dac2(*this, "dac2"),
m_jsa(*this, "jsa"),
+ m_playfield_tilemap(*this, "playfield"),
+ m_alpha_tilemap(*this, "alpha"),
+ m_playfield2_tilemap(*this, "playfield2"),
+ m_alpha2_tilemap(*this, "alpha2"),
m_paletteram_0(*this, "paletteram_0"),
m_paletteram_1(*this, "paletteram_1") { }
@@ -32,6 +36,10 @@ public:
optional_device<dac_device> m_dac1;
optional_device<dac_device> m_dac2;
optional_device<atari_jsa_ii_device> m_jsa;
+ required_device<tilemap_device> m_playfield_tilemap;
+ required_device<tilemap_device> m_alpha_tilemap;
+ optional_device<tilemap_device> m_playfield2_tilemap;
+ optional_device<tilemap_device> m_alpha2_tilemap;
optional_shared_ptr<UINT16> m_paletteram_0;
optional_shared_ptr<UINT16> m_paletteram_1;
UINT16 m_current_slip[2];
diff --git a/src/mame/includes/dooyong.h b/src/mame/includes/dooyong.h
index 57b55507165..5ec78a536ab 100644
--- a/src/mame/includes/dooyong.h
+++ b/src/mame/includes/dooyong.h
@@ -71,6 +71,8 @@ public:
TILE_GET_INFO_MEMBER(get_fg2_tile_info);
TILE_GET_INFO_MEMBER(flytiger_get_fg_tile_info);
TILE_GET_INFO_MEMBER(get_tx_tile_info);
+ inline void lastday_get_tile_info(tile_data &tileinfo, int tile_index, const UINT8 *tilerom, UINT8 *scroll, int graphics);
+ inline void rshark_get_tile_info(tile_data &tileinfo, int tile_index, const UINT8 *tilerom1, const UINT8 *tilerom2, UINT8 *scroll, int graphics);
DECLARE_MACHINE_START(lastday);
DECLARE_MACHINE_RESET(sound_ym2203);
DECLARE_VIDEO_START(lastday);
diff --git a/src/mame/includes/eprom.h b/src/mame/includes/eprom.h
index 8618d57cabf..c5d84af0211 100644
--- a/src/mame/includes/eprom.h
+++ b/src/mame/includes/eprom.h
@@ -12,9 +12,13 @@ class eprom_state : public atarigen_state
public:
eprom_state(const machine_config &mconfig, device_type type, const char *tag)
: atarigen_state(mconfig, type, tag),
+ m_playfield_tilemap(*this, "playfield"),
+ m_alpha_tilemap(*this, "alpha"),
m_jsa(*this, "jsa"),
m_extra(*this, "extra") { }
+ required_device<tilemap_device> m_playfield_tilemap;
+ required_device<tilemap_device> m_alpha_tilemap;
required_device<atari_jsa_base_device> m_jsa;
int m_screen_intensity;
int m_video_disable;
diff --git a/src/mame/includes/foodf.h b/src/mame/includes/foodf.h
index f302ab3a853..e134d914f59 100644
--- a/src/mame/includes/foodf.h
+++ b/src/mame/includes/foodf.h
@@ -13,9 +13,11 @@ public:
foodf_state(const machine_config &mconfig, device_type type, const char *tag)
: atarigen_state(mconfig, type, tag),
m_nvram(*this, "nvram"),
+ m_playfield_tilemap(*this, "playfield"),
m_spriteram(*this, "spriteram") { }
required_device<x2212_device> m_nvram;
+ required_device<tilemap_device> m_playfield_tilemap;
double m_rweights[3];
double m_gweights[3];
diff --git a/src/mame/includes/gauntlet.h b/src/mame/includes/gauntlet.h
index 95e699c55b4..50e74129350 100644
--- a/src/mame/includes/gauntlet.h
+++ b/src/mame/includes/gauntlet.h
@@ -10,7 +10,12 @@ class gauntlet_state : public atarigen_state
{
public:
gauntlet_state(const machine_config &mconfig, device_type type, const char *tag)
- : atarigen_state(mconfig, type, tag) { }
+ : atarigen_state(mconfig, type, tag),
+ m_playfield_tilemap(*this, "playfield"),
+ m_alpha_tilemap(*this, "alpha") { }
+
+ required_device<tilemap_device> m_playfield_tilemap;
+ required_device<tilemap_device> m_alpha_tilemap;
UINT16 m_sound_reset_val;
UINT8 m_vindctr2_screen_refresh;
diff --git a/src/mame/includes/klax.h b/src/mame/includes/klax.h
index a4c4075e9b3..25c620948c5 100644
--- a/src/mame/includes/klax.h
+++ b/src/mame/includes/klax.h
@@ -10,7 +10,11 @@ class klax_state : public atarigen_state
{
public:
klax_state(const machine_config &mconfig, device_type type, const char *tag)
- : atarigen_state(mconfig, type, tag) { }
+ : atarigen_state(mconfig, type, tag),
+ m_playfield_tilemap(*this, "playfield") { }
+
+ required_device<tilemap_device> m_playfield_tilemap;
+
virtual void update_interrupts();
virtual void scanline_update(screen_device &screen, int scanline);
DECLARE_WRITE16_MEMBER(interrupt_ack_w);
diff --git a/src/mame/includes/namcona1.h b/src/mame/includes/namcona1.h
index 442d7523581..b1f3dc0441a 100644
--- a/src/mame/includes/namcona1.h
+++ b/src/mame/includes/namcona1.h
@@ -113,4 +113,7 @@ public:
UINT32 screen_update_namcona1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(namcona1_interrupt);
TIMER_DEVICE_CALLBACK_MEMBER(mcu_interrupt);
+
+private:
+ void tilemap_get_info(tile_data &tileinfo, int tile_index, const UINT16 *tilemap_videoram, int tilemap_color, bool use_4bpp_gfx);
};
diff --git a/src/mame/includes/namcos1.h b/src/mame/includes/namcos1.h
index 0add239d67f..f5085a1e45e 100644
--- a/src/mame/includes/namcos1.h
+++ b/src/mame/includes/namcos1.h
@@ -106,6 +106,10 @@ public:
required_device<cpu_device> m_subcpu;
required_device<cpu_device> m_mcu;
required_device<dac_device> m_dac;
+
+private:
+ inline void bg_get_info(tile_data &tileinfo,int tile_index,UINT8 *info_vram);
+ inline void fg_get_info(tile_data &tileinfo,int tile_index,UINT8 *info_vram);
};
/*----------- defined in drivers/namcos1.c -----------*/
diff --git a/src/mame/includes/namcos2.h b/src/mame/includes/namcos2.h
index df8a8d26e54..e735c783f2a 100644
--- a/src/mame/includes/namcos2.h
+++ b/src/mame/includes/namcos2.h
@@ -186,6 +186,7 @@ protected:
UINT16 m_c355_obj_ram[0x20000/2];
UINT8 m_player_mux;
+ inline void namcoic_get_tile_info(tile_data &tileinfo,int tile_index,UINT16 *vram);
public:
// general
diff --git a/src/mame/includes/namcos86.h b/src/mame/includes/namcos86.h
index 84daaa90c15..838ac61ddc6 100644
--- a/src/mame/includes/namcos86.h
+++ b/src/mame/includes/namcos86.h
@@ -58,4 +58,7 @@ public:
virtual void palette_init();
UINT32 screen_update_namcos86(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void screen_eof_namcos86(screen_device &screen, bool state);
+
+private:
+ inline void get_tile_info(tile_data &tileinfo,int tile_index,int layer,UINT8 *vram);
};
diff --git a/src/mame/includes/skullxbo.h b/src/mame/includes/skullxbo.h
index 880acdfca29..5eccc55f2bf 100644
--- a/src/mame/includes/skullxbo.h
+++ b/src/mame/includes/skullxbo.h
@@ -13,10 +13,16 @@ public:
skullxbo_state(const machine_config &mconfig, device_type type, const char *tag)
: atarigen_state(mconfig, type, tag),
m_jsa(*this, "jsa"),
- m_scanline_timer(*this, "scan_timer") { }
+ m_scanline_timer(*this, "scan_timer"),
+ m_playfield_tilemap(*this, "playfield"),
+ m_alpha_tilemap(*this, "alpha"),
+ m_playfield_latch(-1) { }
required_device<atari_jsa_ii_device> m_jsa;
required_device<timer_device> m_scanline_timer;
+ required_device<tilemap_device> m_playfield_tilemap;
+ required_device<tilemap_device> m_alpha_tilemap;
+ int m_playfield_latch;
virtual void update_interrupts();
virtual void scanline_update(screen_device &screen, int scanline);
@@ -25,13 +31,14 @@ public:
DECLARE_DRIVER_INIT(skullxbo);
TILE_GET_INFO_MEMBER(get_alpha_tile_info);
TILE_GET_INFO_MEMBER(get_playfield_tile_info);
+ WRITE16_MEMBER(playfield_latch_w);
+ WRITE16_MEMBER(playfield_latched_w);
DECLARE_MACHINE_START(skullxbo);
DECLARE_MACHINE_RESET(skullxbo);
DECLARE_VIDEO_START(skullxbo);
UINT32 screen_update_skullxbo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(scanline_timer);
void skullxbo_scanline_update(int scanline);
- DECLARE_WRITE16_MEMBER( skullxbo_playfieldlatch_w );
DECLARE_WRITE16_MEMBER( skullxbo_xscroll_w );
DECLARE_WRITE16_MEMBER( skullxbo_yscroll_w );
DECLARE_WRITE16_MEMBER( skullxbo_mobmsb_w );
diff --git a/src/mame/includes/taito_f3.h b/src/mame/includes/taito_f3.h
index 09c1d545d97..1231fb421a1 100644
--- a/src/mame/includes/taito_f3.h
+++ b/src/mame/includes/taito_f3.h
@@ -289,4 +289,7 @@ public:
protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
+
+private:
+ inline void get_tile_info(tile_data &tileinfo, int tile_index, UINT16 *gfx_base);
};
diff --git a/src/mame/includes/thunderj.h b/src/mame/includes/thunderj.h
index dca17d195d0..60ea68bed5e 100644
--- a/src/mame/includes/thunderj.h
+++ b/src/mame/includes/thunderj.h
@@ -13,9 +13,11 @@ public:
thunderj_state(const machine_config &mconfig, device_type type, const char *tag)
: atarigen_state(mconfig, type, tag),
m_jsa(*this, "jsa"),
+ m_alpha_tilemap(*this, "alpha"),
m_extra(*this, "extra") { }
required_device<atari_jsa_ii_device> m_jsa;
+ required_device<tilemap_device> m_alpha_tilemap;
UINT8 m_alpha_tile_bank;
virtual void update_interrupts();
DECLARE_READ16_MEMBER(special_port2_r);
diff --git a/src/mame/includes/toobin.h b/src/mame/includes/toobin.h
index 470e6278a37..c1ddac6915c 100644
--- a/src/mame/includes/toobin.h
+++ b/src/mame/includes/toobin.h
@@ -13,9 +13,15 @@ public:
toobin_state(const machine_config &mconfig, device_type type, const char *tag)
: atarigen_state(mconfig, type, tag),
m_jsa(*this, "jsa"),
+ m_playfield_tilemap(*this, "playfield"),
+ m_alpha_tilemap(*this, "alpha"),
m_interrupt_scan(*this, "interrupt_scan") { }
required_device<atari_jsa_i_device> m_jsa;
+
+ required_device<tilemap_device> m_playfield_tilemap;
+ required_device<tilemap_device> m_alpha_tilemap;
+
required_shared_ptr<UINT16> m_interrupt_scan;
double m_brightness;
diff --git a/src/mame/includes/vindictr.h b/src/mame/includes/vindictr.h
index dc1b7a141c7..f71cdcdb736 100644
--- a/src/mame/includes/vindictr.h
+++ b/src/mame/includes/vindictr.h
@@ -12,8 +12,12 @@ class vindictr_state : public atarigen_state
public:
vindictr_state(const machine_config &mconfig, device_type type, const char *tag)
: atarigen_state(mconfig, type, tag),
+ m_playfield_tilemap(*this, "playfield"),
+ m_alpha_tilemap(*this, "alpha"),
m_jsa(*this, "jsa") { }
+ required_device<tilemap_device> m_playfield_tilemap;
+ required_device<tilemap_device> m_alpha_tilemap;
required_device<atari_jsa_i_device> m_jsa;
UINT8 m_playfield_tile_bank;
UINT16 m_playfield_xscroll;
diff --git a/src/mame/includes/xybots.h b/src/mame/includes/xybots.h
index 1b3d4d3689c..acb7a012a35 100644
--- a/src/mame/includes/xybots.h
+++ b/src/mame/includes/xybots.h
@@ -12,9 +12,14 @@ class xybots_state : public atarigen_state
public:
xybots_state(const machine_config &mconfig, device_type type, const char *tag)
: atarigen_state(mconfig, type, tag),
- m_jsa(*this, "jsa") { }
+ m_jsa(*this, "jsa"),
+ m_playfield_tilemap(*this, "playfield"),
+ m_alpha_tilemap(*this, "alpha") { }
required_device<atari_jsa_i_device> m_jsa;
+ required_device<tilemap_device> m_playfield_tilemap;
+ required_device<tilemap_device> m_alpha_tilemap;
+
UINT16 m_h256;
virtual void update_interrupts();
DECLARE_READ16_MEMBER(special_port1_r);
diff --git a/src/mame/machine/atarigen.c b/src/mame/machine/atarigen.c
index 196e399f3ca..285a91aa391 100644
--- a/src/mame/machine/atarigen.c
+++ b/src/mame/machine/atarigen.c
@@ -389,21 +389,17 @@ atarigen_state::atarigen_state(const machine_config &mconfig, device_type type,
m_sound_int_state(0),
m_video_int_state(0),
m_eeprom_default(NULL),
- m_playfield(*this, "playfield"),
- m_playfield2(*this, "playfield2"),
- m_playfield_upper(*this, "playfield_up"),
- m_alpha(*this, "alpha"),
- m_alpha2(*this, "alpha2"),
m_xscroll(*this, "xscroll"),
m_yscroll(*this, "yscroll"),
- m_playfield32(*this, "playfield32"),
- m_alpha32(*this, "alpha32"),
- m_playfield_tilemap(NULL),
- m_playfield2_tilemap(NULL),
- m_alpha_tilemap(NULL),
- m_alpha2_tilemap(NULL),
- m_atarivc_data(*this, "atarivc_data"),
- m_atarivc_eof_data(*this, "atarivc_eof"),
+ m_atarivc_playfield_tilemap(*this, "playfield"),
+ m_atarivc_playfield2_tilemap(*this, "playfield2"),
+ m_atarivc_data(*this, "atarivc_data"),
+ m_atarivc_eof_data(*this, "atarivc_eof"),
+ m_actual_vc_latch0(0),
+ m_actual_vc_latch1(0),
+ m_atarivc_playfields(0),
+ m_atarivc_playfield_latch(0),
+ m_atarivc_playfield2_latch(0),
m_eeprom_unlocked(false),
m_slapstic_num(0),
m_slapstic(NULL),
@@ -413,11 +409,6 @@ atarigen_state::atarigen_state(const machine_config &mconfig, device_type type,
m_slapstic_base(0),
m_slapstic_mirror(0),
m_scanlines_per_callback(0),
- m_actual_vc_latch0(0),
- m_actual_vc_latch1(0),
- m_atarivc_playfields(0),
- m_playfield_latch(0),
- m_playfield2_latch(0),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_oki(*this, "oki"),
@@ -457,6 +448,10 @@ void atarigen_state::machine_start()
save_item(NAME(m_atarivc_state.pf1_yscroll)); // playfield 2 yscroll
save_item(NAME(m_atarivc_state.mo_xscroll)); // sprite xscroll
save_item(NAME(m_atarivc_state.mo_yscroll)); // sprite xscroll
+ save_item(NAME(m_actual_vc_latch0));
+ save_item(NAME(m_actual_vc_latch1));
+ save_item(NAME(m_atarivc_playfield_latch));
+ save_item(NAME(m_atarivc_playfield2_latch));
save_item(NAME(m_eeprom_unlocked));
@@ -467,12 +462,6 @@ void atarigen_state::machine_start()
save_item(NAME(m_scanlines_per_callback));
- save_item(NAME(m_actual_vc_latch0));
- save_item(NAME(m_actual_vc_latch1));
-
- save_item(NAME(m_playfield_latch));
- save_item(NAME(m_playfield2_latch));
-
save_item(NAME(m_earom_data));
save_item(NAME(m_earom_control));
}
@@ -920,13 +909,13 @@ void atarigen_state::atarivc_eof_update(emu_timer &timer, screen_device &screen)
atarimo_set_xscroll(0, m_atarivc_state.mo_xscroll);
atarimo_set_yscroll(0, m_atarivc_state.mo_yscroll);
- m_playfield_tilemap->set_scrollx(0, m_atarivc_state.pf0_xscroll);
- m_playfield_tilemap->set_scrolly(0, m_atarivc_state.pf0_yscroll);
+ m_atarivc_playfield_tilemap->set_scrollx(0, m_atarivc_state.pf0_xscroll);
+ m_atarivc_playfield_tilemap->set_scrolly(0, m_atarivc_state.pf0_yscroll);
if (m_atarivc_playfields > 1)
{
- m_playfield2_tilemap->set_scrollx(0, m_atarivc_state.pf1_xscroll);
- m_playfield2_tilemap->set_scrolly(0, m_atarivc_state.pf1_yscroll);
+ m_atarivc_playfield2_tilemap->set_scrollx(0, m_atarivc_state.pf1_xscroll);
+ m_atarivc_playfield2_tilemap->set_scrolly(0, m_atarivc_state.pf1_yscroll);
}
timer.adjust(screen.time_until_pos(0));
@@ -956,6 +945,9 @@ void atarigen_state::atarivc_reset(screen_device &screen, UINT16 *eof_data, int
// this allows us to manually reset eof_data to NULL if it's not used
m_atarivc_eof_data.set_target(eof_data, 0x100);
m_atarivc_playfields = playfields;
+
+ if (playfields == 2 && m_atarivc_playfield2_tilemap != NULL)
+ m_atarivc_playfield2_tilemap->extmem().set(m_atarivc_playfield_tilemap->extmem());
// clear the RAM we use
memset(m_atarivc_data, 0, 0x40);
@@ -1016,8 +1008,8 @@ void atarigen_state::atarivc_common_w(screen_device &screen, offs_t offset, UINT
case 0x0a:
// reset the latches when disabled
- set_playfield_latch((newword & 0x0080) ? m_actual_vc_latch0 : -1);
- set_playfield2_latch((newword & 0x0080) ? m_actual_vc_latch1 : -1);
+ m_atarivc_playfield_latch = (newword & 0x0080) ? m_actual_vc_latch0 : -1;
+ m_atarivc_playfield2_latch = (newword & 0x0080) ? m_actual_vc_latch1 : -1;
// check for rowscroll enable
m_atarivc_state.rowscroll_enable = (newword & 0x2000) >> 13;
@@ -1068,16 +1060,16 @@ void atarigen_state::atarivc_common_w(screen_device &screen, offs_t offset, UINT
case 0x1c:
m_actual_vc_latch0 = -1;
m_actual_vc_latch1 = newword;
- set_playfield_latch((m_atarivc_data[0x0a] & 0x80) ? m_actual_vc_latch0 : -1);
- set_playfield2_latch((m_atarivc_data[0x0a] & 0x80) ? m_actual_vc_latch1 : -1);
+ m_atarivc_playfield_latch = (m_atarivc_data[0x0a] & 0x80) ? m_actual_vc_latch0 : -1;
+ m_atarivc_playfield2_latch = (m_atarivc_data[0x0a] & 0x80) ? m_actual_vc_latch1 : -1;
break;
// latch 2 value
case 0x1d:
m_actual_vc_latch0 = newword;
m_actual_vc_latch1 = -1;
- set_playfield_latch((m_atarivc_data[0x0a] & 0x80) ? m_actual_vc_latch0 : -1);
- set_playfield2_latch((m_atarivc_data[0x0a] & 0x80) ? m_actual_vc_latch1 : -1);
+ m_atarivc_playfield_latch = (m_atarivc_data[0x0a] & 0x80) ? m_actual_vc_latch0 : -1;
+ m_atarivc_playfield2_latch = (m_atarivc_data[0x0a] & 0x80) ? m_actual_vc_latch1 : -1;
break;
// scanline IRQ ack here
@@ -1128,100 +1120,13 @@ UINT16 atarigen_state::atarivc_r(screen_device &screen, offs_t offset)
***************************************************************************/
//-------------------------------------------------
-// alpha_w: Generic write handler for alpha RAM.
-//-------------------------------------------------
-
-WRITE16_MEMBER(atarigen_state::alpha_w)
-{
- COMBINE_DATA(&m_alpha[offset]);
- m_alpha_tilemap->mark_tile_dirty(offset);
-}
-
-WRITE32_MEMBER(atarigen_state::alpha32_w)
-{
- COMBINE_DATA(&m_alpha32[offset]);
- if (ACCESSING_BITS_16_31)
- m_alpha_tilemap->mark_tile_dirty(offset * 2);
- if (ACCESSING_BITS_0_15)
- m_alpha_tilemap->mark_tile_dirty(offset * 2 + 1);
-}
-
-WRITE16_MEMBER(atarigen_state::alpha2_w)
-{
- COMBINE_DATA(&m_alpha2[offset]);
- m_alpha2_tilemap->mark_tile_dirty(offset);
-}
-
-
-
-//-------------------------------------------------
-// set_playfield_latch: Sets the latch for the latched
-// playfield handlers below.
-//-------------------------------------------------
-
-void atarigen_state::set_playfield_latch(int data)
-{
- m_playfield_latch = data;
-}
-
-void atarigen_state::set_playfield2_latch(int data)
-{
- m_playfield2_latch = data;
-}
-
-
-
-//-------------------------------------------------
-// playfield_w: Generic write handler for PF RAM.
-//-------------------------------------------------
-
-WRITE16_MEMBER(atarigen_state::playfield_w)
-{
- COMBINE_DATA(&m_playfield[offset]);
- m_playfield_tilemap->mark_tile_dirty(offset);
-}
-
-WRITE32_MEMBER(atarigen_state::playfield32_w)
-{
- COMBINE_DATA(&m_playfield32[offset]);
- if (ACCESSING_BITS_16_31)
- m_playfield_tilemap->mark_tile_dirty(offset * 2);
- if (ACCESSING_BITS_0_15)
- m_playfield_tilemap->mark_tile_dirty(offset * 2 + 1);
-}
-
-WRITE16_MEMBER(atarigen_state::playfield2_w)
-{
- COMBINE_DATA(&m_playfield2[offset]);
- m_playfield2_tilemap->mark_tile_dirty(offset);
-}
-
-
-
-//-------------------------------------------------
-// playfield_large_w: Generic write handler for
-// large (2-word) playfield RAM.
-//-------------------------------------------------
-
-WRITE16_MEMBER(atarigen_state::playfield_large_w)
-{
- atarigen_state *state = space.machine().driver_data<atarigen_state>();
- COMBINE_DATA(&state->m_playfield[offset]);
- state->m_playfield_tilemap->mark_tile_dirty(offset / 2);
-}
-
-
-
-//-------------------------------------------------
// playfield_upper_w: Generic write handler for
// upper word of split playfield RAM.
//-------------------------------------------------
-WRITE16_MEMBER(atarigen_state::playfield_upper_w)
+WRITE16_MEMBER(atarigen_state::atarivc_playfield_upper_w)
{
- atarigen_state *state = space.machine().driver_data<atarigen_state>();
- COMBINE_DATA(&state->m_playfield_upper[offset]);
- state->m_playfield_tilemap->mark_tile_dirty(offset);
+ m_atarivc_playfield_tilemap->write_ext(space, offset, data, mem_mask);
}
@@ -1231,12 +1136,10 @@ WRITE16_MEMBER(atarigen_state::playfield_upper_w)
// upper word of split dual playfield RAM.
//-------------------------------------------------
-WRITE16_MEMBER(atarigen_state::playfield_dual_upper_w)
+WRITE16_MEMBER(atarigen_state::atarivc_playfield_dual_upper_w)
{
- atarigen_state *state = space.machine().driver_data<atarigen_state>();
- COMBINE_DATA(&state->m_playfield_upper[offset]);
- state->m_playfield_tilemap->mark_tile_dirty(offset);
- state->m_playfield2_tilemap->mark_tile_dirty(offset);
+ m_atarivc_playfield_tilemap->write_ext(space, offset, data, mem_mask);
+ m_atarivc_playfield2_tilemap->write_ext(space, offset, data, mem_mask);
}
@@ -1247,15 +1150,11 @@ WRITE16_MEMBER(atarigen_state::playfield_dual_upper_w)
// upper word.
//-------------------------------------------------
-WRITE16_MEMBER(atarigen_state::playfield_latched_lsb_w)
+WRITE16_MEMBER(atarigen_state::atarivc_playfield_latched_lsb_w)
{
- atarigen_state *state = space.machine().driver_data<atarigen_state>();
-
- COMBINE_DATA(&state->m_playfield[offset]);
- state->m_playfield_tilemap->mark_tile_dirty(offset);
-
- if (state->m_playfield_latch != -1)
- state->m_playfield_upper[offset] = (state->m_playfield_upper[offset] & ~0x00ff) | (state->m_playfield_latch & 0x00ff);
+ m_atarivc_playfield_tilemap->write(space, offset, data, mem_mask);
+ if (m_atarivc_playfield_latch != -1)
+ m_atarivc_playfield_tilemap->write_ext(space, offset, UINT16(m_atarivc_playfield_latch), UINT16(0x00ff));
}
@@ -1266,15 +1165,11 @@ WRITE16_MEMBER(atarigen_state::playfield_latched_lsb_w)
// upper word.
//-------------------------------------------------
-WRITE16_MEMBER(atarigen_state::playfield_latched_msb_w)
+WRITE16_MEMBER(atarigen_state::atarivc_playfield_latched_msb_w)
{
- atarigen_state *state = space.machine().driver_data<atarigen_state>();
-
- COMBINE_DATA(&state->m_playfield[offset]);
- state->m_playfield_tilemap->mark_tile_dirty(offset);
-
- if (state->m_playfield_latch != -1)
- state->m_playfield_upper[offset] = (state->m_playfield_upper[offset] & ~0xff00) | (state->m_playfield_latch & 0xff00);
+ m_atarivc_playfield_tilemap->write(space, offset, data, mem_mask);
+ if (m_atarivc_playfield_latch != -1)
+ m_atarivc_playfield_tilemap->write_ext(space, offset, UINT16(m_atarivc_playfield_latch), UINT16(0xff00));
}
@@ -1285,15 +1180,11 @@ WRITE16_MEMBER(atarigen_state::playfield_latched_msb_w)
// of the upper word.
//-------------------------------------------------
-WRITE16_MEMBER(atarigen_state::playfield2_latched_msb_w)
+WRITE16_MEMBER(atarigen_state::atarivc_playfield2_latched_msb_w)
{
- atarigen_state *state = space.machine().driver_data<atarigen_state>();
-
- COMBINE_DATA(&state->m_playfield2[offset]);
- state->m_playfield2_tilemap->mark_tile_dirty(offset);
-
- if (state->m_playfield2_latch != -1)
- state->m_playfield_upper[offset] = (state->m_playfield_upper[offset] & ~0xff00) | (state->m_playfield2_latch & 0xff00);
+ m_atarivc_playfield2_tilemap->write(space, offset, data, mem_mask);
+ if (m_atarivc_playfield2_latch != -1)
+ m_atarivc_playfield2_tilemap->write_ext(space, offset, UINT16(m_atarivc_playfield2_latch), UINT16(0xff00));
}
diff --git a/src/mame/machine/atarigen.h b/src/mame/machine/atarigen.h
index bb525817e1b..c68c7cbc0fb 100644
--- a/src/mame/machine/atarigen.h
+++ b/src/mame/machine/atarigen.h
@@ -251,20 +251,11 @@ public:
void atarivc_common_w(screen_device &screen, offs_t offset, UINT16 newword);
// playfield/alpha tilemap helpers
- DECLARE_WRITE16_MEMBER( alpha_w );
- DECLARE_WRITE32_MEMBER( alpha32_w );
- DECLARE_WRITE16_MEMBER( alpha2_w );
- void set_playfield_latch(int data);
- void set_playfield2_latch(int data);
- DECLARE_WRITE16_MEMBER( playfield_w );
- DECLARE_WRITE32_MEMBER( playfield32_w );
- DECLARE_WRITE16_MEMBER( playfield_large_w );
- DECLARE_WRITE16_MEMBER( playfield_upper_w );
- DECLARE_WRITE16_MEMBER( playfield_dual_upper_w );
- DECLARE_WRITE16_MEMBER( playfield_latched_lsb_w );
- DECLARE_WRITE16_MEMBER( playfield_latched_msb_w );
- DECLARE_WRITE16_MEMBER( playfield2_w );
- DECLARE_WRITE16_MEMBER( playfield2_latched_msb_w );
+ DECLARE_WRITE16_MEMBER( atarivc_playfield_upper_w );
+ DECLARE_WRITE16_MEMBER( atarivc_playfield_dual_upper_w );
+ DECLARE_WRITE16_MEMBER( atarivc_playfield_latched_lsb_w );
+ DECLARE_WRITE16_MEMBER( atarivc_playfield_latched_msb_w );
+ DECLARE_WRITE16_MEMBER( atarivc_playfield2_latched_msb_w );
// video helpers
int get_hblank(screen_device &screen) const { return (screen.hpos() > (screen.width() * 9 / 10)); }
@@ -308,25 +299,21 @@ public:
const UINT16 * m_eeprom_default;
- optional_shared_ptr<UINT16> m_playfield;
- optional_shared_ptr<UINT16> m_playfield2;
- optional_shared_ptr<UINT16> m_playfield_upper;
- optional_shared_ptr<UINT16> m_alpha;
- optional_shared_ptr<UINT16> m_alpha2;
optional_shared_ptr<UINT16> m_xscroll;
optional_shared_ptr<UINT16> m_yscroll;
- optional_shared_ptr<UINT32> m_playfield32;
- optional_shared_ptr<UINT32> m_alpha32;
+ optional_device<tilemap_device> m_atarivc_playfield_tilemap;
+ optional_device<tilemap_device> m_atarivc_playfield2_tilemap;
- tilemap_t * m_playfield_tilemap;
- tilemap_t * m_playfield2_tilemap;
- tilemap_t * m_alpha_tilemap;
- tilemap_t * m_alpha2_tilemap;
+ optional_shared_ptr<UINT16> m_atarivc_data;
+ optional_shared_ptr<UINT16> m_atarivc_eof_data;
+ atarivc_state_desc m_atarivc_state;
- optional_shared_ptr<UINT16> m_atarivc_data;
- optional_shared_ptr<UINT16> m_atarivc_eof_data;
- atarivc_state_desc m_atarivc_state;
+ UINT32 m_actual_vc_latch0;
+ UINT32 m_actual_vc_latch1;
+ UINT8 m_atarivc_playfields;
+ UINT32 m_atarivc_playfield_latch;
+ UINT32 m_atarivc_playfield2_latch;
/* internal state */
bool m_eeprom_unlocked;
@@ -342,12 +329,6 @@ public:
UINT32 m_scanlines_per_callback;
- UINT32 m_actual_vc_latch0;
- UINT32 m_actual_vc_latch1;
- UINT8 m_atarivc_playfields;
-
- UINT32 m_playfield_latch;
- UINT32 m_playfield2_latch;
atarigen_screen_timer m_screen_timer[2];
required_device<cpu_device> m_maincpu;
diff --git a/src/mame/video/atarig1.c b/src/mame/video/atarig1.c
index 28e76832214..dda5b6ec198 100644
--- a/src/mame/video/atarig1.c
+++ b/src/mame/video/atarig1.c
@@ -18,7 +18,7 @@
TILE_GET_INFO_MEMBER(atarig1_state::get_alpha_tile_info)
{
- UINT16 data = m_alpha[tile_index];
+ UINT16 data = tilemap.basemem_read(tile_index);
int code = data & 0xfff;
int color = (data >> 12) & 0x0f;
int opaque = data & 0x8000;
@@ -28,7 +28,7 @@ TILE_GET_INFO_MEMBER(atarig1_state::get_alpha_tile_info)
TILE_GET_INFO_MEMBER(atarig1_state::get_playfield_tile_info)
{
- UINT16 data = m_playfield[tile_index];
+ UINT16 data = tilemap.basemem_read(tile_index);
int code = (m_playfield_tile_bank << 12) | (data & 0xfff);
int color = (data >> 12) & 7;
SET_TILE_INFO_MEMBER(0, code, color, (data >> 15) & 1);
@@ -47,16 +47,9 @@ VIDEO_START_MEMBER(atarig1_state,atarig1)
/* blend the playfields and free the temporary one */
blend_gfx(0, 2, 0x0f, 0x10);
- /* initialize the playfield */
- m_playfield_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(atarig1_state::get_playfield_tile_info),this), TILEMAP_SCAN_ROWS, 8,8, 64,64);
-
/* initialize the motion objects */
m_rle = machine().device("rle");
- /* initialize the alphanumerics */
- m_alpha_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(atarig1_state::get_alpha_tile_info),this), TILEMAP_SCAN_ROWS, 8,8, 64,32);
- m_alpha_tilemap->set_transparent_pen(0);
-
/* reset statics */
m_pfscroll_xoffset = m_is_pitfight ? 2 : 0;
@@ -77,13 +70,13 @@ VIDEO_START_MEMBER(atarig1_state,atarig1)
void atarig1_state::scanline_update(screen_device &screen, int scanline)
{
- UINT16 *base = &m_alpha[(scanline / 8) * 64 + 48];
int i;
//if (scanline == 0) logerror("-------\n");
/* keep in range */
- if (base >= &m_alpha[0x800])
+ int offset = (scanline / 8) * 64 + 48;
+ if (offset >= 0x800)
return;
screen.update_partial(MAX(scanline - 1, 0));
@@ -93,7 +86,7 @@ void atarig1_state::scanline_update(screen_device &screen, int scanline)
UINT16 word;
/* first word controls horizontal scroll */
- word = *base++;
+ word = m_alpha_tilemap->basemem_read(offset++);
if (word & 0x8000)
{
int newscroll = ((word >> 6) + m_pfscroll_xoffset) & 0x1ff;
@@ -106,7 +99,7 @@ void atarig1_state::scanline_update(screen_device &screen, int scanline)
}
/* second word controls vertical scroll and tile bank */
- word = *base++;
+ word = m_alpha_tilemap->basemem_read(offset++);
if (word & 0x8000)
{
int newscroll = ((word >> 6) - (scanline + i)) & 0x1ff;
diff --git a/src/mame/video/atarig42.c b/src/mame/video/atarig42.c
index c0cafbfb71d..8ba4ba20f36 100644
--- a/src/mame/video/atarig42.c
+++ b/src/mame/video/atarig42.c
@@ -33,7 +33,7 @@
TILE_GET_INFO_MEMBER(atarig42_state::get_alpha_tile_info)
{
- UINT16 data = m_alpha[tile_index];
+ UINT16 data = tilemap.basemem_read(tile_index);
int code = data & 0xfff;
int color = (data >> 12) & 0x0f;
int opaque = data & 0x8000;
@@ -43,7 +43,7 @@ TILE_GET_INFO_MEMBER(atarig42_state::get_alpha_tile_info)
TILE_GET_INFO_MEMBER(atarig42_state::get_playfield_tile_info)
{
- UINT16 data = m_playfield[tile_index];
+ UINT16 data = tilemap.basemem_read(tile_index);
int code = (m_playfield_tile_bank << 12) | (data & 0xfff);
int color = (m_playfield_base >> 5) + ((m_playfield_color_bank << 3) & 0x18) + ((data >> 12) & 7);
SET_TILE_INFO_MEMBER(0, code, color, (data >> 15) & 1);
@@ -70,16 +70,9 @@ VIDEO_START_MEMBER(atarig42_state,atarig42)
/* blend the playfields and free the temporary one */
blend_gfx(0, 2, 0x0f, 0x30);
- /* initialize the playfield */
- m_playfield_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(atarig42_state::get_playfield_tile_info),this), tilemap_mapper_delegate(FUNC(atarig42_state::atarig42_playfield_scan),this), 8,8, 128,64);
-
/* initialize the motion objects */
m_rle = machine().device("rle");
- /* initialize the alphanumerics */
- m_alpha_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(atarig42_state::get_alpha_tile_info),this), TILEMAP_SCAN_ROWS, 8,8, 64,32);
- m_alpha_tilemap->set_transparent_pen(0);
-
/* save states */
save_item(NAME(m_current_control));
save_item(NAME(m_playfield_tile_bank));
@@ -98,13 +91,13 @@ VIDEO_START_MEMBER(atarig42_state,atarig42)
void atarig42_state::scanline_update(screen_device &screen, int scanline)
{
- UINT16 *base = &m_alpha[(scanline / 8) * 64 + 48];
int i;
if (scanline == 0) logerror("-------\n");
/* keep in range */
- if (base >= &m_alpha[0x800])
+ int offset = (scanline / 8) * 64 + 48;
+ if (offset >= 0x800)
return;
/* update the playfield scrolls */
@@ -112,7 +105,7 @@ void atarig42_state::scanline_update(screen_device &screen, int scanline)
{
UINT16 word;
- word = *base++;
+ word = m_alpha_tilemap->basemem_read(offset++);
if (word & 0x8000)
{
int newscroll = (word >> 5) & 0x3ff;
@@ -133,7 +126,7 @@ void atarig42_state::scanline_update(screen_device &screen, int scanline)
}
}
- word = *base++;
+ word = m_alpha_tilemap->basemem_read(offset++);
if (word & 0x8000)
{
int newscroll = ((word >> 6) - (scanline + i)) & 0x1ff;
diff --git a/src/mame/video/atarigt.c b/src/mame/video/atarigt.c
index b2044cab083..703655019be 100644
--- a/src/mame/video/atarigt.c
+++ b/src/mame/video/atarigt.c
@@ -44,7 +44,7 @@
TILE_GET_INFO_MEMBER(atarigt_state::get_alpha_tile_info)
{
- UINT16 data = m_alpha32[tile_index / 2] >> (16 * (~tile_index & 1));
+ UINT16 data = tilemap.basemem_read(tile_index);
int code = data & 0xfff;
int color = (data >> 12) & 0x0f;
SET_TILE_INFO_MEMBER(1, code, color, 0);
@@ -53,7 +53,7 @@ TILE_GET_INFO_MEMBER(atarigt_state::get_alpha_tile_info)
TILE_GET_INFO_MEMBER(atarigt_state::get_playfield_tile_info)
{
- UINT16 data = m_playfield32[tile_index / 2] >> (16 * (~tile_index & 1));
+ UINT16 data = tilemap.basemem_read(tile_index);
int code = (m_playfield_tile_bank << 12) | (data & 0xfff);
int color = (data >> 12) & 7;
SET_TILE_INFO_MEMBER(0, code, color, (data >> 15) & 1);
@@ -82,15 +82,9 @@ VIDEO_START_MEMBER(atarigt_state,atarigt)
/* blend the playfields and free the temporary one */
blend_gfx(0, 2, 0x0f, 0x30);
- /* initialize the playfield */
- m_playfield_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(atarigt_state::get_playfield_tile_info),this), tilemap_mapper_delegate(FUNC(atarigt_state::atarigt_playfield_scan),this), 8,8, 128,64);
-
/* initialize the motion objects */
m_rle = machine().device("rle");
- /* initialize the alphanumerics */
- m_alpha_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(atarigt_state::get_alpha_tile_info),this), TILEMAP_SCAN_ROWS, 8,8, 64,32);
-
/* allocate temp bitmaps */
width = machine().primary_screen->width();
height = machine().primary_screen->height();
@@ -164,22 +158,22 @@ UINT16 atarigt_state::atarigt_colorram_r(offs_t address)
void atarigt_state::scanline_update(screen_device &screen, int scanline)
{
- UINT32 *base = &m_alpha32[(scanline / 8) * 32 + 24];
int i;
/* keep in range */
- if (base >= &m_alpha32[0x400])
+ int offset = (scanline / 8) * 64 + 48;
+ if (offset >= 0x800)
return;
/* update the playfield scrolls */
for (i = 0; i < 8; i++)
{
- UINT32 word = *base++;
+ UINT16 word = m_alpha_tilemap->basemem_read(offset++);
- if (word & 0x80000000)
+ if (word & 0x8000)
{
- int newscroll = (word >> 21) & 0x3ff;
- int newbank = (word >> 16) & 0x1f;
+ int newscroll = (word >> 5) & 0x3ff;
+ int newbank = (word >> 0) & 0x1f;
if (newscroll != m_playfield_xscroll)
{
if (scanline + i > 0)
@@ -196,7 +190,8 @@ void atarigt_state::scanline_update(screen_device &screen, int scanline)
}
}
- if (word & 0x00008000)
+ word = m_alpha_tilemap->basemem_read(offset++);
+ if (word & 0x8000)
{
int newscroll = ((word >> 6) - (scanline + i)) & 0x1ff;
int newbank = word & 15;
diff --git a/src/mame/video/atarigx2.c b/src/mame/video/atarigx2.c
index 48f47992678..890dd56d22d 100644
--- a/src/mame/video/atarigx2.c
+++ b/src/mame/video/atarigx2.c
@@ -33,7 +33,7 @@
TILE_GET_INFO_MEMBER(atarigx2_state::get_alpha_tile_info)
{
- UINT16 data = m_alpha32[tile_index / 2] >> (16 * (~tile_index & 1));
+ UINT16 data = tilemap.basemem_read(tile_index);
int code = data & 0xfff;
int color = (data >> 12) & 0x0f;
int opaque = data & 0x8000;
@@ -43,7 +43,7 @@ TILE_GET_INFO_MEMBER(atarigx2_state::get_alpha_tile_info)
TILE_GET_INFO_MEMBER(atarigx2_state::get_playfield_tile_info)
{
- UINT16 data = m_playfield32[tile_index / 2] >> (16 * (~tile_index & 1));
+ UINT16 data = tilemap.basemem_read(tile_index);
int code = (m_playfield_tile_bank << 12) | (data & 0xfff);
int color = (m_playfield_base >> 5) + ((m_playfield_color_bank << 3) & 0x18) + ((data >> 12) & 7);
SET_TILE_INFO_MEMBER(0, code, color, (data >> 15) & 1);
@@ -70,16 +70,9 @@ VIDEO_START_MEMBER(atarigx2_state,atarigx2)
/* blend the playfields and free the temporary one */
blend_gfx(0, 2, 0x0f, 0x30);
- /* initialize the playfield */
- m_playfield_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(atarigx2_state::get_playfield_tile_info),this), tilemap_mapper_delegate(FUNC(atarigx2_state::atarigx2_playfield_scan),this), 8,8, 128,64);
-
/* initialize the motion objects */
m_rle = machine().device("rle");
- /* initialize the alphanumerics */
- m_alpha_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(atarigx2_state::get_alpha_tile_info),this), TILEMAP_SCAN_ROWS, 8,8, 64,32);
- m_alpha_tilemap->set_transparent_pen(0);
-
/* save states */
save_item(NAME(m_current_control));
save_item(NAME(m_playfield_tile_bank));
@@ -107,24 +100,24 @@ WRITE16_MEMBER( atarigx2_state::atarigx2_mo_control_w )
void atarigx2_state::scanline_update(screen_device &screen, int scanline)
{
- UINT32 *base = &m_alpha32[(scanline / 8) * 32 + 24];
int i;
if (scanline == 0) logerror("-------\n");
/* keep in range */
- if (base >= &m_alpha32[0x400])
+ int offset = (scanline / 8) * 64 + 48;
+ if (offset >= 0x800)
return;
/* update the playfield scrolls */
for (i = 0; i < 8; i++)
{
- UINT32 word = *base++;
+ UINT16 word = m_alpha_tilemap->basemem_read(offset++);
- if (word & 0x80000000)
+ if (word & 0x8000)
{
- int newscroll = (word >> 21) & 0x3ff;
- int newbank = (word >> 16) & 0x1f;
+ int newscroll = (word >> 5) & 0x3ff;
+ int newbank = (word >> 0) & 0x1f;
if (newscroll != m_playfield_xscroll)
{
if (scanline + i > 0)
@@ -141,7 +134,8 @@ void atarigx2_state::scanline_update(screen_device &screen, int scanline)
}
}
- if (word & 0x00008000)
+ word = m_alpha_tilemap->basemem_read(offset++);
+ if (word & 0x8000)
{
int newscroll = ((word >> 6) - (scanline + i)) & 0x1ff;
int newbank = word & 15;
diff --git a/src/mame/video/atarisy1.c b/src/mame/video/atarisy1.c
index dd4d28b2bc0..652d827183b 100644
--- a/src/mame/video/atarisy1.c
+++ b/src/mame/video/atarisy1.c
@@ -80,7 +80,7 @@ static const gfx_layout objlayout_6bpp =
TILE_GET_INFO_MEMBER(atarisy1_state::get_alpha_tile_info)
{
- UINT16 data = m_alpha[tile_index];
+ UINT16 data = tilemap.basemem_read(tile_index);
int code = data & 0x3ff;
int color = (data >> 10) & 0x07;
int opaque = data & 0x2000;
@@ -90,7 +90,7 @@ TILE_GET_INFO_MEMBER(atarisy1_state::get_alpha_tile_info)
TILE_GET_INFO_MEMBER(atarisy1_state::get_playfield_tile_info)
{
- UINT16 data = m_playfield[tile_index];
+ UINT16 data = tilemap.basemem_read(tile_index);
UINT16 lookup = m_playfield_lookup[((data >> 8) & 0x7f) | (m_playfield_tile_bank << 7)];
int gfxindex = (lookup >> 8) & 15;
int code = ((lookup & 0xff) << 8) | (data & 0xff);
@@ -153,16 +153,9 @@ VIDEO_START_MEMBER(atarisy1_state,atarisy1)
/* first decode the graphics */
decode_gfx(m_playfield_lookup, motable);
- /* initialize the playfield */
- m_playfield_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(atarisy1_state::get_playfield_tile_info),this), TILEMAP_SCAN_ROWS, 8,8, 64,64);
-
/* initialize the motion objects */
atarimo_init(machine(), 0, &modesc);
- /* initialize the alphanumerics */
- m_alpha_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(atarisy1_state::get_alpha_tile_info),this), TILEMAP_SCAN_ROWS, 8,8, 64,32);
- m_alpha_tilemap->set_transparent_pen(0);
-
/* modify the motion object code lookup */
codelookup = atarimo_get_code_lookup(0, &size);
for (i = 0; i < size; i++)
diff --git a/src/mame/video/atarisy2.c b/src/mame/video/atarisy2.c
index 81b1b6c95c7..889adc34001 100644
--- a/src/mame/video/atarisy2.c
+++ b/src/mame/video/atarisy2.c
@@ -19,7 +19,7 @@
TILE_GET_INFO_MEMBER(atarisy2_state::get_alpha_tile_info)
{
- UINT16 data = m_alpha[tile_index];
+ UINT16 data = tilemap.basemem_read(tile_index);
int code = data & 0x3ff;
int color = (data >> 13) & 0x07;
SET_TILE_INFO_MEMBER(2, code, color, 0);
@@ -28,7 +28,7 @@ TILE_GET_INFO_MEMBER(atarisy2_state::get_alpha_tile_info)
TILE_GET_INFO_MEMBER(atarisy2_state::get_playfield_tile_info)
{
- UINT16 data = m_playfield[tile_index];
+ UINT16 data = tilemap.basemem_read(tile_index);
int code = m_playfield_tile_bank[(data >> 10) & 1] + (data & 0x3ff);
int color = (data >> 11) & 7;
SET_TILE_INFO_MEMBER(0, code, color, 0);
@@ -83,19 +83,12 @@ VIDEO_START_MEMBER(atarisy2_state,atarisy2)
};
/* initialize banked memory */
- m_alpha.set_target(&m_vram[0x0000], 0x2000);
- m_playfield.set_target(&m_vram[0x2000], 0x2000);
-
- /* initialize the playfield */
- m_playfield_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(atarisy2_state::get_playfield_tile_info),this), TILEMAP_SCAN_ROWS, 8,8, 128,64);
+ m_alpha_tilemap->basemem().set(&m_vram[0x0000], 0x2000, 16, ENDIANNESS_NATIVE, 2);
+ m_playfield_tilemap->basemem().set(&m_vram[0x2000], 0x2000, 16, ENDIANNESS_NATIVE, 2);
/* initialize the motion objects */
atarimo_init(machine(), 0, &modesc);
- /* initialize the alphanumerics */
- m_alpha_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(atarisy2_state::get_alpha_tile_info),this), TILEMAP_SCAN_ROWS, 8,8, 64,48);
- m_alpha_tilemap->set_transparent_pen(0);
-
/* reset the statics */
m_yscroll_reset_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(atarisy2_state::reset_yscroll_callback),this));
m_videobank = 0;
@@ -260,10 +253,7 @@ WRITE16_MEMBER( atarisy2_state::videoram_w )
/* alpharam? */
if (offs < 0x0c00)
- {
- COMBINE_DATA(&m_alpha[offs]);
- m_alpha_tilemap->mark_tile_dirty(offs);
- }
+ m_alpha_tilemap->write(space, offs, data, mem_mask);
/* spriteram? */
else if (offs < 0x1000)
@@ -276,11 +266,7 @@ WRITE16_MEMBER( atarisy2_state::videoram_w )
/* playfieldram? */
else if (offs >= 0x2000)
- {
- offs -= 0x2000;
- COMBINE_DATA(&m_playfield[offs]);
- m_playfield_tilemap->mark_tile_dirty(offs);
- }
+ m_playfield_tilemap->write(space, offs - 0x2000, data, mem_mask);
/* generic case */
else
diff --git a/src/mame/video/badlands.c b/src/mame/video/badlands.c
index b380fac61b1..820e14946bd 100644
--- a/src/mame/video/badlands.c
+++ b/src/mame/video/badlands.c
@@ -18,7 +18,7 @@
TILE_GET_INFO_MEMBER(badlands_state::get_playfield_tile_info)
{
- UINT16 data = m_playfield[tile_index];
+ UINT16 data = tilemap.basemem_read(tile_index);
int code = (data & 0x1fff) + ((data & 0x1000) ? (m_playfield_tile_bank << 12) : 0);
int color = (data >> 13) & 0x07;
SET_TILE_INFO_MEMBER(0, code, color, 0);
@@ -71,9 +71,6 @@ VIDEO_START_MEMBER(badlands_state,badlands)
0 /* callback routine for special entries */
};
- /* initialize the playfield */
- m_playfield_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(badlands_state::get_playfield_tile_info),this), TILEMAP_SCAN_ROWS, 8,8, 64,32);
-
/* initialize the motion objects */
atarimo_init(machine(), 0, &modesc);
diff --git a/src/mame/video/batman.c b/src/mame/video/batman.c
index dcf2e0967b7..14c98ee219e 100644
--- a/src/mame/video/batman.c
+++ b/src/mame/video/batman.c
@@ -18,7 +18,7 @@
TILE_GET_INFO_MEMBER(batman_state::get_alpha_tile_info)
{
- UINT16 data = m_alpha[tile_index];
+ UINT16 data = tilemap.basemem_read(tile_index);
int code = ((data & 0x400) ? (m_alpha_tile_bank * 0x400) : 0) + (data & 0x3ff);
int color = (data >> 11) & 0x0f;
int opaque = data & 0x8000;
@@ -28,8 +28,8 @@ TILE_GET_INFO_MEMBER(batman_state::get_alpha_tile_info)
TILE_GET_INFO_MEMBER(batman_state::get_playfield_tile_info)
{
- UINT16 data1 = m_playfield[tile_index];
- UINT16 data2 = m_playfield_upper[tile_index] & 0xff;
+ UINT16 data1 = tilemap.basemem_read(tile_index);
+ UINT16 data2 = tilemap.extmem_read(tile_index) & 0xff;
int code = data1 & 0x7fff;
int color = 0x10 + (data2 & 0x0f);
SET_TILE_INFO_MEMBER(0, code, color, (data1 >> 15) & 1);
@@ -39,8 +39,8 @@ TILE_GET_INFO_MEMBER(batman_state::get_playfield_tile_info)
TILE_GET_INFO_MEMBER(batman_state::get_playfield2_tile_info)
{
- UINT16 data1 = m_playfield2[tile_index];
- UINT16 data2 = m_playfield_upper[tile_index] >> 8;
+ UINT16 data1 = tilemap.basemem_read(tile_index);
+ UINT16 data2 = tilemap.extmem_read(tile_index) >> 8;
int code = data1 & 0x7fff;
int color = data2 & 0x0f;
SET_TILE_INFO_MEMBER(0, code, color, (data1 >> 15) & 1);
@@ -94,19 +94,8 @@ VIDEO_START_MEMBER(batman_state,batman)
NULL /* callback routine for special entries */
};
- /* initialize the playfield */
- m_playfield_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(batman_state::get_playfield_tile_info),this), TILEMAP_SCAN_COLS, 8,8, 64,64);
-
- /* initialize the second playfield */
- m_playfield2_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(batman_state::get_playfield2_tile_info),this), TILEMAP_SCAN_COLS, 8,8, 64,64);
- m_playfield2_tilemap->set_transparent_pen(0);
-
/* initialize the motion objects */
atarimo_init(machine(), 0, &modesc);
-
- /* initialize the alphanumerics */
- m_alpha_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(batman_state::get_alpha_tile_info),this), TILEMAP_SCAN_ROWS, 8,8, 64,32);
- m_alpha_tilemap->set_transparent_pen(0);
}
@@ -122,13 +111,13 @@ void batman_state::scanline_update(screen_device &screen, int scanline)
/* update the scanline parameters */
if (scanline <= screen.visible_area().max_y && m_atarivc_state.rowscroll_enable)
{
- UINT16 *base = &m_alpha[scanline / 8 * 64 + 48];
+ int offset = scanline / 8 * 64 + 48;
int scan, i;
for (scan = 0; scan < 8; scan++, scanline++)
for (i = 0; i < 2; i++)
{
- int data = *base++;
+ int data = m_alpha_tilemap->basemem_read(offset++);
switch (data & 15)
{
case 9:
@@ -143,8 +132,8 @@ void batman_state::scanline_update(screen_device &screen, int scanline)
screen.update_partial(scanline - 1);
m_atarivc_state.pf1_xscroll_raw = (data >> 7) & 0x1ff;
atarivc_update_pf_xscrolls();
- m_playfield_tilemap->set_scrollx(0, m_atarivc_state.pf0_xscroll);
- m_playfield2_tilemap->set_scrollx(0, m_atarivc_state.pf1_xscroll);
+ m_atarivc_playfield_tilemap->set_scrollx(0, m_atarivc_state.pf0_xscroll);
+ m_atarivc_playfield2_tilemap->set_scrollx(0, m_atarivc_state.pf1_xscroll);
break;
case 11:
@@ -152,7 +141,7 @@ void batman_state::scanline_update(screen_device &screen, int scanline)
screen.update_partial(scanline - 1);
m_atarivc_state.pf0_xscroll_raw = (data >> 7) & 0x1ff;
atarivc_update_pf_xscrolls();
- m_playfield_tilemap->set_scrollx(0, m_atarivc_state.pf0_xscroll);
+ m_atarivc_playfield_tilemap->set_scrollx(0, m_atarivc_state.pf0_xscroll);
break;
case 13:
@@ -166,14 +155,14 @@ void batman_state::scanline_update(screen_device &screen, int scanline)
if (scanline > 0)
screen.update_partial(scanline - 1);
m_atarivc_state.pf1_yscroll = (data >> 7) & 0x1ff;
- m_playfield2_tilemap->set_scrolly(0, m_atarivc_state.pf1_yscroll);
+ m_atarivc_playfield2_tilemap->set_scrolly(0, m_atarivc_state.pf1_yscroll);
break;
case 15:
if (scanline > 0)
screen.update_partial(scanline - 1);
m_atarivc_state.pf0_yscroll = (data >> 7) & 0x1ff;
- m_playfield_tilemap->set_scrolly(0, m_atarivc_state.pf0_yscroll);
+ m_atarivc_playfield_tilemap->set_scrolly(0, m_atarivc_state.pf0_yscroll);
break;
}
}
@@ -197,14 +186,14 @@ UINT32 batman_state::screen_update_batman(screen_device &screen, bitmap_ind16 &b
/* draw the playfield */
priority_bitmap.fill(0, cliprect);
- m_playfield_tilemap->draw(bitmap, cliprect, 0, 0x00);
- m_playfield_tilemap->draw(bitmap, cliprect, 1, 0x01);
- m_playfield_tilemap->draw(bitmap, cliprect, 2, 0x02);
- m_playfield_tilemap->draw(bitmap, cliprect, 3, 0x03);
- m_playfield2_tilemap->draw(bitmap, cliprect, 0, 0x80);
- m_playfield2_tilemap->draw(bitmap, cliprect, 1, 0x84);
- m_playfield2_tilemap->draw(bitmap, cliprect, 2, 0x88);
- m_playfield2_tilemap->draw(bitmap, cliprect, 3, 0x8c);
+ m_atarivc_playfield_tilemap->draw(bitmap, cliprect, 0, 0x00);
+ m_atarivc_playfield_tilemap->draw(bitmap, cliprect, 1, 0x01);
+ m_atarivc_playfield_tilemap->draw(bitmap, cliprect, 2, 0x02);
+ m_atarivc_playfield_tilemap->draw(bitmap, cliprect, 3, 0x03);
+ m_atarivc_playfield2_tilemap->draw(bitmap, cliprect, 0, 0x80);
+ m_atarivc_playfield2_tilemap->draw(bitmap, cliprect, 1, 0x84);
+ m_atarivc_playfield2_tilemap->draw(bitmap, cliprect, 2, 0x88);
+ m_atarivc_playfield2_tilemap->draw(bitmap, cliprect, 3, 0x8c);
/* draw and merge the MO */
mobitmap = atarimo_render(0, cliprect, &rectlist);
diff --git a/src/mame/video/blstroid.c b/src/mame/video/blstroid.c
index 3ea22f2ba1b..2b8ca1fb715 100644
--- a/src/mame/video/blstroid.c
+++ b/src/mame/video/blstroid.c
@@ -19,7 +19,7 @@
TILE_GET_INFO_MEMBER(blstroid_state::get_playfield_tile_info)
{
- UINT16 data = m_playfield[tile_index];
+ UINT16 data = tilemap.basemem_read(tile_index);
int code = data & 0x1fff;
int color = (data >> 13) & 0x07;
SET_TILE_INFO_MEMBER(0, code, color, 0);
@@ -72,9 +72,6 @@ VIDEO_START_MEMBER(blstroid_state,blstroid)
0 /* callback routine for special entries */
};
- /* initialize the playfield */
- m_playfield_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(blstroid_state::get_playfield_tile_info),this), TILEMAP_SCAN_ROWS, 16,8, 64,64);
-
/* initialize the motion objects */
atarimo_init(machine(), 0, &modesc);
}
@@ -93,18 +90,18 @@ void blstroid_state::device_timer(emu_timer &timer, device_timer_id id, int para
switch (id)
{
- case TIMER_IRQ_OFF:
- /* clear the interrupt */
- scanline_int_ack_w(space, 0, 0);
- break;
- case TIMER_IRQ_ON:
- /* generate the interrupt */
- scanline_int_gen(m_maincpu);
- update_interrupts();
- break;
- default:
- atarigen_state::device_timer(timer, id, param, ptr);
- break;
+ case TIMER_IRQ_OFF:
+ /* clear the interrupt */
+ scanline_int_ack_w(space, 0, 0);
+ break;
+ case TIMER_IRQ_ON:
+ /* generate the interrupt */
+ scanline_int_gen(m_maincpu);
+ update_interrupts();
+ break;
+ default:
+ atarigen_state::device_timer(timer, id, param, ptr);
+ break;
}
}
@@ -115,12 +112,8 @@ void blstroid_state::scanline_update(screen_device &screen, int scanline)
/* check for interrupts */
if (offset < 0x1000)
- if (m_playfield[offset] & 0x8000)
+ if (m_playfield_tilemap->basemem_read(offset) & 0x8000)
{
- int width, vpos;
- attotime period_on;
- attotime period_off;
-
/* FIXME: - the only thing this IRQ does it tweak the starting MO link */
/* unfortunately, it does it too early for the given MOs! */
/* perhaps it is not actually hooked up on the real PCB... */
@@ -128,10 +121,10 @@ void blstroid_state::scanline_update(screen_device &screen, int scanline)
/* set a timer to turn the interrupt on at HBLANK of the 7th scanline */
/* and another to turn it off one scanline later */
- width = screen.width();
- vpos = screen.vpos();
- period_on = screen.time_until_pos(vpos + 7, width * 0.9);
- period_off = screen.time_until_pos(vpos + 8, width * 0.9);
+ int width = screen.width();
+ int vpos = screen.vpos();
+ attotime period_on = screen.time_until_pos(vpos + 7, width * 0.9);
+ attotime period_off = screen.time_until_pos(vpos + 8, width * 0.9);
timer_set(period_on, TIMER_IRQ_ON);
timer_set(period_off, TIMER_IRQ_OFF);
diff --git a/src/mame/video/cave.c b/src/mame/video/cave.c
index 9a688317a52..0ac8bf3fb37 100644
--- a/src/mame/video/cave.c
+++ b/src/mame/video/cave.c
@@ -217,11 +217,10 @@ static void set_pens( running_machine &machine )
***************************************************************************/
-INLINE void get_tile_info( running_machine &machine, tile_data &tileinfo, int tile_index, int GFX )
+inline void cave_state::get_tile_info( tile_data &tileinfo, int tile_index, int GFX )
{
- cave_state *state = machine.driver_data<cave_state>();
- UINT16 *VRAM = state->m_vram[GFX];
- int TDIM = state->m_tiledim[GFX];
+ UINT16 *VRAM = m_vram[GFX];
+ int TDIM = m_tiledim[GFX];
UINT32 code, color, pri, tile;
if (TDIM)
@@ -245,7 +244,7 @@ INLINE void get_tile_info( running_machine &machine, tile_data &tileinfo, int ti
code = (code & 0x00ffffff);
}
- SET_TILE_INFO( GFX, code, color, 0 );
+ SET_TILE_INFO_MEMBER( GFX, code, color, 0 );
tileinfo.category = pri;
}
@@ -338,10 +337,10 @@ INLINE void vram_8x8_w( address_space &space, ATTR_UNUSED offs_t offset, ATTR_UN
}
-TILE_GET_INFO_MEMBER(cave_state::get_tile_info_0){ get_tile_info(machine(), tileinfo, tile_index, 0); }
-TILE_GET_INFO_MEMBER(cave_state::get_tile_info_1){ get_tile_info(machine(), tileinfo, tile_index, 1); }
-TILE_GET_INFO_MEMBER(cave_state::get_tile_info_2){ get_tile_info(machine(), tileinfo, tile_index, 2); }
-TILE_GET_INFO_MEMBER(cave_state::get_tile_info_3){ get_tile_info(machine(), tileinfo, tile_index, 3); }
+TILE_GET_INFO_MEMBER(cave_state::get_tile_info_0){ get_tile_info(tileinfo, tile_index, 0); }
+TILE_GET_INFO_MEMBER(cave_state::get_tile_info_1){ get_tile_info(tileinfo, tile_index, 1); }
+TILE_GET_INFO_MEMBER(cave_state::get_tile_info_2){ get_tile_info(tileinfo, tile_index, 2); }
+TILE_GET_INFO_MEMBER(cave_state::get_tile_info_3){ get_tile_info(tileinfo, tile_index, 3); }
WRITE16_MEMBER(cave_state::cave_vram_0_w){ vram_w(space, offset, data, mem_mask, 0); }
WRITE16_MEMBER(cave_state::cave_vram_1_w){ vram_w(space, offset, data, mem_mask, 1); }
diff --git a/src/mame/video/cischeat.c b/src/mame/video/cischeat.c
index 9e5d19cc25a..040b24427e2 100644
--- a/src/mame/video/cischeat.c
+++ b/src/mame/video/cischeat.c
@@ -168,14 +168,14 @@ TILEMAP_MAPPER_MEMBER(cischeat_state::cischeat_scan_16x16)
TILE_GET_INFO_MEMBER(cischeat_state::cischeat_get_scroll_tile_info_8x8)
{
- int tmap = (FPTR)param;
+ int tmap = (FPTR)tilemap.user_data();
UINT16 code = m_scrollram[tmap][tile_index];
SET_TILE_INFO_MEMBER(tmap, (code & 0xfff), code >> (16 - m_bits_per_color_code), 0);
}
TILE_GET_INFO_MEMBER(cischeat_state::cischeat_get_scroll_tile_info_16x16)
{
- int tmap = (FPTR)param;
+ int tmap = (FPTR)tilemap.user_data();
UINT16 code = m_scrollram[tmap][tile_index/4];
SET_TILE_INFO_MEMBER(tmap, (code & 0xfff) * 4 + (tile_index & 3), code >> (16 - m_bits_per_color_code), 0);
}
diff --git a/src/mame/video/cyberbal.c b/src/mame/video/cyberbal.c
index e9f407e70e3..ca0f7a98f4b 100644
--- a/src/mame/video/cyberbal.c
+++ b/src/mame/video/cyberbal.c
@@ -22,40 +22,22 @@
TILE_GET_INFO_MEMBER(cyberbal_state::get_alpha_tile_info)
{
- UINT16 data = m_alpha[tile_index];
+ UINT16 data = tilemap.basemem_read(tile_index);
int code = data & 0xfff;
int color = (data >> 12) & 0x07;
SET_TILE_INFO_MEMBER(2, code, color, (data >> 15) & 1);
}
-TILE_GET_INFO_MEMBER(cyberbal_state::get_alpha2_tile_info)
-{
- UINT16 data = m_alpha2[tile_index];
- int code = data & 0xfff;
- int color = (data >> 12) & 0x07;
- SET_TILE_INFO_MEMBER(2, code, 0x80 | color, (data >> 15) & 1);
-}
-
-
TILE_GET_INFO_MEMBER(cyberbal_state::get_playfield_tile_info)
{
- UINT16 data = m_playfield[tile_index];
+ UINT16 data = tilemap.basemem_read(tile_index);
int code = data & 0x1fff;
int color = (data >> 11) & 0x0f;
SET_TILE_INFO_MEMBER(0, code, color, (data >> 15) & 1);
}
-TILE_GET_INFO_MEMBER(cyberbal_state::get_playfield2_tile_info)
-{
- UINT16 data = m_playfield2[tile_index];
- int code = data & 0x1fff;
- int color = (data >> 11) & 0x0f;
- SET_TILE_INFO_MEMBER(0, code, 0x80 | color, (data >> 15) & 1);
-}
-
-
/*************************************
*
@@ -65,7 +47,7 @@ TILE_GET_INFO_MEMBER(cyberbal_state::get_playfield2_tile_info)
void cyberbal_state::video_start_common(int screens)
{
- static const atarimo_desc mo0desc =
+ static const atarimo_desc modesc =
{
1, /* index to which gfx system */
1, /* number of motion object banks */
@@ -102,69 +84,22 @@ void cyberbal_state::video_start_common(int screens)
0 /* callback routine for special entries */
};
- static const atarimo_desc mo1desc =
- {
- 1, /* index to which gfx system */
- 1, /* number of motion object banks */
- 1, /* are the entries linked? */
- 0, /* are the entries split? */
- 0, /* render in reverse order? */
- 0, /* render in swapped X/Y order? */
- 1, /* does the neighbor bit affect the next object? */
- 1024, /* pixels per SLIP entry (0 for no-slip) */
- 0, /* pixel offset for SLIPs */
- 0, /* maximum number of links to visit/scanline (0=all) */
-
- 0xe00, /* base palette entry */
- 0x100, /* maximum number of colors */
- 0, /* transparent pen index */
-
- {{ 0,0,0x07f8,0 }}, /* mask for the link */
- {{ 0 }}, /* mask for the graphics bank */
- {{ 0x7fff,0,0,0 }}, /* mask for the code index */
- {{ 0 }}, /* mask for the upper code index */
- {{ 0,0,0,0x000f }}, /* mask for the color */
- {{ 0,0,0,0xffc0 }}, /* mask for the X position */
- {{ 0,0xff80,0,0 }}, /* mask for the Y position */
- {{ 0 }}, /* mask for the width, in tiles*/
- {{ 0,0x000f,0,0 }}, /* mask for the height, in tiles */
- {{ 0x8000,0,0,0 }}, /* mask for the horizontal flip */
- {{ 0 }}, /* mask for the vertical flip */
- {{ 0 }}, /* mask for the priority */
- {{ 0,0,0,0x0010 }}, /* mask for the neighbor */
- {{ 0 }}, /* mask for absolute coordinates */
-
- {{ 0 }}, /* mask for the special value */
- 0, /* resulting value to indicate "special" */
- 0 /* callback routine for special entries */
- };
-
- /* initialize the playfield */
- m_playfield_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(cyberbal_state::get_playfield_tile_info),this), TILEMAP_SCAN_ROWS, 16,8, 64,64);
-
/* initialize the motion objects */
- atarimo_init(machine(), 0, &mo0desc);
+ atarimo_init(machine(), 0, &modesc);
atarimo_set_slipram(0, &m_current_slip[0]);
- /* initialize the alphanumerics */
- m_alpha_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(cyberbal_state::get_alpha_tile_info),this), TILEMAP_SCAN_ROWS, 16,8, 64,32);
- m_alpha_tilemap->set_transparent_pen(0);
-
/* allocate the second screen if necessary */
if (screens == 2)
{
- /* initialize the playfield */
- m_playfield2_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(cyberbal_state::get_playfield2_tile_info),this), TILEMAP_SCAN_ROWS, 16,8, 64,64);
+ /* initialize the tilemaps */
m_playfield2_tilemap->set_scrollx(0, 0);
+ m_playfield2_tilemap->set_palette_offset(0x800);
+ m_alpha2_tilemap->set_scrollx(0, 0);
+ m_alpha2_tilemap->set_palette_offset(0x800);
/* initialize the motion objects */
- atarimo_init(machine(), 1, &mo1desc);
+ atarimo_init(machine(), 1, &modesc);
atarimo_set_slipram(1, &m_current_slip[1]);
-
- /* initialize the alphanumerics */
- m_alpha2_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(cyberbal_state::get_alpha2_tile_info),this), TILEMAP_SCAN_ROWS, 16,8, 64,32);
- m_alpha2_tilemap->set_scrollx(0, 0);
- m_alpha2_tilemap->set_transparent_pen(0);
}
/* save states */
@@ -260,56 +195,61 @@ void cyberbal_state::scanline_update(screen_device &screen, int scanline)
screen_device_iterator iter(*this);
for (i = 0, update_screen = iter.first(); update_screen != NULL; i++, update_screen = iter.next())
{
- UINT16 *vram = i ? m_alpha2 : m_alpha;
- UINT16 *base = &vram[((scanline - 8) / 8) * 64 + 47];
+ tilemap_t &curplayfield = i ? static_cast<tilemap_t &>(m_playfield2_tilemap) : static_cast<tilemap_t &>(m_playfield_tilemap);
+ tilemap_t &curalpha = i ? static_cast<tilemap_t &>(m_alpha2_tilemap) : static_cast<tilemap_t &>(m_alpha_tilemap);
/* keep in range */
- if (base < vram)
- base += 0x800;
- else if (base >= &vram[0x800])
+ int offset = ((scanline - 8) / 8) * 64 + 47;
+ if (offset < 0)
+ offset += 0x800;
+ else if (offset >= 0x800)
return;
/* update the current parameters */
- if (!(base[3] & 1))
+ UINT16 word = curalpha.device()->basemem_read(offset + 3);
+ if (!(word & 1))
{
- if (((base[3] >> 1) & 7) != m_playfield_palette_bank[i])
+ if (((word >> 1) & 7) != m_playfield_palette_bank[i])
{
if (scanline > 0)
update_screen->update_partial(scanline - 1);
- m_playfield_palette_bank[i] = (base[3] >> 1) & 7;
- (i ? m_playfield2_tilemap : m_playfield_tilemap)->set_palette_offset(m_playfield_palette_bank[i] << 8);
+ m_playfield_palette_bank[i] = (word >> 1) & 7;
+ curplayfield.set_palette_offset(i * 0x800 + (m_playfield_palette_bank[i] << 8));
}
}
- if (!(base[4] & 1))
+ word = curalpha.device()->basemem_read(offset + 4);
+ if (!(word & 1))
{
- int newscroll = 2 * (((base[4] >> 7) + 4) & 0x1ff);
+ int newscroll = 2 * (((word >> 7) + 4) & 0x1ff);
if (newscroll != m_playfield_xscroll[i])
{
if (scanline > 0)
update_screen->update_partial(scanline - 1);
- (i ? m_playfield2_tilemap : m_playfield_tilemap)->set_scrollx(0, newscroll);
+ curplayfield.set_scrollx(0, newscroll);
m_playfield_xscroll[i] = newscroll;
}
}
- if (!(base[5] & 1))
+ word = curalpha.device()->basemem_read(offset + 5);
+ if (!(word & 1))
{
/* a new vscroll latches the offset into a counter; we must adjust for this */
- int newscroll = ((base[5] >> 7) - (scanline)) & 0x1ff;
+ int newscroll = ((word >> 7) - (scanline)) & 0x1ff;
if (newscroll != m_playfield_yscroll[i])
{
if (scanline > 0)
update_screen->update_partial(scanline - 1);
- (i ? m_playfield2_tilemap : m_playfield_tilemap)->set_scrolly(0, newscroll);
+ curplayfield.set_scrolly(0, newscroll);
m_playfield_yscroll[i] = newscroll;
}
}
- if (!(base[7] & 1))
+ word = curalpha.device()->basemem_read(offset + 7);
+ if (!(word & 1))
{
- if (m_current_slip[i] != base[7])
+ if (m_current_slip[i] != word)
{
if (scanline > 0)
update_screen->update_partial(scanline - 1);
- m_current_slip[i] = base[7];
+ m_current_slip[i] = word;
}
}
}
@@ -332,7 +272,8 @@ UINT32 cyberbal_state::update_one_screen(screen_device &screen, bitmap_ind16 &bi
rectangle visarea = screen.visible_area();
/* draw the playfield */
- ((index == 0) ? m_playfield_tilemap : m_playfield2_tilemap)->draw(bitmap, cliprect, 0, 0);
+ tilemap_t &curplayfield = index ? static_cast<tilemap_t &>(m_playfield2_tilemap) : static_cast<tilemap_t &>(m_playfield_tilemap);
+ curplayfield.draw(bitmap, cliprect, 0, 0);
/* draw the MOs -- note some kludging to get this to work correctly for 2 screens */
mooffset = 0;
@@ -347,6 +288,7 @@ UINT32 cyberbal_state::update_one_screen(screen_device &screen, bitmap_ind16 &bi
visarea.max_x = temp;
/* draw and merge the MO */
+ int palbase = index * 0x800;
for (r = 0; r < rectlist.numrects; r++, rectlist.rect++)
for (y = rectlist.rect->min_y; y <= rectlist.rect->max_y; y++)
{
@@ -357,7 +299,7 @@ UINT32 cyberbal_state::update_one_screen(screen_device &screen, bitmap_ind16 &bi
{
/* not verified: logic is all controlled in a PAL
*/
- pf[x] = mo[x];
+ pf[x] = palbase + mo[x];
/* erase behind ourselves */
mo[x] = 0;
@@ -365,7 +307,8 @@ UINT32 cyberbal_state::update_one_screen(screen_device &screen, bitmap_ind16 &bi
}
/* add the alpha on top */
- ((index == 0) ? m_alpha_tilemap : m_alpha2_tilemap)->draw(bitmap, cliprect, 0, 0);
+ tilemap_t &curalpha = index ? static_cast<tilemap_t &>(m_alpha2_tilemap) : static_cast<tilemap_t &>(m_alpha_tilemap);
+ curalpha.draw(bitmap, cliprect, 0, 0);
return 0;
}
diff --git a/src/mame/video/dooyong.c b/src/mame/video/dooyong.c
index 44d48774e84..3657c2e80e2 100644
--- a/src/mame/video/dooyong.c
+++ b/src/mame/video/dooyong.c
@@ -203,7 +203,7 @@ WRITE16_MEMBER(dooyong_state::rshark_ctrl_w)
when the x scroll moves out of range (trying to decode the whole lot
at once uses hundreds of megabytes of RAM). */
-INLINE void lastday_get_tile_info(running_machine &machine, tile_data &tileinfo, int tile_index,
+inline void dooyong_state::lastday_get_tile_info(tile_data &tileinfo, int tile_index,
const UINT8 *tilerom, UINT8 *scroll, int graphics)
{
int offs = (tile_index + ((int)scroll[1] << 6)) * 2;
@@ -238,10 +238,10 @@ INLINE void lastday_get_tile_info(running_machine &machine, tile_data &tileinfo,
flags = ((attr & 0x40) ? TILE_FLIPX : 0) | ((attr & 0x80) ? TILE_FLIPY : 0);
}
- SET_TILE_INFO(graphics, code, color, flags);
+ SET_TILE_INFO_MEMBER(graphics, code, color, flags);
}
-INLINE void rshark_get_tile_info(running_machine &machine, tile_data &tileinfo, int tile_index,
+inline void dooyong_state::rshark_get_tile_info(tile_data &tileinfo, int tile_index,
const UINT8 *tilerom1, const UINT8 *tilerom2, UINT8 *scroll, int graphics)
{
/* Tiles take two bytes in tile ROM 1:
@@ -258,39 +258,39 @@ INLINE void rshark_get_tile_info(running_machine &machine, tile_data &tileinfo,
int color = tilerom2[offs] & 0x0f;
int flags = ((attr & 0x40) ? TILE_FLIPX : 0) | ((attr & 0x80) ? TILE_FLIPY : 0);
- SET_TILE_INFO(graphics, code, color, flags);
+ SET_TILE_INFO_MEMBER(graphics, code, color, flags);
}
TILE_GET_INFO_MEMBER(dooyong_state::get_bg_tile_info)
{
if (m_bg_tilerom2 != NULL)
- rshark_get_tile_info(machine(), tileinfo, tile_index, m_bg_tilerom, m_bg_tilerom2, m_bgscroll8, m_bg_gfx);
+ rshark_get_tile_info(tileinfo, tile_index, m_bg_tilerom, m_bg_tilerom2, m_bgscroll8, m_bg_gfx);
else
- lastday_get_tile_info(machine(), tileinfo, tile_index, m_bg_tilerom, m_bgscroll8, m_bg_gfx);
+ lastday_get_tile_info(tileinfo, tile_index, m_bg_tilerom, m_bgscroll8, m_bg_gfx);
}
TILE_GET_INFO_MEMBER(dooyong_state::get_bg2_tile_info)
{
if (m_bg2_tilerom2 != NULL)
- rshark_get_tile_info(machine(), tileinfo, tile_index, m_bg2_tilerom, m_bg2_tilerom2, m_bg2scroll8, m_bg2_gfx);
+ rshark_get_tile_info(tileinfo, tile_index, m_bg2_tilerom, m_bg2_tilerom2, m_bg2scroll8, m_bg2_gfx);
else
- lastday_get_tile_info(machine(), tileinfo, tile_index, m_bg2_tilerom, m_bg2scroll8, m_bg2_gfx);
+ lastday_get_tile_info(tileinfo, tile_index, m_bg2_tilerom, m_bg2scroll8, m_bg2_gfx);
}
TILE_GET_INFO_MEMBER(dooyong_state::get_fg_tile_info)
{
if (m_fg_tilerom2 != NULL)
- rshark_get_tile_info(machine(), tileinfo, tile_index, m_fg_tilerom, m_fg_tilerom2, m_fgscroll8, m_fg_gfx);
+ rshark_get_tile_info(tileinfo, tile_index, m_fg_tilerom, m_fg_tilerom2, m_fgscroll8, m_fg_gfx);
else
- lastday_get_tile_info(machine(), tileinfo, tile_index, m_fg_tilerom, m_fgscroll8, m_fg_gfx);
+ lastday_get_tile_info(tileinfo, tile_index, m_fg_tilerom, m_fgscroll8, m_fg_gfx);
}
TILE_GET_INFO_MEMBER(dooyong_state::get_fg2_tile_info)
{
if (m_fg2_tilerom2 != NULL)
- rshark_get_tile_info(machine(), tileinfo, tile_index, m_fg2_tilerom, m_fg2_tilerom2, m_fg2scroll8, m_fg2_gfx);
+ rshark_get_tile_info(tileinfo, tile_index, m_fg2_tilerom, m_fg2_tilerom2, m_fg2scroll8, m_fg2_gfx);
else
- lastday_get_tile_info(machine(), tileinfo, tile_index, m_fg2_tilerom, m_fg2scroll8, m_fg2_gfx);
+ lastday_get_tile_info(tileinfo, tile_index, m_fg2_tilerom, m_fg2scroll8, m_fg2_gfx);
}
/* flytiger uses some palette banking technique or something maybe a trash protection */
diff --git a/src/mame/video/eprom.c b/src/mame/video/eprom.c
index b65696f5767..c248df669e4 100644
--- a/src/mame/video/eprom.c
+++ b/src/mame/video/eprom.c
@@ -52,7 +52,7 @@ void eprom_state::update_palette()
TILE_GET_INFO_MEMBER(eprom_state::get_alpha_tile_info)
{
- UINT16 data = m_alpha[tile_index];
+ UINT16 data = tilemap.basemem_read(tile_index);
int code = data & 0x3ff;
int color = ((data >> 10) & 0x0f) | ((data >> 9) & 0x20);
int opaque = data & 0x8000;
@@ -62,8 +62,8 @@ TILE_GET_INFO_MEMBER(eprom_state::get_alpha_tile_info)
TILE_GET_INFO_MEMBER(eprom_state::get_playfield_tile_info)
{
- UINT16 data1 = m_playfield[tile_index];
- UINT16 data2 = m_playfield_upper[tile_index] >> 8;
+ UINT16 data1 = tilemap.basemem_read(tile_index);
+ UINT16 data2 = tilemap.extmem_read(tile_index) >> 8;
int code = data1 & 0x7fff;
int color = 0x10 + (data2 & 0x0f);
SET_TILE_INFO_MEMBER(0, code, color, (data1 >> 15) & 1);
@@ -72,8 +72,8 @@ TILE_GET_INFO_MEMBER(eprom_state::get_playfield_tile_info)
TILE_GET_INFO_MEMBER(eprom_state::guts_get_playfield_tile_info)
{
- UINT16 data1 = m_playfield[tile_index];
- UINT16 data2 = m_playfield_upper[tile_index] >> 8;
+ UINT16 data1 = tilemap.basemem_read(tile_index);
+ UINT16 data2 = tilemap.extmem_read(tile_index) >> 8;
int code = data1 & 0x7fff;
int color = 0x10 + (data2 & 0x0f);
SET_TILE_INFO_MEMBER(2, code, color, (data1 >> 15) & 1);
@@ -126,16 +126,9 @@ VIDEO_START_MEMBER(eprom_state,eprom)
0 /* callback routine for special entries */
};
- /* initialize the playfield */
- m_playfield_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(eprom_state::get_playfield_tile_info),this), TILEMAP_SCAN_COLS, 8,8, 64,64);
-
/* initialize the motion objects */
atarimo_init(machine(), 0, &modesc);
- /* initialize the alphanumerics */
- m_alpha_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(eprom_state::get_alpha_tile_info),this), TILEMAP_SCAN_ROWS, 8,8, 64,32);
- m_alpha_tilemap->set_transparent_pen(0);
-
/* save states */
save_item(NAME(m_screen_intensity));
save_item(NAME(m_video_disable));
@@ -181,16 +174,9 @@ VIDEO_START_MEMBER(eprom_state,guts)
0 /* callback routine for special entries */
};
- /* initialize the playfield */
- m_playfield_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(eprom_state::guts_get_playfield_tile_info),this), TILEMAP_SCAN_COLS, 8,8, 64,64);
-
/* initialize the motion objects */
atarimo_init(machine(), 0, &modesc);
- /* initialize the alphanumerics */
- m_alpha_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(eprom_state::get_alpha_tile_info),this), TILEMAP_SCAN_ROWS, 8,8, 64,32);
- m_alpha_tilemap->set_transparent_pen(0);
-
/* save states */
save_item(NAME(m_screen_intensity));
save_item(NAME(m_video_disable));
@@ -209,8 +195,8 @@ void eprom_state::scanline_update(screen_device &screen, int scanline)
/* update the playfield */
if (scanline == 0)
{
- int xscroll = (m_alpha[0x780] >> 7) & 0x1ff;
- int yscroll = (m_alpha[0x781] >> 7) & 0x1ff;
+ int xscroll = (m_alpha_tilemap->basemem_read(0x780) >> 7) & 0x1ff;
+ int yscroll = (m_alpha_tilemap->basemem_read(0x781) >> 7) & 0x1ff;
m_playfield_tilemap->set_scrollx(0, xscroll);
m_playfield_tilemap->set_scrolly(0, yscroll);
atarimo_set_xscroll(0, xscroll);
diff --git a/src/mame/video/foodf.c b/src/mame/video/foodf.c
index 41db9b8ba51..c6ead90b019 100644
--- a/src/mame/video/foodf.c
+++ b/src/mame/video/foodf.c
@@ -17,7 +17,7 @@
TILE_GET_INFO_MEMBER(foodf_state::get_playfield_tile_info)
{
- UINT16 data = m_playfield[tile_index];
+ UINT16 data = tilemap.basemem_read(tile_index);
int code = (data & 0xff) | ((data >> 7) & 0x100);
int color = (data >> 8) & 0x3f;
SET_TILE_INFO_MEMBER(0, code, color, m_playfield_flip ? (TILE_FLIPX | TILE_FLIPY) : 0);
@@ -35,10 +35,6 @@ VIDEO_START_MEMBER(foodf_state,foodf)
{
static const int resistances[3] = { 1000, 470, 220 };
- /* initialize the playfield */
- m_playfield_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(foodf_state::get_playfield_tile_info),this), TILEMAP_SCAN_COLS, 8,8, 32,32);
- m_playfield_tilemap->set_transparent_pen(0);
-
/* adjust the playfield for the 8 pixel offset */
m_playfield_tilemap->set_scrollx(0, -8);
save_item(NAME(m_playfield_flip));
diff --git a/src/mame/video/gauntlet.c b/src/mame/video/gauntlet.c
index 51db082c611..1edfdc00c7c 100644
--- a/src/mame/video/gauntlet.c
+++ b/src/mame/video/gauntlet.c
@@ -19,7 +19,7 @@
TILE_GET_INFO_MEMBER(gauntlet_state::get_alpha_tile_info)
{
- UINT16 data = m_alpha[tile_index];
+ UINT16 data = tilemap.basemem_read(tile_index);
int code = data & 0x3ff;
int color = ((data >> 10) & 0x0f) | ((data >> 9) & 0x20);
int opaque = data & 0x8000;
@@ -29,7 +29,7 @@ TILE_GET_INFO_MEMBER(gauntlet_state::get_alpha_tile_info)
TILE_GET_INFO_MEMBER(gauntlet_state::get_playfield_tile_info)
{
- UINT16 data = m_playfield[tile_index];
+ UINT16 data = tilemap.basemem_read(tile_index);
int code = ((m_playfield_tile_bank * 0x1000) + (data & 0xfff)) ^ 0x800;
int color = 0x10 + (m_playfield_color_bank * 8) + ((data >> 12) & 7);
SET_TILE_INFO_MEMBER(0, code, color, (data >> 15) & 1);
@@ -85,16 +85,9 @@ VIDEO_START_MEMBER(gauntlet_state,gauntlet)
UINT16 *codelookup;
int i, size;
- /* initialize the playfield */
- m_playfield_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(gauntlet_state::get_playfield_tile_info),this), TILEMAP_SCAN_COLS, 8,8, 64,64);
-
/* initialize the motion objects */
atarimo_init(machine(), 0, &modesc);
- /* initialize the alphanumerics */
- m_alpha_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(gauntlet_state::get_alpha_tile_info),this), TILEMAP_SCAN_ROWS, 8,8, 64,32);
- m_alpha_tilemap->set_transparent_pen(0);
-
/* modify the motion object code lookup table to account for the code XOR */
codelookup = atarimo_get_code_lookup(0, &size);
for (i = 0; i < size; i++)
diff --git a/src/mame/video/klax.c b/src/mame/video/klax.c
index 4fcde8988e9..8f4a4d2e733 100644
--- a/src/mame/video/klax.c
+++ b/src/mame/video/klax.c
@@ -18,8 +18,8 @@
TILE_GET_INFO_MEMBER(klax_state::get_playfield_tile_info)
{
- UINT16 data1 = m_playfield[tile_index];
- UINT16 data2 = m_playfield_upper[tile_index] >> 8;
+ UINT16 data1 = tilemap.basemem_read(tile_index);
+ UINT16 data2 = tilemap.extmem_read(tile_index) >> 8;
int code = data1 & 0x1fff;
int color = data2 & 0x0f;
SET_TILE_INFO_MEMBER(0, code, color, (data1 >> 15) & 1);
@@ -72,9 +72,6 @@ VIDEO_START_MEMBER(klax_state,klax)
0 /* callback routine for special entries */
};
- /* initialize the playfield */
- m_playfield_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(klax_state::get_playfield_tile_info),this), TILEMAP_SCAN_COLS, 8,8, 64,32);
-
/* initialize the motion objects */
atarimo_init(machine(), 0, &modesc);
}
diff --git a/src/mame/video/m107.c b/src/mame/video/m107.c
index 7cd0d676065..0626663b832 100644
--- a/src/mame/video/m107.c
+++ b/src/mame/video/m107.c
@@ -44,7 +44,7 @@
TILE_GET_INFO_MEMBER(m107_state::get_pf_tile_info)
{
- pf_layer_info *layer = (pf_layer_info *)param;
+ pf_layer_info *layer = (pf_layer_info *)tilemap.user_data();
int tile, attrib;
tile_index = 2 * tile_index + layer->vram_base;
diff --git a/src/mame/video/m92.c b/src/mame/video/m92.c
index d6880deb196..eddf4ff02a6 100644
--- a/src/mame/video/m92.c
+++ b/src/mame/video/m92.c
@@ -145,7 +145,7 @@ WRITE16_MEMBER(m92_state::m92_paletteram_w)
TILE_GET_INFO_MEMBER(m92_state::get_pf_tile_info)
{
- pf_layer_info *layer = (pf_layer_info *)param;
+ pf_layer_info *layer = (pf_layer_info *)tilemap.user_data();
int tile, attrib;
tile_index = 2 * tile_index + layer->vram_base;
diff --git a/src/mame/video/megasys1.c b/src/mame/video/megasys1.c
index 705c7abee60..709c3f5d9e6 100644
--- a/src/mame/video/megasys1.c
+++ b/src/mame/video/megasys1.c
@@ -346,14 +346,14 @@ TILEMAP_MAPPER_MEMBER(megasys1_state::megasys1_scan_16x16)
TILE_GET_INFO_MEMBER(megasys1_state::megasys1_get_scroll_tile_info_8x8)
{
- int tmap = (FPTR)param;
+ int tmap = (FPTR)tilemap.user_data();
UINT16 code = m_scrollram[tmap][tile_index];
SET_TILE_INFO_MEMBER(tmap, (code & 0xfff) * m_8x8_scroll_factor[tmap], code >> (16 - m_bits_per_color_code), 0);
}
TILE_GET_INFO_MEMBER(megasys1_state::megasys1_get_scroll_tile_info_16x16)
{
- int tmap = (FPTR)param;
+ int tmap = (FPTR)tilemap.user_data();
UINT16 code = m_scrollram[tmap][tile_index/4];
SET_TILE_INFO_MEMBER(tmap, (code & 0xfff) * m_16x16_scroll_factor[tmap] + (tile_index & 3), code >> (16 - m_bits_per_color_code), 0);
}
diff --git a/src/mame/video/namcona1.c b/src/mame/video/namcona1.c
index ed166874bcb..7bba245091b 100644
--- a/src/mame/video/namcona1.c
+++ b/src/mame/video/namcona1.c
@@ -10,15 +10,13 @@ TODO:
#include "includes/namcona1.h"
-static void tilemap_get_info(
- running_machine &machine,
+void namcona1_state::tilemap_get_info(
tile_data &tileinfo,
int tile_index,
const UINT16 *tilemap_videoram,
int tilemap_color,
- int use_4bpp_gfx )
+ bool use_4bpp_gfx )
{
- namcona1_state *state = machine.driver_data<namcona1_state>();
UINT16 *source;
int data = tilemap_videoram[tile_index];
@@ -38,17 +36,17 @@ static void tilemap_get_info(
if( data & 0x8000 )
{
- SET_TILE_INFO( gfx,tile,tilemap_color,TILE_FORCE_LAYER0 );
+ SET_TILE_INFO_MEMBER( gfx,tile,tilemap_color,TILE_FORCE_LAYER0 );
}
else
{
- SET_TILE_INFO( gfx,tile,tilemap_color,0 );
+ SET_TILE_INFO_MEMBER( gfx,tile,tilemap_color,0 );
if (ENDIANNESS_NATIVE == ENDIANNESS_BIG)
- tileinfo.mask_data = (UINT8 *)(state->m_shaperam+4*tile);
+ tileinfo.mask_data = (UINT8 *)(m_shaperam+4*tile);
else
{
- UINT8 *mask_data = state->m_mask_data;
- source = state->m_shaperam+4*tile;
+ UINT8 *mask_data = m_mask_data;
+ source = m_shaperam+4*tile;
mask_data[0] = source[0]>>8;
mask_data[1] = source[0]&0xff;
mask_data[2] = source[1]>>8;
@@ -65,25 +63,25 @@ static void tilemap_get_info(
TILE_GET_INFO_MEMBER(namcona1_state::tilemap_get_info0)
{
UINT16 *videoram = m_videoram;
- tilemap_get_info(machine(),tileinfo,tile_index,0*0x1000+videoram,m_tilemap_palette_bank[0],m_vreg[0xbc/2]&1);
+ tilemap_get_info(tileinfo,tile_index,0*0x1000+videoram,m_tilemap_palette_bank[0],m_vreg[0xbc/2]&1);
}
TILE_GET_INFO_MEMBER(namcona1_state::tilemap_get_info1)
{
UINT16 *videoram = m_videoram;
- tilemap_get_info(machine(),tileinfo,tile_index,1*0x1000+videoram,m_tilemap_palette_bank[1],m_vreg[0xbc/2]&2);
+ tilemap_get_info(tileinfo,tile_index,1*0x1000+videoram,m_tilemap_palette_bank[1],m_vreg[0xbc/2]&2);
}
TILE_GET_INFO_MEMBER(namcona1_state::tilemap_get_info2)
{
UINT16 *videoram = m_videoram;
- tilemap_get_info(machine(),tileinfo,tile_index,2*0x1000+videoram,m_tilemap_palette_bank[2],m_vreg[0xbc/2]&4);
+ tilemap_get_info(tileinfo,tile_index,2*0x1000+videoram,m_tilemap_palette_bank[2],m_vreg[0xbc/2]&4);
}
TILE_GET_INFO_MEMBER(namcona1_state::tilemap_get_info3)
{
UINT16 *videoram = m_videoram;
- tilemap_get_info(machine(),tileinfo,tile_index,3*0x1000+videoram,m_tilemap_palette_bank[3],m_vreg[0xbc/2]&8);
+ tilemap_get_info(tileinfo,tile_index,3*0x1000+videoram,m_tilemap_palette_bank[3],m_vreg[0xbc/2]&8);
}
TILE_GET_INFO_MEMBER(namcona1_state::roz_get_info)
diff --git a/src/mame/video/namcos1.c b/src/mame/video/namcos1.c
index 4510621aa84..f3876c6e3eb 100644
--- a/src/mame/video/namcos1.c
+++ b/src/mame/video/namcos1.c
@@ -50,56 +50,54 @@ Namco System 1 Video Hardware
***************************************************************************/
-INLINE void bg_get_info(running_machine &machine,tile_data &tileinfo,int tile_index,UINT8 *info_vram)
+inline void namcos1_state::bg_get_info(tile_data &tileinfo,int tile_index,UINT8 *info_vram)
{
- namcos1_state *state = machine.driver_data<namcos1_state>();
int code;
tile_index <<= 1;
code = info_vram[tile_index + 1] + ((info_vram[tile_index] & 0x3f) << 8);
- SET_TILE_INFO(0,code,0,0);
- tileinfo.mask_data = &state->m_tilemap_maskdata[code << 3];
+ SET_TILE_INFO_MEMBER(0,code,0,0);
+ tileinfo.mask_data = &m_tilemap_maskdata[code << 3];
}
-INLINE void fg_get_info(running_machine &machine,tile_data &tileinfo,int tile_index,UINT8 *info_vram)
+inline void namcos1_state::fg_get_info(tile_data &tileinfo,int tile_index,UINT8 *info_vram)
{
- namcos1_state *state = machine.driver_data<namcos1_state>();
int code;
tile_index <<= 1;
code = info_vram[tile_index + 1] + ((info_vram[tile_index] & 0x3f) << 8);
- SET_TILE_INFO(0,code,0,0);
- tileinfo.mask_data = &state->m_tilemap_maskdata[code << 3];
+ SET_TILE_INFO_MEMBER(0,code,0,0);
+ tileinfo.mask_data = &m_tilemap_maskdata[code << 3];
}
TILE_GET_INFO_MEMBER(namcos1_state::bg_get_info0)
{
- bg_get_info(machine(),tileinfo,tile_index,&m_videoram[0x0000]);
+ bg_get_info(tileinfo,tile_index,&m_videoram[0x0000]);
}
TILE_GET_INFO_MEMBER(namcos1_state::bg_get_info1)
{
- bg_get_info(machine(),tileinfo,tile_index,&m_videoram[0x2000]);
+ bg_get_info(tileinfo,tile_index,&m_videoram[0x2000]);
}
TILE_GET_INFO_MEMBER(namcos1_state::bg_get_info2)
{
- bg_get_info(machine(),tileinfo,tile_index,&m_videoram[0x4000]);
+ bg_get_info(tileinfo,tile_index,&m_videoram[0x4000]);
}
TILE_GET_INFO_MEMBER(namcos1_state::bg_get_info3)
{
- bg_get_info(machine(),tileinfo,tile_index,&m_videoram[0x6000]);
+ bg_get_info(tileinfo,tile_index,&m_videoram[0x6000]);
}
TILE_GET_INFO_MEMBER(namcos1_state::fg_get_info4)
{
- fg_get_info(machine(),tileinfo,tile_index,&m_videoram[0x7010]);
+ fg_get_info(tileinfo,tile_index,&m_videoram[0x7010]);
}
TILE_GET_INFO_MEMBER(namcos1_state::fg_get_info5)
{
- fg_get_info(machine(),tileinfo,tile_index,&m_videoram[0x7810]);
+ fg_get_info(tileinfo,tile_index,&m_videoram[0x7810]);
}
diff --git a/src/mame/video/namcos86.c b/src/mame/video/namcos86.c
index 2772f38497e..c4589dce05d 100644
--- a/src/mame/video/namcos86.c
+++ b/src/mame/video/namcos86.c
@@ -87,17 +87,16 @@ void namcos86_state::palette_init()
***************************************************************************/
-INLINE void get_tile_info(running_machine &machine,tile_data &tileinfo,int tile_index,int layer,UINT8 *vram)
+inline void namcos86_state::get_tile_info(tile_data &tileinfo,int tile_index,int layer,UINT8 *vram)
{
- namcos86_state *state = machine.driver_data<namcos86_state>();
int attr = vram[2*tile_index + 1];
int tile_offs;
if (layer & 2)
- tile_offs = ((state->m_tile_address_prom[((layer & 1) << 4) + (attr & 0x03)] & 0xe0) >> 5) * 0x100;
+ tile_offs = ((m_tile_address_prom[((layer & 1) << 4) + (attr & 0x03)] & 0xe0) >> 5) * 0x100;
else
- tile_offs = ((state->m_tile_address_prom[((layer & 1) << 4) + ((attr & 0x03) << 2)] & 0x0e) >> 1) * 0x100 + state->m_tilebank * 0x800;
+ tile_offs = ((m_tile_address_prom[((layer & 1) << 4) + ((attr & 0x03) << 2)] & 0x0e) >> 1) * 0x100 + m_tilebank * 0x800;
- SET_TILE_INFO(
+ SET_TILE_INFO_MEMBER(
(layer & 2) ? 1 : 0,
vram[2*tile_index] + tile_offs,
attr,
@@ -106,22 +105,22 @@ INLINE void get_tile_info(running_machine &machine,tile_data &tileinfo,int tile_
TILE_GET_INFO_MEMBER(namcos86_state::get_tile_info0)
{
- get_tile_info(machine(),tileinfo,tile_index,0,&m_rthunder_videoram1[0x0000]);
+ get_tile_info(tileinfo,tile_index,0,&m_rthunder_videoram1[0x0000]);
}
TILE_GET_INFO_MEMBER(namcos86_state::get_tile_info1)
{
- get_tile_info(machine(),tileinfo,tile_index,1,&m_rthunder_videoram1[0x1000]);
+ get_tile_info(tileinfo,tile_index,1,&m_rthunder_videoram1[0x1000]);
}
TILE_GET_INFO_MEMBER(namcos86_state::get_tile_info2)
{
- get_tile_info(machine(),tileinfo,tile_index,2,&m_rthunder_videoram2[0x0000]);
+ get_tile_info(tileinfo,tile_index,2,&m_rthunder_videoram2[0x0000]);
}
TILE_GET_INFO_MEMBER(namcos86_state::get_tile_info3)
{
- get_tile_info(machine(),tileinfo,tile_index,3,&m_rthunder_videoram2[0x1000]);
+ get_tile_info(tileinfo,tile_index,3,&m_rthunder_videoram2[0x1000]);
}
diff --git a/src/mame/video/offtwall.c b/src/mame/video/offtwall.c
index 2dcf2fd8c27..274f7eecacc 100644
--- a/src/mame/video/offtwall.c
+++ b/src/mame/video/offtwall.c
@@ -18,8 +18,8 @@
TILE_GET_INFO_MEMBER(offtwall_state::get_playfield_tile_info)
{
- UINT16 data1 = m_playfield[tile_index];
- UINT16 data2 = m_playfield_upper[tile_index] >> 8;
+ UINT16 data1 = tilemap.basemem_read(tile_index);
+ UINT16 data2 = tilemap.extmem_read(tile_index) >> 8;
int code = data1 & 0x7fff;
int color = 0x10 + (data2 & 0x0f);
SET_TILE_INFO_MEMBER(0, code, color, (data1 >> 15) & 1);
@@ -72,9 +72,6 @@ VIDEO_START_MEMBER(offtwall_state,offtwall)
0 /* callback routine for special entries */
};
- /* initialize the playfield */
- m_playfield_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(offtwall_state::get_playfield_tile_info),this), TILEMAP_SCAN_COLS, 8,8, 64,64);
-
/* initialize the motion objects */
atarimo_init(machine(), 0, &modesc);
}
@@ -94,7 +91,7 @@ UINT32 offtwall_state::screen_update_offtwall(screen_device &screen, bitmap_ind1
int x, y, r;
/* draw the playfield */
- m_playfield_tilemap->draw(bitmap, cliprect, 0, 0);
+ m_atarivc_playfield_tilemap->draw(bitmap, cliprect, 0, 0);
/* draw and merge the MO */
mobitmap = atarimo_render(0, cliprect, &rectlist);
diff --git a/src/mame/video/relief.c b/src/mame/video/relief.c
index 1910ba56f64..1c7faff0652 100644
--- a/src/mame/video/relief.c
+++ b/src/mame/video/relief.c
@@ -19,8 +19,8 @@
TILE_GET_INFO_MEMBER(relief_state::get_playfield_tile_info)
{
- UINT16 data1 = m_playfield[tile_index];
- UINT16 data2 = m_playfield_upper[tile_index] & 0xff;
+ UINT16 data1 = tilemap.basemem_read(tile_index);
+ UINT16 data2 = tilemap.extmem_read(tile_index) & 0xff;
int code = data1 & 0x7fff;
int color = 0x20 + (data2 & 0x0f);
SET_TILE_INFO_MEMBER(0, code, color, (data1 >> 15) & 1);
@@ -29,8 +29,8 @@ TILE_GET_INFO_MEMBER(relief_state::get_playfield_tile_info)
TILE_GET_INFO_MEMBER(relief_state::get_playfield2_tile_info)
{
- UINT16 data1 = m_playfield2[tile_index];
- UINT16 data2 = m_playfield_upper[tile_index] >> 8;
+ UINT16 data1 = tilemap.basemem_read(tile_index);
+ UINT16 data2 = tilemap.extmem_read(tile_index) >> 8;
int code = data1 & 0x7fff;
int color = data2 & 0x0f;
SET_TILE_INFO_MEMBER(0, code, color, (data1 >> 15) & 1);
@@ -86,13 +86,6 @@ VIDEO_START_MEMBER(relief_state,relief)
/* MOs are 5bpp but with a 4-bit color granularity */
machine().gfx[1]->set_granularity(16);
- /* initialize the playfield */
- m_playfield_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(relief_state::get_playfield_tile_info),this), TILEMAP_SCAN_COLS, 8,8, 64,64);
-
- /* initialize the second playfield */
- m_playfield2_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(relief_state::get_playfield2_tile_info),this), TILEMAP_SCAN_COLS, 8,8, 64,64);
- m_playfield2_tilemap->set_transparent_pen(0);
-
/* initialize the motion objects */
atarimo_init(machine(), 0, &modesc);
}
@@ -114,8 +107,8 @@ UINT32 relief_state::screen_update_relief(screen_device &screen, bitmap_ind16 &b
/* draw the playfield */
priority_bitmap.fill(0, cliprect);
- m_playfield_tilemap->draw(bitmap, cliprect, 0, 0);
- m_playfield2_tilemap->draw(bitmap, cliprect, 0, 1);
+ m_atarivc_playfield_tilemap->draw(bitmap, cliprect, 0, 0);
+ m_atarivc_playfield2_tilemap->draw(bitmap, cliprect, 0, 1);
/* draw and merge the MO */
mobitmap = atarimo_render(0, cliprect, &rectlist);
diff --git a/src/mame/video/segaic16.c b/src/mame/video/segaic16.c
index 44c893633b8..d5d1ac4a7e1 100644
--- a/src/mame/video/segaic16.c
+++ b/src/mame/video/segaic16.c
@@ -630,7 +630,7 @@ void segaic16_draw_virtual_tilemap(running_machine &machine, struct tilemap_info
TILE_GET_INFO_MEMBER( segaic16_video_device::segaic16_tilemap_16a_tile_info )
{
- const struct tilemap_callback_info *info = (const struct tilemap_callback_info *)param;
+ const struct tilemap_callback_info *info = (const struct tilemap_callback_info *)tilemap.user_data();
UINT16 data = info->rambase[tile_index];
int code = ((data >> 1) & 0x1000) | (data & 0xfff);
int color = (data >> 5) & 0x7f;
@@ -642,7 +642,7 @@ TILE_GET_INFO_MEMBER( segaic16_video_device::segaic16_tilemap_16a_tile_info )
TILE_GET_INFO_MEMBER( segaic16_video_device::segaic16_tilemap_16a_text_info )
{
- const struct tilemap_callback_info *info = (const struct tilemap_callback_info *)param;
+ const struct tilemap_callback_info *info = (const struct tilemap_callback_info *)tilemap.user_data();
UINT16 data = info->rambase[tile_index];
int color = (data >> 8) & 0x07;
int code = data & 0xff;
@@ -842,7 +842,7 @@ void segaic16_tilemap_16a_draw_layer(running_machine &machine, struct tilemap_in
TILE_GET_INFO_MEMBER( segaic16_video_device::segaic16_tilemap_16b_tile_info )
{
- const struct tilemap_callback_info *info = (const struct tilemap_callback_info *)param;
+ const struct tilemap_callback_info *info = (const struct tilemap_callback_info *)tilemap.user_data();
UINT16 data = info->rambase[tile_index];
int color = (data >> 6) & 0x7f;
int code = data & 0x1fff;
@@ -856,7 +856,7 @@ TILE_GET_INFO_MEMBER( segaic16_video_device::segaic16_tilemap_16b_tile_info )
TILE_GET_INFO_MEMBER( segaic16_video_device::segaic16_tilemap_16b_text_info )
{
- const struct tilemap_callback_info *info = (const struct tilemap_callback_info *)param;
+ const struct tilemap_callback_info *info = (const struct tilemap_callback_info *)tilemap.user_data();
UINT16 data = info->rambase[tile_index];
int bank = info->bank[0];
int color = (data >> 9) & 0x07;
@@ -869,7 +869,7 @@ TILE_GET_INFO_MEMBER( segaic16_video_device::segaic16_tilemap_16b_text_info )
TILE_GET_INFO_MEMBER( segaic16_video_device::segaic16_tilemap_16b_alt_tile_info )
{
- const struct tilemap_callback_info *info = (const struct tilemap_callback_info *)param;
+ const struct tilemap_callback_info *info = (const struct tilemap_callback_info *)tilemap.user_data();
UINT16 data = info->rambase[tile_index];
int color = (data >> 5) & 0x7f;
int code = data & 0x1fff;
@@ -883,7 +883,7 @@ TILE_GET_INFO_MEMBER( segaic16_video_device::segaic16_tilemap_16b_alt_tile_info
TILE_GET_INFO_MEMBER( segaic16_video_device::segaic16_tilemap_16b_alt_text_info )
{
- const struct tilemap_callback_info *info = (const struct tilemap_callback_info *)param;
+ const struct tilemap_callback_info *info = (const struct tilemap_callback_info *)tilemap.user_data();
UINT16 data = info->rambase[tile_index];
int bank = info->bank[0];
int color = (data >> 8) & 0x07;
diff --git a/src/mame/video/segas32.c b/src/mame/video/segas32.c
index 377a0236083..94ae896b87b 100644
--- a/src/mame/video/segas32.c
+++ b/src/mame/video/segas32.c
@@ -715,7 +715,7 @@ tilemap_t *segas32_state::find_cache_entry(int page, int bank)
TILE_GET_INFO_MEMBER(segas32_state::get_tile_info)
{
- struct segas32_state::cache_entry *entry = (struct segas32_state::cache_entry *)param;
+ struct segas32_state::cache_entry *entry = (struct segas32_state::cache_entry *)tilemap.user_data();
UINT16 data = m_system32_videoram[(entry->page & 0x7f) * 0x200 + tile_index];
SET_TILE_INFO_MEMBER(0, (entry->bank << 13) + (data & 0x1fff), (data >> 4) & 0x1ff, (data >> 14) & 3);
}
diff --git a/src/mame/video/shuuz.c b/src/mame/video/shuuz.c
index eda1195e804..bc58c777344 100644
--- a/src/mame/video/shuuz.c
+++ b/src/mame/video/shuuz.c
@@ -18,8 +18,8 @@
TILE_GET_INFO_MEMBER(shuuz_state::get_playfield_tile_info)
{
- UINT16 data1 = m_playfield[tile_index];
- UINT16 data2 = m_playfield_upper[tile_index] >> 8;
+ UINT16 data1 = tilemap.basemem_read(tile_index);
+ UINT16 data2 = tilemap.extmem_read(tile_index) >> 8;
int code = data1 & 0x3fff;
int color = data2 & 0x0f;
SET_TILE_INFO_MEMBER(0, code, color, (data1 >> 15) & 1);
@@ -72,9 +72,6 @@ VIDEO_START_MEMBER(shuuz_state,shuuz)
0 /* callback routine for special entries */
};
- /* initialize the playfield */
- m_playfield_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(shuuz_state::get_playfield_tile_info),this), TILEMAP_SCAN_COLS, 8,8, 64,64);
-
/* initialize the motion objects */
atarimo_init(machine(), 0, &modesc);
}
@@ -94,7 +91,7 @@ UINT32 shuuz_state::screen_update_shuuz(screen_device &screen, bitmap_ind16 &bit
int x, y, r;
/* draw the playfield */
- m_playfield_tilemap->draw(bitmap, cliprect, 0, 0);
+ m_atarivc_playfield_tilemap->draw(bitmap, cliprect, 0, 0);
/* draw and merge the MO */
mobitmap = atarimo_render(0, cliprect, &rectlist);
diff --git a/src/mame/video/skullxbo.c b/src/mame/video/skullxbo.c
index 341d686a689..a4b021fc02f 100644
--- a/src/mame/video/skullxbo.c
+++ b/src/mame/video/skullxbo.c
@@ -18,7 +18,7 @@
TILE_GET_INFO_MEMBER(skullxbo_state::get_alpha_tile_info)
{
- UINT16 data = m_alpha[tile_index];
+ UINT16 data = tilemap.basemem_read(tile_index);
int code = (data ^ 0x400) & 0x7ff;
int color = (data >> 11) & 0x0f;
int opaque = data & 0x8000;
@@ -28,8 +28,8 @@ TILE_GET_INFO_MEMBER(skullxbo_state::get_alpha_tile_info)
TILE_GET_INFO_MEMBER(skullxbo_state::get_playfield_tile_info)
{
- UINT16 data1 = m_playfield[tile_index];
- UINT16 data2 = m_playfield_upper[tile_index] & 0xff;
+ UINT16 data1 = tilemap.basemem_read(tile_index);
+ UINT16 data2 = tilemap.extmem_read(tile_index) & 0xff;
int code = data1 & 0x7fff;
int color = data2 & 0x0f;
SET_TILE_INFO_MEMBER(1, code, color, (data1 >> 15) & 1);
@@ -82,15 +82,8 @@ VIDEO_START_MEMBER(skullxbo_state,skullxbo)
0, /* callback routine for special entries */
};
- /* initialize the playfield */
- m_playfield_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(skullxbo_state::get_playfield_tile_info),this), TILEMAP_SCAN_COLS, 16,8, 64,64);
-
/* initialize the motion objects */
atarimo_init(machine(), 0, &modesc);
-
- /* initialize the alphanumerics */
- m_alpha_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(skullxbo_state::get_alpha_tile_info),this), TILEMAP_SCAN_ROWS, 16,8, 64,32);
- m_alpha_tilemap->set_transparent_pen(0);
}
@@ -169,9 +162,20 @@ WRITE16_MEMBER( skullxbo_state::skullxbo_mobmsb_w )
*
*************************************/
-WRITE16_MEMBER( skullxbo_state::skullxbo_playfieldlatch_w )
+WRITE16_MEMBER( skullxbo_state::playfield_latch_w )
{
- set_playfield_latch(data);
+ m_playfield_latch = data;
+}
+
+WRITE16_MEMBER(skullxbo_state::playfield_latched_w)
+{
+ m_playfield_tilemap->write(space, offset, data, mem_mask);
+ if (m_playfield_latch != -1)
+ {
+ UINT16 oldval = m_playfield_tilemap->extmem_read(offset);
+ UINT16 newval = (oldval & ~0x00ff) | (m_playfield_latch & 0x00ff);
+ m_playfield_tilemap->extmem_write(offset, newval);
+ }
}
@@ -184,11 +188,11 @@ WRITE16_MEMBER( skullxbo_state::skullxbo_playfieldlatch_w )
void skullxbo_state::skullxbo_scanline_update(int scanline)
{
- UINT16 *base = &m_alpha[(scanline / 8) * 64 + 42];
int x;
/* keep in range */
- if (base >= &m_alpha[0x7c0])
+ int offset = (scanline / 8) * 64 + 42;
+ if (offset >= 0x7c0)
return;
/* special case: scanline 0 should re-latch the previous raw scroll */
@@ -202,7 +206,7 @@ void skullxbo_state::skullxbo_scanline_update(int scanline)
/* update the current parameters */
for (x = 42; x < 64; x++)
{
- UINT16 data = *base++;
+ UINT16 data = m_alpha_tilemap->basemem_read(offset++);
UINT16 command = data & 0x000f;
/* only command I've ever seen */
diff --git a/src/mame/video/system1.c b/src/mame/video/system1.c
index 6b235784301..1ae6f611981 100644
--- a/src/mame/video/system1.c
+++ b/src/mame/video/system1.c
@@ -98,7 +98,7 @@
TILE_GET_INFO_MEMBER(system1_state::tile_get_info)
{
- const UINT8 *rambase = (const UINT8 *)param;
+ const UINT8 *rambase = (const UINT8 *)tilemap.user_data();
UINT32 tiledata = rambase[tile_index*2+0] | (rambase[tile_index*2+1] << 8);
UINT32 code = ((tiledata >> 4) & 0x800) | (tiledata & 0x7ff);
UINT32 color = (tiledata >> 5) & 0xff;
diff --git a/src/mame/video/taito_f3.c b/src/mame/video/taito_f3.c
index bc4bd9c68f9..0a784905d1d 100644
--- a/src/mame/video/taito_f3.c
+++ b/src/mame/video/taito_f3.c
@@ -402,7 +402,7 @@ static void print_debug_info(running_machine &machine, bitmap_rgb32 &bitmap)
/******************************************************************************/
-INLINE void get_tile_info(running_machine &machine, tile_data &tileinfo, int tile_index, UINT16 *gfx_base)
+inline void taito_f3_state::get_tile_info(tile_data &tileinfo, int tile_index, UINT16 *gfx_base)
{
UINT32 tile=(gfx_base[tile_index*2+0]<<16)|(gfx_base[tile_index*2+1]&0xffff);
UINT8 abtype=(tile>>(16+9)) & 1;
@@ -411,7 +411,7 @@ INLINE void get_tile_info(running_machine &machine, tile_data &tileinfo, int til
// This fixes (at least) the rain in round 6 of Arabian Magic.
UINT8 extra_planes = ((tile>>(16+10)) & 3); // 0 = 4bpp, 1 = 5bpp, 2 = unused?, 3 = 6bpp
- SET_TILE_INFO(
+ SET_TILE_INFO_MEMBER(
1,
tile&0xffff,
(tile>>16) & 0x1ff & (~extra_planes),
@@ -422,42 +422,42 @@ INLINE void get_tile_info(running_machine &machine, tile_data &tileinfo, int til
TILE_GET_INFO_MEMBER(taito_f3_state::get_tile_info1)
{
- get_tile_info(machine(),tileinfo,tile_index,m_f3_pf_data_1);
+ get_tile_info(tileinfo,tile_index,m_f3_pf_data_1);
}
TILE_GET_INFO_MEMBER(taito_f3_state::get_tile_info2)
{
- get_tile_info(machine(),tileinfo,tile_index,m_f3_pf_data_2);
+ get_tile_info(tileinfo,tile_index,m_f3_pf_data_2);
}
TILE_GET_INFO_MEMBER(taito_f3_state::get_tile_info3)
{
- get_tile_info(machine(),tileinfo,tile_index,m_f3_pf_data_3);
+ get_tile_info(tileinfo,tile_index,m_f3_pf_data_3);
}
TILE_GET_INFO_MEMBER(taito_f3_state::get_tile_info4)
{
- get_tile_info(machine(),tileinfo,tile_index,m_f3_pf_data_4);
+ get_tile_info(tileinfo,tile_index,m_f3_pf_data_4);
}
TILE_GET_INFO_MEMBER(taito_f3_state::get_tile_info5)
{
- get_tile_info(machine(),tileinfo,tile_index,m_f3_pf_data_5);
+ get_tile_info(tileinfo,tile_index,m_f3_pf_data_5);
}
TILE_GET_INFO_MEMBER(taito_f3_state::get_tile_info6)
{
- get_tile_info(machine(),tileinfo,tile_index,m_f3_pf_data_6);
+ get_tile_info(tileinfo,tile_index,m_f3_pf_data_6);
}
TILE_GET_INFO_MEMBER(taito_f3_state::get_tile_info7)
{
- get_tile_info(machine(),tileinfo,tile_index,m_f3_pf_data_7);
+ get_tile_info(tileinfo,tile_index,m_f3_pf_data_7);
}
TILE_GET_INFO_MEMBER(taito_f3_state::get_tile_info8)
{
- get_tile_info(machine(),tileinfo,tile_index,m_f3_pf_data_8);
+ get_tile_info(tileinfo,tile_index,m_f3_pf_data_8);
}
diff --git a/src/mame/video/thunderj.c b/src/mame/video/thunderj.c
index 6a17f64fded..4ee842e9c8a 100644
--- a/src/mame/video/thunderj.c
+++ b/src/mame/video/thunderj.c
@@ -19,7 +19,7 @@
TILE_GET_INFO_MEMBER(thunderj_state::get_alpha_tile_info)
{
- UINT16 data = m_alpha[tile_index];
+ UINT16 data = tilemap.basemem_read(tile_index);
int code = ((data & 0x200) ? (m_alpha_tile_bank * 0x200) : 0) + (data & 0x1ff);
int color = ((data >> 10) & 0x0f) | ((data >> 9) & 0x20);
int opaque = data & 0x8000;
@@ -29,8 +29,8 @@ TILE_GET_INFO_MEMBER(thunderj_state::get_alpha_tile_info)
TILE_GET_INFO_MEMBER(thunderj_state::get_playfield_tile_info)
{
- UINT16 data1 = m_playfield[tile_index];
- UINT16 data2 = m_playfield_upper[tile_index] & 0xff;
+ UINT16 data1 = tilemap.basemem_read(tile_index);
+ UINT16 data2 = tilemap.extmem_read(tile_index) & 0xff;
int code = data1 & 0x7fff;
int color = 0x10 + (data2 & 0x0f);
SET_TILE_INFO_MEMBER(0, code, color, (data1 >> 15) & 1);
@@ -40,8 +40,8 @@ TILE_GET_INFO_MEMBER(thunderj_state::get_playfield_tile_info)
TILE_GET_INFO_MEMBER(thunderj_state::get_playfield2_tile_info)
{
- UINT16 data1 = m_playfield2[tile_index];
- UINT16 data2 = m_playfield_upper[tile_index] >> 8;
+ UINT16 data1 = tilemap.basemem_read(tile_index);
+ UINT16 data2 = tilemap.extmem_read(tile_index) >> 8;
int code = data1 & 0x7fff;
int color = data2 & 0x0f;
SET_TILE_INFO_MEMBER(0, code, color, (data1 >> 15) & 1);
@@ -95,19 +95,8 @@ VIDEO_START_MEMBER(thunderj_state,thunderj)
NULL /* callback routine for special entries */
};
- /* initialize the playfield */
- m_playfield_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(thunderj_state::get_playfield_tile_info),this), TILEMAP_SCAN_COLS, 8,8, 64,64);
-
- /* initialize the second playfield */
- m_playfield2_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(thunderj_state::get_playfield2_tile_info),this), TILEMAP_SCAN_COLS, 8,8, 64,64);
- m_playfield2_tilemap->set_transparent_pen(0);
-
/* initialize the motion objects */
atarimo_init(machine(), 0, &modesc);
-
- /* initialize the alphanumerics */
- m_alpha_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(thunderj_state::get_alpha_tile_info),this), TILEMAP_SCAN_ROWS, 8,8, 64,32);
- m_alpha_tilemap->set_transparent_pen(0);
}
@@ -127,14 +116,14 @@ UINT32 thunderj_state::screen_update_thunderj(screen_device &screen, bitmap_ind1
/* draw the playfield */
priority_bitmap.fill(0, cliprect);
- m_playfield_tilemap->draw(bitmap, cliprect, 0, 0x00);
- m_playfield_tilemap->draw(bitmap, cliprect, 1, 0x01);
- m_playfield_tilemap->draw(bitmap, cliprect, 2, 0x02);
- m_playfield_tilemap->draw(bitmap, cliprect, 3, 0x03);
- m_playfield2_tilemap->draw(bitmap, cliprect, 0, 0x80);
- m_playfield2_tilemap->draw(bitmap, cliprect, 1, 0x84);
- m_playfield2_tilemap->draw(bitmap, cliprect, 2, 0x88);
- m_playfield2_tilemap->draw(bitmap, cliprect, 3, 0x8c);
+ m_atarivc_playfield_tilemap->draw(bitmap, cliprect, 0, 0x00);
+ m_atarivc_playfield_tilemap->draw(bitmap, cliprect, 1, 0x01);
+ m_atarivc_playfield_tilemap->draw(bitmap, cliprect, 2, 0x02);
+ m_atarivc_playfield_tilemap->draw(bitmap, cliprect, 3, 0x03);
+ m_atarivc_playfield2_tilemap->draw(bitmap, cliprect, 0, 0x80);
+ m_atarivc_playfield2_tilemap->draw(bitmap, cliprect, 1, 0x84);
+ m_atarivc_playfield2_tilemap->draw(bitmap, cliprect, 2, 0x88);
+ m_atarivc_playfield2_tilemap->draw(bitmap, cliprect, 3, 0x8c);
/* draw and merge the MO */
mobitmap = atarimo_render(0, cliprect, &rectlist);
diff --git a/src/mame/video/toobin.c b/src/mame/video/toobin.c
index 9e753f07313..d6364e24626 100644
--- a/src/mame/video/toobin.c
+++ b/src/mame/video/toobin.c
@@ -19,7 +19,7 @@
TILE_GET_INFO_MEMBER(toobin_state::get_alpha_tile_info)
{
- UINT16 data = m_alpha[tile_index];
+ UINT16 data = tilemap.basemem_read(tile_index);
int code = data & 0x3ff;
int color = (data >> 12) & 0x0f;
SET_TILE_INFO_MEMBER(2, code, color, (data >> 10) & 1);
@@ -28,12 +28,11 @@ TILE_GET_INFO_MEMBER(toobin_state::get_alpha_tile_info)
TILE_GET_INFO_MEMBER(toobin_state::get_playfield_tile_info)
{
- UINT16 data1 = m_playfield[tile_index * 2];
- UINT16 data2 = m_playfield[tile_index * 2 + 1];
- int code = data2 & 0x3fff;
- int color = data1 & 0x0f;
- SET_TILE_INFO_MEMBER(0, code, color, TILE_FLIPYX(data2 >> 14));
- tileinfo.category = (data1 >> 4) & 3;
+ UINT32 data = tilemap.basemem_read(tile_index);
+ int code = data & 0x3fff;
+ int color = (data >> 16) & 0x0f;
+ SET_TILE_INFO_MEMBER(0, code, color, TILE_FLIPYX(data >> 14));
+ tileinfo.category = (data >> 20) & 3;
}
@@ -83,16 +82,9 @@ VIDEO_START_MEMBER(toobin_state,toobin)
0 /* callback routine for special entries */
};
- /* initialize the playfield */
- m_playfield_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(toobin_state::get_playfield_tile_info),this), TILEMAP_SCAN_ROWS, 8,8, 128,64);
-
/* initialize the motion objects */
atarimo_init(machine(), 0, &modesc);
- /* initialize the alphanumerics */
- m_alpha_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(toobin_state::get_alpha_tile_info),this), TILEMAP_SCAN_ROWS, 8,8, 64,48);
- m_alpha_tilemap->set_transparent_pen(0);
-
/* allocate a playfield bitmap for rendering */
machine().primary_screen->register_screen_bitmap(m_pfbitmap);
diff --git a/src/mame/video/unico.c b/src/mame/video/unico.c
index fa8e293d850..015f2e801e1 100644
--- a/src/mame/video/unico.c
+++ b/src/mame/video/unico.c
@@ -90,7 +90,7 @@ WRITE32_MEMBER(unico_state::unico_palette32_w)
TILE_GET_INFO_MEMBER(unico_state::get_tile_info)
{
- UINT16 *vram = (UINT16 *)param;
+ UINT16 *vram = (UINT16 *)tilemap.user_data();
UINT16 code = vram[2 * tile_index + 0 ];
UINT16 attr = vram[2 * tile_index + 1 ];
SET_TILE_INFO_MEMBER(1, code, attr & 0x1f, TILE_FLIPYX( attr >> 5 ));
@@ -98,7 +98,7 @@ TILE_GET_INFO_MEMBER(unico_state::get_tile_info)
TILE_GET_INFO_MEMBER(unico_state::get_tile_info32)
{
- UINT32 *vram = (UINT32 *)param;
+ UINT32 *vram = (UINT32 *)tilemap.user_data();
UINT16 code = vram[tile_index] >> 16;
UINT16 attr = vram[tile_index] & 0xff;
SET_TILE_INFO_MEMBER(1, code, attr & 0x1f, TILE_FLIPYX( attr >> 5 ));
diff --git a/src/mame/video/vindictr.c b/src/mame/video/vindictr.c
index bd50fd74a99..7d3437003c9 100644
--- a/src/mame/video/vindictr.c
+++ b/src/mame/video/vindictr.c
@@ -18,7 +18,7 @@
TILE_GET_INFO_MEMBER(vindictr_state::get_alpha_tile_info)
{
- UINT16 data = m_alpha[tile_index];
+ UINT16 data = tilemap.basemem_read(tile_index);
int code = data & 0x3ff;
int color = ((data >> 10) & 0x0f) | ((data >> 9) & 0x20);
int opaque = data & 0x8000;
@@ -28,7 +28,7 @@ TILE_GET_INFO_MEMBER(vindictr_state::get_alpha_tile_info)
TILE_GET_INFO_MEMBER(vindictr_state::get_playfield_tile_info)
{
- UINT16 data = m_playfield[tile_index];
+ UINT16 data = tilemap.basemem_read(tile_index);
int code = (m_playfield_tile_bank * 0x1000) + (data & 0xfff);
int color = 0x10 + 2 * ((data >> 12) & 7);
SET_TILE_INFO_MEMBER(0, code, color, (data >> 15) & 1);
@@ -81,16 +81,9 @@ VIDEO_START_MEMBER(vindictr_state,vindictr)
NULL /* callback routine for special entries */
};
- /* initialize the playfield */
- m_playfield_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(vindictr_state::get_playfield_tile_info),this), TILEMAP_SCAN_COLS, 8,8, 64,64);
-
/* initialize the motion objects */
atarimo_init(machine(), 0, &modesc);
- /* initialize the alphanumerics */
- m_alpha_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(vindictr_state::get_alpha_tile_info),this), TILEMAP_SCAN_ROWS, 8,8, 64,32);
- m_alpha_tilemap->set_transparent_pen(0);
-
/* save states */
save_item(NAME(m_playfield_tile_bank));
save_item(NAME(m_playfield_xscroll));
@@ -137,19 +130,19 @@ WRITE16_MEMBER( vindictr_state::vindictr_paletteram_w )
void vindictr_state::scanline_update(screen_device &screen, int scanline)
{
- UINT16 *base = &m_alpha[((scanline - 8) / 8) * 64 + 42];
int x;
/* keep in range */
- if (base < m_alpha)
- base += 0x7c0;
- else if (base >= &m_alpha[0x7c0])
+ int offset = ((scanline - 8) / 8) * 64 + 42;
+ if (offset < 0)
+ offset += 0x7c0;
+ else if (offset >= 0x7c0)
return;
/* update the current parameters */
for (x = 42; x < 64; x++)
{
- UINT16 data = *base++;
+ UINT16 data = m_alpha_tilemap->basemem_read(offset++);
switch ((data >> 9) & 7)
{
diff --git a/src/mame/video/xybots.c b/src/mame/video/xybots.c
index 90545ad3ff5..021956f6fd6 100644
--- a/src/mame/video/xybots.c
+++ b/src/mame/video/xybots.c
@@ -19,7 +19,7 @@
TILE_GET_INFO_MEMBER(xybots_state::get_alpha_tile_info)
{
- UINT16 data = m_alpha[tile_index];
+ UINT16 data = tilemap.basemem_read(tile_index);
int code = data & 0x3ff;
int color = (data >> 12) & 7;
int opaque = data & 0x8000;
@@ -29,7 +29,7 @@ TILE_GET_INFO_MEMBER(xybots_state::get_alpha_tile_info)
TILE_GET_INFO_MEMBER(xybots_state::get_playfield_tile_info)
{
- UINT16 data = m_playfield[tile_index];
+ UINT16 data = tilemap.basemem_read(tile_index);
int code = data & 0x1fff;
int color = (data >> 11) & 0x0f;
SET_TILE_INFO_MEMBER(0, code, color, (data >> 15) & 1);
@@ -82,15 +82,8 @@ VIDEO_START_MEMBER(xybots_state,xybots)
NULL /* callback routine for special entries */
};
- /* initialize the playfield */
- m_playfield_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(xybots_state::get_playfield_tile_info),this), TILEMAP_SCAN_ROWS, 8,8, 64,32);
-
/* initialize the motion objects */
atarimo_init(machine(), 0, &modesc);
-
- /* initialize the alphanumerics */
- m_alpha_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(xybots_state::get_alpha_tile_info),this), TILEMAP_SCAN_ROWS, 8,8, 64,32);
- m_alpha_tilemap->set_transparent_pen(0);
}
diff --git a/src/mame/video/ygv608.c b/src/mame/video/ygv608.c
index 107cc333980..01b7e0ed79b 100644
--- a/src/mame/video/ygv608.c
+++ b/src/mame/video/ygv608.c
@@ -118,6 +118,7 @@ static TILEMAP_MAPPER( get_tile_offset )
static TILE_GET_INFO( get_tile_info_A_8 )
{
+ running_machine &machine = device.machine();
// extract row,col packed into tile_index
int col = tile_index >> 6;
int row = tile_index & 0x3f;
@@ -211,6 +212,8 @@ static TILE_GET_INFO( get_tile_info_A_8 )
static TILE_GET_INFO( get_tile_info_B_8 )
{
+ running_machine &machine = device.machine();
+
// extract row,col packed into tile_index
int col = tile_index >> 6;
int row = tile_index & 0x3f;
@@ -308,6 +311,8 @@ static TILE_GET_INFO( get_tile_info_B_8 )
static TILE_GET_INFO( get_tile_info_A_16 )
{
+ running_machine &machine = device.machine();
+
// extract row,col packed into tile_index
int col = tile_index >> 6;
int row = tile_index & 0x3f;
@@ -397,6 +402,8 @@ static TILE_GET_INFO( get_tile_info_A_16 )
static TILE_GET_INFO( get_tile_info_B_16 )
{
+ running_machine &machine = device.machine();
+
// extract row,col packed into tile_index
int col = tile_index >> 6;
int row = tile_index & 0x3f;