From 1534a0bc45c35ac5ffe89be760d33ec404b81284 Mon Sep 17 00:00:00 2001 From: 0kmg <9137159+0kmg@users.noreply.github.com> Date: Sat, 13 Aug 2022 05:08:16 -0800 Subject: [PATCH] bus/nes: Updated emulation of TXC 01-22000-400 PCBs. (#10219) --- hash/nes.xml | 76 +++++++++++++++++++------------------ src/devices/bus/nes/txc.cpp | 71 +++++++++++++++++++++++++++------- src/devices/bus/nes/txc.h | 14 ++++++- 3 files changed, 109 insertions(+), 52 deletions(-) diff --git a/hash/nes.xml b/hash/nes.xml index 4f0189c49dd..37585772398 100644 --- a/hash/nes.xml +++ b/hash/nes.xml @@ -11492,17 +11492,19 @@ license:CC0 - F15 City War (Spa) + F15 City War (Spain) 1990 Gluk Video + - + + - - - - + + + + @@ -29936,18 +29938,19 @@ license:CC0 - Puzzle (Spa) - 1990? + Puzzle (Spain) + 1990 Gluk Video + - - + + - - - - + + + + @@ -56329,38 +56332,39 @@ preliminary proto for the PAL version, still running on NTSC systems) or the gfx - Strike Wolf (Taiwan) - 19?? - TXC Corp - + Strike Wolf (Spain, Taiwan) + 1992 + Gluk Video / TXC Corp + + + - + - - - - + + + + Policeman (Spain, Taiwan) - 19?? + 1992 Gluk Video / TXC Corp - + - - - - - + + + + @@ -67049,20 +67053,20 @@ We don't include these hacks because they were not burned into real carts nor so - Venice Beach Volleyball (Spa) - 19?? + Venice Beach Volleyball (Spain) + 1991 Gluk Video - - + + - + - + diff --git a/src/devices/bus/nes/txc.cpp b/src/devices/bus/nes/txc.cpp index 39a4f5dab59..398adbd17f3 100644 --- a/src/devices/bus/nes/txc.cpp +++ b/src/devices/bus/nes/txc.cpp @@ -7,10 +7,10 @@ Here we emulate the following PCBs + * TXC 01-22000-400 [mapper 36] * TXC 22111 [mapper 132] * TXC Du Ma Racing [mapper 172] * TXC Mahjong Block [mapper 172] - * TXC Strike Wolf [mapper 36] * TXC Commandos (and many more) [mapper 241] TODO: @@ -40,7 +40,7 @@ DEFINE_DEVICE_TYPE(NES_TXC_22211, nes_txc_22211_device, "nes_txc_22211", "NES Cart TXC 22211 PCB") DEFINE_DEVICE_TYPE(NES_TXC_DUMARACING, nes_txc_dumarc_device, "nes_txc_dumarc", "NES Cart TXC Du Ma Racing PCB") DEFINE_DEVICE_TYPE(NES_TXC_MJBLOCK, nes_txc_mjblock_device, "nes_txc_mjblock", "NES Cart TXC Mahjong Block PCB") -DEFINE_DEVICE_TYPE(NES_TXC_STRIKEW, nes_txc_strikew_device, "nes_txc_strikew", "NES Cart TXC Strike Wolf PCB") +DEFINE_DEVICE_TYPE(NES_TXC_STRIKEW, nes_txc_strikew_device, "nes_txc_strikew", "NES Cart TXC 01-22000-400 PCB") DEFINE_DEVICE_TYPE(NES_TXC_COMMANDOS, nes_txc_commandos_device, "nes_txc_comm", "NES Cart TXC Cart Commandos PCB") // and others @@ -64,7 +64,7 @@ nes_txc_mjblock_device::nes_txc_mjblock_device(const machine_config &mconfig, co { } -nes_txc_strikew_device::nes_txc_strikew_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +nes_txc_strikew_device::nes_txc_strikew_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : nes_nrom_device(mconfig, NES_TXC_STRIKEW, tag, owner, clock) { } @@ -90,6 +90,19 @@ void nes_txc_22211_device::pcb_reset() m_reg[0] = m_reg[1] = m_reg[2] = m_reg[3] = 0; } +void nes_txc_strikew_device::device_start() +{ + common_start(); + save_item(NAME(m_reg)); +} + +void nes_txc_strikew_device::pcb_reset() +{ + prg32(0); + chr8(0, m_chr_source); + m_reg[0] = m_reg[1] = m_reg[2] = m_reg[3] = 0; +} + @@ -189,29 +202,59 @@ uint8_t nes_txc_mjblock_device::read_l(offs_t offset) /*------------------------------------------------- - Bootleg Board 'Strike Wolf' by TXC + TXC 01-22000-400 Board - Games: Strike Wolf and Policeman + Games: F-15 City War, Policeman, Puzzle, Strike Wolf, + Venice Beach Volley iNES: mapper 36 - In MESS: Supported (Policeman requires no bus conflict - though, or it has glitches) + In MAME: Supported. -------------------------------------------------*/ -void nes_txc_strikew_device::write_h(offs_t offset, uint8_t data) +u8 nes_txc_strikew_device::read_l(offs_t offset) { - LOG_MMC(("TXC Strike Wolf write_h, offset: %04x, data: %02x\n", offset, data)); + LOG_MMC(("TXC 01-22000-400 read_l, offset: %04x\n", offset)); - // this pcb is subject to bus conflict - data = account_bus_conflict(offset, data); + offset += 0x100; + if (offset & 0x100) + return (get_open_bus() & 0xcf) | m_reg[0] << 4; - if ((offset >= 0x400) && (offset < 0x7fff)) + return get_open_bus(); +} + +void nes_txc_strikew_device::write_l(offs_t offset, u8 data) +{ + LOG_MMC(("TXC 01-22000-400 write_l, offset: %04x, data: %02x\n", offset, data)); + + offset += 0x100; + switch (offset & 0x103) { - prg32(data >> 4); - chr8(data & 0x0f, CHRROM); + case 0x100: + if (m_reg[3] & 1) + m_reg[0] = (m_reg[0] + 1) & 0x03; + else if (m_reg[1] & 1) + m_reg[0] = m_reg[2] ^ 0x03; + else + m_reg[0] = m_reg[2]; + break; + case 0x101: + case 0x102: + case 0x103: + m_reg[offset & 0x03] = BIT(data, 4, 2); + break; } + + if (offset & 0x200) + chr8(data, CHRROM); +} + +void nes_txc_strikew_device::write_h(offs_t offset, u8 data) +{ + LOG_MMC(("TXC 01-22000-400 write_h, offset: %04x, data: %02x\n", offset, data)); + + prg32(m_reg[0]); } /*------------------------------------------------- diff --git a/src/devices/bus/nes/txc.h b/src/devices/bus/nes/txc.h index af8bdc3bc5c..4e7f938c1a8 100644 --- a/src/devices/bus/nes/txc.h +++ b/src/devices/bus/nes/txc.h @@ -62,9 +62,19 @@ class nes_txc_strikew_device : public nes_nrom_device { public: // construction/destruction - nes_txc_strikew_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + nes_txc_strikew_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 u8 read_l(offs_t offset) override; + virtual void write_l(offs_t offset, u8 data) override; + virtual void write_h(offs_t offset, u8 data) override; + + virtual void pcb_reset() override; + +protected: + // device-level overrides + virtual void device_start() override; + + u8 m_reg[4]; };