summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/nes
diff options
context:
space:
mode:
author 0kmg <9137159+0kmg@users.noreply.github.com>2021-10-02 12:21:34 -0800
committer GitHub <noreply@github.com>2021-10-02 16:21:34 -0400
commitf8a45bd24f381588396246e89f9f34a618203b3f (patch)
treed3f4400e43e27c4b1ed5626678293bbd91d585dc /src/devices/bus/nes
parent4ba9d35e35199e89cf3a7b61d43cb63ca4c2b474 (diff)
bus/nes: Added emulation for A Winner is You homebrew cart. (#8582)
Diffstat (limited to 'src/devices/bus/nes')
-rw-r--r--src/devices/bus/nes/nes_carts.cpp1
-rw-r--r--src/devices/bus/nes/nes_ines.hxx25
-rw-r--r--src/devices/bus/nes/nes_pcb.hxx1
-rw-r--r--src/devices/bus/nes/nes_slot.h6
-rw-r--r--src/devices/bus/nes/sealie.cpp37
-rw-r--r--src/devices/bus/nes/sealie.h15
6 files changed, 81 insertions, 4 deletions
diff --git a/src/devices/bus/nes/nes_carts.cpp b/src/devices/bus/nes/nes_carts.cpp
index 2ee3e4d06f3..380e87aceb0 100644
--- a/src/devices/bus/nes/nes_carts.cpp
+++ b/src/devices/bus/nes/nes_carts.cpp
@@ -460,6 +460,7 @@ void nes_cart(device_slot_interface &device)
device.option_add_internal("cufrom", NES_CUFROM);
device.option_add_internal("unrom512", NES_UNROM512);
device.option_add_internal("2a03pur", NES_2A03PURITANS);
+ device.option_add_internal("dpcmcart", NES_DPCMCART);
// other unsupported...
device.option_add_internal("unl_dance", NES_NROM); // UNSUPPORTED
device.option_add_internal("onebus", NES_NROM); // UNSUPPORTED
diff --git a/src/devices/bus/nes/nes_ines.hxx b/src/devices/bus/nes/nes_ines.hxx
index af365d9688b..0c8ce115178 100644
--- a/src/devices/bus/nes/nes_ines.hxx
+++ b/src/devices/bus/nes/nes_ines.hxx
@@ -444,7 +444,7 @@ static const nes_mmc mmc_list[] =
// 406 homebrew game Haradius Zero
// 407 VT03 PnP
// 408 Konami PnP
- // 409 (Sealie) homebrew game A Winner is You, 64MB music cart, easy to support if dump is available
+ { 409, UNL_DPCMCART }, // A Winner is You homebrew music cart
// 410 Unused or JY?
{ 411, BMC_A88S1 },
// 412 INTV 10-in-1 PnP 2nd edition
@@ -643,8 +643,27 @@ void nes_cart_slot_device::call_load_ines()
mapper |= (header[8] & 0x0f) << 8;
// read submappers (based on 20140116 specs)
submapper = (header[8] & 0xf0) >> 4;
- prg_size += ((header[9] & 0x0f) << 8) * 0x4000;
- vrom_size += ((header[9] & 0xf0) << 4) * 0x2000;
+
+ // NES 2.0's extended exponential sizes, needed for loading PRG >= 64MB, CHR >= 32MB. These bizarrely go up to 7 * 2^63!
+ auto expsize = [] (u8 byte) { return (2*(byte & 0x03) + 1) << (byte >> 2); };
+
+ if ((header[9] & 0x0f) == 0x0f)
+ {
+ prg_size = expsize(header[4]);
+ if (prg_size == 0) // 0 only on overflow
+ fatalerror("NES 2.0 PRG size >= 4GB is unsupported.\n");
+ }
+ else
+ prg_size += ((header[9] & 0x0f) << 8) * 0x4000;
+
+ if ((header[9] & 0xf0) == 0xf0)
+ {
+ vrom_size = expsize(header[5]);
+ if (vrom_size == 0) // 0 only on overflow
+ fatalerror("NES 2.0 CHR size >= 4GB is unsupported.\n");
+ }
+ else
+ vrom_size += ((header[9] & 0xf0) << 4) * 0x2000;
}
ines_mapr_setup(mapper, &pcb_id);
diff --git a/src/devices/bus/nes/nes_pcb.hxx b/src/devices/bus/nes/nes_pcb.hxx
index 49daf61ec80..cbf56bce160 100644
--- a/src/devices/bus/nes/nes_pcb.hxx
+++ b/src/devices/bus/nes/nes_pcb.hxx
@@ -370,6 +370,7 @@ static const nes_pcb pcb_list[] =
{ "cufrom", UNL_CUFROM },
{ "unrom512", UNL_UNROM512 },
{ "2a03pur", UNL_2A03PURITANS },
+ { "dpcmcart", UNL_DPCMCART },
{ "ffe3", FFE3_BOARD },
{ "ffe4", FFE4_BOARD },
{ "ffe8", FFE8_BOARD },
diff --git a/src/devices/bus/nes/nes_slot.h b/src/devices/bus/nes/nes_slot.h
index cdf05bef93f..e33e545ec08 100644
--- a/src/devices/bus/nes/nes_slot.h
+++ b/src/devices/bus/nes/nes_slot.h
@@ -143,7 +143,11 @@ enum
// homebrew PCBs
NOCASH_NOCHR, // homebrew PCB design which uses NTRAM for CHRRAM
UNL_ACTION53, // homebrew PCB for homebrew multicarts
- BATMAP_000, BATMAP_SRRX, UNL_CUFROM, UNL_UNROM512, UNL_2A03PURITANS,
+ UNL_2A03PURITANS,
+ // Batlab Electronics
+ BATMAP_000, BATMAP_SRRX,
+ // Sealie
+ UNL_CUFROM, UNL_UNROM512, UNL_DPCMCART,
// FFE boards, for mappers 6, 8, 17
FFE3_BOARD, FFE4_BOARD, FFE8_BOARD, TEST_BOARD,
// Unsupported (for place-holder boards, with no working emulation) & no-board (at init)
diff --git a/src/devices/bus/nes/sealie.cpp b/src/devices/bus/nes/sealie.cpp
index 1e6761486ac..f9ecbdfa272 100644
--- a/src/devices/bus/nes/sealie.cpp
+++ b/src/devices/bus/nes/sealie.cpp
@@ -9,6 +9,7 @@
Here we emulate the following homebrew PCBs
* SEALIE RET-CUFROM [mapper 29]
+ * SEALIE DPCMcart [mapper 409]
* SEALIE UNROM 512 [mapper 30]
***********************************************************************************************************/
@@ -32,6 +33,7 @@
//-------------------------------------------------
DEFINE_DEVICE_TYPE(NES_CUFROM, nes_cufrom_device, "nes_cufrom", "NES Cart Sealie RET-CUFROM PCB")
+DEFINE_DEVICE_TYPE(NES_DPCMCART, nes_dpcmcart_device, "nes_dpcmcart", "NES Cart Sealie DPCMcart PCB")
DEFINE_DEVICE_TYPE(NES_UNROM512, nes_unrom512_device, "nes_unrom512", "NES Cart Sealie UNROM 512 PCB")
@@ -40,6 +42,11 @@ nes_cufrom_device::nes_cufrom_device(const machine_config &mconfig, const char *
{
}
+nes_dpcmcart_device::nes_dpcmcart_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+ : nes_nrom_device(mconfig, NES_DPCMCART, tag, owner, clock)
+{
+}
+
nes_unrom512_device::nes_unrom512_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: nes_nrom_device(mconfig, NES_UNROM512, tag, owner, clock)
{
@@ -54,6 +61,13 @@ void nes_cufrom_device::pcb_reset()
chr8(0, CHRRAM);
}
+void nes_dpcmcart_device::pcb_reset()
+{
+ prg16_89ab(0);
+ prg16_cdef(m_prg_chunks - 1);
+ chr8(0, CHRRAM);
+}
+
void nes_unrom512_device::pcb_reset()
{
prg16_89ab(0);
@@ -95,6 +109,29 @@ void nes_cufrom_device::write_h(offs_t offset, u8 data)
/*-------------------------------------------------
+ Sealie DPCMcart board
+
+ Games: A Winner is You
+
+ This homebrew mapper supports a whopping 64MB which
+ is paged in 16K chucks at 0x8000. 0xc000 is fixed.
+
+ NES 2.0: mapper 409
+
+ In MAME: Partially supported.
+
+ TODO: Controls other than 'next track' don't work.
+
+ -------------------------------------------------*/
+
+void nes_dpcmcart_device::write_h(offs_t offset, u8 data)
+{
+ LOG_MMC(("dpcmcart write_h, offset: %04x, data: %02x\n", offset, data));
+ prg16_89ab(offset & 0x0fff);
+}
+
+/*-------------------------------------------------
+
Sealie UNROM 512 board
Games: Battle Kid 1 & 2, E.T., many more
diff --git a/src/devices/bus/nes/sealie.h b/src/devices/bus/nes/sealie.h
index 1892bf45ff2..f674d558d07 100644
--- a/src/devices/bus/nes/sealie.h
+++ b/src/devices/bus/nes/sealie.h
@@ -22,6 +22,20 @@ public:
};
+// ======================> nes_dpcmcart_device
+
+class nes_dpcmcart_device : public nes_nrom_device
+{
+public:
+ // construction/destruction
+ nes_dpcmcart_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
+
+ virtual void write_h(offs_t offset, u8 data) override;
+
+ virtual void pcb_reset() override;
+};
+
+
// ======================> nes_unrom512_device
class nes_unrom512_device : public nes_nrom_device
@@ -38,6 +52,7 @@ public:
// device type definition
DECLARE_DEVICE_TYPE(NES_CUFROM, nes_cufrom_device)
+DECLARE_DEVICE_TYPE(NES_DPCMCART, nes_dpcmcart_device)
DECLARE_DEVICE_TYPE(NES_UNROM512, nes_unrom512_device)
#endif // MAME_BUS_NES_SEALIE_H