summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/nes/mmc1.cpp
diff options
context:
space:
mode:
author 0kmg <9137159+0kmg@users.noreply.github.com>2021-09-08 16:31:48 -0800
committer 0kmg <9137159+0kmg@users.noreply.github.com>2021-09-09 17:04:22 -0800
commit968fb7f491a1eab76034b8a4fe14ad1f32060a88 (patch)
treeb198059d5316c7122c0c1acd06e39b9cd1c66896 /src/devices/bus/nes/mmc1.cpp
parent925f5183a10de850b6331441301a05d3291cf2fa (diff)
bus/nes: Added support for MMC1-based multicarts.
- Modified MMC1 base class (SxROM) to have outer bank base/mask to make it extensible by multicarts. - Implemented two boards, reset-based SxROM and a 2-in-1 by TXC, as proof of concept. - Marked Operation Wolf games as partially supported due to zapper inputs not working. - Marked Space Shadow as not supported since it requires the extra buttons on the Bandai Hyper Shot gun. New working software list additions (nes.xml) ----------------------------------- 1997 Super HiK 4 in 1 (JY-021) [MLX] 1995 Super HiK 4 in 1 (JY-022) [NewRisingSun, taizou] 1996 Super HiK 4 in 1 (JY-051) [NewRisingSun, taizou] 2 in 1 Uzi Lightgun [CaH4e3]
Diffstat (limited to 'src/devices/bus/nes/mmc1.cpp')
-rw-r--r--src/devices/bus/nes/mmc1.cpp39
1 files changed, 32 insertions, 7 deletions
diff --git a/src/devices/bus/nes/mmc1.cpp b/src/devices/bus/nes/mmc1.cpp
index 9a27c601b4c..cb752cb0754 100644
--- a/src/devices/bus/nes/mmc1.cpp
+++ b/src/devices/bus/nes/mmc1.cpp
@@ -13,6 +13,10 @@
* 001 Yoshi flashes in-game.
* 001 Back to the Future have heavily corrupted graphics (since forever).
+ TODO:
+ - Combine 2 versions of set_prg in SxROM base class. This means dealing with
+ variant boards SNROM, SUROM, etc which repurpose bits in the MMC1 regs.
+
***********************************************************************************************************/
@@ -142,6 +146,28 @@ TIMER_CALLBACK_MEMBER( nes_sxrom_device::resync_callback )
}
+// Standard MMC1 PRG banking with base and mask (to support multicarts, etc)
+void nes_sxrom_device::set_prg(int prg_base, int prg_mask)
+{
+ u8 bank = prg_base | (m_reg[3] & prg_mask);
+
+ switch ((m_reg[0] >> 2) & 3)
+ {
+ case 0:
+ case 1:
+ prg32(bank >> 1);
+ break;
+ case 2:
+ prg16_89ab(prg_base);
+ prg16_cdef(bank);
+ break;
+ case 3:
+ prg16_89ab(bank);
+ prg16_cdef(prg_base | prg_mask);
+ break;
+ }
+}
+
void nes_sxrom_device::set_prg()
{
uint8_t prg_mode, prg_offset;
@@ -177,17 +203,16 @@ void nes_sxrom_device::set_prg()
}
}
-void nes_sxrom_device::set_chr()
+// Standard MMC1 CHR banking with base and mask (to support multicarts, etc)
+void nes_sxrom_device::set_chr(int chr_base, int chr_mask)
{
- uint8_t chr_mode = BIT(m_reg[0], 4);
-
- if (chr_mode)
+ if (BIT(m_reg[0], 4))
{
- chr4_0(m_reg[1] & 0x1f, m_chr_source);
- chr4_4(m_reg[2] & 0x1f, m_chr_source);
+ chr4_0(chr_base | (m_reg[1] & chr_mask), m_chr_source);
+ chr4_4(chr_base | (m_reg[2] & chr_mask), m_chr_source);
}
else
- chr8((m_reg[1] & 0x1f) >> 1, m_chr_source);
+ chr8((chr_base | (m_reg[1] & chr_mask)) >> 1, m_chr_source);
}
// this allows for easier implementation of the NES-EVENT board used for Nintento World Championships