bus/nes: Work on Tengen boards. (#9594)

New NOT_WORKING software list additions (nes.xml)
---------------------------------------
Skull & Crossbones (Korea) [MLX]
This commit is contained in:
0kmg 2022-04-21 04:50:15 -08:00 committed by GitHub
parent 11f5de6ed7
commit f4acd7279e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 176 additions and 206 deletions

View File

@ -39242,7 +39242,7 @@ license:CC0
<publisher>Tengen</publisher>
<info name="serial" value="TGN-002-TT"/>
<part name="cart" interface="nes_cart">
<feature name="slot" value="tengen_800008" />
<feature name="slot" value="sa0037" />
<feature name="pcb" value="TENGEN-800008" />
<feature name="mirroring" value="vertical" />
<dataarea name="prg" size="32768">
@ -54569,11 +54569,11 @@ preliminary proto for the PAL version, still running on NTSC systems) or the gfx
</software>
<software name="tai16mj">
<description>Taiwan Mahjong - Tai Wan Ma Que 16 (Tw)</description>
<description>Taiwan Mahjong - Tai Wan Ma Que 16 (Taiwan)</description>
<year>1989</year>
<publisher>Sachen</publisher>
<info name="serial" value="SA-001"/>
<info name="alt_title" value="台灣麻將"/>
<info name="alt_title" value="臺灣麻雀"/>
<part name="cart" interface="nes_cart">
<feature name="slot" value="sa0036" />
<feature name="pcb" value="UNL-SA-0036" />
@ -54588,9 +54588,10 @@ preliminary proto for the PAL version, still running on NTSC systems) or the gfx
</software>
<software name="tai16mja" cloneof="tai16mj">
<description>Taiwan Mahjong - Tai Wan Ma Que 16 (Tw, Alt)</description>
<description>Taiwan Mahjong - Tai Wan Ma Que 16 (Taiwan, alt)</description>
<year>1989</year>
<publisher>Sachen</publisher>
<info name="alt_title" value="臺灣麻雀"/>
<part name="cart" interface="nes_cart">
<feature name="slot" value="sa0036" />
<feature name="pcb" value="UNL-SA-0036" />
@ -54605,9 +54606,10 @@ preliminary proto for the PAL version, still running on NTSC systems) or the gfx
</software>
<software name="tai16mjb" cloneof="tai16mj">
<description>Taiwan Mahjong - Tai Wan Ma Que 16 (Tw, Pirate?)</description>
<description>Taiwan Mahjong - Tai Wan Ma Que 16 (Asia, pirate?)</description>
<year>1989</year>
<publisher>&lt;pirate&gt;</publisher>
<info name="alt_title" value="麻雀16"/>
<part name="cart" interface="nes_cart">
<feature name="slot" value="cnrom" />
<feature name="pcb" value="NES-CNROM" />
@ -56101,6 +56103,77 @@ preliminary proto for the PAL version, still running on NTSC systems) or the gfx
</part>
</software>
<!-- Haitai (Supercom) -->
<software name="blackdrg" cloneof="chaldrgn">
<description>Black Dragon (Korea)</description>
<year>1991</year>
<publisher>Haitai</publisher>
<info name="alt_title" value="블랙 드래곤"/>
<part name="cart" interface="nes_cart">
<feature name="slot" value="discrete_74x377" />
<feature name="pcb" value="COLORDREAMS-74*377" />
<feature name="mirroring" value="vertical" />
<dataarea name="prg" size="65536">
<rom name="beullaeg deulaegon.prg" size="65536" crc="93e2b8ef" sha1="1cbaf9aa401c7714a1673995d376574ecbee6943" />
</dataarea>
<dataarea name="chr" size="65536">
<rom name="beullaeg deulaegon.chr" size="65536" crc="367c87df" sha1="5290455811e31adc8ad7c0b508bb9623a117920f" />
</dataarea>
</part>
</software>
<software name="flyingsb" cloneof="menaceb">
<description>Nar-ara Superboy (Korea)</description>
<year>1991?</year>
<publisher>Haitai</publisher>
<info name="alt_title" value="날아라 슈퍼보이"/>
<part name="cart" interface="nes_cart">
<feature name="slot" value="discrete_74x377" />
<feature name="pcb" value="COLORDREAMS-74*377" />
<feature name="mirroring" value="vertical" />
<dataarea name="prg" size="65536">
<rom name="flying superboy.prg" size="65536" crc="28acc254" sha1="225894caec0ffb9ae75b317421ab609c7455c0eb" />
</dataarea>
<dataarea name="chr" size="65536">
<rom name="flying superboy.chr" size="65536" crc="e9b4810d" sha1="7ca6956f689ee714283d7d0d9b9922448fefce88" />
</dataarea>
</part>
</software>
<software name="skullxbk" cloneof="skullxb" supported="no">
<description>Skull &amp; Crossbones (Korea)</description>
<year>1991</year>
<publisher>Haitai</publisher>
<part name="cart" interface="nes_cart">
<feature name="slot" value="tengen_800032" />
<feature name="pcb" value="TENGEN-800032" />
<dataarea name="prg" size="131072">
<rom name="skull &amp; crossbones (supercom).prg" size="131072" crc="0857df48" sha1="fa5b2faa0d5ad1bc342f57d5852f8baba7cd3005" />
</dataarea>
<dataarea name="chr" size="65536">
<rom name="skull &amp; crossbones (supercom).chr" size="65536" crc="88a6516d" sha1="3abdd977885259c93aef59d427c9455a7f8ee6b9" />
</dataarea>
</part>
</software>
<software name="toobink" cloneof="toobin">
<description>Toobin' (Korea)</description>
<year>1991?</year>
<publisher>Haitai</publisher>
<info name="alt_title" value="튜브탐험"/>
<part name="cart" interface="nes_cart">
<feature name="slot" value="namcot_3433" />
<feature name="mirroring" value="horizontal" />
<dataarea name="prg" size="131072">
<rom name="toobin (k).prg" size="131072" crc="05d70600" sha1="4b6e17a1e86a46c766c3a85c990854a19b901ade" />
</dataarea>
<dataarea name="chr" size="65536">
<rom name="toobin (k).chr" size="65536" crc="f772fcfd" sha1="c3583fbaf4248baea80e98f3229ee20d6793c2ad" />
</dataarea>
</part>
</software>
<!-- Waixing ES-**** and clones -->
@ -64125,24 +64198,6 @@ preliminary proto for the PAL version, still running on NTSC systems) or the gfx
</part>
</software>
<software name="blackdrg" cloneof="chaldrgn">
<description>Black Dragon (Korea)</description>
<year>19??</year>
<publisher>Haitai</publisher>
<info name="alt_title" value="블랙 드래곤"/>
<part name="cart" interface="nes_cart">
<feature name="slot" value="discrete_74x377" />
<feature name="pcb" value="COLORDREAMS-74*377" />
<feature name="mirroring" value="vertical" />
<dataarea name="prg" size="65536">
<rom name="beullaeg deulaegon.prg" size="65536" crc="93e2b8ef" sha1="1cbaf9aa401c7714a1673995d376574ecbee6943" status="baddump" />
</dataarea>
<dataarea name="chr" size="65536">
<rom name="beullaeg deulaegon.chr" size="65536" crc="367c87df" sha1="5290455811e31adc8ad7c0b508bb9623a117920f" status="baddump"/>
</dataarea>
</part>
</software>
<software name="blockfrc">
<description>Block Force (Asia, Ripped from Tetris Family 9 in 1?)</description>
<year>19??</year>
@ -64942,24 +64997,6 @@ preliminary proto for the PAL version, still running on NTSC systems) or the gfx
</part>
</software>
<software name="flyingsb" cloneof="menaceb">
<description>Nar-ara Superboy (Korea)</description>
<year>199?</year>
<publisher>Haitai</publisher>
<info name="alt_title" value="날아라 슈퍼보이"/>
<part name="cart" interface="nes_cart">
<feature name="slot" value="discrete_74x377" />
<feature name="pcb" value="COLORDREAMS-74*377" />
<feature name="mirroring" value="vertical" />
<dataarea name="prg" size="65536">
<rom name="flying superboy.prg" size="65536" crc="28acc254" sha1="225894caec0ffb9ae75b317421ab609c7455c0eb" status="baddump" />
</dataarea>
<dataarea name="chr" size="65536">
<rom name="flying superboy.chr" size="65536" crc="e9b4810d" sha1="7ca6956f689ee714283d7d0d9b9922448fefce88" status="baddump" />
</dataarea>
</part>
</software>
<software name="fudomyodh" cloneof="demnswrd">
<description>Fudou Myouou Den (pirate)</description>
<year>19??</year>
@ -66590,23 +66627,6 @@ We don't include these hacks because they were not burned into real carts nor so
</part>
</software>
<software name="toobink" cloneof="toobin">
<description>Toobin' (Korea)</description>
<year>1991?</year>
<publisher>Haitai</publisher>
<info name="alt_title" value="튜브탐험"/>
<part name="cart" interface="nes_cart">
<feature name="slot" value="namcot_3433" />
<feature name="mirroring" value="horizontal" />
<dataarea name="prg" size="131072">
<rom name="toobin (k).prg" size="131072" crc="05d70600" sha1="4b6e17a1e86a46c766c3a85c990854a19b901ade" />
</dataarea>
<dataarea name="chr" size="65536">
<rom name="toobin (k).chr" size="65536" crc="f772fcfd" sha1="c3583fbaf4248baea80e98f3229ee20d6793c2ad" />
</dataarea>
</part>
</software>
<software name="toystory" supported="partial">
<description>Toy Story</description>
<year>19??</year>

