summaryrefslogtreecommitdiffstatshomepage
path: root/src/mess/machine
diff options
context:
space:
mode:
author Fabio Priuli <etabeta78@users.noreply.github.com>2013-02-07 19:21:05 +0000
committer Fabio Priuli <etabeta78@users.noreply.github.com>2013-02-07 19:21:05 +0000
commit6812fc3a83742d33019685337f4482fd25221ec4 (patch)
treef732915e87a25705f7ae0aaecfeda65abfea1c95 /src/mess/machine
parente98ac172b5c42ecad279fc0ac7190915cb243b7c (diff)
(MESS) megadriv.c: more updates [Fabio Priuli]
- implemented correct ROM mirroring, based on research by Eke & others - emulated the protection in Ya Se Chuan Shuo, promoting it to work state - fixed cart type in Blockbuster World Video Game Championship II (works for the first time in MESS) - fixed cart type in HardBall III, Barver Battle Saga and Chao Ji Da Fu Weng - added support for unusual SRAM location in HardBall 95 - fixed a few regressions introduced in the previous commit - fixed wrong driver class being used in 32x and SegaCD
Diffstat (limited to 'src/mess/machine')
-rw-r--r--src/mess/machine/md_eeprom.c49
-rw-r--r--src/mess/machine/md_jcart.c10
-rw-r--r--src/mess/machine/md_rom.c88
-rw-r--r--src/mess/machine/md_rom.h37
-rw-r--r--src/mess/machine/md_sk.c5
-rw-r--r--src/mess/machine/md_slot.c118
-rw-r--r--src/mess/machine/md_slot.h7
7 files changed, 214 insertions, 100 deletions
diff --git a/src/mess/machine/md_eeprom.c b/src/mess/machine/md_eeprom.c
index 3f8a5c7b1f4..f1f72500143 100644
--- a/src/mess/machine/md_eeprom.c
+++ b/src/mess/machine/md_eeprom.c
@@ -213,10 +213,13 @@ READ16_MEMBER(md_std_eeprom_device::read)
{
if (offset == 0x200000/2)
{
- m_i2c_mem = i2cmem_sda_read(m_i2cmem);
+// m_i2c_mem = i2cmem_sda_read(m_i2cmem);
return ~m_i2c_mem & 1;
}
- return m_rom[offset];
+ if (offset < 0x400000/2)
+ return m_rom[MD_ADDR(offset)];
+ else
+ return 0xffff;
}
WRITE16_MEMBER(md_std_eeprom_device::write)
@@ -234,10 +237,13 @@ READ16_MEMBER(md_eeprom_nbajam_device::read)
{
if (offset == 0x200000/2)
{
- m_i2c_mem = i2cmem_sda_read(m_i2cmem);
+// m_i2c_mem = i2cmem_sda_read(m_i2cmem);
return m_i2c_mem & 1;
}
- return m_rom[offset];
+ if (offset < 0x400000/2)
+ return m_rom[MD_ADDR(offset)];
+ else
+ return 0xffff;
}
WRITE16_MEMBER(md_eeprom_nbajam_device::write)
@@ -255,10 +261,13 @@ READ16_MEMBER(md_eeprom_nbajamte_device::read)
{
if (offset == 0x200000/2)
{
- m_i2c_mem = i2cmem_sda_read(m_i2cmem);
+// m_i2c_mem = i2cmem_sda_read(m_i2cmem);
return m_i2c_mem & 1;
}
- return m_rom[offset];
+ if (offset < 0x400000/2)
+ return m_rom[MD_ADDR(offset)];
+ else
+ return 0xffff;
}
WRITE16_MEMBER(md_eeprom_nbajamte_device::write)
@@ -277,10 +286,13 @@ READ16_MEMBER(md_eeprom_cslam_device::read)
{
if (offset == 0x200000/2)
{
- m_i2c_mem = i2cmem_sda_read(m_i2cmem);
+// m_i2c_mem = i2cmem_sda_read(m_i2cmem);
return m_i2c_mem & 1;
}
- return m_rom[offset];
+ if (offset < 0x400000/2)
+ return m_rom[MD_ADDR(offset)];
+ else
+ return 0xffff;
}
WRITE16_MEMBER(md_eeprom_cslam_device::write)
@@ -299,10 +311,13 @@ READ16_MEMBER(md_eeprom_nflqb_device::read)
{
if (offset == 0x200000/2)
{
- m_i2c_mem = i2cmem_sda_read(m_i2cmem);
+// m_i2c_mem = i2cmem_sda_read(m_i2cmem);
return m_i2c_mem & 1;
}
- return m_rom[offset];
+ if (offset < 0x400000/2)
+ return m_rom[MD_ADDR(offset)];
+ else
+ return 0xffff;
}
WRITE16_MEMBER(md_eeprom_nflqb_device::write)
@@ -320,10 +335,13 @@ READ16_MEMBER(md_eeprom_nhlpa_device::read)
{
if (offset == 0x200000/2)
{
- m_i2c_mem = i2cmem_sda_read(m_i2cmem);
+// m_i2c_mem = i2cmem_sda_read(m_i2cmem);
return (m_i2c_mem & 1) << 7;
}
- return m_rom[offset];
+ if (offset < 0x400000/2)
+ return m_rom[MD_ADDR(offset)];
+ else
+ return 0xffff;
}
WRITE16_MEMBER(md_eeprom_nhlpa_device::write)
@@ -341,10 +359,13 @@ READ16_MEMBER(md_eeprom_blara_device::read)
{
if (offset == 0x380000/2)
{
- m_i2c_mem = i2cmem_sda_read(m_i2cmem);
+// m_i2c_mem = i2cmem_sda_read(m_i2cmem);
return (m_i2c_mem & 1) << 7;
}
- return m_rom[offset];
+ if (offset < 0x400000/2)
+ return m_rom[MD_ADDR(offset)];
+ else
+ return 0xffff;
}
WRITE16_MEMBER(md_eeprom_blara_device::write)
diff --git a/src/mess/machine/md_jcart.c b/src/mess/machine/md_jcart.c
index 606563e5f6a..5aadc882a25 100644
--- a/src/mess/machine/md_jcart.c
+++ b/src/mess/machine/md_jcart.c
@@ -188,7 +188,10 @@ READ16_MEMBER(md_jcart_device::read)
return (m_jcart_io_data[0] & 0x40) | joy[0] | (joy[1] << 8);
}
}
- return m_rom[offset];
+ if (offset < 0x400000/2)
+ return m_rom[MD_ADDR(offset)];
+ else
+ return 0xffff;
}
WRITE16_MEMBER(md_jcart_device::write)
@@ -228,7 +231,10 @@ READ16_MEMBER(md_seprom_codemast_device::read)
return (m_jcart_io_data[0] & 0x40) | joy[0] | (joy[1] << 8);
}
}
- return m_rom[offset];
+ if (offset < 0x400000/2)
+ return m_rom[MD_ADDR(offset)];
+ else
+ return 0xffff;
}
WRITE16_MEMBER(md_seprom_codemast_device::write)
diff --git a/src/mess/machine/md_rom.c b/src/mess/machine/md_rom.c
index 8f8fd3246cc..a6755a9aa80 100644
--- a/src/mess/machine/md_rom.c
+++ b/src/mess/machine/md_rom.c
@@ -37,6 +37,7 @@ const device_type MD_ROM_KOF99 = &device_creator<md_rom_kof99_device>;
const device_type MD_ROM_SOULB = &device_creator<md_rom_soulb_device>;
const device_type MD_ROM_CHINF3 = &device_creator<md_rom_chinf3_device>;
const device_type MD_ROM_ELFWOR = &device_creator<md_rom_elfwor_device>;
+const device_type MD_ROM_YASECH = &device_creator<md_rom_yasech_device>;
const device_type MD_ROM_LION2 = &device_creator<md_rom_lion2_device>;
const device_type MD_ROM_LION3 = &device_creator<md_rom_lion3_device>;
const device_type MD_ROM_MCPIR = &device_creator<md_rom_mcpirate_device>;
@@ -46,7 +47,6 @@ const device_type MD_ROM_REDCL = &device_creator<md_rom_redcl_device>;
const device_type MD_ROM_SQUIR = &device_creator<md_rom_squir_device>;
const device_type MD_ROM_TOPF = &device_creator<md_rom_topf_device>;
const device_type MD_ROM_RADICA = &device_creator<md_rom_radica_device>;
-const device_type MD_ROM_BEGGAR = &device_creator<md_rom_beggar_device>;
// below ones are currently unused, because the protection is patched out
const device_type MD_ROM_MULAN = &device_creator<md_std_rom_device>;
@@ -71,11 +71,6 @@ md_rom_sram_device::md_rom_sram_device(const machine_config &mconfig, const char
{
}
-md_rom_beggar_device::md_rom_beggar_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : md_std_rom_device(mconfig, MD_ROM_BEGGAR, "MD Xin Qigai Wangzi", tag, owner, clock)
-{
-}
-
md_rom_fram_device::md_rom_fram_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: md_std_rom_device(mconfig, MD_ROM_FRAM, "MD Standard cart + FRAM", tag, owner, clock)
{
@@ -151,6 +146,11 @@ md_rom_elfwor_device::md_rom_elfwor_device(const machine_config &mconfig, const
{
}
+md_rom_yasech_device::md_rom_yasech_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : md_std_rom_device(mconfig, MD_ROM_YASECH, "MD Ya Se Chuan Shuo", tag, owner, clock)
+{
+}
+
md_rom_lion2_device::md_rom_lion2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: md_std_rom_device(mconfig, MD_ROM_LION2, "MD Lion King 2", tag, owner, clock)
{
@@ -282,15 +282,17 @@ void md_rom_radica_device::device_start()
READ16_MEMBER(md_rom_sram_device::read)
{
- offset <<= 1;
// since a lot of generic carts ends up here if loaded from fullpath
// we access nvram only if m_nvram_handlers_installed has been turned on
if (m_nvram_handlers_installed)
{
- if (offset >= m_nvram_start && offset < m_nvram_end && m_nvram_active)
- return m_nvram[(offset - m_nvram_start)/2];
+ if (offset >= m_nvram_start/2 && offset < m_nvram_end/2 && m_nvram_active)
+ return m_nvram[offset - m_nvram_start/2];
}
- return m_rom[offset/2];
+ if (offset < 0x400000/2)
+ return m_rom[MD_ADDR(offset)];
+ else
+ return 0xffff;
}
WRITE16_MEMBER(md_rom_sram_device::write)
@@ -299,16 +301,14 @@ WRITE16_MEMBER(md_rom_sram_device::write)
// we access nvram only if m_nvram_handlers_installed has been turned on
if (m_nvram_handlers_installed)
{
- offset <<= 1;
- if (offset >= m_nvram_start && offset <= m_nvram_end && m_nvram_active && !m_nvram_readonly)
- m_nvram[(offset - m_nvram_start)/2] = data;
+ if (offset >= m_nvram_start/2 && offset <= m_nvram_end/2 && m_nvram_active && !m_nvram_readonly)
+ m_nvram[offset - m_nvram_start/2] = data;
}
}
WRITE16_MEMBER(md_rom_sram_device::write_a13)
{
- offset <<= 1;
- if (offset == 0xf)
+ if (offset == 0xf0/2)
{
/* unsure if this is actually supposed to toggle or just switch on? yet to encounter game that uses this */
m_nvram_active = BIT(data, 0);
@@ -322,58 +322,29 @@ WRITE16_MEMBER(md_rom_sram_device::write_a13)
}
/*-------------------------------------------------
- BEGGAR PRINCE / XIN QIGAI WANGZI [same as above, but diff start/end... merge?]
- -------------------------------------------------*/
-
-READ16_MEMBER(md_rom_beggar_device::read)
-{
- offset <<= 1;
- if (offset >= m_nvram_start && offset < m_nvram_end && m_nvram_active)
- return m_nvram[(offset - m_nvram_start)/2];
- return m_rom[offset/2];
-}
-
-WRITE16_MEMBER(md_rom_beggar_device::write)
-{
- offset <<= 1;
- if (offset >= m_nvram_start && offset <= m_nvram_end && m_nvram_active && !m_nvram_readonly)
- m_nvram[(offset - m_nvram_start)/2] = data;
-}
-
-WRITE16_MEMBER(md_rom_beggar_device::write_a13)
-{
- offset <<= 1;
- if (offset == 0xf)
- {
- /* unsure if this is actually supposed to toggle or just switch on? yet to encounter game that uses this */
- m_nvram_active = BIT(data, 0);
- m_nvram_readonly = BIT(data, 1);
- }
-}
-
-/*-------------------------------------------------
CART + FRAM [almost same as SRAM... merge common parts?]
-------------------------------------------------*/
READ16_MEMBER(md_rom_fram_device::read)
{
- offset <<= 1;
- if (offset >= m_nvram_start && offset < m_nvram_end && m_nvram_active)
- return m_nvram[(offset - m_nvram_start)/2];
- return m_rom[offset/2];
+ if (offset >= m_nvram_start/2 && offset < m_nvram_end/2 && m_nvram_active)
+ return m_nvram[offset - m_nvram_start/2];
+ if (offset < 0x400000/2)
+ return m_rom[MD_ADDR(offset)];
+ else
+ return 0xffff;
}
WRITE16_MEMBER(md_rom_fram_device::write_a13)
{
- offset <<= 1;
- if (offset == 0xf)
+ if (offset == 0xf0/2)
m_nvram_active = BIT(data, 0);
}
READ16_MEMBER(md_rom_fram_device::read_a13)
{
- if (offset == 0xf)
+ if (offset == 0xf0/2)
return m_nvram_active;
else
return 0xffff;
@@ -564,6 +535,19 @@ READ16_MEMBER(md_rom_smouse_device::read)
}
/*-------------------------------------------------
+ YA SE CHUAN SHUO
+ -------------------------------------------------*/
+
+READ16_MEMBER(md_rom_yasech_device::read)
+{
+ if (offset == 0x400000/2) return 0x6300;
+ if (offset == 0x400002/2) return 0x9800;
+ if (offset == 0x400004/2) return 0xc900;
+ if (offset == 0x400006/2) return 0x1800;
+ return m_rom[offset];
+}
+
+/*-------------------------------------------------
KOF98
-------------------------------------------------*/
diff --git a/src/mess/machine/md_rom.h b/src/mess/machine/md_rom.h
index 1ad1b9c4fe8..fd7b03d0901 100644
--- a/src/mess/machine/md_rom.h
+++ b/src/mess/machine/md_rom.h
@@ -3,7 +3,6 @@
#include "machine/md_slot.h"
-
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -23,7 +22,7 @@ public:
virtual void device_config_complete() { m_shortname = "md_std_rom"; }
// reading and writing
- virtual DECLARE_READ16_MEMBER(read) { return m_rom[offset]; };
+ virtual DECLARE_READ16_MEMBER(read) { if (offset < 0x400000/2) return m_rom[MD_ADDR(offset)]; else return 0xffff; };
virtual DECLARE_WRITE16_MEMBER(write) { };
};
@@ -44,23 +43,6 @@ public:
virtual DECLARE_WRITE16_MEMBER(write_a13);
};
-// ======================> md_rom_beggar_device
-
-class md_rom_beggar_device : public md_std_rom_device
-{
-public:
- // construction/destruction
- md_rom_beggar_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
-
- // device-level overrides
- virtual void device_config_complete() { m_shortname = "md_rom_beggar"; }
-
- // reading and writing
- virtual DECLARE_READ16_MEMBER(read);
- virtual DECLARE_WRITE16_MEMBER(write);
- virtual DECLARE_WRITE16_MEMBER(write_a13);
-};
-
// ======================> md_rom_fram_device
class md_rom_fram_device : public md_std_rom_device
@@ -170,6 +152,21 @@ public:
virtual DECLARE_READ16_MEMBER(read);
};
+// ======================> md_rom_yasech_device
+
+class md_rom_yasech_device : public md_std_rom_device
+{
+public:
+ // construction/destruction
+ md_rom_yasech_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // device-level overrides
+ virtual void device_config_complete() { m_shortname = "md_rom_yasech"; }
+
+ // reading and writing
+ virtual DECLARE_READ16_MEMBER(read);
+};
+
// ======================> md_rom_kof98_device
class md_rom_kof98_device : public md_std_rom_device
@@ -469,10 +466,10 @@ private:
extern const device_type MD_STD_ROM;
extern const device_type MD_ROM_SRAM;
extern const device_type MD_ROM_FRAM;
-extern const device_type MD_ROM_BEGGAR;
extern const device_type MD_ROM_BUGSLIFE;
extern const device_type MD_ROM_CHINF3;
extern const device_type MD_ROM_ELFWOR;
+extern const device_type MD_ROM_YASECH;
extern const device_type MD_ROM_KOF98;
extern const device_type MD_ROM_KOF99;
extern const device_type MD_ROM_LION2;
diff --git a/src/mess/machine/md_sk.c b/src/mess/machine/md_sk.c
index dbaf0822f69..e2b38b7da47 100644
--- a/src/mess/machine/md_sk.c
+++ b/src/mess/machine/md_sk.c
@@ -52,7 +52,10 @@ READ16_MEMBER(md_rom_sk_device::read)
{
if (m_exp->m_cart != NULL && m_exp->m_cart->get_rom_base() != NULL && offset >= 0x200000/2 && offset < (0x200000 + m_exp->m_cart->get_rom_size())/2)
return m_exp->m_cart->m_rom[offset - 0x200000/2];
- return m_rom[offset];
+ if (offset < 0x400000/2)
+ return m_rom[MD_ADDR(offset)];
+ else
+ return 0xffff;
}
WRITE16_MEMBER(md_rom_sk_device::write)
diff --git a/src/mess/machine/md_slot.c b/src/mess/machine/md_slot.c
index 7b0fec66188..2ab615dddd5 100644
--- a/src/mess/machine/md_slot.c
+++ b/src/mess/machine/md_slot.c
@@ -16,11 +16,29 @@
md_sk: Sonic & Knuckles pass-thorugh cart (enables a second slot to mount any other cart)
md_stm95: cart + STM95 EEPROM (e.g. Pier Solar)
- TODO: currently read access in 0x000000-0x7fffff are not masked (so we assume that no game attempts to
- read beyond its ROM size). A regression test is pending to identify which games need this and mirror
- them properly (Eke's doc states ROM data should be mirrored), but none of the ~120 games I tried
- attempted that and a testcase would be appreciated
+ Cart Mirroring (based Eke's research)
+
+ MD Cartridge area is mapped to $000000-$3fffff: when accessing ROM, 68k address lines A1 to A21 can be
+ used by the internal cartridge hardware to decode full 4MB address range.
+ Depending on ROM total size and additional decoding hardware, some address lines might be ignored,
+ resulting in ROM mirroring.
+
+ Cartridges typically use either 8-bits (x2) or 16-bits (x1, x2) Mask ROM chips, each chip size is a
+ factor of 2 bytes.
+ When one chip ROM1 of size 2^N is present, it is generally mirrored each 2^N bytes so that read access
+ to cart area sees the sequence ROM1,ROM1,ROM1,... (up to 4MB)
+ When two chips ROM1 & ROM2 are present and the whole size is 2^N, then the block ROM1+ROM2 is mirrored
+ in the cart area, and reads see the sequence ROM1+ROM2,ROM1+ROM2,... (up to 4MB)
+ When two chips ROM1 & ROM2 are present and the whole size is not 2^N (e.g. because ROM1 and ROM2 have
+ different sizes), then the area between the end of ROM2 and next power 2^N is generally ignored, and
+ reads see the sequence ROM1,ROM2,XXXX,ROM1,ROM2,XXXX... (up to 4MB)
+
+ At loading time we first compute first power 2^N larger than cart size (see get_padded_size function),
+ we allocate such a size for ROM and we fill of 0xff the area between end of dump and 2^N.
+ Then we handle mirroring by creating a rom_bank_map[] (see rom_map_setup function) which points each
+ access in 0x000000-0x400000 to the correct 64K ROM bank.
+
***********************************************************************************************************/
@@ -89,6 +107,57 @@ void device_md_cart_interface::nvram_alloc(running_machine &machine, size_t size
}
}
+//-------------------------------------------------
+// rom_map_setup - setup map of rom banks in 64K
+// blocks, so to simplify ROM mirroring
+//-------------------------------------------------
+
+void device_md_cart_interface::rom_map_setup(UINT32 size)
+{
+ int i;
+ // setup the rom_bank_map array to faster ROM read
+ for (i = 0; i < size / 0x10000; i++)
+ rom_bank_map[i] = i;
+
+ // fill up remaining blocks with mirrors
+ while (i % 64)
+ {
+ int j = 0, repeat_banks;
+ while ((i % (64 >> j)) && j < 7)
+ j++;
+ repeat_banks = i % (64 >> (j - 1));
+ for (int k = 0; k < repeat_banks; k++)
+ rom_bank_map[i + k] = rom_bank_map[i + k - repeat_banks];
+ i += repeat_banks;
+ }
+
+// check bank map!
+// for (i = 0; i < 64; i++)
+// {
+// printf("bank %3d = %3d\t", i, rom_bank_map[i]);
+// if ((i%8) == 7)
+// printf("\n");
+// }
+}
+
+//-------------------------------------------------
+//
+//
+//-------------------------------------------------
+
+UINT32 device_md_cart_interface::get_padded_size(UINT32 size)
+{
+ UINT32 pad_size = 0x10000;
+ while (size > pad_size)
+ pad_size <<= 1;
+
+ if (pad_size < 0x800000 && size < pad_size)
+ return pad_size;
+ else
+ return size;
+}
+
+
//**************************************************************************
// LIVE DEVICE
@@ -170,6 +239,7 @@ static const md_slot slot_list[] =
{ SEGA_SRAM, "rom_sram" },
{ SEGA_FRAM, "rom_fram" },
+ { HARDBALL95, "rom_hardbl95" },
{ BEGGAR, "rom_beggar"},
{ SEGA_EEPROM, "rom_eeprom" },
@@ -294,15 +364,26 @@ int base_md_cart_slot_device::load_list()
UINT32 length = get_software_region_length("rom");
const char *slot_name;
- m_cart->rom_alloc(machine(), length);
+ // if cart size is not (2^n * 64K), the system will see anyway that size so we need to alloc a bit more space
+ length = m_cart->get_padded_size(length);
+
+ m_cart->rom_alloc(machine(), length);
ROM = m_cart->get_rom_base();
- memcpy(ROM, get_software_region("rom"), length);
+ memcpy(ROM, get_software_region("rom"), get_software_region_length("rom"));
+
+ // if we allocated a ROM larger that the file (e.g. due to uneven cart size), set remaining space to 0xff
+ if (length > get_software_region_length("rom"))
+ memset(ROM + get_software_region_length("rom")/2, 0xffff, (length - get_software_region_length("rom"))/2);
if ((slot_name = get_feature("slot")) == NULL)
m_type = SEGA_STD;
else
m_type = md_get_pcb_id(slot_name);
-
+
+ // handle mirroring of ROM, unless it's SSF2 or Pier Solar
+ if (m_type != SSF2 && m_type != PSOLAR)
+ m_cart->rom_map_setup(length);
+
return IMAGE_INIT_PASS;
}
@@ -382,7 +463,7 @@ static int genesis_is_SMD(unsigned char *buf,unsigned int len)
int base_md_cart_slot_device::load_nonlist()
{
unsigned char *ROM, *tmpROM;
- UINT32 len = length();
+ UINT32 len = m_cart->get_padded_size(length()); // if cart size is not (2^n * 64K), the system will see anyway that size so we need to alloc a bit more space
// this contains an hack for SSF2: its current bankswitch code needs larger rom space to work
m_cart->rom_alloc(machine(), (len == 0x500000) ? 0x900000 : len);
@@ -428,10 +509,18 @@ int base_md_cart_slot_device::load_nonlist()
}
global_free(tmpROM);
-
+
+ // if we allocated a ROM larger that the file (e.g. due to uneven cart size), set remaining space to 0xff
+ if (len > length())
+ memset(m_cart->get_rom_base() + length()/2, 0xffff, (len - length())/2);
+
// STEP 2: determine the cart type (to deal with pirate mappers & eeprom)
- m_type = get_cart_type(ROM, len);
+ m_type = get_cart_type(ROM, length());
+ // handle mirroring of ROM, unless it's SSF2 or Pier Solar
+ if (m_type != SSF2 && m_type != PSOLAR)
+ m_cart->rom_map_setup(len);
+
#ifdef LSB_FIRST
unsigned char fliptemp;
// is this really needed nowadays?
@@ -577,8 +666,15 @@ void base_md_cart_slot_device::setup_nvram()
m_cart->m_nvram_active = 1;
m_cart->m_nvram_handlers_installed = 1;
break;
-
+
// These types might come from both (pending proper id routines)
+ case HARDBALL95:
+ m_cart->m_nvram_start = 0x300000;
+ m_cart->m_nvram_end = m_cart->m_nvram_start + get_software_region_length("sram") - 1;
+ m_cart->nvram_alloc(machine(), m_cart->m_nvram_end - m_cart->m_nvram_start + 1);
+ m_cart->m_nvram_active = 1;
+ m_cart->m_nvram_handlers_installed = 1;
+ break;
case BEGGAR:
m_cart->m_nvram_start = 0x400000;
m_cart->m_nvram_end = m_cart->m_nvram_start + 0xffff;
diff --git a/src/mess/machine/md_slot.h b/src/mess/machine/md_slot.h
index fca02970d83..a51b3f5bc01 100644
--- a/src/mess/machine/md_slot.h
+++ b/src/mess/machine/md_slot.h
@@ -5,6 +5,7 @@
TYPE DEFINITIONS
***************************************************************************/
+#define MD_ADDR(a) rom_bank_map[(a / 0x10000) & 0x3f] * 0x10000 + (a & 0xffff)
/* PCB */
enum
@@ -19,6 +20,7 @@ enum
// Cart + NVRAM
SEGA_SRAM, SEGA_FRAM,
+ HARDBALL95, /* Hardball 95 uses different sram start address */
BEGGAR, /* Xin Qigai Wangzi uses different sram start address and has no valid header */
// EEPROM
@@ -106,6 +108,9 @@ public:
virtual UINT32 get_rom_size() { return m_rom_size; };
virtual UINT32 get_nvram_size() { return m_nvram_size; };
+ virtual void rom_map_setup(UINT32 size);
+ virtual UINT32 get_padded_size(UINT32 size);
+
int m_nvram_start, m_nvram_end;
int m_nvram_active, m_nvram_readonly;
@@ -119,6 +124,8 @@ public:
UINT16 *m_nvram;
UINT32 m_rom_size;
UINT32 m_nvram_size;
+
+ UINT8 rom_bank_map[128]; // 64K chunks of rom
};