summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/nes
diff options
context:
space:
mode:
author 0kmg <9137159+0kmg@users.noreply.github.com>2022-02-07 15:12:19 -0900
committer GitHub <noreply@github.com>2022-02-07 19:12:19 -0500
commit9da06744f15162239e6b901cb127d2c4aca66baa (patch)
tree5f3033ef96a65e1b2ce23f6c986d7140afd7d4c2 /src/devices/bus/nes
parentb8f4bb43f7075013c85c4cdfae37ac6c5c08376c (diff)
bus/nes: Added support for multicart variant of JY830623C board. (#9120)
- Renamed MK2 board to JY830623C, the PCB label of at least one of the related bootlegs. - Removed deprecated hold_irq_line(). New working software list additions (nes.xml) ----------------------------------- 1995 Super HiK 4 in 1 (JY-016) [krzysiobal, NewRisingSun] 1995 Super HiK 4 in 1 (JY-017) [krzysiobal, NewRisingSun]
Diffstat (limited to 'src/devices/bus/nes')
-rw-r--r--src/devices/bus/nes/nes_carts.cpp2
-rw-r--r--src/devices/bus/nes/nes_ines.hxx2
-rw-r--r--src/devices/bus/nes/nes_pcb.hxx2
-rw-r--r--src/devices/bus/nes/nes_slot.h2
-rw-r--r--src/devices/bus/nes/pirate.cpp106
-rw-r--r--src/devices/bus/nes/pirate.h18
6 files changed, 77 insertions, 55 deletions
diff --git a/src/devices/bus/nes/nes_carts.cpp b/src/devices/bus/nes/nes_carts.cpp
index b22ac853406..16307334349 100644
--- a/src/devices/bus/nes/nes_carts.cpp
+++ b/src/devices/bus/nes/nes_carts.cpp
@@ -293,7 +293,7 @@ void nes_cart(device_slot_interface &device)
device.option_add_internal("xiaozy", NES_XIAOZY);
device.option_add_internal("edu2k", NES_EDU2K);
device.option_add_internal("t230", NES_T230);
- device.option_add_internal("mk2", NES_MK2);
+ device.option_add_internal("jy830623c", NES_JY830623C);
device.option_add_internal("unl_43272", NES_43272); // used in Gaau Hok Gwong Cheung
device.option_add_internal("tf1201", NES_TF1201);
device.option_add_internal("th21311", NES_TH21311);
diff --git a/src/devices/bus/nes/nes_ines.hxx b/src/devices/bus/nes/nes_ines.hxx
index 25b6b9c6d83..ac7454bb347 100644
--- a/src/devices/bus/nes/nes_ines.hxx
+++ b/src/devices/bus/nes/nes_ines.hxx
@@ -123,7 +123,7 @@ static const nes_mmc mmc_list[] =
{ 88, NAMCOT_34X3 },
{ 89, SUNSOFT_2 },
{ 90, JYCOMPANY_A },
- { 91, UNL_MK2 },
+ { 91, UNL_JY830623C },
{ 92, JALECO_JF19 },
{ 93, SUNSOFT_2 },
{ 94, STD_UN1ROM },
diff --git a/src/devices/bus/nes/nes_pcb.hxx b/src/devices/bus/nes/nes_pcb.hxx
index 3df5f0d5c43..3da6f033067 100644
--- a/src/devices/bus/nes/nes_pcb.hxx
+++ b/src/devices/bus/nes/nes_pcb.hxx
@@ -201,7 +201,7 @@ static const nes_pcb pcb_list[] =
{ "xiaozy", UNL_XIAOZY },
{ "edu2k", UNL_EDU2K },
{ "t230", UNL_T230 },
- { "mk2", UNL_MK2 },
+ { "jy830623c", UNL_JY830623C },
{ "zemina", ZEMINA_BOARD },
// misc bootleg boards
{ "ax40g", UNL_AX40G },
diff --git a/src/devices/bus/nes/nes_slot.h b/src/devices/bus/nes/nes_slot.h
index 5ae61d5a643..970390547af 100644
--- a/src/devices/bus/nes/nes_slot.h
+++ b/src/devices/bus/nes/nes_slot.h
@@ -112,7 +112,7 @@ enum
// Unlicensed
UNL_8237, UNL_8237A, UNL_CC21, UNL_AX40G, UNL_AX5705, UNL_KN42,
UNL_KOF97, UNL_N625092, UNL_SC127, UNL_SMB2J, UNL_T230, UNL_MMALEE,
- UNL_MK2, UNL_XIAOZY, UNL_KOF96, UNL_FS6,
+ UNL_JY830623C, UNL_XIAOZY, UNL_KOF96, UNL_FS6,
UNL_SF3, UNL_RACERMATE, UNL_EDU2K,
UNL_STUDYNGAME, UNL_603_5052, UNL_H2288, UNL_158B, UNL_2708,
UNL_MALISB, UNL_AC08, UNL_A9746, UNL_43272, UNL_TF1201, UNL_TH21311,
diff --git a/src/devices/bus/nes/pirate.cpp b/src/devices/bus/nes/pirate.cpp
index b6384d434b9..e846f164c7a 100644
--- a/src/devices/bus/nes/pirate.cpp
+++ b/src/devices/bus/nes/pirate.cpp
@@ -43,7 +43,7 @@ DEFINE_DEVICE_TYPE(NES_DAOU306, nes_daou306_device, "nes_daou306", "
DEFINE_DEVICE_TYPE(NES_CC21, nes_cc21_device, "nes_cc21", "NES Cart CC-21 PCB")
DEFINE_DEVICE_TYPE(NES_XIAOZY, nes_xiaozy_device, "nes_xiaozy", "NES Cart Xiao Zhuan Yuan PCB")
DEFINE_DEVICE_TYPE(NES_EDU2K, nes_edu2k_device, "nes_edu2k", "NES Cart Educational Computer 2000 PCB")
-DEFINE_DEVICE_TYPE(NES_MK2, nes_mk2_device, "nes_mk2", "NES Cart Mortal Kombat 2 PCB")
+DEFINE_DEVICE_TYPE(NES_JY830623C, nes_jy830623c_device, "nes_jy830623c", "NES Cart JY830623C PCB")
DEFINE_DEVICE_TYPE(NES_43272, nes_43272_device, "nes_43272", "NES Cart UNL-43272 PCB")
DEFINE_DEVICE_TYPE(NES_EH8813A, nes_eh8813a_device, "nes_eh8813a", "NES Cart UNL-EH8813A PCB")
@@ -93,8 +93,8 @@ nes_edu2k_device::nes_edu2k_device(const machine_config &mconfig, const char *ta
{
}
-nes_mk2_device::nes_mk2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : nes_nrom_device(mconfig, NES_MK2, tag, owner, clock), m_irq_count(0), m_irq_count_latch(0), m_irq_clear(0), m_irq_enable(0)
+nes_jy830623c_device::nes_jy830623c_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+ : nes_nrom_device(mconfig, NES_JY830623C, tag, owner, clock), m_latch(0), m_irq_count(0), m_irq_count_latch(0), m_irq_enable(0)
{
}
@@ -217,24 +217,23 @@ void nes_edu2k_device::pcb_reset()
m_latch = 0;
}
-void nes_mk2_device::device_start()
+void nes_jy830623c_device::device_start()
{
common_start();
- save_item(NAME(m_irq_clear));
+ save_item(NAME(m_latch));
+ save_item(NAME(m_reg));
save_item(NAME(m_irq_enable));
save_item(NAME(m_irq_count));
save_item(NAME(m_irq_count_latch));
}
-void nes_mk2_device::pcb_reset()
+void nes_jy830623c_device::pcb_reset()
{
- m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM;
- prg16_89ab(m_prg_chunks - 1);
- prg16_cdef(m_prg_chunks - 1);
- chr8(0, m_chr_source);
+ m_latch = 0;
+ std::fill(std::begin(m_reg), std::end(m_reg), 0x00);
+ update_banks();
set_nt_mirroring(PPU_MIRROR_VERT);
- m_irq_clear = 0;
m_irq_enable = 0;
m_irq_count = m_irq_count_latch = 0;
}
@@ -625,70 +624,89 @@ uint8_t nes_edu2k_device::read_m(offs_t offset)
/*-------------------------------------------------
- Bootleg Board for MK2
+ Bootleg Board JY830623C
Games: Mortal Kombat II, Street Fighter III, Super Mario
Kart Rider
- This board uses an IRQ system very similar to MMC3. We indeed
- use mapper4_irq, but there is some small glitch!
-
iNES: mapper 91
- In MESS: Supported.
+ In MAME: Partially supported.
+
+ FIXME: IRQ is fixed length but not every 7 scanlines
+ as done here. Rather it triggers once every 64 rises
+ of PPU A12. Various games have very obvious raster-
+ split issues from this bug. Also note there is
+ another submapper with cycle-based IRQ.
-------------------------------------------------*/
-// Same IRQ as MMC3
-void nes_mk2_device::hblank_irq( int scanline, int vblank, int blanked )
+void nes_jy830623c_device::hblank_irq(int scanline, int vblank, int blanked)
{
if (scanline < ppu2c0x_device::BOTTOM_VISIBLE_SCANLINE)
{
int prior_count = m_irq_count;
- if ((m_irq_count == 0) || m_irq_clear)
- m_irq_count = m_irq_count_latch;
- else
+ if (m_irq_count)
m_irq_count--;
+ else
+ m_irq_count = m_irq_count_latch;
- if (m_irq_enable && !blanked && (m_irq_count == 0) && (prior_count || m_irq_clear))
+ if (m_irq_enable && !blanked && !m_irq_count && prior_count)
{
LOG_MMC(("irq fired, scanline: %d\n", scanline));
- hold_irq_line();
+ set_irq_line(ASSERT_LINE);
}
}
- m_irq_clear = 0;
}
-void nes_mk2_device::write_m(offs_t offset, uint8_t data)
+void nes_jy830623c_device::update_banks()
{
- LOG_MMC(("mk2 write_m, offset: %04x, data: %02x\n", offset, data));
+ prg8_89((m_latch & 0x06) << 3 | m_reg[4]);
+ prg8_ab((m_latch & 0x06) << 3 | m_reg[5]);
+ prg16_cdef((m_latch & 0x06) << 2 | 0x07);
+
+ for (int i = 0; i < 4; i++)
+ chr2_x(2 * i, (m_latch & 1) << 8 | m_reg[i], CHRROM);
+}
- switch (offset & 0x1000)
+void nes_jy830623c_device::write_m(offs_t offset, u8 data)
+{
+ LOG_MMC(("jy830623c write_m, offset: %04x, data: %02x\n", offset, data));
+
+ switch (offset & 0x1003)
{
case 0x0000:
- switch (offset & 0x03)
- {
- case 0x00: chr2_0(data, CHRROM); break;
- case 0x01: chr2_2(data, CHRROM); break;
- case 0x02: chr2_4(data, CHRROM); break;
- case 0x03: chr2_6(data, CHRROM); break;
- }
- break;
+ case 0x0001:
+ case 0x0002:
+ case 0x0003:
case 0x1000:
- switch (offset & 0x03)
- {
- case 0x00: prg8_89(data); break;
- case 0x01: prg8_ab(data); break;
- case 0x02: m_irq_enable = 0; m_irq_count = 0; break;
- case 0x03: m_irq_enable = 1; m_irq_count = 7; break;
- }
+ case 0x1001:
+ m_reg[bitswap<3>(offset, 12, 1, 0)] = data;
+ update_banks();
+ break;
+ case 0x1002:
+ m_irq_enable = 0;
+ m_irq_count = 0;
+ set_irq_line(CLEAR_LINE);
break;
- default:
- logerror("mk2 write_m, uncaught addr: %04x value: %02x\n", offset + 0x6000, data);
+ case 0x1003:
+ m_irq_enable = 1;
+ m_irq_count = 7;
break;
}
}
+void nes_jy830623c_device::write_h(offs_t offset, u8 data)
+{
+ LOG_MMC(("jy830623c write_h, offset: %04x, data: %02x\n", offset, data));
+
+ if (offset < 0x2000)
+ {
+ m_latch = offset;
+ update_banks();
+ }
+}
+
/*-------------------------------------------------
UNL-43272
diff --git a/src/devices/bus/nes/pirate.h b/src/devices/bus/nes/pirate.h
index b2b1b5ccaa5..a94f541b498 100644
--- a/src/devices/bus/nes/pirate.h
+++ b/src/devices/bus/nes/pirate.h
@@ -178,15 +178,16 @@ private:
};
-// ======================> nes_mk2_device
+// ======================> nes_jy830623c_device
-class nes_mk2_device : public nes_nrom_device
+class nes_jy830623c_device : public nes_nrom_device
{
public:
// construction/destruction
- nes_mk2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ nes_jy830623c_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
- virtual void write_m(offs_t offset, uint8_t data) override;
+ virtual void write_m(offs_t offset, u8 data) override;
+ virtual void write_h(offs_t offset, u8 data) override;
virtual void hblank_irq(int scanline, int vblank, int blanked) override;
virtual void pcb_reset() override;
@@ -196,8 +197,11 @@ protected:
virtual void device_start() override;
private:
- uint16_t m_irq_count, m_irq_count_latch;
- uint8_t m_irq_clear;
+ void update_banks();
+ u8 m_latch;
+ u8 m_reg[6];
+
+ u16 m_irq_count, m_irq_count_latch;
int m_irq_enable;
};
@@ -283,7 +287,7 @@ DECLARE_DEVICE_TYPE(NES_DAOU306, nes_daou306_device)
DECLARE_DEVICE_TYPE(NES_CC21, nes_cc21_device)
DECLARE_DEVICE_TYPE(NES_XIAOZY, nes_xiaozy_device)
DECLARE_DEVICE_TYPE(NES_EDU2K, nes_edu2k_device)
-DECLARE_DEVICE_TYPE(NES_MK2, nes_mk2_device)
+DECLARE_DEVICE_TYPE(NES_JY830623C, nes_jy830623c_device)
DECLARE_DEVICE_TYPE(NES_43272, nes_43272_device)
DECLARE_DEVICE_TYPE(NES_EH8813A, nes_eh8813a_device)
//DECLARE_DEVICE_TYPE(NES_FUJIYA, nes_fujiya_device)