View File

@ -221,7 +221,6 @@ void nes_cart(device_slot_interface &device)
device.option_add_internal("s74x374a", NES_SACHEN_74X374_ALT); // FIXME: Made up boards some different handling
device.option_add_internal("tcu01", NES_SACHEN_TCU01);
device.option_add_internal("tcu02", NES_SACHEN_TCU02);
device.option_add_internal("tengen_800008", NES_TENGEN_800008); // FIXME: Is this the same as CNROM?
device.option_add_internal("tengen_800032", NES_TENGEN_800032);
device.option_add_internal("tengen_800037", NES_TENGEN_800037);
device.option_add_internal("txc_22110", NES_TXC_22110);

View File

@ -129,7 +129,6 @@ static const nes_pcb pcb_list[] =
{ "tcu01", SACHEN_TCU01 },
{ "tcu02", SACHEN_TCU02 },
{ "sa9602b", SACHEN_SA9602B },
{ "tengen_800008", TENGEN_800008 }, /* FIXME: Is this the same as mapper 3? */
{ "tengen_800032", TENGEN_800032 },
{ "tengen_800037", TENGEN_800037 },
{ "txc_22110", TXC_22110 },

View File

@ -80,7 +80,7 @@ enum
TAITO_TC0190FMC, TAITO_TC0190FMCP,
TAITO_X1_005, TAITO_X1_017,
// Tengen
TENGEN_800008, TENGEN_800032, TENGEN_800037,
TENGEN_800032, TENGEN_800037,
// TXC
TXC_22110, TXC_22211, TXC_COMMANDOS, TXC_DUMARACING,
TXC_MJBLOCK, TXC_STRIKEW, TXC_TW,

