mirror of
https://github.com/holub/mame
synced 2025-04-20 23:42:22 +03:00
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).
This commit is contained in:
parent
756616a2b5
commit
b1dcb15ba2
12
hash/nes.xml
12
hash/nes.xml
@ -63970,10 +63970,10 @@ We don't include these hacks because they were not burned into real carts nor so
|
||||
|
||||
<software name="pocohon">
|
||||
<description>Pocohontos (Asia)</description>
|
||||
<year>19??</year>
|
||||
<publisher><unknown></publisher>
|
||||
<year>1997</year>
|
||||
<publisher>Hosenkan</publisher>
|
||||
<part name="cart" interface="nes_cart">
|
||||
<feature name="slot" value="hosenkan" />
|
||||
<feature name="slot" value="sg_lionk" />
|
||||
<feature name="pcb" value="UNL-HOSENKAN" />
|
||||
<dataarea name="chr" size="262144">
|
||||
<rom name="pocohontos (199x)(-)(as)[p].chr" size="262144" crc="f995a526" sha1="3829b9da7a1a55e4b8d3f89e91d535ffa6004224" offset="00000" status="baddump" />
|
||||
@ -66665,10 +66665,10 @@ All musics were removed in this game.
|
||||
|
||||
<software name="sdkong">
|
||||
<description>Super Donkey Kong (Asia)</description>
|
||||
<year>19??</year>
|
||||
<publisher><unknown></publisher>
|
||||
<year>1997?</year>
|
||||
<publisher>Hosenkan</publisher>
|
||||
<part name="cart" interface="nes_cart">
|
||||
<feature name="slot" value="hosenkan" />
|
||||
<feature name="slot" value="sg_lionk" />
|
||||
<feature name="pcb" value="UNL-HOSENKAN" />
|
||||
<dataarea name="chr" size="131072">
|
||||
<rom name="super donkey kong (unl).chr" size="131072" crc="d0883ac5" sha1="63a66b7f17e8520cb88916893c0a4200caa06365" offset="00000" status="baddump" />
|
||||
|
@ -2812,8 +2812,6 @@ if (BUSES["NES"]~=null) then
|
||||
MAME_DIR .. "src/devices/bus/nes/henggedianzi.h",
|
||||
MAME_DIR .. "src/devices/bus/nes/hes.cpp",
|
||||
MAME_DIR .. "src/devices/bus/nes/hes.h",
|
||||
MAME_DIR .. "src/devices/bus/nes/hosenkan.cpp",
|
||||
MAME_DIR .. "src/devices/bus/nes/hosenkan.h",
|
||||
MAME_DIR .. "src/devices/bus/nes/irem.cpp",
|
||||
MAME_DIR .. "src/devices/bus/nes/irem.h",
|
||||
MAME_DIR .. "src/devices/bus/nes/jaleco.cpp",
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -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
|
@ -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));
|
||||
@ -1131,46 +1136,6 @@ void nes_sglionk_device::write_h(offs_t offset, u8 data)
|
||||
txrom_write(addr & 0x6001, 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)
|
||||
|
@ -138,29 +138,46 @@ 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;
|
||||
};
|
||||
|
||||
|
||||
// ======================> nes_sglionk_device
|
||||
|
||||
class nes_sglionk_device : public nes_kasing_device
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
nes_sglionk_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
|
||||
|
||||
virtual void write_h(offs_t offset, u8 data) override;
|
||||
|
||||
protected:
|
||||
// construction/destruction
|
||||
nes_sglionk_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
|
||||
|
||||
private:
|
||||
int m_board;
|
||||
};
|
||||
|
||||
@ -175,28 +192,6 @@ public:
|
||||
};
|
||||
|
||||
|
||||
// ======================> nes_kasing_device
|
||||
|
||||
class nes_kasing_device : public nes_txrom_device
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
nes_kasing_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
virtual void write_m(offs_t offset, uint8_t data) override;
|
||||
virtual void prg_cb(int start, int bank) override;
|
||||
|
||||
virtual void pcb_reset() override;
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
|
||||
private:
|
||||
uint8_t m_reg;
|
||||
};
|
||||
|
||||
|
||||
// ======================> nes_kay_device
|
||||
|
||||
class nes_kay_device : public nes_txrom_device
|
||||
|
@ -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)
|
||||
|
@ -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 },
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user