From 1c268bd11613f750a8c7946741f79b17f9c87317 Mon Sep 17 00:00:00 2001 From: 0kmg <9137159+0kmg@users.noreply.github.com> Date: Fri, 9 Jul 2021 03:33:47 -0800 Subject: -bus/nes: Added support for two more FDS bootlegs, fixed another. (#8247) * Added boards for Palthena no Kagami (Kid Icarus) and Lucky Rabbit, (Roger Rabbit) FDS bootlegs. * Fixed background tiles in fuunsfds, it has hardwired vertical mirroring. -nes.xml: Marked tobidfds as not supported - it crashes on start. New working software list additions (nes.xml) ----------------------------------- Hikari Shinwa - Palthena no Kagami (Asia, FDS conversion) [famiac] Lucky Rabbit (Asia, Roger Rabbit FDS conversion) [famiac] --- hash/nes.xml | 36 +++++++- src/devices/bus/nes/bootleg.cpp | 171 ++++++++++++++++++++++++++++++++++++-- src/devices/bus/nes/bootleg.h | 51 +++++++++++- src/devices/bus/nes/nes_carts.cpp | 2 + src/devices/bus/nes/nes_pcb.hxx | 2 + src/devices/bus/nes/nes_slot.h | 2 +- src/mame/machine/nes.cpp | 2 +- 7 files changed, 252 insertions(+), 14 deletions(-) diff --git a/hash/nes.xml b/hash/nes.xml index c90a0aa5dda..ce6238e15ad 100644 --- a/hash/nes.xml +++ b/hash/nes.xml @@ -66692,7 +66692,6 @@ Also notice that VRAM & WRAM are probably incorrect for some of these sets, at t - @@ -66771,6 +66770,39 @@ Also notice that VRAM & WRAM are probably incorrect for some of these sets, at t + + Hikari Shinwa - Palthena no Kagami (Asia, FDS conversion) + 19?? + <pirate> + + + + + + + + + + + + + + + + Lucky Rabbit (Asia, Roger Rabbit FDS conversion) + 19?? + <pirate> + + + + + + + + + + + Meikyuu Jiin Dababa (Asia, FDS conversion) 19?? @@ -67067,7 +67099,7 @@ Also notice that VRAM & WRAM are probably incorrect for some of these sets, at t - + Tobidase Daisakusen (Asia, FDS conversion) 19?? <pirate> diff --git a/src/devices/bus/nes/bootleg.cpp b/src/devices/bus/nes/bootleg.cpp index aa698598793..9dc0d5585c1 100644 --- a/src/devices/bus/nes/bootleg.cpp +++ b/src/devices/bus/nes/bootleg.cpp @@ -46,7 +46,9 @@ DEFINE_DEVICE_TYPE(NES_BTL_DNINJA, nes_btl_dn_device, "nes_btl_dn", "N DEFINE_DEVICE_TYPE(NES_SMB2J, nes_smb2j_device, "nes_smb2j", "NES Cart Super Mario Bros. 2 Jpn PCB") DEFINE_DEVICE_TYPE(NES_SMB2JA, nes_smb2ja_device, "nes_smb2ja", "NES Cart Super Mario Bros. 2 Jpn (Alt) PCB") DEFINE_DEVICE_TYPE(NES_SMB2JB, nes_smb2jb_device, "nes_smb2jb", "NES Cart Super Mario Bros. 2 Jpn (Alt 2) PCB") +DEFINE_DEVICE_TYPE(NES_0353, nes_0353_device, "nes_0353", "NES Cart 0353 PCB") DEFINE_DEVICE_TYPE(NES_09034A, nes_09034a_device, "nes_09034a", "NES Cart 09-034A PCB") +DEFINE_DEVICE_TYPE(NES_PALTHENA, nes_palthena_device, "nes_palthena", "NES Cart Palthena no Kagami Pirate PCB") DEFINE_DEVICE_TYPE(NES_TOBIDASE, nes_tobidase_device, "nes_tobidase", "NES Cart Tobidase Daisakusen Pirate PCB") DEFINE_DEVICE_TYPE(NES_DH08, nes_dh08_device, "nes_dh08", "NES Cart DH-08 Pirate PCB") DEFINE_DEVICE_TYPE(NES_LE05, nes_le05_device, "nes_le05", "NES Cart LE05 Pirate PCB") @@ -107,11 +109,21 @@ nes_smb2jb_device::nes_smb2jb_device(const machine_config &mconfig, const char * { } +nes_0353_device::nes_0353_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : nes_nrom_device(mconfig, NES_0353, tag, owner, clock), m_reg(0) +{ +} + nes_09034a_device::nes_09034a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : nes_nrom_device(mconfig, NES_09034A, tag, owner, clock), m_reg(0) { } +nes_palthena_device::nes_palthena_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : nes_nrom_device(mconfig, NES_PALTHENA, tag, owner, clock), m_reg(0) +{ +} + nes_tobidase_device::nes_tobidase_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : nes_nrom_device(mconfig, NES_TOBIDASE, tag, owner, clock), m_latch(0) { @@ -368,6 +380,20 @@ void nes_smb2jb_device::pcb_reset() m_irq_count = 0; } +void nes_0353_device::device_start() +{ + common_start(); + save_item(NAME(m_reg)); +} + +void nes_0353_device::pcb_reset() +{ + prg32((m_prg_chunks >> 1) - 1); // fixed 32K bank + chr8(0, CHRRAM); + + m_reg = 0; +} + void nes_09034a_device::device_start() { common_start(); @@ -382,6 +408,22 @@ void nes_09034a_device::pcb_reset() m_reg = 0; } +void nes_palthena_device::device_start() +{ + common_start(); + save_item(NAME(m_reg)); +} + +void nes_palthena_device::pcb_reset() +{ + prg8_89(0x0c); + // 0xa000-0xbfff switchable bank + prg16_cdef(m_prg_chunks - 1); + chr8(0, CHRRAM); + + m_reg = 0; +} + void nes_tobidase_device::device_start() { common_start(); @@ -436,14 +478,15 @@ void nes_lh10_device::device_start() void nes_lh10_device::pcb_reset() { - chr8(0, CHRRAM); - prg8_89(0); prg8_ab(0); // 0xc000-0xdfff reads/writes WRAM - prg8_ef(0xff); - memset(m_reg, 0, sizeof(m_reg)); + prg8_ef((m_prg_chunks << 1) - 1); + chr8(0, CHRRAM); + set_nt_mirroring(PPU_MIRROR_VERT); + m_latch = 0; + std::fill(std::begin(m_reg), std::end(m_reg), 0x00); } void nes_lh53_device::device_start() @@ -462,8 +505,8 @@ void nes_lh53_device::pcb_reset() chr8(0, CHRRAM); prg8_89(0xc); - prg8_ab(0xd); // last 2K are overlayed by WRAM - prg8_cd(0xe); // first 6K are overlayed by WRAM + prg8_ab(0xd); // last 2K are overlaid by WRAM + prg8_cd(0xe); // first 6K are overlaid by WRAM prg8_ef(0xf); m_reg = 0; m_irq_count = 0; @@ -481,7 +524,7 @@ void nes_2708_device::pcb_reset() chr8(0, CHRRAM); prg32(7); - // the upper PRG banks never change, but there are 8K of WRAM overlayed to the ROM area based on reg1 + // the upper PRG banks never change, but there are 8K of WRAM overlaid to the ROM area based on reg1 m_reg[0] = 0; m_reg[1] = 0; } @@ -1181,6 +1224,32 @@ void nes_smb2jb_device::write_ex(offs_t offset, uint8_t data) } } +/*------------------------------------------------- + + (BTL-)0353 + + Games: Lucky Rabbit (Roger Rabbit conversion) + + NES 2.0: mapper 415 + + In MAME: Supported. + + -------------------------------------------------*/ + +u8 nes_0353_device::read_m(offs_t offset) +{ +// LOG_MMC(("0353 read_m, offset: %04x\n", offset)); + return m_prg[m_reg * 0x2000 + offset]; +} + +void nes_0353_device::write_h(offs_t offset, u8 data) +{ + LOG_MMC(("0353 write_h, offset: %04x, data: %02x\n", offset, data)); + + set_nt_mirroring(BIT(data, 4) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); + m_reg = data & 0x0f; +} + /*------------------------------------------------- (UNL-)09-034A @@ -1212,6 +1281,91 @@ uint8_t nes_09034a_device::read_m(offs_t offset) return m_prg[((m_reg + 4) * 0x2000) + offset]; } +/*------------------------------------------------- + + BTL-PALTHENA + + Games: Palthena no Kagami (FDS conversion) + + This board has fixed 8K PRG banks at 0x6000, 0x8000, + 0xc000, and 0xe000. The PRG bank at 0xa000 is switchable + by writing to the register in the same 0xa000-0xbfff + range. What makes the board interesting is the overlaid + 8K of RAM with only 6K addressable: + + 8K WRAM: Addr: + 0x0000-0x11ff 0xc000-0xd1ff + 0x1200-0x12ff 0x8200-0x82ff + 0x1300-0x17ff N/A + 0x1800-0x18ff 0x6000-0x60ff + 0x1900-0x19ff N/A + 0x1a00-0x1aff 0x6200-0x62ff + 0x1b00-0x1bff N/A + 0x1c00-0x1dff 0x6400-0x65ff + 0x1e00-0x1eff N/A + 0x1f00-0x1fff 0xdf00-0xdfff + + NES 2.0: mapper 539 + + In MAME: Supported. + +-------------------------------------------------*/ + +u8 nes_palthena_device::read_m(offs_t offset) +{ +// LOG_MMC(("palthena read_m, offset: %04x\n", offset)); + switch (offset & 0x1f00) + { + case 0x0000: + case 0x0200: + case 0x0400: + case 0x0500: + return m_prgram[offset | 0x1800]; + default: + return m_prg[0x0d * 0x2000 + offset]; // fixed PRG bank + } +} + +void nes_palthena_device::write_m(offs_t offset, u8 data) +{ + LOG_MMC(("palthena write_m, offset: %04x, data: %02x\n", offset, data)); + switch (offset & 0x1f00) + { + case 0x0000: + case 0x0200: + case 0x0400: + case 0x0500: + m_prgram[offset | 0x1800] = data; + break; + } +} + +u8 nes_palthena_device::read_h(offs_t offset) +{ +// LOG_MMC(("palthena read_h, offset: %04x\n", offset)); + u8 page = (offset >> 8); + if ((page >= 0x40 && page < 0x52) || page == 0x5f) + return m_prgram[offset & 0x1fff]; + else if (page == 0x02) + return m_prgram[offset | 0x1000]; + + return hi_access_rom(offset); +} + +void nes_palthena_device::write_h(offs_t offset, u8 data) +{ + LOG_MMC(("palthena write_h, offset: %04x, data: %02x\n", offset, data)); + u8 page = (offset >> 8); + if ((page >= 0x40 && page < 0x52) || page == 0x5f) + m_prgram[offset & 0x1fff] = data; + else if (page == 0x02) + m_prgram[offset | 0x1000] = data; + else if (page >= 0x20 && page < 0x40) + prg8_ab(data & 0x0f); + else if (offset == 0x7fff) + set_nt_mirroring(BIT(data, 3) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); +} + /*------------------------------------------------- Bootleg Board used for FDS conversion @@ -1228,7 +1382,7 @@ uint8_t nes_09034a_device::read_m(offs_t offset) void nes_tobidase_device::write_l(offs_t offset, uint8_t data) { - LOG_MMC(("tobidase write_h, offset: %04x, data: %02x\n", offset, data)); + LOG_MMC(("tobidase write_l, offset: %04x, data: %02x\n", offset, data)); offset += 0x4100; if ((offset & 0x63c0) == 0x41c0) @@ -1335,7 +1489,6 @@ void nes_lh10_device::write_h(offs_t offset, uint8_t data) if (offset >= 0x4000 && offset < 0x6000) m_prgram[offset & 0x1fff] = data; - else { switch (offset & 0x6001) diff --git a/src/devices/bus/nes/bootleg.h b/src/devices/bus/nes/bootleg.h index b47bb17bfee..498df640279 100644 --- a/src/devices/bus/nes/bootleg.h +++ b/src/devices/bus/nes/bootleg.h @@ -231,6 +231,28 @@ private: }; +// ======================> nes_0353_device + +class nes_0353_device : public nes_nrom_device +{ +public: + // construction/destruction + nes_0353_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + virtual u8 read_m(offs_t offset) 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; + +private: + u8 m_reg; +}; + + // ======================> nes_09034a_device class nes_09034a_device : public nes_nrom_device @@ -253,6 +275,30 @@ private: }; +// ======================> nes_palthena_device + +class nes_palthena_device : public nes_nrom_device +{ +public: + // construction/destruction + nes_palthena_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + virtual u8 read_m(offs_t offset) override; + virtual u8 read_h(offs_t offset) override; + virtual void write_m(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; + +private: + u8 m_reg; +}; + + // ======================> nes_tobidase_device class nes_tobidase_device : public nes_nrom_device @@ -445,6 +491,7 @@ private: uint8_t m_reg[2]; }; + // ======================> nes_ac08_device class nes_ac08_device : public nes_nrom_device @@ -485,6 +532,7 @@ protected: virtual void device_start() override; }; + // ======================> nes_shuiguan_device class nes_shuiguan_device : public nes_nrom_device @@ -542,7 +590,9 @@ DECLARE_DEVICE_TYPE(NES_BTL_DNINJA, nes_btl_dn_device) DECLARE_DEVICE_TYPE(NES_SMB2J, nes_smb2j_device) DECLARE_DEVICE_TYPE(NES_SMB2JA, nes_smb2ja_device) DECLARE_DEVICE_TYPE(NES_SMB2JB, nes_smb2jb_device) +DECLARE_DEVICE_TYPE(NES_0353, nes_0353_device) DECLARE_DEVICE_TYPE(NES_09034A, nes_09034a_device) +DECLARE_DEVICE_TYPE(NES_PALTHENA, nes_palthena_device) DECLARE_DEVICE_TYPE(NES_TOBIDASE, nes_tobidase_device) DECLARE_DEVICE_TYPE(NES_DH08, nes_dh08_device) DECLARE_DEVICE_TYPE(NES_LE05, nes_le05_device) @@ -557,5 +607,4 @@ DECLARE_DEVICE_TYPE(NES_MMALEE, nes_mmalee_device) DECLARE_DEVICE_TYPE(NES_SHUIGUAN, nes_shuiguan_device) DECLARE_DEVICE_TYPE(NES_RT01, nes_rt01_device) - #endif // MAME_BUS_NES_BOOTLEG_H diff --git a/src/devices/bus/nes/nes_carts.cpp b/src/devices/bus/nes/nes_carts.cpp index 895176147cf..28f9ce9e443 100644 --- a/src/devices/bus/nes/nes_carts.cpp +++ b/src/devices/bus/nes/nes_carts.cpp @@ -297,7 +297,9 @@ void nes_cart(device_slot_interface &device) device.option_add_internal("smb2j", NES_SMB2J); device.option_add_internal("smb2ja", NES_SMB2JA); device.option_add_internal("smb2jb", NES_SMB2JB); + device.option_add_internal("btl_0353", NES_0353); // used by Lucky (Roger) Rabbit FDS conversion device.option_add_internal("09034a", NES_09034A); + device.option_add_internal("palthena", NES_PALTHENA); // used by Palthena no Kagami FDS conversion device.option_add_internal("tobidase", NES_TOBIDASE); // mapper 120 device.option_add_internal("mmalee2", NES_MMALEE); // mapper 55 device.option_add_internal("unl_2708", NES_2708); // mapper 103 diff --git a/src/devices/bus/nes/nes_pcb.hxx b/src/devices/bus/nes/nes_pcb.hxx index 1f9e94e3c0a..d0026b1a377 100644 --- a/src/devices/bus/nes/nes_pcb.hxx +++ b/src/devices/bus/nes/nes_pcb.hxx @@ -205,7 +205,9 @@ static const nes_pcb pcb_list[] = { "smb2j", UNL_SMB2J }, { "smb2ja", BTL_SMB2JA }, { "smb2jb", BTL_SMB2JB }, + { "btl_0353", BTL_0353 }, { "09034a", BTL_09034A }, + { "palthena", BTL_PALTHENA }, { "tobidase", BTL_TOBIDASE }, // mapper 120 { "dbz5", REXSOFT_DBZ5 }, { "sl1632", REXSOFT_SL1632 }, diff --git a/src/devices/bus/nes/nes_slot.h b/src/devices/bus/nes/nes_slot.h index 313f0fb275f..b1c992f1ffb 100644 --- a/src/devices/bus/nes/nes_slot.h +++ b/src/devices/bus/nes/nes_slot.h @@ -111,7 +111,7 @@ enum /* Bootleg boards */ BTL_SMB2JA, BTL_MARIOBABY, BTL_AISENSHINICOL, BTL_TOBIDASE, BTL_SMB2JB, BTL_09034A, BTL_SMB3, BTL_SBROS11, BTL_DRAGONNINJA, - BTL_PIKACHUY2K, BTL_SHUIGUAN, + BTL_PIKACHUY2K, BTL_SHUIGUAN, BTL_0353, BTL_PALTHENA, /* Kaiser */ KAISER_KS202, KAISER_KS7010, KAISER_KS7012, KAISER_KS7013B, KAISER_KS7016, KAISER_KS7017, KAISER_KS7022, KAISER_KS7030, diff --git a/src/mame/machine/nes.cpp b/src/mame/machine/nes.cpp index ded7bc9e531..be8cc45d2e0 100644 --- a/src/mame/machine/nes.cpp +++ b/src/mame/machine/nes.cpp @@ -72,7 +72,7 @@ void nes_state::machine_start() // install additional handlers (read_h, read_ex, write_ex) if (m_cartslot->get_pcb_id() == STD_EXROM || m_cartslot->get_pcb_id() == STD_NROM368 || m_cartslot->get_pcb_id() == STD_DISKSYS || m_cartslot->get_pcb_id() == GG_NROM || m_cartslot->get_pcb_id() == CAMERICA_ALADDIN || m_cartslot->get_pcb_id() == SUNSOFT_DCS - || m_cartslot->get_pcb_id() == BANDAI_DATACH || m_cartslot->get_pcb_id() == BANDAI_KARAOKE || m_cartslot->get_pcb_id() == UNL_2A03PURITANS || m_cartslot->get_pcb_id() == AVE_MAXI15 + || m_cartslot->get_pcb_id() == BANDAI_DATACH || m_cartslot->get_pcb_id() == BANDAI_KARAOKE || m_cartslot->get_pcb_id() == UNL_2A03PURITANS || m_cartslot->get_pcb_id() == AVE_MAXI15 || m_cartslot->get_pcb_id() == BTL_PALTHENA || m_cartslot->get_pcb_id() == KAISER_KS7010 || m_cartslot->get_pcb_id() == KAISER_KS7022 || m_cartslot->get_pcb_id() == KAISER_KS7030 || m_cartslot->get_pcb_id() == KAISER_KS7031 || m_cartslot->get_pcb_id() == KAISER_KS7037 || m_cartslot->get_pcb_id() == KAISER_KS7057 || m_cartslot->get_pcb_id() == BMC_VT5201 || m_cartslot->get_pcb_id() == UNL_LH32 || m_cartslot->get_pcb_id() == UNL_LH10 || m_cartslot->get_pcb_id() == UNL_2708 || m_cartslot->get_pcb_id() == UNL_RT01 || m_cartslot->get_pcb_id() == UNL_43272 || m_cartslot->get_pcb_id() == BMC_G63IN1 || m_cartslot->get_pcb_id() == BMC_8157 -- cgit v1.2.3