View File

@ -9,8 +9,8 @@
Here we emulate the following PCBs
* Sachen SA-009 [mapper 160]
* Sachen SA-0036 [mapper 148]
* Sachen SA-0037 [mapper 149]
* Sachen SA-0036 [mapper 149]
* Sachen SA-0037 [mapper 148]
* Sachen SA-72007 [mapper 145]
* Sachen SA-72008 [mapper 133]
* Sachen TCA-01 [mapper 143]
@ -69,7 +69,7 @@ nes_sachen_sa009_device::nes_sachen_sa009_device(const machine_config &mconfig,
{
}
nes_sachen_sa0036_device::nes_sachen_sa0036_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
nes_sachen_sa0036_device::nes_sachen_sa0036_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: nes_nrom_device(mconfig, NES_SACHEN_SA0036, tag, owner, clock)
{
}
@ -274,30 +274,34 @@ void nes_sachen_sa009_device::write_l(offs_t offset, uint8_t data)
iNES: mapper 149
In MESS: Supported.
In MAME: Supported.
-------------------------------------------------*/
void nes_sachen_sa0036_device::write_h(offs_t offset, uint8_t data)
void nes_sachen_sa0036_device::write_h(offs_t offset, u8 data)
{
LOG_MMC(("sa0036 write_h, offset: %04x, data: %02x\n", offset, data));
// this pcb is subject to bus conflict
data = account_bus_conflict(offset, data);
chr8(data >> 7, CHRROM);
}
/*-------------------------------------------------
Sachen SA0037 bootleg boards
Tengen 800008 board
Games: Mahjong World, Shisen Mahjong
Games: Mahjong World, Shisen Mahjong, Tengen Tetris
iNES: mapper 148
In MESS: Supported.
In MAME: Supported.
-------------------------------------------------*/
void nes_sachen_sa0037_device::write_h(offs_t offset, uint8_t data)
void nes_sachen_sa0037_device::write_h(offs_t offset, u8 data)
{
LOG_MMC(("sa0037 write_h, offset: %04x, data: %02x\n", offset, data));

View File

@ -26,9 +26,9 @@ class nes_sachen_sa0036_device : public nes_nrom_device
{
public:
// construction/destruction
nes_sachen_sa0036_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
nes_sachen_sa0036_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
virtual void write_h(offs_t offset, uint8_t data) override;
virtual void write_h(offs_t offset, u8 data) override;
};
@ -38,9 +38,9 @@ class nes_sachen_sa0037_device : public nes_nrom_device
{
public:
// construction/destruction
nes_sachen_sa0037_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
nes_sachen_sa0037_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
virtual void write_h(offs_t offset, uint8_t data) override;
virtual void write_h(offs_t offset, u8 data) override;
};

View File

@ -8,12 +8,10 @@
Here we emulate the following PCBs
* Tengen 800008
* Tengen 800032 [mapper 64]
* Tengen 800037 [mapper 158]
TODO:
- emulated the IRQ delay in 800032 (possibly reason of Skull & Crossbones not working?)
Note, Tetris' Tengen 800008 [mapper 148] is implemented in sachen.cpp.
***********************************************************************************************************/
@ -37,27 +35,21 @@
// constructor
//-------------------------------------------------
DEFINE_DEVICE_TYPE(NES_TENGEN_800008, nes_tengen008_device, "nes_tengen008", "NES Cart Tengen 800008 PCB")
DEFINE_DEVICE_TYPE(NES_TENGEN_800032, nes_tengen032_device, "nes_tengen032", "NES Cart Tengen 800032 PCB")
DEFINE_DEVICE_TYPE(NES_TENGEN_800037, nes_tengen037_device, "nes_tengen037", "NES Cart Tengen 800037 PCB")
nes_tengen008_device::nes_tengen008_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: nes_nrom_device(mconfig, NES_TENGEN_800008, tag, owner, clock)
nes_tengen032_device::nes_tengen032_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock)
: nes_nrom_device(mconfig, type, tag, owner, clock), m_latch(0), m_irq_count(0), m_irq_count_latch(0), m_irq_mode(0), m_irq_reset(0), m_irq_enable(0), m_irq_pending(0), irq_timer(nullptr)
{
}
nes_tengen032_device::nes_tengen032_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
: nes_nrom_device(mconfig, type, tag, owner, clock), m_irq_count(0), m_irq_count_latch(0), m_irq_mode(0), m_irq_reset(0), m_irq_enable(0), m_latch(0), irq_timer(nullptr)
{
}
nes_tengen032_device::nes_tengen032_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
nes_tengen032_device::nes_tengen032_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: nes_tengen032_device(mconfig, NES_TENGEN_800032, tag, owner, clock)
{
}
nes_tengen037_device::nes_tengen037_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
nes_tengen037_device::nes_tengen037_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: nes_tengen032_device(mconfig, NES_TENGEN_800037, tag, owner, clock)
{
}
@ -69,8 +61,8 @@ void nes_tengen032_device::device_start()
{
common_start();
irq_timer = timer_alloc(TIMER_IRQ);
irq_timer->reset();
timer_freq = clocks_to_attotime(4);
irq_timer->adjust(attotime::zero, 0, timer_freq);
save_item(NAME(m_mmc_prg_bank));
save_item(NAME(m_mmc_vrom_bank));
@ -79,24 +71,27 @@ void nes_tengen032_device::device_start()
save_item(NAME(m_irq_mode));
save_item(NAME(m_irq_reset));
save_item(NAME(m_irq_enable));
save_item(NAME(m_irq_pending));
save_item(NAME(m_irq_count));
save_item(NAME(m_irq_count_latch));
}
void nes_tengen032_device::pcb_reset()
{
m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM;
prg16_89ab(m_prg_chunks - 1);
prg16_89ab(0);
prg16_cdef(m_prg_chunks - 1);
chr8(0, m_chr_source);
memset(m_mmc_prg_bank, 0, sizeof(m_mmc_prg_bank));
memset(m_mmc_vrom_bank, 0, sizeof(m_mmc_vrom_bank));
std::fill(std::begin(m_mmc_prg_bank), std::end(m_mmc_prg_bank), 0x00);
std::fill(std::begin(m_mmc_vrom_bank), std::end(m_mmc_vrom_bank), 0x00);
m_latch = 0;
m_irq_mode = 0;
m_irq_reset = 0;
m_irq_enable = 0;
m_irq_count = m_irq_count_latch = 0;
m_irq_pending = 0;
m_irq_count = 0;
m_irq_count_latch = 0xff;
}
@ -104,27 +99,6 @@ void nes_tengen032_device::pcb_reset()
mapper specific handlers
-------------------------------------------------*/
/*-------------------------------------------------
Tengen 800008 Board
iNES: mapper 3?
In MESS: Supported.
-------------------------------------------------*/
void nes_tengen008_device::write_h(offs_t offset, uint8_t data)
{
LOG_MMC(("tengen008 write_h, offset: %04x, data: %02x\n", offset, data));
// this pcb is subject to bus conflict
data = account_bus_conflict(offset, data);
prg32(data >> 3);
chr8(data, CHRROM);
}
/*-------------------------------------------------
Tengen 800032 Board
@ -138,10 +112,12 @@ void nes_tengen008_device::write_h(offs_t offset, uint8_t data)
iNES: mapper 64
In MESS: Partially Supported (there should be a small
delay between the IRQ and its execution, but that is not
emulated yet: this is possibly the problem with Skulls
& Crossbones)
In MAME: Partially supported.
TODO: There are issues with IRQ. Skull & Crossbones
probably doesn't work because of this? It alone uses
the cycle-based IRQ (and it constantly switches
between IRQ modes).
-------------------------------------------------*/
@ -156,14 +132,15 @@ inline void nes_tengen032_device::irq_clock(int blanked)
if (m_irq_reset)
{
m_irq_reset = 0;
m_irq_count = m_irq_count_latch + 1;
m_irq_count = m_irq_count_latch | (m_irq_count_latch ? 1 : 0);
}
else if (!m_irq_count)
m_irq_count = m_irq_count_latch;
else
m_irq_count--;
m_irq_count--;
if (m_irq_enable && !blanked && !m_irq_count)
set_irq_line(ASSERT_LINE);
m_irq_pending = 1;
}
// we use the HBLANK IRQ latch from PPU for the scanline based IRQ mode
@ -173,7 +150,14 @@ void nes_tengen032_device::device_timer(emu_timer &timer, device_timer_id id, in
{
if (id == TIMER_IRQ)
{
irq_clock(0);
if (m_irq_pending)
{
set_irq_line(ASSERT_LINE);
m_irq_pending = 0;
}
if (m_irq_mode)
irq_clock(0);
}
}
@ -182,7 +166,7 @@ void nes_tengen032_device::hblank_irq(int scanline, int vblank, int blanked)
{
if (!m_irq_mode) // we are in scanline mode!
{
if (scanline < ppu2c0x_device::BOTTOM_VISIBLE_SCANLINE)
if (scanline <= ppu2c0x_device::BOTTOM_VISIBLE_SCANLINE)
{
irq_clock(blanked);
}
@ -191,47 +175,40 @@ void nes_tengen032_device::hblank_irq(int scanline, int vblank, int blanked)
void nes_tengen032_device::set_prg()
{
uint8_t prg_mode = m_latch & 0x40;
u8 prg_flip = (m_latch & 0x40) >> 5;
prg8_89(m_mmc_prg_bank[prg_mode ? 2: 0]);
prg8_ab(m_mmc_prg_bank[prg_mode ? 0: 1]);
prg8_cd(m_mmc_prg_bank[prg_mode ? 1: 2]);
}
void nes_tengen032_device::chr_cb(int start, int bank, int source)
{
chr1_x(start, bank, source);
prg8_89(m_mmc_prg_bank[0 ^ prg_flip]);
prg8_ab(m_mmc_prg_bank[1]);
prg8_cd(m_mmc_prg_bank[2 ^ prg_flip]);
}
void nes_tengen032_device::set_chr()
{
uint8_t chr_page = (m_latch & 0x80) >> 5;
u8 chr_flip = (m_latch & 0x80) >> 5;
if (m_latch & 0x20)
{
chr_cb(0 ^ chr_page, m_mmc_vrom_bank[0], CHRROM);
chr_cb(1 ^ chr_page, m_mmc_vrom_bank[6], CHRROM);
chr_cb(2 ^ chr_page, m_mmc_vrom_bank[1], CHRROM);
chr_cb(3 ^ chr_page, m_mmc_vrom_bank[7], CHRROM);
chr1_x(0 ^ chr_flip, m_mmc_vrom_bank[0], CHRROM);
chr1_x(1 ^ chr_flip, m_mmc_vrom_bank[6], CHRROM);
chr1_x(2 ^ chr_flip, m_mmc_vrom_bank[1], CHRROM);
chr1_x(3 ^ chr_flip, m_mmc_vrom_bank[7], CHRROM);
}
else
{
chr_cb(0 ^ chr_page, m_mmc_vrom_bank[0] & ~0x01, CHRROM);
chr_cb(1 ^ chr_page, m_mmc_vrom_bank[0] | 0x01, CHRROM);
chr_cb(2 ^ chr_page, m_mmc_vrom_bank[1] & ~0x01, CHRROM);
chr_cb(3 ^ chr_page, m_mmc_vrom_bank[1] | 0x01, CHRROM);
chr2_x(0 ^ chr_flip, m_mmc_vrom_bank[0] >> 1, CHRROM);
chr2_x(2 ^ chr_flip, m_mmc_vrom_bank[1] >> 1, CHRROM);
}
chr_cb(4 ^ chr_page, m_mmc_vrom_bank[2], CHRROM);
chr_cb(5 ^ chr_page, m_mmc_vrom_bank[3], CHRROM);
chr_cb(6 ^ chr_page, m_mmc_vrom_bank[4], CHRROM);
chr_cb(7 ^ chr_page, m_mmc_vrom_bank[5], CHRROM);
chr1_x(4 ^ chr_flip, m_mmc_vrom_bank[2], CHRROM);
chr1_x(5 ^ chr_flip, m_mmc_vrom_bank[3], CHRROM);
chr1_x(6 ^ chr_flip, m_mmc_vrom_bank[4], CHRROM);
chr1_x(7 ^ chr_flip, m_mmc_vrom_bank[5], CHRROM);
}
void nes_tengen032_device::tengen032_write(offs_t offset, uint8_t data)
void nes_tengen032_device::write_h(offs_t offset, u8 data)
{
uint8_t helper, cmd;
LOG_MMC(("tengen032_write, offset: %04x, data: %02x\n", offset, data));
u8 helper, cmd;
LOG_MMC(("tengen032 write_h, offset: %04x, data: %02x\n", offset, data));
switch (offset & 0x6001)
{
@ -281,17 +258,16 @@ void nes_tengen032_device::tengen032_write(offs_t offset, uint8_t data)
m_irq_count_latch = data;
break;
case 0x4001: /* $c001 - IRQ scanline latch */
case 0x4001: // $c001 - IRQ scanline latch
m_irq_mode = data & 0x01;
if (m_irq_mode)
irq_timer->adjust(attotime::zero, 0, timer_freq);
else
irq_timer->adjust(attotime::never);
m_irq_reset = 1;
break;
case 0x6000:
m_irq_enable = 0;
m_irq_pending = 0;
set_irq_line(CLEAR_LINE);
break;
@ -318,36 +294,23 @@ void nes_tengen032_device::tengen032_write(offs_t offset, uint8_t data)
iNES: mapper 158
In MESS: Supported.
In MAME: Supported.
-------------------------------------------------*/
void nes_tengen037_device::set_mirror()
void nes_tengen037_device::set_chr()
{
if (m_latch & 0x80)
{
set_nt_page(0, CIRAM, BIT(m_mmc_vrom_bank[2],7), 1);
set_nt_page(1, CIRAM, BIT(m_mmc_vrom_bank[3],7), 1);
set_nt_page(2, CIRAM, BIT(m_mmc_vrom_bank[4],7), 1);
set_nt_page(3, CIRAM, BIT(m_mmc_vrom_bank[5],7), 1);
}
else
{
set_nt_page(0, CIRAM, BIT(m_mmc_vrom_bank[0],7), 1);
set_nt_page(1, CIRAM, BIT(m_mmc_vrom_bank[0],7), 1);
set_nt_page(2, CIRAM, BIT(m_mmc_vrom_bank[1],7), 1);
set_nt_page(3, CIRAM, BIT(m_mmc_vrom_bank[1],7), 1);
}
nes_tengen032_device::set_chr();
// do nametables
static constexpr u8 bank[8] = { 0, 0, 1, 1, 2, 3, 4, 5 };
int start = (m_latch & 0x80) >> 5;
for (int i = 0; i < 4; i++)
set_nt_page(i, CIRAM, BIT(m_mmc_vrom_bank[bank[start + i]], 7), 1);
}
void nes_tengen037_device::chr_cb( int start, int bank, int source )
{
set_mirror(); // we could probably update only for one (e.g. the first) call, to slightly optimize the code
chr1_x(start, bank, source);
}
void nes_tengen037_device::write_h(offs_t offset, uint8_t data)
void nes_tengen037_device::write_h(offs_t offset, u8 data)
{
LOG_MMC(("tengen037 write_h, offset: %04x, data: %02x\n", offset, data));
@ -355,9 +318,8 @@ void nes_tengen037_device::write_h(offs_t offset, uint8_t data)
{
case 0x2000:
break;
default:
tengen032_write(offset, data);
nes_tengen032_device::write_h(offset, data);
break;
}
}

View File

@ -6,54 +6,42 @@
#include "nxrom.h"
// ======================> nes_tengen008_device
class nes_tengen008_device : public nes_nrom_device
{
public:
// construction/destruction
nes_tengen008_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;
};
// ======================> nes_tengen032_device
class nes_tengen032_device : public nes_nrom_device
{
public:
// construction/destruction
nes_tengen032_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
nes_tengen032_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
void tengen032_write(offs_t offset, uint8_t data);
virtual void write_h(offs_t offset, uint8_t data) override { tengen032_write(offset, data); }
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;
protected:
nes_tengen032_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
nes_tengen032_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
// device-level overrides
virtual void device_start() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void chr_cb(int start, int bank, int source);
virtual void set_chr();
u8 m_latch;
u8 m_mmc_vrom_bank[8];
private:
void set_prg();
void set_chr();
void irq_clock(int blanked);
uint16_t m_irq_count, m_irq_count_latch;
uint8_t m_irq_mode, m_irq_reset;
int m_irq_enable;
u16 m_irq_count, m_irq_count_latch;
u8 m_irq_mode, m_irq_reset;
u8 m_irq_enable, m_irq_pending;
uint8_t m_latch;
uint8_t m_mmc_prg_bank[3];
uint8_t m_mmc_vrom_bank[8];
u8 m_mmc_prg_bank[3];
static const device_timer_id TIMER_IRQ = 0;
static constexpr device_timer_id TIMER_IRQ = 0;
emu_timer *irq_timer;
attotime timer_freq;
};
@ -65,19 +53,17 @@ class nes_tengen037_device : public nes_tengen032_device
{
public:
// construction/destruction
nes_tengen037_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
nes_tengen037_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
// device-level overrides
virtual void write_h(offs_t offset, uint8_t data) override;
virtual void chr_cb(int start, int bank, int source) override;
virtual void write_h(offs_t offset, u8 data) override;
protected:
void set_mirror();
virtual void set_chr() override;
};
// device type definition
DECLARE_DEVICE_TYPE(NES_TENGEN_800008, nes_tengen008_device)
DECLARE_DEVICE_TYPE(NES_TENGEN_800032, nes_tengen032_device)
DECLARE_DEVICE_TYPE(NES_TENGEN_800037, nes_tengen037_device)