Merge pull request #1 from mamedev/master

Update Master
This commit is contained in:
Michael.S.G 2017-02-03 08:09:21 +11:00 committed by GitHub
commit 1886daad98
19 changed files with 1895 additions and 1067 deletions

View File

@ -3390,6 +3390,8 @@ files {
MAME_DIR .. "src/mame/video/rdpblend.h", MAME_DIR .. "src/mame/video/rdpblend.h",
MAME_DIR .. "src/mame/video/rdptpipe.cpp", MAME_DIR .. "src/mame/video/rdptpipe.cpp",
MAME_DIR .. "src/mame/video/rdptpipe.h", MAME_DIR .. "src/mame/video/rdptpipe.h",
MAME_DIR .. "src/mame/video/pin64.cpp",
MAME_DIR .. "src/mame/video/pin64.h",
MAME_DIR .. "src/mame/drivers/hanaawas.cpp", MAME_DIR .. "src/mame/drivers/hanaawas.cpp",
MAME_DIR .. "src/mame/includes/hanaawas.h", MAME_DIR .. "src/mame/includes/hanaawas.h",
MAME_DIR .. "src/mame/video/hanaawas.cpp", MAME_DIR .. "src/mame/video/hanaawas.cpp",

View File

@ -1172,6 +1172,8 @@ files {
MAME_DIR .. "src/mame/video/rdpblend.h", MAME_DIR .. "src/mame/video/rdpblend.h",
MAME_DIR .. "src/mame/video/rdptpipe.cpp", MAME_DIR .. "src/mame/video/rdptpipe.cpp",
MAME_DIR .. "src/mame/video/rdptpipe.h", MAME_DIR .. "src/mame/video/rdptpipe.h",
MAME_DIR .. "src/mame/video/pin64.cpp",
MAME_DIR .. "src/mame/video/pin64.h",
MAME_DIR .. "src/mame/machine/megadriv.cpp", MAME_DIR .. "src/mame/machine/megadriv.cpp",
MAME_DIR .. "src/mame/drivers/naomi.cpp", MAME_DIR .. "src/mame/drivers/naomi.cpp",
MAME_DIR .. "src/mame/includes/naomi.h", MAME_DIR .. "src/mame/includes/naomi.h",

File diff suppressed because it is too large Load Diff

View File

@ -8,10 +8,10 @@
***************************************************************************/ ***************************************************************************/
#pragma once #ifndef MAME_FRONTEND_CHEAT_H
#define MAME_FRONTEND_CHEAT_H
#ifndef __CHEAT_H__ #pragma once
#define __CHEAT_H__
#include "debug/express.h" #include "debug/express.h"
#include "debug/debugcpu.h" #include "debug/debugcpu.h"
@ -50,12 +50,20 @@ class number_and_format
{ {
public: public:
// construction/destruction // construction/destruction
number_and_format(uint64_t value = 0, util::xml::data_node::int_format format = util::xml::data_node::int_format::DECIMAL) constexpr number_and_format(
uint64_t value = 0,
util::xml::data_node::int_format format = util::xml::data_node::int_format::DECIMAL)
: m_value(value) : m_value(value)
, m_format(format) , m_format(format)
{ {
} }
// copyable/movable
constexpr number_and_format(number_and_format const &) = default;
number_and_format(number_and_format &&) = default;
number_and_format &operator=(number_and_format const &) = default;
number_and_format &operator=(number_and_format &&) = default;
// pass-through to look like a regular number // pass-through to look like a regular number
operator uint64_t &() { return m_value; } operator uint64_t &() { return m_value; }
operator const uint64_t &() const { return m_value; } operator const uint64_t &() const { return m_value; }
@ -77,13 +85,17 @@ class cheat_parameter
{ {
public: public:
// construction/destruction // construction/destruction
cheat_parameter(cheat_manager &manager, symbol_table &symbols, const char *filename, util::xml::data_node const &paramnode); cheat_parameter(
cheat_manager &manager,
symbol_table &symbols,
char const *filename,
util::xml::data_node const &paramnode);
// queries // queries
const char *text(); char const *text();
bool has_itemlist() const { return (m_itemlist.size() != 0); } bool has_itemlist() const { return !m_itemlist.empty(); }
bool is_minimum() const { return (m_value == ((m_itemlist.size() == 0) ? m_minval : m_itemlist.front()->value())); } bool is_minimum() const { return (m_itemlist.empty() ? m_minval : m_itemlist.front().value()) == m_value; }
bool is_maximum() const { return (m_value == ((m_itemlist.size() == 0) ? m_maxval : m_itemlist.back()->value())); } bool is_maximum() const { return (m_itemlist.empty() ? m_maxval : m_itemlist.back().value()) == m_value; }
// state setters // state setters
bool set_minimum_state(); bool set_minimum_state();
@ -102,11 +114,18 @@ private:
item(const char *text, uint64_t value, util::xml::data_node::int_format valformat) item(const char *text, uint64_t value, util::xml::data_node::int_format valformat)
: m_text(text) : m_text(text)
, m_value(value, valformat) , m_value(value, valformat)
{ } {
}
// copyable/movable
item(item const &) = default;
item(item &&) = default;
item &operator=(item const &) = default;
item &operator=(item &&) = default;
// getters // getters
const number_and_format &value() const { return m_value; } number_and_format const &value() const { return m_value; }
const char *text() const { return m_text.c_str(); } char const *text() const { return m_text.c_str(); }
private: private:
// internal state // internal state
@ -120,7 +139,7 @@ private:
number_and_format m_stepval; // step value number_and_format m_stepval; // step value
uint64_t m_value; // live value of the parameter uint64_t m_value; // live value of the parameter
std::string m_curtext; // holding for a value string std::string m_curtext; // holding for a value string
std::vector<std::unique_ptr<item>> m_itemlist; // list of items std::vector<item> m_itemlist; // list of items
}; };
@ -131,7 +150,11 @@ class cheat_script
{ {
public: public:
// construction/destruction // construction/destruction
cheat_script(cheat_manager &manager, symbol_table &symbols, const char *filename, util::xml::data_node const &scriptnode); cheat_script(
cheat_manager &manager,
symbol_table &symbols,
char const *filename,
util::xml::data_node const &scriptnode);
// getters // getters
script_state state() const { return m_state; } script_state state() const { return m_state; }
@ -146,7 +169,12 @@ private:
{ {
public: public:
// construction/destruction // construction/destruction
script_entry(cheat_manager &manager, symbol_table &symbols, const char *filename, util::xml::data_node const &entrynode, bool isaction); script_entry(
cheat_manager &manager,
symbol_table &symbols,
char const *filename,
util::xml::data_node const &entrynode,
bool isaction);
// actions // actions
void execute(cheat_manager &manager, uint64_t &argindex); void execute(cheat_manager &manager, uint64_t &argindex);
@ -158,7 +186,11 @@ private:
{ {
public: public:
// construction/destruction // construction/destruction
output_argument(cheat_manager &manager, symbol_table &symbols, const char *filename, util::xml::data_node const &argnode); output_argument(
cheat_manager &manager,
symbol_table &symbols,
char const *filename,
util::xml::data_node const &argnode);
// getters // getters
int count() const { return m_count; } int count() const { return m_count; }
@ -174,7 +206,7 @@ private:
}; };
// internal helpers // internal helpers
void validate_format(const char *filename, int line); void validate_format(char const *filename, int line);
// internal state // internal state
parsed_expression m_condition; // condition under which this is executed parsed_expression m_condition; // condition under which this is executed
@ -185,7 +217,7 @@ private:
ui::text_layout::text_justify m_justify; // justification when printing ui::text_layout::text_justify m_justify; // justification when printing
// constants // constants
static const int MAX_ARGUMENTS = 32; static constexpr int MAX_ARGUMENTS = 32;
}; };
// internal state // internal state
@ -264,7 +296,7 @@ private:
uint64_t m_argindex; // argument index variable uint64_t m_argindex; // argument index variable
// constants // constants
static const int DEFAULT_TEMP_VARIABLES = 10; static constexpr int DEFAULT_TEMP_VARIABLES = 10;
}; };
@ -280,10 +312,10 @@ public:
// getters // getters
running_machine &machine() const { return m_machine; } running_machine &machine() const { return m_machine; }
bool enabled() const { return !m_disabled; } bool enabled() const { return !m_disabled; }
const std::vector<std::unique_ptr<cheat_entry>> &entries() const { return m_cheatlist; } std::vector<std::unique_ptr<cheat_entry>> const &entries() const { return m_cheatlist; }
// setters // setters
void set_enable(bool enable = true); void set_enable(bool enable);
// actions // actions
void reload(); void reload();
@ -294,14 +326,14 @@ public:
std::string &get_output_string(int row, ui::text_layout::text_justify justify); std::string &get_output_string(int row, ui::text_layout::text_justify justify);
// global helpers // global helpers
static std::string quote_expression(const parsed_expression &expression); static std::string quote_expression(parsed_expression const &expression);
static uint64_t execute_frombcd(symbol_table &table, void *ref, int params, const uint64_t *param); static uint64_t execute_frombcd(symbol_table &table, void *ref, int params, uint64_t const *param);
static uint64_t execute_tobcd(symbol_table &table, void *ref, int params, const uint64_t *param); static uint64_t execute_tobcd(symbol_table &table, void *ref, int params, uint64_t const *param);
private: private:
// internal helpers // internal helpers
void frame_update(); void frame_update();
void load_cheats(const char *filename); void load_cheats(char const *filename);
// internal state // internal state
running_machine & m_machine; // reference to our machine running_machine & m_machine; // reference to our machine
@ -320,4 +352,4 @@ private:
}; };
#endif /* __CHEAT_H__ */ #endif /* MAME_FRONTEND_CHEAT_H */

View File

@ -885,7 +885,7 @@ chd_error chd_file::read_hunk(uint32_t hunknum, void *buffer)
// get a pointer to the map entry // get a pointer to the map entry
uint64_t blockoffs; uint64_t blockoffs;
uint32_t blocklen; uint32_t blocklen;
uint32_t blockcrc; util::crc32_t blockcrc;
uint8_t *rawmap; uint8_t *rawmap;
uint8_t *dest = reinterpret_cast<uint8_t *>(buffer); uint8_t *dest = reinterpret_cast<uint8_t *>(buffer);
switch (m_version) switch (m_version)
@ -2147,12 +2147,12 @@ void chd_file::decompress_v5_map()
// read the reader // read the reader
uint8_t rawbuf[16]; uint8_t rawbuf[16];
file_read(m_mapoffset, rawbuf, sizeof(rawbuf)); file_read(m_mapoffset, rawbuf, sizeof(rawbuf));
uint32_t mapbytes = be_read(&rawbuf[0], 4); uint32_t const mapbytes = be_read(&rawbuf[0], 4);
uint64_t firstoffs = be_read(&rawbuf[4], 6); uint64_t const firstoffs = be_read(&rawbuf[4], 6);
uint16_t mapcrc = be_read(&rawbuf[10], 2); util::crc16_t const mapcrc = be_read(&rawbuf[10], 2);
uint8_t lengthbits = rawbuf[12]; uint8_t const lengthbits = rawbuf[12];
uint8_t selfbits = rawbuf[13]; uint8_t const selfbits = rawbuf[13];
uint8_t parentbits = rawbuf[14]; uint8_t const parentbits = rawbuf[14];
// now read the map // now read the map
std::vector<uint8_t> compressed(mapbytes); std::vector<uint8_t> compressed(mapbytes);

View File

@ -15,10 +15,12 @@
#include "osdcore.h" #include "osdcore.h"
#include "corestr.h" #include "corestr.h"
#include <string>
#include "md5.h" #include "md5.h"
#include "sha1.h" #include "sha1.h"
#include <functional>
#include <string>
namespace util { namespace util {
//************************************************************************** //**************************************************************************
@ -132,13 +134,23 @@ protected:
// final digest // final digest
struct crc32_t struct crc32_t
{ {
bool operator==(const crc32_t &rhs) const { return m_raw == rhs.m_raw; } crc32_t() { }
bool operator!=(const crc32_t &rhs) const { return m_raw != rhs.m_raw; } constexpr crc32_t(const crc32_t &rhs) = default;
constexpr crc32_t(const uint32_t crc) : m_raw(crc) { }
constexpr bool operator==(const crc32_t &rhs) const { return m_raw == rhs.m_raw; }
constexpr bool operator!=(const crc32_t &rhs) const { return m_raw != rhs.m_raw; }
crc32_t &operator=(const crc32_t &rhs) = default;
crc32_t &operator=(const uint32_t crc) { m_raw = crc; return *this; } crc32_t &operator=(const uint32_t crc) { m_raw = crc; return *this; }
operator uint32_t() const { return m_raw; }
constexpr operator uint32_t() const { return m_raw; }
bool from_string(const char *string, int length = -1); bool from_string(const char *string, int length = -1);
std::string as_string() const; std::string as_string() const;
uint32_t m_raw; uint32_t m_raw;
static const crc32_t null; static const crc32_t null;
}; };
@ -178,13 +190,23 @@ protected:
// final digest // final digest
struct crc16_t struct crc16_t
{ {
bool operator==(const crc16_t &rhs) const { return m_raw == rhs.m_raw; } crc16_t() { }
bool operator!=(const crc16_t &rhs) const { return m_raw != rhs.m_raw; } constexpr crc16_t(const crc16_t &rhs) = default;
constexpr crc16_t(const uint16_t crc) : m_raw(crc) { }
constexpr bool operator==(const crc16_t &rhs) const { return m_raw == rhs.m_raw; }
constexpr bool operator!=(const crc16_t &rhs) const { return m_raw != rhs.m_raw; }
crc16_t &operator=(const crc16_t &rhs) = default;
crc16_t &operator=(const uint16_t crc) { m_raw = crc; return *this; } crc16_t &operator=(const uint16_t crc) { m_raw = crc; return *this; }
operator uint16_t() const { return m_raw; }
constexpr operator uint16_t() const { return m_raw; }
bool from_string(const char *string, int length = -1); bool from_string(const char *string, int length = -1);
std::string as_string() const; std::string as_string() const;
uint16_t m_raw; uint16_t m_raw;
static const crc16_t null; static const crc16_t null;
}; };
@ -220,4 +242,22 @@ protected:
} // namespace util } // namespace util
namespace std {
template <> struct hash<::util::crc32_t>
{
typedef ::util::crc32_t argument_type;
typedef std::size_t result_type;
result_type operator()(argument_type const & s) const { return std::hash<std::uint32_t>()(s); }
};
template <> struct hash<::util::crc16_t>
{
typedef ::util::crc16_t argument_type;
typedef std::size_t result_type;
result_type operator()(argument_type const & s) const { return std::hash<std::uint16_t>()(s); }
};
} // namespace std
#endif // __HASHING_H__ #endif // __HASHING_H__

View File

@ -7,7 +7,7 @@
Chase (aka Chase1) (1976) Chase (aka Chase1) (1976)
Deluxe Soccer (1973) Deluxe Soccer (1973)
Fire Power (1975) EG-1020-2 Fire Power (1975) EG-1020-2
Fütsball (1975) Fötsball (1975)
Galaxy Raider (1974) Galaxy Raider (1974)
Hesitation (1974) AL-6500? Hesitation (1974) AL-6500?
Hockey, Soccer, Tennis (1974) Hockey, Soccer, Tennis (1974)

View File

@ -323,7 +323,7 @@ static INPUT_PORTS_START( asteroid )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER("dvg", dvg_device, done_r, nullptr) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER("dvg", dvg_device, done_r, nullptr)
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_CODE(KEYCODE_SPACE) PORT_CODE(JOYCODE_BUTTON3) /* hyperspace */ PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_CODE(KEYCODE_SPACE) PORT_CODE(JOYCODE_BUTTON3) /* hyperspace */
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(JOYCODE_BUTTON1) /* fire */ PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(JOYCODE_BUTTON1) /* fire */
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_NAME("Diagnostic Step") PORT_CODE(KEYCODE_F1) PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_NAME("Diagnostic Step")
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_TILT ) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_TILT )
PORT_SERVICE( 0x80, IP_ACTIVE_HIGH ) PORT_SERVICE( 0x80, IP_ACTIVE_HIGH )
@ -416,7 +416,7 @@ static INPUT_PORTS_START( asterock )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, asteroid_state,clock_r, nullptr) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, asteroid_state,clock_r, nullptr)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_CODE(KEYCODE_SPACE) PORT_CODE(JOYCODE_BUTTON3) /* hyperspace */ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_CODE(KEYCODE_SPACE) PORT_CODE(JOYCODE_BUTTON3) /* hyperspace */
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(JOYCODE_BUTTON1) /* fire */ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(JOYCODE_BUTTON1) /* fire */
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Diagnostic Step") PORT_CODE(KEYCODE_F1) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Diagnostic Step")
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_TILT ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_TILT )
PORT_SERVICE( 0x80, IP_ACTIVE_LOW ) PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
@ -457,7 +457,7 @@ static INPUT_PORTS_START( astdelux )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER("dvg", dvg_device, done_r, nullptr) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER("dvg", dvg_device, done_r, nullptr)
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_CODE(KEYCODE_SPACE) PORT_CODE(JOYCODE_BUTTON3) /* hyperspace */ PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_CODE(KEYCODE_SPACE) PORT_CODE(JOYCODE_BUTTON3) /* hyperspace */
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(JOYCODE_BUTTON1) /* fire */ PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(JOYCODE_BUTTON1) /* fire */
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_NAME("Diagnostic Step") PORT_CODE(KEYCODE_F1) PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_NAME("Diagnostic Step")
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_TILT ) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_TILT )
PORT_SERVICE( 0x80, IP_ACTIVE_HIGH ) PORT_SERVICE( 0x80, IP_ACTIVE_HIGH )
@ -542,7 +542,7 @@ static INPUT_PORTS_START( llander )
/* Of the rest, Bit 6 is the 3KHz source. 3,4 and 5 are unknown */ /* Of the rest, Bit 6 is the 3KHz source. 3,4 and 5 are unknown */
PORT_BIT( 0x38, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x38, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, asteroid_state,clock_r, nullptr) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, asteroid_state,clock_r, nullptr)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Diagnostic Step") PORT_CODE(KEYCODE_F1) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Diagnostic Step")
PORT_START("IN1") PORT_START("IN1")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 ) PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )

