summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/devices/machine/netlist.h16
-rw-r--r--src/frontend/mame/luaengine.cpp4
-rw-r--r--src/lib/netlist/devices/nld_truthtable.cpp4
-rw-r--r--src/lib/netlist/nl_base.h14
-rw-r--r--src/lib/netlist/nl_parser.cpp4
-rw-r--r--src/lib/netlist/nl_setup.cpp2
-rw-r--r--src/lib/netlist/plib/palloc.cpp37
-rw-r--r--src/lib/netlist/plib/palloc.h39
-rw-r--r--src/lib/netlist/plib/pparser.cpp7
-rw-r--r--src/lib/netlist/plib/pparser.h2
-rw-r--r--src/lib/netlist/plib/pstream.cpp123
-rw-r--r--src/lib/netlist/plib/pstream.h47
-rw-r--r--src/lib/netlist/plib/pstring.cpp3
-rw-r--r--src/lib/netlist/plib/pstring.h7
-rw-r--r--src/lib/netlist/prg/nltool.cpp90
-rw-r--r--src/lib/netlist/prg/nlwav.cpp26
-rw-r--r--src/mame/drivers/vendetta.cpp176
-rw-r--r--src/mame/includes/vendetta.h33
-rw-r--r--src/mame/video/vendetta.cpp2
-rw-r--r--src/osd/modules/debugger/win/consolewininfo.cpp61
20 files changed, 375 insertions, 322 deletions
diff --git a/src/devices/machine/netlist.h b/src/devices/machine/netlist.h
index e4166f29151..bc31b38dcdd 100644
--- a/src/devices/machine/netlist.h
+++ b/src/devices/machine/netlist.h
@@ -62,6 +62,14 @@
PORT_CHANGED_MEMBER(_base ":" _tag, netlist_mame_analog_input_t, input_changed, 0)
+#define MEMREGION_SOURCE(_name) \
+ setup.register_source(plib::make_unique_base<netlist::source_t, netlist_source_memregion_t>(_name));
+
+#define NETDEV_ANALOG_CALLBACK_MEMBER(_name) \
+ void _name(const double data, const attotime &time)
+
+
+
// ----------------------------------------------------------------------------------------
// Extensions to interface netlist with MAME code ....
// ----------------------------------------------------------------------------------------
@@ -79,12 +87,6 @@ private:
pstring m_name;
};
-#define MEMREGION_SOURCE(_name) \
- setup.register_source(plib::make_unique_base<netlist::source_t, netlist_source_memregion_t>(_name));
-
-#define NETDEV_ANALOG_CALLBACK_MEMBER(_name) \
- void _name(const double data, const attotime &time)
-
class netlist_mame_device_t;
class netlist_mame_t : public netlist::netlist_t
@@ -579,7 +581,7 @@ public:
// FIXME: make this a parameter
// avoid calls due to noise
- if (fabs(cur - m_last) > 1e-6)
+ if (std::fabs(cur - m_last) > 1e-6)
{
m_cpu_device->update_time_x();
m_callback(cur, m_cpu_device->local_time());
diff --git a/src/frontend/mame/luaengine.cpp b/src/frontend/mame/luaengine.cpp
index af593fa6b66..c30527858bc 100644
--- a/src/frontend/mame/luaengine.cpp
+++ b/src/frontend/mame/luaengine.cpp
@@ -663,7 +663,7 @@ luabridge::LuaRef lua_engine::l_ioport_get_ports(const ioport_manager *m)
luabridge::LuaRef port_table = luabridge::LuaRef::newTable(L);
for (auto &port : im->ports()) {
- port_table[port.second->tag()] = &port;
+ port_table[port.second->tag()] = port.second.get();
}
return port_table;
@@ -762,7 +762,7 @@ luabridge::LuaRef lua_engine::l_dev_get_states(const device_t *d)
for (auto &s : dev->state().state_entries())
{
// XXX: refrain from exporting non-visible entries?
- st_table[s->symbol()] = &s;
+ st_table[s->symbol()] = s.get();
}
return st_table;
diff --git a/src/lib/netlist/devices/nld_truthtable.cpp b/src/lib/netlist/devices/nld_truthtable.cpp
index be80b72fdce..d885ae3b1ca 100644
--- a/src/lib/netlist/devices/nld_truthtable.cpp
+++ b/src/lib/netlist/devices/nld_truthtable.cpp
@@ -156,7 +156,7 @@ void truthtable_desc_t::help(unsigned cur, plib::pstring_vector_t list,
{
// cutoff previous inputs and outputs for ignore
if (m_outs[nstate] != m_outs.adjust(all_set) && m_outs[nstate] != val)
- fatalerror_e(plib::pfmt("Error in truthtable: State {1} already set, {2} != {3}\n")
+ nl_exception(plib::pfmt("Error in truthtable: State {1} already set, {2} != {3}\n")
.x(nstate,"04")(m_outs[nstate])(val) );
m_outs.set(nstate, val);
for (unsigned j=0; j<m_NO; j++)
@@ -252,7 +252,7 @@ void truthtable_desc_t::setup(const plib::pstring_vector_t &truthtable, uint_lea
for (size_t i=0; i<m_size; i++)
{
if (m_outs[i] == m_outs.adjust(all_set))
- throw fatalerror_e(plib::pfmt("truthtable: found element not set {1}\n").x(i) );
+ throw nl_exception(plib::pfmt("truthtable: found element not set {1}\n").x(i) );
m_outs.set(i, m_outs[i] | ((ign[i] & ~disabled_ignore) << m_NO));;
}
*m_initialized = true;
diff --git a/src/lib/netlist/nl_base.h b/src/lib/netlist/nl_base.h
index d31c39f2eda..9a0c9b824bf 100644
--- a/src/lib/netlist/nl_base.h
+++ b/src/lib/netlist/nl_base.h
@@ -238,11 +238,11 @@ class NETLIB_NAME(name) : public device_t
//============================================================
#if defined(MAME_DEBUG)
-#define nl_assert(x) do { if (1) if (!(x)) throw fatalerror_e(plib::pfmt("assert: {1}:{2}: {3}")(__FILE__)(__LINE__)(#x) ); } while (0)
+#define nl_assert(x) do { if (1) if (!(x)) throw nl_exception(plib::pfmt("assert: {1}:{2}: {3}")(__FILE__)(__LINE__)(#x) ); } while (0)
#else
-#define nl_assert(x) do { if (0) if (!(x)) throw fatalerror_e(plib::pfmt("assert: {1}:{2}: {3}")(__FILE__)(__LINE__)(#x) ); } while (0)
+#define nl_assert(x) do { if (0) if (!(x)) throw nl_exception(plib::pfmt("assert: {1}:{2}: {3}")(__FILE__)(__LINE__)(#x) ); } while (0)
#endif
-#define nl_assert_always(x, msg) do { if (!(x)) throw fatalerror_e(plib::pfmt("Fatal error: {1}\nCaused by assert: {2}:{3}: {4}")(msg)(__FILE__)(__LINE__)(#x)); } while (0)
+#define nl_assert_always(x, msg) do { if (!(x)) throw nl_exception(plib::pfmt("Fatal error: {1}\nCaused by assert: {2}:{3}: {4}")(msg)(__FILE__)(__LINE__)(#x)); } while (0)
// -----------------------------------------------------------------------------
@@ -270,12 +270,12 @@ namespace netlist
// Exceptions
//============================================================
- class fatalerror_e : public plib::pexception
+ class nl_exception : public plib::pexception
{
public:
- explicit fatalerror_e(const pstring text) : plib::pexception(text) { }
- fatalerror_e(const fatalerror_e &e) : plib::pexception(e) { }
- virtual ~fatalerror_e() noexcept {}
+ explicit nl_exception(const pstring text) : plib::pexception(text) { }
+ nl_exception(const nl_exception &e) : plib::pexception(e) { }
+ virtual ~nl_exception() noexcept {}
};
class logic_output_t;
diff --git a/src/lib/netlist/nl_parser.cpp b/src/lib/netlist/nl_parser.cpp
index bc27913e6b0..c0b0b56bdf1 100644
--- a/src/lib/netlist/nl_parser.cpp
+++ b/src/lib/netlist/nl_parser.cpp
@@ -410,7 +410,7 @@ void parser_t::device(const pstring &dev_type)
tok = get_token();
}
if (cnt != termlist.size())
- m_setup.log().fatal("netlist: input count mismatch for {1} - expected {2} found {3}\n", devname, termlist.size(), cnt);
+ error(plib::pfmt("Input count mismatch for {1} - expected {2} found {3}")(devname)(termlist.size())(cnt));
require_token(tok, m_tok_param_right);
}
}
@@ -446,7 +446,7 @@ nl_double parser_t::eval_param(const token_t tok)
val = tok.str();
ret = val.as_double(&e);
if (e)
- error(plib::pfmt("Error with parameter {1}...\n")(val));
+ error(plib::pfmt("Parameter value <{1}> not double \n")(val));
}
return ret * facs[f];
diff --git a/src/lib/netlist/nl_setup.cpp b/src/lib/netlist/nl_setup.cpp
index afa4545e3b7..8aa30c9d945 100644
--- a/src/lib/netlist/nl_setup.cpp
+++ b/src/lib/netlist/nl_setup.cpp
@@ -975,7 +975,7 @@ nl_double setup_t::model_value(model_map_t &map, const pstring &entity)
case 'a': factor = 1e-18; break;
default:
if (numfac < "0" || numfac > "9")
- fatalerror_e(plib::pfmt("Unknown number factor <{1}> in: {2}")(numfac)(entity));
+ nl_exception(plib::pfmt("Unknown number factor <{1}> in: {2}")(numfac)(entity));
}
if (factor != NL_FCONST(1.0))
tmp = tmp.left(tmp.len() - 1);
diff --git a/src/lib/netlist/plib/palloc.cpp b/src/lib/netlist/plib/palloc.cpp
index f7a9117f503..ef9e42dcba5 100644
--- a/src/lib/netlist/plib/palloc.cpp
+++ b/src/lib/netlist/plib/palloc.cpp
@@ -9,8 +9,10 @@
#include "pconfig.h"
#include "palloc.h"
+#include "pfmtlog.h"
namespace plib {
+
//============================================================
// Exceptions
//============================================================
@@ -18,9 +20,42 @@ namespace plib {
pexception::pexception(const pstring text)
{
m_text = text;
- fprintf(stderr, "%s\n", m_text.cstr());
}
+file_e::file_e(const pstring fmt, const pstring &filename)
+ : pexception(pfmt(fmt)(filename))
+{
+}
+
+file_open_e::file_open_e(const pstring &filename)
+ : file_e("File open failed: {}", filename)
+{
+}
+
+file_read_e::file_read_e(const pstring &filename)
+ : file_e("File read failed: {}", filename)
+{
+}
+
+file_write_e::file_write_e(const pstring &filename)
+ : file_e("File write failed: {}", filename)
+{
+}
+
+null_argument_e::null_argument_e(const pstring &argument)
+ : pexception(pfmt("Null argument passed: {}")(argument))
+{
+}
+
+out_of_mem_e::out_of_mem_e(const pstring &location)
+ : pexception(pfmt("Out of memory: {}")(location))
+{
+}
+
+//============================================================
+// Memory pool
+//============================================================
+
mempool::mempool(int min_alloc, int min_align)
: m_min_alloc(min_alloc), m_min_align(min_align)
{
diff --git a/src/lib/netlist/plib/palloc.h b/src/lib/netlist/plib/palloc.h
index 5b734785145..cd21be0c91e 100644
--- a/src/lib/netlist/plib/palloc.h
+++ b/src/lib/netlist/plib/palloc.h
@@ -17,6 +17,7 @@
#include "pstring.h"
namespace plib {
+
//============================================================
// exception base
//============================================================
@@ -24,7 +25,7 @@ namespace plib {
class pexception : public std::exception
{
public:
- explicit pexception(const pstring text);
+ pexception(const pstring text);
pexception(const pexception &e) : std::exception(e) { m_text = e.m_text; }
virtual ~pexception() noexcept {}
@@ -35,6 +36,42 @@ private:
pstring m_text;
};
+class file_e : public plib::pexception
+{
+public:
+ explicit file_e(const pstring fmt, const pstring &filename);
+};
+
+class file_open_e : public file_e
+{
+public:
+ explicit file_open_e(const pstring &filename);
+};
+
+class file_read_e : public file_e
+{
+public:
+ explicit file_read_e(const pstring &filename);
+};
+
+class file_write_e : public file_e
+{
+public:
+ explicit file_write_e(const pstring &filename);
+};
+
+class null_argument_e : public plib::pexception
+{
+public:
+ explicit null_argument_e(const pstring &argument);
+};
+
+class out_of_mem_e : public plib::pexception
+{
+public:
+ explicit out_of_mem_e(const pstring &location);
+};
+
//============================================================
// Memory allocation
//============================================================
diff --git a/src/lib/netlist/plib/pparser.cpp b/src/lib/netlist/plib/pparser.cpp
index 468fb90a1f6..cfa30669801 100644
--- a/src/lib/netlist/plib/pparser.cpp
+++ b/src/lib/netlist/plib/pparser.cpp
@@ -41,9 +41,11 @@ pstring::code_t ptokenizer::getc()
{
if (m_px >= m_cur_line.len())
{
+ m_lineno++;
if (m_strm.readline(m_cur_line))
{
- m_cur_line += "\n";
+ if (m_cur_line.right(1) != "\n")
+ m_cur_line += "\n";
m_px = 0;
}
else
@@ -245,7 +247,7 @@ ptokenizer::token_t ptokenizer::get_token_internal()
void ptokenizer::error(const pstring &errs)
{
- verror("Error: " + errs, currentline_no(), currentline_str());
+ verror(errs, currentline_no(), currentline_str());
//throw error;
}
@@ -459,7 +461,6 @@ pstring ppreprocessor::process_line(const pstring &line)
if (m_ifflag == 0)
{
ret.cat(lt);
- ret.cat("\n");
}
}
return ret;
diff --git a/src/lib/netlist/plib/pparser.h b/src/lib/netlist/plib/pparser.h
index 30a00514840..463fdad9b76 100644
--- a/src/lib/netlist/plib/pparser.h
+++ b/src/lib/netlist/plib/pparser.h
@@ -25,7 +25,7 @@ public:
virtual ~ptokenizer() {}
explicit ptokenizer(pistream &strm)
- : m_strm(strm), m_lineno(1), m_px(0), m_string('"')
+ : m_strm(strm), m_lineno(0), m_px(0), m_string('"')
{}
enum token_type
diff --git a/src/lib/netlist/plib/pstream.cpp b/src/lib/netlist/plib/pstream.cpp
index 40152408b0c..9fcede380d5 100644
--- a/src/lib/netlist/plib/pstream.cpp
+++ b/src/lib/netlist/plib/pstream.cpp
@@ -21,8 +21,8 @@ namespace plib {
bool pistream::readline(pstring &line)
{
char c = 0;
- pstringbuffer buf;
- if (!this->read(c))
+ m_linebuf.clear();
+ if (!this->readbyte(c))
{
line = "";
return false;
@@ -32,11 +32,11 @@ bool pistream::readline(pstring &line)
if (c == 10)
break;
else if (c != 13) /* ignore CR */
- buf += c;
- if (!this->read(c))
+ m_linebuf += c;
+ if (!this->readbyte(c))
break;
}
- line = buf;
+ line = m_linebuf;
return true;
}
@@ -48,7 +48,7 @@ void postream::write(pistream &strm)
{
char buf[1024];
unsigned r;
- while ( !bad() && ((r=strm.read(buf, 1024)) > 0))
+ while ((r=strm.read(buf, 1024)) > 0)
write(buf, r);
}
@@ -57,48 +57,39 @@ void postream::write(pistream &strm)
// -----------------------------------------------------------------------------
pifilestream::pifilestream(const pstring &fname)
-: pistream(0), m_pos(0), m_actually_close(true)
+: pistream(0)
+, m_file(fopen(fname.cstr(), "rb"))
+, m_pos(0)
+, m_actually_close(true)
+, m_filename(fname)
{
- init(fopen(fname.cstr(), "rb"));
+ if (m_file == nullptr)
+ throw file_open_e(fname);
+ init();
}
-pifilestream::pifilestream(void *file, const bool do_close)
-: pistream(0), m_pos(0), m_actually_close(do_close)
+pifilestream::pifilestream(void *file, const pstring name, const bool do_close)
+: pistream(0), m_file(file), m_pos(0), m_actually_close(do_close), m_filename(name)
{
- init(file);
+ if (m_file == nullptr)
+ throw null_argument_e(m_filename);
+ init();
}
-void pifilestream::init(void *file)
+void pifilestream::init()
{
- m_file = file;
- if (m_file == nullptr)
- {
- set_flag(FLAG_ERROR);
- set_flag(FLAG_EOF);
- set_flag(FLAG_CLOSED);
- }
- else
+ if (ftell((FILE *) m_file) >= 0)
{
- if (ftell((FILE *) m_file) >= 0)
- {
- if (fseek((FILE *) m_file, 0, SEEK_SET) >= 0)
- set_flag(FLAG_SEEKABLE);
- }
+ if (fseek((FILE *) m_file, 0, SEEK_SET) >= 0)
+ set_flag(FLAG_SEEKABLE);
}
}
pifilestream::~pifilestream()
{
- if (!closed())
- close();
-}
-
-void pifilestream::close()
-{
if (m_actually_close)
{
fclose((FILE *) m_file);
- set_flag(FLAG_CLOSED);
}
}
@@ -110,7 +101,7 @@ unsigned pifilestream::vread(void *buf, const unsigned n)
if (feof((FILE *) m_file))
set_flag(FLAG_EOF);
if (ferror((FILE *) m_file))
- set_flag(FLAG_ERROR);
+ throw file_read_e(m_filename);
}
m_pos += r;
return r;
@@ -118,9 +109,8 @@ unsigned pifilestream::vread(void *buf, const unsigned n)
void pifilestream::vseek(const pos_type n)
{
- check_seekable();
if (fseek((FILE *) m_file, SEEK_SET, n) < 0)
- set_flag(FLAG_ERROR);
+ throw file_e("File seek failed: {}", m_filename);
else
m_pos = n;
if (feof((FILE *) m_file))
@@ -128,7 +118,7 @@ void pifilestream::vseek(const pos_type n)
else
clear_flag(FLAG_EOF);
if (ferror((FILE *) m_file))
- set_flag(FLAG_ERROR);
+ throw file_e("Generic file operation failed: {}", m_filename);
}
pifilestream::pos_type pifilestream::vtell()
@@ -147,7 +137,7 @@ pifilestream::pos_type pifilestream::vtell()
// -----------------------------------------------------------------------------
pstdin::pstdin()
-: pifilestream(stdin, false)
+: pifilestream(stdin, "<stdin>", false)
{
/* nothing to do */
}
@@ -157,48 +147,32 @@ pstdin::pstdin()
// -----------------------------------------------------------------------------
pofilestream::pofilestream(const pstring &fname)
-: postream(0), m_pos(0), m_actually_close(true)
+: postream(0), m_file(fopen(fname.cstr(), "wb")), m_pos(0), m_actually_close(true), m_filename(fname)
{
- init(fopen(fname.cstr(), "wb"));
-}
-
-pofilestream::pofilestream(void *file, const bool do_close)
-: postream(0), m_pos(0), m_actually_close(do_close)
-{
- init(file);
+ if (m_file == nullptr)
+ throw file_open_e(m_filename);
+ init();
}
-void pofilestream::init(void *file)
+pofilestream::pofilestream(void *file, const pstring name, const bool do_close)
+: postream(0), m_file(file), m_pos(0), m_actually_close(do_close), m_filename(name)
{
- m_file = file;
if (m_file == nullptr)
- {
- set_flag(FLAG_ERROR);
- set_flag(FLAG_CLOSED);
- }
- else
- {
- if (ftell((FILE *) m_file) >= 0)
- {
- if (fseek((FILE *) m_file, 0, SEEK_SET) >= 0)
- set_flag(FLAG_SEEKABLE);
- }
- }
+ throw null_argument_e(m_filename);
+ init();
}
-pofilestream::~pofilestream()
+void pofilestream::init()
{
- if (!closed())
- close();
+ if (ftell((FILE *) m_file) >= 0)
+ if (fseek((FILE *) m_file, 0, SEEK_SET) >= 0)
+ set_flag(FLAG_SEEKABLE);
}
-void pofilestream::close()
+pofilestream::~pofilestream()
{
if (m_actually_close)
- {
fclose((FILE *) m_file);
- set_flag(FLAG_CLOSED);
- }
}
void pofilestream::vwrite(const void *buf, const unsigned n)
@@ -207,21 +181,20 @@ void pofilestream::vwrite(const void *buf, const unsigned n)
if (r < n)
{
if (ferror((FILE *) m_file))
- set_flag(FLAG_ERROR);
+ throw file_write_e(m_filename);
}
m_pos += r;
}
void pofilestream::vseek(const pos_type n)
{
- check_seekable();
if (fseek((FILE *) m_file, SEEK_SET, n) < 0)
- set_flag(FLAG_ERROR);
+ throw file_e("File seek failed: {}", m_filename);
else
{
m_pos = n;
if (ferror((FILE *) m_file))
- set_flag(FLAG_ERROR);
+ throw file_e("Generic file operation failed: {}", m_filename);
}
}
@@ -241,7 +214,7 @@ pstream::pos_type pofilestream::vtell()
// -----------------------------------------------------------------------------
pstderr::pstderr()
-: pofilestream(stderr, false)
+: pofilestream(stderr, "<stderr>", false)
{
}
@@ -250,7 +223,7 @@ pstderr::pstderr()
// -----------------------------------------------------------------------------
pstdout::pstdout()
-: pofilestream(stdout, false)
+: pofilestream(stdout, "<stdout>", false)
{
}
@@ -325,8 +298,7 @@ void pomemstream::vwrite(const void *buf, const unsigned n)
m_mem = palloc_array<char>(m_capacity);
if (m_mem == nullptr)
{
- set_flag(FLAG_ERROR);
- return;
+ throw out_of_mem_e("pomemstream::vwrite");
}
memcpy(m_mem, o, m_pos);
pfree_array(o);
@@ -349,8 +321,7 @@ void pomemstream::vseek(const pos_type n)
m_mem = palloc_array<char>(m_capacity);
if (m_mem == nullptr)
{
- set_flag(FLAG_ERROR);
- return;
+ throw out_of_mem_e("pomemstream::vseek");
}
memcpy(m_mem, o, m_pos);
pfree_array(o);
diff --git a/src/lib/netlist/plib/pstream.h b/src/lib/netlist/plib/pstream.h
index 59406eab025..1e9a3ed6a1c 100644
--- a/src/lib/netlist/plib/pstream.h
+++ b/src/lib/netlist/plib/pstream.h
@@ -9,7 +9,6 @@
#include <cstdarg>
#include <cstddef>
-#include <stdexcept>
#include "pconfig.h"
#include "pstring.h"
@@ -28,7 +27,7 @@ public:
using pos_type = std::size_t;
- static const pos_type SEEK_EOF = (pos_type) -1;
+ static constexpr pos_type SEEK_EOF = (pos_type) -1;
explicit pstream(const unsigned flags) : m_flags(flags)
{
@@ -37,12 +36,10 @@ public:
{
}
- bool bad() const { return ((m_flags & FLAG_ERROR) != 0); }
bool seekable() const { return ((m_flags & FLAG_SEEKABLE) != 0); }
void seek(const pos_type n)
{
- check_seekable();
return vseek(n);
}
@@ -55,12 +52,8 @@ protected:
virtual void vseek(const pos_type n) = 0;
virtual pos_type vtell() = 0;
- static const unsigned FLAG_EOF = 0x01;
- static const unsigned FLAG_ERROR = 0x02;
- static const unsigned FLAG_SEEKABLE = 0x04;
- static const unsigned FLAG_CLOSED = 0x08; /* convenience flag */
-
- bool closed() { return ((m_flags & FLAG_CLOSED) != 0); }
+ static constexpr unsigned FLAG_EOF = 0x01;
+ static constexpr unsigned FLAG_SEEKABLE = 0x04;
void set_flag(const unsigned flag)
{
@@ -70,19 +63,6 @@ protected:
{
m_flags &= ~flag;
}
-
- void check_not_eof() const
- {
- if (m_flags & FLAG_EOF)
- throw pexception("unexpected eof");
- }
-
- void check_seekable() const
- {
- if (!(m_flags & FLAG_SEEKABLE))
- throw pexception("stream is not seekable");
- }
-
unsigned flags() const { return m_flags; }
private:
@@ -101,15 +81,15 @@ public:
explicit pistream(const unsigned flags) : pstream(flags) {}
virtual ~pistream() {}
- bool eof() const { return ((flags() & FLAG_EOF) != 0) || bad(); }
+ bool eof() const { return ((flags() & FLAG_EOF) != 0); }
/* this digests linux & dos/windows text files */
bool readline(pstring &line);
- bool read(char &c)
+ bool readbyte(char &b)
{
- return (read(&c, 1) == 1);
+ return (read(&b, 1) == 1);
}
unsigned read(void *buf, const unsigned n)
@@ -122,6 +102,7 @@ protected:
virtual unsigned vread(void *buf, const unsigned n) = 0;
private:
+ pstringbuffer m_linebuf;
};
// -----------------------------------------------------------------------------
@@ -232,10 +213,8 @@ public:
explicit pofilestream(const pstring &fname);
virtual ~pofilestream();
- void close();
-
protected:
- pofilestream(void *file, const bool do_close);
+ pofilestream(void *file, const pstring name, const bool do_close);
/* write n bytes to stream */
virtual void vwrite(const void *buf, const unsigned n) override;
virtual void vseek(const pos_type n) override;
@@ -245,8 +224,9 @@ private:
void *m_file;
pos_type m_pos;
bool m_actually_close;
+ pstring m_filename;
- void init(void *file);
+ void init();
};
// -----------------------------------------------------------------------------
@@ -283,10 +263,8 @@ public:
explicit pifilestream(const pstring &fname);
virtual ~pifilestream();
- void close();
-
protected:
- pifilestream(void *file, const bool do_close);
+ pifilestream(void *file, const pstring name, const bool do_close);
/* read up to n bytes from stream */
virtual unsigned vread(void *buf, const unsigned n) override;
@@ -297,8 +275,9 @@ private:
void *m_file;
pos_type m_pos;
bool m_actually_close;
+ pstring m_filename;
- void init(void *file);
+ void init();
};
// -----------------------------------------------------------------------------
diff --git a/src/lib/netlist/plib/pstring.cpp b/src/lib/netlist/plib/pstring.cpp
index c85f18c260a..4db3de10503 100644
--- a/src/lib/netlist/plib/pstring.cpp
+++ b/src/lib/netlist/plib/pstring.cpp
@@ -25,7 +25,8 @@ pstr_t pstring_t<pu8_traits>::m_zero = pstr_t(0);
template<typename F>
pstring_t<F>::~pstring_t()
{
- sfree(m_ptr);
+ if (m_ptr != nullptr)
+ sfree(m_ptr);
}
template<typename F>
diff --git a/src/lib/netlist/plib/pstring.h b/src/lib/netlist/plib/pstring.h
index 2490186566e..df4d79d587f 100644
--- a/src/lib/netlist/plib/pstring.h
+++ b/src/lib/netlist/plib/pstring.h
@@ -60,6 +60,7 @@ public:
// construction with copy
pstring_t(const mem_t *string) {init(); if (string != nullptr && *string != 0) pcopy(string); }
pstring_t(const pstring_t &string) {init(); pcopy(string); }
+ pstring_t(pstring_t &&string) : m_ptr(string.m_ptr) {string.m_ptr = nullptr; }
// assignment operators
pstring_t &operator=(const mem_t *string) { pcopy(string); return *this; }
@@ -115,7 +116,7 @@ public:
unsigned len() const
{
- return F::len(m_ptr);
+ return traits::len(m_ptr);
}
pstring_t& operator+=(const code_t c) { mem_t buf[F::MAXCODELEN+1] = { 0 }; F::encode(c, buf); pcat(buf); return *this; }
@@ -295,6 +296,8 @@ struct putf8_traits
}
};
+// FIXME: "using pstring = pstring_t<putf8_traits>" is not understood by eclipse
+
struct pstring : public pstring_t<putf8_traits>
{
public:
@@ -357,6 +360,8 @@ public:
void cat(const char *s) { pcat(s); }
void cat(const void *m, unsigned l) { pcat(m, l); }
+ void clear() { m_len = 0; *m_ptr = 0; }
+
private:
void init()
diff --git a/src/lib/netlist/prg/nltool.cpp b/src/lib/netlist/prg/nltool.cpp
index fdfd5ed7a94..31cb8af00f6 100644
--- a/src/lib/netlist/prg/nltool.cpp
+++ b/src/lib/netlist/prg/nltool.cpp
@@ -145,9 +145,10 @@ protected:
void vlog(const plib::plog_level &l, const pstring &ls) const override
{
- pout("{}: {}\n", l.name().cstr(), ls.cstr());
+ pstring err = plib::pfmt("{}: {}\n")(l.name())(ls.cstr());
+ pout("{}", err);
if (l == plib::plog_level::FATAL)
- throw std::exception();
+ throw netlist::nl_exception(err);
}
private:
@@ -179,7 +180,7 @@ struct input_t
double t;
int e = sscanf(line.cstr(), "%lf,%[^,],%lf", &t, buf, &m_value);
if ( e!= 3)
- throw netlist::fatalerror_e(plib::pfmt("error {1} scanning line {2}\n")(e)(line));
+ throw netlist::nl_exception(plib::pfmt("error {1} scanning line {2}\n")(e)(line));
m_time = netlist::netlist_time::from_double(t);
m_param = setup.find_param(buf, true);
}
@@ -190,7 +191,7 @@ struct input_t
{
case netlist::param_t::MODEL:
case netlist::param_t::STRING:
- throw netlist::fatalerror_e(plib::pfmt("param {1} is not numeric\n")(m_param->name()));
+ throw netlist::nl_exception(plib::pfmt("param {1} is not numeric\n")(m_param->name()));
case netlist::param_t::DOUBLE:
static_cast<netlist::param_double_t*>(m_param)->setTo(m_value);
break;
@@ -432,50 +433,61 @@ int main(int argc, char *argv[])
return 0;
}
- pstring cmd = opts.opt_cmd();
- if (cmd == "listdevices")
- listdevices(opts);
- else if (cmd == "run")
- run(opts);
- else if (cmd == "static")
- static_compile(opts);
- else if (cmd == "convert")
+ try
{
- pstring contents;
- plib::postringstream ostrm;
- if (opts.opt_file() == "-")
+ pstring cmd = opts.opt_cmd();
+ if (cmd == "listdevices")
+ listdevices(opts);
+ else if (cmd == "run")
+ run(opts);
+ else if (cmd == "static")
+ static_compile(opts);
+ else if (cmd == "convert")
{
- plib::pstdin f;
- ostrm.write(f);
- }
- else
- {
- plib::pifilestream f(opts.opt_file());
- ostrm.write(f);
- }
- contents = ostrm.str();
+ pstring contents;
+ plib::postringstream ostrm;
+ if (opts.opt_file() == "-")
+ {
+ plib::pstdin f;
+ ostrm.write(f);
+ }
+ else
+ {
+ plib::pifilestream f(opts.opt_file());
+ ostrm.write(f);
+ }
+ contents = ostrm.str();
- pstring result;
- if (opts.opt_type().equals("spice"))
- {
- nl_convert_spice_t c;
- c.convert(contents);
- result = c.result();
+ pstring result;
+ if (opts.opt_type().equals("spice"))
+ {
+ nl_convert_spice_t c;
+ c.convert(contents);
+ result = c.result();
+ }
+ else
+ {
+ nl_convert_eagle_t c;
+ c.convert(contents);
+ result = c.result();
+ }
+ /* present result */
+ pout_strm.write(result.cstr());
}
else
{
- nl_convert_eagle_t c;
- c.convert(contents);
- result = c.result();
+ perr("Unknown command {}\n", cmd.cstr());
+ usage(opts);
+ return 1;
}
- /* present result */
- pout_strm.write(result.cstr());
}
- else
+ catch (netlist::nl_exception &e)
{
- perr("Unknown command {}\n", cmd.cstr());
- usage(opts);
- return 1;
+ perr("Netlist exception caught: {}\n", e.text());
+ }
+ catch (plib::pexception &e)
+ {
+ perr("plib exception caught: {}\n", e.text());
}
pstring::resetmem();
diff --git a/src/lib/netlist/prg/nlwav.cpp b/src/lib/netlist/prg/nlwav.cpp
index 0937f70470d..a48323f265f 100644
--- a/src/lib/netlist/prg/nlwav.cpp
+++ b/src/lib/netlist/prg/nlwav.cpp
@@ -49,7 +49,12 @@ public:
}
~wav_t()
{
- close();
+ m_f.seek(0);
+ m_f.write(&m_fh, sizeof(m_fh));
+ m_f.write(&m_fmt, sizeof(m_fmt));
+
+ //data.len = fmt.block_align * n;
+ m_f.write(&m_data, sizeof(m_data));
}
unsigned channels() { return m_fmt.channels; }
@@ -62,15 +67,6 @@ public:
m_f.write(&ps, sizeof(ps));
}
- void close()
- {
- m_f.seek(0);
- m_f.write(&m_fh, sizeof(m_fh));
- m_f.write(&m_fmt, sizeof(m_fmt));
-
- //data.len = fmt.block_align * n;
- m_f.write(&m_data, sizeof(m_data));
- }
private:
struct riff_chunk_t
{
@@ -129,15 +125,9 @@ private:
static void convert(nlwav_options_t &opts)
{
plib::pofilestream fo(opts.opt_out());
- if (fo.bad())
- {
- throw netlist::fatalerror_e("Error opening output file: " + opts.opt_out());
- }
wav_t wo(fo, 48000);
plib::pifilestream fin(opts.opt_inp());
- if (fin.bad())
- throw netlist::fatalerror_e("Error opening input file: " + opts.opt_inp());
double dt = 1.0 / (double) wo.sample_rate();
double ct = dt;
@@ -208,10 +198,6 @@ static void convert(nlwav_options_t &opts)
pout("Mean (static): {}\n", means / (double) n);
pout("Amp + {}\n", 32000.0 / (maxsam- mean));
pout("Amp - {}\n", -32000.0 / (minsam- mean));
- wo.close();
- fo.close();
- fin.close();
-
}
static void usage(plib::pstream_fmt_writer_t &fw, nlwav_options_t &opts)
diff --git a/src/mame/drivers/vendetta.cpp b/src/mame/drivers/vendetta.cpp
index e803c5101f8..da15f8789c8 100644
--- a/src/mame/drivers/vendetta.cpp
+++ b/src/mame/drivers/vendetta.cpp
@@ -24,7 +24,7 @@
***** NOTES *****
-------
- 1) ESCAPE KIDS uses 053246's unknown function. (see video/konamiic.c)
+ 1) ESCAPE KIDS uses 053246's unknown function. (see video/k053246_k053247_k055673.cpp)
(053246 register #5 UnKnown Bit #5, #3, #2 always set "1")
@@ -35,8 +35,8 @@
2) "xxxx: read from unknown 052109 address yyyy"
3) "xxxx: write zz to unknown 052109 address yyyy"
- These are video/konamiic.c's message.
- "video/konamiic.c" checks 052109 RAM area access.
+ These are video/k052109.cpp's message.
+ "video/k052109.cpp" checks 052109 RAM area access.
If accessed over 0x1800 (0x3800), logged 2) or 3) messages.
Escape Kids use 0x1800-0x19ff and 0x3800-0x39ff area.
@@ -105,7 +105,7 @@
***************************************************************************/
-WRITE8_MEMBER(vendetta_state::vendetta_eeprom_w)
+WRITE8_MEMBER(vendetta_state::eeprom_w)
{
/* bit 0 - VOC0 - Video banking related */
/* bit 1 - VOC1 - Video banking related */
@@ -125,17 +125,18 @@ WRITE8_MEMBER(vendetta_state::vendetta_eeprom_w)
m_irq_enabled = (data >> 6) & 1;
- vendetta_video_banking(data & 1);
+ m_videobank0->set_bank(BIT(data, 0));
+ m_videobank1->set_bank(BIT(data, 0));
}
/********************************************/
-READ8_MEMBER(vendetta_state::vendetta_K052109_r)
+READ8_MEMBER(vendetta_state::K052109_r)
{
return m_k052109->read(space, offset + 0x2000);
}
-WRITE8_MEMBER(vendetta_state::vendetta_K052109_w)
+WRITE8_MEMBER(vendetta_state::K052109_w)
{
// *************************************************************************************
// * Escape Kids uses 052109's mirrored Tilemap ROM bank selector, but only during *
@@ -147,25 +148,7 @@ WRITE8_MEMBER(vendetta_state::vendetta_K052109_w)
}
-void vendetta_state::vendetta_video_banking( int select )
-{
- address_space &space = m_maincpu->space(AS_PROGRAM);
-
- if (select & 1)
- {
- space.install_read_bank(m_video_banking_base + 0x2000, m_video_banking_base + 0x2fff, "bank4" );
- space.install_write_handler(m_video_banking_base + 0x2000, m_video_banking_base + 0x2fff, write8_delegate(FUNC(palette_device::write), m_palette.target()) );
- space.install_readwrite_handler(m_video_banking_base + 0x0000, m_video_banking_base + 0x0fff, read8_delegate(FUNC(k053247_device::k053247_r), (k053247_device*)m_k053246), write8_delegate(FUNC(k053247_device::k053247_w), (k053247_device*)m_k053246) );
- membank("bank4")->set_base(&m_paletteram[0]);
- }
- else
- {
- space.install_readwrite_handler(m_video_banking_base + 0x2000, m_video_banking_base + 0x2fff, read8_delegate(FUNC(vendetta_state::vendetta_K052109_r),this), write8_delegate(FUNC(vendetta_state::vendetta_K052109_w),this) );
- space.install_readwrite_handler(m_video_banking_base + 0x0000, m_video_banking_base + 0x0fff, read8_delegate(FUNC(k052109_device::read), (k052109_device*)m_k052109), write8_delegate(FUNC(k052109_device::write), (k052109_device*)m_k052109));
- }
-}
-
-WRITE8_MEMBER(vendetta_state::vendetta_5fe0_w)
+WRITE8_MEMBER(vendetta_state::_5fe0_w)
{
/* bit 0,1 coin counters */
machine().bookkeeping().coin_counter_w(0, data & 0x01);
@@ -226,17 +209,17 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, vendetta_state )
AM_RANGE(0x5fc3, 0x5fc3) AM_READ_PORT("P4")
AM_RANGE(0x5fd0, 0x5fd0) AM_READ_PORT("EEPROM")
AM_RANGE(0x5fd1, 0x5fd1) AM_READ_PORT("SERVICE")
- AM_RANGE(0x5fe0, 0x5fe0) AM_WRITE(vendetta_5fe0_w)
- AM_RANGE(0x5fe2, 0x5fe2) AM_WRITE(vendetta_eeprom_w)
+ AM_RANGE(0x5fe0, 0x5fe0) AM_WRITE(_5fe0_w)
+ AM_RANGE(0x5fe2, 0x5fe2) AM_WRITE(eeprom_w)
AM_RANGE(0x5fe4, 0x5fe4) AM_READWRITE(z80_irq_r, z80_irq_w)
AM_RANGE(0x5fe6, 0x5fe7) AM_DEVREADWRITE("k053260", k053260_device, main_read, main_write)
AM_RANGE(0x5fe8, 0x5fe9) AM_DEVREAD("k053246", k053247_device, k053246_r)
AM_RANGE(0x5fea, 0x5fea) AM_DEVREAD("watchdog", watchdog_timer_device, reset_r)
/* what is the desired effect of overlapping these memory regions anyway? */
- AM_RANGE(0x4000, 0x4fff) AM_RAMBANK("bank3")
- AM_RANGE(0x6000, 0x6fff) AM_RAMBANK("bank2")
+ AM_RANGE(0x4000, 0x4fff) AM_DEVICE("videobank0", address_map_bank_device, amap8)
+ AM_RANGE(0x6000, 0x6fff) AM_DEVICE("videobank1", address_map_bank_device, amap8)
AM_RANGE(0x4000, 0x7fff) AM_DEVREADWRITE("k052109", k052109_device, read, write)
- AM_RANGE(0x8000, 0xffff) AM_ROM
+ AM_RANGE(0x8000, 0xffff) AM_ROM AM_REGION("maincpu", 0x38000)
ADDRESS_MAP_END
static ADDRESS_MAP_START( esckids_map, AS_PROGRAM, 8, vendetta_state )
@@ -250,20 +233,29 @@ static ADDRESS_MAP_START( esckids_map, AS_PROGRAM, 8, vendetta_state )
AM_RANGE(0x3fa0, 0x3fa7) AM_DEVWRITE("k053246", k053247_device, k053246_w) // 053246 (Sprite)
AM_RANGE(0x3fb0, 0x3fbf) AM_DEVWRITE("k053251", k053251_device, write) // 053251 (Priority Encoder)
AM_RANGE(0x3fc0, 0x3fcf) AM_DEVREADWRITE("k053252", k053252_device, read, write) // Not Emulated (053252 ???)
- AM_RANGE(0x3fd0, 0x3fd0) AM_WRITE(vendetta_5fe0_w) // Coin Counter, 052109 RMRD, 053246 OBJCHA
- AM_RANGE(0x3fd2, 0x3fd2) AM_WRITE(vendetta_eeprom_w) // EEPROM, Video banking
+ AM_RANGE(0x3fd0, 0x3fd0) AM_WRITE(_5fe0_w) // Coin Counter, 052109 RMRD, 053246 OBJCHA
+ AM_RANGE(0x3fd2, 0x3fd2) AM_WRITE(eeprom_w) // EEPROM, Video banking
AM_RANGE(0x3fd4, 0x3fd4) AM_READWRITE(z80_irq_r, z80_irq_w) // Sound
AM_RANGE(0x3fd6, 0x3fd7) AM_DEVREADWRITE("k053260", k053260_device, main_read, main_write) // Sound
AM_RANGE(0x3fd8, 0x3fd9) AM_DEVREAD("k053246", k053247_device, k053246_r) // 053246 (Sprite)
AM_RANGE(0x3fda, 0x3fda) AM_WRITENOP // Not Emulated (Watchdog ???)
/* what is the desired effect of overlapping these memory regions anyway? */
- AM_RANGE(0x2000, 0x2fff) AM_RAMBANK("bank3") // 052109 (Tilemap) 0x0000-0x0fff
- AM_RANGE(0x4000, 0x4fff) AM_RAMBANK("bank2") // 052109 (Tilemap) 0x2000-0x3fff, Tilemap MASK-ROM bank selector (MASK-ROM Test)
+ AM_RANGE(0x2000, 0x2fff) AM_DEVICE("videobank0", address_map_bank_device, amap8) // 052109 (Tilemap) 0x0000-0x0fff - 052109 (Tilemap)
+ AM_RANGE(0x4000, 0x4fff) AM_DEVICE("videobank1", address_map_bank_device, amap8) // 0x2000-0x3fff, Tilemap MASK-ROM bank selector (MASK-ROM Test)
AM_RANGE(0x2000, 0x5fff) AM_DEVREADWRITE("k052109", k052109_device, read, write) // 052109 (Tilemap)
AM_RANGE(0x6000, 0x7fff) AM_ROMBANK("bank1") // 053248 '975r01' 1M ROM (Banked)
- AM_RANGE(0x8000, 0xffff) AM_ROM // 053248 '975r01' 1M ROM (0x18000-0x1ffff)
+ AM_RANGE(0x8000, 0xffff) AM_ROM AM_REGION("maincpu", 0x18000) // 053248 '975r01' 1M ROM (0x18000-0x1ffff)
ADDRESS_MAP_END
+static ADDRESS_MAP_START( videobank0_map, AS_PROGRAM, 8, vendetta_state )
+ AM_RANGE(0x0000, 0x0fff) AM_DEVREADWRITE("k052109", k052109_device, read, write)
+ AM_RANGE(0x1000, 0x1fff) AM_DEVREADWRITE("k053246", k053247_device, k053247_r, k053247_w)
+ADDRESS_MAP_END
+
+static ADDRESS_MAP_START( videobank1_map, AS_PROGRAM, 8, vendetta_state )
+ AM_RANGE(0x0000, 0x0fff) AM_READWRITE(K052109_r, K052109_w)
+ AM_RANGE(0x1000, 0x1fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
+ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, vendetta_state )
AM_RANGE(0x0000, 0xefff) AM_ROM
@@ -388,7 +380,7 @@ INPUT_PORTS_END
***************************************************************************/
-INTERRUPT_GEN_MEMBER(vendetta_state::vendetta_irq)
+INTERRUPT_GEN_MEMBER(vendetta_state::irq)
{
if (m_irq_enabled)
device.execute().set_input_line(KONAMI_IRQ_LINE, HOLD_LINE);
@@ -396,15 +388,9 @@ INTERRUPT_GEN_MEMBER(vendetta_state::vendetta_irq)
void vendetta_state::machine_start()
{
- UINT8 *ROM = memregion("maincpu")->base();
-
- membank("bank1")->configure_entries(0, 28, &ROM[0x10000], 0x2000);
+ membank("bank1")->configure_entries(0, 28, memregion("maincpu")->base(), 0x2000);
membank("bank1")->set_entry(0);
- m_paletteram.resize(0x1000);
- m_palette->basemem().set(m_paletteram, ENDIANNESS_BIG, 2);
-
- save_item(NAME(m_paletteram));
save_item(NAME(m_irq_enabled));
save_item(NAME(m_sprite_colorbase));
save_item(NAME(m_layer_colorbase));
@@ -421,9 +407,6 @@ void vendetta_state::machine_reset()
m_sprite_colorbase = 0;
m_irq_enabled = 0;
-
- /* init banks */
- vendetta_video_banking(0);
}
WRITE8_MEMBER( vendetta_state::banking_callback )
@@ -439,9 +422,23 @@ static MACHINE_CONFIG_START( vendetta, vendetta_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", KONAMI, XTAL_24MHz/8) /* 052001 (verified on pcb) */
MCFG_CPU_PROGRAM_MAP(main_map)
- MCFG_CPU_VBLANK_INT_DRIVER("screen", vendetta_state, vendetta_irq)
+ MCFG_CPU_VBLANK_INT_DRIVER("screen", vendetta_state, irq)
MCFG_KONAMICPU_LINE_CB(WRITE8(vendetta_state, banking_callback))
+ MCFG_DEVICE_ADD("videobank0", ADDRESS_MAP_BANK, 0)
+ MCFG_DEVICE_PROGRAM_MAP(videobank0_map)
+ MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG)
+ MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8)
+ MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(13)
+ MCFG_ADDRESS_MAP_BANK_STRIDE(0x1000)
+
+ MCFG_DEVICE_ADD("videobank1", ADDRESS_MAP_BANK, 0)
+ MCFG_DEVICE_PROGRAM_MAP(videobank1_map)
+ MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG)
+ MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8)
+ MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(13)
+ MCFG_ADDRESS_MAP_BANK_STRIDE(0x1000)
+
MCFG_CPU_ADD("audiocpu", Z80, XTAL_3_579545MHz) /* verified with PCB */
MCFG_CPU_PROGRAM_MAP(sound_map)
/* interrupts are triggered by the main CPU */
@@ -456,7 +453,7 @@ static MACHINE_CONFIG_START( vendetta, vendetta_state )
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(13*8, (64-13)*8-1, 2*8, 30*8-1 )
- MCFG_SCREEN_UPDATE_DRIVER(vendetta_state, screen_update_vendetta)
+ MCFG_SCREEN_UPDATE_DRIVER(vendetta_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
MCFG_PALETTE_ADD("palette", 2048)
@@ -522,9 +519,8 @@ MACHINE_CONFIG_END
***************************************************************************/
ROM_START( vendetta )
- ROM_REGION( 0x48000, "maincpu", 0 ) /* code + banked roms + banked ram */
- ROM_LOAD( "081t01", 0x10000, 0x38000, CRC(e76267f5) SHA1(efef6c2edb4c181374661f358dad09123741b63d) )
- ROM_CONTINUE( 0x08000, 0x08000 )
+ ROM_REGION( 0x40000, "maincpu", 0 ) /* code + banked roms + banked ram */
+ ROM_LOAD( "081t01", 0x00000, 0x40000, CRC(e76267f5) SHA1(efef6c2edb4c181374661f358dad09123741b63d) )
ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for the sound CPU */
ROM_LOAD( "081b02", 0x000000, 0x10000, CRC(4c604d9b) SHA1(22d979f5dbde7912dd927bf5538fdbfc5b82905e) )
@@ -547,9 +543,8 @@ ROM_START( vendetta )
ROM_END
ROM_START( vendettar )
- ROM_REGION( 0x48000, "maincpu", 0 ) /* code + banked roms + banked ram */
- ROM_LOAD( "081r01", 0x10000, 0x38000, CRC(84796281) SHA1(e4330c6eaa17adda5b4bd3eb824388c89fb07918) )
- ROM_CONTINUE( 0x08000, 0x08000 )
+ ROM_REGION( 0x40000, "maincpu", 0 ) /* code + banked roms + banked ram */
+ ROM_LOAD( "081r01", 0x00000, 0x40000, CRC(84796281) SHA1(e4330c6eaa17adda5b4bd3eb824388c89fb07918) )
ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for the sound CPU */
ROM_LOAD( "081b02", 0x000000, 0x10000, CRC(4c604d9b) SHA1(22d979f5dbde7912dd927bf5538fdbfc5b82905e) )
@@ -572,9 +567,8 @@ ROM_START( vendettar )
ROM_END
ROM_START( vendettaz )
- ROM_REGION( 0x48000, "maincpu", 0 ) /* code + banked roms + banked ram */
- ROM_LOAD( "081z01.bin", 0x10000, 0x38000, CRC(4d225a8d) SHA1(fe8f6e63d033cf04c9a287d870db244fddb81f03) )
- ROM_CONTINUE( 0x08000, 0x08000 )
+ ROM_REGION( 0x40000, "maincpu", 0 ) /* code + banked roms + banked ram */
+ ROM_LOAD( "081z01.bin", 0x00000, 0x40000, CRC(4d225a8d) SHA1(fe8f6e63d033cf04c9a287d870db244fddb81f03) )
ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for the sound CPU */
ROM_LOAD( "081b02", 0x000000, 0x10000, CRC(4c604d9b) SHA1(22d979f5dbde7912dd927bf5538fdbfc5b82905e) )
@@ -597,9 +591,8 @@ ROM_START( vendettaz )
ROM_END
ROM_START( vendetta2p )
- ROM_REGION( 0x48000, "maincpu", 0 ) /* code + banked roms + banked ram */
- ROM_LOAD( "081w01", 0x10000, 0x38000, CRC(cee57132) SHA1(8b6413877e127511daa76278910c2ee3247d613a) )
- ROM_CONTINUE( 0x08000, 0x08000 )
+ ROM_REGION( 0x40000, "maincpu", 0 ) /* code + banked roms + banked ram */
+ ROM_LOAD( "081w01", 0x00000, 0x40000, CRC(cee57132) SHA1(8b6413877e127511daa76278910c2ee3247d613a) )
ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for the sound CPU */
ROM_LOAD( "081b02", 0x000000, 0x10000, CRC(4c604d9b) SHA1(22d979f5dbde7912dd927bf5538fdbfc5b82905e) )
@@ -623,9 +616,8 @@ ROM_END
ROM_START( vendetta2peba )
- ROM_REGION( 0x48000, "maincpu", 0 ) /* code + banked roms + banked ram */
- ROM_LOAD( "081-eb-a01.17c", 0x10000, 0x38000, CRC(8430bb52) SHA1(54e896510fa44e76b0640b17150210fbf6b3b5bc)) // Label was unclear apart from EB stamp on the middle line. Bottom line looked like 401, but probably A01
- ROM_CONTINUE( 0x08000, 0x08000 )
+ ROM_REGION( 0x40000, "maincpu", 0 ) /* code + banked roms + banked ram */
+ ROM_LOAD( "081-eb-a01.17c", 0x00000, 0x40000, CRC(8430bb52) SHA1(54e896510fa44e76b0640b17150210fbf6b3b5bc)) // Label was unclear apart from EB stamp on the middle line. Bottom line looked like 401, but probably A01
ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for the sound CPU */
ROM_LOAD( "081b02", 0x000000, 0x10000, CRC(4c604d9b) SHA1(22d979f5dbde7912dd927bf5538fdbfc5b82905e) )
@@ -648,9 +640,8 @@ ROM_START( vendetta2peba )
ROM_END
ROM_START( vendetta2pu )
- ROM_REGION( 0x48000, "maincpu", 0 ) /* code + banked roms + banked ram */
- ROM_LOAD( "081u01", 0x10000, 0x38000, CRC(b4d9ade5) SHA1(fbd543738cb0b68c80ff05eed7849b608de03395) )
- ROM_CONTINUE( 0x08000, 0x08000 )
+ ROM_REGION( 0x40000, "maincpu", 0 ) /* code + banked roms + banked ram */
+ ROM_LOAD( "081u01", 0x00000, 0x40000, CRC(b4d9ade5) SHA1(fbd543738cb0b68c80ff05eed7849b608de03395) )
ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for the sound CPU */
ROM_LOAD( "081b02", 0x000000, 0x10000, CRC(4c604d9b) SHA1(22d979f5dbde7912dd927bf5538fdbfc5b82905e) )
@@ -673,9 +664,8 @@ ROM_START( vendetta2pu )
ROM_END
ROM_START( vendetta2pd )
- ROM_REGION( 0x48000, "maincpu", 0 ) /* code + banked roms + banked ram */
- ROM_LOAD( "081d01", 0x10000, 0x38000, CRC(335da495) SHA1(ea74680eb898aeecf9f1eec95f151bcf66e6b6cb) )
- ROM_CONTINUE( 0x08000, 0x08000 )
+ ROM_REGION( 0x40000, "maincpu", 0 ) /* code + banked roms + banked ram */
+ ROM_LOAD( "081d01", 0x00000, 0x40000, CRC(335da495) SHA1(ea74680eb898aeecf9f1eec95f151bcf66e6b6cb) )
ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for the sound CPU */
ROM_LOAD( "081b02", 0x000000, 0x10000, CRC(4c604d9b) SHA1(22d979f5dbde7912dd927bf5538fdbfc5b82905e) )
@@ -701,9 +691,8 @@ ROM_END
ROM_START( vendettaj )
- ROM_REGION( 0x48000, "maincpu", 0 ) /* code + banked roms + banked ram */
- ROM_LOAD( "081p01", 0x10000, 0x38000, CRC(5fe30242) SHA1(2ea98e66637fa2ad60044b1a2b0dd158a82403a2) )
- ROM_CONTINUE( 0x08000, 0x08000 )
+ ROM_REGION( 0x40000, "maincpu", 0 ) /* code + banked roms + banked ram */
+ ROM_LOAD( "081p01", 0x00000, 0x40000, CRC(5fe30242) SHA1(2ea98e66637fa2ad60044b1a2b0dd158a82403a2) )
ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for the sound CPU */
ROM_LOAD( "081b02", 0x000000, 0x10000, CRC(4c604d9b) SHA1(22d979f5dbde7912dd927bf5538fdbfc5b82905e) )
@@ -726,9 +715,8 @@ ROM_START( vendettaj )
ROM_END
ROM_START( esckids )
- ROM_REGION( 0x048000, "maincpu", 0 ) // Main CPU (053248) Code & Banked (1M x 1)
- ROM_LOAD( "17c.bin", 0x010000, 0x018000, CRC(9dfba99c) SHA1(dbcb89aad5a9addaf7200b2524be999877313a6e) )
- ROM_CONTINUE( 0x008000, 0x008000 )
+ ROM_REGION( 0x020000, "maincpu", 0 ) // Main CPU (053248) Code & Banked (1M x 1)
+ ROM_LOAD( "17c.bin", 0x000000, 0x020000, CRC(9dfba99c) SHA1(dbcb89aad5a9addaf7200b2524be999877313a6e) )
ROM_REGION( 0x010000, "audiocpu", 0 ) // Sound CPU (Z80) Code (512K x 1)
ROM_LOAD( "975f02", 0x000000, 0x010000, CRC(994fb229) SHA1(bf194ae91240225b8edb647b1a62cd83abfa215e) )
@@ -752,9 +740,8 @@ ROM_END
ROM_START( esckidsj )
- ROM_REGION( 0x048000, "maincpu", 0 ) // Main CPU (053248) Code & Banked (1M x 1)
- ROM_LOAD( "975r01", 0x010000, 0x018000, CRC(7b5c5572) SHA1(b94b58c010539926d112c2dfd80bcbad76acc986) )
- ROM_CONTINUE( 0x008000, 0x008000 )
+ ROM_REGION( 0x020000, "maincpu", 0 ) // Main CPU (053248) Code & Banked (1M x 1)
+ ROM_LOAD( "975r01", 0x000000, 0x020000, CRC(7b5c5572) SHA1(b94b58c010539926d112c2dfd80bcbad76acc986) )
ROM_REGION( 0x010000, "audiocpu", 0 ) // Sound CPU (Z80) Code (512K x 1)
ROM_LOAD( "975f02", 0x000000, 0x010000, CRC(994fb229) SHA1(bf194ae91240225b8edb647b1a62cd83abfa215e) )
@@ -783,25 +770,14 @@ ROM_END
***************************************************************************/
-DRIVER_INIT_MEMBER(vendetta_state,vendetta)
-{
- m_video_banking_base = 0x4000;
-}
-
-DRIVER_INIT_MEMBER(vendetta_state,esckids)
-{
- m_video_banking_base = 0x2000;
-}
-
-
-GAME( 1991, vendetta, 0, vendetta, vendet4p, vendetta_state, vendetta, ROT0, "Konami", "Vendetta (World, 4 Players, ver. T)", MACHINE_SUPPORTS_SAVE )
-GAME( 1991, vendettar, vendetta, vendetta, vendet4p, vendetta_state, vendetta, ROT0, "Konami", "Vendetta (US, 4 Players, ver. R)", MACHINE_SUPPORTS_SAVE )
-GAME( 1991, vendettaz, vendetta, vendetta, vendet4p, vendetta_state, vendetta, ROT0, "Konami", "Vendetta (Asia, 4 Players, ver. Z)", MACHINE_SUPPORTS_SAVE )
-GAME( 1991, vendetta2p, vendetta, vendetta, vendetta, vendetta_state, vendetta, ROT0, "Konami", "Vendetta (World, 2 Players, ver. W)", MACHINE_SUPPORTS_SAVE )
-GAME( 1991, vendetta2peba,vendetta,vendetta, vendetta, vendetta_state, vendetta, ROT0, "Konami", "Vendetta (World, 2 Players, ver. EB-A?)", MACHINE_SUPPORTS_SAVE )
-GAME( 1991, vendetta2pu, vendetta, vendetta, vendetta, vendetta_state, vendetta, ROT0, "Konami", "Vendetta (Asia, 2 Players, ver. U)", MACHINE_SUPPORTS_SAVE )
-GAME( 1991, vendetta2pd, vendetta, vendetta, vendetta, vendetta_state, vendetta, ROT0, "Konami", "Vendetta (Asia, 2 Players, ver. D)", MACHINE_SUPPORTS_SAVE )
-GAME( 1991, vendettaj, vendetta, vendetta, vendetta, vendetta_state, vendetta, ROT0, "Konami", "Crime Fighters 2 (Japan, 2 Players, ver. P)", MACHINE_SUPPORTS_SAVE )
-GAME( 1991, esckids, 0, esckids, esckids, vendetta_state, esckids, ROT0, "Konami", "Escape Kids (Asia, 4 Players)", MACHINE_SUPPORTS_SAVE )
-GAME( 1991, esckidsj, esckids, esckids, esckidsj, vendetta_state, esckids, ROT0, "Konami", "Escape Kids (Japan, 2 Players)", MACHINE_SUPPORTS_SAVE )
+GAME( 1991, vendetta, 0, vendetta, vendet4p, driver_device, 0, ROT0, "Konami", "Vendetta (World, 4 Players, ver. T)", MACHINE_SUPPORTS_SAVE )
+GAME( 1991, vendettar, vendetta, vendetta, vendet4p, driver_device, 0, ROT0, "Konami", "Vendetta (US, 4 Players, ver. R)", MACHINE_SUPPORTS_SAVE )
+GAME( 1991, vendettaz, vendetta, vendetta, vendet4p, driver_device, 0, ROT0, "Konami", "Vendetta (Asia, 4 Players, ver. Z)", MACHINE_SUPPORTS_SAVE )
+GAME( 1991, vendetta2p, vendetta, vendetta, vendetta, driver_device, 0, ROT0, "Konami", "Vendetta (World, 2 Players, ver. W)", MACHINE_SUPPORTS_SAVE )
+GAME( 1991, vendetta2peba,vendetta,vendetta, vendetta, driver_device, 0, ROT0, "Konami", "Vendetta (World, 2 Players, ver. EB-A?)", MACHINE_SUPPORTS_SAVE )
+GAME( 1991, vendetta2pu, vendetta, vendetta, vendetta, driver_device, 0, ROT0, "Konami", "Vendetta (Asia, 2 Players, ver. U)", MACHINE_SUPPORTS_SAVE )
+GAME( 1991, vendetta2pd, vendetta, vendetta, vendetta, driver_device, 0, ROT0, "Konami", "Vendetta (Asia, 2 Players, ver. D)", MACHINE_SUPPORTS_SAVE )
+GAME( 1991, vendettaj, vendetta, vendetta, vendetta, driver_device, 0, ROT0, "Konami", "Crime Fighters 2 (Japan, 2 Players, ver. P)", MACHINE_SUPPORTS_SAVE )
+GAME( 1991, esckids, 0, esckids, esckids, driver_device, 0, ROT0, "Konami", "Escape Kids (Asia, 4 Players)", MACHINE_SUPPORTS_SAVE )
+GAME( 1991, esckidsj, esckids, esckids, esckidsj, driver_device, 0, ROT0, "Konami", "Escape Kids (Japan, 2 Players)", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/includes/vendetta.h b/src/mame/includes/vendetta.h
index f32c7cc9f61..497db3c2886 100644
--- a/src/mame/includes/vendetta.h
+++ b/src/mame/includes/vendetta.h
@@ -5,6 +5,7 @@
Vendetta
*************************************************************************/
+#include "machine/bankdev.h"
#include "machine/k053252.h"
#include "video/k053246_k053247_k055673.h"
#include "video/k054000.h"
@@ -29,11 +30,11 @@ public:
m_k053251(*this, "k053251"),
m_k053252(*this, "k053252"),
m_k054000(*this, "k054000"),
- m_palette(*this, "palette") { }
-
- /* memory pointers */
- std::vector<UINT8> m_paletteram;
+ m_palette(*this, "palette"),
+ m_videobank0(*this, "videobank0"),
+ m_videobank1(*this, "videobank1") { }
+
/* video-related */
int m_layer_colorbase[3];
int m_sprite_colorbase;
@@ -41,7 +42,6 @@ public:
/* misc */
int m_irq_enabled;
- offs_t m_video_banking_base;
/* devices */
required_device<cpu_device> m_maincpu;
@@ -52,20 +52,25 @@ public:
optional_device<k053252_device> m_k053252;
optional_device<k054000_device> m_k054000;
required_device<palette_device> m_palette;
- DECLARE_WRITE8_MEMBER(vendetta_eeprom_w);
- DECLARE_READ8_MEMBER(vendetta_K052109_r);
- DECLARE_WRITE8_MEMBER(vendetta_K052109_w);
- DECLARE_WRITE8_MEMBER(vendetta_5fe0_w);
+
+ required_device<address_map_bank_device> m_videobank0;
+ required_device<address_map_bank_device> m_videobank1;
+
+ DECLARE_WRITE8_MEMBER(eeprom_w);
+ DECLARE_READ8_MEMBER(K052109_r);
+ DECLARE_WRITE8_MEMBER(K052109_w);
+ DECLARE_WRITE8_MEMBER(_5fe0_w);
DECLARE_WRITE8_MEMBER(z80_arm_nmi_w);
DECLARE_WRITE8_MEMBER(z80_irq_w);
DECLARE_READ8_MEMBER(z80_irq_r);
- DECLARE_DRIVER_INIT(vendetta);
- DECLARE_DRIVER_INIT(esckids);
+
virtual void machine_start() override;
virtual void machine_reset() override;
- UINT32 screen_update_vendetta(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- INTERRUPT_GEN_MEMBER(vendetta_irq);
- void vendetta_video_banking( int select );
+
+ UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+
+ INTERRUPT_GEN_MEMBER(irq);
+
K052109_CB_MEMBER(vendetta_tile_callback);
K052109_CB_MEMBER(esckids_tile_callback);
DECLARE_WRITE8_MEMBER(banking_callback);
diff --git a/src/mame/video/vendetta.cpp b/src/mame/video/vendetta.cpp
index 2dc72d2f7d7..9b587dcf055 100644
--- a/src/mame/video/vendetta.cpp
+++ b/src/mame/video/vendetta.cpp
@@ -50,7 +50,7 @@ K053246_CB_MEMBER(vendetta_state::sprite_callback)
***************************************************************************/
-UINT32 vendetta_state::screen_update_vendetta(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+UINT32 vendetta_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int layer[3];
diff --git a/src/osd/modules/debugger/win/consolewininfo.cpp b/src/osd/modules/debugger/win/consolewininfo.cpp
index 5e77a28a6e3..9245250b384 100644
--- a/src/osd/modules/debugger/win/consolewininfo.cpp
+++ b/src/osd/modules/debugger/win/consolewininfo.cpp
@@ -180,8 +180,8 @@ void consolewin_info::update_menu()
AppendMenu(devicesubmenu, MF_STRING, new_item + DEVOPTION_OPEN, TEXT("Mount..."));
- //if (img.is_creatable())
- //AppendMenu(devicesubmenu, MF_STRING, new_item + DEVOPTION_CREATE, TEXT("Create..."));
+ if (img.is_creatable())
+ AppendMenu(devicesubmenu, MF_STRING, new_item + DEVOPTION_CREATE, TEXT("Create..."));
AppendMenu(devicesubmenu, flags_for_exists, new_item + DEVOPTION_CLOSE, TEXT("Unmount"));
if (img.device().type() == CASSETTE)
@@ -262,8 +262,49 @@ bool consolewin_info::handle_command(WPARAM wparam, LPARAM lparam)
}
}
return true;
- //case DEVOPTION_CREATE:
- //return true;
+ case DEVOPTION_CREATE:
+ {
+ std::string filter;
+ build_generic_filter(img, true, filter);
+ LPTSTR t_filter = tstring_from_utf8(filter.c_str());
+ if (t_filter)
+ {
+ // convert a pipe-char delimited string into a NUL delimited string
+ for (int i = 0; t_filter[i] != '\0'; i++)
+ {
+ if (t_filter[i] == '|')
+ t_filter[i] = '\0';
+ }
+
+ TCHAR selectedFilename[MAX_PATH];
+ selectedFilename[0] = '\0';
+ OPENFILENAME ofn;
+ memset(&ofn, 0, sizeof(ofn));
+ ofn.lStructSize = sizeof(ofn);
+ ofn.hwndOwner = nullptr;
+ ofn.lpstrFile = selectedFilename;
+ ofn.lpstrFile[0] = '\0';
+ ofn.nMaxFile = MAX_PATH;
+ ofn.lpstrFilter = t_filter;
+ ofn.nFilterIndex = 1;
+ ofn.lpstrFileTitle = nullptr;
+ ofn.nMaxFileTitle = 0;
+ ofn.lpstrInitialDir = nullptr;
+ ofn.Flags = OFN_PATHMUSTEXIST;
+
+ if (GetSaveFileName(&ofn))
+ {
+ char *utf8_buf = utf8_from_tstring(selectedFilename);
+ if (utf8_buf != nullptr)
+ {
+ img->create(utf8_buf, img->device_get_indexed_creatable_format(0), nullptr);
+ osd_free(utf8_buf);
+ }
+ }
+ osd_free(t_filter);
+ }
+ }
+ return true;
case DEVOPTION_CLOSE:
img->unload();
return 1;
@@ -310,15 +351,17 @@ void consolewin_info::process_string(char const *string)
void consolewin_info::build_generic_filter(device_image_interface *img, bool is_save, std::string &filter)
{
- // common image types
- add_filter_entry(filter, "Common image types", img->file_extensions());
+ std::string file_extension = img->file_extensions();
- // compressed
if (!is_save)
- filter.append("Compressed Images (*.zip)|*.zip|");
+ file_extension.append(",zip,7z");
+
+ add_filter_entry(filter, "Common image types", file_extension.c_str());
- // all files
filter.append("All files (*.*)|*.*|");
+
+ if (!is_save)
+ filter.append("Compressed Images (*.zip;*.7z)|*.zip;*.7z|");
}