summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2013-08-07 03:18:59 +0000
committer Aaron Giles <aaron@aarongiles.com>2013-08-07 03:18:59 +0000
commit2f1e78d892e218b4f23fc95c89d731ca6e054482 (patch)
treedcaa328a6049494af1dd68634935b61ea42ac14b
parent1e7273341bfc5ddcb7893f66cd9ffccb038d8c28 (diff)
Moved tilemap_memory into a generic memory_array class, since it is
more generally useful than just in tilemaps. Code is now in memarray.* Converted the Atari RLE motion objects device from a half-assed device into a full-assed device, leveraging the memory_array class.
-rw-r--r--.gitattributes2
-rw-r--r--src/emu/emu.h1
-rw-r--r--src/emu/emu.mak1
-rw-r--r--src/emu/memarray.c203
-rw-r--r--src/emu/memarray.h138
-rw-r--r--src/emu/tilemap.c164
-rw-r--r--src/emu/tilemap.h76
-rw-r--r--src/mame/drivers/atarig1.c54
-rw-r--r--src/mame/drivers/atarig42.c29
-rw-r--r--src/mame/drivers/atarigt.c27
-rw-r--r--src/mame/drivers/atarigx2.c51
-rw-r--r--src/mame/includes/atarig1.h4
-rw-r--r--src/mame/includes/atarig42.h3
-rw-r--r--src/mame/includes/atarigt.h4
-rw-r--r--src/mame/includes/atarigx2.h6
-rw-r--r--src/mame/video/atarig1.c14
-rw-r--r--src/mame/video/atarig42.c16
-rw-r--r--src/mame/video/atarigt.c20
-rw-r--r--src/mame/video/atarigx2.c16
-rw-r--r--src/mame/video/atarirle.c1487
-rw-r--r--src/mame/video/atarirle.h227
21 files changed, 1193 insertions, 1350 deletions
diff --git a/.gitattributes b/.gitattributes
index 390e15e7ecd..40cd7ac961a 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1503,6 +1503,8 @@ src/emu/mame.h svneol=native#text/plain
src/emu/mcfglgcy.h svneol=native#text/plain
src/emu/mconfig.c svneol=native#text/plain
src/emu/mconfig.h svneol=native#text/plain
+src/emu/memarray.c svneol=native#text/plain
+src/emu/memarray.h svneol=native#text/plain
src/emu/memory.c svneol=native#text/plain
src/emu/memory.h svneol=native#text/plain
src/emu/network.c svneol=native#text/plain
diff --git a/src/emu/emu.h b/src/emu/emu.h
index 17e3a2e3779..0f82cef7d0f 100644
--- a/src/emu/emu.h
+++ b/src/emu/emu.h
@@ -69,6 +69,7 @@
// memory and address spaces
#include "memory.h"
#include "addrmap.h"
+#include "memarray.h"
// machine-wide utilities
#include "romload.h"
diff --git a/src/emu/emu.mak b/src/emu/emu.mak
index 6110c14ac13..b24a06d0c8c 100644
--- a/src/emu/emu.mak
+++ b/src/emu/emu.mak
@@ -89,6 +89,7 @@ EMUOBJS = \
$(EMUOBJ)/mame.o \
$(EMUOBJ)/machine.o \
$(EMUOBJ)/mconfig.o \
+ $(EMUOBJ)/memarray.o \
$(EMUOBJ)/memory.o \
$(EMUOBJ)/network.o \
$(EMUOBJ)/output.o \
diff --git a/src/emu/memarray.c b/src/emu/memarray.c
new file mode 100644
index 00000000000..4f1b26cdd96
--- /dev/null
+++ b/src/emu/memarray.c
@@ -0,0 +1,203 @@
+/***************************************************************************
+
+ memarray.c
+
+ Generic memory array accessor helper.
+
+****************************************************************************
+
+ 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"
+
+
+//**************************************************************************
+// MEMORY ARRAY HELPER
+//**************************************************************************
+
+//-------------------------------------------------
+// memory_array - constructor
+//-------------------------------------------------
+
+memory_array::memory_array()
+ : m_base(NULL),
+ m_bytes(0),
+ m_membits(0),
+ m_bytes_per_entry(0)
+{
+}
+
+
+//-------------------------------------------------
+// set - configure the parameters
+//-------------------------------------------------
+
+void memory_array::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 = &memory_array::read8_from_8; m_writer = &memory_array::write8_to_8; break;
+ case 1*1000 + 8*10 + ENDIANNESS_BIG: m_reader = &memory_array::read8_from_8; m_writer = &memory_array::write8_to_8; break;
+ case 1*1000 + 16*10 + ENDIANNESS_LITTLE: m_reader = &memory_array::read8_from_16le; m_writer = &memory_array::write8_to_16le; break;
+ case 1*1000 + 16*10 + ENDIANNESS_BIG: m_reader = &memory_array::read8_from_16be; m_writer = &memory_array::write8_to_16be; break;
+ case 1*1000 + 32*10 + ENDIANNESS_LITTLE: m_reader = &memory_array::read8_from_32le; m_writer = &memory_array::write8_to_32le; break;
+ case 1*1000 + 32*10 + ENDIANNESS_BIG: m_reader = &memory_array::read8_from_32be; m_writer = &memory_array::write8_to_32be; break;
+ case 1*1000 + 64*10 + ENDIANNESS_LITTLE: m_reader = &memory_array::read8_from_64le; m_writer = &memory_array::write8_to_64le; break;
+ case 1*1000 + 64*10 + ENDIANNESS_BIG: m_reader = &memory_array::read8_from_64be; m_writer = &memory_array::write8_to_64be; break;
+
+ case 2*1000 + 8*10 + ENDIANNESS_LITTLE: m_reader = &memory_array::read16_from_8le; m_writer = &memory_array::write16_to_8le; break;
+ case 2*1000 + 8*10 + ENDIANNESS_BIG: m_reader = &memory_array::read16_from_8be; m_writer = &memory_array::write16_to_8be; break;
+ case 2*1000 + 16*10 + ENDIANNESS_LITTLE: m_reader = &memory_array::read16_from_16; m_writer = &memory_array::write16_to_16; break;
+ case 2*1000 + 16*10 + ENDIANNESS_BIG: m_reader = &memory_array::read16_from_16; m_writer = &memory_array::write16_to_16; break;
+ case 2*1000 + 32*10 + ENDIANNESS_LITTLE: m_reader = &memory_array::read16_from_32le; m_writer = &memory_array::write16_to_32le; break;
+ case 2*1000 + 32*10 + ENDIANNESS_BIG: m_reader = &memory_array::read16_from_32be; m_writer = &memory_array::write16_to_32be; break;
+ case 2*1000 + 64*10 + ENDIANNESS_LITTLE: m_reader = &memory_array::read16_from_64le; m_writer = &memory_array::write16_to_64le; break;
+ case 2*1000 + 64*10 + ENDIANNESS_BIG: m_reader = &memory_array::read16_from_64be; m_writer = &memory_array::write16_to_64be; break;
+
+ case 4*1000 + 8*10 + ENDIANNESS_LITTLE: m_reader = &memory_array::read32_from_8le; m_writer = &memory_array::write32_to_8le; break;
+ case 4*1000 + 8*10 + ENDIANNESS_BIG: m_reader = &memory_array::read32_from_8be; m_writer = &memory_array::write32_to_8be; break;
+ case 4*1000 + 16*10 + ENDIANNESS_LITTLE: m_reader = &memory_array::read32_from_16le; m_writer = &memory_array::write32_to_16le; break;
+ case 4*1000 + 16*10 + ENDIANNESS_BIG: m_reader = &memory_array::read32_from_16be; m_writer = &memory_array::write32_to_16be; break;
+ case 4*1000 + 32*10 + ENDIANNESS_LITTLE: m_reader = &memory_array::read32_from_32; m_writer = &memory_array::write32_to_32; break;
+ case 4*1000 + 32*10 + ENDIANNESS_BIG: m_reader = &memory_array::read32_from_32; m_writer = &memory_array::write32_to_32; break;
+ case 4*1000 + 64*10 + ENDIANNESS_LITTLE: m_reader = &memory_array::read32_from_64le; m_writer = &memory_array::write32_to_64le; break;
+ case 4*1000 + 64*10 + ENDIANNESS_BIG: m_reader = &memory_array::read32_from_64be; m_writer = &memory_array::write32_to_64be; break;
+
+ default: throw emu_fatalerror("Illegal memory bits/bus width combo in memory_array");
+ }
+}
+
+
+//-------------------------------------------------
+// set - additional setter variants
+//-------------------------------------------------
+
+void memory_array::set(const address_space &space, void *base, UINT32 bytes, int bpe)
+{
+ set(base, bytes, space.data_width(), space.endianness(), bpe);
+}
+
+void memory_array::set(const memory_share &share, int bpe)
+{
+ set(share.ptr(), share.bytes(), share.width(), share.endianness(), bpe);
+}
+
+void memory_array::set(const memory_array &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 memory_array::read8_from_8(int index) { return reinterpret_cast<UINT8 *>(m_base)[index]; }
+void memory_array::write8_to_8(int index, UINT32 data) { reinterpret_cast<UINT8 *>(m_base)[index] = data; }
+
+UINT32 memory_array::read8_from_16le(int index) { return reinterpret_cast<UINT8 *>(m_base)[BYTE_XOR_LE(index)]; }
+void memory_array::write8_to_16le(int index, UINT32 data) { reinterpret_cast<UINT8 *>(m_base)[BYTE_XOR_LE(index)] = data; }
+UINT32 memory_array::read8_from_16be(int index) { return reinterpret_cast<UINT8 *>(m_base)[BYTE_XOR_BE(index)]; }
+void memory_array::write8_to_16be(int index, UINT32 data) { reinterpret_cast<UINT8 *>(m_base)[BYTE_XOR_BE(index)] = data; }
+
+UINT32 memory_array::read8_from_32le(int index) { return reinterpret_cast<UINT8 *>(m_base)[BYTE4_XOR_BE(index)]; }
+void memory_array::write8_to_32le(int index, UINT32 data) { reinterpret_cast<UINT8 *>(m_base)[BYTE4_XOR_BE(index)] = data; }
+UINT32 memory_array::read8_from_32be(int index) { return reinterpret_cast<UINT8 *>(m_base)[BYTE4_XOR_BE(index)]; }
+void memory_array::write8_to_32be(int index, UINT32 data) { reinterpret_cast<UINT8 *>(m_base)[BYTE4_XOR_BE(index)] = data; }
+
+UINT32 memory_array::read8_from_64le(int index) { return reinterpret_cast<UINT8 *>(m_base)[BYTE8_XOR_BE(index)]; }
+void memory_array::write8_to_64le(int index, UINT32 data) { reinterpret_cast<UINT8 *>(m_base)[BYTE8_XOR_BE(index)] = data; }
+UINT32 memory_array::read8_from_64be(int index) { return reinterpret_cast<UINT8 *>(m_base)[BYTE8_XOR_BE(index)]; }
+void memory_array::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 memory_array::read16_from_8le(int index) { return read8_from_8(index*2) | (read8_from_8(index*2+1) << 8); }
+void memory_array::write16_to_8le(int index, UINT32 data) { write8_to_8(index*2, data); write8_to_8(index*2+1, data >> 8); }
+UINT32 memory_array::read16_from_8be(int index) { return (read8_from_8(index*2) << 8) | read8_from_8(index*2+1); }
+void memory_array::write16_to_8be(int index, UINT32 data) { write8_to_8(index*2, data >> 8); write8_to_8(index*2+1, data); }
+
+UINT32 memory_array::read16_from_16(int index) { return reinterpret_cast<UINT16 *>(m_base)[index]; }
+void memory_array::write16_to_16(int index, UINT32 data) { reinterpret_cast<UINT16 *>(m_base)[index] = data; }
+
+UINT32 memory_array::read16_from_32le(int index) { return reinterpret_cast<UINT16 *>(m_base)[BYTE_XOR_LE(index)]; }
+void memory_array::write16_to_32le(int index, UINT32 data) { reinterpret_cast<UINT16 *>(m_base)[BYTE_XOR_LE(index)] = data; }
+UINT32 memory_array::read16_from_32be(int index) { return reinterpret_cast<UINT16 *>(m_base)[BYTE_XOR_BE(index)]; }
+void memory_array::write16_to_32be(int index, UINT32 data) { reinterpret_cast<UINT16 *>(m_base)[BYTE_XOR_BE(index)] = data; }
+
+UINT32 memory_array::read16_from_64le(int index) { return reinterpret_cast<UINT16 *>(m_base)[BYTE4_XOR_LE(index)]; }
+void memory_array::write16_to_64le(int index, UINT32 data) { reinterpret_cast<UINT16 *>(m_base)[BYTE4_XOR_LE(index)] = data; }
+UINT32 memory_array::read16_from_64be(int index) { return reinterpret_cast<UINT16 *>(m_base)[BYTE4_XOR_BE(index)]; }
+void memory_array::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 memory_array::read32_from_8le(int index) { return read16_from_8le(index*2) | (read16_from_8le(index*2+1) << 16); }
+void memory_array::write32_to_8le(int index, UINT32 data) { write16_to_8le(index*2, data); write16_to_8le(index*2+1, data >> 16); }
+UINT32 memory_array::read32_from_8be(int index) { return (read16_from_8be(index*2) << 16) | read16_from_8be(index*2+1); }
+void memory_array::write32_to_8be(int index, UINT32 data) { write16_to_8be(index*2, data >> 16); write16_to_8be(index*2+1, data); }
+
+UINT32 memory_array::read32_from_16le(int index) { return read16_from_16(index*2) | (read16_from_16(index*2+1) << 16); }
+void memory_array::write32_to_16le(int index, UINT32 data) { write16_to_16(index*2, data); write16_to_16(index*2+1, data >> 16); }
+UINT32 memory_array::read32_from_16be(int index) { return (read16_from_16(index*2) << 16) | read16_from_16(index*2+1); }
+void memory_array::write32_to_16be(int index, UINT32 data) { write16_to_16(index*2, data >> 16); write16_to_16(index*2+1, data); }
+
+UINT32 memory_array::read32_from_32(int index) { return reinterpret_cast<UINT32 *>(m_base)[index]; }
+void memory_array::write32_to_32(int index, UINT32 data) { reinterpret_cast<UINT32 *>(m_base)[index] = data; }
+
+UINT32 memory_array::read32_from_64le(int index) { return reinterpret_cast<UINT32 *>(m_base)[BYTE_XOR_LE(index)]; }
+void memory_array::write32_to_64le(int index, UINT32 data) { reinterpret_cast<UINT32 *>(m_base)[BYTE_XOR_LE(index)] = data; }
+UINT32 memory_array::read32_from_64be(int index) { return reinterpret_cast<UINT32 *>(m_base)[BYTE_XOR_BE(index)]; }
+void memory_array::write32_to_64be(int index, UINT32 data) { reinterpret_cast<UINT32 *>(m_base)[BYTE_XOR_BE(index)] = data; }
diff --git a/src/emu/memarray.h b/src/emu/memarray.h
new file mode 100644
index 00000000000..c1acc53e5c6
--- /dev/null
+++ b/src/emu/memarray.h
@@ -0,0 +1,138 @@
+/***************************************************************************
+
+ memarray.h
+
+ Generic memory array accessor helper.
+
+****************************************************************************
+
+ 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.
+
+****************************************************************************
+
+ A memory array in this case is an array of 8, 16, or 32-bit data
+ arranged logically.
+
+ A memory array is stored in "natural" order, i.e., read/writes to it
+ are done via AM_RAM, or standard COMBINE_DATA, even if the width of
+ the CPU is different from the array width.
+
+ The read_entry/write_entry functions serve to read/write entries of
+ the configured size regardless of the underlay width of the CPU's
+ memory system.
+
+***************************************************************************/
+
+#pragma once
+
+#ifndef __EMU_H__
+#error Dont include this file directly; include emu.h instead.
+#endif
+
+#ifndef __MEMARRAY_H__
+#define __MEMARRAY_H__
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+
+// ======================> memory_array
+
+// memory information
+class memory_array
+{
+public:
+ // construction/destruction
+ memory_array();
+ memory_array(void *base, UINT32 bytes, int membits, endianness_t endianness, int bpe) { set(base, bytes, membits, endianness, bpe); }
+ memory_array(const address_space &space, void *base, UINT32 bytes, int bpe) { set(space, base, bytes, bpe); }
+ memory_array(const memory_share &share, int bpe) { set(share, bpe); }
+ memory_array(const memory_array &helper) { set(helper); }
+
+ // 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 memory_array &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; }
+
+ // readers and writers
+ UINT32 read(int index) { return (this->*m_reader)(index); }
+ void write(int index, UINT32 data) { (this->*m_writer)(index, data); }
+
+private:
+ // 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);
+
+ // internal state
+ void * m_base;
+ UINT32 m_bytes;
+ int m_membits;
+ endianness_t m_endianness;
+ int m_bytes_per_entry;
+ UINT32 (memory_array::*m_reader)(int);
+ void (memory_array::*m_writer)(int, UINT32);
+};
+
+
+
+#endif // __MEMARRAY_H__
diff --git a/src/emu/tilemap.c b/src/emu/tilemap.c
index 87104909033..b2da098b98b 100644
--- a/src/emu/tilemap.c
+++ b/src/emu/tilemap.c
@@ -1491,170 +1491,6 @@ 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
//**************************************************************************
diff --git a/src/emu/tilemap.h b/src/emu/tilemap.h
index e40ea1434fa..0d2d1a0827f 100644
--- a/src/emu/tilemap.h
+++ b/src/emu/tilemap.h
@@ -434,6 +434,7 @@ enum tilemap_standard_mapper
MCFG_TILEMAP_TRANSPARENT_PEN(_transpen)
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -485,73 +486,6 @@ typedef device_delegate<void (tilemap_t &, tile_data &, tilemap_memory_index)> t
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);
-
- // 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
@@ -589,8 +523,8 @@ public:
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; }
+ memory_array &basemem() { return m_basemem; }
+ memory_array &extmem() { return m_extmem; }
UINT32 width() const { return m_width; }
UINT32 height() const { return m_height; }
bool enabled() const { return m_enable; }
@@ -712,8 +646,8 @@ private:
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
+ memory_array m_basemem; // info about base memory
+ memory_array m_extmem; // info about extension memory
// basic tilemap metrics
UINT32 m_rows; // number of tile rows
diff --git a/src/mame/drivers/atarig1.c b/src/mame/drivers/atarig1.c
index b726ba97c9a..70a09fdd799 100644
--- a/src/mame/drivers/atarig1.c
+++ b/src/mame/drivers/atarig1.c
@@ -58,19 +58,10 @@ MACHINE_RESET_MEMBER(atarig1_state,atarig1)
*
*************************************/
-WRITE16_MEMBER(atarig1_state::mo_control_w)
-{
- if (ACCESSING_BITS_0_7)
- {
- atarirle_control_w(m_rle, data & 7);
- }
-}
-
-
WRITE16_MEMBER(atarig1_state::mo_command_w)
{
COMBINE_DATA(m_mo_command);
- atarirle_command_w(m_rle, (data == 0 && m_is_pitfight) ? ATARIRLE_COMMAND_CHECKSUM : ATARIRLE_COMMAND_DRAW);
+ m_rle->command_write(space, offset, (data == 0 && m_is_pitfight) ? ATARIRLE_COMMAND_CHECKSUM : ATARIRLE_COMMAND_DRAW);
}
@@ -203,7 +194,7 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, atarig1_state )
AM_RANGE(0xf88000, 0xf8ffff) AM_WRITE(eeprom_enable_w)
AM_RANGE(0xf90000, 0xf90001) AM_DEVWRITE8("jsa", atari_jsa_ii_device, main_command_w, 0xff00)
AM_RANGE(0xf98000, 0xf98001) AM_DEVWRITE("jsa", atari_jsa_ii_device, sound_reset_w)
- AM_RANGE(0xfa0000, 0xfa0001) AM_WRITE(mo_control_w)
+ AM_RANGE(0xfa0000, 0xfa0001) AM_DEVWRITE8("rle", atari_rle_objects_device, control_write, 0x00ff)
AM_RANGE(0xfb0000, 0xfb0001) AM_WRITE(video_int_ack_w)
AM_RANGE(0xfc0000, 0xfc0001) AM_READ(special_port0_r)
AM_RANGE(0xfc8000, 0xfc8007) AM_READWRITE(a2d_data_r, a2d_select_w)
@@ -211,7 +202,7 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, atarig1_state )
AM_RANGE(0xfd8000, 0xfdffff) AM_READWRITE(eeprom_r, eeprom_w) AM_SHARE("eeprom")
/* AM_RANGE(0xfe0000, 0xfe7fff) AM_READ(from_r)*/
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(0xff0000, 0xff0fff) AM_RAM AM_SHARE("rle")
AM_RANGE(0xff2000, 0xff2001) AM_WRITE(mo_command_w) AM_SHARE("mo_command")
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")
@@ -388,15 +379,11 @@ GFXDECODE_END
-static const atarirle_desc modesc_hydra =
+static const atari_rle_objects_config modesc_hydra =
{
- "gfx3", /* region where the GFX data lives */
- 256, /* number of entries in sprite RAM */
0, /* left clip coordinate */
255, /* right clip coordinate */
-
0x200, /* base palette entry */
- 0x100, /* maximum number of colors */
{{ 0x7fff,0,0,0,0,0,0,0 }}, /* mask for the code index */
{{ 0,0x00f0,0,0,0,0,0,0 }}, /* mask for the color */
@@ -409,15 +396,11 @@ static const atarirle_desc modesc_hydra =
{{ 0 }} /* mask for the VRAM target */
};
-static const atarirle_desc modesc_pitfight =
+static const atari_rle_objects_config modesc_pitfight =
{
- "gfx3", /* region where the GFX data lives */
- 256, /* number of entries in sprite RAM */
40, /* left clip coordinate */
295, /* right clip coordinate */
-
0x200, /* base palette entry */
- 0x100, /* maximum number of colors */
{{ 0x7fff,0,0,0,0,0,0,0 }}, /* mask for the code index */
{{ 0,0x00f0,0,0,0,0,0,0 }}, /* mask for the color */
@@ -460,7 +443,6 @@ static MACHINE_CONFIG_START( atarig1, atarig1_state )
/* note: these parameters are from published specs, not derived */
MCFG_SCREEN_RAW_PARAMS(ATARI_CLOCK_14MHz/2, 456, 0, 336, 262, 0, 240)
MCFG_SCREEN_UPDATE_DRIVER(atarig1_state, screen_update_atarig1)
- MCFG_SCREEN_VBLANK_DRIVER(atarig1_state, screen_eof_atarig1)
MCFG_VIDEO_START_OVERRIDE(atarig1_state,atarig1)
@@ -473,11 +455,11 @@ static MACHINE_CONFIG_START( atarig1, atarig1_state )
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( hydra, atarig1 )
- MCFG_ATARIRLE_ADD( "rle", modesc_hydra )
+ MCFG_ATARIRLE_ADD("rle", modesc_hydra)
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( pitfight, atarig1 )
- MCFG_ATARIRLE_ADD( "rle", modesc_pitfight )
+ MCFG_ATARIRLE_ADD("rle", modesc_pitfight)
MACHINE_CONFIG_END
@@ -517,7 +499,7 @@ ROM_START( hydra )
ROM_REGION( 0x020000, "gfx2", 0 )
ROM_LOAD( "136079-1027.bin", 0x000000, 0x20000, CRC(f9135b9b) SHA1(48c0ad0d3e592d191d1385e30530bdb69a095452) ) /* alphanumerics */
- ROM_REGION16_BE( 0x100000, "gfx3", 0 )
+ ROM_REGION16_BE( 0x100000, "rle", 0 )
ROM_LOAD16_BYTE( "136079-1001.bin", 0x00001, 0x10000, CRC(3f757a53) SHA1(be2b7f8b907ef9ea24b24b7210ead70cdbad3506) )
ROM_LOAD16_BYTE( "136079-1002.bin", 0x00000, 0x10000, CRC(a1169469) SHA1(b5ab65ca9d98ef1e79518eaa519fba0cee92c86e) )
ROM_LOAD16_BYTE( "136079-1003.bin", 0x20001, 0x10000, CRC(aa21ec33) SHA1(dec65b670c64b3630f6ccbbcc3212f6771908de9) )
@@ -577,7 +559,7 @@ ROM_START( hydrap )
ROM_REGION( 0x020000, "gfx2", 0 )
ROM_LOAD( "hydalph.bin", 0x000000, 0x20000, CRC(7dd2b062) SHA1(789b35b1e8cce73e2314d1b6688b5066df91b604) ) /* alphanumerics */
- ROM_REGION16_BE( 0x100000, "gfx3", 0 )
+ ROM_REGION16_BE( 0x100000, "rle", 0 )
ROM_LOAD16_BYTE( "hydmhi0.bin", 0x00001, 0x10000, CRC(3c83b42d) SHA1(3c6de7e6aab08a673227f06b04e000714a9111b1) )
ROM_LOAD16_BYTE( "hydmlo0.bin", 0x00000, 0x10000, CRC(6d49650c) SHA1(97f9dbdfa5cc620705eec1da2398b2ac63cef30f) )
ROM_LOAD16_BYTE( "hydmhi1.bin", 0x20001, 0x10000, CRC(689b3376) SHA1(85ffa31f10483317db615cf8e520a8c8a40d6013) )
@@ -637,7 +619,7 @@ ROM_START( hydrap2 )
ROM_REGION( 0x020000, "gfx2", 0 )
ROM_LOAD( "136079-1027.bin", 0x000000, 0x20000, CRC(f9135b9b) SHA1(48c0ad0d3e592d191d1385e30530bdb69a095452) ) /* alphanumerics */
- ROM_REGION16_BE( 0x100000, "gfx3", 0 )
+ ROM_REGION16_BE( 0x100000, "rle", 0 )
ROM_LOAD16_BYTE( "136079-1001.bin", 0x00001, 0x10000, BAD_DUMP CRC(3f757a53) SHA1(be2b7f8b907ef9ea24b24b7210ead70cdbad3506) ) // not dumped from this pcb, rom taken from another set instead
ROM_LOAD16_BYTE( "136079-1002.bin", 0x00000, 0x10000, BAD_DUMP CRC(a1169469) SHA1(b5ab65ca9d98ef1e79518eaa519fba0cee92c86e) ) // "
ROM_LOAD16_BYTE( "136079-1003.bin", 0x20001, 0x10000, BAD_DUMP CRC(aa21ec33) SHA1(dec65b670c64b3630f6ccbbcc3212f6771908de9) ) // "
@@ -721,7 +703,7 @@ ROM_START( pitfight )
ROM_REGION( 0x020000, "gfx2", 0 )
ROM_LOAD( "136081-1027.15l", 0x000000, 0x10000, CRC(a59f381d) SHA1(b14e878340ad2adbf4f6d4fc331c58f62037c7c7) ) /* alphanumerics */
- ROM_REGION16_BE( 0x200000, "gfx3", 0 )
+ ROM_REGION16_BE( 0x200000, "rle", 0 )
ROM_LOAD16_BYTE( "136081-1001.65r", 0x000001, 0x20000, CRC(3af31444) SHA1(91fc02786b82abdf12ebdbaacdd1f158f8ce6d06) )
ROM_LOAD16_BYTE( "136081-1002.65n", 0x000000, 0x20000, CRC(f1d76a4c) SHA1(ca769d2cdd096f4a54f7bcaa4840fc9ffaabf499) )
ROM_LOAD16_BYTE( "136081-1003.70r", 0x040001, 0x20000, CRC(28c41c2a) SHA1(75cd527f98c8475e3b880f53c5a355d6c3bd8766) )
@@ -817,7 +799,7 @@ ROM_START( pitfight7 )
ROM_REGION( 0x020000, "gfx2", 0 )
ROM_LOAD( "136081-1027.15l", 0x000000, 0x10000, CRC(a59f381d) SHA1(b14e878340ad2adbf4f6d4fc331c58f62037c7c7) ) /* alphanumerics */
- ROM_REGION16_BE( 0x200000, "gfx3", 0 )
+ ROM_REGION16_BE( 0x200000, "rle", 0 )
ROM_LOAD16_BYTE( "136081-1001.65r", 0x000001, 0x20000, CRC(3af31444) SHA1(91fc02786b82abdf12ebdbaacdd1f158f8ce6d06) )
ROM_LOAD16_BYTE( "136081-1002.65n", 0x000000, 0x20000, CRC(f1d76a4c) SHA1(ca769d2cdd096f4a54f7bcaa4840fc9ffaabf499) )
ROM_LOAD16_BYTE( "136081-1003.70r", 0x040001, 0x20000, CRC(28c41c2a) SHA1(75cd527f98c8475e3b880f53c5a355d6c3bd8766) )
@@ -880,7 +862,7 @@ ROM_START( pitfight6 )
ROM_REGION( 0x020000, "gfx2", 0 )
ROM_LOAD( "136081-1027.15l", 0x000000, 0x10000, CRC(a59f381d) SHA1(b14e878340ad2adbf4f6d4fc331c58f62037c7c7) ) /* alphanumerics */
- ROM_REGION16_BE( 0x200000, "gfx3", 0 )
+ ROM_REGION16_BE( 0x200000, "rle", 0 )
ROM_LOAD16_BYTE( "136081-1065.65r", 0x000001, 0x80000, CRC(6d3a834f) SHA1(6e153fee39b6a932aeb101e69e3557355a637c76) ) /* Same data as other sets, but in four mask roms */
ROM_LOAD16_BYTE( "136081-1066.65n", 0x000000, 0x80000, CRC(0f7f5117) SHA1(e9d3d0db388a5f7d76de363018d92fa59bf8113a) )
ROM_LOAD16_BYTE( "136081-1067.70r", 0x100001, 0x80000, CRC(ca4f75a8) SHA1(f8b8b03df4ad043a48970a0f8a4c3b85c7140493) )
@@ -931,7 +913,7 @@ ROM_START( pitfight5 )
ROM_REGION( 0x020000, "gfx2", 0 )
ROM_LOAD( "136081-1027.15l", 0x000000, 0x10000, CRC(a59f381d) SHA1(b14e878340ad2adbf4f6d4fc331c58f62037c7c7) ) /* alphanumerics */
- ROM_REGION16_BE( 0x200000, "gfx3", 0 )
+ ROM_REGION16_BE( 0x200000, "rle", 0 )
ROM_LOAD16_BYTE( "136081-1065.65r", 0x000001, 0x80000, CRC(6d3a834f) SHA1(6e153fee39b6a932aeb101e69e3557355a637c76) ) /* Same data as other sets, but in four mask roms */
ROM_LOAD16_BYTE( "136081-1066.65n", 0x000000, 0x80000, CRC(0f7f5117) SHA1(e9d3d0db388a5f7d76de363018d92fa59bf8113a) )
ROM_LOAD16_BYTE( "136081-1067.70r", 0x100001, 0x80000, CRC(ca4f75a8) SHA1(f8b8b03df4ad043a48970a0f8a4c3b85c7140493) )
@@ -982,7 +964,7 @@ ROM_START( pitfight4 )
ROM_REGION( 0x020000, "gfx2", 0 )
ROM_LOAD( "136081-1027.15l", 0x000000, 0x10000, CRC(a59f381d) SHA1(b14e878340ad2adbf4f6d4fc331c58f62037c7c7) ) /* alphanumerics */
- ROM_REGION16_BE( 0x200000, "gfx3", 0 )
+ ROM_REGION16_BE( 0x200000, "rle", 0 )
ROM_LOAD16_BYTE( "136081-1001.65r", 0x000001, 0x20000, CRC(3af31444) SHA1(91fc02786b82abdf12ebdbaacdd1f158f8ce6d06) )
ROM_LOAD16_BYTE( "136081-1002.65n", 0x000000, 0x20000, CRC(f1d76a4c) SHA1(ca769d2cdd096f4a54f7bcaa4840fc9ffaabf499) )
ROM_LOAD16_BYTE( "136081-1003.70r", 0x040001, 0x20000, CRC(28c41c2a) SHA1(75cd527f98c8475e3b880f53c5a355d6c3bd8766) )
@@ -1045,7 +1027,7 @@ ROM_START( pitfight3 )
ROM_REGION( 0x020000, "gfx2", 0 )
ROM_LOAD( "136081-1027.15l", 0x000000, 0x10000, CRC(a59f381d) SHA1(b14e878340ad2adbf4f6d4fc331c58f62037c7c7) ) /* alphanumerics */
- ROM_REGION16_BE( 0x200000, "gfx3", 0 )
+ ROM_REGION16_BE( 0x200000, "rle", 0 )
ROM_LOAD16_BYTE( "136081-1001.65r", 0x000001, 0x20000, CRC(3af31444) SHA1(91fc02786b82abdf12ebdbaacdd1f158f8ce6d06) )
ROM_LOAD16_BYTE( "136081-1002.65n", 0x000000, 0x20000, CRC(f1d76a4c) SHA1(ca769d2cdd096f4a54f7bcaa4840fc9ffaabf499) )
ROM_LOAD16_BYTE( "136081-1003.70r", 0x040001, 0x20000, CRC(28c41c2a) SHA1(75cd527f98c8475e3b880f53c5a355d6c3bd8766) )
@@ -1108,7 +1090,7 @@ ROM_START( pitfightj )
ROM_REGION( 0x020000, "gfx2", 0 )
ROM_LOAD( "136081-1427.dat", 0x000000, 0x20000, CRC(b2c51dff) SHA1(7ad82a6a55d3a68e39d113c92f9e89a43408b5b2) ) /* alphanumerics */
- ROM_REGION16_BE( 0x200000, "gfx3", 0 )
+ ROM_REGION16_BE( 0x200000, "rle", 0 )
ROM_LOAD16_BYTE( "136081-1001.65r", 0x000001, 0x20000, CRC(3af31444) SHA1(91fc02786b82abdf12ebdbaacdd1f158f8ce6d06) )
ROM_LOAD16_BYTE( "136081-1002.65n", 0x000000, 0x20000, CRC(f1d76a4c) SHA1(ca769d2cdd096f4a54f7bcaa4840fc9ffaabf499) )
ROM_LOAD16_BYTE( "136081-1003.70r", 0x040001, 0x20000, CRC(28c41c2a) SHA1(75cd527f98c8475e3b880f53c5a355d6c3bd8766) )
@@ -1171,7 +1153,7 @@ ROM_START( pitfightb )
ROM_REGION( 0x020000, "gfx2", 0 )
ROM_LOAD( "136081-1027.15l", 0x000000, 0x10000, CRC(a59f381d) SHA1(b14e878340ad2adbf4f6d4fc331c58f62037c7c7) ) /* alphanumerics */
- ROM_REGION16_BE( 0x200000, "gfx3", 0 )
+ ROM_REGION16_BE( 0x200000, "rle", 0 )
ROM_LOAD16_BYTE( "136081-1001.65r", 0x000001, 0x20000, CRC(3af31444) SHA1(91fc02786b82abdf12ebdbaacdd1f158f8ce6d06) )
ROM_LOAD16_BYTE( "136081-1002.65n", 0x000000, 0x20000, CRC(f1d76a4c) SHA1(ca769d2cdd096f4a54f7bcaa4840fc9ffaabf499) )
ROM_LOAD16_BYTE( "136081-1003.70r", 0x040001, 0x20000, CRC(28c41c2a) SHA1(75cd527f98c8475e3b880f53c5a355d6c3bd8766) )
diff --git a/src/mame/drivers/atarig42.c b/src/mame/drivers/atarig42.c
index 0b04e719eae..e4dcc403e73 100644
--- a/src/mame/drivers/atarig42.c
+++ b/src/mame/drivers/atarig42.c
@@ -93,7 +93,7 @@ WRITE16_MEMBER(atarig42_state::io_latch_w)
asic65_reset(machine(), (~data >> 14) & 1);
/* bits 13-11 are the MO control bits */
- atarirle_control_w(m_rle, (data >> 11) & 7);
+ m_rle->control_write(space, 0, (data >> 11) & 7);
}
/* lower byte */
@@ -114,7 +114,7 @@ WRITE16_MEMBER(atarig42_state::io_latch_w)
WRITE16_MEMBER(atarig42_state::mo_command_w)
{
COMBINE_DATA(m_mo_command);
- atarirle_command_w(m_rle, (data == 0) ? ATARIRLE_COMMAND_CHECKSUM : ATARIRLE_COMMAND_DRAW);
+ m_rle->command_write(space, offset, (data == 0) ? ATARIRLE_COMMAND_CHECKSUM : ATARIRLE_COMMAND_DRAW);
}
@@ -347,7 +347,7 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, atarig42_state )
AM_RANGE(0xf80000, 0xf80003) AM_WRITE_LEGACY(asic65_data_w)
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(0xff0000, 0xff0fff) AM_RAM AM_SHARE("rle")
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")
@@ -487,15 +487,11 @@ static GFXDECODE_START( atarig42 )
GFXDECODE_END
-static const atarirle_desc modesc_0x200 =
+static const atari_rle_objects_config modesc_0x200 =
{
- "gfx3", /* region where the GFX data lives */
- 256, /* number of entries in sprite RAM */
0, /* left clip coordinate */
0, /* right clip coordinate */
-
0x200, /* base palette entry */
- 0x400, /* maximum number of colors */
{{ 0x7fff,0,0,0,0,0,0,0 }}, /* mask for the code index */
{{ 0,0x01f0,0,0,0,0,0,0 }}, /* mask for the color */
@@ -509,15 +505,11 @@ static const atarirle_desc modesc_0x200 =
};
-static const atarirle_desc modesc_0x400 =
+static const atari_rle_objects_config modesc_0x400 =
{
- "gfx3", /* region where the GFX data lives */
- 256, /* number of entries in sprite RAM */
0, /* left clip coordinate */
0, /* right clip coordinate */
-
0x400, /* base palette entry */
- 0x400, /* maximum number of colors */
{{ 0x7fff,0,0,0,0,0,0,0 }}, /* mask for the code index */
{{ 0,0x03f0,0,0,0,0,0,0 }}, /* mask for the color */
@@ -565,7 +557,6 @@ static MACHINE_CONFIG_START( atarig42, atarig42_state )
/* the board uses an SOS chip to generate video signals */
MCFG_SCREEN_RAW_PARAMS(ATARI_CLOCK_14MHz/2, 456, 0, 336, 262, 0, 240)
MCFG_SCREEN_UPDATE_DRIVER(atarig42_state, screen_update_atarig42)
- MCFG_SCREEN_VBLANK_DRIVER(atarig42_state, screen_eof_atarig42)
MCFG_VIDEO_START_OVERRIDE(atarig42_state,atarig42)
@@ -578,11 +569,11 @@ static MACHINE_CONFIG_START( atarig42, atarig42_state )
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( atarig42_0x200, atarig42 )
- MCFG_ATARIRLE_ADD( "rle", modesc_0x200 )
+ MCFG_ATARIRLE_ADD("rle", modesc_0x200)
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( atarig42_0x400, atarig42 )
- MCFG_ATARIRLE_ADD( "rle", modesc_0x400 )
+ MCFG_ATARIRLE_ADD("rle", modesc_0x400)
MACHINE_CONFIG_END
@@ -619,7 +610,7 @@ ROM_START( roadriot )
ROM_REGION( 0x020000, "gfx2", 0 )
ROM_LOAD( "136089-1046.22j", 0x000000, 0x20000, CRC(0005bab0) SHA1(257e1b23eea117fe6701a67134b96d9d9fe10caf) ) /* alphanumerics */
- ROM_REGION16_BE( 0x200000, "gfx3", 0 )
+ ROM_REGION16_BE( 0x200000, "rle", 0 )
ROM_LOAD16_BYTE( "136089-1018.2s", 0x000000, 0x20000, CRC(19590a94) SHA1(e375b7e01a8b1f366bb4e7750e33f0b6d9ae2042) )
ROM_LOAD16_BYTE( "136089-1017.2p", 0x000001, 0x20000, CRC(c2bf3f69) SHA1(f822359070b1907973ee7ee35469f4a59f720830) )
ROM_LOAD16_BYTE( "136089-1020.3s", 0x040000, 0x20000, CRC(bab110e4) SHA1(0c4e3521474249517e7832df1bc63aca6d6a6c91) )
@@ -677,7 +668,7 @@ ROM_START( roadrioto )
ROM_REGION( 0x020000, "gfx2", 0 )
ROM_LOAD( "136089-1046.22j", 0x000000, 0x20000, CRC(0005bab0) SHA1(257e1b23eea117fe6701a67134b96d9d9fe10caf) ) /* alphanumerics */
- ROM_REGION16_BE( 0x200000, "gfx3", 0 )
+ ROM_REGION16_BE( 0x200000, "rle", 0 )
ROM_LOAD16_BYTE( "136089-1018.2s", 0x000000, 0x20000, CRC(19590a94) SHA1(e375b7e01a8b1f366bb4e7750e33f0b6d9ae2042) )
ROM_LOAD16_BYTE( "136089-1017.2p", 0x000001, 0x20000, CRC(c2bf3f69) SHA1(f822359070b1907973ee7ee35469f4a59f720830) )
ROM_LOAD16_BYTE( "136089-1020.3s", 0x040000, 0x20000, CRC(bab110e4) SHA1(0c4e3521474249517e7832df1bc63aca6d6a6c91) )
@@ -733,7 +724,7 @@ ROM_START( guardian )
ROM_REGION( 0x020000, "gfx2", 0 )
ROM_LOAD( "136092-0030.23k", 0x000000, 0x20000, CRC(0fd7baa1) SHA1(7802d732e5173291628ed498ad0fab71aeef4688) ) /* alphanumerics */
- ROM_REGION16_BE( 0x600000, "gfx3", 0 )
+ ROM_REGION16_BE( 0x600000, "rle", 0 )
ROM_LOAD16_BYTE( "136092-0041.2s", 0x000000, 0x80000, CRC(a2a5ae08) SHA1(d99f925bbc9a72432e13328ee8422fde615db90f) )
ROM_LOAD16_BYTE( "136092-0040.2p", 0x000001, 0x80000, CRC(ef95132e) SHA1(288de1d15956a612b7d19ceb2cf853490bf42b05) )
ROM_LOAD16_BYTE( "136092-0043.3s", 0x100000, 0x80000, CRC(6438b8e4) SHA1(ee1446209fbcab8b17c88c53b65e754a85f279d1) )
diff --git a/src/mame/drivers/atarigt.c b/src/mame/drivers/atarigt.c
index 25366b8c0d6..b8777789cc1 100644
--- a/src/mame/drivers/atarigt.c
+++ b/src/mame/drivers/atarigt.c
@@ -219,7 +219,7 @@ WRITE32_MEMBER(atarigt_state::latch_w)
if (ACCESSING_BITS_24_31)
{
/* bits 13-11 are the MO control bits */
- atarirle_control_w(m_rle, (data >> 27) & 7);
+ m_rle->control_write(space, offset, (data >> 27) & 7);
}
if (ACCESSING_BITS_16_23)
@@ -235,7 +235,7 @@ WRITE32_MEMBER(atarigt_state::mo_command_w)
{
COMBINE_DATA(m_mo_command);
if (ACCESSING_BITS_0_15)
- atarirle_command_w(m_rle, ((data & 0xffff) == 2) ? ATARIRLE_COMMAND_CHECKSUM : ATARIRLE_COMMAND_DRAW);
+ m_rle->command_write(space, offset, ((data & 0xffff) == 2) ? ATARIRLE_COMMAND_CHECKSUM : ATARIRLE_COMMAND_DRAW);
}
@@ -620,7 +620,7 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 32, atarigt_state )
AM_RANGE(0xd40000, 0xd4ffff) AM_WRITE16(eeprom_enable_w, 0xffffffff)
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(0xd78000, 0xd78fff) AM_RAM AM_SHARE("rle")
AM_RANGE(0xd7a200, 0xd7a203) AM_WRITE(mo_command_w) AM_SHARE("mo_command")
AM_RANGE(0xd70000, 0xd7ffff) AM_RAM
AM_RANGE(0xd80000, 0xdfffff) AM_READWRITE(colorram_protection_r, colorram_protection_w) AM_SHARE("colorram")
@@ -790,15 +790,11 @@ static GFXDECODE_START( atarigt )
GFXDECODE_END
-static const atarirle_desc modesc =
+static const atari_rle_objects_config modesc =
{
- "gfx3", /* region where the GFX data lives */
- 256, /* number of entries in sprite RAM */
0, /* left clip coordinate */
0, /* right clip coordinate */
-
0x0000, /* base palette entry */
- 0x1000, /* maximum number of colors */
{{ 0x7fff,0,0,0,0,0,0,0 }}, /* mask for the code index */
{{ 0,0x0ff0,0,0,0,0,0,0 }}, /* mask for the color */
@@ -843,7 +839,6 @@ static MACHINE_CONFIG_START( atarigt, atarigt_state )
/* the board uses a pair of GALs to determine H and V parameters */
MCFG_SCREEN_RAW_PARAMS(ATARI_CLOCK_14MHz/2, 456, 0, 336, 262, 0, 240)
MCFG_SCREEN_UPDATE_DRIVER(atarigt_state, screen_update_atarigt)
- MCFG_SCREEN_VBLANK_DRIVER(atarigt_state, screen_eof_atarigt)
MCFG_VIDEO_START_OVERRIDE(atarigt_state,atarigt)
@@ -891,7 +886,7 @@ ROM_START( tmek )
ROM_REGION( 0x020000, "gfx2", 0 )
ROM_LOAD( "0045a", 0x000000, 0x20000, CRC(057a5304) SHA1(d44c0cf885a1324888b7e8118f124c0dae616859) ) /* alphanumerics */
- ROM_REGION16_BE( 0x1000000, "gfx3", 0 )
+ ROM_REGION16_BE( 0x1000000, "rle", 0 )
ROM_LOAD16_BYTE( "0300", 0x000001, 0x100000, CRC(8367ddac) SHA1(9ca77962259284cef8a261b652ab1327817ee8d0) )
ROM_LOAD16_BYTE( "0301", 0x000000, 0x100000, CRC(94524b5b) SHA1(db401fd7ba56658fcb614406672c02569d845930) )
ROM_LOAD16_BYTE( "0302", 0x200001, 0x100000, CRC(c03f1aa7) SHA1(c68b52280d0695629c843b9c90f7a39713e063b0) )
@@ -946,7 +941,7 @@ ROM_START( tmek51p )
ROM_REGION( 0x020000, "gfx2", 0 )
ROM_LOAD( "0045a", 0x000000, 0x20000, CRC(057a5304) SHA1(d44c0cf885a1324888b7e8118f124c0dae616859) ) /* alphanumerics */
- ROM_REGION16_BE( 0x1000000, "gfx3", 0 )
+ ROM_REGION16_BE( 0x1000000, "rle", 0 )
ROM_LOAD16_BYTE( "0300", 0x000001, 0x100000, CRC(8367ddac) SHA1(9ca77962259284cef8a261b652ab1327817ee8d0) )
ROM_LOAD16_BYTE( "0301", 0x000000, 0x100000, CRC(94524b5b) SHA1(db401fd7ba56658fcb614406672c02569d845930) )
ROM_LOAD16_BYTE( "0302", 0x200001, 0x100000, CRC(c03f1aa7) SHA1(c68b52280d0695629c843b9c90f7a39713e063b0) )
@@ -1001,7 +996,7 @@ ROM_START( tmek45 )
ROM_REGION( 0x020000, "gfx2", 0 )
ROM_LOAD( "0045a", 0x000000, 0x20000, CRC(057a5304) SHA1(d44c0cf885a1324888b7e8118f124c0dae616859) ) /* alphanumerics */
- ROM_REGION16_BE( 0x1000000, "gfx3", 0 )
+ ROM_REGION16_BE( 0x1000000, "rle", 0 )
ROM_LOAD16_BYTE( "0300", 0x000001, 0x100000, CRC(8367ddac) SHA1(9ca77962259284cef8a261b652ab1327817ee8d0) )
ROM_LOAD16_BYTE( "0301", 0x000000, 0x100000, CRC(94524b5b) SHA1(db401fd7ba56658fcb614406672c02569d845930) )
ROM_LOAD16_BYTE( "0302", 0x200001, 0x100000, CRC(c03f1aa7) SHA1(c68b52280d0695629c843b9c90f7a39713e063b0) )
@@ -1056,7 +1051,7 @@ ROM_START( tmek44 )
ROM_REGION( 0x020000, "gfx2", 0 )
ROM_LOAD( "0045a", 0x000000, 0x20000, CRC(057a5304) SHA1(d44c0cf885a1324888b7e8118f124c0dae616859) ) /* alphanumerics */
- ROM_REGION16_BE( 0x1000000, "gfx3", 0 )
+ ROM_REGION16_BE( 0x1000000, "rle", 0 )
ROM_LOAD16_BYTE( "0300", 0x000001, 0x100000, CRC(8367ddac) SHA1(9ca77962259284cef8a261b652ab1327817ee8d0) )
ROM_LOAD16_BYTE( "0301", 0x000000, 0x100000, CRC(94524b5b) SHA1(db401fd7ba56658fcb614406672c02569d845930) )
ROM_LOAD16_BYTE( "0302", 0x200001, 0x100000, CRC(c03f1aa7) SHA1(c68b52280d0695629c843b9c90f7a39713e063b0) )
@@ -1111,7 +1106,7 @@ ROM_START( tmek20 )
ROM_REGION( 0x020000, "gfx2", 0 )
ROM_LOAD( "alpha", 0x000000, 0x20000, CRC(8f57a604) SHA1(f076636430ff73ea11e4687ef7b21a7bac1d8e34) ) /* alphanumerics */
- ROM_REGION16_BE( 0x1000000, "gfx3", 0 )
+ ROM_REGION16_BE( 0x1000000, "rle", 0 )
ROM_LOAD16_BYTE( "0300", 0x000001, 0x100000, CRC(8367ddac) SHA1(9ca77962259284cef8a261b652ab1327817ee8d0) )
ROM_LOAD16_BYTE( "0301", 0x000000, 0x100000, CRC(94524b5b) SHA1(db401fd7ba56658fcb614406672c02569d845930) )
ROM_LOAD16_BYTE( "0302", 0x200001, 0x100000, CRC(c03f1aa7) SHA1(c68b52280d0695629c843b9c90f7a39713e063b0) )
@@ -1158,7 +1153,7 @@ ROM_START( primrage )
ROM_REGION( 0x020000, "gfx2", 0 )
ROM_LOAD( "136102-1045b.23p", 0x000000, 0x20000, CRC(1d3260bf) SHA1(85d9db8499cbe180c8d52710f3cfe64453a530ff) ) /* alphanumerics */
- ROM_REGION16_BE( 0x2000000, "gfx3", 0 )
+ ROM_REGION16_BE( 0x2000000, "rle", 0 )
ROM_LOAD16_BYTE( "136102-1100a.2v", 0x0000001, 0x080000, CRC(6e9c80b5) SHA1(ec724011527dd8707c733211b1a6c51b22f580c7) )
ROM_LOAD16_BYTE( "136102-1101a.2w", 0x0000000, 0x080000, CRC(bb7ee624) SHA1(0de6385aee7d25b41fd5bf232e44e5da536504ac) )
ROM_LOAD16_BYTE( "136102-0332.mol1.0", 0x0800001, 0x100000, CRC(610cfcb4) SHA1(bed1bd0d11c0a7cc48d020fc0acec34daf48c5ac) )
@@ -1244,7 +1239,7 @@ ROM_START( primrage20 )
ROM_REGION( 0x020000, "gfx2", 0 )
ROM_LOAD( "136102-0045a.23p", 0x000000, 0x20000, CRC(c8b39b1c) SHA1(836c0ccf96b2beccacf6d8ac23981fc2d1f09803) ) /* alphanumerics */
- ROM_REGION16_BE( 0x2000000, "gfx3", 0 )
+ ROM_REGION16_BE( 0x2000000, "rle", 0 )
ROM_LOAD16_BYTE( "136102-0100a.2v", 0x0000001, 0x080000, CRC(5299fb2a) SHA1(791378215ab6ffff3ab2ae7192ce9f88dae4090d) )
ROM_LOAD16_BYTE( "136102-0101a.2w", 0x0000000, 0x080000, CRC(3e234711) SHA1(6a9f19db2b4c8c34d3d7b4984206e3d5c4398d7f) )
ROM_LOAD16_BYTE( "136102-0332.mol1.0", 0x0800001, 0x100000, CRC(610cfcb4) SHA1(bed1bd0d11c0a7cc48d020fc0acec34daf48c5ac) )
diff --git a/src/mame/drivers/atarigx2.c b/src/mame/drivers/atarigx2.c
index b3a8ef8a148..95854ea1070 100644
--- a/src/mame/drivers/atarigx2.c
+++ b/src/mame/drivers/atarigx2.c
@@ -103,7 +103,7 @@ WRITE32_MEMBER(atarigx2_state::latch_w)
if (ACCESSING_BITS_24_31)
{
/* bits 13-11 are the MO control bits */
- atarirle_control_w(m_rle, (data >> 27) & 7);
+ m_rle->control_write(space, offset, (data >> 27) & 7);
}
/* lower byte */
@@ -116,7 +116,7 @@ WRITE32_MEMBER(atarigx2_state::mo_command_w)
{
COMBINE_DATA(m_mo_command);
if (ACCESSING_BITS_0_15)
- atarirle_command_w(m_rle, ((data & 0xffff) == 2) ? ATARIRLE_COMMAND_CHECKSUM : ATARIRLE_COMMAND_DRAW);
+ m_rle->command_write(space, offset, ((data & 0xffff) == 2) ? ATARIRLE_COMMAND_CHECKSUM : ATARIRLE_COMMAND_DRAW);
}
@@ -1139,7 +1139,7 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 32, atarigx2_state )
AM_RANGE(0xd40000, 0xd40fff) AM_RAM_WRITE(paletteram32_666_w) AM_SHARE("paletteram")
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(0xd78000, 0xd78fff) AM_RAM AM_SHARE("rle")
AM_RANGE(0xd7a200, 0xd7a203) AM_WRITE(mo_command_w) AM_SHARE("mo_command")
AM_RANGE(0xd70000, 0xd7ffff) AM_RAM
AM_RANGE(0xd80000, 0xd9ffff) AM_WRITE16(eeprom_enable_w, 0xffffffff)
@@ -1356,15 +1356,11 @@ static GFXDECODE_START( atarigx2 )
GFXDECODE_ENTRY( "gfx1", 0, pftoplayout, 0x000, 64 )
GFXDECODE_END
-static const atarirle_desc modesc_0x200 =
+static const atari_rle_objects_config modesc_0x200 =
{
- "gfx3", /* region where the GFX data lives */
- 256, /* number of entries in sprite RAM */
0, /* left clip coordinate */
0, /* right clip coordinate */
-
0x200, /* base palette entry */
- 0x400, /* maximum number of colors */
{{ 0x7fff,0,0,0,0,0,0,0 }}, /* mask for the code index */
{{ 0,0x01f0,0,0,0,0,0,0 }}, /* mask for the color */
@@ -1377,15 +1373,11 @@ static const atarirle_desc modesc_0x200 =
{{ 0 }} /* mask for the VRAM target */
};
-static const atarirle_desc modesc_0x400 =
+static const atari_rle_objects_config modesc_0x400 =
{
- "gfx3", /* region where the GFX data lives */
- 256, /* number of entries in sprite RAM */
0, /* left clip coordinate */
0, /* right clip coordinate */
-
0x400, /* base palette entry */
- 0x400, /* maximum number of colors */
{{ 0x7fff,0,0,0,0,0,0,0 }}, /* mask for the code index */
{{ 0,0x03f0,0,0,0,0,0,0 }}, /* mask for the color */
@@ -1429,7 +1421,6 @@ static MACHINE_CONFIG_START( atarigx2, atarigx2_state )
/* the board uses a pair of GALs to determine H and V parameters */
MCFG_SCREEN_RAW_PARAMS(ATARI_CLOCK_14MHz/2, 456, 0, 336, 262, 0, 240)
MCFG_SCREEN_UPDATE_DRIVER(atarigx2_state, screen_update_atarigx2)
- MCFG_SCREEN_VBLANK_DRIVER(atarigx2_state, screen_eof_atarigx2)
MCFG_VIDEO_START_OVERRIDE(atarigx2_state,atarigx2)
@@ -1444,11 +1435,11 @@ MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( atarigx2_0x200, atarigx2 )
- MCFG_ATARIRLE_ADD( "rle", modesc_0x200 )
+ MCFG_ATARIRLE_ADD("rle", modesc_0x200)
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( atarigx2_0x400, atarigx2 )
- MCFG_ATARIRLE_ADD( "rle", modesc_0x400 )
+ MCFG_ATARIRLE_ADD("rle", modesc_0x400)
MACHINE_CONFIG_END
@@ -1478,7 +1469,7 @@ ROM_START( spclords )
ROM_REGION( 0x020000, "gfx2", 0 )
ROM_LOAD( "136095.25a", 0x000000, 0x20000, CRC(1669496e) SHA1(005deaafd6156505e3a27966123e58928837ad9f) ) /* alphanumerics */
- ROM_REGION16_BE( 0x600000, "gfx3", 0 )
+ ROM_REGION16_BE( 0x600000, "rle", 0 )
ROM_LOAD16_BYTE( "136095.41b", 0x000000, 0x80000, CRC(02ce7e07) SHA1(a48a6930c8ca4e2d0e4bc77a558730fa790be3b5) )
ROM_LOAD16_BYTE( "136095.40b", 0x000001, 0x80000, CRC(abb80720) SHA1(0e02688454f59b90d38d548808f794294f5c9e7e) )
ROM_LOAD16_BYTE( "136095.43b", 0x100000, 0x80000, CRC(26526345) SHA1(30ef83f63aca3a846dfc2828e3147208e3e350ca) )
@@ -1524,7 +1515,7 @@ ROM_START( spclordsb )
ROM_REGION( 0x020000, "gfx2", 0 )
ROM_LOAD( "136095.25a", 0x000000, 0x20000, CRC(1669496e) SHA1(005deaafd6156505e3a27966123e58928837ad9f) ) /* alphanumerics */
- ROM_REGION16_BE( 0x600000, "gfx3", 0 )
+ ROM_REGION16_BE( 0x600000, "rle", 0 )
ROM_LOAD16_BYTE( "136095.41b", 0x000000, 0x80000, CRC(02ce7e07) SHA1(a48a6930c8ca4e2d0e4bc77a558730fa790be3b5) )
ROM_LOAD16_BYTE( "136095.40b", 0x000001, 0x80000, CRC(abb80720) SHA1(0e02688454f59b90d38d548808f794294f5c9e7e) )
ROM_LOAD16_BYTE( "136095.43b", 0x100000, 0x80000, CRC(26526345) SHA1(30ef83f63aca3a846dfc2828e3147208e3e350ca) )
@@ -1570,7 +1561,7 @@ ROM_START( spclordsg )
ROM_REGION( 0x020000, "gfx2", 0 )
ROM_LOAD( "136095.25a", 0x000000, 0x20000, CRC(1669496e) SHA1(005deaafd6156505e3a27966123e58928837ad9f) ) /* alphanumerics */
- ROM_REGION16_BE( 0x600000, "gfx3", 0 )
+ ROM_REGION16_BE( 0x600000, "rle", 0 )
ROM_LOAD16_BYTE( "136095.41a", 0x000000, 0x80000, CRC(5f9743ee) SHA1(fa521572f8dd2eda566f90d1345adba3d0b8c48f) )
ROM_LOAD16_BYTE( "136095.40a", 0x000001, 0x80000, CRC(99b26863) SHA1(21682771d310c73d4431dde5e72398a69a6f3d53) )
ROM_LOAD16_BYTE( "136095.43a", 0x100000, 0x80000, CRC(9c0e09a5) SHA1(039dc52318935f686230f57a7b39b9c62280cbf9) )
@@ -1616,7 +1607,7 @@ ROM_START( spclordsa )
ROM_REGION( 0x020000, "gfx2", 0 )
ROM_LOAD( "136095.25a", 0x000000, 0x20000, CRC(1669496e) SHA1(005deaafd6156505e3a27966123e58928837ad9f) ) /* alphanumerics */
- ROM_REGION16_BE( 0x600000, "gfx3", 0 )
+ ROM_REGION16_BE( 0x600000, "rle", 0 )
ROM_LOAD16_BYTE( "136095.41a", 0x000000, 0x80000, CRC(5f9743ee) SHA1(fa521572f8dd2eda566f90d1345adba3d0b8c48f) )
ROM_LOAD16_BYTE( "136095.40a", 0x000001, 0x80000, CRC(99b26863) SHA1(21682771d310c73d4431dde5e72398a69a6f3d53) )
ROM_LOAD16_BYTE( "136095.43a", 0x100000, 0x80000, CRC(9c0e09a5) SHA1(039dc52318935f686230f57a7b39b9c62280cbf9) )
@@ -1662,7 +1653,7 @@ ROM_START( motofren )
ROM_REGION( 0x020000, "gfx2", 0 )
ROM_LOAD( "136094-0025a.13n", 0x000000, 0x20000, CRC(6ab762ad) SHA1(c52dd207ff5adaffa458e020e7d452a1d1e65194) ) /* alphanumerics */
- ROM_REGION16_BE( 0x700000, "gfx3", 0 )
+ ROM_REGION16_BE( 0x700000, "rle", 0 )
ROM_LOAD16_BYTE( "136094-0041a.31n", 0x000000, 0x80000, CRC(474770e9) SHA1(507dac654d1c350ab530892e3ec19793629d3a07) )
ROM_LOAD16_BYTE( "136094-0040a.31l", 0x000001, 0x80000, CRC(cb777468) SHA1(aa199bc02ab966b9f270057857aec50add8d684c) )
ROM_LOAD16_BYTE( "136094-0043a.33n", 0x100000, 0x80000, CRC(353d2dc3) SHA1(82c2c862404ea4c94c9baee1d0ac32696fcf78bd) )
@@ -1710,7 +1701,7 @@ ROM_START( motofrenmd )
ROM_REGION( 0x020000, "gfx2", 0 )
ROM_LOAD( "136094-0025a.13n", 0x000000, 0x20000, CRC(6ab762ad) SHA1(c52dd207ff5adaffa458e020e7d452a1d1e65194) ) /* alphanumerics */
- ROM_REGION16_BE( 0x700000, "gfx3", 0 )
+ ROM_REGION16_BE( 0x700000, "rle", 0 )
ROM_LOAD16_BYTE( "136094-0041a.31n", 0x000000, 0x80000, CRC(474770e9) SHA1(507dac654d1c350ab530892e3ec19793629d3a07) )
ROM_LOAD16_BYTE( "136094-0040a.31l", 0x000001, 0x80000, CRC(cb777468) SHA1(aa199bc02ab966b9f270057857aec50add8d684c) )
ROM_LOAD16_BYTE( "136094-0043a.33n", 0x100000, 0x80000, CRC(353d2dc3) SHA1(82c2c862404ea4c94c9baee1d0ac32696fcf78bd) )
@@ -1762,7 +1753,7 @@ ROM_START( motofrei )
ROM_REGION( 0x020000, "gfx2", 0 )
ROM_LOAD( "136094-0025a.13n", 0x000000, 0x20000, CRC(6ab762ad) SHA1(c52dd207ff5adaffa458e020e7d452a1d1e65194) ) /* alphanumerics */
- ROM_REGION16_BE( 0x700000, "gfx3", 0 )
+ ROM_REGION16_BE( 0x700000, "rle", 0 )
ROM_LOAD16_BYTE( "136094-0041a.31n", 0x000000, 0x80000, CRC(474770e9) SHA1(507dac654d1c350ab530892e3ec19793629d3a07) )
ROM_LOAD16_BYTE( "136094-0040a.31l", 0x000001, 0x80000, CRC(cb777468) SHA1(aa199bc02ab966b9f270057857aec50add8d684c) )
ROM_LOAD16_BYTE( "136094-0043a.33n", 0x100000, 0x80000, CRC(353d2dc3) SHA1(82c2c862404ea4c94c9baee1d0ac32696fcf78bd) )
@@ -1811,7 +1802,7 @@ ROM_START( motofreg )
ROM_REGION( 0x020000, "gfx2", 0 )
ROM_LOAD( "136094-0025a.13n", 0x000000, 0x20000, CRC(6ab762ad) SHA1(c52dd207ff5adaffa458e020e7d452a1d1e65194) ) /* alphanumerics */
- ROM_REGION16_BE( 0x700000, "gfx3", 0 )
+ ROM_REGION16_BE( 0x700000, "rle", 0 )
ROM_LOAD16_BYTE( "136094-0041a.31n", 0x000000, 0x80000, CRC(474770e9) SHA1(507dac654d1c350ab530892e3ec19793629d3a07) )
ROM_LOAD16_BYTE( "136094-0040a.31l", 0x000001, 0x80000, CRC(cb777468) SHA1(aa199bc02ab966b9f270057857aec50add8d684c) )
ROM_LOAD16_BYTE( "136094-0043a.33n", 0x100000, 0x80000, CRC(353d2dc3) SHA1(82c2c862404ea4c94c9baee1d0ac32696fcf78bd) )
@@ -1860,7 +1851,7 @@ ROM_START( motofmdg )
ROM_REGION( 0x020000, "gfx2", 0 )
ROM_LOAD( "136094-0025a.13n", 0x000000, 0x20000, CRC(6ab762ad) SHA1(c52dd207ff5adaffa458e020e7d452a1d1e65194) ) /* alphanumerics */
- ROM_REGION16_BE( 0x700000, "gfx3", 0 )
+ ROM_REGION16_BE( 0x700000, "rle", 0 )
ROM_LOAD16_BYTE( "136094-0041a.31n", 0x000000, 0x80000, CRC(474770e9) SHA1(507dac654d1c350ab530892e3ec19793629d3a07) )
ROM_LOAD16_BYTE( "136094-0040a.31l", 0x000001, 0x80000, CRC(cb777468) SHA1(aa199bc02ab966b9f270057857aec50add8d684c) )
ROM_LOAD16_BYTE( "136094-0043a.33n", 0x100000, 0x80000, CRC(353d2dc3) SHA1(82c2c862404ea4c94c9baee1d0ac32696fcf78bd) )
@@ -1908,7 +1899,7 @@ ROM_START( motofrenft )
ROM_REGION( 0x020000, "gfx2", 0 )
ROM_LOAD( "136094-0025a.13n", 0x000000, 0x20000, CRC(6ab762ad) SHA1(c52dd207ff5adaffa458e020e7d452a1d1e65194) ) /* alphanumerics */
- ROM_REGION16_BE( 0x700000, "gfx3", 0 )
+ ROM_REGION16_BE( 0x700000, "rle", 0 )
ROM_LOAD16_BYTE( "136094-0041a.31n", 0x000000, 0x80000, CRC(474770e9) SHA1(507dac654d1c350ab530892e3ec19793629d3a07) )
ROM_LOAD16_BYTE( "136094-0040a.31l", 0x000001, 0x80000, CRC(cb777468) SHA1(aa199bc02ab966b9f270057857aec50add8d684c) )
ROM_LOAD16_BYTE( "136094-0043a.33n", 0x100000, 0x80000, CRC(353d2dc3) SHA1(82c2c862404ea4c94c9baee1d0ac32696fcf78bd) )
@@ -1956,7 +1947,7 @@ ROM_START( motofrenmf )
ROM_REGION( 0x020000, "gfx2", 0 )
ROM_LOAD( "136094-0025a.13n", 0x000000, 0x20000, CRC(6ab762ad) SHA1(c52dd207ff5adaffa458e020e7d452a1d1e65194) ) /* alphanumerics */
- ROM_REGION16_BE( 0x700000, "gfx3", 0 )
+ ROM_REGION16_BE( 0x700000, "rle", 0 )
ROM_LOAD16_BYTE( "136094-0041a.31n", 0x000000, 0x80000, CRC(474770e9) SHA1(507dac654d1c350ab530892e3ec19793629d3a07) )
ROM_LOAD16_BYTE( "136094-0040a.31l", 0x000001, 0x80000, CRC(cb777468) SHA1(aa199bc02ab966b9f270057857aec50add8d684c) )
ROM_LOAD16_BYTE( "136094-0043a.33n", 0x100000, 0x80000, CRC(353d2dc3) SHA1(82c2c862404ea4c94c9baee1d0ac32696fcf78bd) )
@@ -2000,7 +1991,7 @@ ROM_START( rrreveng )
ROM_REGION( 0x020000, "gfx2", 0 )
ROM_LOAD( "alpha.13n", 0x000000, 0x20000, CRC(f2efbd66) SHA1(d5339f0b3de7a102d659f7459b5f4800cab31829) ) /* alphanumerics */
- ROM_REGION16_BE( 0x500000, "gfx3", 0 )
+ ROM_REGION16_BE( 0x500000, "rle", 0 )
ROM_LOAD16_BYTE( "mo0h.31n", 0x000000, 0x80000, CRC(fc2755d5) SHA1(e24319161307efbb3828b21a6250869051f1ccc1) )
ROM_LOAD16_BYTE( "mo0l.31l", 0x000001, 0x80000, CRC(f9f6bfe3) SHA1(c7e1479bb86646691d5ca7ee9127553cfd86571e) )
ROM_LOAD16_BYTE( "rrmo1h.33n", 0x100000, 0x80000, CRC(c7a48389) SHA1(a263aa4829cb243440ebe0496dd4f0158d97e2cc) )
@@ -2066,7 +2057,7 @@ ROM_START( rrrevenga ) /* Same program roms as the set below, but shares more ro
ROM_REGION( 0x020000, "gfx2", 0 )
ROM_LOAD( "alpha.13n", 0x000000, 0x20000, CRC(f2efbd66) SHA1(d5339f0b3de7a102d659f7459b5f4800cab31829) ) /* alphanumerics */
- ROM_REGION16_BE( 0x500000, "gfx3", 0 )
+ ROM_REGION16_BE( 0x500000, "rle", 0 )
ROM_LOAD16_BYTE( "mo0h.31n", 0x000000, 0x80000, CRC(fc2755d5) SHA1(e24319161307efbb3828b21a6250869051f1ccc1) )
ROM_LOAD16_BYTE( "mo0l.31l", 0x000001, 0x80000, CRC(f9f6bfe3) SHA1(c7e1479bb86646691d5ca7ee9127553cfd86571e) )
ROM_LOAD16_BYTE( "rrmo1h.33n", 0x100000, 0x80000, CRC(c7a48389) SHA1(a263aa4829cb243440ebe0496dd4f0158d97e2cc) )
@@ -2126,7 +2117,7 @@ ROM_START( rrrevengb )
ROM_REGION( 0x020000, "gfx2", 0 )
ROM_LOAD( "rralalph.13n", 0x000000, 0x20000, CRC(7ca93790) SHA1(5e2f069be4b15d63f418c8693e8550eb0ae22381) ) /* alphanumerics */
- ROM_REGION16_BE( 0x500000, "gfx3", 0 )
+ ROM_REGION16_BE( 0x500000, "rle", 0 )
ROM_LOAD16_BYTE( "rrmo0h.31n", 0x000000, 0x80000, CRC(9b7e0315) SHA1(856804e89f586a4e777da5f47dc29c4e34175f44) )
ROM_LOAD16_BYTE( "rrmo0l.31l", 0x000001, 0x80000, CRC(10478697) SHA1(9682e82cfbdc20f63d5c49303265c598a334c15b) )
ROM_LOAD16_BYTE( "rrmo1h.33n", 0x100000, 0x80000, CRC(c7a48389) SHA1(a263aa4829cb243440ebe0496dd4f0158d97e2cc) )
diff --git a/src/mame/includes/atarig1.h b/src/mame/includes/atarig1.h
index a729f24810e..58d49be939d 100644
--- a/src/mame/includes/atarig1.h
+++ b/src/mame/includes/atarig1.h
@@ -17,12 +17,14 @@ public:
m_jsa(*this, "jsa"),
m_playfield_tilemap(*this, "playfield"),
m_alpha_tilemap(*this, "alpha"),
+ m_rle(*this, "rle"),
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;
+ required_device<atari_rle_objects_device> m_rle;
bool m_is_pitfight;
@@ -40,7 +42,6 @@ public:
UINT16 m_playfield_xscroll;
UINT16 m_playfield_yscroll;
- device_t * m_rle;
virtual void device_post_load();
virtual void update_interrupts();
virtual void scanline_update(screen_device &screen, int scanline);
@@ -64,7 +65,6 @@ public:
DECLARE_MACHINE_RESET(atarig1);
DECLARE_VIDEO_START(atarig1);
UINT32 screen_update_atarig1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- void screen_eof_atarig1(screen_device &screen, bool state);
private:
void init_common(offs_t slapstic_base, int slapstic, bool is_pitfight);
void pitfightb_cheap_slapstic_init();
diff --git a/src/mame/includes/atarig42.h b/src/mame/includes/atarig42.h
index 913d7e94978..22243d85e2b 100644
--- a/src/mame/includes/atarig42.h
+++ b/src/mame/includes/atarig42.h
@@ -17,6 +17,7 @@ public:
m_jsa(*this, "jsa"),
m_playfield_tilemap(*this, "playfield"),
m_alpha_tilemap(*this, "alpha"),
+ m_rle(*this, "rle"),
m_mo_command(*this, "mo_command") { }
required_device<cpu_device> m_maincpu;
@@ -24,6 +25,7 @@ public:
required_device<tilemap_device> m_playfield_tilemap;
required_device<tilemap_device> m_alpha_tilemap;
+ required_device<atari_rle_objects_device> m_rle;
UINT16 m_playfield_base;
@@ -42,7 +44,6 @@ public:
int m_sloop_state;
UINT16 * m_sloop_base;
- device_t * m_rle;
UINT32 m_last_accesses[8];
virtual void update_interrupts();
virtual void scanline_update(screen_device &screen, int scanline);
diff --git a/src/mame/includes/atarigt.h b/src/mame/includes/atarigt.h
index cfa2033e09a..784def2dd92 100644
--- a/src/mame/includes/atarigt.h
+++ b/src/mame/includes/atarigt.h
@@ -21,6 +21,7 @@ public:
m_colorram(*this, "colorram", 32),
m_playfield_tilemap(*this, "playfield"),
m_alpha_tilemap(*this, "alpha"),
+ m_rle(*this, "rle"),
m_mo_command(*this, "mo_command") { }
UINT8 m_is_primrage;
@@ -28,6 +29,7 @@ public:
required_device<tilemap_device> m_playfield_tilemap;
required_device<tilemap_device> m_alpha_tilemap;
+ required_device<atari_rle_objects_device> m_rle;
bitmap_ind16 * m_pf_bitmap;
bitmap_ind16 * m_an_bitmap;
@@ -52,7 +54,6 @@ public:
UINT16 m_protresult;
UINT8 m_protdata[0x800];
- device_t * m_rle;
virtual void update_interrupts();
virtual void scanline_update(screen_device &screen, int scanline);
DECLARE_READ32_MEMBER(special_port2_r);
@@ -79,7 +80,6 @@ public:
DECLARE_MACHINE_RESET(atarigt);
DECLARE_VIDEO_START(atarigt);
UINT32 screen_update_atarigt(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
- void screen_eof_atarigt(screen_device &screen, bool state);
private:
void tmek_update_mode(offs_t offset);
void tmek_protection_w(address_space &space, offs_t offset, UINT16 data);
diff --git a/src/mame/includes/atarigx2.h b/src/mame/includes/atarigx2.h
index febb91aa3c3..0090c3748ba 100644
--- a/src/mame/includes/atarigx2.h
+++ b/src/mame/includes/atarigx2.h
@@ -16,7 +16,8 @@ public:
m_mo_command(*this, "mo_command"),
m_protection_base(*this, "protection_base"),
m_playfield_tilemap(*this, "playfield"),
- m_alpha_tilemap(*this, "alpha") { }
+ m_alpha_tilemap(*this, "alpha"),
+ m_rle(*this, "rle") { }
UINT16 m_playfield_base;
@@ -27,6 +28,7 @@ public:
required_device<tilemap_device> m_playfield_tilemap;
required_device<tilemap_device> m_alpha_tilemap;
+ required_device<atari_rle_objects_device> m_rle;
UINT16 m_current_control;
UINT8 m_playfield_tile_bank;
@@ -37,7 +39,6 @@ public:
UINT16 m_last_write;
UINT16 m_last_write_offset;
- device_t * m_rle;
virtual void update_interrupts();
virtual void scanline_update(screen_device &screen, int scanline);
DECLARE_READ32_MEMBER(special_port2_r);
@@ -58,6 +59,5 @@ public:
DECLARE_MACHINE_RESET(atarigx2);
DECLARE_VIDEO_START(atarigx2);
UINT32 screen_update_atarigx2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- void screen_eof_atarigx2(screen_device &screen, bool state);
DECLARE_WRITE16_MEMBER( atarigx2_mo_control_w );
};
diff --git a/src/mame/video/atarig1.c b/src/mame/video/atarig1.c
index b366bca8027..75321f343bb 100644
--- a/src/mame/video/atarig1.c
+++ b/src/mame/video/atarig1.c
@@ -47,9 +47,6 @@ VIDEO_START_MEMBER(atarig1_state,atarig1)
/* blend the playfields and free the temporary one */
blend_gfx(0, 2, 0x0f, 0x10);
- /* initialize the motion objects */
- m_rle = machine().device("rle");
-
/* reset statics */
m_pfscroll_xoffset = m_is_pitfight ? 2 : 0;
@@ -134,18 +131,9 @@ UINT32 atarig1_state::screen_update_atarig1(screen_device &screen, bitmap_ind16
m_playfield_tilemap->draw(screen, bitmap, cliprect, 0, 0);
/* copy the motion objects on top */
- copybitmap_trans(bitmap, *atarirle_get_vram(m_rle, 0), 0, 0, 0, 0, cliprect, 0);
+ copybitmap_trans(bitmap, m_rle->vram(0), 0, 0, 0, 0, cliprect, 0);
/* add the alpha on top */
m_alpha_tilemap->draw(screen, bitmap, cliprect, 0, 0);
return 0;
}
-
-void atarig1_state::screen_eof_atarig1(screen_device &screen, bool state)
-{
- // rising edge
- if (state)
- {
- atarirle_eof(m_rle);
- }
-}
diff --git a/src/mame/video/atarig42.c b/src/mame/video/atarig42.c
index 3ece114b3ac..41c3ef2f7eb 100644
--- a/src/mame/video/atarig42.c
+++ b/src/mame/video/atarig42.c
@@ -70,9 +70,6 @@ VIDEO_START_MEMBER(atarig42_state,atarig42)
/* blend the playfields and free the temporary one */
blend_gfx(0, 2, 0x0f, 0x30);
- /* initialize the motion objects */
- m_rle = machine().device("rle");
-
/* save states */
save_item(NAME(m_current_control));
save_item(NAME(m_playfield_tile_bank));
@@ -174,7 +171,7 @@ UINT32 atarig42_state::screen_update_atarig42(screen_device &screen, bitmap_ind1
/* copy the motion objects on top */
{
- bitmap_ind16 *mo_bitmap = atarirle_get_vram(m_rle, 0);
+ bitmap_ind16 &mo_bitmap = m_rle->vram(0);
int left = cliprect.min_x;
int top = cliprect.min_y;
int right = cliprect.max_x + 1;
@@ -185,7 +182,7 @@ UINT32 atarig42_state::screen_update_atarig42(screen_device &screen, bitmap_ind1
for (y = top; y < bottom; y++)
{
UINT16 *pf = &bitmap.pix16(y);
- UINT16 *mo = &mo_bitmap->pix16(y);
+ UINT16 *mo = &mo_bitmap.pix16(y);
UINT8 *pri = &priority_bitmap.pix8(y);
for (x = left; x < right; x++)
if (mo[x])
@@ -202,12 +199,3 @@ UINT32 atarig42_state::screen_update_atarig42(screen_device &screen, bitmap_ind1
m_alpha_tilemap->draw(screen, bitmap, cliprect, 0, 0);
return 0;
}
-
-void atarig42_state::screen_eof_atarig42(screen_device &screen, bool state)
-{
- // rising edge
- if (state)
- {
- atarirle_eof(m_rle);
- }
-}
diff --git a/src/mame/video/atarigt.c b/src/mame/video/atarigt.c
index fbd6cf8042a..16b4c6576f6 100644
--- a/src/mame/video/atarigt.c
+++ b/src/mame/video/atarigt.c
@@ -82,9 +82,6 @@ VIDEO_START_MEMBER(atarigt_state,atarigt)
/* blend the playfields and free the temporary one */
blend_gfx(0, 2, 0x0f, 0x30);
- /* initialize the motion objects */
- m_rle = machine().device("rle");
-
/* allocate temp bitmaps */
width = m_screen->width();
height = m_screen->height();
@@ -499,8 +496,8 @@ PrimRage GALs:
UINT32 atarigt_state::screen_update_atarigt(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
- bitmap_ind16 *mo_bitmap = atarirle_get_vram(m_rle, 0);
- bitmap_ind16 *tm_bitmap = atarirle_get_vram(m_rle, 1);
+ bitmap_ind16 &mo_bitmap = m_rle->vram(0);
+ bitmap_ind16 &tm_bitmap = m_rle->vram(1);
UINT16 *cram, *tram;
int color_latch;
UINT32 *mram;
@@ -523,8 +520,8 @@ UINT32 atarigt_state::screen_update_atarigt(screen_device &screen, bitmap_rgb32
{
UINT16 *an = &m_an_bitmap->pix16(y);
UINT16 *pf = &m_pf_bitmap->pix16(y);
- UINT16 *mo = &mo_bitmap->pix16(y);
- UINT16 *tm = &tm_bitmap->pix16(y);
+ UINT16 *mo = &mo_bitmap.pix16(y);
+ UINT16 *tm = &tm_bitmap.pix16(y);
UINT32 *dst = &bitmap.pix32(y);
/* Primal Rage: no TRAM, slightly different priorities */
@@ -621,12 +618,3 @@ UINT32 atarigt_state::screen_update_atarigt(screen_device &screen, bitmap_rgb32
}
return 0;
}
-
-void atarigt_state::screen_eof_atarigt(screen_device &screen, bool state)
-{
- // rising edge
- if (state)
- {
- atarirle_eof(m_rle);
- }
-}
diff --git a/src/mame/video/atarigx2.c b/src/mame/video/atarigx2.c
index 5c9969797c4..51eb95f3362 100644
--- a/src/mame/video/atarigx2.c
+++ b/src/mame/video/atarigx2.c
@@ -70,9 +70,6 @@ VIDEO_START_MEMBER(atarigx2_state,atarigx2)
/* blend the playfields and free the temporary one */
blend_gfx(0, 2, 0x0f, 0x30);
- /* initialize the motion objects */
- m_rle = machine().device("rle");
-
/* save states */
save_item(NAME(m_current_control));
save_item(NAME(m_playfield_tile_bank));
@@ -182,7 +179,7 @@ UINT32 atarigx2_state::screen_update_atarigx2(screen_device &screen, bitmap_ind1
/* copy the motion objects on top */
{
- bitmap_ind16 *mo_bitmap = atarirle_get_vram(m_rle, 0);
+ bitmap_ind16 &mo_bitmap = m_rle->vram(0);
int left = cliprect.min_x;
int top = cliprect.min_y;
int right = cliprect.max_x + 1;
@@ -193,7 +190,7 @@ UINT32 atarigx2_state::screen_update_atarigx2(screen_device &screen, bitmap_ind1
for (y = top; y < bottom; y++)
{
UINT16 *pf = &bitmap.pix16(y);
- UINT16 *mo = &mo_bitmap->pix16(y);
+ UINT16 *mo = &mo_bitmap.pix16(y);
UINT8 *pri = &priority_bitmap.pix8(y);
for (x = left; x < right; x++)
if (mo[x] && (mo[x] >> ATARIRLE_PRIORITY_SHIFT) >= pri[x])
@@ -205,12 +202,3 @@ UINT32 atarigx2_state::screen_update_atarigx2(screen_device &screen, bitmap_ind1
m_alpha_tilemap->draw(screen, bitmap, cliprect, 0, 0);
return 0;
}
-
-void atarigx2_state::screen_eof_atarigx2(screen_device &screen, bool state)
-{
- // rising edge
- if (state)
- {
- atarirle_eof(m_rle);
- }
-}
diff --git a/src/mame/video/atarirle.c b/src/mame/video/atarirle.c
index 8b858db1130..94bcbff4df4 100644
--- a/src/mame/video/atarirle.c
+++ b/src/mame/video/atarirle.c
@@ -20,166 +20,30 @@
#include "emu.h"
#include "atarirle.h"
-#include "devlegcy.h"
-/***************************************************************************
- TYPES & STRUCTURES
-***************************************************************************/
-
-/* internal structure containing a word index, shift and mask */
-struct atarirle_mask
-{
- int word; /* word index */
- int shift; /* shift amount */
- int mask; /* final mask */
-};
-
-/* internal structure for sorting the motion objects */
-struct mo_sort_entry
-{
- mo_sort_entry * next;
- int entry;
-};
-
-/* internal structure describing each object in the ROMs */
-struct atarirle_info
-{
- INT16 width;
- INT16 height;
- INT16 xoffs;
- INT16 yoffs;
- UINT8 bpp;
- const UINT16 * table;
- const UINT16 * data;
-};
-
-/* internal structure containing the state of the motion objects */
-struct atarirle_data
-{
- int bitmapwidth; /* width of the full playfield bitmap */
- int bitmapheight; /* height of the full playfield bitmap */
- int bitmapxmask; /* x coordinate mask for the playfield bitmap */
- int bitmapymask; /* y coordinate mask for the playfield bitmap */
-
- int spriterammask; /* combined mask when accessing sprite RAM with raw addresses */
- int spriteramsize; /* total size of sprite RAM, in entries */
-
- int palettebase; /* base palette entry */
- int maxcolors; /* maximum number of colors */
-
- rectangle cliprect; /* clipping rectangle */
-
- atarirle_mask codemask; /* mask for the code index */
- atarirle_mask colormask; /* mask for the color */
- atarirle_mask xposmask; /* mask for the X position */
- atarirle_mask yposmask; /* mask for the Y position */
- atarirle_mask scalemask; /* mask for the scale factor */
- atarirle_mask hflipmask; /* mask for the horizontal flip */
- atarirle_mask ordermask; /* mask for the order */
- atarirle_mask prioritymask; /* mask for the priority */
- atarirle_mask vrammask; /* mask for the VRAM target */
-
- const UINT16 * rombase; /* pointer to the base of the GFX ROM */
- int romlength; /* length of the GFX ROM */
- int objectcount; /* number of objects in the ROM */
- atarirle_info * info; /* list of info records */
- atarirle_entry *spriteram; /* pointer to sprite RAM */
-
- bitmap_ind16 * vram[2][2]; /* pointers to VRAM bitmaps and backbuffers */
- int partial_scanline; /* partial update scanline */
-
- UINT8 control_bits; /* current control bits */
- UINT8 command; /* current command */
- UINT8 is32bit; /* 32-bit or 16-bit? */
- UINT16 checksums[256]; /* checksums for each 0x40000 bytes */
- UINT16 ram[0x1000/2];
-};
-
-
-
-/***************************************************************************
- MACROS
-***************************************************************************/
-
-/* data extraction */
-#define EXTRACT_DATA(_input, _mask) (((_input)->data[(_mask).word] >> (_mask).shift) & (_mask).mask)
+//**************************************************************************
+// CONSTANTS
+//**************************************************************************
+const device_type ATARI_RLE_OBJECTS = &device_creator<atari_rle_objects_device>;
enum { atarirle_hilite_index = -1 };
-/***************************************************************************
- STATIC VARIABLES
-***************************************************************************/
-
-static UINT8 rle_bpp[8];
-static UINT16 *rle_table[8];
-
-
-
-/***************************************************************************
- STATIC FUNCTION DECLARATIONS
-***************************************************************************/
-
-static void build_rle_tables(running_machine &machine);
-static int count_objects(const UINT16 *base, int length);
-static void prescan_rle(const atarirle_data *mo, int which);
-static void sort_and_render(running_machine &machine, atarirle_data *mo);
-static void compute_checksum(atarirle_data *mo);
-static void draw_rle(atarirle_data *mo, bitmap_ind16 &bitmap, int code, int color, int hflip, int vflip,
- int x, int y, int xscale, int yscale, const rectangle &clip);
-static void draw_rle_zoom(bitmap_ind16 &bitmap, const atarirle_info *gfx,
- UINT32 palette, int sx, int sy, int scalex, int scaley,
- const rectangle &clip);
-static void draw_rle_zoom_hflip(bitmap_ind16 &bitmap, const atarirle_info *gfx,
- UINT32 palette, int sx, int sy, int scalex, int scaley,
- const rectangle &clip);
-
-
-
-/***************************************************************************
- INLINE FUNCTIONS
-***************************************************************************/
-
-INLINE atarirle_data *get_safe_token(device_t *device)
-{
- assert(device != NULL);
- assert(device->type() == ATARIRLE);
-
- return (atarirle_data *)downcast<atarirle_device *>(device)->token();
-}
-
-
-/*---------------------------------------------------------------
- compute_log: Computes the number of bits necessary to
- hold a given value. The input must be an even power of
- two.
----------------------------------------------------------------*/
+//**************************************************************************
+// INLINE FUNCTIONS
+//**************************************************************************
-#ifdef UNUSED_FUNCTION
-INLINE int compute_log(int value)
-{
- int log = 0;
-
- if (value == 0)
- return -1;
- while (!(value & 1))
- log++, value >>= 1;
- if (value != 1)
- return -1;
- return log;
-}
-#endif
-
-/*---------------------------------------------------------------
- round_to_powerof2: Rounds a number up to the nearest
- power of 2. Even powers of 2 are rounded up to the
- next greatest power (e.g., 4 returns 8).
----------------------------------------------------------------*/
+//-------------------------------------------------
+// round_to_powerof2: Rounds a number up to the
+// nearest power of 2. Even powers of 2 are
+// rounded up to the next greatest power
+// (e.g., 4 returns 8).
+//-------------------------------------------------
-INLINE int round_to_powerof2(int value)
+inline int atari_rle_objects_device::round_to_powerof2(int value)
{
int log = 0;
@@ -191,847 +55,552 @@ INLINE int round_to_powerof2(int value)
}
-/*---------------------------------------------------------------
- collapse_bits: Moving right-to-left, for each 1 bit in
- the mask, copy the corresponding bit from the input
- value into the result, packing the bits along the way.
----------------------------------------------------------------*/
-#ifdef UNUSED_FUNCTION
-INLINE int collapse_bits(int value, int mask)
-{
- int testmask, ormask;
- int result = 0;
-
- for (testmask = ormask = 1; testmask != 0; testmask <<= 1)
- if (mask & testmask)
- {
- if (value & testmask)
- result |= ormask;
- ormask <<= 1;
- }
- return result;
-}
-#endif
-
-/*---------------------------------------------------------------
- convert_mask: Converts a 4-word mask into a word index,
- shift, and adjusted mask. Returns 0 if invalid.
----------------------------------------------------------------*/
-
-INLINE int convert_mask(const atarirle_entry *input, atarirle_mask *result)
-{
- int i, temp;
-
- /* determine the word and make sure it's only 1 */
- result->word = -1;
- for (i = 0; i < 8; i++)
- if (input->data[i])
- {
- if (result->word == -1)
- result->word = i;
- else
- return 0;
- }
-
- /* if all-zero, it's valid */
- if (result->word == -1)
- {
- result->word = result->shift = result->mask = 0;
- return 1;
- }
-
- /* determine the shift and final mask */
- result->shift = 0;
- temp = input->data[result->word];
- while (!(temp & 1))
- {
- result->shift++;
- temp >>= 1;
- }
- result->mask = temp;
- return 1;
-}
-
-
-
-/***************************************************************************
- GLOBAL FUNCTIONS
-***************************************************************************/
-
-/*---------------------------------------------------------------
- atarirle_init: Configures the motion objects using the input
- description. Allocates all memory necessary and generates
- the attribute lookup table.
----------------------------------------------------------------*/
-
-static DEVICE_START( atarirle )
-{
- atarirle_data *mo = get_safe_token(device);
- running_machine &machine = device->machine();
- const atarirle_desc *desc = (const atarirle_desc *)device->static_config();
- const UINT16 *base = (const UINT16 *)machine.root_device().memregion(desc->region)->base();
- int i, width, height;
-
- /* build and allocate the generic tables */
- build_rle_tables(machine);
-
- /* determine the masks first */
- convert_mask(&desc->codemask, &mo->codemask);
- convert_mask(&desc->colormask, &mo->colormask);
- convert_mask(&desc->xposmask, &mo->xposmask);
- convert_mask(&desc->yposmask, &mo->yposmask);
- convert_mask(&desc->scalemask, &mo->scalemask);
- convert_mask(&desc->hflipmask, &mo->hflipmask);
- convert_mask(&desc->ordermask, &mo->ordermask);
- convert_mask(&desc->prioritymask, &mo->prioritymask);
- convert_mask(&desc->vrammask, &mo->vrammask);
-
- /* copy in the basic data */
- mo->bitmapwidth = round_to_powerof2(mo->xposmask.mask);
- mo->bitmapheight = round_to_powerof2(mo->yposmask.mask);
- mo->bitmapxmask = mo->bitmapwidth - 1;
- mo->bitmapymask = mo->bitmapheight - 1;
-
- mo->spriteramsize = desc->spriteramentries;
- mo->spriterammask = desc->spriteramentries - 1;
-
- mo->palettebase = desc->palettebase;
- mo->maxcolors = desc->maxcolors / 16;
-
- mo->rombase = base;
- mo->romlength = machine.root_device().memregion(desc->region)->bytes();
- mo->objectcount = count_objects(base, mo->romlength);
-
- mo->cliprect = machine.primary_screen->visible_area();
- if (desc->rightclip)
- {
- mo->cliprect.min_x = desc->leftclip;
- mo->cliprect.max_x = desc->rightclip;
- }
-
- /* compute the checksums */
- memset(mo->checksums, 0, sizeof(mo->checksums));
- for (i = 0; i < mo->romlength / 0x20000; i++)
- {
- const UINT16 *csbase = &mo->rombase[0x10000 * i];
- int cursum = 0, j;
- for (j = 0; j < 0x10000; j++)
- cursum += *csbase++;
- mo->checksums[i] = cursum;
- }
-
- /* allocate the object info */
- mo->info = auto_alloc_array_clear(machine, atarirle_info, mo->objectcount);
-
- /* fill in the data */
- for (i = 0; i < mo->objectcount; i++)
- prescan_rle(mo, i);
-
- /* allocate the spriteram */
- mo->spriteram = auto_alloc_array_clear(machine, atarirle_entry, mo->spriteramsize);
-
- /* allocate bitmaps */
- width = machine.primary_screen->width();
- height = machine.primary_screen->height();
-
- mo->vram[0][0] = auto_bitmap_ind16_alloc(machine, width, height);
- mo->vram[0][1] = auto_bitmap_ind16_alloc(machine, width, height);
- mo->vram[0][0]->fill(0);
- mo->vram[0][1]->fill(0);
-
- /* allocate alternate bitmaps if needed */
- if (mo->vrammask.mask != 0)
- {
- mo->vram[1][0] = auto_bitmap_ind16_alloc(machine, width, height);
- mo->vram[1][1] = auto_bitmap_ind16_alloc(machine, width, height);
- mo->vram[1][0]->fill(0);
- mo->vram[1][1]->fill(0);
- }
-
- mo->partial_scanline = -1;
-
- /* register for save states */
- device->save_pointer(NAME(mo->spriteram[0].data), ARRAY_LENGTH(mo->spriteram[0].data) * mo->spriteramsize);
- device->save_item(NAME(*mo->vram[0][0]));
- device->save_item(NAME(*mo->vram[0][1]));
- if (mo->vrammask.mask != 0)
- {
- device->save_item(NAME(*mo->vram[1][0]));
- device->save_item(NAME(*mo->vram[1][1]));
- }
- device->save_item(NAME(mo->partial_scanline));
- device->save_item(NAME(mo->control_bits));
- device->save_item(NAME(mo->command));
- device->save_item(NAME(mo->is32bit));
- device->save_item(NAME(mo->checksums));
-}
-
-
-const device_type ATARIRLE = &device_creator<atarirle_device>;
-
-atarirle_device::atarirle_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : device_t(mconfig, ATARIRLE, "Atari RLE", tag, owner, clock, "atari_rle", __FILE__)
-{
- m_token = global_alloc_clear(atarirle_data);
-}
+//**************************************************************************
+// CORE DEVICE IMPLEMENTATION
+//**************************************************************************
//-------------------------------------------------
-// device_config_complete - perform any
-// operations now that the configuration is
-// complete
+// atari_rle_objects_device: Constructor
//-------------------------------------------------
-void atarirle_device::device_config_complete()
+atari_rle_objects_device::atari_rle_objects_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : device_t(mconfig, ATARI_RLE_OBJECTS, "Atari RLE Motion Objects", tag, owner, clock, "atari_rle", __FILE__),
+ device_video_interface(mconfig, *this)
{
}
+
//-------------------------------------------------
-// device_start - device-specific startup
+// static_set_config: Set the tag of the
+// sound CPU
//-------------------------------------------------
-void atarirle_device::device_start()
+void atari_rle_objects_device::static_set_config(device_t &device, const atari_rle_objects_config &config)
{
- DEVICE_START_NAME( atarirle )(this);
+ atari_rle_objects_device &target = downcast<atari_rle_objects_device &>(device);
+ static_cast<atari_rle_objects_config &>(target) = config;
}
+//-------------------------------------------------
+// control_write: Write handler for MO control
+// bits.
+//-------------------------------------------------
-/*---------------------------------------------------------------
- atarirle_control_w: Write handler for MO control bits.
----------------------------------------------------------------*/
-
-void atarirle_control_w(device_t *device, UINT8 bits)
+WRITE8_MEMBER(atari_rle_objects_device::control_write)
{
- atarirle_data *mo = get_safe_token(device);
- screen_device *screen = device->machine().first_screen();
- int scanline = screen->vpos();
- int oldbits = mo->control_bits;
-
//logerror("atarirle_control_w(%d)\n", bits);
- /* do nothing if nothing changed */
- if (oldbits == bits)
+ // do nothing if nothing changed
+ int oldbits = m_control_bits;
+ if (oldbits == data)
return;
- /* force a partial update first */
- screen->update_partial(scanline);
+ // force a partial update first
+ int scanline = m_screen->vpos();
+ m_screen->update_partial(scanline);
- /* if the erase flag was set, erase the front map */
- if (oldbits & ATARIRLE_CONTROL_ERASE)
+ // if the erase flag was set, erase the front map
+ if ((oldbits & ATARIRLE_CONTROL_ERASE) != 0)
{
- rectangle cliprect = mo->cliprect;
-
- /* compute the top and bottom of the rect */
- if (mo->partial_scanline + 1 > cliprect.min_y)
- cliprect.min_y = mo->partial_scanline + 1;
+ // compute the top and bottom of the rect
+ rectangle cliprect = m_cliprect;
+ if (m_partial_scanline + 1 > cliprect.min_y)
+ cliprect.min_y = m_partial_scanline + 1;
if (scanline < cliprect.max_y)
cliprect.max_y = scanline;
//logerror(" partial erase %d-%d (frame %d)\n", cliprect.min_y, cliprect.max_y, (oldbits & ATARIRLE_CONTROL_FRAME) >> 2);
- /* erase the bitmap */
- mo->vram[0][(oldbits & ATARIRLE_CONTROL_FRAME) >> 2]->fill(0, cliprect);
- if (mo->vrammask.mask != 0)
- mo->vram[1][(oldbits & ATARIRLE_CONTROL_FRAME) >> 2]->fill(0, cliprect);
+ // erase the bitmap
+ m_vram[0][(oldbits & ATARIRLE_CONTROL_FRAME) >> 2].fill(0, cliprect);
+ if (m_vrammask.mask() != 0)
+ m_vram[1][(oldbits & ATARIRLE_CONTROL_FRAME) >> 2].fill(0, cliprect);
}
- /* update the bits */
- mo->control_bits = bits;
+ // update the bits
+ m_control_bits = data;
- /* if mogo is set, do a render on the rising edge */
- if (!(oldbits & ATARIRLE_CONTROL_MOGO) && (bits & ATARIRLE_CONTROL_MOGO))
+ // if mogo is set, do a render on the rising edge
+ if ((oldbits & ATARIRLE_CONTROL_MOGO) == 0 && (data & ATARIRLE_CONTROL_MOGO) != 0)
{
- if (mo->command == ATARIRLE_COMMAND_DRAW)
- sort_and_render(device->machine(), mo);
- else if (mo->command == ATARIRLE_COMMAND_CHECKSUM)
- compute_checksum(mo);
+ if (m_command == ATARIRLE_COMMAND_DRAW)
+ sort_and_render();
+ else if (m_command == ATARIRLE_COMMAND_CHECKSUM)
+ compute_checksum();
}
- /* remember where we left off */
- mo->partial_scanline = scanline;
+ // remember where we left off
+ m_partial_scanline = scanline;
}
+//-------------------------------------------------
+// command_write: Write handler for MO command
+// bits.
+//-------------------------------------------------
-/*---------------------------------------------------------------
- atarirle_command_w: Write handler for MO command bits.
----------------------------------------------------------------*/
-
-void atarirle_command_w(device_t *device, UINT8 command)
+WRITE8_MEMBER(atari_rle_objects_device::command_write)
{
- atarirle_data *mo = get_safe_token(device);
- mo->command = command;
+ m_command = data;
}
+//-------------------------------------------------
+// vblank_callback: VBLANK callback.
+//-------------------------------------------------
-/*---------------------------------------------------------------
- atarirle_eof: Flush remaining changes.
----------------------------------------------------------------*/
-
-void atarirle_eof(device_t *device)
+void atari_rle_objects_device::vblank_callback(screen_device &screen, bool state)
{
+ // on the rising edge, if the erase flag is set, erase to the end of the screen
+ if (state)
{
- atarirle_data *mo = get_safe_token(device);
-
- /* if the erase flag is set, erase to the end of the screen */
- if (mo->control_bits & ATARIRLE_CONTROL_ERASE)
+ if (m_control_bits & ATARIRLE_CONTROL_ERASE)
{
- rectangle cliprect = mo->cliprect;
+ // compute top only; bottom is equal to visible_area
+ rectangle cliprect = m_cliprect;
+ if (m_partial_scanline + 1 > cliprect.min_y)
+ cliprect.min_y = m_partial_scanline + 1;
- /* compute top only; bottom is equal to visible_area */
- if (mo->partial_scanline + 1 > cliprect.min_y)
- cliprect.min_y = mo->partial_scanline + 1;
+ //logerror(" partial erase %d-%d (frame %d)\n", cliprect.min_y, cliprect.max_y, (m_control_bits & ATARIRLE_CONTROL_FRAME) >> 2);
-//logerror(" partial erase %d-%d (frame %d)\n", cliprect.min_y, cliprect.max_y, (mo->control_bits & ATARIRLE_CONTROL_FRAME) >> 2);
-
- /* erase the bitmap */
- mo->vram[0][(mo->control_bits & ATARIRLE_CONTROL_FRAME) >> 2]->fill(0, cliprect);
- if (mo->vrammask.mask != 0)
- mo->vram[1][(mo->control_bits & ATARIRLE_CONTROL_FRAME) >> 2]->fill(0, cliprect);
+ // erase the bitmap
+ m_vram[0][(m_control_bits & ATARIRLE_CONTROL_FRAME) >> 2].fill(0, cliprect);
+ if (m_vrammask.mask() != 0)
+ m_vram[1][(m_control_bits & ATARIRLE_CONTROL_FRAME) >> 2].fill(0, cliprect);
}
- /* reset the partial scanline to -1 so we can detect full updates */
- mo->partial_scanline = -1;
+ // reset the partial scanline to -1 so we can detect full updates
+ m_partial_scanline = -1;
}
}
+//-------------------------------------------------
+// device_start: Configures the motion objects
+// using the input description. Allocates all
+// memory necessary and generates the attribute
+// lookup table.
+//-------------------------------------------------
-/*---------------------------------------------------------------
- atarirle_spriteram_r: Read handler for the spriteram.
----------------------------------------------------------------*/
-
-READ16_DEVICE_HANDLER( atarirle_spriteram_r )
-{
- atarirle_data *mo = get_safe_token(device);
-
- return mo->ram[offset];
-}
-
-
-
-/*---------------------------------------------------------------
- atarirle_spriteram_w: Write handler for the spriteram.
----------------------------------------------------------------*/
-
-WRITE16_DEVICE_HANDLER( atarirle_spriteram_w )
-{
- atarirle_data *mo = get_safe_token(device);
- int entry = (offset >> 3) & mo->spriterammask;
- int idx = offset & 7;
-
- /* combine raw data */
- COMBINE_DATA(&mo->ram[offset]);
-
- /* store a copy in our local spriteram */
- mo->spriteram[entry].data[idx] = mo->ram[offset];
- mo->is32bit = 0;
-}
-
-
-
-/*---------------------------------------------------------------
- atarirle_spriteram32_r: Read handler for the spriteram.
----------------------------------------------------------------*/
-
-READ32_DEVICE_HANDLER( atarirle_spriteram32_r )
+void atari_rle_objects_device::device_start()
{
- atarirle_data *mo = get_safe_token(device);
- UINT32 *ram = (UINT32 *)mo->ram;
+ // resolve our memory
+ memory_share *share = owner()->memshare(tag());
+ if (share == NULL)
+ throw emu_fatalerror("Error: unable to find memory share '%s' needed for Atari RLE device", tag());
+ m_ram.set(*share, 2);
+
+ // register a VBLANK callback
+ m_screen->register_vblank_callback(vblank_state_delegate(FUNC(atari_rle_objects_device::vblank_callback), this));
+
+ // build and allocate the generic tables
+ build_rle_tables();
+
+ // determine the masks first
+ m_codemask.set(m_code_entry);
+ m_colormask.set(m_color_entry);
+ m_xposmask.set(m_xpos_entry);
+ m_yposmask.set(m_ypos_entry);
+ m_scalemask.set(m_scale_entry);
+ m_hflipmask.set(m_hflip_entry);
+ m_ordermask.set(m_order_entry);
+ m_prioritymask.set(m_priority_entry);
+ m_vrammask.set(m_vram_entry);
+
+ // copy in the basic data
+ m_bitmapwidth = round_to_powerof2(m_xposmask.mask());
+ m_bitmapheight = round_to_powerof2(m_yposmask.mask());
+ m_bitmapxmask = m_bitmapwidth - 1;
+ m_bitmapymask = m_bitmapheight - 1;
+
+ // set up the graphics ROM
+ m_rombase = reinterpret_cast<UINT16 *>(m_region->base());
+ m_romlength = m_region->bytes();
+ m_objectcount = count_objects();
+
+ // set up a cliprect
+ m_cliprect = m_screen->visible_area();
+ if (m_rightclip != 0)
+ {
+ m_cliprect.min_x = m_leftclip;
+ m_cliprect.max_x = m_rightclip;
+ }
- return ram[offset];
-}
+ // compute the checksums
+ memset(m_checksums, 0, sizeof(m_checksums));
+ for (int sumchunk = 0; sumchunk < m_romlength / 0x20000; sumchunk++)
+ {
+ const UINT16 *csbase = &m_rombase[0x10000 * sumchunk];
+ int cursum = 0;
+ for (int word = 0; word < 0x10000; word++)
+ cursum += *csbase++;
+ m_checksums[sumchunk] = cursum;
+ }
+ // allocate the object info and scan the objects
+ m_info.resize(m_objectcount);
+ for (int objnum = 0; objnum < m_objectcount; objnum++)
+ prescan_rle(objnum);
+ // register the bitmaps with the target screen
+ m_screen->register_screen_bitmap(m_vram[0][0]);
+ m_screen->register_screen_bitmap(m_vram[0][1]);
+ m_vram[0][0].fill(0);
+ m_vram[0][1].fill(0);
-/*---------------------------------------------------------------
- atarirle_spriteram32_w: Write handler for the spriteram.
----------------------------------------------------------------*/
+ // allocate alternate bitmaps if needed
+ if (m_vrammask.mask() != 0)
+ {
+ m_screen->register_screen_bitmap(m_vram[1][0]);
+ m_screen->register_screen_bitmap(m_vram[1][1]);
+ m_vram[1][0].fill(0);
+ m_vram[1][1].fill(0);
+ }
-WRITE32_DEVICE_HANDLER( atarirle_spriteram32_w )
-{
- atarirle_data *mo = get_safe_token(device);
- UINT32 *ram = (UINT32 *)mo->ram;
- int entry = (offset >> 2) & mo->spriterammask;
- int idx = 2 * (offset & 3);
-
- /* combine raw data */
- COMBINE_DATA(&ram[offset]);
-
- /* store a copy in our local spriteram */
- mo->spriteram[entry].data[idx+0] = ram[offset] >> 16;
- mo->spriteram[entry].data[idx+1] = ram[offset];
- mo->is32bit = 1;
+ // register for save states
+ save_item(NAME(m_vram[0][0]));
+ save_item(NAME(m_vram[0][1]));
+ if (m_vrammask.mask() != 0)
+ {
+ save_item(NAME(m_vram[1][0]));
+ save_item(NAME(m_vram[1][1]));
+ }
+ save_item(NAME(m_partial_scanline));
+ save_item(NAME(m_control_bits));
+ save_item(NAME(m_command));
}
+//-------------------------------------------------
+// device_reset: Reset the state of the device.
+//-------------------------------------------------
-/*---------------------------------------------------------------
- atarirle_get_vram: Return the VRAM bitmap.
----------------------------------------------------------------*/
-
-bitmap_ind16 *atarirle_get_vram(device_t *device, int idx)
+void atari_rle_objects_device::device_reset()
{
- atarirle_data *mo = get_safe_token(device);
-//logerror("atarirle_get_vram (frame %d)\n", (mo->control_bits & ATARIRLE_CONTROL_FRAME) >> 2);
- return mo->vram[idx][(mo->control_bits & ATARIRLE_CONTROL_FRAME) >> 2];
+ m_partial_scanline = -1;
}
+//-------------------------------------------------
+// build_rle_tables: Builds internal table for
+// RLE mapping.
+//-------------------------------------------------
-/*---------------------------------------------------------------
- build_rle_tables: Builds internal table for RLE mapping.
----------------------------------------------------------------*/
-
-static void build_rle_tables(running_machine &machine)
+void atari_rle_objects_device::build_rle_tables()
{
- UINT16 *base;
- int i;
-
- /* allocate all 5 tables */
- base = auto_alloc_array(machine, UINT16, 0x500);
-
- /* assign the tables */
- rle_table[0] = &base[0x000];
- rle_table[1] = &base[0x100];
- rle_table[2] = rle_table[3] = &base[0x200];
- rle_table[4] = rle_table[6] = &base[0x300];
- rle_table[5] = rle_table[7] = &base[0x400];
-
- /* set the bpps */
- rle_bpp[0] = 4;
- rle_bpp[1] = rle_bpp[2] = rle_bpp[3] = 5;
- rle_bpp[4] = rle_bpp[5] = rle_bpp[6] = rle_bpp[7] = 6;
-
- /* build the 4bpp table */
- for (i = 0; i < 256; i++)
- rle_table[0][i] = (((i & 0xf0) + 0x10) << 4) | (i & 0x0f);
-
- /* build the 5bpp table */
- for (i = 0; i < 256; i++)
- rle_table[2][i] = (((i & 0xe0) + 0x20) << 3) | (i & 0x1f);
-
- /* build the special 5bpp table */
- for (i = 0; i < 256; i++)
+ // assign the tables
+ m_rle_table[0] = &m_rle_table_data[0x000];
+ m_rle_table[1] = &m_rle_table_data[0x100];
+ m_rle_table[2] = m_rle_table[3] = &m_rle_table_data[0x200];
+ m_rle_table[4] = m_rle_table[6] = &m_rle_table_data[0x300];
+ m_rle_table[5] = m_rle_table[7] = &m_rle_table_data[0x400];
+
+ // set the bpps
+ m_rle_bpp[0] = 4;
+ m_rle_bpp[1] = m_rle_bpp[2] = m_rle_bpp[3] = 5;
+ m_rle_bpp[4] = m_rle_bpp[5] = m_rle_bpp[6] = m_rle_bpp[7] = 6;
+
+ // build the 4bpp table
+ for (int i = 0; i < 256; i++)
+ m_rle_table[0][i] = (((i & 0xf0) + 0x10) << 4) | (i & 0x0f);
+
+ // build the 5bpp table
+ for (int i = 0; i < 256; i++)
+ m_rle_table[2][i] = (((i & 0xe0) + 0x20) << 3) | (i & 0x1f);
+
+ // build the special 5bpp table
+ for (int i = 0; i < 256; i++)
{
if ((i & 0x0f) == 0)
- rle_table[1][i] = (((i & 0xf0) + 0x10) << 4) | (i & 0x0f);
+ m_rle_table[1][i] = (((i & 0xf0) + 0x10) << 4) | (i & 0x0f);
else
- rle_table[1][i] = (((i & 0xe0) + 0x20) << 3) | (i & 0x1f);
+ m_rle_table[1][i] = (((i & 0xe0) + 0x20) << 3) | (i & 0x1f);
}
- /* build the 6bpp table */
- for (i = 0; i < 256; i++)
- rle_table[5][i] = (((i & 0xc0) + 0x40) << 2) | (i & 0x3f);
+ // build the 6bpp table
+ for (int i = 0; i < 256; i++)
+ m_rle_table[5][i] = (((i & 0xc0) + 0x40) << 2) | (i & 0x3f);
- /* build the special 6bpp table */
- for (i = 0; i < 256; i++)
+ // build the special 6bpp table
+ for (int i = 0; i < 256; i++)
{
if ((i & 0x0f) == 0)
- rle_table[4][i] = (((i & 0xf0) + 0x10) << 4) | (i & 0x0f);
+ m_rle_table[4][i] = (((i & 0xf0) + 0x10) << 4) | (i & 0x0f);
else
- rle_table[4][i] = (((i & 0xc0) + 0x40) << 2) | (i & 0x3f);
+ m_rle_table[4][i] = (((i & 0xc0) + 0x40) << 2) | (i & 0x3f);
}
}
-/*---------------------------------------------------------------
- count_objects: Determines the number of objects in the
- motion object ROM.
----------------------------------------------------------------*/
+//-------------------------------------------------
+// count_objects: Determines the number of objects in the
+// motion object ROM.
+//-------------------------------------------------
-int count_objects(const UINT16 *base, int length)
+int atari_rle_objects_device::count_objects()
{
- int lowest_address = length;
- int i;
-
- /* first determine the lowest address of all objects */
- for (i = 0; i < lowest_address; i += 4)
+ // first determine the lowest address of all objects
+ int lowest_address = m_romlength;
+ for (int objoffset = 0; objoffset < lowest_address; objoffset += 4)
{
- int offset = ((base[i + 2] & 0xff) << 16) | base[i + 3];
-//logerror("count_objects: i=%d offset=%08X\n", i, offset);
- if (offset > i && offset < lowest_address)
+ int offset = ((m_rombase[objoffset + 2] & 0xff) << 16) | m_rombase[objoffset + 3];
+//logerror("count_objects: objoffset=%d offset=%08X\n", objoffset, offset);
+ if (offset > objoffset && offset < lowest_address)
lowest_address = offset;
}
- /* that determines how many objects */
+ // that determines how many objects
return lowest_address / 4;
}
+//-------------------------------------------------
+// prescan_rle: Prescans an RLE object, computing the
+// width, height, and other goodies.
+//-------------------------------------------------
-/*---------------------------------------------------------------
- prescan_rle: Prescans an RLE object, computing the
- width, height, and other goodies.
----------------------------------------------------------------*/
-
-static void prescan_rle(const atarirle_data *mo, int which)
+void atari_rle_objects_device::prescan_rle(int which)
{
- atarirle_info *rledata = &mo->info[which];
- UINT16 *base = (UINT16 *)&mo->rombase[which * 4];
- const UINT16 *end = mo->rombase + mo->romlength / 2;
- int width = 0, height, flags, offset;
- const UINT16 *table;
-
- /* look up the offset */
- rledata->xoffs = (INT16)base[0];
- rledata->yoffs = (INT16)base[1];
-
- /* determine the depth and table */
- flags = base[2];
- rledata->bpp = rle_bpp[(flags >> 8) & 7];
- table = rledata->table = rle_table[(flags >> 8) & 7];
-
- /* determine the starting offset */
- offset = ((base[2] & 0xff) << 16) | base[3];
- rledata->data = base = (UINT16 *)&mo->rombase[offset];
-
- /* make sure it's valid */
- if (offset < which * 4 || offset >= mo->romlength)
+ object_info &info = m_info[which];
+
+ // look up the offset
+ UINT16 *base = (UINT16 *)&m_rombase[which * 4];
+ const UINT16 *end = m_rombase + m_romlength / 2;
+ info.xoffs = (INT16)base[0];
+ info.yoffs = (INT16)base[1];
+
+ // determine the depth and table
+ int flags = base[2];
+ info.bpp = m_rle_bpp[(flags >> 8) & 7];
+ const UINT16 *table = info.table = m_rle_table[(flags >> 8) & 7];
+
+ // determine the starting offset
+ int offset = ((base[2] & 0xff) << 16) | base[3];
+ info.data = base = (UINT16 *)&m_rombase[offset];
+
+ // make sure it's valid
+ if (offset < which * 4 || offset >= m_romlength)
{
- memset(rledata, 0, sizeof(*rledata));
+ info.data = NULL;
return;
}
- /* first pre-scan to determine the width and height */
+ // first pre-scan to determine the width and height
+ int width = 0;
+ int height;
for (height = 0; height < 1024 && base < end; height++)
{
int tempwidth = 0;
int entry_count = *base++;
- /* if the high bit is set, assume we're inverted */
+ // if the high bit is set, assume we're inverted
if (entry_count & 0x8000)
{
entry_count ^= 0xffff;
- /* also change the ROM data so we don't have to do this again at runtime */
+ // also change the ROM data so we don't have to do this again at runtime
base[-1] ^= 0xffff;
}
- /* we're done when we hit 0 */
+ // we're done when we hit 0
if (entry_count == 0)
break;
- /* track the width */
+ // track the width
while (entry_count-- && base < end)
{
int word = *base++;
int count/*, value*/;
- /* decode the low byte first */
+ // decode the low byte first
count = table[word & 0xff];
//value = count & 0xff;
tempwidth += count >> 8;
- /* decode the upper byte second */
+ // decode the upper byte second
count = table[word >> 8];
//value = count & 0xff;
tempwidth += count >> 8;
}
- /* only remember the max */
+ // only remember the max
if (tempwidth > width)
width = tempwidth;
}
- /* fill in the data */
- rledata->width = width;
- rledata->height = height;
+ // fill in the data
+ info.width = width;
+ info.height = height;
}
-/*---------------------------------------------------------------
- compute_checksum: Compute the checksum values on the ROMs.
----------------------------------------------------------------*/
+//-------------------------------------------------
+// compute_checksum: Compute the checksum values
+// on the ROMs.
+//-------------------------------------------------
-static void compute_checksum(atarirle_data *mo)
+void atari_rle_objects_device::compute_checksum()
{
- int reqsums = mo->spriteram[0].data[0] + 1;
- int i;
-
- /* number of checksums is in the first word */
+ // number of checksums is in the first word
+ int reqsums = m_ram.read(0) + 1;
if (reqsums > 256)
reqsums = 256;
- /* stuff them back */
- if (!mo->is32bit)
- {
- for (i = 0; i < reqsums; i++)
- mo->ram[i] = mo->checksums[i];
- }
- else
- {
- UINT32 *ram = (UINT32 *)mo->ram;
- for (i = 0; i < reqsums; i++)
- if (i & 1)
- ram[i/2] = (ram[i/2] & 0xffff0000) | mo->checksums[i];
- else
- ram[i/2] = (ram[i/2] & 0x0000ffff) | (mo->checksums[i] << 16);
- }
+ // stuff them back
+ for (int i = 0; i < reqsums; i++)
+ m_ram.write(i, m_checksums[i]);
}
-/*---------------------------------------------------------------
- sort_and_render: Render all motion objects in order.
----------------------------------------------------------------*/
-static void sort_and_render(running_machine &machine, atarirle_data *mo)
-{
- bitmap_ind16 *bitmap1 = mo->vram[0][(~mo->control_bits & ATARIRLE_CONTROL_FRAME) >> 2];
- bitmap_ind16 *bitmap2 = mo->vram[1][(~mo->control_bits & ATARIRLE_CONTROL_FRAME) >> 2];
- atarirle_entry *obj = mo->spriteram;
- mo_sort_entry sort_entry[256];
- mo_sort_entry *list_head[256];
- mo_sort_entry *current;
- int i;
-
-atarirle_entry *hilite = NULL;
-int count = 0;
-
- /* sort the motion objects into their proper priorities */
- memset(list_head, 0, sizeof(list_head));
- for (i = 0; i < 256; i++, obj++)
+//-------------------------------------------------
+// sort_and_render: Render all motion objects in
+// order.
+//-------------------------------------------------
+
+void atari_rle_objects_device::sort_and_render()
+{
+ // struct for sorting
+ struct sort_entry_t
{
- int order = EXTRACT_DATA(obj, mo->ordermask);
- sort_entry[i].entry = i;
- sort_entry[i].next = list_head[order];
- list_head[order] = &sort_entry[i];
+ sort_entry_t * next;
+ int entry;
+ };
+
+ // sort the motion objects into their proper priorities
+ sort_entry_t *list_head[256] = { 0 };
+ sort_entry_t sort_entry[256];
+ for (int objnum = 0; objnum < 256; objnum++)
+ {
+ int order = m_ordermask.extract(m_ram, objnum * 8);
+ sort_entry[objnum].entry = objnum * 8;
+ sort_entry[objnum].next = list_head[order];
+ list_head[order] = &sort_entry[objnum];
}
- /* now loop back and process */
- count = 0;
- for (i = 1; i < 256; i++)
- for (current = list_head[i]; current; current = current->next)
+ // now loop back and process
+ int bitmap_index = (~m_control_bits & ATARIRLE_CONTROL_FRAME) >> 2;
+ int count = 0;
+int hilite = -1;
+ for (int order = 1; order < 256; order++)
+ for (sort_entry_t *current = list_head[order]; current != NULL; current = current->next)
{
- int scale, code;
-
- /* extract scale and code */
- obj = &mo->spriteram[current->entry];
- scale = EXTRACT_DATA(obj, mo->scalemask);
- code = EXTRACT_DATA(obj, mo->codemask);
+ // extract scale and code
+ int scale = m_scalemask.extract(m_ram, current->entry);
+ int code = m_codemask.extract(m_ram, current->entry);
- /* make sure they are in range */
- if (scale > 0 && code < mo->objectcount)
+ // make sure they are in range
+ if (scale > 0 && code < m_objectcount)
{
- int hflip = EXTRACT_DATA(obj, mo->hflipmask);
- int color = EXTRACT_DATA(obj, mo->colormask);
- int priority = EXTRACT_DATA(obj, mo->prioritymask);
- int x = EXTRACT_DATA(obj, mo->xposmask);
- int y = EXTRACT_DATA(obj, mo->yposmask);
- int which = EXTRACT_DATA(obj, mo->vrammask);
+ int hflip = m_hflipmask.extract(m_ram, current->entry);
+ int color = m_colormask.extract(m_ram, current->entry);
+ int priority = m_prioritymask.extract(m_ram, current->entry);
+ int x = m_xposmask.extract(m_ram, current->entry);
+ int y = m_yposmask.extract(m_ram, current->entry);
+ int which = m_vrammask.extract(m_ram, current->entry);
if (count++ == atarirle_hilite_index)
- hilite = obj;
+ hilite = current->entry;
- if (x & ((mo->xposmask.mask + 1) >> 1))
- x = (INT16)(x | ~mo->xposmask.mask);
- if (y & ((mo->yposmask.mask + 1) >> 1))
- y = (INT16)(y | ~mo->yposmask.mask);
- x += mo->cliprect.min_x;
+ if (x & ((m_xposmask.mask() + 1) >> 1))
+ x = (INT16)(x | ~m_xposmask.mask());
+ if (y & ((m_yposmask.mask() + 1) >> 1))
+ y = (INT16)(y | ~m_yposmask.mask());
+ x += m_cliprect.min_x;
- /* merge priority and color */
+ // merge priority and color
color = (color << 4) | (priority << ATARIRLE_PRIORITY_SHIFT);
- /* render to one or both bitmaps */
- if (which == 0)
- draw_rle(mo, *bitmap1, code, color, hflip, 0, x, y, scale, scale, mo->cliprect);
- if (bitmap2 && which != 0)
- draw_rle(mo, *bitmap2, code, color, hflip, 0, x, y, scale, scale, mo->cliprect);
+ // render to one or both bitmaps
+ bitmap_ind16 &bitmap = m_vram[which][bitmap_index];
+ draw_rle(bitmap, m_cliprect, code, color, hflip, 0, x, y, scale, scale);
}
}
-if (hilite)
-{
- int scale, code/*, which*/;
-
- /* extract scale and code */
- obj = hilite;
- scale = EXTRACT_DATA(obj, mo->scalemask);
- code = EXTRACT_DATA(obj, mo->codemask);
- //which = EXTRACT_DATA(obj, mo->vrammask);
-
- /* make sure they are in range */
- if (scale > 0 && code < mo->objectcount)
- {
- int hflip = EXTRACT_DATA(obj, mo->hflipmask);
- int color = EXTRACT_DATA(obj, mo->colormask);
- int priority = EXTRACT_DATA(obj, mo->prioritymask);
- int x = EXTRACT_DATA(obj, mo->xposmask);
- int y = EXTRACT_DATA(obj, mo->yposmask);
- int scaled_xoffs, scaled_yoffs;
- const atarirle_info *info;
-
- if (x & ((mo->xposmask.mask + 1) >> 1))
- x = (INT16)(x | ~mo->xposmask.mask);
- if (y & ((mo->yposmask.mask + 1) >> 1))
- y = (INT16)(y | ~mo->yposmask.mask);
- x += mo->cliprect.min_x;
-
- /* merge priority and color */
- color = (color << 4) | (priority << ATARIRLE_PRIORITY_SHIFT);
-
- info = &mo->info[code];
- scaled_xoffs = (scale * info->xoffs) >> 12;
- scaled_yoffs = (scale * info->yoffs) >> 12;
-
- /* we're hflipped, account for it */
- if (hflip)
- scaled_xoffs = ((scale * info->width) >> 12) - scaled_xoffs;
-
- /* adjust for the x and y offsets */
- x -= scaled_xoffs;
- y -= scaled_yoffs;
-
- do
- {
- const rectangle &visarea = machine.primary_screen->visible_area();
- int scaled_width = (scale * info->width + 0x7fff) >> 12;
- int scaled_height = (scale * info->height + 0x7fff) >> 12;
- int ex, ey, sx = x, sy = y, tx, ty;
-
- /* make sure we didn't end up with 0 */
- if (scaled_width == 0) scaled_width = 1;
- if (scaled_height == 0) scaled_height = 1;
-
- /* compute the remaining parameters */
- ex = sx + scaled_width - 1;
- ey = sy + scaled_height - 1;
-
- /* left edge clip */
- if (sx < visarea.min_x)
- sx = visarea.min_x;
- if (sx > visarea.max_x)
- break;
-
- /* right edge clip */
- if (ex > visarea.max_x)
- ex = visarea.max_x;
- else if (ex < visarea.min_x)
- break;
-
- /* top edge clip */
- if (sy < visarea.min_y)
- sy = visarea.min_y;
- else if (sy > visarea.max_y)
- break;
-
- /* bottom edge clip */
- if (ey > visarea.max_y)
- ey = visarea.max_y;
- else if (ey < visarea.min_y)
- break;
-
- for (ty = sy; ty <= ey; ty++)
- {
- bitmap1->pix16(ty, sx) = machine.rand() & 0xff;
- bitmap1->pix16(ty, ex) = machine.rand() & 0xff;
- }
- for (tx = sx; tx <= ex; tx++)
- {
- bitmap1->pix16(sy, tx) = machine.rand() & 0xff;
- bitmap1->pix16(ey, tx) = machine.rand() & 0xff;
- }
- } while (0);
-fprintf(stderr, " Sprite: c=%04X l=%04X h=%d X=%4d (o=%4d w=%3d) Y=%4d (o=%4d h=%d) s=%04X\n",
- code, color, hflip,
- x, -scaled_xoffs, (scale * info->width) >> 12,
- y, -scaled_yoffs, (scale * info->height) >> 12, scale);
- }
-
-}
+ if (hilite != -1)
+ hilite_object(m_vram[0][bitmap_index], hilite);
}
+//-------------------------------------------------
+// draw_rle: Render a single RLE-compressed motion
+// object.
+//-------------------------------------------------
-/*---------------------------------------------------------------
- draw_rle: Render a single RLE-compressed motion
- object.
----------------------------------------------------------------*/
-
-void draw_rle(atarirle_data *mo, bitmap_ind16 &bitmap, int code, int color, int hflip, int vflip,
- int x, int y, int xscale, int yscale, const rectangle &clip)
+void atari_rle_objects_device::draw_rle(bitmap_ind16 &bitmap, const rectangle &clip, int code, int color, int hflip, int vflip, int x, int y, int xscale, int yscale)
{
- UINT32 palettebase = mo->palettebase + color;
- const atarirle_info *info = &mo->info[code];
- int scaled_xoffs = (xscale * info->xoffs) >> 12;
- int scaled_yoffs = (yscale * info->yoffs) >> 12;
+ // bail on a NULL object
+ const object_info &info = m_info[code];
+ if (info.data == NULL)
+ return;
+
+ //
+ int scaled_xoffs = (xscale * info.xoffs) >> 12;
+ int scaled_yoffs = (yscale * info.yoffs) >> 12;
- /* we're hflipped, account for it */
+ // we're hflipped, account for it
if (hflip)
- scaled_xoffs = ((xscale * info->width) >> 12) - scaled_xoffs;
+ scaled_xoffs = ((xscale * info.width) >> 12) - scaled_xoffs;
-//if (clip.min_y == Machine->primary_screen->visible_area().min_y)
+//if (clip.min_y == m_screen->visible_area().min_y)
//logerror(" Sprite: c=%04X l=%04X h=%d X=%4d (o=%4d w=%3d) Y=%4d (o=%4d h=%d) s=%04X\n",
// code, color, hflip,
-// x, -scaled_xoffs, (xscale * info->width) >> 12,
-// y, -scaled_yoffs, (yscale * info->height) >> 12, xscale);
+// x, -scaled_xoffs, (xscale * info.width) >> 12,
+// y, -scaled_yoffs, (yscale * info.height) >> 12, xscale);
- /* adjust for the x and y offsets */
+ // adjust for the x and y offsets
x -= scaled_xoffs;
y -= scaled_yoffs;
- /* bail on a NULL object */
- if (!info->data)
- return;
-
- /* 16-bit case */
- assert(bitmap.bpp() == 16);
+ // draw it with appropriate flipping
+ UINT32 palettebase = m_palettebase + color;
if (!hflip)
- draw_rle_zoom(bitmap, info, palettebase, x, y, xscale << 4, yscale << 4, clip);
+ draw_rle_zoom(bitmap, clip, info, palettebase, x, y, xscale << 4, yscale << 4);
else
- draw_rle_zoom_hflip(bitmap, info, palettebase, x, y, xscale << 4, yscale << 4, clip);
+ draw_rle_zoom_hflip(bitmap, clip, info, palettebase, x, y, xscale << 4, yscale << 4);
}
-/*---------------------------------------------------------------
- draw_rle_zoom: Draw an RLE-compressed object to a 16-bit
- bitmap.
----------------------------------------------------------------*/
+//-------------------------------------------------
+// draw_rle_zoom: Draw an RLE-compressed object to
+// a 16-bit bitmap.
+//-------------------------------------------------
-void draw_rle_zoom(bitmap_ind16 &bitmap, const atarirle_info *gfx,
- UINT32 palette, int sx, int sy, int scalex, int scaley,
- const rectangle &clip)
+void atari_rle_objects_device::draw_rle_zoom(bitmap_ind16 &bitmap, const rectangle &clip, const object_info &info, UINT32 palette, int sx, int sy, int scalex, int scaley)
{
- const UINT16 *row_start = gfx->data;
- const UINT16 *table = gfx->table;
- volatile int current_row = 0;
-
- int scaled_width = (scalex * gfx->width + 0x7fff) >> 16;
- int scaled_height = (scaley * gfx->height + 0x7fff) >> 16;
-
- int pixels_to_skip = 0, xclipped = 0;
- int dx, dy, ex, ey;
- int y, sourcey;
-
- /* make sure we didn't end up with 0 */
+ // determine scaled size; make sure we didn't end up with 0
+ int scaled_width = (scalex * info.width + 0x7fff) >> 16;
+ int scaled_height = (scaley * info.height + 0x7fff) >> 16;
if (scaled_width == 0) scaled_width = 1;
if (scaled_height == 0) scaled_height = 1;
- /* compute the remaining parameters */
- dx = (gfx->width << 16) / scaled_width;
- dy = (gfx->height << 16) / scaled_height;
- ex = sx + scaled_width - 1;
- ey = sy + scaled_height - 1;
- sourcey = dy / 2;
+ // compute the remaining parameters
+ int dx = (info.width << 16) / scaled_width;
+ int dy = (info.height << 16) / scaled_height;
+ int ex = sx + scaled_width - 1;
+ int ey = sy + scaled_height - 1;
+ int sourcey = dy / 2;
- /* left edge clip */
+ // left edge clip
+ int pixels_to_skip = 0;
+ bool xclipped = false;
if (sx < clip.min_x)
- pixels_to_skip = clip.min_x - sx, xclipped = 1;
+ pixels_to_skip = clip.min_x - sx, xclipped = true;
if (sx > clip.max_x)
return;
- /* right edge clip */
+ // right edge clip
if (ex > clip.max_x)
- ex = clip.max_x, xclipped = 1;
+ ex = clip.max_x, xclipped = true;
else if (ex < clip.min_x)
return;
- /* top edge clip */
+ // top edge clip
if (sy < clip.min_y)
{
sourcey += (clip.min_y - sy) * dy;
@@ -1040,43 +609,42 @@ void draw_rle_zoom(bitmap_ind16 &bitmap, const atarirle_info *gfx,
else if (sy > clip.max_y)
return;
- /* bottom edge clip */
+ // bottom edge clip
if (ey > clip.max_y)
ey = clip.max_y;
else if (ey < clip.min_y)
return;
- /* loop top to bottom */
- for (y = sy; y <= ey; y++, sourcey += dy)
+ // loop top to bottom
+ const UINT16 *row_start = info.data;
+ const UINT16 *table = info.table;
+ int current_row = 0;
+ for (int y = sy; y <= ey; y++, sourcey += dy)
{
UINT16 *dest = &bitmap.pix16(y, sx);
- int j, sourcex = dx / 2, rle_end = 0;
- const UINT16 *base;
- int entry_count;
+ int sourcex = dx / 2, rle_end = 0;
- /* loop until we hit the row we're on */
+ // loop until we hit the row we're on
for ( ; current_row != (sourcey >> 16); current_row++)
row_start += 1 + *row_start;
- /* grab our starting parameters from this row */
- base = row_start;
- entry_count = *base++;
+ // grab our starting parameters from this row
+ const UINT16 *base = row_start;
+ int entry_count = *base++;
- /* non-clipped case */
+ // non-clipped case
if (!xclipped)
{
- /* decode the pixels */
- for (j = 0; j < entry_count; j++)
+ // decode the pixels
+ for (int entry = 0; entry < entry_count; entry++)
{
+ // decode the low byte first
int word = *base++;
- int count, value;
-
- /* decode the low byte first */
- count = table[word & 0xff];
- value = count & 0xff;
+ int count = table[word & 0xff];
+ int value = count & 0xff;
rle_end += (count & 0xff00) << 8;
- /* store copies of the value until we pass the end of this chunk */
+ // store copies of the value until we pass the end of this chunk
if (value)
{
value += palette;
@@ -1089,12 +657,12 @@ void draw_rle_zoom(bitmap_ind16 &bitmap, const atarirle_info *gfx,
dest++, sourcex += dx;
}
- /* decode the upper byte second */
+ // decode the upper byte second
count = table[word >> 8];
value = count & 0xff;
rle_end += (count & 0xff00) << 8;
- /* store copies of the value until we pass the end of this chunk */
+ // store copies of the value until we pass the end of this chunk
if (value)
{
value += palette;
@@ -1109,24 +677,22 @@ void draw_rle_zoom(bitmap_ind16 &bitmap, const atarirle_info *gfx,
}
}
- /* clipped case */
+ // clipped case
else
{
const UINT16 *end = &bitmap.pix16(y, ex);
int to_be_skipped = pixels_to_skip;
- /* decode the pixels */
- for (j = 0; j < entry_count && dest <= end; j++)
+ // decode the pixels
+ for (int entry = 0; entry < entry_count && dest <= end; entry++)
{
+ // decode the low byte first
int word = *base++;
- int count, value;
-
- /* decode the low byte first */
- count = table[word & 0xff];
- value = count & 0xff;
+ int count = table[word & 0xff];
+ int value = count & 0xff;
rle_end += (count & 0xff00) << 8;
- /* store copies of the value until we pass the end of this chunk */
+ // store copies of the value until we pass the end of this chunk
if (to_be_skipped)
{
while (to_be_skipped && sourcex < rle_end)
@@ -1146,12 +712,12 @@ void draw_rle_zoom(bitmap_ind16 &bitmap, const atarirle_info *gfx,
}
next3:
- /* decode the upper byte second */
+ // decode the upper byte second
count = table[word >> 8];
value = count & 0xff;
rle_end += (count & 0xff00) << 8;
- /* store copies of the value until we pass the end of this chunk */
+ // store copies of the value until we pass the end of this chunk
if (to_be_skipped)
{
while (to_be_skipped && sourcex < rle_end)
@@ -1178,49 +744,42 @@ void draw_rle_zoom(bitmap_ind16 &bitmap, const atarirle_info *gfx,
-/*---------------------------------------------------------------
- draw_rle_zoom_hflip: Draw an RLE-compressed object to a
- 16-bit bitmap with horizontal flip.
----------------------------------------------------------------*/
+//-------------------------------------------------
+// draw_rle_zoom_hflip: Draw an RLE-compressed
+// object to a 16-bit bitmap with horizontal
+// flip.
+//-------------------------------------------------
-void draw_rle_zoom_hflip(bitmap_ind16 &bitmap, const atarirle_info *gfx,
- UINT32 palette, int sx, int sy, int scalex, int scaley,
- const rectangle &clip)
+void atari_rle_objects_device::draw_rle_zoom_hflip(bitmap_ind16 &bitmap, const rectangle &clip, const object_info &info, UINT32 palette, int sx, int sy, int scalex, int scaley)
{
- const UINT16 *row_start = gfx->data;
- const UINT16 *table = gfx->table;
- volatile int current_row = 0;
-
- int scaled_width = (scalex * gfx->width + 0x7fff) >> 16;
- int scaled_height = (scaley * gfx->height + 0x7fff) >> 16;
- int pixels_to_skip = 0, xclipped = 0;
- int dx, dy, ex, ey;
- int y, sourcey;
-
- /* make sure we didn't end up with 0 */
+ // determine scaled size; make sure we didn't end up with 0
+ int scaled_width = (scalex * info.width + 0x7fff) >> 16;
+ int scaled_height = (scaley * info.height + 0x7fff) >> 16;
if (scaled_width == 0) scaled_width = 1;
if (scaled_height == 0) scaled_height = 1;
- /* compute the remaining parameters */
- dx = (gfx->width << 16) / scaled_width;
- dy = (gfx->height << 16) / scaled_height;
- ex = sx + scaled_width - 1;
- ey = sy + scaled_height - 1;
- sourcey = dy / 2;
+ // compute the remaining parameters
+ int dx = (info.width << 16) / scaled_width;
+ int dy = (info.height << 16) / scaled_height;
+ int ex = sx + scaled_width - 1;
+ int ey = sy + scaled_height - 1;
+ int sourcey = dy / 2;
- /* left edge clip */
+ // left edge clip
+ int pixels_to_skip = 0;
+ bool xclipped = false;
if (sx < clip.min_x)
- sx = clip.min_x, xclipped = 1;
+ sx = clip.min_x, xclipped = true;
if (sx > clip.max_x)
return;
- /* right edge clip */
+ // right edge clip
if (ex > clip.max_x)
- pixels_to_skip = ex - clip.max_x, xclipped = 1;
+ pixels_to_skip = ex - clip.max_x, xclipped = true;
else if (ex < clip.min_x)
return;
- /* top edge clip */
+ // top edge clip
if (sy < clip.min_y)
{
sourcey += (clip.min_y - sy) * dy;
@@ -1229,43 +788,42 @@ void draw_rle_zoom_hflip(bitmap_ind16 &bitmap, const atarirle_info *gfx,
else if (sy > clip.max_y)
return;
- /* bottom edge clip */
+ // bottom edge clip
if (ey > clip.max_y)
ey = clip.max_y;
else if (ey < clip.min_y)
return;
- /* loop top to bottom */
- for (y = sy; y <= ey; y++, sourcey += dy)
+ // loop top to bottom
+ const UINT16 *row_start = info.data;
+ const UINT16 *table = info.table;
+ int current_row = 0;
+ for (int y = sy; y <= ey; y++, sourcey += dy)
{
UINT16 *dest = &bitmap.pix16(y, ex);
- int j, sourcex = dx / 2, rle_end = 0;
- const UINT16 *base;
- int entry_count;
+ int sourcex = dx / 2, rle_end = 0;
- /* loop until we hit the row we're on */
+ // loop until we hit the row we're on
for ( ; current_row != (sourcey >> 16); current_row++)
row_start += 1 + *row_start;
- /* grab our starting parameters from this row */
- base = row_start;
- entry_count = *base++;
+ // grab our starting parameters from this row
+ const UINT16 *base = row_start;
+ int entry_count = *base++;
- /* non-clipped case */
+ // non-clipped case
if (!xclipped)
{
- /* decode the pixels */
- for (j = 0; j < entry_count; j++)
+ // decode the pixels
+ for (int entry = 0; entry < entry_count; entry++)
{
+ // decode the low byte first
int word = *base++;
- int count, value;
-
- /* decode the low byte first */
- count = table[word & 0xff];
- value = count & 0xff;
+ int count = table[word & 0xff];
+ int value = count & 0xff;
rle_end += (count & 0xff00) << 8;
- /* store copies of the value until we pass the end of this chunk */
+ // store copies of the value until we pass the end of this chunk
if (value)
{
value += palette;
@@ -1278,12 +836,12 @@ void draw_rle_zoom_hflip(bitmap_ind16 &bitmap, const atarirle_info *gfx,
dest--, sourcex += dx;
}
- /* decode the upper byte second */
+ // decode the upper byte second
count = table[word >> 8];
value = count & 0xff;
rle_end += (count & 0xff00) << 8;
- /* store copies of the value until we pass the end of this chunk */
+ // store copies of the value until we pass the end of this chunk
if (value)
{
value += palette;
@@ -1298,24 +856,22 @@ void draw_rle_zoom_hflip(bitmap_ind16 &bitmap, const atarirle_info *gfx,
}
}
- /* clipped case */
+ // clipped case
else
{
const UINT16 *start = &bitmap.pix16(y, sx);
int to_be_skipped = pixels_to_skip;
- /* decode the pixels */
- for (j = 0; j < entry_count && dest >= start; j++)
+ // decode the pixels
+ for (int entry = 0; entry < entry_count && dest >= start; entry++)
{
+ // decode the low byte first
int word = *base++;
- int count, value;
-
- /* decode the low byte first */
- count = table[word & 0xff];
- value = count & 0xff;
+ int count = table[word & 0xff];
+ int value = count & 0xff;
rle_end += (count & 0xff00) << 8;
- /* store copies of the value until we pass the end of this chunk */
+ // store copies of the value until we pass the end of this chunk
if (to_be_skipped)
{
while (to_be_skipped && sourcex < rle_end)
@@ -1335,12 +891,12 @@ void draw_rle_zoom_hflip(bitmap_ind16 &bitmap, const atarirle_info *gfx,
}
next3:
- /* decode the upper byte second */
+ // decode the upper byte second
count = table[word >> 8];
value = count & 0xff;
rle_end += (count & 0xff00) << 8;
- /* store copies of the value until we pass the end of this chunk */
+ // store copies of the value until we pass the end of this chunk
if (to_be_skipped)
{
while (to_be_skipped && sourcex < rle_end)
@@ -1366,6 +922,161 @@ void draw_rle_zoom_hflip(bitmap_ind16 &bitmap, const atarirle_info *gfx,
}
+//-------------------------------------------------
+// hilite_object: Hilight an object by drawing a
+// flashing box around it
+//-------------------------------------------------
+
+void atari_rle_objects_device::hilite_object(bitmap_ind16 &bitmap, int hilite)
+{
+ // extract scale and code
+ int scale = m_scalemask.extract(m_ram, hilite);
+ int code = m_codemask.extract(m_ram, hilite);
+
+ // make sure they are in range
+ if (scale > 0 && code < m_objectcount)
+ {
+ int hflip = m_hflipmask.extract(m_ram, hilite);
+ int color = m_colormask.extract(m_ram, hilite);
+ int priority = m_prioritymask.extract(m_ram, hilite);
+ int x = m_xposmask.extract(m_ram, hilite);
+ int y = m_yposmask.extract(m_ram, hilite);
+
+ if (x & ((m_xposmask.mask() + 1) >> 1))
+ x = (INT16)(x | ~m_xposmask.mask());
+ if (y & ((m_yposmask.mask() + 1) >> 1))
+ y = (INT16)(y | ~m_yposmask.mask());
+ x += m_cliprect.min_x;
+
+ // merge priority and color
+ color = (color << 4) | (priority << ATARIRLE_PRIORITY_SHIFT);
+
+ const object_info &info = m_info[code];
+ int scaled_xoffs = (scale * info.xoffs) >> 12;
+ int scaled_yoffs = (scale * info.yoffs) >> 12;
+
+ // we're hflipped, account for it
+ if (hflip)
+ scaled_xoffs = ((scale * info.width) >> 12) - scaled_xoffs;
+
+ // adjust for the x and y offsets
+ x -= scaled_xoffs;
+ y -= scaled_yoffs;
+
+ do
+ {
+ // make sure we didn't end up with 0
+ int scaled_width = (scale * info.width + 0x7fff) >> 12;
+ int scaled_height = (scale * info.height + 0x7fff) >> 12;
+ if (scaled_width == 0) scaled_width = 1;
+ if (scaled_height == 0) scaled_height = 1;
+
+ // compute the remaining parameters
+ int sx = x;
+ int sy = y;
+ int ex = sx + scaled_width - 1;
+ int ey = sy + scaled_height - 1;
+
+ // left edge clip
+ const rectangle &visarea = m_screen->visible_area();
+ if (sx < visarea.min_x)
+ sx = visarea.min_x;
+ if (sx > visarea.max_x)
+ break;
+
+ // right edge clip
+ if (ex > visarea.max_x)
+ ex = visarea.max_x;
+ else if (ex < visarea.min_x)
+ break;
+
+ // top edge clip
+ if (sy < visarea.min_y)
+ sy = visarea.min_y;
+ else if (sy > visarea.max_y)
+ break;
+
+ // bottom edge clip
+ if (ey > visarea.max_y)
+ ey = visarea.max_y;
+ else if (ey < visarea.min_y)
+ break;
+
+ for (int ty = sy; ty <= ey; ty++)
+ {
+ bitmap.pix16(ty, sx) = machine().rand() & 0xff;
+ bitmap.pix16(ty, ex) = machine().rand() & 0xff;
+ }
+ for (int tx = sx; tx <= ex; tx++)
+ {
+ bitmap.pix16(sy, tx) = machine().rand() & 0xff;
+ bitmap.pix16(ey, tx) = machine().rand() & 0xff;
+ }
+ } while (0);
+ fprintf(stderr, " Sprite: c=%04X l=%04X h=%d X=%4d (o=%4d w=%3d) Y=%4d (o=%4d h=%d) s=%04X\n",
+ code, color, hflip,
+ x, -scaled_xoffs, (scale * info.width) >> 12,
+ y, -scaled_yoffs, (scale * info.height) >> 12, scale);
+ }
+}
+
+
+
+//**************************************************************************
+// SPRITE PARAMETER
+//**************************************************************************
+
+//-------------------------------------------------
+// sprite_parameter: Constructor
+//-------------------------------------------------
+
+atari_rle_objects_device::sprite_parameter::sprite_parameter()
+ : m_word(0),
+ m_shift(0),
+ m_mask(0)
+{
+}
+
+
+//-------------------------------------------------
+// set: Sets the mask via an input 4-word mask.
+//-------------------------------------------------
+
+bool atari_rle_objects_device::sprite_parameter::set(const UINT16 input[8])
+{
+ // determine the word and make sure it's only 1
+ m_word = 0xffff;
+ for (int i = 0; i < 8; i++)
+ if (input[i])
+ {
+ if (m_word == 0xffff)
+ m_word = i;
+ else
+ return false;
+ }
+
+ // if all-zero, it's valid
+ if (m_word == 0xffff)
+ {
+ m_word = m_shift = m_mask = 0;
+ return true;
+ }
+
+ // determine the shift and final mask
+ m_shift = 0;
+ UINT16 temp = input[m_word];
+ while (!(temp & 1))
+ {
+ m_shift++;
+ temp >>= 1;
+ }
+ m_mask = temp;
+ return true;
+}
+
+
+
+
/***************************************************************************
The mapping of the bits from the PROMs is like this:
diff --git a/src/mame/video/atarirle.h b/src/mame/video/atarirle.h
index 2b50138ccef..b1196887483 100644
--- a/src/mame/video/atarirle.h
+++ b/src/mame/video/atarirle.h
@@ -5,15 +5,56 @@
Common RLE-based motion object management functions for early 90's
Atari raster games.
+****************************************************************************
+
+ 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.
+
***************************************************************************/
#ifndef __ATARIRLE__
#define __ATARIRLE__
-/***************************************************************************
- CONSTANTS
-***************************************************************************/
+//**************************************************************************
+// DEVICE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_ATARIRLE_ADD(_tag, _interface) \
+ MCFG_DEVICE_ADD(_tag, ATARI_RLE_OBJECTS, 0) \
+ atari_rle_objects_device::static_set_config(*device, _interface);
+
+
+
+//**************************************************************************
+// CONSTANTS
+//**************************************************************************
#define ATARIRLE_PRIORITY_SHIFT 12
#define ATARIRLE_BANK_SHIFT 15
@@ -30,80 +71,144 @@
-/***************************************************************************
- TYPES & STRUCTURES
-***************************************************************************/
+//**************************************************************************
+// TYPES & STRUCTURES
+//**************************************************************************
-/* description for an eight-word mask */
-struct atarirle_entry
+// description of the motion objects
+struct atari_rle_objects_config
{
- UINT16 data[8];
+ struct entry { UINT16 data[8]; };
+
+ UINT16 m_leftclip; // left clip coordinate
+ UINT16 m_rightclip; // right clip coordinate
+ UINT16 m_palettebase; // base palette entry
+
+ entry m_code_entry; // mask for the code index
+ entry m_color_entry; // mask for the color
+ entry m_xpos_entry; // mask for the X position
+ entry m_ypos_entry; // mask for the Y position
+ entry m_scale_entry; // mask for the scale factor
+ entry m_hflip_entry; // mask for the horizontal flip
+ entry m_order_entry; // mask for the order
+ entry m_priority_entry; // mask for the priority
+ entry m_vram_entry; // mask for the VRAM target
};
-/* description of the motion objects */
-struct atarirle_desc
-{
- const char * region; /* region where the GFX data lives */
- UINT16 spriteramentries; /* number of entries in sprite RAM */
- UINT16 leftclip; /* left clip coordinate */
- UINT16 rightclip; /* right clip coordinate */
-
- UINT16 palettebase; /* base palette entry */
- UINT16 maxcolors; /* maximum number of colors */
-
- atarirle_entry codemask; /* mask for the code index */
- atarirle_entry colormask; /* mask for the color */
- atarirle_entry xposmask; /* mask for the X position */
- atarirle_entry yposmask; /* mask for the Y position */
- atarirle_entry scalemask; /* mask for the scale factor */
- atarirle_entry hflipmask; /* mask for the horizontal flip */
- atarirle_entry ordermask; /* mask for the order */
- atarirle_entry prioritymask; /* mask for the priority */
- atarirle_entry vrammask; /* mask for the VRAM target */
-};
+// ======================> atari_rle_objects_device
+// device type definition
+extern const device_type ATARI_RLE_OBJECTS;
-/***************************************************************************
- FUNCTION PROTOTYPES
-***************************************************************************/
-
-class atarirle_device : public device_t
+class atari_rle_objects_device : public device_t,
+ public device_video_interface,
+ public atari_rle_objects_config
{
public:
- atarirle_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
- ~atarirle_device() { global_free(m_token); }
+ // construction/destruction
+ atari_rle_objects_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // static configuration helpers
+ static void static_set_config(device_t &device, const atari_rle_objects_config &config);
+
+ // control handlers
+ DECLARE_WRITE8_MEMBER(control_write);
+ DECLARE_WRITE8_MEMBER(command_write);
+
+ // render helpers
+ void vblank_callback(screen_device &screen, bool state);
+
+ // getters
+ bitmap_ind16 &vram(int idx) { return m_vram[idx][(m_control_bits & ATARIRLE_CONTROL_FRAME) >> 2]; }
- // access to legacy token
- void *token() const { assert(m_token != NULL); return m_token; }
protected:
// device-level overrides
- virtual void device_config_complete();
virtual void device_start();
+ virtual void device_reset();
+
private:
- // internal state
- void *m_token;
+ // a sprite parameter, which is a word index + shift + mask
+ class sprite_parameter
+ {
+ public:
+ sprite_parameter();
+ bool set(const atari_rle_objects_config::entry &input) { return set(input.data); }
+ bool set(const UINT16 input[8]);
+ UINT16 extract(memory_array &array, int offset) const { return (array.read(offset + m_word) >> m_shift) & m_mask; }
+ UINT16 shift() const { return m_shift; }
+ UINT16 mask() const { return m_mask; }
+
+ private:
+ UINT16 m_word; // word index
+ UINT16 m_shift; // shift amount
+ UINT16 m_mask; // final mask
+ };
+
+ // internal structure describing each object in the ROMs
+ struct object_info
+ {
+ INT16 width;
+ INT16 height;
+ INT16 xoffs;
+ INT16 yoffs;
+ UINT8 bpp;
+ const UINT16 * table;
+ const UINT16 * data;
+ };
+
+ // internal helpers
+ inline int round_to_powerof2(int value);
+ void build_rle_tables();
+ int count_objects();
+ void prescan_rle(int which);
+ void compute_checksum();
+ void sort_and_render();
+ void draw_rle(bitmap_ind16 &bitmap, const rectangle &clip, int code, int color, int hflip, int vflip, int x, int y, int xscale, int yscale);
+ void draw_rle_zoom(bitmap_ind16 &bitmap, const rectangle &clip, const object_info &info, UINT32 palette, int sx, int sy, int scalex, int scaley);
+ void draw_rle_zoom_hflip(bitmap_ind16 &bitmap, const rectangle &clip, const object_info &info, UINT32 palette, int sx, int sy, int scalex, int scaley);
+ void hilite_object(bitmap_ind16 &bitmap, int hilite);
+
+ // derived state
+ int m_bitmapwidth; // width of the full playfield bitmap
+ int m_bitmapheight; // height of the full playfield bitmap
+ int m_bitmapxmask; // x coordinate mask for the playfield bitmap
+ int m_bitmapymask; // y coordinate mask for the playfield bitmap
+ rectangle m_cliprect; // clipping rectangle
+
+ // masks
+ sprite_parameter m_codemask; // mask for the code index
+ sprite_parameter m_colormask; // mask for the color
+ sprite_parameter m_xposmask; // mask for the X position
+ sprite_parameter m_yposmask; // mask for the Y position
+ sprite_parameter m_scalemask; // mask for the scale factor
+ sprite_parameter m_hflipmask; // mask for the horizontal flip
+ sprite_parameter m_ordermask; // mask for the order
+ sprite_parameter m_prioritymask; // mask for the priority
+ sprite_parameter m_vrammask; // mask for the VRAM target
+
+ // ROM information
+ const UINT16 * m_rombase; // pointer to the base of the GFX ROM
+ int m_romlength; // length of the GFX ROM
+ int m_objectcount; // number of objects in the ROM
+ dynamic_array<object_info> m_info; // list of info records
+
+ // rendering state
+ bitmap_ind16 m_vram[2][2]; // pointers to VRAM bitmaps and backbuffers
+ int m_partial_scanline; // partial update scanline
+
+ // control state
+ UINT8 m_control_bits; // current control bits
+ UINT8 m_command; // current command
+ UINT16 m_checksums[256]; // checksums for each 0x40000 bytes
+ memory_array m_ram;
+
+ // tables
+ UINT8 m_rle_bpp[8];
+ UINT16 * m_rle_table[8];
+ UINT16 m_rle_table_data[0x500];
};
-extern const device_type ATARIRLE;
-
-#define MCFG_ATARIRLE_ADD(_tag, _interface) \
- MCFG_DEVICE_ADD(_tag, ATARIRLE, 0) \
- MCFG_DEVICE_CONFIG(_interface)
-
-
-/* control handlers */
-void atarirle_control_w(device_t *device, UINT8 bits);
-void atarirle_command_w(device_t *device, UINT8 command);
-
-/* read/write handlers */
-DECLARE_READ16_DEVICE_HANDLER( atarirle_spriteram_r );
-DECLARE_READ32_DEVICE_HANDLER( atarirle_spriteram32_r );
-DECLARE_WRITE16_DEVICE_HANDLER( atarirle_spriteram_w );
-DECLARE_WRITE32_DEVICE_HANDLER( atarirle_spriteram32_w );
-/* render helpers */
-void atarirle_eof(device_t *device);
-bitmap_ind16 *atarirle_get_vram(device_t *device, int idx);
#endif