View File

@ -447,7 +447,7 @@ static INPUT_PORTS_START( bwidow )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN1 ) // To fit "Coin A" Dip Switch PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN1 ) // To fit "Coin A" Dip Switch
PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_SERVICE( 0x10, IP_ACTIVE_LOW ) PORT_SERVICE( 0x10, IP_ACTIVE_LOW )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Diagnostic Step") PORT_CODE(KEYCODE_F1) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Diagnostic Step")
/* bit 6 is the VG HALT bit. We set it to "low" */ /* bit 6 is the VG HALT bit. We set it to "low" */
/* per default (busy vector processor). */ /* per default (busy vector processor). */
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER("avg", avg_device, done_r, nullptr) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER("avg", avg_device, done_r, nullptr)
@ -525,7 +525,7 @@ static INPUT_PORTS_START( gravitar )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN1 ) // To fit "Coin A" Dip Switch PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN1 ) // To fit "Coin A" Dip Switch
PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_SERVICE( 0x10, IP_ACTIVE_LOW ) PORT_SERVICE( 0x10, IP_ACTIVE_LOW )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Diagnostic Step") PORT_CODE(KEYCODE_F1) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Diagnostic Step")
/* bit 6 is the VG HALT bit. We set it to "low" */ /* bit 6 is the VG HALT bit. We set it to "low" */
/* per default (busy vector processor). */ /* per default (busy vector processor). */
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER("avg", avg_device, done_r, nullptr) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER("avg", avg_device, done_r, nullptr)
@ -633,7 +633,7 @@ static INPUT_PORTS_START( spacduel )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN1 ) // To fit "Coin A" Dip Switch PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN1 ) // To fit "Coin A" Dip Switch
PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_SERVICE( 0x10, IP_ACTIVE_LOW ) PORT_SERVICE( 0x10, IP_ACTIVE_LOW )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Diagnostic Step") PORT_CODE(KEYCODE_F1) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Diagnostic Step")
/* bit 6 is the VG HALT bit. We set it to "low" */ /* bit 6 is the VG HALT bit. We set it to "low" */
/* per default (busy vector processor). */ /* per default (busy vector processor). */
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER("avg", avg_device, done_r, nullptr) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER("avg", avg_device, done_r, nullptr)

