diff --git a/.gitattributes b/.gitattributes
index fe03ae78f02..22777cf8e15 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -183,6 +183,7 @@ hash/neocd.xml svneol=native#text/xml
hash/neogeo.xml svneol=native#text/xml
hash/nes.hsi svneol=native#text/xml
hash/nes.xml svneol=native#text/xml
+hash/nes_ade.xml svneol=native#text/xml
hash/nes_datach.xml svneol=native#text/xml
hash/nes_kstudio.xml svneol=native#text/xml
hash/nes_ntbrom.xml svneol=native#text/xml
@@ -8178,6 +8179,8 @@ src/mess/machine/ne2000.h svneol=native#text/plain
src/mess/machine/nes.c svneol=native#text/plain
src/mess/machine/nes_act53.c svneol=native#text/plain
src/mess/machine/nes_act53.h svneol=native#text/plain
+src/mess/machine/nes_aladdin.c svneol=native#text/plain
+src/mess/machine/nes_aladdin.h svneol=native#text/plain
src/mess/machine/nes_ave.c svneol=native#text/plain
src/mess/machine/nes_ave.h svneol=native#text/plain
src/mess/machine/nes_bandai.c svneol=native#text/plain
diff --git a/hash/nes.xml b/hash/nes.xml
index ef06a39fa86..d351c0e12db 100644
--- a/hash/nes.xml
+++ b/hash/nes.xml
@@ -4084,15 +4084,14 @@
- Big Nose Freaks Out (Aladdin Deck Enhancer & regular cart) (USA)
+ Big Nose Freaks Out (USA)
1992
Camerica
-
+
-
+
-
@@ -8544,25 +8543,6 @@
-
- Dizzy The Adventurer (Aladdin Deck Enhancer) (USA)
- 1991
- Camerica
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Doki! Doki! Yuuenchi - Crazyland Daisakusen (Jpn)
1991
@@ -12076,11 +12056,11 @@
-
+
The Fantastic Adventures of Dizzy (USA)
1991
Camerica
-
+
@@ -12094,28 +12074,6 @@
-
- The Fantastic Adventures of Dizzy (Aladdin Deck Enhancer) (USA)
- 1991
- Camerica
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Fantasy Zone (Jpn)
1987
@@ -21363,16 +21321,15 @@
-
- Linus Spacehead's Cosmic Crusade (Aladdin Deck Enhancer & regular cart) (USA)
+
+ Linus Spacehead's Cosmic Crusade (USA)
1992
Camerica
-
+
-
@@ -24088,33 +24045,6 @@
-
- Micro Machines (Aladdin Deck Enhancer) (USA)
- 1992
- Camerica
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Might and Magic - Book One - Secret of the Inner Sanctum (Jpn)
1990
@@ -29166,15 +29096,14 @@
- Quattro Adventure (Aladdin Deck Enhancer & regular cart) (USA)
+ Quattro Adventure (USA)
1991
Camerica
-
+
-
+
-
@@ -29188,7 +29117,7 @@
Quattro Arcade (USA)
1992
Camerica
-
+
@@ -29203,17 +29132,16 @@
- Quattro Sports (Aladdin Deck Enhancer & regular cart) (USA)
+ Quattro Sports (USA)
1991
Camerica
-
+
-
+
-
-
+
@@ -77036,8 +76964,9 @@ to check why this is different -->
+
- Pegasus 4 in 1
+ Pegasus 4 in 1 ~ Golden Four (Pol)
19??
<pirate>
@@ -77053,8 +76982,9 @@ to check why this is different -->
-
- Pegasus 5 in 1 (Golden Five)
+
+
+ Pegasus 5 in 1 ~ Golden Five (Pol)
19??
<pirate>
@@ -78310,4 +78240,27 @@ that the real dumps might surface -->
+
+
+
+ Aladdin Deck Enhancer (USA)
+ 1991
+ Camerica
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/hash/nes_ade.xml b/hash/nes_ade.xml
new file mode 100644
index 00000000000..244a4524217
--- /dev/null
+++ b/hash/nes_ade.xml
@@ -0,0 +1,102 @@
+
+
+
+
+
+
+
+ Dizzy The Adventurer (USA)
+ 1991
+ Camerica
+
+
+
+
+
+
+
+
+
+
+ Big Nose Freaks Out (USA)
+ 1992
+ Camerica
+
+
+
+
+
+
+
+
+
+
+ The Fantastic Adventures of Dizzy (USA)
+ 1991
+ Camerica
+
+
+
+
+
+
+
+
+
+
+ Linus Spacehead's Cosmic Crusade (USA)
+ 1992
+ Camerica
+
+
+
+
+
+
+
+
+
+
+ Micro Machines (USA)
+ 1992
+ Camerica
+
+
+
+
+
+
+
+
+
+
+ Quattro Adventure (USA)
+ 1991
+ Camerica
+
+
+
+
+
+
+
+
+
+
+ Quattro Sports (USA)
+ 1991
+ Camerica
+
+
+
+
+
+
+
+
+
+
diff --git a/hash/nes_ntbrom.xml b/hash/nes_ntbrom.xml
index 7d3bd28224a..77f52d85a8a 100644
--- a/hash/nes_ntbrom.xml
+++ b/hash/nes_ntbrom.xml
@@ -10,9 +10,8 @@
-
+
-
@@ -25,9 +24,8 @@
-
+
-
diff --git a/src/mess/drivers/nes.c b/src/mess/drivers/nes.c
index ba8a7ec19f5..3c60574bfb0 100644
--- a/src/mess/drivers/nes.c
+++ b/src/mess/drivers/nes.c
@@ -813,6 +813,7 @@ SLOT_INTERFACE_START(nes_cart)
SLOT_INTERFACE_INTERNAL("bf9093", NES_BF9093)
SLOT_INTERFACE_INTERNAL("bf9096", NES_BF9096)
SLOT_INTERFACE_INTERNAL("goldenfive", NES_GOLDEN5)
+ SLOT_INTERFACE_INTERNAL("ade", NES_ALADDIN)
SLOT_INTERFACE_INTERNAL("cne_decathl", NES_CNE_DECATHL)
SLOT_INTERFACE_INTERNAL("cne_fsb", NES_CNE_FSB)
SLOT_INTERFACE_INTERNAL("cne_shlz", NES_CNE_SHLZ)
@@ -1070,6 +1071,7 @@ static MACHINE_CONFIG_START( nes, nes_state )
MCFG_NES_CARTRIDGE_ADD("nes_slot", nes_crt_interface, nes_cart, NULL)
MCFG_SOFTWARE_LIST_ADD("cart_list", "nes")
+ MCFG_SOFTWARE_LIST_ADD("ade_list", "nes_ade") // Camerica/Codemasters Aladdin Deck Enhancer mini-carts
MCFG_SOFTWARE_LIST_ADD("ntb_list", "nes_ntbrom") // Sunsoft Nantettate! Baseball mini-carts
MCFG_SOFTWARE_LIST_ADD("kstudio_list", "nes_kstudio") // Bandai Karaoke Studio expansion carts
MCFG_SOFTWARE_LIST_ADD("datach_list", "nes_datach") // Bandai Datach Joint ROM System mini-carts
diff --git a/src/mess/includes/nes.h b/src/mess/includes/nes.h
index d9a28dc6b0d..1e67a0e2622 100644
--- a/src/mess/includes/nes.h
+++ b/src/mess/includes/nes.h
@@ -36,6 +36,7 @@
#include "machine/nes_taito.h"
// unlicensed/bootleg/pirate PCBs
#include "machine/nes_act53.h"
+#include "machine/nes_aladdin.h"
#include "machine/nes_ave.h"
#include "machine/nes_benshieng.h"
#include "machine/nes_camerica.h"
diff --git a/src/mess/machine/nes.c b/src/mess/machine/nes.c
index d3d2461df6c..a8d133ec120 100644
--- a/src/mess/machine/nes.c
+++ b/src/mess/machine/nes.c
@@ -159,7 +159,7 @@ void nes_state::machine_start()
m_ppu->set_latch(ppu2c0x_latch_delegate(FUNC(device_nes_cart_interface::ppu_latch),m_cartslot->m_cart));
// install additional handlers (read_h, read_ex, write_ex)
- if (m_cartslot->get_pcb_id() == STD_NROM368 || m_cartslot->get_pcb_id() == GG_NROM || m_cartslot->get_pcb_id() == SUNSOFT_DCS
+ if (m_cartslot->get_pcb_id() == STD_NROM368 || m_cartslot->get_pcb_id() == GG_NROM || m_cartslot->get_pcb_id() == CAMERICA_ALADDIN || m_cartslot->get_pcb_id() == SUNSOFT_DCS
|| m_cartslot->get_pcb_id() == BANDAI_DATACH || m_cartslot->get_pcb_id() == BANDAI_KARAOKE || m_cartslot->get_pcb_id() == AVE_MAXI15
|| m_cartslot->get_pcb_id() == KAISER_KS7022 || m_cartslot->get_pcb_id() == KAISER_KS7031 || m_cartslot->get_pcb_id() == BMC_VT5201
|| m_cartslot->get_pcb_id() == UNL_LH32 || m_cartslot->get_pcb_id() == UNL_LH10 || m_cartslot->get_pcb_id() == UNL_2708
diff --git a/src/mess/machine/nes_aladdin.c b/src/mess/machine/nes_aladdin.c
new file mode 100644
index 00000000000..38e6e15996e
--- /dev/null
+++ b/src/mess/machine/nes_aladdin.c
@@ -0,0 +1,341 @@
+/***********************************************************************************************************
+
+
+ NES/Famicom cartridge emulation for Camerica/Codemasters Aladdin Deck Enhancer pass-through cart
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+
+ Here we emulate the following PCBs
+
+ * Camerica ALGNV11 [mapper 71]
+ * Camerica ALGQV11 [mapper 232]
+
+ ***********************************************************************************************************/
+
+
+#include "emu.h"
+#include "machine/nes_aladdin.h"
+
+
+#ifdef NES_PCB_DEBUG
+#define VERBOSE 1
+#else
+#define VERBOSE 0
+#endif
+
+#define LOG_MMC(x) do { if (VERBOSE) logerror x; } while (0)
+
+
+
+//----------------------------------
+//
+// Aladdin Cartslot implementation
+//
+//----------------------------------
+
+//-------------------------------------------------
+// sub-cart interface
+//-------------------------------------------------
+
+aladdin_cart_interface::aladdin_cart_interface(const machine_config &mconfig, device_t &device)
+ : device_slot_card_interface(mconfig, device),
+ m_rom(NULL),
+ m_rom_size(0),
+ m_rom_mask(0xff)
+{
+}
+
+aladdin_cart_interface::~aladdin_cart_interface()
+{
+}
+
+READ8_MEMBER(aladdin_cart_interface::read)
+{
+ if (offset < 0x4000)
+ return m_rom[(m_lobank * 0x4000) + (offset & 0x3fff)];
+ else
+ return m_rom[(m_hibank * 0x4000) + (offset & 0x3fff)];
+}
+
+//-------------------------------------------------
+// sub-cart slot device
+//-------------------------------------------------
+
+const device_type NES_ALADDIN_SLOT = &device_creator;
+
+nes_aladdin_slot_device::nes_aladdin_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, NES_ALADDIN_SLOT, "NES Aladdin Deck Enhancer Cartridge Slot", tag, owner, clock, "nes_ade_slot", __FILE__),
+ device_image_interface(mconfig, *this),
+ device_slot_interface(mconfig, *this)
+{
+}
+
+nes_aladdin_slot_device::~nes_aladdin_slot_device()
+{
+}
+
+
+void nes_aladdin_slot_device::device_start()
+{
+ m_cart = dynamic_cast(get_card_device());
+}
+
+READ8_MEMBER(nes_aladdin_slot_device::read)
+{
+ if (m_cart)
+ return m_cart->read(space, offset, mem_mask);
+
+ return 0xff;
+}
+
+// 128K for Dizzy The Adventurer, 256K for the others
+bool nes_aladdin_slot_device::call_load()
+{
+ if (m_cart)
+ {
+ UINT8 *ROM = m_cart->get_cart_base();
+ UINT32 size = 0;
+
+ if (!ROM)
+ return IMAGE_INIT_FAIL;
+
+ if (software_entry() == NULL)
+ {
+ if (length() != 0x20010 && length() != 0x40010)
+ return IMAGE_INIT_FAIL;
+
+ UINT8 temp[0x40010];
+ size = length() - 0x10;
+ fread(&temp, length());
+ memcpy(ROM, temp + 0x10, size);
+
+ // double check that iNES files are really mapper 71 or 232
+ {
+ UINT8 mapper = (temp[6] & 0xf0) >> 4;
+ mapper |= temp[7] & 0xf0;
+ if (mapper != 71 && mapper != 232)
+ return IMAGE_INIT_FAIL;
+ }
+ }
+ else
+ {
+ if (get_software_region_length("rom") != 0x20000 && get_software_region_length("rom") != 0x40000)
+ return IMAGE_INIT_FAIL;
+
+ size = get_software_region_length("rom");
+ memcpy(ROM, get_software_region("rom"), size);
+ }
+
+ m_cart->set_cart_size(size);
+ }
+
+ return IMAGE_INIT_PASS;
+}
+
+
+bool nes_aladdin_slot_device::call_softlist_load(char *swlist, char *swname, rom_entry *start_entry)
+{
+ load_software_part_region(this, swlist, swname, start_entry );
+ return TRUE;
+}
+
+const char * nes_aladdin_slot_device::get_default_card_software(const machine_config &config, emu_options &options)
+{
+ if (open_image_file(options))
+ {
+ const char *slot_string = "algn";
+ UINT32 len = core_fsize(m_file);
+ UINT8 *ROM = global_alloc_array(UINT8, len);
+ UINT8 mapper;
+
+ core_fread(m_file, ROM, len);
+
+ mapper = (ROM[6] & 0xf0) >> 4;
+ mapper |= ROM[7] & 0xf0;
+
+// if (mapper == 71)
+// slot_string = "algn";
+ if (mapper == 232)
+ slot_string = "algq";
+
+ global_free(ROM);
+ clear();
+
+ return slot_string;
+ }
+ else
+ return software_get_default_slot(config, options, this, "algn");
+}
+
+
+//----------------------------------
+//
+// Aladdin Minicart implementation
+//
+//----------------------------------
+
+ROM_START( ade_rom )
+ ROM_REGION(0x40000, "aderom", ROMREGION_ERASEFF)
+ROM_END
+
+const device_type NES_ALGN_ROM = &device_creator;
+const device_type NES_ALGQ_ROM = &device_creator;
+
+nes_algn_rom_device::nes_algn_rom_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
+ : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
+ aladdin_cart_interface( mconfig, *this )
+{
+}
+
+nes_algn_rom_device::nes_algn_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : device_t(mconfig, NES_ALGN_ROM, "NES Aladdin Deck Enhancer ALGN ROM", tag, owner, clock, "nes_algn_rom", __FILE__),
+ aladdin_cart_interface( mconfig, *this )
+{
+}
+
+nes_algq_rom_device::nes_algq_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : nes_algn_rom_device(mconfig, NES_ALGQ_ROM, "NES Aladdin Deck Enhancer ALGQ ROM", tag, owner, clock, "nes_algq_rom", __FILE__)
+{
+}
+
+void nes_algn_rom_device::device_start()
+{
+ m_rom = (UINT8*)memregion("aderom")->base();
+ save_item(NAME(m_lobank));
+}
+
+void nes_algn_rom_device::device_reset()
+{
+ m_lobank = 0;
+ m_hibank = 0x0f & m_rom_mask;
+}
+
+void nes_algq_rom_device::device_start()
+{
+ m_rom = (UINT8*)memregion("aderom")->base();
+ save_item(NAME(m_lobank));
+ save_item(NAME(m_hibank));
+ save_item(NAME(m_bank_base));
+}
+
+void nes_algq_rom_device::device_reset()
+{
+ m_lobank = 0;
+ m_hibank = 3;
+ m_bank_base = 0;
+}
+
+const rom_entry *nes_algn_rom_device::device_rom_region() const
+{
+ return ROM_NAME( ade_rom );
+}
+
+UINT8 *nes_algn_rom_device::get_cart_base()
+{
+ return m_rom;
+}
+
+void nes_algn_rom_device::write_prg(UINT32 offset, UINT8 data)
+{
+ // m_hibank is fixed to the last available bank!
+ if (offset >= 0x4000)
+ m_lobank = data & m_rom_mask;
+}
+
+void nes_algq_rom_device::write_prg(UINT32 offset, UINT8 data)
+{
+ // here hibank & lobank variables are used differently
+ // m_bank_base = 64K block
+ // m_lobank = 16K page inside the block
+ // m_hibank = 3rd page inside the block
+ if (offset < 0x4000)
+ {
+ m_bank_base = ((data >> 3) & 3) << 2;
+ m_lobank = m_bank_base | (m_lobank & 3);
+ m_hibank = m_bank_base | 3;
+ }
+ else
+ m_lobank = m_bank_base | (data & 3);
+}
+
+
+//-----------------------------------------------
+//
+// Camerica/Codemasters Aladdin passthru
+// implementation
+//
+//-----------------------------------------------
+
+const device_type NES_ALADDIN = &device_creator;
+
+nes_aladdin_device::nes_aladdin_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : nes_nrom_device(mconfig, NES_ALADDIN, "NES Cart Camerica Aladdin PCB", tag, owner, clock, "nes_aladdin", __FILE__),
+ m_subslot(*this, "ade_slot")
+{
+}
+
+
+void nes_aladdin_device::device_start()
+{
+ common_start();
+}
+
+void nes_aladdin_device::pcb_reset()
+{
+ prg32(0xff);
+ chr8(0, CHRRAM);
+}
+
+
+/*-------------------------------------------------
+ mapper specific handlers
+ -------------------------------------------------*/
+
+/*-------------------------------------------------
+
+ Camerica/Codemasters Aladdin Deck Enhancer
+
+ iNES: mapper 71 & 232
+
+ In MESS: Supported (but timing issues in some games)
+
+ -------------------------------------------------*/
+
+READ8_MEMBER(nes_aladdin_device::read_h)
+{
+ LOG_MMC(("aladdin read_h, offset: %04x\n", offset));
+ // this shall be the proper code, but it's a bit slower, so we access directly the subcart below
+ //return m_subslot->read(space, offset, mem_mask);
+
+ if (m_subslot->m_cart)
+ return m_subslot->m_cart->read(space, offset, mem_mask);
+ else // this is "fake" in the sense that we fill CPU space with 0xff if no Aladdin cart is loaded
+ return hi_access_rom(offset);
+}
+
+WRITE8_MEMBER(nes_aladdin_device::write_h)
+{
+ LOG_MMC(("aladdin write_h, offset: %04x, data: %02x\n", offset, data));
+ m_subslot->write_prg(offset, data);
+}
+
+//-------------------------------------------------
+// CART SLOT
+//-------------------------------------------------
+
+static SLOT_INTERFACE_START(ade_cart)
+ SLOT_INTERFACE("algn", NES_ALGN_ROM)
+ SLOT_INTERFACE("algq", NES_ALGQ_ROM)
+SLOT_INTERFACE_END
+
+
+MACHINE_CONFIG_FRAGMENT( camerica_aladdin )
+ MCFG_ALADDIN_MINICART_ADD("ade_slot", ade_cart)
+MACHINE_CONFIG_END
+
+machine_config_constructor nes_aladdin_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( camerica_aladdin );
+}
diff --git a/src/mess/machine/nes_aladdin.h b/src/mess/machine/nes_aladdin.h
new file mode 100644
index 00000000000..c7009f70a73
--- /dev/null
+++ b/src/mess/machine/nes_aladdin.h
@@ -0,0 +1,165 @@
+#ifndef __NES_ALADDIN_H
+#define __NES_ALADDIN_H
+
+#include "machine/nes_nxrom.h"
+
+
+//----------------------------------
+//
+// Aladdin Cartslot implementation
+//
+//----------------------------------
+
+// ======================> aladdin_cart_interface
+
+class aladdin_cart_interface : public device_slot_card_interface
+{
+public:
+ // construction/destruction
+ aladdin_cart_interface(const machine_config &mconfig, device_t &device);
+ virtual ~aladdin_cart_interface();
+
+ // reading and writing
+ virtual DECLARE_READ8_MEMBER(read);
+
+ UINT8 *get_cart_base() { return m_rom; }
+ void set_cart_size(UINT32 size) { m_rom_size = size; m_rom_mask = (size / 0x4000) - 1; }
+ virtual void write_prg(UINT32 offset, UINT8 data) { }
+
+protected:
+ // internal state
+ UINT8 *m_rom;
+ UINT32 m_rom_size;
+ UINT8 m_lobank, m_hibank, m_rom_mask;
+};
+
+// ======================> nes_aladdin_slot_device
+
+class nes_aladdin_slot_device : public device_t,
+ public device_image_interface,
+ public device_slot_interface
+{
+public:
+ // construction/destruction
+ nes_aladdin_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ virtual ~nes_aladdin_slot_device();
+
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_config_complete() { update_names(); }
+
+ // image-level overrides
+ virtual bool call_load();
+ virtual bool call_softlist_load(char *swlist, char *swname, rom_entry *start_entry);
+
+ virtual iodevice_t image_type() const { return IO_CARTSLOT; }
+ virtual bool is_readable() const { return 1; }
+ virtual bool is_writeable() const { return 0; }
+ virtual bool is_creatable() const { return 0; }
+ virtual bool must_be_loaded() const { return 0; }
+ virtual bool is_reset_on_load() const { return 1; }
+ virtual const char *image_interface() const { return "ade_cart"; }
+ virtual const char *file_extensions() const { return "nes,bin"; }
+ virtual const option_guide *create_option_guide() const { return NULL; }
+
+ // slot interface overrides
+ virtual const char * get_default_card_software(const machine_config &config, emu_options &options);
+
+ virtual DECLARE_READ8_MEMBER(read);
+ void write_prg(UINT32 offset, UINT8 data) { if (m_cart) m_cart->write_prg(offset, data); }
+
+ aladdin_cart_interface* m_cart;
+};
+
+// device type definition
+extern const device_type NES_ALADDIN_SLOT;
+
+
+#define MCFG_ALADDIN_MINICART_ADD(_tag, _slot_intf) \
+ MCFG_DEVICE_ADD(_tag, NES_ALADDIN_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, NULL, false)
+
+
+//----------------------------------
+//
+// Aladdin Minicart implementation
+//
+//----------------------------------
+
+// ======================> nes_algn_rom_device
+
+class nes_algn_rom_device : public device_t,
+ public aladdin_cart_interface
+{
+public:
+ // construction/destruction
+ nes_algn_rom_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
+ nes_algn_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual const rom_entry *device_rom_region() const;
+ virtual UINT8* get_cart_base();
+ virtual void write_prg(UINT32 offset, UINT8 data);
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+};
+
+
+// ======================> nes_algq_rom_device
+
+class nes_algq_rom_device : public nes_algn_rom_device
+{
+public:
+ // construction/destruction
+ nes_algq_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual void write_prg(UINT32 offset, UINT8 data);
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ UINT8 m_bank_base;
+};
+
+// device type definition
+extern const device_type NES_ALGN_ROM;
+extern const device_type NES_ALGQ_ROM;
+
+
+//-----------------------------------------------
+//
+// Codemasters Aladdin passthru implementation
+//
+//-----------------------------------------------
+
+// ======================> nes_aladdin_device
+
+class nes_aladdin_device : public nes_nrom_device
+{
+public:
+ // construction/destruction
+ nes_aladdin_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // device-level overrides
+ virtual void device_start();
+ virtual machine_config_constructor device_mconfig_additions() const;
+ virtual DECLARE_READ8_MEMBER(read_h);
+ virtual DECLARE_WRITE8_MEMBER(write_h);
+
+ virtual void pcb_reset();
+
+protected:
+ required_device m_subslot;
+};
+
+
+// device type definition
+extern const device_type NES_ALADDIN;
+
+#endif
diff --git a/src/mess/machine/nes_camerica.c b/src/mess/machine/nes_camerica.c
index cb5bc520c16..6c1f72b3425 100644
--- a/src/mess/machine/nes_camerica.c
+++ b/src/mess/machine/nes_camerica.c
@@ -9,11 +9,14 @@
Here we emulate the following PCBs
- * Camerica BF9093, BF9097, BF909X & ALGNV11 [mapper 71, two variants]
- * Camerica BF9096 & ALGQV11 Boards [mapper 232]
+ * Camerica BF9093, BF9097, BF909X [mapper 71, two variants]
+ * Camerica BF9096 Boards [mapper 232]
* Camerica Golden Five [mapper 104]
+ Aladdin Deck Enhancer pass-thru cart and the corresponding minicarts
+ (ALGNV11 & ALGQV11 PCBs) are emulated in a separate source file.
+
TODO:
- check what causes flickering from PPU in Fire Hawk, Poogie and Big Nose (same PPU issue as Back to
Future 2&3?)
@@ -77,8 +80,8 @@ void nes_bf9093_device::pcb_reset()
void nes_bf9096_device::device_start()
{
common_start();
- save_item(NAME(m_latch1));
- save_item(NAME(m_latch2));
+ save_item(NAME(m_latch));
+ save_item(NAME(m_bank_base));
}
void nes_bf9096_device::pcb_reset()
@@ -86,9 +89,10 @@ void nes_bf9096_device::pcb_reset()
m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM;
chr8(0, m_chr_source);
- m_latch1 = 0x18;
- m_latch2 = 0x00;
- set_prg();
+ m_latch = 0x00;
+ m_bank_base = 0x0c;
+ prg16_89ab(m_bank_base | m_latch);
+ prg16_cdef(m_bank_base | 3);
}
void nes_golden5_device::device_start()
@@ -100,11 +104,12 @@ void nes_golden5_device::device_start()
void nes_golden5_device::pcb_reset()
{
m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM;
- prg16_89ab(0x00);
- prg16_cdef(0x0f);
chr8(0, m_chr_source);
- m_latch = 0;
+ m_latch = 0x00;
+ m_bank_base = 0x00;
+ prg16_89ab(m_bank_base | m_latch);
+ prg16_cdef(m_bank_base | 0x0f);
}
@@ -158,8 +163,8 @@ WRITE8_MEMBER(nes_bf9093_device::write_h)
Games: Quattro Adventure, Quattro Arcade, Quattro Sports
- Writes to 0x8000-0x9fff set prg block to (data&0x18)>>1,
- writes to 0xa000-0xbfff set prg page to data&3. selected
+ Writes to 0x8000-0xbfff set prg block to (data&0x18)>>1,
+ writes to 0xc000-0xffff set prg page to data&3. selected
prg are: prg16_89ab = block|page, prg_cdef = 3|page.
For more info on the hardware to bypass the NES lockout, see
Kevtris' Camerica Mappers documentation.
@@ -170,22 +175,21 @@ WRITE8_MEMBER(nes_bf9093_device::write_h)
-------------------------------------------------*/
-void nes_bf9096_device::set_prg()
-{
- prg16_89ab((m_latch2 & 0x03) | ((m_latch1 & 0x18) >> 1));
- prg16_cdef(0x03 | ((m_latch1 & 0x18) >> 1));
-}
-
WRITE8_MEMBER(nes_bf9096_device::write_h)
{
LOG_MMC(("bf9096 write_h, offset: %04x, data: %02x\n", offset, data));
- if (offset < 0x2000)
- m_latch1 = data;
+ if (offset < 0x4000)
+ {
+ m_bank_base = ((data >> 3) & 3) << 2;
+ prg16_89ab(m_bank_base | m_latch);
+ prg16_cdef(m_bank_base | 3);
+ }
else
- m_latch2 = data;
-
- set_prg();
+ {
+ m_latch = data & 3;
+ prg16_89ab(m_bank_base | m_latch);
+ }
}
/*-------------------------------------------------
@@ -208,15 +212,15 @@ WRITE8_MEMBER(nes_golden5_device::write_h)
{
if (data & 0x08)
{
- m_latch = ((data & 0x07) << 4) | (m_latch & 0x0f);
- prg16_89ab(m_latch);
- prg16_cdef(((data & 0x07) << 4) | 0x0f);
+ m_bank_base = (data & 0x07) << 4;
+ prg16_89ab(m_bank_base | m_latch);
+ prg16_cdef(m_bank_base | 0x0f);
}
}
else
{
- m_latch = (m_latch & 0x70) | (data & 0x0f);
- prg16_89ab(m_latch);
+ m_latch = data & 0x0f;
+ prg16_89ab(m_bank_base | m_latch);
}
}
diff --git a/src/mess/machine/nes_camerica.h b/src/mess/machine/nes_camerica.h
index b24411be908..c067af668e6 100644
--- a/src/mess/machine/nes_camerica.h
+++ b/src/mess/machine/nes_camerica.h
@@ -36,8 +36,7 @@ public:
virtual void pcb_reset();
private:
- void set_prg();
- UINT8 m_latch1, m_latch2;
+ UINT8 m_bank_base, m_latch;
};
@@ -56,7 +55,7 @@ public:
virtual void pcb_reset();
private:
- UINT8 m_latch;
+ UINT8 m_bank_base, m_latch;
};
diff --git a/src/mess/machine/nes_datach.c b/src/mess/machine/nes_datach.c
index aac7648e1ec..5346817cdee 100644
--- a/src/mess/machine/nes_datach.c
+++ b/src/mess/machine/nes_datach.c
@@ -46,8 +46,7 @@
datach_cart_interface::datach_cart_interface(const machine_config &mconfig, device_t &device)
: device_slot_card_interface(mconfig, device),
m_i2cmem(*this, "i2cmem"),
- m_rom(NULL),
- m_rom_size(0)
+ m_rom(NULL)
{
}
@@ -171,7 +170,7 @@ const device_type NES_DATACH_ROM = &device_creator;
const device_type NES_DATACH_24C01 = &device_creator;
nes_datach_rom_device::nes_datach_rom_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
- : device_t(mconfig, type, name, tag, owner, clock, "nes_datach_24c01", __FILE__),
+ : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
datach_cart_interface( mconfig, *this )
{
}
diff --git a/src/mess/machine/nes_datach.h b/src/mess/machine/nes_datach.h
index 82902b47c0b..9dbe2413ceb 100644
--- a/src/mess/machine/nes_datach.h
+++ b/src/mess/machine/nes_datach.h
@@ -31,7 +31,6 @@ public:
protected:
// internal state
UINT8 *m_rom;
- UINT32 m_rom_size;
// ROM is accessed via two 16K banks, but only the first one can be switched
UINT8 m_bank;
};
diff --git a/src/mess/machine/nes_karastudio.c b/src/mess/machine/nes_karastudio.c
index 5335d8a9c7e..cdc4ee012aa 100644
--- a/src/mess/machine/nes_karastudio.c
+++ b/src/mess/machine/nes_karastudio.c
@@ -53,8 +53,7 @@
kstudio_cart_interface::kstudio_cart_interface(const machine_config &mconfig, device_t &device)
: device_slot_card_interface(mconfig, device),
- m_rom(NULL),
- m_rom_size(0)
+ m_rom(NULL)
{
}
diff --git a/src/mess/machine/nes_karastudio.h b/src/mess/machine/nes_karastudio.h
index 9043dc5c38a..df06a462b31 100644
--- a/src/mess/machine/nes_karastudio.h
+++ b/src/mess/machine/nes_karastudio.h
@@ -28,7 +28,6 @@ public:
protected:
// internal state
UINT8 *m_rom;
- UINT32 m_rom_size;
// ROM is accessed via two 16K banks, but only the first one can be switched
UINT8 m_bank;
};
diff --git a/src/mess/machine/nes_pcb.inc b/src/mess/machine/nes_pcb.inc
index ebfb4776cad..af5b449beca 100644
--- a/src/mess/machine/nes_pcb.inc
+++ b/src/mess/machine/nes_pcb.inc
@@ -100,6 +100,7 @@ static const nes_pcb pcb_list[] =
{ "bf9093", CAMERICA_BF9093 },
{ "bf9096", CAMERICA_BF9096 },
{ "goldenfive", CAMERICA_GOLDENFIVE },
+ { "ade" , CAMERICA_ALADDIN },
{ "cne_decathl", CNE_DECATHLON },
{ "cne_fsb", CNE_FSB },
{ "cne_shlz", CNE_SHLZ },
diff --git a/src/mess/machine/nes_slot.h b/src/mess/machine/nes_slot.h
index 2394bf3d4d5..a264caa64f5 100644
--- a/src/mess/machine/nes_slot.h
+++ b/src/mess/machine/nes_slot.h
@@ -38,7 +38,7 @@ enum
/* Caltron */
CALTRON_6IN1,
/* Camerica */
- CAMERICA_BF9093, CAMERICA_BF9096,
+ CAMERICA_BF9093, CAMERICA_BF9096, CAMERICA_ALADDIN,
CAMERICA_GOLDENFIVE, GG_NROM,
/* Dreamtech */
DREAMTECH_BOARD,
diff --git a/src/mess/machine/nes_sunsoft_dcs.c b/src/mess/machine/nes_sunsoft_dcs.c
index 3fc0d4a4b4a..f2cfa3090da 100644
--- a/src/mess/machine/nes_sunsoft_dcs.c
+++ b/src/mess/machine/nes_sunsoft_dcs.c
@@ -37,8 +37,7 @@
ntb_cart_interface::ntb_cart_interface(const machine_config &mconfig, device_t &device)
: device_slot_card_interface(mconfig, device),
- m_rom(NULL),
- m_rom_size(0)
+ m_rom(NULL)
{
}
@@ -89,17 +88,17 @@ bool nes_ntb_slot_device::call_load()
if (software_entry() == NULL)
{
- if (length() != 0x8000)
+ if (length() != 0x4000)
return IMAGE_INIT_FAIL;
- fread(&ROM, 0x8000);
+ fread(&ROM, 0x4000);
}
else
{
- if (get_software_region_length("rom") != 0x8000)
+ if (get_software_region_length("rom") != 0x4000)
return IMAGE_INIT_FAIL;
- memcpy(ROM, get_software_region("rom"), 0x8000);
+ memcpy(ROM, get_software_region("rom"), 0x4000);
}
}
@@ -125,7 +124,7 @@ const char * nes_ntb_slot_device::get_default_card_software(const machine_config
//-----------------------------------------------
ROM_START( ntb_rom )
- ROM_REGION(0x8000, "ntbrom", ROMREGION_ERASEFF)
+ ROM_REGION(0x4000, "ntbrom", ROMREGION_ERASEFF)
ROM_END
const device_type NES_NTB_ROM = &device_creator;
diff --git a/src/mess/machine/nes_sunsoft_dcs.h b/src/mess/machine/nes_sunsoft_dcs.h
index b12a366b568..2c76f0b022d 100644
--- a/src/mess/machine/nes_sunsoft_dcs.h
+++ b/src/mess/machine/nes_sunsoft_dcs.h
@@ -20,14 +20,13 @@ public:
virtual ~ntb_cart_interface();
// reading and writing
- virtual DECLARE_READ8_MEMBER(read) { return m_rom[offset & (m_rom_size - 1)]; }
+ virtual DECLARE_READ8_MEMBER(read) { return m_rom[offset]; }
UINT8 *get_cart_base() { return m_rom; }
protected:
// internal state
UINT8 *m_rom;
- UINT32 m_rom_size;
};
// ======================> nes_ntb_slot_device
diff --git a/src/mess/mess.mak b/src/mess/mess.mak
index 9db1d0aa161..7ef4a3e12b2 100644
--- a/src/mess/mess.mak
+++ b/src/mess/mess.mak
@@ -1536,6 +1536,7 @@ $(MESSOBJ)/nintendo.a: \
$(MESS_MACHINE)/nes_mmc3_clones.o \
$(MESS_MACHINE)/nes_mmc5.o \
$(MESS_MACHINE)/nes_act53.o \
+ $(MESS_MACHINE)/nes_aladdin.o \
$(MESS_MACHINE)/nes_ave.o \
$(MESS_MACHINE)/nes_bandai.o \
$(MESS_MACHINE)/nes_benshieng.o \