From 9ecfb51aabd722ddb89e14bfcbe16caef3ae8a12 Mon Sep 17 00:00:00 2001 From: 0kmg <9137159+0kmg@users.noreply.github.com> Date: Sat, 25 Sep 2021 21:07:42 -0800 Subject: [PATCH] bus/nes: Uncommented some existing code for Toy Story pirate cart. (#8617) Software list items promoted to working (nes.xml) --------------------------------------- Toy Story [etabeta] --- hash/nes.xml | 5 +- src/devices/bus/nes/mmc3_clones.cpp | 205 ++++++++++++++-------------- src/devices/bus/nes/mmc3_clones.h | 6 +- src/devices/bus/nes/nes_carts.cpp | 2 +- src/devices/bus/nes/nes_ines.hxx | 2 +- src/devices/bus/nes/nes_pcb.hxx | 2 +- 6 files changed, 108 insertions(+), 114 deletions(-) diff --git a/hash/nes.xml b/hash/nes.xml index 909f15cb5a0..919172fb2ab 100644 --- a/hash/nes.xml +++ b/hash/nes.xml @@ -64942,13 +64942,12 @@ We don't include these hacks because they were not burned into real carts nor so - + Toy Story 19?? <unknown> - - + diff --git a/src/devices/bus/nes/mmc3_clones.cpp b/src/devices/bus/nes/mmc3_clones.cpp index 322d35bdacd..8aac9112b91 100644 --- a/src/devices/bus/nes/mmc3_clones.cpp +++ b/src/devices/bus/nes/mmc3_clones.cpp @@ -50,7 +50,7 @@ DEFINE_DEVICE_TYPE(NES_SF3, nes_sf3_device, "nes_sf3", DEFINE_DEVICE_TYPE(NES_GOUDER, nes_gouder_device, "nes_gouder", "NES Cart Gouder PCB") DEFINE_DEVICE_TYPE(NES_SA9602B, nes_sa9602b_device, "nes_sa9602b", "NES Cart SA-9602B PCB") DEFINE_DEVICE_TYPE(NES_SACHEN_SHERO, nes_sachen_shero_device, "nes_shero", "NES Cart Street Hero PCB") -//DEFINE_DEVICE_TYPE(NES_A9746, nes_a9746_device, "nes_bmc_a9746", "NES Cart A-9746 PCB") +DEFINE_DEVICE_TYPE(NES_A9746, nes_a9746_device, "nes_bmc_a9746", "NES Cart A-9746 PCB") DEFINE_DEVICE_TYPE(NES_A88S1, nes_a88s1_device, "nes_a88s1", "NES Cart BMC A88S-1 PCB") DEFINE_DEVICE_TYPE(NES_FCGJ8IN1, nes_fcgj8in1_device, "nes_fcgj8in1", "NES Cart BMC FC Genjin 8 in 1 PCB") @@ -208,10 +208,10 @@ nes_sachen_shero_device::nes_sachen_shero_device(const machine_config &mconfig, { } -//nes_a9746_device::nes_a9746_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) -// : nes_txrom_device(mconfig, NES_A9746, tag, owner, clock) -//{ -//} +nes_a9746_device::nes_a9746_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : nes_txrom_device(mconfig, NES_A9746, tag, owner, clock) +{ +} nes_a88s1_device::nes_a88s1_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : nes_txrom_device(mconfig, NES_A88S1, tag, owner, clock) @@ -536,6 +536,22 @@ void nes_sachen_shero_device::pcb_reset() mmc3_common_initialize(0xff, 0x1ff, 0); } +void nes_a9746_device::device_start() +{ + mmc3_start(); + save_item(NAME(m_reg)); +} + +void nes_a9746_device::pcb_reset() +{ + m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; + + m_reg[0] = 0; + m_reg[1] = 0; + m_reg[2] = 0; + mmc3_common_initialize(0x7f, 0xff, 0); +} + void nes_a88s1_device::device_start() { mmc3_start(); @@ -1916,6 +1932,81 @@ uint8_t nes_sachen_shero_device::read_l(offs_t offset) return get_open_bus(); // open bus } +/*------------------------------------------------- + + UNL-A9746 + + Games: Toy Story, Super 1997 4 in 1 (NT-8029) + + MMC3 clone + + iNES: mapper 219 + + Preliminary emulation based on Cah4e3's code + + -------------------------------------------------*/ + +void nes_a9746_device::update_banks(uint8_t value) +{ + uint8_t bank = bitswap<8>(value & 0x3c,7,6,0,1,2,3,4,5); + + switch (m_reg[0]) + { + case 0x26: prg8_89(bank); break; + case 0x25: prg8_ab(bank); break; + case 0x24: prg8_cd(bank); break; + case 0x23: prg8_ef(bank); break; + } + + switch (m_reg[1]) + { + case 0x08: case 0x0a: case 0x0c: case 0x0e: + case 0x10: case 0x12: case 0x14: case 0x16: + case 0x18: case 0x1a: case 0x1c: case 0x1e: + m_reg[2] = (value << 4); + break; + case 0x09: chr1_0(m_reg[2] | (value >> 1), m_chr_source); break; + case 0x0b: chr1_1(m_reg[2] | (value >> 1) | 1, m_chr_source); break; + case 0x0d: chr1_2(m_reg[2] | (value >> 1), m_chr_source); break; + case 0x0f: chr1_3(m_reg[2] | (value >> 1) | 1, m_chr_source); break; + case 0x11: chr1_4(m_reg[2] | (value >> 1), m_chr_source); break; + case 0x15: chr1_5(m_reg[2] | (value >> 1), m_chr_source); break; + case 0x19: chr1_6(m_reg[2] | (value >> 1), m_chr_source); break; + case 0x1d: chr1_7(m_reg[2] | (value >> 1), m_chr_source); break; + } +} + +void nes_a9746_device::write_h(offs_t offset, uint8_t data) +{ + LOG_MMC(("unl_a9746 write_h, offset: %04x, data: %02x\n", offset, data)); + + switch (offset & 0x6003) + { + case 0x0000: + m_reg[1] = data; + m_reg[0] = 0; + break; + case 0x0001: + update_banks(data); + break; + case 0x0002: + m_reg[0] = data; + m_reg[1] = 0; + break; + + case 0x0003: + case 0x2000: + case 0x2001: + case 0x2002: + case 0x2003: + break; + + default: + txrom_write(offset, data); + break; + } +} + /*------------------------------------------------- @@ -1924,16 +2015,16 @@ uint8_t nes_sachen_shero_device::read_l(offs_t offset) -------------------------------------------------*/ - /*------------------------------------------------- +/*------------------------------------------------- - Board BMC-FK23C + Board BMC-FK23C - MMC3 clone + MMC3 clone - In MESS: partially supported (still to sort initial banking - for many games) + In MAME: partially supported (still to sort initial banking + for many games) - -------------------------------------------------*/ + -------------------------------------------------*/ #if 0 // alt version... @@ -3052,95 +3143,3 @@ void nes_coolboy_device::write_m(offs_t offset, uint8_t data) set_chr(m_chr_source, m_chr_base, m_chr_mask); set_prg(m_prg_base, m_prg_mask); } - -#ifdef UNUSED_FUNCTION -/*------------------------------------------------- - - UNL-A9746 - - - MMC3 clone - - - Preliminary emulation based on Cah4e3's code - No dump is available (yet) for this. - - -------------------------------------------------*/ - -void nes_a9746_device::device_start() -{ - mmc3_start(); - save_item(NAME(m_reg)); -} - -void nes_a9746_device::pcb_reset() -{ - m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; - - m_reg[0] = 0; - m_reg[1] = 0; - m_reg[2] = 0; - mmc3_common_initialize(0x7f, 0xff, 0); -} - -void nes_a9746_device::update_banks(uint8_t value) -{ - uint8_t bank = bitswap<8>(value & 0x3c,7,6,0,1,2,3,4,5); - - switch (m_reg[0]) - { - case 0x26: prg8_89(bank); break; - case 0x25: prg8_ab(bank); break; - case 0x24: prg8_cd(bank); break; - case 0x23: prg8_ef(bank); break; - } - - switch (m_reg[1]) - { - case 0x08: case 0x0a: case 0x0c: case 0x0e: - case 0x10: case 0x12: case 0x14: case 0x16: - case 0x18: case 0x1a: case 0x1c: case 0x1e: - m_reg[2] = (value << 4); - break; - case 0x09: chr1_0(m_reg[2] | (value >> 1), m_chr_source); break; - case 0x0b: chr1_1(m_reg[2] | (value >> 1) | 1, m_chr_source); break; - case 0x0d: chr1_2(m_reg[2] | (value >> 1), m_chr_source); break; - case 0x0f: chr1_3(m_reg[2] | (value >> 1) | 1, m_chr_source); break; - case 0x11: chr1_4(m_reg[2] | (value >> 1), m_chr_source); break; - case 0x15: chr1_5(m_reg[2] | (value >> 1), m_chr_source); break; - case 0x19: chr1_6(m_reg[2] | (value >> 1), m_chr_source); break; - case 0x1d: chr1_7(m_reg[2] | (value >> 1), m_chr_source); break; - } -} - -void nes_a9746_device::write_h(offs_t offset, uint8_t data) -{ - LOG_MMC(("unl_a9746 write_h, offset: %04x, data: %02x\n", offset, data)); - - switch (offset & 0x6003) - { - case 0x0000: - m_reg[1] = data; - m_reg[0] = 0; - break; - case 0x0001: - update_banks(data); - break; - case 0x0002: - m_reg[0] = data; - m_reg[1] = 0; - break; - - case 0x0003: - case 0x2000: - case 0x2001: - case 0x2002: - case 0x2003: - break; - - default: - txrom_write(offset, data); - break; - } -} -#endif diff --git a/src/devices/bus/nes/mmc3_clones.h b/src/devices/bus/nes/mmc3_clones.h index 201c82efca7..0c75312bda4 100644 --- a/src/devices/bus/nes/mmc3_clones.h +++ b/src/devices/bus/nes/mmc3_clones.h @@ -428,7 +428,6 @@ private: uint8_t m_reg; }; -#ifdef UNUSED_FUNCTION // ======================> nes_a9746_device class nes_a9746_device : public nes_txrom_device @@ -439,7 +438,7 @@ public: virtual void write_h(offs_t offset, uint8_t data) override; - virtual void pcb_reset(); + virtual void pcb_reset() override; protected: // device-level overrides @@ -449,7 +448,6 @@ private: void update_banks(uint8_t value); uint8_t m_reg[3]; }; -#endif // ======================> nes_a88s1_device @@ -1018,9 +1016,7 @@ DECLARE_DEVICE_TYPE(NES_SF3, nes_sf3_device) DECLARE_DEVICE_TYPE(NES_GOUDER, nes_gouder_device) DECLARE_DEVICE_TYPE(NES_SA9602B, nes_sa9602b_device) DECLARE_DEVICE_TYPE(NES_SACHEN_SHERO, nes_sachen_shero_device) -#ifdef UNUSED_FUNCTION DECLARE_DEVICE_TYPE(NES_A9746, nes_a9746_device) -#endif DECLARE_DEVICE_TYPE(NES_A88S1, nes_a88s1_device) DECLARE_DEVICE_TYPE(NES_FCGJ8IN1, nes_fcgj8in1_device) diff --git a/src/devices/bus/nes/nes_carts.cpp b/src/devices/bus/nes/nes_carts.cpp index 7dea84ea444..53609bf5d41 100644 --- a/src/devices/bus/nes/nes_carts.cpp +++ b/src/devices/bus/nes/nes_carts.cpp @@ -356,6 +356,7 @@ void nes_cart(device_slot_interface &device) device.option_add_internal("gouder", NES_GOUDER); device.option_add_internal("sa9602b", NES_SA9602B); device.option_add_internal("unl_shero", NES_SACHEN_SHERO); + device.option_add_internal("a9746", NES_A9746); // mapper 219 // misc multigame cart boards device.option_add_internal("benshieng", NES_BENSHIENG); device.option_add_internal("action52", NES_ACTION52); @@ -471,7 +472,6 @@ void nes_cart(device_slot_interface &device) device.option_add_internal("konami_qtai", NES_NROM); // [mentioned in FCEUMM source - we need more info] - UNSUPPORTED device.option_add_internal("unl_3d_block", NES_NROM); // [mentioned in FCEUMM source - we need more info] - UNSUPPORTED device.option_add_internal("unl_c_n22m", NES_NROM); // [mentioned in FCEUMM source - we need more info] - UNSUPPORTED - device.option_add_internal("a9746", NES_NROM); // mapper 219 - UNSUPPORTED (no dump available); // legacy boards for FFE copier mappers (are there images available to fix/improve emulation?) device.option_add_internal("ffe3", NES_FFE3); device.option_add_internal("ffe4", NES_FFE4); diff --git a/src/devices/bus/nes/nes_ines.hxx b/src/devices/bus/nes/nes_ines.hxx index 74e3360f742..d4872d0844c 100644 --- a/src/devices/bus/nes/nes_ines.hxx +++ b/src/devices/bus/nes/nes_ines.hxx @@ -252,7 +252,7 @@ static const nes_mmc mmc_list[] = { 216, RCM_GS2015 }, { 217, BMC_500IN1 }, { 218, NOCASH_NOCHR }, - // 219 UNL-A9746 (according to Cah4e3's code, no dump available (yet) + { 219, UNL_A9746 }, // 220 Unused - reserved for emulator debugging { 221, UNL_N625092 }, { 222, BTL_DRAGONNINJA }, diff --git a/src/devices/bus/nes/nes_pcb.hxx b/src/devices/bus/nes/nes_pcb.hxx index 410fb6197f1..656edc41193 100644 --- a/src/devices/bus/nes/nes_pcb.hxx +++ b/src/devices/bus/nes/nes_pcb.hxx @@ -339,6 +339,7 @@ static const nes_pcb pcb_list[] = { "tek90", JYCOMPANY_A }, { "sa9602b", SACHEN_SA9602B }, { "unl_shero", SACHEN_SHERO }, + { "a9746", UNL_A9746 }, { "mmalee2", UNL_MMALEE }, { "unl_2708", UNL_2708 }, { "unl_dh08", UNL_DH08 }, @@ -376,7 +377,6 @@ static const nes_pcb pcb_list[] = { "onebus", UNSUPPORTED_BOARD }, { "coolboy", UNSUPPORTED_BOARD }, { "btl_900218", UNSUPPORTED_BOARD }, // pirate The Lord of King, to be emulated soon - { "a9746", UNSUPPORTED_BOARD }, { "pec586", UNSUPPORTED_BOARD }, { "unl_drgnfgt", UNSUPPORTED_BOARD }, // Dragon Fighter by Flying Star { "test", TEST_BOARD },