View File

@ -355,7 +355,7 @@ ADDRESS_MAP_END
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )\ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )\
PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED )\ PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED )\
PORT_SERVICE( 0x10, IP_ACTIVE_LOW )\ PORT_SERVICE( 0x10, IP_ACTIVE_LOW )\
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Diagnostic Step") PORT_CODE(KEYCODE_F1)\ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Diagnostic Step") \
/* bit 6 is the VG HALT bit. We set it to "low" */\ /* bit 6 is the VG HALT bit. We set it to "low" */\
/* per default (busy vector processor). */\ /* per default (busy vector processor). */\
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER("avg", avg_bzone_device, done_r, nullptr)\ PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER("avg", avg_bzone_device, done_r, nullptr)\

View File

@ -51,7 +51,7 @@ ToDo:
- Get rid of ROM patches in Sly Spy and Hippodrome; - Get rid of ROM patches in Sly Spy and Hippodrome;
- background pen in Birdie Try is presumably wrong. - background pen in Birdie Try is presumably wrong.
- Pixel clock frequency isn't verified; - Pixel clock frequency isn't verified;
- Finally, get a proper decap of the MCUs used by Drangonninja and Birdie Try; - Finally, get a proper decap of the MCUs used by Dragonninja and Birdie Try;
Bad Dudes MCU dump came from an MCU that had been damaged during a misguided Bad Dudes MCU dump came from an MCU that had been damaged during a misguided

View File

@ -434,7 +434,7 @@ static INPUT_PORTS_START( firetrk )
PORT_DIPNAME( 0x40, 0x40, DEF_STR( Cabinet )) PORT_DIPNAME( 0x40, 0x40, DEF_STR( Cabinet ))
PORT_DIPSETTING( 0x00, "Smokey Joe (1 Player)" ) PORT_DIPSETTING( 0x00, "Smokey Joe (1 Player)" )
PORT_DIPSETTING( 0x40, "Fire Truck (2 Players)" ) PORT_DIPSETTING( 0x40, "Fire Truck (2 Players)" )
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_NAME("Diag Hold") PORT_CODE(KEYCODE_F6) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SERVICE2 ) PORT_NAME("Diag Hold")
PORT_START("BIT_7") PORT_START("BIT_7")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
@ -444,7 +444,7 @@ static INPUT_PORTS_START( firetrk )
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_COIN1 )
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN2 )
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, firetrk_state,crash_r, (void *)2) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, firetrk_state,crash_r, (void *)2)
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_NAME("Diag Step") PORT_CODE(KEYCODE_F1) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_NAME("Diag Step")
PORT_START("HORN") PORT_START("HORN")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Horn") PORT_PLAYER(1) PORT_CHANGED_MEMBER(DEVICE_SELF, firetrk_state,firetrk_horn_changed, 0) PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Horn") PORT_PLAYER(1) PORT_CHANGED_MEMBER(DEVICE_SELF, firetrk_state,firetrk_horn_changed, 0)

View File

