summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/machine
diff options
context:
space:
mode:
authorGravatarGravatar MetalliC <0vetal0@gmail.com>2016-08-01 22:19:06 +0300
committerGravatarGravatar MetalliC <0vetal0@gmail.com>2016-08-01 22:19:06 +0300
commite50cabe1ffae8cda9be5e9328f97514c5f06d79b (patch)
treeced6fe932ed81503c0d0db3d4ddbbb334c46b667 /src/mame/machine
parent203e6dc8293414dc1839eec7a48d875f6fc902a3 (diff)
naomi: get rid of hacky rom_region, use rom_parameter instead
Diffstat (limited to 'src/mame/machine')
-rw-r--r--src/mame/machine/naomi.cpp35
-rw-r--r--src/mame/machine/naomibd.cpp4
-rw-r--r--src/mame/machine/naomibd.h7
-rw-r--r--src/mame/machine/naomigd.h2
-rw-r--r--src/mame/machine/naomim1.cpp17
-rw-r--r--src/mame/machine/naomim1.h5
-rw-r--r--src/mame/machine/naomim2.h4
-rw-r--r--src/mame/machine/naomim4.cpp27
-rw-r--r--src/mame/machine/naomim4.h5
-rw-r--r--src/mame/machine/naomirom.h4
10 files changed, 36 insertions, 74 deletions
diff --git a/src/mame/machine/naomi.cpp b/src/mame/machine/naomi.cpp
index d54da60cbfb..b91c3889839 100644
--- a/src/mame/machine/naomi.cpp
+++ b/src/mame/machine/naomi.cpp
@@ -205,7 +205,6 @@ DRIVER_INIT_MEMBER(naomi_state,naomi)
{
//m_maincpu->space(AS_PROGRAM).install_read_handler(0xc2ad238, 0xc2ad23f, read64_delegate(FUNC(naomi_state::naomi_biose_idle_skip_r),this); // rev e bios
m_maincpu->space(AS_PROGRAM).install_read_handler(0xc2b0600, 0xc2b0607, read64_delegate(FUNC(naomi_state::naomi_biosh_idle_skip_r),this)); // rev h bios
- actel_id = 0xffff;
create_pic_from_retdat();
}
@@ -213,7 +212,6 @@ DRIVER_INIT_MEMBER(naomi_state,naomi)
DRIVER_INIT_MEMBER(naomi_state,naomi2)
{
m_maincpu->space(AS_PROGRAM).install_read_handler(0xc2b0600, 0xc2b0607, read64_delegate(FUNC(naomi_state::naomi2_biose_idle_skip_r),this)); // rev e bios
- actel_id = 0xffff;
create_pic_from_retdat();
}
@@ -240,7 +238,6 @@ DRIVER_INIT_MEMBER(naomi_state,naomi_mp)
{
//m_maincpu->space(AS_PROGRAM).install_read_handler(0xc2ad238, 0xc2ad23f, read64_delegate(FUNC(naomi_state::naomi_biose_idle_skip_r),this); // rev e bios
m_maincpu->space(AS_PROGRAM).install_read_handler(0xc2b0600, 0xc2b0607, read64_delegate(FUNC(naomi_state::naomi_biosh_idle_skip_r),this)); // rev h bios
- actel_id = 0xffff;
m_mp_mux = 0;
create_pic_from_retdat();
@@ -250,7 +247,6 @@ DRIVER_INIT_MEMBER(naomi_state,naomigd)
{
m_maincpu->space(AS_PROGRAM).install_read_handler(0xc2ad238, 0xc2ad23f, read64_delegate(FUNC(naomi_state::naomi_biose_idle_skip_r),this)); // rev e bios
//m_maincpu->space(AS_PROGRAM).install_read_handler(0xc2b0600, 0xc2b0607, read64_delegate(FUNC(naomi_state::naomi_biosh_idle_skip_r),this)); // rev h bios
- actel_id = 0xffff;
create_pic_from_retdat();
}
@@ -259,7 +255,6 @@ DRIVER_INIT_MEMBER(naomi_state,naomigd_mp)
{
m_maincpu->space(AS_PROGRAM).install_read_handler(0xc2ad238, 0xc2ad23f, read64_delegate(FUNC(naomi_state::naomi_biose_idle_skip_r),this)); // rev e bios
//m_maincpu->space(AS_PROGRAM).install_read_handler(0xc2b0600, 0xc2b0607, read64_delegate(FUNC(naomi_state::naomi_biosh_idle_skip_r),this)); // rev h bios
- actel_id = 0xffff;
m_mp_mux = 0;
create_pic_from_retdat();
@@ -327,36 +322,6 @@ DRIVER_INIT_MEMBER(naomi_state,sfz3ugd)
}
-DRIVER_INIT_MEMBER(naomi_state,qmegamis)
-{
- DRIVER_INIT_CALL(naomi);
- actel_id = 0; //FIXME: correct value
-}
-
-DRIVER_INIT_MEMBER(naomi_state,mvsc2)
-{
- DRIVER_INIT_CALL(naomi);
- actel_id = 0; //FIXME: correct value
-}
-
-DRIVER_INIT_MEMBER(naomi_state,gram2000)
-{
- DRIVER_INIT_CALL(naomi);
- actel_id = 0; //FIXME: correct value
-}
-
-DRIVER_INIT_MEMBER(naomi_state,vf4evoct)
-{
- DRIVER_INIT_CALL(naomi2);
- actel_id = 0; //FIXME: correct value
-}
-
-DRIVER_INIT_MEMBER(naomi_state,kick4csh)
-{
- DRIVER_INIT_CALL(naomi);
- actel_id = 0; //FIXME: correct value
-}
-
READ64_MEMBER(naomi_state::hotd2_idle_skip_r )
{
// if (space.device().safe_pc()==0xc0cfcbc)
diff --git a/src/mame/machine/naomibd.cpp b/src/mame/machine/naomibd.cpp
index f90c3d35077..d3bba812c7e 100644
--- a/src/mame/machine/naomibd.cpp
+++ b/src/mame/machine/naomibd.cpp
@@ -68,14 +68,12 @@ naomi_board::naomi_board(const machine_config &mconfig, device_type type, const
: naomi_g1_device(mconfig, type, name, tag, owner, clock, shortname, source)
{
eeprom_tag = nullptr;
- rombdid_tag = nullptr;
}
-void naomi_board::static_set_eeprom_tag(device_t &device, const char *_eeprom_tag, const char *_actel_tag)
+void naomi_board::static_set_eeprom_tag(device_t &device, const char *_eeprom_tag)
{
naomi_board &dev = downcast<naomi_board &>(device);
dev.eeprom_tag = _eeprom_tag;
- dev.rombdid_tag = _actel_tag;
}
diff --git a/src/mame/machine/naomibd.h b/src/mame/machine/naomibd.h
index 8f0c07d3c09..a965833d3c2 100644
--- a/src/mame/machine/naomibd.h
+++ b/src/mame/machine/naomibd.h
@@ -6,16 +6,16 @@
#include "machine/naomig1.h"
#include "machine/x76f100.h"
-#define MCFG_NAOMI_BOARD_ADD(_tag, type, _eeprom_tag, _actel_tag, _irq_cb) \
+#define MCFG_NAOMI_BOARD_ADD(_tag, type, _eeprom_tag, _irq_cb) \
MCFG_NAOMI_G1_ADD(_tag, type, _irq_cb) \
- naomi_board::static_set_eeprom_tag(*device, _eeprom_tag, _actel_tag);
+ naomi_board::static_set_eeprom_tag(*device, _eeprom_tag);
class naomi_board : public naomi_g1_device
{
public:
naomi_board(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
- static void static_set_eeprom_tag(device_t &device, const char *_eeprom_tag, const char *_actel_tag);
+ static void static_set_eeprom_tag(device_t &device, const char *_eeprom_tag);
// Can be patched in the underlying class
virtual DECLARE_ADDRESS_MAP(submap, 16);
@@ -49,7 +49,6 @@ protected:
virtual void board_write(offs_t offset, UINT16 data);
UINT32 rom_offset;
- const char *rombdid_tag;
private:
UINT32 dma_offset, dma_cur_offset;
UINT16 dma_count;
diff --git a/src/mame/machine/naomigd.h b/src/mame/machine/naomigd.h
index 4a291bbb119..3590beb827c 100644
--- a/src/mame/machine/naomigd.h
+++ b/src/mame/machine/naomigd.h
@@ -6,7 +6,7 @@
#include "machine/naomibd.h"
#define MCFG_NAOMI_GDROM_BOARD_ADD(_tag, _image_tag, _pic_tag, _eeprom_tag, _irq_cb) \
- MCFG_NAOMI_BOARD_ADD(_tag, NAOMI_GDROM_BOARD, _eeprom_tag, nullptr, _irq_cb) \
+ MCFG_NAOMI_BOARD_ADD(_tag, NAOMI_GDROM_BOARD, _eeprom_tag, _irq_cb) \
naomi_gdrom_board::static_set_tags(*device, _image_tag, _pic_tag);
class naomi_gdrom_board : public naomi_board
diff --git a/src/mame/machine/naomim1.cpp b/src/mame/machine/naomim1.cpp
index a456bc8cdb8..68282faf8d9 100644
--- a/src/mame/machine/naomim1.cpp
+++ b/src/mame/machine/naomim1.cpp
@@ -20,13 +20,7 @@ naomi_m1_board::naomi_m1_board(const machine_config &mconfig, const char *tag, d
READ16_MEMBER(naomi_m1_board::actel_id_r)
{
- if (rombdid_tag && owner()->memregion(rombdid_tag) != nullptr)
- {
- const UINT8 *bdid = owner()->memregion(rombdid_tag)->base();
- return bdid[0] | (bdid[1] << 8);
- }
-
- return 0x0000;
+ return actel_id;
}
void naomi_m1_board::device_start()
@@ -42,6 +36,15 @@ void naomi_m1_board::device_start()
key = 0;
}
+ std::string sid = parameter("id");
+ if (!sid.empty())
+ actel_id = strtoll(sid.c_str(), nullptr, 16);
+ else
+ {
+ logerror("%s: Warning: Actel ID not provided\n", tag());
+ actel_id = 0;
+ }
+
buffer = std::make_unique<UINT8[]>(BUFFER_SIZE);
save_pointer(NAME(buffer.get()), BUFFER_SIZE);
diff --git a/src/mame/machine/naomim1.h b/src/mame/machine/naomim1.h
index 0e1730eee80..126648e378c 100644
--- a/src/mame/machine/naomim1.h
+++ b/src/mame/machine/naomim1.h
@@ -5,8 +5,8 @@
#include "naomibd.h"
-#define MCFG_NAOMI_M1_BOARD_ADD(_tag, _eeprom_tag, _actel_tag, _irq_cb) \
- MCFG_NAOMI_BOARD_ADD(_tag, NAOMI_M1_BOARD, _eeprom_tag, _actel_tag, _irq_cb)
+#define MCFG_NAOMI_M1_BOARD_ADD(_tag, _eeprom_tag, _irq_cb) \
+ MCFG_NAOMI_BOARD_ADD(_tag, NAOMI_M1_BOARD, _eeprom_tag, _irq_cb)
class naomi_m1_board : public naomi_board
{
@@ -28,6 +28,7 @@ protected:
private:
enum { BUFFER_SIZE = 32768 };
UINT32 key;
+ UINT16 actel_id;
std::unique_ptr<UINT8[]> buffer;
UINT8 dict[111], hist[2];
diff --git a/src/mame/machine/naomim2.h b/src/mame/machine/naomim2.h
index 8196e7e4ba7..21ca305be6e 100644
--- a/src/mame/machine/naomim2.h
+++ b/src/mame/machine/naomim2.h
@@ -7,8 +7,8 @@
#include "315-5881_crypt.h"
-#define MCFG_NAOMI_M2_BOARD_ADD(_tag, _eeprom_tag, _actel_tag, _irq_cb) \
- MCFG_NAOMI_BOARD_ADD(_tag, NAOMI_M2_BOARD, _eeprom_tag, _actel_tag, _irq_cb)
+#define MCFG_NAOMI_M2_BOARD_ADD(_tag, _eeprom_tag, _irq_cb) \
+ MCFG_NAOMI_BOARD_ADD(_tag, NAOMI_M2_BOARD, _eeprom_tag, _irq_cb)
class naomi_m2_board : public naomi_board
{
diff --git a/src/mame/machine/naomim4.cpp b/src/mame/machine/naomim4.cpp
index 89d61ce08c3..6f51a964576 100644
--- a/src/mame/machine/naomim4.cpp
+++ b/src/mame/machine/naomim4.cpp
@@ -63,6 +63,15 @@ void naomi_m4_board::device_start()
{
naomi_board::device_start();
+ std::string sid = parameter("id");
+ if (!sid.empty())
+ m4id = strtoll(sid.c_str(), nullptr, 16);
+ else
+ {
+ logerror("%s: Warning: M4 ID not provided\n", tag());
+ m4id = 0x5504;
+ }
+
subkey1 = (m_key_data[0x5e2] << 8) | m_key_data[0x5e0];
subkey2 = (m_key_data[0x5e6] << 8) | m_key_data[0x5e4];
@@ -132,13 +141,7 @@ void naomi_m4_board::board_get_buffer(UINT8 *&base, UINT32 &limit)
static UINT8 retzero[2] = { 0, 0 };
if (cfi_mode) {
- int fpr_num = 0;
-
- if (rombdid_tag && owner()->memregion(rombdid_tag) != nullptr)
- {
- fpr_num = *owner()->memregion(rombdid_tag)->base() & 0x7f;
-
- }
+ int fpr_num = m4id & 0x7f;
if (((rom_cur_address >> 26) & 0x07) < fpr_num) {
base = &cfidata[rom_cur_address & 0xffff];
@@ -215,15 +218,7 @@ void naomi_m4_board::enc_fill()
READ16_MEMBER(naomi_m4_board::m4_id_r)
{
- UINT16 epr_flag = 0;
-
- if (rombdid_tag != nullptr && owner()->memregion(rombdid_tag) != nullptr)
- {
- epr_flag = *owner()->memregion(rombdid_tag)->base() & 0x80;
-
- }
-
- return 0x5500 | epr_flag;
+ return m4id & 0xff80;
}
void naomi_m4_board::board_write(offs_t offset, UINT16 data)
diff --git a/src/mame/machine/naomim4.h b/src/mame/machine/naomim4.h
index 461fa1779a5..0d340b3cab5 100644
--- a/src/mame/machine/naomim4.h
+++ b/src/mame/machine/naomim4.h
@@ -5,8 +5,8 @@
#include "naomibd.h"
-#define MCFG_NAOMI_M4_BOARD_ADD(_tag, _key_tag, _eeprom_tag, _actel_tag, _irq_cb) \
- MCFG_NAOMI_BOARD_ADD(_tag, NAOMI_M4_BOARD, _eeprom_tag, _actel_tag, _irq_cb) \
+#define MCFG_NAOMI_M4_BOARD_ADD(_tag, _key_tag, _eeprom_tag, _irq_cb) \
+ MCFG_NAOMI_BOARD_ADD(_tag, NAOMI_M4_BOARD, _eeprom_tag, _irq_cb) \
naomi_m4_board::static_set_tags(*device, "^" _key_tag);
class naomi_m4_board : public naomi_board
@@ -33,6 +33,7 @@ private:
static const UINT8 k_sboxes[4][16];
+ UINT16 m4id;
required_memory_region m_region;
required_region_ptr<UINT8> m_key_data;
UINT16 subkey1, subkey2;
diff --git a/src/mame/machine/naomirom.h b/src/mame/machine/naomirom.h
index 11f692200db..f1303dcdd82 100644
--- a/src/mame/machine/naomirom.h
+++ b/src/mame/machine/naomirom.h
@@ -5,8 +5,8 @@
#include "naomibd.h"
-#define MCFG_NAOMI_ROM_BOARD_ADD(_tag, _eeprom_tag, _actel_tag, _irq_cb) \
- MCFG_NAOMI_BOARD_ADD(_tag, NAOMI_ROM_BOARD, _eeprom_tag, _actel_tag, _irq_cb)
+#define MCFG_NAOMI_ROM_BOARD_ADD(_tag, _eeprom_tag, _irq_cb) \
+ MCFG_NAOMI_BOARD_ADD(_tag, NAOMI_ROM_BOARD, _eeprom_tag, _irq_cb)
class naomi_rom_board : public naomi_board
{