summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author Gaston90 <Gastonelias90@gmail.com>2019-02-22 11:09:58 -0300
committer Gaston90 <Gastonelias90@gmail.com>2019-02-22 11:09:58 -0300
commit3972e74ee9e4095b6b151894e77e6bdfb449626c (patch)
tree993529a9c291501ed4d2c4733424c8b5c6373370
parentb58f948528ffc9899b71481e813f04a3049ea1bf (diff)
parent9ec1ab5d1aa23610e7cff20fad5f05cfbe1aa052 (diff)
Merge branch 'master' of https://github.com/Robbbert/hbmame
-rw-r--r--src/devices/machine/netlist.cpp10
-rw-r--r--src/lib/netlist/devices/nlid_truthtable.cpp4
-rw-r--r--src/lib/netlist/devices/nlid_truthtable.h2
-rw-r--r--src/lib/netlist/nl_base.cpp8
-rw-r--r--src/lib/netlist/nl_base.h20
-rw-r--r--src/lib/netlist/nl_factory.cpp2
-rw-r--r--src/lib/netlist/nl_factory.h10
-rw-r--r--src/lib/netlist/nl_setup.cpp16
-rw-r--r--src/lib/netlist/nl_setup.h18
-rw-r--r--src/lib/netlist/plib/palloc.h193
-rw-r--r--src/lib/netlist/plib/parray.h17
-rw-r--r--src/lib/netlist/plib/pconfig.h15
-rw-r--r--src/lib/netlist/plib/pdynlib.cpp8
-rw-r--r--src/lib/netlist/plib/pmempool.h45
-rw-r--r--src/lib/netlist/plib/pstate.h3
-rw-r--r--src/lib/netlist/plib/pstream.cpp12
-rw-r--r--src/lib/netlist/plib/pstream.h14
-rw-r--r--src/lib/netlist/prg/nltool.cpp6
-rw-r--r--src/lib/netlist/prg/nlwav.cpp16
-rw-r--r--src/lib/netlist/solver/nld_matrix_solver.cpp8
-rw-r--r--src/lib/netlist/solver/nld_matrix_solver.h16
-rw-r--r--src/lib/netlist/solver/nld_ms_gcr.h3
-rw-r--r--src/lib/netlist/solver/nld_ms_gmres.h2
-rw-r--r--src/lib/netlist/solver/nld_solver.cpp36
-rw-r--r--src/lib/netlist/solver/nld_solver.h3
-rw-r--r--src/lib/netlist/tools/nl_convert.cpp2
-rw-r--r--src/lib/netlist/tools/nl_convert.h8
-rw-r--r--src/mame/drivers/model2.cpp2
-rw-r--r--src/mame/drivers/model3.cpp2
-rw-r--r--src/mame/drivers/suprnova.cpp73
-rw-r--r--src/mame/mame.lst1
-rw-r--r--src/mame/video/newport.cpp82
-rw-r--r--src/mame/video/newport.h8
33 files changed, 477 insertions, 188 deletions
diff --git a/src/devices/machine/netlist.cpp b/src/devices/machine/netlist.cpp
index 1eccdd3f291..7beb745cbf2 100644
--- a/src/devices/machine/netlist.cpp
+++ b/src/devices/machine/netlist.cpp
@@ -218,7 +218,7 @@ public:
{
}
- virtual std::unique_ptr<plib::pistream> stream(const pstring &name) override;
+ virtual plib::unique_ptr<plib::pistream> stream(const pstring &name) override;
private:
device_t &m_dev;
pstring m_name;
@@ -229,7 +229,7 @@ class netlist_data_memregions_t : public netlist::source_t
public:
netlist_data_memregions_t(device_t &dev);
- virtual std::unique_ptr<plib::pistream> stream(const pstring &name) override;
+ virtual plib::unique_ptr<plib::pistream> stream(const pstring &name) override;
private:
device_t &m_dev;
@@ -240,7 +240,7 @@ private:
// memregion source support
// ----------------------------------------------------------------------------------------
-std::unique_ptr<plib::pistream> netlist_source_memregion_t::stream(const pstring &name)
+plib::unique_ptr<plib::pistream> netlist_source_memregion_t::stream(const pstring &name)
{
//memory_region *mem = static_cast<netlist_mame_device::netlist_mame_t &>(setup().setup().exec()).machine().root_device().memregion(m_name.c_str());
memory_region *mem = m_dev.machine().root_device().memregion(m_name.c_str());
@@ -252,7 +252,7 @@ netlist_data_memregions_t::netlist_data_memregions_t(device_t &dev)
{
}
-std::unique_ptr<plib::pistream> netlist_data_memregions_t::stream(const pstring &name)
+plib::unique_ptr<plib::pistream> netlist_data_memregions_t::stream(const pstring &name)
{
//memory_region *mem = static_cast<netlist_mame_device::netlist_mame_t &>(setup().setup().exec()).parent().memregion(name.c_str());
memory_region *mem = m_dev.memregion(name.c_str());
@@ -264,7 +264,7 @@ std::unique_ptr<plib::pistream> netlist_data_memregions_t::stream(const pstring
{
// This should be the last data provider being called - last resort
fatalerror("data named %s not found in device rom regions\n", name.c_str());
- return std::unique_ptr<plib::pistream>(nullptr);
+ return plib::unique_ptr<plib::pistream>(nullptr);
}
}
diff --git a/src/lib/netlist/devices/nlid_truthtable.cpp b/src/lib/netlist/devices/nlid_truthtable.cpp
index b37fd31abf6..cadbdf0b7bb 100644
--- a/src/lib/netlist/devices/nlid_truthtable.cpp
+++ b/src/lib/netlist/devices/nlid_truthtable.cpp
@@ -464,9 +464,9 @@ netlist_base_factory_truthtable_t::netlist_base_factory_truthtable_t(const pstri
ENTRYY(n, 4, s); ENTRYY(n, 5, s); ENTRYY(n, 6, s); \
ENTRYY(n, 7, s); ENTRYY(n, 8, s)
-std::unique_ptr<netlist_base_factory_truthtable_t> tt_factory_create(tt_desc &desc, const pstring &sourcefile)
+plib::unique_ptr<netlist_base_factory_truthtable_t> tt_factory_create(tt_desc &desc, const pstring &sourcefile)
{
- std::unique_ptr<netlist_base_factory_truthtable_t> ret;
+ plib::unique_ptr<netlist_base_factory_truthtable_t> ret;
switch (desc.ni * 100 + desc.no)
{
diff --git a/src/lib/netlist/devices/nlid_truthtable.h b/src/lib/netlist/devices/nlid_truthtable.h
index abc6b108ce5..a4b9e1e238e 100644
--- a/src/lib/netlist/devices/nlid_truthtable.h
+++ b/src/lib/netlist/devices/nlid_truthtable.h
@@ -225,7 +225,7 @@ namespace devices
};
/* the returned element is still missing a pointer to the family ... */
- std::unique_ptr<netlist_base_factory_truthtable_t> tt_factory_create(tt_desc &desc, const pstring &sourcefile);
+ plib::unique_ptr<netlist_base_factory_truthtable_t> tt_factory_create(tt_desc &desc, const pstring &sourcefile);
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/nl_base.cpp b/src/lib/netlist/nl_base.cpp
index bb2e2daafdd..3d6a8cf04b0 100644
--- a/src/lib/netlist/nl_base.cpp
+++ b/src/lib/netlist/nl_base.cpp
@@ -236,7 +236,7 @@ detail::terminal_type detail::core_terminal_t::type() const
// netlist_t
// ----------------------------------------------------------------------------------------
-netlist_t::netlist_t(const pstring &aname, std::unique_ptr<callbacks_t> callbacks)
+netlist_t::netlist_t(const pstring &aname, plib::unique_ptr<callbacks_t> callbacks)
: m_state(plib::make_unique<netlist_state_t>(aname,
std::move(callbacks),
plib::make_unique<setup_t>(*this))) // FIXME, ugly but needed to have netlist_state_t constructed first
@@ -256,8 +256,8 @@ netlist_t::netlist_t(const pstring &aname, std::unique_ptr<callbacks_t> callback
// ----------------------------------------------------------------------------------------
netlist_state_t::netlist_state_t(const pstring &aname,
- std::unique_ptr<callbacks_t> &&callbacks,
- std::unique_ptr<setup_t> &&setup)
+ plib::unique_ptr<callbacks_t> &&callbacks,
+ plib::unique_ptr<setup_t> &&setup)
: m_name(aname)
, m_state()
, m_callbacks(std::move(callbacks)) // Order is important here
@@ -1035,7 +1035,7 @@ nl_double param_model_t::model_value(const pstring &entity)
}
-std::unique_ptr<plib::pistream> param_data_t::stream()
+plib::unique_ptr<plib::pistream> param_data_t::stream()
{
return device().setup().get_data_stream(Value());
}
diff --git a/src/lib/netlist/nl_base.h b/src/lib/netlist/nl_base.h
index 5975eaa4011..7f65a33e6bf 100644
--- a/src/lib/netlist/nl_base.h
+++ b/src/lib/netlist/nl_base.h
@@ -30,7 +30,7 @@
#include "nl_time.h"
//============================================================
-// MACROS / New Syntax999
+// MACROS / New Syntax
//============================================================
/*! Construct a netlist device name */
@@ -1070,7 +1070,7 @@ namespace netlist
{
}
- std::unique_ptr<plib::pistream> stream();
+ plib::unique_ptr<plib::pistream> stream();
protected:
void changed() override { }
};
@@ -1276,8 +1276,8 @@ namespace netlist
/* need to preserve order of device creation ... */
using devices_collection_type = std::vector<std::pair<pstring, poolptr<core_device_t>>>;
netlist_state_t(const pstring &aname,
- std::unique_ptr<callbacks_t> &&callbacks,
- std::unique_ptr<setup_t> &&setup);
+ plib::unique_ptr<callbacks_t> &&callbacks,
+ plib::unique_ptr<setup_t> &&setup);
COPYASSIGNMOVE(netlist_state_t, delete)
@@ -1371,7 +1371,7 @@ namespace netlist
}
/* sole use is to manage lifetime of family objects */
- std::vector<std::pair<pstring, std::unique_ptr<logic_family_desc_t>>> m_family_cache;
+ std::vector<std::pair<pstring, plib::unique_ptr<logic_family_desc_t>>> m_family_cache;
setup_t &setup() NL_NOEXCEPT { return *m_setup; }
const setup_t &setup() const NL_NOEXCEPT { return *m_setup; }
@@ -1387,11 +1387,11 @@ namespace netlist
void reset();
pstring m_name;
- std::unique_ptr<plib::dynlib> m_lib; // external lib needs to be loaded as long as netlist exists
+ plib::unique_ptr<plib::dynlib> m_lib; // external lib needs to be loaded as long as netlist exists
plib::state_manager_t m_state;
- std::unique_ptr<callbacks_t> m_callbacks;
+ plib::unique_ptr<callbacks_t> m_callbacks;
log_type m_log;
- std::unique_ptr<setup_t> m_setup;
+ plib::unique_ptr<setup_t> m_setup;
nets_collection_type m_nets;
/* sole use is to manage lifetime of net objects */
@@ -1409,7 +1409,7 @@ namespace netlist
{
public:
- explicit netlist_t(const pstring &aname, std::unique_ptr<callbacks_t> callbacks);
+ explicit netlist_t(const pstring &aname, plib::unique_ptr<callbacks_t> callbacks);
COPYASSIGNMOVE(netlist_t, delete)
@@ -1454,7 +1454,7 @@ namespace netlist
void print_stats() const;
private:
- std::unique_ptr<netlist_state_t> m_state;
+ plib::unique_ptr<netlist_state_t> m_state;
devices::NETLIB_NAME(solver) * m_solver;
/* mostly rw */
diff --git a/src/lib/netlist/nl_factory.cpp b/src/lib/netlist/nl_factory.cpp
index 793a0b4d1bc..c9d5ea7e29f 100644
--- a/src/lib/netlist/nl_factory.cpp
+++ b/src/lib/netlist/nl_factory.cpp
@@ -52,7 +52,7 @@ namespace netlist { namespace factory
{
}
- void list_t::register_device(std::unique_ptr<element_t> &&factory)
+ void list_t::register_device(plib::unique_ptr<element_t> &&factory)
{
for (auto & e : *this)
if (e->name() == factory->name())
diff --git a/src/lib/netlist/nl_factory.h b/src/lib/netlist/nl_factory.h
index 3ed98b19152..cd7e74944eb 100644
--- a/src/lib/netlist/nl_factory.h
+++ b/src/lib/netlist/nl_factory.h
@@ -25,7 +25,7 @@
NETLIB_DEVICE_IMPL_BASE(ns, chip, chip, p_name, p_def_param) \
#define NETLIB_DEVICE_IMPL_BASE(ns, p_alias, chip, p_name, p_def_param) \
- static std::unique_ptr<factory::element_t> NETLIB_NAME(p_alias ## _c) \
+ static plib::unique_ptr<factory::element_t> NETLIB_NAME(p_alias ## _c) \
(const pstring &classname) \
{ \
return plib::make_unique<factory::device_element_t<ns :: NETLIB_NAME(chip)>>(p_name, classname, p_def_param, pstring(__FILE__)); \
@@ -91,7 +91,7 @@ namespace factory {
}
};
- class list_t : public std::vector<std::unique_ptr<element_t>>
+ class list_t : public std::vector<plib::unique_ptr<element_t>>
{
public:
explicit list_t(log_type &alog);
@@ -106,7 +106,7 @@ namespace factory {
register_device(plib::make_unique<device_element_t<device_class>>(name, classname, def_param));
}
- void register_device(std::unique_ptr<element_t> &&factory);
+ void register_device(plib::unique_ptr<element_t> &&factory);
element_t * factory_by_name(const pstring &devname);
@@ -124,10 +124,10 @@ namespace factory {
// factory_creator_ptr_t
// -----------------------------------------------------------------------------
- using constructor_ptr_t = std::unique_ptr<element_t> (*)(const pstring &classname);
+ using constructor_ptr_t = plib::unique_ptr<element_t> (*)(const pstring &classname);
template <typename T>
- std::unique_ptr<element_t> constructor_t(const pstring &name, const pstring &classname,
+ plib::unique_ptr<element_t> constructor_t(const pstring &name, const pstring &classname,
const pstring &def_param)
{
return plib::make_unique<device_element_t<T>>(name, classname, def_param);
diff --git a/src/lib/netlist/nl_setup.cpp b/src/lib/netlist/nl_setup.cpp
index b9196852878..b892fb4571c 100644
--- a/src/lib/netlist/nl_setup.cpp
+++ b/src/lib/netlist/nl_setup.cpp
@@ -219,7 +219,7 @@ namespace netlist
return false;
}
- bool nlparse_t::parse_stream(std::unique_ptr<plib::pistream> &&istrm, const pstring &name)
+ bool nlparse_t::parse_stream(plib::unique_ptr<plib::pistream> &&istrm, const pstring &name)
{
return parser_t(std::move(plib::ppreprocessor(&m_defines).process(std::move(istrm))), *this).parse(name);
}
@@ -986,7 +986,7 @@ const logic_family_desc_t *setup_t::family_from_model(const pstring &model)
// Sources
// ----------------------------------------------------------------------------------------
-std::unique_ptr<plib::pistream> setup_t::get_data_stream(const pstring &name)
+plib::unique_ptr<plib::pistream> setup_t::get_data_stream(const pstring &name)
{
for (auto &source : m_sources)
{
@@ -998,7 +998,7 @@ std::unique_ptr<plib::pistream> setup_t::get_data_stream(const pstring &name)
}
}
log().warning(MW_1_DATA_1_NOT_FOUND, name);
- return std::unique_ptr<plib::pistream>(nullptr);
+ return plib::unique_ptr<plib::pistream>(nullptr);
}
@@ -1146,19 +1146,19 @@ bool source_t::parse(nlparse_t &setup, const pstring &name)
}
}
-std::unique_ptr<plib::pistream> source_string_t::stream(const pstring &name)
+plib::unique_ptr<plib::pistream> source_string_t::stream(const pstring &name)
{
plib::unused_var(name);
return plib::make_unique<plib::pimemstream>(m_str.c_str(), std::strlen(m_str.c_str()));
}
-std::unique_ptr<plib::pistream> source_mem_t::stream(const pstring &name)
+plib::unique_ptr<plib::pistream> source_mem_t::stream(const pstring &name)
{
plib::unused_var(name);
return plib::make_unique<plib::pimemstream>(m_str.c_str(), std::strlen(m_str.c_str()));
}
-std::unique_ptr<plib::pistream> source_file_t::stream(const pstring &name)
+plib::unique_ptr<plib::pistream> source_file_t::stream(const pstring &name)
{
plib::unused_var(name);
return plib::make_unique<plib::pifilestream>(m_filename);
@@ -1175,10 +1175,10 @@ bool source_proc_t::parse(nlparse_t &setup, const pstring &name)
return false;
}
-std::unique_ptr<plib::pistream> source_proc_t::stream(const pstring &name)
+plib::unique_ptr<plib::pistream> source_proc_t::stream(const pstring &name)
{
plib::unused_var(name);
- std::unique_ptr<plib::pistream> p(nullptr);
+ plib::unique_ptr<plib::pistream> p(nullptr);
return p;
}
diff --git a/src/lib/netlist/nl_setup.h b/src/lib/netlist/nl_setup.h
index 448df3490da..5e445fc6a32 100644
--- a/src/lib/netlist/nl_setup.h
+++ b/src/lib/netlist/nl_setup.h
@@ -180,7 +180,7 @@ namespace netlist
DATA
};
- using list_t = std::vector<std::unique_ptr<source_t>>;
+ using list_t = std::vector<plib::unique_ptr<source_t>>;
source_t(const type_t type = SOURCE)
: m_type(type)
@@ -195,7 +195,7 @@ namespace netlist
type_t type() const { return m_type; }
protected:
- virtual std::unique_ptr<plib::pistream> stream(const pstring &name) = 0;
+ virtual plib::unique_ptr<plib::pistream> stream(const pstring &name) = 0;
private:
const type_t m_type;
@@ -224,7 +224,7 @@ namespace netlist
void register_frontier(const pstring &attach, const double r_IN, const double r_OUT);
/* register a source */
- void register_source(std::unique_ptr<source_t> &&src)
+ void register_source(plib::unique_ptr<source_t> &&src)
{
m_sources.push_back(std::move(src));
}
@@ -251,7 +251,7 @@ namespace netlist
bool device_exists(const pstring &name) const;
/* FIXME: used by source_t - need a different approach at some time */
- bool parse_stream(std::unique_ptr<plib::pistream> &&istrm, const pstring &name);
+ bool parse_stream(plib::unique_ptr<plib::pistream> &&istrm, const pstring &name);
void add_define(pstring def, pstring val)
{
@@ -328,7 +328,7 @@ namespace netlist
void register_dynamic_log_devices();
void resolve_inputs();
- std::unique_ptr<plib::pistream> get_data_stream(const pstring &name);
+ plib::unique_ptr<plib::pistream> get_data_stream(const pstring &name);
factory::list_t &factory() { return m_factory; }
@@ -404,7 +404,7 @@ namespace netlist
}
protected:
- std::unique_ptr<plib::pistream> stream(const pstring &name) override;
+ plib::unique_ptr<plib::pistream> stream(const pstring &name) override;
private:
pstring m_str;
@@ -420,7 +420,7 @@ namespace netlist
}
protected:
- std::unique_ptr<plib::pistream> stream(const pstring &name) override;
+ plib::unique_ptr<plib::pistream> stream(const pstring &name) override;
private:
pstring m_filename;
@@ -435,7 +435,7 @@ namespace netlist
}
protected:
- std::unique_ptr<plib::pistream> stream(const pstring &name) override;
+ plib::unique_ptr<plib::pistream> stream(const pstring &name) override;
private:
pstring m_str;
@@ -454,7 +454,7 @@ namespace netlist
bool parse(nlparse_t &setup, const pstring &name) override;
protected:
- std::unique_ptr<plib::pistream> stream(const pstring &name) override;
+ plib::unique_ptr<plib::pistream> stream(const pstring &name) override;
private:
void (*m_setup_func)(nlparse_t &);
diff --git a/src/lib/netlist/plib/palloc.h b/src/lib/netlist/plib/palloc.h
index c70aaa392d7..45c19ef7b3a 100644
--- a/src/lib/netlist/plib/palloc.h
+++ b/src/lib/netlist/plib/palloc.h
@@ -8,45 +8,124 @@
#ifndef PALLOC_H_
#define PALLOC_H_
+#include "pconfig.h"
#include "pstring.h"
#include "ptypes.h"
#include <cstddef>
+#include <cstdlib>
#include <memory>
#include <utility>
#include <vector>
+#if defined(_WIN32) || defined(_WIN64) || defined(_MSC_VER)
+#include <malloc.h>
+#endif
+
namespace plib {
//============================================================
// Memory allocation
//============================================================
+#if (USE_ALIGNED_OPTIMIZATIONS)
+ static inline void *paligned_alloc( size_t alignment, size_t size )
+ {
+#if defined(_WIN32) || defined(_WIN64) || defined(_MSC_VER)
+ return _aligned_malloc(size, alignment);
+#elif defined(__APPLE__)
+ void* p;
+ if (::posix_memalign(&p, alignment, size) != 0) {
+ p = nullptr;
+ }
+ return p;
+#else
+ return aligned_alloc(alignment, size);
+#endif
+ }
+
+ static inline void pfree( void *ptr )
+ {
+ free(ptr);
+ }
+
+ template <typename T, std::size_t ALIGN>
+ inline C14CONSTEXPR T *assume_aligned_ptr(T *p) noexcept
+ {
+ return reinterpret_cast<T *>(__builtin_assume_aligned(p, ALIGN));
+ }
+
+ template <typename T, std::size_t ALIGN>
+ inline C14CONSTEXPR const T *assume_aligned_ptr(const T *p) noexcept
+ {
+ return reinterpret_cast<const T *>(__builtin_assume_aligned(p, ALIGN));
+ }
+#else
+ static inline void *paligned_alloc( size_t alignment, size_t size )
+ {
+ unused_var(alignment);
+ return ::operator new(size);
+ }
+
+ static inline void pfree( void *ptr )
+ {
+ ::operator delete(ptr);
+ }
+
+ template <typename T, std::size_t ALIGN>
+ inline C14CONSTEXPR T *assume_aligned_ptr(T *p) noexcept
+ {
+ return p;
+ }
+
+ template <typename T, std::size_t ALIGN>
+ inline C14CONSTEXPR const T *assume_aligned_ptr(const T *p) noexcept
+ {
+ return p;
+ }
+#endif
template<typename T, typename... Args>
- T *palloc(Args&&... args)
+ inline T *pnew(Args&&... args)
{
- return new T(std::forward<Args>(args)...);
+ auto *p = paligned_alloc(alignof(T), sizeof(T));
+ return new(p) T(std::forward<Args>(args)...);
}
template<typename T>
- void pfree(T *ptr)
+ inline void pdelete(T *ptr)
{
- delete ptr;
+ ptr->~T();
+ pfree(ptr);
}
template<typename T>
- T* palloc_array(const std::size_t num)
+ inline T* pnew_array(const std::size_t num)
{
return new T[num]();
}
template<typename T>
- void pfree_array(T *ptr)
+ inline void pdelete_array(T *ptr)
{
delete [] ptr;
}
- template <typename SC, typename D = std::default_delete<SC>>
+ template <typename T>
+ struct pdefault_deleter
+ {
+ constexpr pdefault_deleter() noexcept = default;
+
+ template<typename U, typename = typename
+ std::enable_if<std::is_convertible< U*, T*>::value>::type>
+ pdefault_deleter(const pdefault_deleter<U>&) noexcept { }
+
+ void operator()(T *p) const
+ {
+ pdelete(p);
+ }
+ };
+
+ template <typename SC, typename D = pdefault_deleter<SC>>
class owned_ptr
{
public:
@@ -142,19 +221,113 @@ namespace plib {
bool m_is_owned;
};
+ template <typename T>
+ using unique_ptr = std::unique_ptr<T, pdefault_deleter<T>>;
+
template<typename T, typename... Args>
- std::unique_ptr<T> make_unique(Args&&... args)
+ plib::unique_ptr<T> make_unique(Args&&... args)
{
- return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
+ return plib::unique_ptr<T>(pnew<T>(std::forward<Args>(args)...));
}
template<typename T, typename... Args>
static owned_ptr<T> make_owned(Args&&... args)
{
- owned_ptr<T> a(new T(std::forward<Args>(args)...), true);
+ owned_ptr<T> a(pnew<T>(std::forward<Args>(args)...), true);
return std::move(a);
}
+ template <class T, std::size_t ALIGN = alignof(T)>
+ class aligned_allocator
+ {
+ public:
+ using value_type = T;
+
+ static_assert(ALIGN >= alignof(T) && (ALIGN % alignof(T)) == 0,
+ "ALIGN must be greater than alignof(T) and a multiple");
+
+ aligned_allocator() = default;
+
+ aligned_allocator(const aligned_allocator&) = default;
+ aligned_allocator& operator=(const aligned_allocator&) = delete;
+
+ template <class U>
+ aligned_allocator(const aligned_allocator<U, ALIGN>& rhs) noexcept
+ {
+ unused_var(rhs);
+ }
+
+ template <class U> struct rebind
+ {
+ using other = aligned_allocator<U, ALIGN>;
+ };
+
+ T* allocate(std::size_t n)
+ {
+ return reinterpret_cast<T *>(paligned_alloc(ALIGN, sizeof(T) * n));
+ }
+
+ void deallocate(T* p, std::size_t n) noexcept
+ {
+ unused_var(n);
+ pfree(p);
+ }
+
+ template <class T1, std::size_t A1, class U, std::size_t A2>
+ friend bool operator==(const aligned_allocator<T1, A1>& lhs,
+ const aligned_allocator<U, A2>& rhs) noexcept;
+
+ template <class U, std::size_t A> friend class aligned_allocator;
+ };
+
+ template <class T1, std::size_t A1, class U, std::size_t A2>
+ /*friend*/ inline bool operator==(const aligned_allocator<T1, A1>& lhs,
+ const aligned_allocator<U, A2>& rhs) noexcept
+ {
+ unused_var(lhs, rhs);
+ return A1 == A2;
+ }
+ template <class T1, std::size_t A1, class U, std::size_t A2>
+ /*friend*/ inline bool operator!=(const aligned_allocator<T1, A1>& lhs,
+ const aligned_allocator<U, A2>& rhs) noexcept
+ {
+ return !(lhs == rhs);
+ }
+
+ // FIXME: needs to be somewhere else
+#if 0
+ template <class T, std::size_t ALIGN = alignof(T)>
+ using aligned_vector = std::vector<T, aligned_allocator<T, alignof(T)>>;
+ //using aligned_vector = std::vector<T, aligned_allocator<T, ALIGN>>;
+#else
+ template <class T, std::size_t ALIGN = alignof(T)>
+ class aligned_vector : public std::vector<T, aligned_allocator<T, ALIGN>>
+ {
+ public:
+ using base = std::vector<T, aligned_allocator<T, ALIGN>>;
+
+ using reference = typename base::reference;
+ using const_reference = typename base::const_reference;
+ using size_type = typename base::size_type;
+
+ using base::base;
+
+ reference operator[](size_type i) noexcept
+ {
+ return assume_aligned_ptr<T, ALIGN>(this->data())[i];
+ }
+ constexpr const_reference operator[](size_type i) const noexcept
+ {
+ return assume_aligned_ptr<T, ALIGN>(this->data())[i];
+ }
+
+ };
+
+
+#endif
+
+
+
} // namespace plib
#endif /* PALLOC_H_ */
diff --git a/src/lib/netlist/plib/parray.h b/src/lib/netlist/plib/parray.h
index 662c2e9550e..e09639163f0 100644
--- a/src/lib/netlist/plib/parray.h
+++ b/src/lib/netlist/plib/parray.h
@@ -10,6 +10,7 @@
#include "pconfig.h"
#include "pexception.h"
+#include "palloc.h"
#include <array>
#include <memory>
@@ -30,7 +31,7 @@ namespace plib {
struct sizeabs<FT, 0>
{
static constexpr const std::size_t ABS = 0;
- using container = typename std::vector<FT> ;
+ using container = typename std::vector<FT, aligned_allocator<FT, PALIGN_VECTOROPT>>;
};
/**
@@ -102,11 +103,17 @@ namespace plib {
return m_a[i];
}
#else
- reference operator[](size_type i) noexcept { return m_a[i]; }
- constexpr const_reference operator[](size_type i) const noexcept { return m_a[i]; }
+ reference operator[](size_type i) noexcept
+ {
+ return assume_aligned_ptr<FT, PALIGN_VECTOROPT>(&m_a[0])[i];
+ }
+ constexpr const_reference operator[](size_type i) const noexcept
+ {
+ return assume_aligned_ptr<FT, PALIGN_VECTOROPT>(&m_a[0])[i];
+ }
#endif
- FT * data() noexcept { return m_a.data(); }
- const FT * data() const noexcept { return m_a.data(); }
+ FT * data() noexcept { return assume_aligned_ptr<FT, PALIGN_VECTOROPT>(m_a.data()); }
+ const FT * data() const noexcept { return assume_aligned_ptr<FT, PALIGN_VECTOROPT>(m_a.data()); }
private:
PALIGNAS_VECTOROPT()
diff --git a/src/lib/netlist/plib/pconfig.h b/src/lib/netlist/plib/pconfig.h
index cc92a42c827..9f61fc0b01f 100644
--- a/src/lib/netlist/plib/pconfig.h
+++ b/src/lib/netlist/plib/pconfig.h
@@ -34,11 +34,22 @@
#endif
/*
+ * Set this to one if you want to use aligned storage optimizations.
+ */
+
+#ifndef USE_ALIGNED_OPTIMIZATIONS
+#define USE_ALIGNED_OPTIMIZATIONS (0)
+#endif
+
+/*
* Standard alignment macros
*/
-#define PALIGNAS_CACHELINE() PALIGNAS(64)
-#define PALIGNAS_VECTOROPT() PALIGNAS(64)
+#define PALIGN_CACHELINE (64)
+#define PALIGN_VECTOROPT (16)
+
+#define PALIGNAS_CACHELINE() PALIGNAS(PALIGN_CACHELINE)
+#define PALIGNAS_VECTOROPT() PALIGNAS(PALIGN_VECTOROPT)
/* Breaks mame build on windows due to -Wattribute */
#if defined(_WIN32) && defined(__GNUC__)
diff --git a/src/lib/netlist/plib/pdynlib.cpp b/src/lib/netlist/plib/pdynlib.cpp
index f30ddc5d59a..c0c89de208d 100644
--- a/src/lib/netlist/plib/pdynlib.cpp
+++ b/src/lib/netlist/plib/pdynlib.cpp
@@ -25,7 +25,7 @@ CHAR *astring_from_utf8(const char *utf8string)
// convert UTF-16 to "ANSI code page" string
char_count = WideCharToMultiByte(CP_ACP, 0, wstring, -1, nullptr, 0, nullptr, nullptr);
- result = palloc_array<CHAR>(char_count);
+ result = pnew_array<CHAR>(char_count);
if (result != nullptr)
WideCharToMultiByte(CP_ACP, 0, wstring, -1, result, char_count, nullptr, nullptr);
@@ -39,7 +39,7 @@ WCHAR *wstring_from_utf8(const char *utf8string)
// convert MAME string (UTF-8) to UTF-16
char_count = MultiByteToWideChar(CP_UTF8, 0, utf8string, -1, nullptr, 0);
- result = palloc_array<WCHAR>(char_count);
+ result = pnew_array<WCHAR>(char_count);
if (result != nullptr)
MultiByteToWideChar(CP_UTF8, 0, utf8string, -1, result, char_count);
@@ -72,7 +72,7 @@ dynlib::dynlib(const pstring libname)
m_isLoaded = true;
//else
// fprintf(stderr, "win: library <%s> not found!\n", libname.c_str());
- pfree_array(buffer);
+ pdelete_array(buffer);
#elif defined(EMSCRIPTEN)
//no-op
#else
@@ -106,7 +106,7 @@ dynlib::dynlib(const pstring path, const pstring libname)
{
//printf("win: library <%s> not found!\n", libname.c_str());
}
- pfree_array(buffer);
+ pdelete_array(buffer);
#elif defined(EMSCRIPTEN)
//no-op
#else
diff --git a/src/lib/netlist/plib/pmempool.h b/src/lib/netlist/plib/pmempool.h
index 80e30ada324..c55d66d8847 100644
--- a/src/lib/netlist/plib/pmempool.h
+++ b/src/lib/netlist/plib/pmempool.h
@@ -34,7 +34,6 @@ namespace plib {
void operator()(T *p) const
{
- p->~T();
P::free(p);
}
};
@@ -83,7 +82,7 @@ namespace plib {
block * new_block(std::size_t min_bytes)
{
- auto *b = new block(this, min_bytes);
+ auto *b = plib::pnew<block>(this, min_bytes);
m_blocks.push_back(b);
return b;
}
@@ -123,22 +122,27 @@ namespace plib {
}
}
- void *alloc(size_t size, size_t align)
+ template <std::size_t ALIGN>
+ void *alloc(size_t size)
{
+ size_t align = ALIGN;
if (align < m_min_align)
align = m_min_align;
- size_t rs = (size + align - 1) & ~(align - 1);
+ size_t rs = size + align;
for (auto &b : m_blocks)
{
if (b->m_free > rs)
{
b->m_free -= rs;
b->m_num_alloc++;
- auto ret = reinterpret_cast<void *>(b->m_data + b->m_cur);
+ auto *ret = reinterpret_cast<void *>(b->m_data + b->m_cur);
auto capacity(rs);
- std::align(align, size, ret, capacity);
+ ret = std::align(align, size, ret, capacity);
+ if (ret == nullptr)
+ printf("Oh no\n");
sinfo().insert({ ret, info(b, b->m_cur)});
+ rs -= (capacity - size);
b->m_cur += rs;
return ret;
@@ -148,17 +152,24 @@ namespace plib {
block *b = new_block(rs);
b->m_num_alloc = 1;
b->m_free = m_min_alloc - rs;
- auto ret = reinterpret_cast<void *>(b->m_data + b->m_cur);
+ auto *ret = reinterpret_cast<void *>(b->m_data + b->m_cur);
auto capacity(rs);
- std::align(align, size, ret, capacity);
+ ret = std::align(align, size, ret, capacity);
+ if (ret == nullptr)
+ printf("Oh no\n");
sinfo().insert({ ret, info(b, b->m_cur)});
+ rs -= (capacity - size);
b->m_cur += rs;
return ret;
}
}
- static void free(void *ptr)
+ template <typename T>
+ static void free(T *ptr)
{
+ /* call destructor */
+ ptr->~T();
+
auto it = sinfo().find(ptr);
if (it == sinfo().end())
plib::terminate("mempool::free - pointer not found\n");
@@ -182,7 +193,7 @@ namespace plib {
template<typename T, typename... Args>
poolptr<T> make_poolptr(Args&&... args)
{
- auto mem = this->alloc(sizeof(T), alignof(T));
+ auto *mem = this->alloc<alignof(T)>(sizeof(T));
auto *obj = new (mem) T(std::forward<Args>(args)...);
poolptr<T> a(obj, true);
return std::move(a);
@@ -208,6 +219,7 @@ namespace plib {
~mempool_default() = default;
+#if 0
void *alloc(size_t size)
{
plib::unused_var(m_min_alloc); // -Wunused-private-field fires without
@@ -216,9 +228,11 @@ namespace plib {
return ::operator new(size);
}
- static void free(void *ptr)
+#endif
+ template <typename T>
+ static void free(T *ptr)
{
- ::operator delete(ptr);
+ plib::pdelete(ptr);
}
template <typename T>
@@ -227,12 +241,13 @@ namespace plib {
template<typename T, typename... Args>
poolptr<T> make_poolptr(Args&&... args)
{
- auto mem(alloc(sizeof(T)));
- auto *obj = new (mem) T(std::forward<Args>(args)...);
+ plib::unused_var(m_min_alloc); // -Wunused-private-field fires without
+ plib::unused_var(m_min_align);
+
+ auto *obj = plib::pnew<T>(std::forward<Args>(args)...);
poolptr<T> a(obj, true);
return std::move(a);
}
-
};
diff --git a/src/lib/netlist/plib/pstate.h b/src/lib/netlist/plib/pstate.h
index cdb6ea94dc8..d837a6d2931 100644
--- a/src/lib/netlist/plib/pstate.h
+++ b/src/lib/netlist/plib/pstate.h
@@ -10,6 +10,7 @@
#include "pstring.h"
#include "ptypes.h"
+#include "palloc.h"
#include <array>
#include <memory>
@@ -63,7 +64,7 @@ public:
struct entry_t
{
- using list_t = std::vector<std::unique_ptr<entry_t>>;
+ using list_t = std::vector<plib::unique_ptr<entry_t>>;
entry_t(const pstring &stname, const datatype_t &dt, const void *owner,
const std::size_t count, void *ptr)
diff --git a/src/lib/netlist/plib/pstream.cpp b/src/lib/netlist/plib/pstream.cpp
index f9dd224e92f..8f80f317f98 100644
--- a/src/lib/netlist/plib/pstream.cpp
+++ b/src/lib/netlist/plib/pstream.cpp
@@ -270,13 +270,13 @@ pimemstream::pos_type pimemstream::vtell() const
pomemstream::pomemstream()
: postream(FLAG_SEEKABLE), m_pos(0), m_capacity(1024), m_size(0)
{
- m_mem = palloc_array<char>(m_capacity);
+ m_mem = pnew_array<char>(m_capacity);
}
pomemstream::~pomemstream()
{
if (m_mem != nullptr)
- pfree_array(m_mem);
+ pdelete_array(m_mem);
}
void pomemstream::vwrite(const value_type *buf, const pos_type n)
@@ -286,13 +286,13 @@ void pomemstream::vwrite(const value_type *buf, const pos_type n)
while (m_pos + n >= m_capacity)
m_capacity *= 2;
char *o = m_mem;
- m_mem = palloc_array<char>(m_capacity);
+ m_mem = pnew_array<char>(m_capacity);
if (m_mem == nullptr)
{
throw out_of_mem_e("pomemstream::vwrite");
}
std::copy(o, o + m_pos, m_mem);
- pfree_array(o);
+ pdelete_array(o);
}
std::copy(buf, buf + n, m_mem + m_pos);
@@ -309,13 +309,13 @@ void pomemstream::vseek(const pos_type n)
while (m_size >= m_capacity)
m_capacity *= 2;
char *o = m_mem;
- m_mem = palloc_array<char>(m_capacity);
+ m_mem = pnew_array<char>(m_capacity);
if (m_mem == nullptr)
{
throw out_of_mem_e("pomemstream::vseek");
}
std::copy(o, o + m_pos, m_mem);
- pfree_array(o);
+ pdelete_array(o);
}
}
diff --git a/src/lib/netlist/plib/pstream.h b/src/lib/netlist/plib/pstream.h
index 80619137c51..d5b2bfa4809 100644
--- a/src/lib/netlist/plib/pstream.h
+++ b/src/lib/netlist/plib/pstream.h
@@ -447,7 +447,7 @@ private:
template <typename T>
struct constructor_helper
{
- std::unique_ptr<pistream> operator()(T &&s) { return std::move(plib::make_unique<T>(std::move(s))); }
+ plib::unique_ptr<pistream> operator()(T &&s) { return std::move(plib::make_unique<T>(std::move(s))); }
};
// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions)
@@ -489,20 +489,20 @@ public:
}
private:
- std::unique_ptr<pistream> m_strm;
+ plib::unique_ptr<pistream> m_strm;
putf8string m_linebuf;
};
template <>
struct constructor_helper<putf8_reader>
{
- std::unique_ptr<pistream> operator()(putf8_reader &&s) { return std::move(s.m_strm); }
+ plib::unique_ptr<pistream> operator()(putf8_reader &&s) { return std::move(s.m_strm); }
};
template <>
-struct constructor_helper<std::unique_ptr<pistream>>
+struct constructor_helper<plib::unique_ptr<pistream>>
{
- std::unique_ptr<pistream> operator()(std::unique_ptr<pistream> &&s) { return std::move(s); }
+ plib::unique_ptr<pistream> operator()(plib::unique_ptr<pistream> &&s) { return std::move(s); }
};
@@ -626,11 +626,11 @@ public:
{
std::size_t sz = 0;
read(sz);
- auto buf = plib::palloc_array<plib::string_info<pstring>::mem_t>(sz+1);
+ auto buf = plib::pnew_array<plib::string_info<pstring>::mem_t>(sz+1);
m_strm.read(reinterpret_cast<pistream::value_type *>(buf), sz);
buf[sz] = 0;
s = pstring(buf);
- plib::pfree_array(buf);
+ plib::pdelete_array(buf);
}
template <typename T>
diff --git a/src/lib/netlist/prg/nltool.cpp b/src/lib/netlist/prg/nltool.cpp
index ea7e1426626..076d004528c 100644
--- a/src/lib/netlist/prg/nltool.cpp
+++ b/src/lib/netlist/prg/nltool.cpp
@@ -126,13 +126,13 @@ public:
{
}
- std::unique_ptr<plib::pistream> stream(const pstring &file) override;
+ plib::unique_ptr<plib::pistream> stream(const pstring &file) override;
private:
pstring m_folder;
};
-std::unique_ptr<plib::pistream> netlist_data_folder_t::stream(const pstring &file)
+plib::unique_ptr<plib::pistream> netlist_data_folder_t::stream(const pstring &file)
{
pstring name = m_folder + "/" + file;
try
@@ -145,7 +145,7 @@ std::unique_ptr<plib::pistream> netlist_data_folder_t::stream(const pstring &fil
if (dynamic_cast<const plib::file_open_e *>(&e) == nullptr )
throw;
}
- return std::unique_ptr<plib::pistream>(nullptr);
+ return plib::unique_ptr<plib::pistream>(nullptr);
}
class netlist_tool_callbacks_t : public netlist::callbacks_t
diff --git a/src/lib/netlist/prg/nlwav.cpp b/src/lib/netlist/prg/nlwav.cpp
index 96cf9342058..24c84c73739 100644
--- a/src/lib/netlist/prg/nlwav.cpp
+++ b/src/lib/netlist/prg/nlwav.cpp
@@ -166,7 +166,7 @@ public:
return success;
}
- void process(std::vector<std::unique_ptr<plib::pistream>> &is)
+ void process(std::vector<plib::unique_ptr<plib::pistream>> &is)
{
std::vector<plib::putf8_reader> readers;
for (auto &i : is)
@@ -431,7 +431,7 @@ public:
private:
void convert_wav();
void convert_vcd(vcdwriter::format_e format);
- std::vector<std::unique_ptr<plib::pistream>> m_instrms;
+ std::vector<plib::unique_ptr<plib::pistream>> m_instrms;
plib::postream *m_outstrm;
};
@@ -440,8 +440,8 @@ void nlwav_app::convert_wav()
double dt = 1.0 / static_cast<double>(opt_rate());
- std::unique_ptr<wavwriter> wo = plib::make_unique<wavwriter>(*m_outstrm, m_instrms.size(), opt_rate(), opt_amp());
- std::unique_ptr<aggregator> ago = plib::make_unique<aggregator>(m_instrms.size(), dt, aggregator::callback_type(&wavwriter::process, wo.get()));
+ plib::unique_ptr<wavwriter> wo = plib::make_unique<wavwriter>(*m_outstrm, m_instrms.size(), opt_rate(), opt_amp());
+ plib::unique_ptr<aggregator> ago = plib::make_unique<aggregator>(m_instrms.size(), dt, aggregator::callback_type(&wavwriter::process, wo.get()));
aggregator::callback_type agcb = log_processor::callback_type(&aggregator::process, ago.get());
log_processor lp(m_instrms.size(), agcb);
@@ -462,7 +462,7 @@ void nlwav_app::convert_wav()
void nlwav_app::convert_vcd(vcdwriter::format_e format)
{
- std::unique_ptr<vcdwriter> wo = plib::make_unique<vcdwriter>(*m_outstrm, opt_args(),
+ plib::unique_ptr<vcdwriter> wo = plib::make_unique<vcdwriter>(*m_outstrm, opt_args(),
format, opt_high(), opt_low());
log_processor::callback_type agcb = log_processor::callback_type(&vcdwriter::process, wo.get());
@@ -510,11 +510,11 @@ int nlwav_app::execute()
return 0;
}
- m_outstrm = (opt_out() == "-" ? &pout_strm : plib::palloc<plib::pofilestream>(opt_out()));
+ m_outstrm = (opt_out() == "-" ? &pout_strm : plib::pnew<plib::pofilestream>(opt_out()));
for (auto &oi: opt_args())
{
- std::unique_ptr<plib::pistream> fin = (oi == "-" ?
+ plib::unique_ptr<plib::pistream> fin = (oi == "-" ?
plib::make_unique<plib::pstdin>()
: plib::make_unique<plib::pifilestream>(oi));
m_instrms.push_back(std::move(fin));
@@ -534,7 +534,7 @@ int nlwav_app::execute()
}
if (opt_out() != "-")
- plib::pfree(m_outstrm);
+ plib::pdelete(m_outstrm);
return 0;
}
diff --git a/src/lib/netlist/solver/nld_matrix_solver.cpp b/src/lib/netlist/solver/nld_matrix_solver.cpp
index 36c8f2fb551..951733874fd 100644
--- a/src/lib/netlist/solver/nld_matrix_solver.cpp
+++ b/src/lib/netlist/solver/nld_matrix_solver.cpp
@@ -336,9 +336,9 @@ void matrix_solver_t::setup_matrix()
* This should reduce cache misses ...
*/
- auto **touched = plib::palloc_array<bool *>(iN);
+ auto **touched = plib::pnew_array<bool *>(iN);
for (std::size_t k=0; k<iN; k++)
- touched[k] = plib::palloc_array<bool>(iN);
+ touched[k] = plib::pnew_array<bool>(iN);
for (std::size_t k = 0; k < iN; k++)
{
@@ -397,8 +397,8 @@ void matrix_solver_t::setup_matrix()
}
for (std::size_t k=0; k<iN; k++)
- plib::pfree_array(touched[k]);
- plib::pfree_array(touched);
+ plib::pdelete_array(touched[k]);
+ plib::pdelete_array(touched);
}
void matrix_solver_t::update_inputs()
diff --git a/src/lib/netlist/solver/nld_matrix_solver.h b/src/lib/netlist/solver/nld_matrix_solver.h
index 803437d76e2..e5404290de0 100644
--- a/src/lib/netlist/solver/nld_matrix_solver.h
+++ b/src/lib/netlist/solver/nld_matrix_solver.h
@@ -10,6 +10,7 @@
#include "netlist/nl_base.h"
#include "netlist/nl_errstr.h"
+#include "netlist/plib/palloc.h"
#include "netlist/plib/putil.h"
#include "netlist/plib/vector_ops.h"
@@ -103,9 +104,6 @@ public:
std::vector<unsigned> m_nzrd; /* non zero right of the diagonal for elimination, may include RHS element */
std::vector<unsigned> m_nzbd; /* non zero below of the diagonal for elimination */
-
-
-
/* state */
nl_double m_last_V;
nl_double m_DD_n_m_1;
@@ -113,10 +111,10 @@ public:
private:
std::vector<int> m_connected_net_idx;
- std::vector<nl_double> m_go;
- std::vector<nl_double> m_gt;
- std::vector<nl_double> m_Idr;
- std::vector<nl_double *> m_connected_net_V;
+ plib::aligned_vector<nl_double, PALIGN_VECTOROPT> m_go;
+ plib::aligned_vector<nl_double, PALIGN_VECTOROPT> m_gt;
+ plib::aligned_vector<nl_double, PALIGN_VECTOROPT> m_Idr;
+ plib::aligned_vector<nl_double *, PALIGN_VECTOROPT> m_connected_net_V;
std::vector<terminal_t *> m_terms;
};
@@ -218,11 +216,11 @@ protected:
template <typename T>
void build_LE_RHS(T &child);
- std::vector<std::unique_ptr<terms_for_net_t>> m_terms;
+ std::vector<plib::unique_ptr<terms_for_net_t>> m_terms;
std::vector<analog_net_t *> m_nets;
std::vector<poolptr<proxied_analog_output_t>> m_inps;
- std::vector<std::unique_ptr<terms_for_net_t>> m_rails_temp;
+ std::vector<plib::unique_ptr<terms_for_net_t>> m_rails_temp;
const solver_parameters_t &m_params;
diff --git a/src/lib/netlist/solver/nld_ms_gcr.h b/src/lib/netlist/solver/nld_ms_gcr.h
index 8d1351435c8..d2caa944434 100644
--- a/src/lib/netlist/solver/nld_ms_gcr.h
+++ b/src/lib/netlist/solver/nld_ms_gcr.h
@@ -65,7 +65,8 @@ private:
plib::parray<FT, SIZE> RHS;
plib::parray<FT, SIZE> new_V;
- std::array<std::vector<FT *>, storage_N> m_term_cr;
+ std::array<plib::aligned_vector<FT *, PALIGN_VECTOROPT>, storage_N> m_term_cr;
+// std::array<std::vector<FT *>, storage_N> m_term_cr;
mat_type mat;
diff --git a/src/lib/netlist/solver/nld_ms_gmres.h b/src/lib/netlist/solver/nld_ms_gmres.h
index 3cd88dea429..dcb3726f5f2 100644
--- a/src/lib/netlist/solver/nld_ms_gmres.h
+++ b/src/lib/netlist/solver/nld_ms_gmres.h
@@ -51,7 +51,7 @@ namespace devices
using mattype = typename plib::matrix_compressed_rows_t<FT, SIZE>::index_type;
- plib::parray<std::vector<FT *>, SIZE> m_term_cr;
+ plib::parray<plib::aligned_vector<FT *, PALIGN_VECTOROPT>, SIZE> m_term_cr;
plib::mat_precondition_ILU<FT, SIZE> m_ops;
//plib::mat_precondition_diag<FT, SIZE> m_ops;
plib::gmres_t<FT, SIZE> m_gmres;
diff --git a/src/lib/netlist/solver/nld_solver.cpp b/src/lib/netlist/solver/nld_solver.cpp
index 6ce9a093c84..44d51793690 100644
--- a/src/lib/netlist/solver/nld_solver.cpp
+++ b/src/lib/netlist/solver/nld_solver.cpp
@@ -175,6 +175,25 @@ poolptr<matrix_solver_t> NETLIB_NAME(solver)::create_solver(std::size_t size, co
}
}
+template <typename FT, int SIZE>
+poolptr<matrix_solver_t> NETLIB_NAME(solver)::create_solver_x(std::size_t size, const pstring &solvername)
+{
+ if (SIZE > 0)
+ {
+ if (size == SIZE)
+ return create_solver<FT, SIZE>(size, solvername);
+ else
+ return this->create_solver_x<FT, SIZE-1>(size, solvername);
+ }
+ else
+ {
+ if (size * 2 > -SIZE )
+ return create_solver<FT, SIZE>(size, solvername);
+ else
+ return this->create_solver_x<FT, SIZE / 2>(size, solvername);
+ }
+};
+
struct net_splitter
{
@@ -230,9 +249,6 @@ struct net_splitter
void NETLIB_NAME(solver)::post_start()
{
- const bool use_specific = true;
- plib::unused_var(use_specific);
-
m_params.m_pivot = m_pivot();
m_params.m_accuracy = m_accuracy();
/* FIXME: Throw when negative */
@@ -283,18 +299,11 @@ void NETLIB_NAME(solver)::post_start()
{
#if 1
case 1:
- if (use_specific)
- ms = pool().make_poolptr<matrix_solver_direct1_t<double>>(state(), sname, &m_params);
- else
- ms = create_solver<double, 1>(1, sname);
+ ms = pool().make_poolptr<matrix_solver_direct1_t<double>>(state(), sname, &m_params);
break;
case 2:
- if (use_specific)
- ms = pool().make_poolptr<matrix_solver_direct2_t<double>>(state(), sname, &m_params);
- else
- ms = create_solver<double, 2>(2, sname);
+ ms = pool().make_poolptr<matrix_solver_direct2_t<double>>(state(), sname, &m_params);
break;
-#if 1
case 3:
ms = create_solver<double, 3>(3, sname);
break;
@@ -319,6 +328,7 @@ void NETLIB_NAME(solver)::post_start()
case 10:
ms = create_solver<double, 10>(10, sname);
break;
+#if 0
case 11:
ms = create_solver<double, 11>(11, sname);
break;
@@ -341,7 +351,7 @@ void NETLIB_NAME(solver)::post_start()
ms = create_solver<double, 49>(49, sname);
break;
#endif
-#if 0
+#if 1
case 86:
ms = create_solver<double,86>(86, sname);
break;
diff --git a/src/lib/netlist/solver/nld_solver.h b/src/lib/netlist/solver/nld_solver.h
index 247abc9097b..c4a9eba6971 100644
--- a/src/lib/netlist/solver/nld_solver.h
+++ b/src/lib/netlist/solver/nld_solver.h
@@ -105,6 +105,9 @@ private:
template <typename FT, int SIZE>
poolptr<matrix_solver_t> create_solver(std::size_t size, const pstring &solvername);
+
+ template <typename FT, int SIZE>
+ poolptr<matrix_solver_t> create_solver_x(std::size_t size, const pstring &solvername);
};
} //namespace devices
diff --git a/src/lib/netlist/tools/nl_convert.cpp b/src/lib/netlist/tools/nl_convert.cpp
index 95e05d27857..f4616cb7774 100644
--- a/src/lib/netlist/tools/nl_convert.cpp
+++ b/src/lib/netlist/tools/nl_convert.cpp
@@ -81,7 +81,7 @@ void nl_convert_base_t::add_ext_alias(const pstring &alias)
m_ext_alias.push_back(alias);
}
-void nl_convert_base_t::add_device(std::unique_ptr<dev_t> dev)
+void nl_convert_base_t::add_device(plib::unique_ptr<dev_t> dev)
{
for (auto & d : m_devs)
if (d->name() == dev->name())
diff --git a/src/lib/netlist/tools/nl_convert.h b/src/lib/netlist/tools/nl_convert.h
index 7dd0e56c5ee..73c98301af5 100644
--- a/src/lib/netlist/tools/nl_convert.h
+++ b/src/lib/netlist/tools/nl_convert.h
@@ -124,14 +124,14 @@ private:
private:
- void add_device(std::unique_ptr<dev_t> dev);
+ void add_device(plib::unique_ptr<dev_t> dev);
plib::postringstream m_buf;
- std::vector<std::unique_ptr<dev_t>> m_devs;
- std::unordered_map<pstring, std::unique_ptr<net_t> > m_nets;
+ std::vector<plib::unique_ptr<dev_t>> m_devs;
+ std::unordered_map<pstring, plib::unique_ptr<net_t> > m_nets;
std::vector<pstring> m_ext_alias;
- std::unordered_map<pstring, std::unique_ptr<pin_alias_t>> m_pins;
+ std::unordered_map<pstring, plib::unique_ptr<pin_alias_t>> m_pins;
static unit_t m_units[];
pstring m_numberchars;
diff --git a/src/mame/drivers/model2.cpp b/src/mame/drivers/model2.cpp
index d4dcd86c361..ce22010dc32 100644
--- a/src/mame/drivers/model2.cpp
+++ b/src/mame/drivers/model2.cpp
@@ -5306,7 +5306,7 @@ Main board ID# 837-10854-02-91
Sega Game ID# 836-13274 OVER REV
ROM board ID# 836-13275
-These ID numbers have been verfied on multiple board sets for both revision A and revision B program ROMs
+These ID numbers have been verified on multiple board sets for both revision A and revision B program ROMs
*/
ROM_START( overrevb ) /* Over Rev Revision B, Model 2B */
ROM_REGION( 0x200000, "maincpu", 0 ) // i960 program
diff --git a/src/mame/drivers/model3.cpp b/src/mame/drivers/model3.cpp
index a0ed163092c..fb31b4a5303 100644
--- a/src/mame/drivers/model3.cpp
+++ b/src/mame/drivers/model3.cpp
@@ -5213,7 +5213,7 @@ ROM_START( harleya ) /* Step 2.0, Sega game ID# is 833-13325, ROM board ID# 8
ROM_FILL( 0x000000, 0x1000000, 0x0000 )
ROM_END
-ROM_START( fvipers2 ) /* Step 2.0 */
+ROM_START( fvipers2 ) /* Step 2.0, Sega game ID# is 833-13407 FIGHTING VIPERS2, ROM board ID# 834-13408 FIGHTING VIPERS2, Security board ID# 837-13423-COM */
ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */
// CROM
ROM_LOAD64_WORD_SWAP( "epr-20596a.17", 0x000006, 0x200000, CRC(969ab801) SHA1(a7a2aa71204d1c38a6a8c0605331fd859cb224f1) )
diff --git a/src/mame/drivers/suprnova.cpp b/src/mame/drivers/suprnova.cpp
index 1c9a193c4da..fae1e70d3e6 100644
--- a/src/mame/drivers/suprnova.cpp
+++ b/src/mame/drivers/suprnova.cpp
@@ -1257,20 +1257,20 @@ ROM_START( galpanis )
ROM_LOAD16_BYTE( "gps-001-e1.u8", 0x000001, 0x100000, CRC(ded57bd0) SHA1(4c0122f0521829d4d83b6b1c403f7e6470f14951) )
ROM_REGION( 0x1000000, "spritegen", 0 )
- ROM_LOAD( "gps10000.u24", 0x000000, 0x400000, CRC(a1a7acf2) SHA1(52c86ae907f0c0236808c19f652955b09e90ec5a) )
- ROM_LOAD( "gps10100.u20", 0x400000, 0x400000, CRC(49f764b6) SHA1(9f4289858c3dac625ef623cc381a47b45aa5d8e2) )
- ROM_LOAD( "gps10200.u17", 0x800000, 0x400000, CRC(51980272) SHA1(6c0706d913b33995579aaf0688c4bf26d6d35a78) )
+ ROM_LOAD( "gps-100-00.u24", 0x000000, 0x400000, CRC(a1a7acf2) SHA1(52c86ae907f0c0236808c19f652955b09e90ec5a) )
+ ROM_LOAD( "gps-101-00.u20", 0x400000, 0x400000, CRC(49f764b6) SHA1(9f4289858c3dac625ef623cc381a47b45aa5d8e2) )
+ ROM_LOAD( "gps-102-00.u17", 0x800000, 0x400000, CRC(51980272) SHA1(6c0706d913b33995579aaf0688c4bf26d6d35a78) )
ROM_REGION( 0x800000, "gfx2", 0 )
- ROM_LOAD( "gps20000.u16", 0x000000, 0x400000, CRC(c146a09e) SHA1(5af5a7b9d9a55ec7aba3fd85a3a0211b92b1b84f) )
- ROM_LOAD( "gps20100.u13", 0x400000, 0x400000, CRC(9dfa2dc6) SHA1(a058c42fd76c23c0e5c8c11f5617fd29e056be7d) )
+ ROM_LOAD( "gps-200-00.u16", 0x000000, 0x400000, CRC(c146a09e) SHA1(5af5a7b9d9a55ec7aba3fd85a3a0211b92b1b84f) )
+ ROM_LOAD( "gps-201-00.u13", 0x400000, 0x400000, CRC(9dfa2dc6) SHA1(a058c42fd76c23c0e5c8c11f5617fd29e056be7d) )
ROM_REGION( 0x800000, "gfx3", ROMREGION_ERASE00 ) /* Tiles Plane B */
/* First 0x040000 bytes (0x03ff Tiles) are RAM Based Tiles */
/* 0x040000 - 0x3fffff empty? */
ROM_REGION( 0x400000, "ymz", 0 ) /* Samples */
- ROM_LOAD( "gps30000.u4", 0x000000, 0x400000, CRC(9e4da8e3) SHA1(6506d9300a442883357003a05fd2c78d364c35bb) )
+ ROM_LOAD( "gps-300-00.u4", 0x000000, 0x400000, CRC(9e4da8e3) SHA1(6506d9300a442883357003a05fd2c78d364c35bb) )
ROM_END
ROM_START( galpanise )
@@ -1281,20 +1281,20 @@ ROM_START( galpanise )
ROM_LOAD16_BYTE( "u8", 0x000001, 0x100000, CRC(098eff7c) SHA1(3cac22cbb11905a46afaa62c0470624b3b554fc0) ) /* mask ROM with no labels */
ROM_REGION( 0x1000000, "spritegen", 0 )
- ROM_LOAD( "gps10000.u24", 0x000000, 0x400000, CRC(a1a7acf2) SHA1(52c86ae907f0c0236808c19f652955b09e90ec5a) )
- ROM_LOAD( "gps10100.u20", 0x400000, 0x400000, CRC(49f764b6) SHA1(9f4289858c3dac625ef623cc381a47b45aa5d8e2) )
- ROM_LOAD( "gps10200.u17", 0x800000, 0x400000, CRC(51980272) SHA1(6c0706d913b33995579aaf0688c4bf26d6d35a78) )
+ ROM_LOAD( "gps-100-00.u24", 0x000000, 0x400000, CRC(a1a7acf2) SHA1(52c86ae907f0c0236808c19f652955b09e90ec5a) )
+ ROM_LOAD( "gps-101-00.u20", 0x400000, 0x400000, CRC(49f764b6) SHA1(9f4289858c3dac625ef623cc381a47b45aa5d8e2) )
+ ROM_LOAD( "gps-102-00.u17", 0x800000, 0x400000, CRC(51980272) SHA1(6c0706d913b33995579aaf0688c4bf26d6d35a78) )
ROM_REGION( 0x800000, "gfx2", 0 )
- ROM_LOAD( "gps20000.u16", 0x000000, 0x400000, CRC(c146a09e) SHA1(5af5a7b9d9a55ec7aba3fd85a3a0211b92b1b84f) )
- ROM_LOAD( "gps20100.u13", 0x400000, 0x400000, CRC(9dfa2dc6) SHA1(a058c42fd76c23c0e5c8c11f5617fd29e056be7d) )
+ ROM_LOAD( "gps-200-00.u16", 0x000000, 0x400000, CRC(c146a09e) SHA1(5af5a7b9d9a55ec7aba3fd85a3a0211b92b1b84f) )
+ ROM_LOAD( "gps-201-00.u13", 0x400000, 0x400000, CRC(9dfa2dc6) SHA1(a058c42fd76c23c0e5c8c11f5617fd29e056be7d) )
ROM_REGION( 0x800000, "gfx3", ROMREGION_ERASE00 ) /* Tiles Plane B */
/* First 0x040000 bytes (0x03ff Tiles) are RAM Based Tiles */
/* 0x040000 - 0x3fffff empty? */
ROM_REGION( 0x400000, "ymz", 0 ) /* Samples */
- ROM_LOAD( "gps30000.u4", 0x000000, 0x400000, CRC(9e4da8e3) SHA1(6506d9300a442883357003a05fd2c78d364c35bb) )
+ ROM_LOAD( "gps-300-00.u4", 0x000000, 0x400000, CRC(9e4da8e3) SHA1(6506d9300a442883357003a05fd2c78d364c35bb) )
ROM_END
ROM_START( galpanisj )
@@ -1305,20 +1305,44 @@ ROM_START( galpanisj )
ROM_LOAD16_BYTE( "gps-001-j1.u8", 0x000001, 0x100000, CRC(e764177a) SHA1(3a1333eb1022ed1a275b9c3d44b5f4ab81618fb6) )
ROM_REGION( 0x1000000, "spritegen", 0 )
- ROM_LOAD( "gps10000.u24", 0x000000, 0x400000, CRC(a1a7acf2) SHA1(52c86ae907f0c0236808c19f652955b09e90ec5a) )
- ROM_LOAD( "gps10100.u20", 0x400000, 0x400000, CRC(49f764b6) SHA1(9f4289858c3dac625ef623cc381a47b45aa5d8e2) )
- ROM_LOAD( "gps10200.u17", 0x800000, 0x400000, CRC(51980272) SHA1(6c0706d913b33995579aaf0688c4bf26d6d35a78) )
+ ROM_LOAD( "gps-100-00.u24", 0x000000, 0x400000, CRC(a1a7acf2) SHA1(52c86ae907f0c0236808c19f652955b09e90ec5a) )
+ ROM_LOAD( "gps-101-00.u20", 0x400000, 0x400000, CRC(49f764b6) SHA1(9f4289858c3dac625ef623cc381a47b45aa5d8e2) )
+ ROM_LOAD( "gps-102-00.u17", 0x800000, 0x400000, CRC(51980272) SHA1(6c0706d913b33995579aaf0688c4bf26d6d35a78) )
ROM_REGION( 0x800000, "gfx2", 0 )
- ROM_LOAD( "gps20000.u16", 0x000000, 0x400000, CRC(c146a09e) SHA1(5af5a7b9d9a55ec7aba3fd85a3a0211b92b1b84f) )
- ROM_LOAD( "gps20100.u13", 0x400000, 0x400000, CRC(9dfa2dc6) SHA1(a058c42fd76c23c0e5c8c11f5617fd29e056be7d) )
+ ROM_LOAD( "gps-200-00.u16", 0x000000, 0x400000, CRC(c146a09e) SHA1(5af5a7b9d9a55ec7aba3fd85a3a0211b92b1b84f) )
+ ROM_LOAD( "gps-201-00.u13", 0x400000, 0x400000, CRC(9dfa2dc6) SHA1(a058c42fd76c23c0e5c8c11f5617fd29e056be7d) )
ROM_REGION( 0x800000, "gfx3", ROMREGION_ERASE00 ) /* Tiles Plane B */
/* First 0x040000 bytes (0x03ff Tiles) are RAM Based Tiles */
/* 0x040000 - 0x3fffff empty? */
ROM_REGION( 0x400000, "ymz", 0 ) /* Samples */
- ROM_LOAD( "gps30000.u4", 0x000000, 0x400000, CRC(9e4da8e3) SHA1(6506d9300a442883357003a05fd2c78d364c35bb) )
+ ROM_LOAD( "gps-300-00.u4", 0x000000, 0x400000, CRC(9e4da8e3) SHA1(6506d9300a442883357003a05fd2c78d364c35bb) )
+ROM_END
+
+ROM_START( galpanisa )
+ SKNS_ASIA
+
+ ROM_REGION32_BE( 0x200000, "user1", 0 ) /* SH-2 Code mapped at 0x04000000 */
+ ROM_LOAD16_BYTE( "gps-000-a0_9abc.u10", 0x000000, 0x100000, CRC(4e24b799) SHA1(614f4eb6a7b0ab03ea6ada28a670ed0759b3f4f9) ) /* hand written labels with checksum */
+ ROM_LOAD16_BYTE( "gps-001-a0_bd64.u8", 0x000001, 0x100000, CRC(aa4db8af) SHA1(10cc15fa065b6a2dcaf8c7d701c5ae7c18e4e863) ) /* hand written labels with checksum */
+
+ ROM_REGION( 0x1000000, "spritegen", 0 )
+ ROM_LOAD( "gps-100-00.u24", 0x000000, 0x400000, CRC(a1a7acf2) SHA1(52c86ae907f0c0236808c19f652955b09e90ec5a) )
+ ROM_LOAD( "gps-101-00.u20", 0x400000, 0x400000, CRC(49f764b6) SHA1(9f4289858c3dac625ef623cc381a47b45aa5d8e2) )
+ ROM_LOAD( "gps-102-00.u17", 0x800000, 0x400000, CRC(51980272) SHA1(6c0706d913b33995579aaf0688c4bf26d6d35a78) )
+
+ ROM_REGION( 0x800000, "gfx2", 0 )
+ ROM_LOAD( "gps-200-00.u16", 0x000000, 0x400000, CRC(c146a09e) SHA1(5af5a7b9d9a55ec7aba3fd85a3a0211b92b1b84f) )
+ ROM_LOAD( "gps-201-00.u13", 0x400000, 0x400000, CRC(9dfa2dc6) SHA1(a058c42fd76c23c0e5c8c11f5617fd29e056be7d) )
+
+ ROM_REGION( 0x800000, "gfx3", ROMREGION_ERASE00 ) /* Tiles Plane B */
+ /* First 0x040000 bytes (0x03ff Tiles) are RAM Based Tiles */
+ /* 0x040000 - 0x3fffff empty? */
+
+ ROM_REGION( 0x400000, "ymz", 0 ) /* Samples */
+ ROM_LOAD( "gps-300-00.u4", 0x000000, 0x400000, CRC(9e4da8e3) SHA1(6506d9300a442883357003a05fd2c78d364c35bb) )
ROM_END
ROM_START( galpanisk )
@@ -1329,20 +1353,20 @@ ROM_START( galpanisk )
ROM_LOAD16_BYTE( "gps-001-k1.u8", 0x000001, 0x100000, CRC(354e601d) SHA1(4d176f2337a3b0b63548b2e542f9fa87d0a1ef7b) )
ROM_REGION( 0x1000000, "spritegen", 0 )
- ROM_LOAD( "gps10000.u24", 0x000000, 0x400000, CRC(a1a7acf2) SHA1(52c86ae907f0c0236808c19f652955b09e90ec5a) )
- ROM_LOAD( "gps10100.u20", 0x400000, 0x400000, CRC(49f764b6) SHA1(9f4289858c3dac625ef623cc381a47b45aa5d8e2) )
- ROM_LOAD( "gps10200.u17", 0x800000, 0x400000, CRC(51980272) SHA1(6c0706d913b33995579aaf0688c4bf26d6d35a78) )
+ ROM_LOAD( "gps-100-00.u24", 0x000000, 0x400000, CRC(a1a7acf2) SHA1(52c86ae907f0c0236808c19f652955b09e90ec5a) )
+ ROM_LOAD( "gps-101-00.u20", 0x400000, 0x400000, CRC(49f764b6) SHA1(9f4289858c3dac625ef623cc381a47b45aa5d8e2) )
+ ROM_LOAD( "gps-102-00.u17", 0x800000, 0x400000, CRC(51980272) SHA1(6c0706d913b33995579aaf0688c4bf26d6d35a78) )
ROM_REGION( 0x800000, "gfx2", 0 )
- ROM_LOAD( "gps20000.u16", 0x000000, 0x400000, CRC(c146a09e) SHA1(5af5a7b9d9a55ec7aba3fd85a3a0211b92b1b84f) )
- ROM_LOAD( "gps20100.u13", 0x400000, 0x400000, CRC(9dfa2dc6) SHA1(a058c42fd76c23c0e5c8c11f5617fd29e056be7d) )
+ ROM_LOAD( "gps-200-00.u16", 0x000000, 0x400000, CRC(c146a09e) SHA1(5af5a7b9d9a55ec7aba3fd85a3a0211b92b1b84f) )
+ ROM_LOAD( "gps-201-00.u13", 0x400000, 0x400000, CRC(9dfa2dc6) SHA1(a058c42fd76c23c0e5c8c11f5617fd29e056be7d) )
ROM_REGION( 0x800000, "gfx3", ROMREGION_ERASE00 ) /* Tiles Plane B */
/* First 0x040000 bytes (0x03ff Tiles) are RAM Based Tiles */
/* 0x040000 - 0x3fffff empty? */
ROM_REGION( 0x400000, "ymz", 0 ) /* Samples */
- ROM_LOAD( "gps30000.u4", 0x000000, 0x400000, CRC(9e4da8e3) SHA1(6506d9300a442883357003a05fd2c78d364c35bb) )
+ ROM_LOAD( "gps-300-00.u4", 0x000000, 0x400000, CRC(9e4da8e3) SHA1(6506d9300a442883357003a05fd2c78d364c35bb) )
ROM_END
ROM_START( galpans2 ) //only the 2 program ROMs were dumped, but mask ROMs are supposed to match.
@@ -1941,6 +1965,7 @@ GAME( 1996, jjparads, skns, sknsj, skns_1p, skns_state, init_jjparads, RO
GAME( 1997, galpanis, skns, sknse, galpanis, skns_state, init_galpanis, ROT0, "Kaneko", "Gals Panic S - Extra Edition (Europe, set 1)", MACHINE_IMPERFECT_GRAPHICS )
GAME( 1997, galpanise, galpanis, sknse, galpanis, skns_state, init_galpanis, ROT0, "Kaneko", "Gals Panic S - Extra Edition (Europe, set 2)", MACHINE_IMPERFECT_GRAPHICS )
GAME( 1997, galpanisj, galpanis, sknsj, galpanis, skns_state, init_galpanis, ROT0, "Kaneko", "Gals Panic S - Extra Edition (Japan)", MACHINE_IMPERFECT_GRAPHICS )
+GAME( 1997, galpanisa, galpanis, sknsa, galpanis, skns_state, init_galpanis, ROT0, "Kaneko", "Gals Panic S - Extra Edition (Asia)", MACHINE_IMPERFECT_GRAPHICS )
GAME( 1997, galpanisk, galpanis, sknsk, galpanis, skns_state, init_galpanis, ROT0, "Kaneko", "Gals Panic S - Extra Edition (Korea)", MACHINE_IMPERFECT_GRAPHICS )
GAME( 1997, jjparad2, skns, sknsj, skns_1p, skns_state, init_jjparad2, ROT0, "Electro Design", "Jan Jan Paradise 2", MACHINE_IMPERFECT_GRAPHICS )
diff --git a/src/mame/mame.lst b/src/mame/mame.lst
index 88edddcdcd7..5b1d9a8d35b 100644
--- a/src/mame/mame.lst
+++ b/src/mame/mame.lst
@@ -36532,6 +36532,7 @@ galpani4j // 1996.09 (c) 1996 Kaneko (Japan)
galpani4k // 1996.09 (c) 1996 Kaneko (Korea)
galpanidx // 1996.09 (c) 1996 Kaneko (Asia)
galpanis // 1997.04 (c) 1997 Kaneko (Europe)
+galpanisa // 1997.04 (c) 1997 Kaneko (Asia)
galpanise // 1997.04 (c) 1997 Kaneko (Europe)
galpanisj // 1997.04 (c) 1997 Kaneko (Japan)
galpanisk // 1997.04 (c) 1997 Kaneko (Korea)
diff --git a/src/mame/video/newport.cpp b/src/mame/video/newport.cpp
index 46102e49e17..21595b09245 100644
--- a/src/mame/video/newport.cpp
+++ b/src/mame/video/newport.cpp
@@ -1244,9 +1244,12 @@ READ64_MEMBER(newport_video_device::rex3_r)
return ret;
}
-void newport_video_device::write_pixel(uint8_t color)
+void newport_video_device::write_pixel(uint8_t color, bool shade)
{
- write_pixel(m_rex3.m_x_start_i, m_rex3.m_y_start_i, color);
+ if (shade)
+ write_pixel(m_rex3.m_x_start_i, m_rex3.m_y_start_i, (uint8_t)(m_rex3.m_color_red >> 11));
+ else
+ write_pixel(m_rex3.m_x_start_i, m_rex3.m_y_start_i, color);
}
bool newport_video_device::pixel_clip_pass(int16_t x, int16_t y)
@@ -1388,7 +1391,7 @@ void newport_video_device::write_pixel(int16_t x, int16_t y, uint8_t color)
}
}
-void newport_video_device::do_v_iline(uint8_t color, bool skip_last)
+void newport_video_device::do_v_iline(uint8_t color, bool skip_last, bool shade)
{
int16_t x1 = m_rex3.m_x_start_i;
int16_t y1 = m_rex3.m_y_start_i;
@@ -1398,19 +1401,30 @@ void newport_video_device::do_v_iline(uint8_t color, bool skip_last)
do
{
- write_pixel(x1, y1, color);
+ if (shade)
+ write_pixel(x1, y1, (uint8_t)(m_rex3.m_color_red >> 11));
+ else
+ write_pixel(x1, y1, color);
+
y1 += incy;
+
+ if (shade)
+ m_rex3.m_color_red += m_rex3.m_slope_red;
} while (y1 != y2);
- if (!skip_last) {
- write_pixel(x1, y1, color);
+ if (!skip_last)
+ {
+ if (shade)
+ write_pixel(x1, y1, (uint8_t)(m_rex3.m_color_red >> 11));
+ else
+ write_pixel(x1, y1, color);
}
write_x_start(x1 << 11);
write_y_start(y1 << 11);
}
-void newport_video_device::do_h_iline(uint8_t color, bool skip_last)
+void newport_video_device::do_h_iline(uint8_t color, bool skip_last, bool shade)
{
int16_t x1 = m_rex3.m_x_start_i;
int16_t y1 = m_rex3.m_y_start_i;
@@ -1420,19 +1434,29 @@ void newport_video_device::do_h_iline(uint8_t color, bool skip_last)
do
{
- write_pixel(x1, y1, color);
+ if (shade)
+ write_pixel(x1, y1, (uint8_t)(m_rex3.m_color_red >> 11));
+ else
+ write_pixel(x1, y1, color);
+
x1 += incx;
+
+ if (shade)
+ m_rex3.m_color_red += m_rex3.m_slope_red;
} while (x1 != x2);
if (!skip_last) {
- write_pixel(x1, y1, color);
+ if (shade)
+ write_pixel(x1, y1, (uint8_t)(m_rex3.m_color_red >> 11));
+ else
+ write_pixel(x1, y1, color);
}
write_x_start(x1 << 11);
write_y_start(y1 << 11);
}
-void newport_video_device::do_iline(uint8_t color, bool skip_last)
+void newport_video_device::do_iline(uint8_t color, bool skip_last, bool shade)
{
int16_t x1 = m_rex3.m_x_start_i;
int16_t y1 = m_rex3.m_y_start_i;
@@ -1486,7 +1510,10 @@ void newport_video_device::do_iline(uint8_t color, bool skip_last)
{
do
{
- write_pixel(x1, y1, color);
+ if (shade)
+ write_pixel(x1, y1, (uint8_t)(m_rex3.m_color_red >> 11));
+ else
+ write_pixel(x1, y1, color);
if (e > 0)
{
@@ -1499,13 +1526,18 @@ void newport_video_device::do_iline(uint8_t color, bool skip_last)
}
x1++;
+ if (shade)
+ m_rex3.m_color_red += m_rex3.m_slope_red;
} while (x1 != x2);
}
else
{
do
{
- write_pixel(x1, y1, color);
+ if (shade)
+ write_pixel(x1, y1, (uint8_t)(m_rex3.m_color_red >> 11));
+ else
+ write_pixel(x1, y1, color);
if (e > 0)
{
@@ -1518,11 +1550,17 @@ void newport_video_device::do_iline(uint8_t color, bool skip_last)
}
x1++;
+ if (shade)
+ m_rex3.m_color_red += m_rex3.m_slope_red;
} while (x1 != x2);
}
- if (!skip_last) {
- write_pixel(x1, y1, color);
+ if (!skip_last)
+ {
+ if (shade)
+ write_pixel(x1, y1, (uint8_t)(m_rex3.m_color_red >> 11));
+ else
+ write_pixel(x1, y1, color);
}
write_x_start(x1 << 11);
@@ -1595,7 +1633,7 @@ void newport_video_device::do_rex3_command()
{
LOGMASKED(LOG_COMMANDS, "%04x, %04x = %02x\n", start_x, start_y, m_rex3.m_color_i & 0xff);
m_rex3.m_bres_octant_inc1 = 0;
- write_pixel(m_rex3.m_color_i & 0xff);
+ write_pixel(m_rex3.m_color_i & 0xff, false);
start_x++;
if (start_x > end_x)
{
@@ -1651,6 +1689,7 @@ void newport_video_device::do_rex3_command()
case 0x00000122: // StopOnX, DoSetup, Span, Draw
case 0x00022102: // LSOpaque, EnLSPattern, StopOnX, Span, Draw
case 0x00080122: // LROnly, StopOnX, DoSetup, Span, Draw
+ case 0x000c0122: // Shade, LROnly, StopOnX, DoSetup, Span, Draw
{
if (BIT(mode0, 19) && dx < 0) // LROnly
break;
@@ -1715,27 +1754,32 @@ void newport_video_device::do_rex3_command()
case 0x0000032a: // StopOnX, StopOnY, DoSetup, I_Line, Draw
case 0x00000b2a: // SkipLast, StopOnX, StopOnY, DoSetup, I_Line, Draw
case 0x0000232e: // EnLSPattern, StopOnX, StopOnY, DoSetup, F_Line, Draw
+ case 0x0004232e: // Shade, EnLSPattern, StopOnX, StopOnY, DoSetup, F_Line, Draw
{
+ const bool skip_last = BIT(mode0, 11);
+ const bool shade = BIT(mode0, 18);
+
LOGMASKED(LOG_COMMANDS, "%cLine: %04x, %04x to %04x, %04x = %08x\n", (mode0 & 0x1c) == 3 ? 'F' : 'I',
start_x, start_y, end_x, end_y, m_cmap0.m_palette[m_rex3.m_color_i]);
if (start_x == end_x && start_y == end_y)
{
- write_pixel(m_rex3.m_color_i);
+ write_pixel(m_rex3.m_color_i, shade);
}
else if (start_x == end_x)
{
- do_v_iline(m_rex3.m_color_i, BIT(mode0, 11));
+ do_v_iline(m_rex3.m_color_i, skip_last, shade);
}
else if (start_y == end_y)
{
- do_h_iline(m_rex3.m_color_i, BIT(mode0, 11));
+ do_h_iline(m_rex3.m_color_i, skip_last, shade);
}
else
{
- do_iline(m_rex3.m_color_i, BIT(mode0, 11));
+ do_iline(m_rex3.m_color_i, skip_last, shade);
}
break;
}
+ case 0x00001106: // EnZPattern, StopOnX, Block, Draw
case 0x00002106: // EnLSPattern, StopOnX, Block, Draw
case 0x00009106: // Length32, EnZPattern, StopOnX, Block, Draw
case 0x00022106: // LSOpaque, EnLSPattern, StopOnX, Block, Draw
diff --git a/src/mame/video/newport.h b/src/mame/video/newport.h
index 3de9362e7a0..b8038c69372 100644
--- a/src/mame/video/newport.h
+++ b/src/mame/video/newport.h
@@ -187,13 +187,13 @@ private:
void write_y_end(int32_t val);
bool pixel_clip_pass(int16_t x, int16_t y);
- void write_pixel(uint8_t color);
+ void write_pixel(uint8_t color, bool shade);
void write_pixel(int16_t x, int16_t y, uint8_t color);
void store_pixel(uint8_t *dest_buf, const uint8_t src);
- void do_v_iline(uint8_t color, bool skip_last);
- void do_h_iline(uint8_t color, bool skip_last);
- void do_iline(uint8_t color, bool skip_last);
+ void do_v_iline(uint8_t color, bool skip_last, bool shade);
+ void do_h_iline(uint8_t color, bool skip_last, bool shade);
+ void do_iline(uint8_t color, bool skip_last, bool shade);
uint8_t do_pixel_read();
uint64_t do_pixel_word_read();
void do_rex3_command();