@ -4,13 +4,25 @@
Apple LaserWriter II NT driver Apple LaserWriter II NT driver
0x000000 - 0x1fffff ???/ROM (switches based on overlay)
0x200000 - 0x3fffff ROM
0x400000 - 0x5fffff RAM
0x600000 - 0x7fffff ??? more RAM?
0x800000 - 0x9fffff LED/Printer Controls
0xa00000 - 0xbfffff Zilog 8530 SCC (Serial Control Chip) Read
0xc00000 - 0xdfffff Zilog 8530 SCC (Serial Control Chip) Write
0xe00000 - 0xefffff Rockwell 6522 VIA
0xf00000 - 0xffffef ??? (the ROM appears to be accessing here)
0xfffff0 - 0xffffff ???Auto Vector??
TODO: TODO:
- Get the board to pass its self test, it fails long before it even bothers reading the dipswitches - Get the board to pass its self test, it fails long before it even bothers reading the dipswitches
- Hook up SCC and VIA interrupt pins to the 68k
- Hook up the rest of the VIA pins to a canon printer HLE stub - Hook up the rest of the VIA pins to a canon printer HLE stub
- Hook up ADB bitbang device to the VIA CB1, CB2 and PortA pins - Hook up ADB bitbang device to the VIA CB1, CB2 and PortA pins
- Hook up VIA Port A, bits 5 and 6 to the SW1 and SW2 panel switches - Hook up VIA Port A, bits 5 and 6 to the SW1 and SW2 panel switches
- Everything else - Everything else
DONE:
- Hook up SCC and VIA interrupt pins to the 68k
Future: Future:
- Let the board identify itself to a emulated mac driver so it displays the printer icon on the desktop - Let the board identify itself to a emulated mac driver so it displays the printer icon on the desktop
@ -100,7 +112,7 @@ public:
{ } { }
DECLARE_READ16_MEMBER(bankedarea_r); DECLARE_READ16_MEMBER(bankedarea_r);
DECLARE_WRITE16_MEMBER(bankedarea_w); DECLARE_WRITE16_MEMBER(bankedarea_w);
DECLARE_WRITE8_MEMBER(led_w); DECLARE_WRITE8_MEMBER(led_out_w);
DECLARE_READ8_MEMBER(via_pa_r); DECLARE_READ8_MEMBER(via_pa_r);
DECLARE_WRITE8_MEMBER(via_pa_w); DECLARE_WRITE8_MEMBER(via_pa_w);
DECLARE_WRITE_LINE_MEMBER(via_ca2_w); DECLARE_WRITE_LINE_MEMBER(via_ca2_w);
@ -109,6 +121,7 @@ public:
DECLARE_WRITE_LINE_MEMBER(via_cb1_w); DECLARE_WRITE_LINE_MEMBER(via_cb1_w);
DECLARE_WRITE_LINE_MEMBER(via_cb2_w); DECLARE_WRITE_LINE_MEMBER(via_cb2_w);
DECLARE_WRITE_LINE_MEMBER(via_int_w); DECLARE_WRITE_LINE_MEMBER(via_int_w);
//DECLARE_WRITE_LINE_MEMBER(scc_int);
virtual void machine_start () override; virtual void machine_start () override;
virtual void machine_reset () override; virtual void machine_reset () override;
private: private:
@ -122,7 +135,7 @@ private:
required_device<via6522_device> m_via; required_device<via6522_device> m_via;
#endif #endif
// uint16_t *m_ram_ptr, *m_rom_ptr;
bool m_overlay; bool m_overlay;
}; };
@ -138,7 +151,8 @@ a23 a22 a21 a20 a19 a18 a17 a16 a15 a14 a13 a12 a11 a10 a9 a8 a7 a6 a5 a4
0 0 A 0 1 0 * * * * * * * * * * * * * * * * * * R ROMEN3 0 0 A 0 1 0 * * * * * * * * * * * * * * * * * * R ROMEN3
0 0 A 0 1 1 * * * * * * * * * * * * * * * * * * R ROMEN4 0 0 A 0 1 1 * * * * * * * * * * * * * * * * * * R ROMEN4
0 0 A 1 x x x x x x x x x x x x x x x x x x x x OPEN BUS 0 0 A 1 x x x x x x x x x x x x x x x x x x x x OPEN BUS
0 1 * * * * * * * * * * * * * * * * * * * * * * RW DRAM 0 1 0 * * * * * * * * * * * * * * * * * * * * * RW DRAM
0 1 1 * * * * * * * * * * * * * * * * * * * * * RW ???? DRAM mirror?
1 0 0 ? ? ? x x x x x x x x x x x x x x x x x 1 W Status LEDs and mech 1 0 0 ? ? ? x x x x x x x x x x x x x x x x x 1 W Status LEDs and mech
1 0 1 ? ? ? x x x x x x x x x x x x x x x * * 1 R 8530 SCC Read 1 0 1 ? ? ? x x x x x x x x x x x x x x x * * 1 R 8530 SCC Read
1 1 0 ? ? ? x x x x x x x x x x x x x x x * * 0 W 8530 SCC Write 1 1 0 ? ? ? x x x x x x x x x x x x x x x * * 0 W 8530 SCC Write
@ -153,7 +167,7 @@ map when overlay is set, i.e. A above is considered 'x':
000000-1fffff ROM (second half is open bus) 000000-1fffff ROM (second half is open bus)
200000-3fffff ROM (second half is open bus) 200000-3fffff ROM (second half is open bus)
400000-5fffff DRAM? 400000-5fffff DRAM?
600000-7fffff unknown 600000-7fffff unknown, DRAM mirror?
800000-83ffff LEDs and status bits to printer mechanism 800000-83ffff LEDs and status bits to printer mechanism
840000-9fffff unknown 840000-9fffff unknown
a00000-a3ffff SCC read a00000-a3ffff SCC read
@ -169,7 +183,7 @@ map when overlay is clear, i.e. A above is considered '1':
000000-1fffff unknown, maybe RAM???? maybe eeprom goes here too? eeprom is specifically disabled when overlay is set 000000-1fffff unknown, maybe RAM???? maybe eeprom goes here too? eeprom is specifically disabled when overlay is set
200000-3fffff ROM (second half is open bus) 200000-3fffff ROM (second half is open bus)
400000-5fffff DRAM? 400000-5fffff DRAM?
600000-7fffff unknown 600000-7fffff unknown, DRAM mirror?
800000-83ffff LEDs and status bits to printer mechanism 800000-83ffff LEDs and status bits to printer mechanism
840000-9fffff unknown 840000-9fffff unknown
a00000-a3ffff SCC read a00000-a3ffff SCC read
@ -189,8 +203,9 @@ static ADDRESS_MAP_START (maincpu_map, AS_PROGRAM, 16, lwriter_state)
AM_RANGE(0x000000, 0x1fffff) AM_READWRITE(bankedarea_r, bankedarea_w) AM_RANGE(0x000000, 0x1fffff) AM_READWRITE(bankedarea_r, bankedarea_w)
AM_RANGE(0x200000, 0x2fffff) AM_ROM AM_REGION("rom", 0) // 1MB ROM AM_RANGE(0x200000, 0x2fffff) AM_ROM AM_REGION("rom", 0) // 1MB ROM
//AM_RANGE(0x300000, 0x3fffff) // open bus? //AM_RANGE(0x300000, 0x3fffff) // open bus?
AM_RANGE(0x400000, 0x5fffff) AM_RAM AM_REGION("mainram", 0) AM_MIRROR(0x200000) // 2MB DRAM; the AM_MIRROR is probably wrong, but it gets the selftest to failing on test 08 instead of 0A AM_RANGE(0x400000, 0x5fffff) AM_RAM AM_REGION("mainram", 0) AM_MIRROR(0x200000) // 2MB DRAM
AM_RANGE(0x800000, 0x800001) AM_WRITE8(led_w, 0xff00) AM_MIRROR(0x1ffffe) // mirror is a guess given that the pals can only decode A18-A23 //AM_RANGE(0x600000, 0x600fff) AM_RAM AM_MIRROR(0x1ff000) // 4096 bytes SRAM????
AM_RANGE(0x800000, 0x800001) AM_WRITE8(led_out_w, 0xff00) AM_MIRROR(0x1ffffe) // mirror is a guess given that the pals can only decode A18-A23
AM_RANGE(0xc00000, 0xc00001) AM_DEVWRITE8("scc", scc8530_device, ca_w, 0x00ff) AM_MIRROR(0x1ffff8) AM_RANGE(0xc00000, 0xc00001) AM_DEVWRITE8("scc", scc8530_device, ca_w, 0x00ff) AM_MIRROR(0x1ffff8)
AM_RANGE(0xc00004, 0xc00005) AM_DEVWRITE8("scc", scc8530_device, da_w, 0x00ff) AM_MIRROR(0x1ffff8) AM_RANGE(0xc00004, 0xc00005) AM_DEVWRITE8("scc", scc8530_device, da_w, 0x00ff) AM_MIRROR(0x1ffff8)
AM_RANGE(0xa00000, 0xa00001) AM_DEVREAD8 ("scc", scc8530_device, ca_r, 0xff00) AM_MIRROR(0x1ffff8) AM_RANGE(0xa00000, 0xa00001) AM_DEVREAD8 ("scc", scc8530_device, ca_r, 0xff00) AM_MIRROR(0x1ffff8)
@ -214,6 +229,8 @@ INPUT_PORTS_END
/* Start it up */ /* Start it up */
void lwriter_state::machine_start() void lwriter_state::machine_start()
{ {
m_rom_ptr = (uint16_t*)memregion("rom")->base();
m_ram_ptr = (uint16_t*)memregion("mainram")->base();
// do stuff here later on like setting up printer mechanisms HLE timers etc // do stuff here later on like setting up printer mechanisms HLE timers etc
} }
@ -223,8 +240,29 @@ void lwriter_state::machine_reset()
m_via->reset(); m_via->reset();
} }
/* Overlay area */
READ16_MEMBER(lwriter_state::bankedarea_r)
{
if (m_overlay)
{
return m_rom_ptr[offset];
}
// what actually maps here? dram? the sram and eeprom?
return 0xFFFF;//m_ram_ptr[offset];
}
WRITE16_MEMBER (lwriter_state::bankedarea_w)
{
if (!m_overlay)
{
COMBINE_DATA(&m_ram_ptr[offset]);
}
else
fprintf(stderr, "Attempt to write data %04X to offset %08X IGNORED!\n", data, offset);
}
/* 4 diagnostic LEDs, plus 4 i/o lines for the printer */ /* 4 diagnostic LEDs, plus 4 i/o lines for the printer */
WRITE8_MEMBER(lwriter_state::led_w) WRITE8_MEMBER(lwriter_state::led_out_w)
{ {
//popmessage("LED status: %02X\n", data&0xFF); //popmessage("LED status: %02X\n", data&0xFF);
logerror("LED status: %02X\n", data&0xFF); logerror("LED status: %02X\n", data&0xFF);
@ -232,7 +270,6 @@ WRITE8_MEMBER(lwriter_state::led_w)
} }
/* via stuff */ /* via stuff */
// second via
READ8_MEMBER(lwriter_state::via_pa_r) READ8_MEMBER(lwriter_state::via_pa_r)
{ {
logerror(" VIA: Port A read!\n"); logerror(" VIA: Port A read!\n");
@ -258,6 +295,8 @@ READ8_MEMBER(lwriter_state::via_pb_r)
WRITE8_MEMBER(lwriter_state::via_pb_w) WRITE8_MEMBER(lwriter_state::via_pb_w)
{ {
logerror(" VIA: Port B written with data of 0x%02x!\n", data); logerror(" VIA: Port B written with data of 0x%02x!\n", data);
/* Like early Mac models which had VIA A4 control overlaying, the
* LaserWriter II NT overlay is controlled by VIA B3 */
m_overlay = BIT(data,3); m_overlay = BIT(data,3);
} }
@ -274,31 +313,18 @@ WRITE_LINE_MEMBER(lwriter_state::via_cb2_w)
WRITE_LINE_MEMBER(lwriter_state::via_int_w) WRITE_LINE_MEMBER(lwriter_state::via_int_w)
{ {
logerror(" VIA: INT output set to %d!\n", state); logerror(" VIA: INT output set to %d!\n", state);
//TODO: this is likely wrong, the VPA pin which controls whether autovector is enabled or not is controlled by PAL U8D, which is not dumped.
m_maincpu->set_input_line_and_vector(M68K_IRQ_1, (state ? ASSERT_LINE : CLEAR_LINE), M68K_INT_ACK_AUTOVECTOR);
} }
READ16_MEMBER(lwriter_state::bankedarea_r) /* scc stuff */
/*
WRITE_LINE_MEMBER(lwriter_state::scc_int)
{ {
uint16_t *rom = (uint16_t *)(memregion("rom")->base()); logerror(" SCC: INT output set to %d!\n", state);
//uint16_t *ram = (uint16_t *)(memregion("mainram")->base()); //m_via->set_input_line(VIA_CA1, state ? ASSERT_LINE : CLEAR_LINE);
if (m_overlay == 1) m_via->write_ca1(state);
{ }*/
rom += (offset&0x1fffff);
return *rom;
}
else
{
// what actually maps here? the sram and eeprom?
//ram += (offset&0x1fffff);
//return *ram;
return 0xFFFF; /** TODO: fix me */
}
}
WRITE16_MEMBER (lwriter_state::bankedarea_w)
{
uint16_t *ram = (uint16_t *)(memregion("mainram")->base());
COMBINE_DATA(&ram[offset]);
}
#define CPU_CLK (XTAL_22_3210MHz / 2) // Based on pictures form here: http://picclick.co.uk/Apple-Postscript-LaserWriter-IINT-Printer-640-4105-M6009-Mainboard-282160713108.html#&gid=1&pid=7 #define CPU_CLK (XTAL_22_3210MHz / 2) // Based on pictures form here: http://picclick.co.uk/Apple-Postscript-LaserWriter-IINT-Printer-640-4105-M6009-Mainboard-282160713108.html#&gid=1&pid=7
#define RXC_CLK ((CPU_CLK - (87 * 16 * 70)) / 3) // Tuned to get 9600 baud according to manual, needs rework based on real hardware #define RXC_CLK ((CPU_CLK - (87 * 16 * 70)) / 3) // Tuned to get 9600 baud according to manual, needs rework based on real hardware
@ -315,6 +341,9 @@ static MACHINE_CONFIG_START( lwriter, lwriter_state )
MCFG_Z80SCC_OUT_TXDB_CB(DEVWRITELINE("rs232b", rs232_port_device, write_txd)) MCFG_Z80SCC_OUT_TXDB_CB(DEVWRITELINE("rs232b", rs232_port_device, write_txd))
MCFG_Z80SCC_OUT_DTRB_CB(DEVWRITELINE("rs232b", rs232_port_device, write_dtr)) MCFG_Z80SCC_OUT_DTRB_CB(DEVWRITELINE("rs232b", rs232_port_device, write_dtr))
MCFG_Z80SCC_OUT_RTSB_CB(DEVWRITELINE("rs232b", rs232_port_device, write_rts)) MCFG_Z80SCC_OUT_RTSB_CB(DEVWRITELINE("rs232b", rs232_port_device, write_rts))
/* Interrupt */
MCFG_Z80SCC_OUT_INT_CB(DEVWRITELINE("via", via6522_device, write_ca1))
//MCFG_Z80SCC_OUT_INT_CB(WRITELINE(lwriter_state, scc_int))
MCFG_RS232_PORT_ADD ("rs232a", default_rs232_devices, "terminal") MCFG_RS232_PORT_ADD ("rs232a", default_rs232_devices, "terminal")
MCFG_RS232_RXD_HANDLER (DEVWRITELINE ("scc", scc8530_device, rxa_w)) MCFG_RS232_RXD_HANDLER (DEVWRITELINE ("scc", scc8530_device, rxa_w))
@ -373,14 +402,14 @@ MACHINE_CONFIG_END
ROM_START(lwriter) ROM_START(lwriter)
ROM_REGION16_BE (0x1000000, "rom", 0) ROM_REGION16_BE (0x1000000, "rom", 0)
ROM_LOAD16_BYTE ("342-0545.l0", 0x000001, 0x20000, CRC (6431742d) SHA1 (040bd5b84b49b86f2b0fe9ece378bbc7a10a94ec)) ROM_LOAD16_BYTE ("342-0545.l0", 0x000001, 0x20000, CRC (6431742d) SHA1 (040bd5b84b49b86f2b0fe9ece378bbc7a10a94ec)) // Label: "342-0545-A JAPAN // TC531000CP-F700 // (C) 87 APPLE 8940EAI // (C) 83-87 ADOBE V47.0 // (C) 81 LINOTYPE" TC531000 @L0
ROM_LOAD16_BYTE ("342-0546.h0", 0x000000, 0x20000, CRC (c592bfb7) SHA1 (b595ae225238f7fabd1566a3133ea6154e082e2d)) ROM_LOAD16_BYTE ("342-0546.h0", 0x000000, 0x20000, CRC (c592bfb7) SHA1 (b595ae225238f7fabd1566a3133ea6154e082e2d)) // Label: "342-0546-A JAPAN // TC531000CP-F701 // (C) 87 APPLE 8940EAI // (C) 83-87 ADOBE V47.0 // (C) 81 LINOTYPE" TC531000 @H0
ROM_LOAD16_BYTE ("342-0547.l1", 0x040001, 0x20000, CRC (205a5ea8) SHA1 (205fefbb5c67a07d57cb6184c69648321a34a8fe)) ROM_LOAD16_BYTE ("342-0547.l1", 0x040001, 0x20000, CRC (205a5ea8) SHA1 (205fefbb5c67a07d57cb6184c69648321a34a8fe)) // Label: "342-0547-A JAPAN // TC531000CP-F702 // (C) 87 APPLE 8940EAI // (C) 83-87 ADOBE V47.0 // (C) 81 LINOTYPE" TC531000 @L1
ROM_LOAD16_BYTE ("342-0548.h1", 0x040000, 0x20000, CRC (f616e1c3) SHA1 (b9e2cd4d07990b2d1936be97b6e89ef21f06b462)) ROM_LOAD16_BYTE ("342-0548.h1", 0x040000, 0x20000, CRC (f616e1c3) SHA1 (b9e2cd4d07990b2d1936be97b6e89ef21f06b462)) // Label: "342-0548-A JAPAN // TC531000CP-F703 // (C) 87 APPLE 8940EAI // (C) 83-87 ADOBE V47.0 // (C) 81 LINOTYPE" TC531000 @H1
ROM_LOAD16_BYTE ("342-0549.l2", 0x080001, 0x20000, CRC (0b0b051a) SHA1 (64a80085001570c3f99d9865031715bf49bd7698)) ROM_LOAD16_BYTE ("342-0549.l2", 0x080001, 0x20000, CRC (0b0b051a) SHA1 (64a80085001570c3f99d9865031715bf49bd7698)) // Label: "342-0549-A JAPAN // TC531000CP-F704 // (C) 87 APPLE 8940EAI // (C) 83-87 ADOBE V47.0 // (C) 81 LINOTYPE" TC531000 @L2
ROM_LOAD16_BYTE ("342-0550.h2", 0x080000, 0x20000, CRC (82adcf85) SHA1 (e2ab728afdae802c0c67fc25c9ba278b9cb04e31)) ROM_LOAD16_BYTE ("342-0550.h2", 0x080000, 0x20000, CRC (82adcf85) SHA1 (e2ab728afdae802c0c67fc25c9ba278b9cb04e31)) // Label: "342-0550-A JAPAN // TC531000CP-F705 // (C) 87 APPLE 8940EAI // (C) 83-87 ADOBE V47.0 // (C) 81 LINOTYPE" TC531000 @H2
ROM_LOAD16_BYTE ("342-0551.l3", 0x0c0001, 0x20000, CRC (176b3346) SHA1 (eb8dfc7e44f2bc884097e51a47e2f10ee091c9e9)) ROM_LOAD16_BYTE ("342-0551.l3", 0x0c0001, 0x20000, CRC (176b3346) SHA1 (eb8dfc7e44f2bc884097e51a47e2f10ee091c9e9)) // Label: "342-0551-A JAPAN // TC531000CP-F706 // (C) 87 APPLE 8940EAI // (C) 83-87 ADOBE V47.0 // (C) 81 LINOTYPE" TC531000 @L3
ROM_LOAD16_BYTE ("342-0552.h3", 0x0c0000, 0x20000, CRC (69b175c6) SHA1 (a84c82be1ec7e373bb097ee74b941920a3b091aa)) ROM_LOAD16_BYTE ("342-0552.h3", 0x0c0000, 0x20000, CRC (69b175c6) SHA1 (a84c82be1ec7e373bb097ee74b941920a3b091aa)) // Label: "342-0552-A JAPAN // TC531000CP-F707 // (C) 87 APPLE 8940EAI // (C) 83-87 ADOBE V47.0 // (C) 81 LINOTYPE" TC531000 @H3
ROM_REGION( 0x200000, "mainram", ROMREGION_ERASEFF ) ROM_REGION( 0x200000, "mainram", ROMREGION_ERASEFF )
ROM_END ROM_END

