summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus
diff options
context:
space:
mode:
author 0kmg <9137159+0kmg@users.noreply.github.com>2021-08-26 14:56:18 -0800
committer 0kmg <9137159+0kmg@users.noreply.github.com>2021-08-26 15:21:48 -0800
commitb1dcb15ba28eaee2908f17dcd3355f4415620f0a (patch)
tree6d7081c8d336a5fa0e4416ad653375c3ebbf786d /src/devices/bus
parent756616a2b56721de803861521e27b3161019d0ca (diff)
bus/nes: Simplified a few related boards by Kasheng and Hosenkan.
- Reduced redundant code by making "kasing" device parent class for sglionk/sgboog. The latter are identical save for the extended register/address scrambling. - Eliminated hosenkan device altogether (mapper 182). It is identical to sglionk (mapper 114).
Diffstat (limited to 'src/devices/bus')
-rw-r--r--src/devices/bus/nes/hosenkan.cpp159
-rw-r--r--src/devices/bus/nes/hosenkan.h39
-rw-r--r--src/devices/bus/nes/mmc3_clones.cpp111
-rw-r--r--src/devices/bus/nes/mmc3_clones.h43
-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.hxx1
-rw-r--r--src/devices/bus/nes/nes_slot.h2
8 files changed, 59 insertions, 300 deletions
diff --git a/src/devices/bus/nes/hosenkan.cpp b/src/devices/bus/nes/hosenkan.cpp
deleted file mode 100644
index ae7749b7e9a..00000000000
--- a/src/devices/bus/nes/hosenkan.cpp
+++ /dev/null
@@ -1,159 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Fabio Priuli
-/***********************************************************************************************************
-
-
- NES/Famicom cartridge emulation for Hosenkan PCBs
-
-
- ***********************************************************************************************************/
-
-
-#include "emu.h"
-#include "hosenkan.h"
-
-#include "video/ppu2c0x.h" // this has to be included so that IRQ functions can access ppu2c0x_device::BOTTOM_VISIBLE_SCANLINE
-#include "screen.h"
-
-
-#ifdef NES_PCB_DEBUG
-#define VERBOSE 1
-#else
-#define VERBOSE 0
-#endif
-
-#define LOG_MMC(x) do { if (VERBOSE) logerror x; } while (0)
-
-
-//-------------------------------------------------
-// constructor
-//-------------------------------------------------
-
-DEFINE_DEVICE_TYPE(NES_HOSENKAN, nes_hosenkan_device, "nes_hosenkan", "NES Cart HOSENKAN PCB")
-
-
-nes_hosenkan_device::nes_hosenkan_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : nes_nrom_device(mconfig, NES_HOSENKAN, tag, owner, clock)
- , m_irq_count(0)
- , m_irq_count_latch(0)
- , m_irq_clear(0)
- , m_irq_enable(0)
- , m_latch(0)
-{
-}
-
-
-
-
-void nes_hosenkan_device::device_start()
-{
- common_start();
- save_item(NAME(m_irq_enable));
- save_item(NAME(m_irq_count));
- save_item(NAME(m_irq_count_latch));
- save_item(NAME(m_irq_clear));
- save_item(NAME(m_latch));
-}
-
-void nes_hosenkan_device::pcb_reset()
-{
- m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM;
- prg32((m_prg_chunks - 1) >> 1);
- chr8(0, m_chr_source);
-
- m_latch = 0;
- m_irq_enable = 0;
- m_irq_count = m_irq_count_latch = 0;
- m_irq_clear = 0;
-}
-
-
-
-/*-------------------------------------------------
- mapper specific handlers
- -------------------------------------------------*/
-
-/*-------------------------------------------------
-
- Bootleg Board by Hosenkan
-
- Games: Pocahontas, Super Donkey Kong
-
- iNES: mapper 182
-
- In MESS: Supported.
-
- -------------------------------------------------*/
-
-// same as MMC3!
-void nes_hosenkan_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
- m_irq_count--;
-
- if (m_irq_enable && !blanked && (m_irq_count == 0) && (prior_count || m_irq_clear))
- {
- LOG_MMC(("irq fired, scanline: %d\n", scanline));
- hold_irq_line();
- }
- }
- m_irq_clear = 0;
-}
-
-void nes_hosenkan_device::write_h(offs_t offset, uint8_t data)
-{
- LOG_MMC(("hosenkan write_h, offset: %04x, data: %02x\n", offset, data));
-
- switch (offset & 0x7003)
- {
- case 0x0001:
- set_nt_mirroring(BIT(data, 0) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
- break;
- case 0x2000:
- m_latch = data;
- break;
- case 0x4000:
- switch (m_latch)
- {
- case 0:
- chr2_0(data >> 1, CHRROM);
- break;
- case 1:
- chr1_5(data, CHRROM);
- break;
- case 2:
- chr2_2(data >> 1, CHRROM);
- break;
- case 3:
- chr1_7(data, CHRROM);
- break;
- case 4:
- prg8_89(data);
- break;
- case 5:
- prg8_ab(data);
- break;
- case 6:
- chr1_4(data, CHRROM);
- break;
- case 7:
- chr1_6(data, CHRROM);
- break;
- }
- break;
- case 0x6003:
- if (data)
- {
- m_irq_count = data;
- m_irq_enable = 1;
- }
- else
- m_irq_enable = 0;
- break;
- }
-}
diff --git a/src/devices/bus/nes/hosenkan.h b/src/devices/bus/nes/hosenkan.h
deleted file mode 100644
index 163aef76edc..00000000000
--- a/src/devices/bus/nes/hosenkan.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Fabio Priuli
-#ifndef MAME_BUS_NES_HOSENKAN_H
-#define MAME_BUS_NES_HOSENKAN_H
-
-#pragma once
-
-#include "nxrom.h"
-
-
-// ======================> nes_hosenkan_device
-
-class nes_hosenkan_device : public nes_nrom_device
-{
-public:
- // construction/destruction
- nes_hosenkan_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
- virtual void write_h(offs_t offset, uint8_t data) override;
-
- virtual void hblank_irq(int scanline, int vblank, int blanked) override;
- virtual void pcb_reset() override;
-
-protected:
- // device-level overrides
- virtual void device_start() override;
-
-private:
- uint16_t m_irq_count, m_irq_count_latch;
- uint8_t m_irq_clear;
- int m_irq_enable;
-
- uint8_t m_latch;
-};
-
-// device type definition
-DECLARE_DEVICE_TYPE(NES_HOSENKAN, nes_hosenkan_device)
-
-#endif // MAME_BUS_NES_HOSENKAN_H
diff --git a/src/devices/bus/nes/mmc3_clones.cpp b/src/devices/bus/nes/mmc3_clones.cpp
index 67b5f5796ca..7bf1a4ebaf4 100644
--- a/src/devices/bus/nes/mmc3_clones.cpp
+++ b/src/devices/bus/nes/mmc3_clones.cpp
@@ -124,8 +124,18 @@ nes_8237a_device::nes_8237a_device(const machine_config &mconfig, const char *ta
{
}
+nes_kasing_device::nes_kasing_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock)
+ : nes_txrom_device(mconfig, type, tag, owner, clock), m_mmc3_mode(true)
+{
+}
+
+nes_kasing_device::nes_kasing_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+ : nes_kasing_device(mconfig, NES_KASING, tag, owner, clock)
+{
+}
+
nes_sglionk_device::nes_sglionk_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock)
- : nes_txrom_device(mconfig, type, tag, owner, clock), m_mmc3_mode(true), m_board(type == NES_SG_BOOG)
+ : nes_kasing_device(mconfig, type, tag, owner, clock), m_board(type == NES_SG_BOOG)
{
}
@@ -139,11 +149,6 @@ nes_sgboog_device::nes_sgboog_device(const machine_config &mconfig, const char *
{
}
-nes_kasing_device::nes_kasing_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : nes_txrom_device(mconfig, NES_KASING, tag, owner, clock), m_reg(0)
-{
-}
-
nes_kay_device::nes_kay_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: nes_txrom_device(mconfig, NES_KAY, tag, owner, clock), m_low_reg(0)
{
@@ -379,35 +384,20 @@ void nes_8237_device::pcb_reset()
update_banks();
}
-void nes_sglionk_device::device_start()
-{
- mmc3_start();
- save_item(NAME(m_mmc3_mode));
-}
-
-void nes_sglionk_device::pcb_reset()
-{
- m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM;
-
- m_mmc3_mode = true;
- mmc3_common_initialize(0xff, 0xff, 0);
-}
-
void nes_kasing_device::device_start()
{
mmc3_start();
- save_item(NAME(m_reg));
+ save_item(NAME(m_mmc3_mode));
}
void nes_kasing_device::pcb_reset()
{
m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM;
- m_reg = 0;
+ m_mmc3_mode = true;
mmc3_common_initialize(0xff, 0xff, 0);
}
-
void nes_kay_device::device_start()
{
mmc3_start();
@@ -1064,30 +1054,28 @@ void nes_8237_device::write_h(offs_t offset, u8 data)
/*-------------------------------------------------
- Bootleg Board by Super Game
+ Bootleg Board by Kasing
- Games: The Lion King, Aladdin, Boogerman
+ Games: AV Jiu Ji Mahjong, Bao Qing Tian, Thunderbolt 2,
+ Shisen Mahjong 2, Garou Densetsu Special
- MMC3 clone with register and address scrambling and
- a few extra banking modes by writing 0x6000-0x7fff.
+ MMC3 clone with extra banking modes at 0x6000-0x7fff.
- iNES: mapper 114
+ iNES: mapper 115
In MAME: Supported.
- TODO: pocohon and sdkong should also work on this device.
-
-------------------------------------------------*/
-void nes_sglionk_device::prg_cb(int start, int bank)
+void nes_kasing_device::prg_cb(int start, int bank)
{
if (m_mmc3_mode)
nes_txrom_device::prg_cb(start, bank);
}
-void nes_sglionk_device::write_m(offs_t offset, u8 data)
+void nes_kasing_device::write_m(offs_t offset, u8 data)
{
- LOG_MMC(("sglionk write_m, offset: %04x, data: %02x\n", offset, data));
+ LOG_MMC(("kasing write_m, offset: %04x, data: %02x\n", offset, data));
if (BIT(offset, 0))
{
@@ -1109,6 +1097,23 @@ void nes_sglionk_device::write_m(offs_t offset, u8 data)
}
}
+/*-------------------------------------------------
+
+ Bootleg Boards by Super Game and Hosenkan
+
+ Games: The Lion King, Aladdin, Boogerman, Pocohon,
+ Super Donkey Kong
+
+ MMC3 clone with register and address scrambling and
+ a few extra banking modes by writing 0x6000-0x7fff.
+ This is the same as mapper 115 with scrambling.
+
+ iNES: mapper 114 (and 182)
+
+ In MAME: Supported.
+
+ -------------------------------------------------*/
+
void nes_sglionk_device::write_h(offs_t offset, u8 data)
{
LOG_MMC(("sglionk write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1133,46 +1138,6 @@ void nes_sglionk_device::write_h(offs_t offset, u8 data)
/*-------------------------------------------------
- Bootleg Board by Kasing
-
- Games: AV Jiu Ji Mahjong, Bao Qing Tian, Thunderbolt 2,
- Shisen Mahjong 2
-
- MMC3 clone
-
- iNES: mapper 115
-
- In MESS: Supported
-
- -------------------------------------------------*/
-
-void nes_kasing_device::prg_cb(int start, int bank)
-{
- if (BIT(m_reg, 7))
- prg32(m_reg >> 1);
- else
- prg8_x(start, bank);
-}
-
-void nes_kasing_device::write_m(offs_t offset, uint8_t data)
-{
- LOG_MMC(("kasing write_m, offset: %04x, data: %02x\n", offset, data));
-
- switch (offset & 0x01)
- {
- case 0x00:
- m_reg = data;
- set_prg(m_prg_base, m_prg_mask);
- break;
- case 0x01:
- m_chr_base = (data & 0x01) ? 0x100 : 0x000;
- set_chr(m_chr_source, m_chr_base, m_chr_mask);
- break;
- }
-}
-
-/*-------------------------------------------------
-
Bootleg Board by Kay (for Panda Prince)
Games: The Panda Prince, Sonic 3d Blast 6, SFZ2 '97, YuYu '97
diff --git a/src/devices/bus/nes/mmc3_clones.h b/src/devices/bus/nes/mmc3_clones.h
index 5a86c613236..551d5552ebb 100644
--- a/src/devices/bus/nes/mmc3_clones.h
+++ b/src/devices/bus/nes/mmc3_clones.h
@@ -138,62 +138,57 @@ public:
};
-// ======================> nes_sglionk_device
+// ======================> nes_kasing_device
-class nes_sglionk_device : public nes_txrom_device
+class nes_kasing_device : public nes_txrom_device
{
public:
// construction/destruction
- nes_sglionk_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
+ nes_kasing_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
virtual void write_m(offs_t offset, u8 data) override;
- virtual void write_h(offs_t offset, u8 data) override;
virtual void prg_cb(int start, int bank) override;
virtual void pcb_reset() override;
protected:
// construction/destruction
- nes_sglionk_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
+ nes_kasing_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
// device-level overrides
virtual void device_start() override;
private:
bool m_mmc3_mode;
- int m_board;
};
-// ======================> nes_sgboog_device
+// ======================> nes_sglionk_device
-class nes_sgboog_device : public nes_sglionk_device
+class nes_sglionk_device : public nes_kasing_device
{
public:
// construction/destruction
- nes_sgboog_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
-};
-
+ nes_sglionk_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
-// ======================> nes_kasing_device
+ virtual void write_h(offs_t offset, u8 data) override;
-class nes_kasing_device : public nes_txrom_device
-{
-public:
+protected:
// construction/destruction
- nes_kasing_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ nes_sglionk_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
- virtual void write_m(offs_t offset, uint8_t data) override;
- virtual void prg_cb(int start, int bank) override;
+private:
+ int m_board;
+};
- virtual void pcb_reset() override;
-protected:
- // device-level overrides
- virtual void device_start() override;
+// ======================> nes_sgboog_device
-private:
- uint8_t m_reg;
+class nes_sgboog_device : public nes_sglionk_device
+{
+public:
+ // construction/destruction
+ nes_sgboog_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
};
diff --git a/src/devices/bus/nes/nes_carts.cpp b/src/devices/bus/nes/nes_carts.cpp
index 1c03f5f625a..f42e319c292 100644
--- a/src/devices/bus/nes/nes_carts.cpp
+++ b/src/devices/bus/nes/nes_carts.cpp
@@ -41,7 +41,6 @@
#include "ggenie.h"
#include "hes.h"
#include "henggedianzi.h"
-#include "hosenkan.h"
#include "jy.h"
#include "kaiser.h"
#include "legacy.h"
@@ -250,7 +249,6 @@ void nes_cart(device_slot_interface &device)
device.option_add_internal("hengg_xhzs", NES_HENGG_XHZS);
device.option_add_internal("hengg_shjy3", NES_HENGG_SHJY3); // mapper 253
device.option_add_internal("hes", NES_HES);
- device.option_add_internal("hosenkan", NES_HOSENKAN);
device.option_add_internal("ks106c", NES_KS106C); // mapper 352
device.option_add_internal("ks202", NES_KS202); // mapper 56
device.option_add_internal("ks7010", NES_KS7010); // used in Akumajo Dracula (FDS Conversion)
diff --git a/src/devices/bus/nes/nes_ines.hxx b/src/devices/bus/nes/nes_ines.hxx
index 7da9adc453c..63f435afc52 100644
--- a/src/devices/bus/nes/nes_ines.hxx
+++ b/src/devices/bus/nes/nes_ines.hxx
@@ -215,7 +215,7 @@ static const nes_mmc mmc_list[] =
{ 179, HENGG_XHZS },
{ 180, UXROM_CC },
// 181 Unused
- { 182, HOSENKAN_BOARD },
+ { 182, SUPERGAME_LIONKING }, // duplicate of mapper 114
{ 183, BTL_SHUIGUAN },
{ 184, SUNSOFT_1 },
{ 185, STD_CNROM },
diff --git a/src/devices/bus/nes/nes_pcb.hxx b/src/devices/bus/nes/nes_pcb.hxx
index c92ad5b49af..c01f523125c 100644
--- a/src/devices/bus/nes/nes_pcb.hxx
+++ b/src/devices/bus/nes/nes_pcb.hxx
@@ -162,7 +162,6 @@ static const nes_pcb pcb_list[] =
{ "hengg_xhzs", HENGG_XHZS },
{ "hengg_shjy3", HENGG_SHJY3 }, // mapper 253
{ "hes", HES_BOARD },
- { "hosenkan", HOSENKAN_BOARD },
{ "ks106c", KAISER_KS106C }, // mapper 352
{ "ks202", KAISER_KS202 }, // mapper 56
{ "ks7010", KAISER_KS7010 }, // used in Akumajo Dracula (FDS Conversion)
diff --git a/src/devices/bus/nes/nes_slot.h b/src/devices/bus/nes/nes_slot.h
index 80225ea9199..ee3f582ae2a 100644
--- a/src/devices/bus/nes/nes_slot.h
+++ b/src/devices/bus/nes/nes_slot.h
@@ -136,7 +136,7 @@ enum
WAIXING_TYPE_I, WAIXING_TYPE_J, WAIXING_FS304,
WAIXING_SGZLZ, WAIXING_SGZ, WAIXING_WXZS, WAIXING_SECURITY, WAIXING_SH2,
WAIXING_DQ8, WAIXING_FFV, WAIXING_WXZS2, SUPERGAME_LIONKING, SUPERGAME_BOOGERMAN,
- KAY_BOARD, HOSENKAN_BOARD, NITRA_TDA, GOUDER_37017, NANJING_BOARD, ZEMINA_BOARD,
+ KAY_BOARD, NITRA_TDA, GOUDER_37017, NANJING_BOARD, ZEMINA_BOARD,
NOCASH_NOCHR, // homebrew PCB design which uses NTRAM for CHRRAM
UNL_ACTION53, // homebrew PCB for homebrew multicarts
UNL_CUFROM, UNL_UNROM512, UNL_2A03PURITANS, // homebrew PCBs