View File

@ -204,7 +204,7 @@ static INPUT_PORTS_START( starwars )
PORT_START("IN1") PORT_START("IN1")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Diagnostic Step") PORT_CODE(KEYCODE_F1) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE2 ) PORT_NAME("Diagnostic Step")
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )

View File

@ -477,7 +477,7 @@ static INPUT_PORTS_START( tempest )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_TILT ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_TILT )
PORT_SERVICE( 0x10, IP_ACTIVE_LOW ) PORT_SERVICE( 0x10, IP_ACTIVE_LOW )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Diagnostic Step") PORT_CODE(KEYCODE_F1) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Diagnostic Step")
/* bit 6 is the VG HALT bit. We set it to "low" */ /* bit 6 is the VG HALT bit. We set it to "low" */
/* per default (busy vector processor). */ /* per default (busy vector processor). */
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER("avg", avg_tempest_device, done_r, nullptr) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER("avg", avg_tempest_device, done_r, nullptr)

File diff suppressed because it is too large Load Diff

View File

@ -6,6 +6,7 @@
#include "emu.h" #include "emu.h"
#include "includes/n64.h" #include "includes/n64.h"
#include "video/poly.h" #include "video/poly.h"
#include "pin64.h"
/*****************************************************************************/ /*****************************************************************************/
@ -128,7 +129,7 @@ class n64_rdp;
#include "video/rdpblend.h" #include "video/rdpblend.h"
#include "video/rdptpipe.h" #include "video/rdptpipe.h"
typedef void (*rdp_command_t)(uint32_t w1, uint32_t w2); typedef void (*rdp_command_t)(uint64_t w1);
class n64_rdp : public poly_manager<uint32_t, rdp_poly_state, 8, 32000> class n64_rdp : public poly_manager<uint32_t, rdp_poly_state, 8, 32000>
{ {
@ -163,7 +164,7 @@ public:
} }
void process_command_list(); void process_command_list();
uint32_t read_data(uint32_t address); uint64_t read_data(uint32_t address);
void disassemble(char* buffer); void disassemble(char* buffer);
void set_machine(running_machine& machine) { m_machine = &machine; } void set_machine(running_machine& machine) { m_machine = &machine; }
@ -224,43 +225,43 @@ public:
bool z_compare(uint32_t zcurpixel, uint32_t dzcurpixel, uint32_t sz, uint16_t dzpix, rdp_span_aux* userdata, const rdp_poly_state &object); bool z_compare(uint32_t zcurpixel, uint32_t dzcurpixel, uint32_t sz, uint16_t dzpix, rdp_span_aux* userdata, const rdp_poly_state &object);
// Commands // Commands
void cmd_invalid(uint32_t w1, uint32_t w2); void cmd_invalid(uint64_t w1);
void cmd_noop(uint32_t w1, uint32_t w2); void cmd_noop(uint64_t w1);
void cmd_triangle(uint32_t w1, uint32_t w2); void cmd_triangle(uint64_t w1);
void cmd_triangle_z(uint32_t w1, uint32_t w2); void cmd_triangle_z(uint64_t w1);
void cmd_triangle_t(uint32_t w1, uint32_t w2); void cmd_triangle_t(uint64_t w1);
void cmd_triangle_tz(uint32_t w1, uint32_t w2); void cmd_triangle_tz(uint64_t w1);
void cmd_triangle_s(uint32_t w1, uint32_t w2); void cmd_triangle_s(uint64_t w1);
void cmd_triangle_sz(uint32_t w1, uint32_t w2); void cmd_triangle_sz(uint64_t w1);
void cmd_triangle_st(uint32_t w1, uint32_t w2); void cmd_triangle_st(uint64_t w1);
void cmd_triangle_stz(uint32_t w1, uint32_t w2); void cmd_triangle_stz(uint64_t w1);
void cmd_tex_rect(uint32_t w1, uint32_t w2); void cmd_tex_rect(uint64_t w1);
void cmd_tex_rect_flip(uint32_t w1, uint32_t w2); void cmd_tex_rect_flip(uint64_t w1);
void cmd_sync_load(uint32_t w1, uint32_t w2); void cmd_sync_load(uint64_t w1);
void cmd_sync_pipe(uint32_t w1, uint32_t w2); void cmd_sync_pipe(uint64_t w1);
void cmd_sync_tile(uint32_t w1, uint32_t w2); void cmd_sync_tile(uint64_t w1);
void cmd_sync_full(uint32_t w1, uint32_t w2); void cmd_sync_full(uint64_t w1);
void cmd_set_key_gb(uint32_t w1, uint32_t w2); void cmd_set_key_gb(uint64_t w1);
void cmd_set_key_r(uint32_t w1, uint32_t w2); void cmd_set_key_r(uint64_t w1);
void cmd_set_fill_color32(uint32_t w1, uint32_t w2); void cmd_set_fill_color32(uint64_t w1);
void cmd_set_convert(uint32_t w1, uint32_t w2); void cmd_set_convert(uint64_t w1);
void cmd_set_scissor(uint32_t w1, uint32_t w2); void cmd_set_scissor(uint64_t w1);
void cmd_set_prim_depth(uint32_t w1, uint32_t w2); void cmd_set_prim_depth(uint64_t w1);
void cmd_set_other_modes(uint32_t w1, uint32_t w2); void cmd_set_other_modes(uint64_t w1);
void cmd_load_tlut(uint32_t w1, uint32_t w2); void cmd_load_tlut(uint64_t w1);
void cmd_set_tile_size(uint32_t w1, uint32_t w2); void cmd_set_tile_size(uint64_t w1);
void cmd_load_block(uint32_t w1, uint32_t w2); void cmd_load_block(uint64_t w1);
void cmd_load_tile(uint32_t w1, uint32_t w2); void cmd_load_tile(uint64_t w1);
void cmd_fill_rect(uint32_t w1, uint32_t w2); void cmd_fill_rect(uint64_t w1);
void cmd_set_tile(uint32_t w1, uint32_t w2); void cmd_set_tile(uint64_t w1);
void cmd_set_fog_color(uint32_t w1, uint32_t w2); void cmd_set_fog_color(uint64_t w1);
void cmd_set_blend_color(uint32_t w1, uint32_t w2); void cmd_set_blend_color(uint64_t w1);
void cmd_set_prim_color(uint32_t w1, uint32_t w2); void cmd_set_prim_color(uint64_t w1);
void cmd_set_env_color(uint32_t w1, uint32_t w2); void cmd_set_env_color(uint64_t w1);
void cmd_set_combine(uint32_t w1, uint32_t w2); void cmd_set_combine(uint64_t w1);
void cmd_set_texture_image(uint32_t w1, uint32_t w2); void cmd_set_texture_image(uint64_t w1);
void cmd_set_mask_image(uint32_t w1, uint32_t w2); void cmd_set_mask_image(uint64_t w1);
void cmd_set_color_image(uint32_t w1, uint32_t w2); void cmd_set_color_image(uint64_t w1);
void rgbaz_clip(int32_t sr, int32_t sg, int32_t sb, int32_t sa, int32_t* sz, rdp_span_aux* userdata); void rgbaz_clip(int32_t sr, int32_t sg, int32_t sb, int32_t sa, int32_t* sz, rdp_span_aux* userdata);
void rgbaz_correct_triangle(int32_t offx, int32_t offy, int32_t* r, int32_t* g, int32_t* b, int32_t* a, int32_t* z, rdp_span_aux* userdata, const rdp_poly_state &object); void rgbaz_correct_triangle(int32_t offx, int32_t offy, int32_t* r, int32_t* g, int32_t* b, int32_t* a, int32_t* z, rdp_span_aux* userdata, const rdp_poly_state &object);
@ -272,6 +273,8 @@ public:
uint16_t decompress_cvmask_frombyte(uint8_t x); uint16_t decompress_cvmask_frombyte(uint8_t x);
void lookup_cvmask_derivatives(uint32_t mask, uint8_t* offx, uint8_t* offy, rdp_span_aux* userdata); void lookup_cvmask_derivatives(uint32_t mask, uint8_t* offx, uint8_t* offy, rdp_span_aux* userdata);
void mark_frame() { m_capture.mark_frame(*m_machine); }
misc_state_t m_misc_state; misc_state_t m_misc_state;
// Color constants // Color constants
@ -344,8 +347,8 @@ private:
uint32_t m_z_complete_dec_table[0x4000]; //the same for decompressed z values, 14b uint32_t m_z_complete_dec_table[0x4000]; //the same for decompressed z values, 14b
uint8_t m_compressed_cvmasks[0x10000]; //16bit cvmask -> to byte uint8_t m_compressed_cvmasks[0x10000]; //16bit cvmask -> to byte
uint32_t m_cmd_data[0x1000]; uint64_t m_cmd_data[0x800];
uint32_t m_temp_rect_data[0x1000]; uint64_t m_temp_rect_data[0x800];
int32_t m_cmd_ptr; int32_t m_cmd_ptr;
int32_t m_cmd_cur; int32_t m_cmd_cur;
@ -367,6 +370,8 @@ private:
int32_t m_norm_point_rom[64]; int32_t m_norm_point_rom[64];
int32_t m_norm_slope_rom[64]; int32_t m_norm_slope_rom[64];
pin64_t m_capture;
static uint32_t s_special_9bit_clamptable[512]; static uint32_t s_special_9bit_clamptable[512];
static const z_decompress_entry_t m_z_dec_table[8]; static const z_decompress_entry_t m_z_dec_table[8];

508
src/mame/video/pin64.cpp Normal file
View File

@ -0,0 +1,508 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
#include "pin64.h"
#define CAP_NAME "pin64_%d.cap"
// pin64_fileutil_t members
void pin64_fileutil_t::write(FILE* file, uint32_t data) {
if (!file)
return;
uint8_t temp(data >> 24);
fwrite(&temp, 1, 1, file);
temp = (uint8_t)(data >> 16);
fwrite(&temp, 1, 1, file);
temp = (uint8_t)(data >> 8);
fwrite(&temp, 1, 1, file);
temp = (uint8_t)data;
fwrite(&temp, 1, 1, file);
}
void pin64_fileutil_t::write(FILE* file, const uint8_t* data, uint32_t size) {
if (!file)
return;
fwrite(data, 1, size, file);
}
// pin64_data_t members
void pin64_data_t::put8(uint8_t data) {
m_data.push_back(data);
m_offset++;
}
void pin64_data_t::put16(uint16_t data) {
put8((uint8_t)(data >> 8));
put8((uint8_t)data);
}
void pin64_data_t::put32(uint32_t data) {
put16((uint16_t)(data >> 16));
put16((uint16_t)data);
}
void pin64_data_t::put64(uint64_t data) {
put32((uint32_t)(data >> 32));
put32((uint32_t)data);
}
uint8_t pin64_data_t::get8() {
if (m_offset >= m_data.size())
fatalerror("PIN64: Call to pin64_data_t::get8() at end of block (requested offset %x, size %x)\n", m_offset, (uint32_t)m_data.size());
uint8_t ret = m_data[m_offset];
m_offset++;
return ret;
}
uint16_t pin64_data_t::get16() {
uint16_t ret = (uint16_t)get8() << 8;
return ret | get8();
}
uint32_t pin64_data_t::get32() {
uint32_t ret = (uint32_t)get16() << 16;
return ret | get16();
}
uint64_t pin64_data_t::get64() {
uint64_t ret = (uint64_t)get32() << 32;
return ret | get32();
}
uint8_t pin64_data_t::get8(uint32_t offset, bool temp_access) {
update_offset(offset, temp_access);
uint8_t ret = get8();
m_offset = m_old_offset;
return ret;
}
uint16_t pin64_data_t::get16(uint32_t offset, bool temp_access) {
update_offset(offset, temp_access);
uint16_t ret = get16();
m_offset = m_old_offset;
return ret;
}
uint32_t pin64_data_t::get32(uint32_t offset, bool temp_access) {
update_offset(offset, temp_access);
uint32_t ret = get32();
m_offset = m_old_offset;
return ret;
}
uint64_t pin64_data_t::get64(uint32_t offset, bool temp_access) {
update_offset(offset, temp_access);
uint32_t ret = get64();
m_offset = m_old_offset;
return ret;
}
void pin64_data_t::reset() {
m_old_offset = 0;
m_offset = 0;
}
void pin64_data_t::clear() {
reset();
m_data.clear();
}
void pin64_data_t::update_offset(uint32_t offset, bool update_current) {
m_old_offset = (update_current ? offset : m_offset);
m_offset = offset;
}
// pin64_printer_t members
void pin64_printer_t::print_data(pin64_block_t* block) {
pin64_data_t* data = block->data();
printf(" CRC32: %08x\n", (uint32_t)block->crc32()); fflush(stdout);
printf(" Data Size: %08x\n", (uint32_t)data->size()); fflush(stdout);
printf(" Data: "); fflush(stdout);
const uint32_t data_size = data->size();
const uint32_t row_count = (data_size + 31) / 32;
const uint8_t* bytes = data->bytes();
for (uint32_t row = 0; row < row_count; row++) {
const uint32_t row_index = row * 32;
const uint32_t data_remaining = data_size - row_index;
const uint32_t col_count = (data_remaining > 32 ? 32 : data_remaining);
for (uint32_t col = 0; col < col_count; col++)
{
printf("%02x ", bytes[row_index + col]); fflush(stdout);
}
if (row == (row_count - 1)) {
printf("\n"); fflush(stdout);
} else {
printf("\n "); fflush(stdout);
}
}
printf("\n"); fflush(stdout);
}
void pin64_printer_t::print_command(int cmd_start, int cmd, std::unordered_map<util::crc32_t, pin64_block_t*>& blocks, std::vector<util::crc32_t>& commands) {
pin64_block_t* block = blocks[commands[cmd]];
pin64_data_t* data = block->data();
printf(" Command %d:\n", cmd - cmd_start); fflush(stdout);
const uint32_t cmd_size(data->get32());
printf(" CRC32: %08x\n", (uint32_t)commands[cmd]); fflush(stdout);
printf(" Packet Data Size: %d words\n", cmd_size); fflush(stdout);
printf(" Packet Data: "); fflush(stdout);
bool load_command = false;
for (int i = 0; i < cmd_size; i++) {
const uint64_t cmd_entry(data->get64());
if (i == 0) {
const uint8_t top_byte = uint8_t(cmd_entry >> 56) & 0x3f;
if (top_byte == 0x30 || top_byte == 0x33 || top_byte == 0x34)
load_command = true;
}
printf("%08x%08x\n", uint32_t(cmd_entry >> 32), (uint32_t)cmd_entry); fflush(stdout);
if (i < (cmd_size - 1))
printf(" "); fflush(stdout);
}
printf(" Data Block Present: %s\n", load_command ? "Yes" : "No"); fflush(stdout);
if (load_command) {
printf(" Data Block CRC32: %08x\n", data->get32()); fflush(stdout);
}
data->reset();
};
// pin64_block_t members
void pin64_block_t::finalize() {
if (m_data.size() > 0)
m_crc32 = util::crc32_creator::simple(m_data.bytes(), m_data.size());
else
m_crc32 = ~0;
m_data.reset();
}
void pin64_block_t::clear() {
m_crc32 = 0;
m_data.clear();
}
void pin64_block_t::write(FILE* file) {
pin64_fileutil_t::write(file, m_crc32);
pin64_fileutil_t::write(file, m_data.size());
if (m_data.size() > 0)
pin64_fileutil_t::write(file, m_data.bytes(), m_data.size());
}
uint32_t pin64_block_t::size() {
return sizeof(uint32_t) // data CRC32
+ sizeof(uint32_t) // data size
+ m_data.size(); // data
}
// pin64_t members
const uint8_t pin64_t::CAP_ID[8] = { 'P', 'I', 'N', '6', '4', 'C', 'A', 'P' };
pin64_t::~pin64_t() {
if (m_capture_file)
finish();
clear();
}
void pin64_t::start(int frames)
{
if (m_capture_index == ~0)
init_capture_index();
if (m_capture_file)
fatalerror("PIN64: Call to start() while already capturing\n");
char name_buf[256];
sprintf(name_buf, CAP_NAME, m_capture_index);
m_capture_index++;
m_capture_file = fopen(name_buf, "wb");
m_capture_frames = frames;
m_frames.push_back(0);
}
void pin64_t::finish() {
if (!m_capture_file)
return;
finalize();
print();
write(m_capture_file);
fclose(m_capture_file);
m_capture_file = nullptr;
clear();
}
void pin64_t::finalize() {
finish_command();
data_end();
}
void pin64_t::play(int index) {
}
void pin64_t::mark_frame(running_machine& machine) {
if (m_capture_file) {
if (m_frames.size() == m_capture_frames && m_capture_frames > 0) {
printf("\n");
finish();
machine.popmessage("Done recording.");
} else {
printf("%d ", (uint32_t)m_commands.size());
m_frames.push_back((uint32_t)m_commands.size());
}
}
#if PIN64_ENABLE_CAPTURE
if (machine.input().code_pressed_once(KEYCODE_N) && !m_capture_file) {
start(1);
machine.popmessage("Capturing PIN64 snapshot to pin64_%d.cap", m_capture_index - 1);
} else if (machine.input().code_pressed_once(KEYCODE_M)) {
if (m_capture_file) {
finish();
machine.popmessage("Done recording.");
} else {
start();
machine.popmessage("Recording PIN64 movie to pin64_%d.cap", m_capture_index - 1);
}
}
#endif
}
void pin64_t::command(uint64_t* cmd_data, uint32_t size) {
if (!capturing())
return;
finish_command();
m_current_command = new pin64_block_t();
m_current_command->data()->put32(size);
for (uint32_t i = 0 ; i < size; i++)
m_current_command->data()->put64(cmd_data[i]);
}
void pin64_t::finish_command() {
if (!m_current_command)
return;
m_current_command->finalize();
if (m_blocks.find(m_current_command->crc32()) == m_blocks.end())
m_blocks[m_current_command->crc32()] = m_current_command;
m_commands.push_back(m_current_command->crc32());
}
void pin64_t::data_begin() {
if (!capturing())
return;
if (m_current_data)
data_end();
m_current_data = new pin64_block_t();
}
pin64_data_t* pin64_t::data_block() {
if (!capturing() || !m_current_data)
return &m_dummy_data;
return m_current_data->data();
}
void pin64_t::data_end() {
if (!capturing() || !m_current_data)
return;
m_current_data->finalize();
m_current_command->data()->put32(m_current_data->crc32());
finish_command();
if (m_blocks.find(m_current_data->crc32()) == m_blocks.end())
m_blocks[m_current_data->crc32()] = m_current_data;
m_current_data = nullptr;
}
size_t pin64_t::size() {
return header_size() + block_directory_size() + cmdlist_directory_size() + cmdlist_size();
}
size_t pin64_t::header_size() {
return sizeof(uint8_t) * 8 // "PIN64CAP"
+ sizeof(uint32_t) // total file size
+ sizeof(uint32_t) // start of block directory data
+ sizeof(uint32_t) // start of command-list directory data
+ sizeof(uint32_t) // start of blocks
+ sizeof(uint32_t); // start of commands
}
size_t pin64_t::block_directory_size() {
return (m_blocks.size() + 1) * sizeof(uint32_t);
}
size_t pin64_t::cmdlist_directory_size() {
return (m_frames.size() + 1) * sizeof(uint16_t);
}
size_t pin64_t::blocks_size() {
size_t block_size = 0;
for (std::pair<util::crc32_t, pin64_block_t*> block_pair : m_blocks)
block_size += (block_pair.second)->size();
return block_size;
}
size_t pin64_t::cmdlist_size() {
return (m_commands.size() + 1) * sizeof(uint32_t);
}
void pin64_t::print()
{
printf("Total Size: %9x bytes\n", (uint32_t)size()); fflush(stdout);
printf("Header Size: %9x bytes\n", (uint32_t)header_size()); fflush(stdout);
printf("Block Dir Size: %9x bytes\n", (uint32_t)block_directory_size()); fflush(stdout);
printf("Cmdlist Dir Size: %9x bytes\n", (uint32_t)cmdlist_directory_size()); fflush(stdout);
printf("Blocks Size: %9x bytes\n", (uint32_t)blocks_size()); fflush(stdout);
printf("Cmdlist Size: %9x bytes\n", (uint32_t)cmdlist_size()); fflush(stdout);
printf("Command-List Count: %d\n", (uint32_t)m_frames.size()); fflush(stdout);
for (int i = 0; i < m_frames.size(); i++) {
printf(" List %d:\n", i); fflush(stdout);
const int next_start = ((i == (m_frames.size() - 1)) ? m_commands.size() : m_frames[i+1]);
for (int cmd = m_frames[i]; cmd < next_start; cmd++) {
pin64_printer_t::print_command(m_frames[i], cmd, m_blocks, m_commands);
}
if (i == (m_frames.size() - 1))
{
printf("\n"); fflush(stdout);
}
}
printf("\nData Block Count: %d\n", (uint32_t)m_blocks.size()); fflush(stdout);
int i = 0;
for (std::pair<util::crc32_t, pin64_block_t*> block_pair : m_blocks) {
printf(" Block %d:\n", i); fflush(stdout);
pin64_printer_t::print_data((block_pair.second));
if (i == (m_blocks.size() - 1))
{
printf("\n"); fflush(stdout);
}
i++;
}
}
void pin64_t::write(FILE* file) {
const uint32_t size_total = size();
const uint32_t size_header = header_size();
const uint32_t size_block_dir = block_directory_size();
const uint32_t size_cmdlist_dir = cmdlist_directory_size();
const uint32_t size_blocks_dir = blocks_size();
pin64_fileutil_t::write(file, CAP_ID, 8);
pin64_fileutil_t::write(file, size_total);
pin64_fileutil_t::write(file, size_header);
pin64_fileutil_t::write(file, size_header + size_block_dir);
pin64_fileutil_t::write(file, size_header + size_block_dir + size_cmdlist_dir);
pin64_fileutil_t::write(file, size_header + size_block_dir + size_cmdlist_dir + size_blocks_dir);
write_data_directory(file);
write_cmdlist_directory(file);
for (std::pair<util::crc32_t, pin64_block_t*> block_pair : m_blocks)
(block_pair.second)->write(file);
pin64_fileutil_t::write(file, m_commands.size());
for (util::crc32_t crc : m_commands)
pin64_fileutil_t::write(file, crc);
}
void pin64_t::write_data_directory(FILE* file) {
pin64_fileutil_t::write(file, m_blocks.size());
size_t offset(header_size());
for (std::pair<util::crc32_t, pin64_block_t*> block_pair : m_blocks) {
pin64_fileutil_t::write(file, offset);
offset += (block_pair.second)->size();
}
}
void pin64_t::write_cmdlist_directory(FILE* file) {
pin64_fileutil_t::write(file, m_frames.size());
for (uint32_t frame : m_frames)
pin64_fileutil_t::write(file, frame);
}
void pin64_t::clear() {
if (m_capture_file != nullptr) {
fclose(m_capture_file);
m_capture_file = nullptr;
}
for (std::pair<util::crc32_t, pin64_block_t*> block_pair : m_blocks)
delete block_pair.second;
m_blocks.clear();
m_commands.clear();
m_frames.clear();
m_current_data = nullptr;
m_current_command = nullptr;
}
void pin64_t::init_capture_index()
{
char name_buf[256];
bool found = true;
m_capture_index = 0;
do {
sprintf(name_buf, CAP_NAME, m_capture_index);
FILE* temp = fopen(name_buf, "rb");
if (temp == nullptr) {
break;
} else {
fclose(temp);
m_capture_index++;
}
} while(found);
}

180
src/mame/video/pin64.h Normal file
View File

@ -0,0 +1,180 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
#pragma once
#ifndef PIN64_H
#define PIN64_H
#include <cstdio>
#include <vector>
#include <map>
#define PIN64_ENABLE_CAPTURE (0)
#include "emu.h"
class pin64_fileutil_t {
public:
static void write(FILE* file, uint32_t data);
static void write(FILE* file, const uint8_t* data, uint32_t size);
};
class pin64_command_t {
public:
std::vector<uint8_t> data;
};
class pin64_data_t {
public:
pin64_data_t()
: m_offset(0)
, m_old_offset(0) { }
void reset();
void clear();
// setters
virtual void put8(uint8_t data);
virtual void put16(uint16_t data);
virtual void put32(uint32_t data);
virtual void put64(uint64_t data);
// getters
virtual uint8_t get8();
virtual uint8_t get8(uint32_t offset, bool temp_access = false);
virtual uint16_t get16();
virtual uint16_t get16(uint32_t offset, bool temp_access = false);
virtual uint32_t get32();
virtual uint32_t get32(uint32_t offset, bool temp_access = false);
virtual uint64_t get64();
virtual uint64_t get64(uint32_t offset, bool temp_access = false);
virtual uint32_t offset() { return m_offset; }
uint8_t* bytes() { return (m_data.size() > 0) ? &m_data[0] : nullptr; }
uint32_t size() { return m_data.size(); }
private:
void update_offset(uint32_t offset, bool temp_access = false);
protected:
std::vector<uint8_t> m_data;
uint32_t m_offset;
uint32_t m_old_offset;
};
class pin64_dummy_data_t : public pin64_data_t {
public:
void put8(uint8_t data) override { }
void put16(uint16_t data) override { }
void put32(uint32_t data) override { }
void put64(uint64_t data) override { }
uint8_t get8() override { return 0; }
uint8_t get8(uint32_t offset, bool update_current = true) override { return 0; }
uint16_t get16() override { return 0; }
uint16_t get16(uint32_t offset, bool update_current = true) override { return 0; }
uint32_t get32() override { return 0; }
uint32_t get32(uint32_t offset, bool update_current = true) override { return 0; }
uint64_t get64() override { return 0; }
uint64_t get64(uint32_t offset, bool update_current = true) override { return 0; }
uint32_t offset() override { return 0; }
};
class pin64_block_t {
public:
pin64_block_t()
: m_crc32{0} { }
virtual ~pin64_block_t() { }
void finalize();
void clear();
void write(FILE* file);
// getters
uint32_t size();
pin64_data_t* data() { return &m_data; }
util::crc32_t crc32() const { return m_crc32; }
protected:
util::crc32_t m_crc32;
pin64_data_t m_data;
};
class pin64_printer_t {
public:
static void print_data(pin64_block_t* block);
static void print_command(int cmd_start, int cmd, std::unordered_map<util::crc32_t, pin64_block_t*>& blocks, std::vector<util::crc32_t>& commands);
};
class pin64_t
{
public:
pin64_t()
: m_capture_file(nullptr)
, m_capture_index(~0)
, m_capture_frames(0)
, m_current_data(nullptr)
, m_current_command(nullptr)
, m_playing(false)
{ }
~pin64_t();
void start(int frames = 0);
void finish();
void clear();
void print();
void mark_frame(running_machine& machine);
void play(int index);
void command(uint64_t* cmd_data, uint32_t size);
void data_begin();
pin64_data_t* data_block();
pin64_block_t& block() { return *m_current_data; }
void data_end();
bool capturing() const { return m_capture_file != nullptr; }
bool playing() const { return m_playing; }
size_t size();
private:
void start_command_block();
void write(FILE* file);
size_t header_size();
size_t block_directory_size();
size_t cmdlist_directory_size();
size_t blocks_size();
size_t cmdlist_size();
void finish_command();
void write_data_directory(FILE* file);
void write_cmdlist_directory(FILE* file);
void init_capture_index();
void finalize();
FILE *m_capture_file;
int32_t m_capture_index;
int m_capture_frames;
pin64_block_t* m_current_data;
pin64_block_t* m_current_command;
std::unordered_map<util::crc32_t, pin64_block_t*> m_blocks;
std::vector<util::crc32_t> m_commands;
std::vector<uint32_t> m_frames;
bool m_playing;
pin64_dummy_data_t m_dummy_data;
static const uint8_t CAP_ID[8];
};
#endif // PIN64_H