From 3587aed8598058ca38357acc15bf38c89db63804 Mon Sep 17 00:00:00 2001 From: 0kmg <9137159+0kmg@users.noreply.github.com> Date: Sat, 30 Apr 2022 13:34:17 -0800 Subject: bus/nes: Updates for Camerica/Codemasters boards. (#9647) - BF9096: Added alternate paging required by certain dumps. Fixes menu items that didn't load or were crisscrossed. - Golden Five: Corrected reset/game lock behavior according to reverse engineered hardware info. --- hash/nes.xml | 36 ++++++------ src/devices/bus/nes/camerica.cpp | 110 ++++++++++++++++++------------------ src/devices/bus/nes/camerica.h | 31 +++++++--- src/devices/bus/nes/irem.h | 3 +- src/devices/bus/nes/jaleco.h | 2 +- src/devices/bus/nes/mmc3_clones.cpp | 4 +- src/devices/bus/nes/mmc3_clones.h | 8 +-- src/devices/bus/nes/nes_carts.cpp | 1 + src/devices/bus/nes/nes_ines.hxx | 10 +++- src/devices/bus/nes/nes_pcb.hxx | 1 + src/devices/bus/nes/nes_slot.h | 4 +- 11 files changed, 118 insertions(+), 92 deletions(-) diff --git a/hash/nes.xml b/hash/nes.xml index 5f08fa99973..2895a21edcd 100644 --- a/hash/nes.xml +++ b/hash/nes.xml @@ -30106,6 +30106,7 @@ license:CC0 + Quattro Arcade (USA) 1992 @@ -30124,7 +30125,8 @@ license:CC0 - + + Quattro Sports (USA) 1991 Camerica @@ -36501,8 +36503,8 @@ license:CC0 19?? Codemasters - - + + @@ -51230,8 +51232,9 @@ preliminary proto for the PAL version, still running on NTSC systems) or the gfx - - Super Sports Challenge (Euro, Plug-Thru Cart) + + + Super Sports Challenge (Euro, plug-thru cart) 19?? Codemasters @@ -51247,13 +51250,14 @@ preliminary proto for the PAL version, still running on NTSC systems) or the gfx - + + Super Sports Challenge (Euro) 19?? Codemasters - - + + @@ -85605,13 +85609,13 @@ be better to redump them properly. --> - - Pegasus 4 in 1 ~ Golden Four (Pol) - 19?? + + Pegasus 4 in 1 ~ Golden Four (Poland) + 199? <pirate> - - + + @@ -85623,9 +85627,9 @@ be better to redump them properly. --> - - Pegasus 5 in 1 ~ Golden Five (Pol) - 19?? + + Pegasus 5 in 1 ~ Golden Five (Poland) + 199? <pirate> diff --git a/src/devices/bus/nes/camerica.cpp b/src/devices/bus/nes/camerica.cpp index 831f3cd8a9d..fd80dca08b0 100644 --- a/src/devices/bus/nes/camerica.cpp +++ b/src/devices/bus/nes/camerica.cpp @@ -17,9 +17,8 @@ TODO: - - check what causes flickering from PPU in Fire Hawk, Poogie and Big Nose (same PPU issue as Back to - Future 2&3?) - - not all the Golden Five games work. investigate! + - check what causes flickering from PPU in Fire Hawk, Pogie and Big Nose Freaks Out (same PPU issue as Back to Future 2&3?) + - mapper 232 games need properly dumped to determine if the "alt" BF9096 board really exists. ***********************************************************************************************************/ @@ -43,21 +42,32 @@ DEFINE_DEVICE_TYPE(NES_BF9093, nes_bf9093_device, "nes_bf9093", "NES Cart Camerica BF9093 PCB") DEFINE_DEVICE_TYPE(NES_BF9096, nes_bf9096_device, "nes_bf9096", "NES Cart Camerica BF9096 PCB") +DEFINE_DEVICE_TYPE(NES_BF9096A, nes_bf9096a_device, "nes_bf9096a", "NES Cart Camerica BF9096 Alt PCB") DEFINE_DEVICE_TYPE(NES_GOLDEN5, nes_golden5_device, "nes_golden5", "NES Cart Camerica Golden 5 PCB") -nes_bf9093_device::nes_bf9093_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +nes_bf9093_device::nes_bf9093_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : nes_nrom_device(mconfig, NES_BF9093, tag, owner, clock) { } -nes_bf9096_device::nes_bf9096_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : nes_nrom_device(mconfig, NES_BF9096, tag, owner, clock), m_bank_base(0), m_latch(0) +nes_bf9096_device::nes_bf9096_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, bool page_swap) + : nes_nrom_device(mconfig, type, tag, owner, clock), m_reg(0), m_page_swap(page_swap) { } -nes_golden5_device::nes_golden5_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : nes_nrom_device(mconfig, NES_GOLDEN5, tag, owner, clock), m_bank_base(0), m_latch(0) +nes_bf9096_device::nes_bf9096_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : nes_bf9096_device(mconfig, NES_BF9096, tag, owner, clock, false) +{ +} + +nes_bf9096a_device::nes_bf9096a_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : nes_bf9096_device(mconfig, NES_BF9096A, tag, owner, clock, true) +{ +} + +nes_golden5_device::nes_golden5_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : nes_nrom_device(mconfig, NES_GOLDEN5, tag, owner, clock), m_lock(0), m_reg(0) { } @@ -66,50 +76,46 @@ nes_golden5_device::nes_golden5_device(const machine_config &mconfig, const char void nes_bf9093_device::pcb_reset() { - m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; - prg32(0xff); - chr8(0, m_chr_source); + prg16_89ab(0); + prg16_cdef(m_prg_chunks - 1); + if (m_pcb_ctrl_mirror) + set_nt_mirroring(PPU_MIRROR_LOW); } void nes_bf9096_device::device_start() { common_start(); - save_item(NAME(m_latch)); - save_item(NAME(m_bank_base)); + save_item(NAME(m_reg)); } void nes_bf9096_device::pcb_reset() { - m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; - chr8(0, m_chr_source); + prg16_89ab(0); + prg16_cdef(3); - m_latch = 0x00; - m_bank_base = 0x0c; - prg16_89ab(m_bank_base | m_latch); - prg16_cdef(m_bank_base | 3); + m_reg = 0; } void nes_golden5_device::device_start() { common_start(); - save_item(NAME(m_latch)); + save_item(NAME(m_lock)); + save_item(NAME(m_reg)); + + // these are not cleared on reset + m_lock = 0; + m_reg = 0; } void nes_golden5_device::pcb_reset() { - m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; - chr8(0, m_chr_source); - - m_latch = 0x00; - m_bank_base = 0x00; - prg16_89ab(m_bank_base | m_latch); - prg16_cdef(m_bank_base | 0x0f); + prg16_89ab(m_reg); + prg16_cdef(m_reg | 0x0f); } - /*------------------------------------------------- mapper specific handlers -------------------------------------------------*/ @@ -127,25 +133,22 @@ void nes_golden5_device::pcb_reset() iNES: mapper 71 - In MESS: Partially Supported. + In MAME: Partially supported. -------------------------------------------------*/ -void nes_bf9093_device::write_h(offs_t offset, uint8_t data) +void nes_bf9093_device::write_h(offs_t offset, u8 data) { LOG_MMC(("bf9093 write_h, offset: %04x, data: %02x\n", offset, data)); - switch (offset & 0x7000) + switch (offset & 0x6000) { case 0x0000: - case 0x1000: if (m_pcb_ctrl_mirror) set_nt_mirroring(BIT(data, 4) ? PPU_MIRROR_HIGH : PPU_MIRROR_LOW); break; case 0x4000: - case 0x5000: case 0x6000: - case 0x7000: prg16_89ab(data); break; } @@ -165,24 +168,26 @@ void nes_bf9093_device::write_h(offs_t offset, uint8_t data) iNES: mapper 232 - In MESS: Supported. + In MAME: Supported. -------------------------------------------------*/ -void nes_bf9096_device::write_h(offs_t offset, uint8_t data) +void nes_bf9096_device::write_h(offs_t offset, u8 data) { LOG_MMC(("bf9096 write_h, offset: %04x, data: %02x\n", offset, data)); if (offset < 0x4000) { - m_bank_base = (data & 0x18) >> 1; - prg16_89ab(m_bank_base | m_latch); - prg16_cdef(m_bank_base | 3); + m_reg = (m_reg & 0x03) | (data & 0x18) >> 1; + if (m_page_swap) + m_reg = bitswap<4>(m_reg, 2, 3, 1, 0); + prg16_89ab(m_reg); + prg16_cdef(m_reg | 0x03); } else { - m_latch = data & 3; - prg16_89ab(m_bank_base | m_latch); + m_reg = (m_reg & 0x0c) | (data & 0x03); + prg16_89ab(m_reg); } } @@ -194,27 +199,24 @@ void nes_bf9096_device::write_h(offs_t offset, uint8_t data) iNES: mapper 104 - In MESS: Supported. + In MAME: Supported. -------------------------------------------------*/ -void nes_golden5_device::write_h(offs_t offset, uint8_t data) +void nes_golden5_device::write_h(offs_t offset, u8 data) { LOG_MMC(("golden5 write_h, offset: %04x, data: %02x\n", offset, data)); - if (offset < 0x4000) + if (offset >= 0x4000) { - if (data & 0x08) - { - m_bank_base = (data & 0x07) << 4; - prg16_89ab(m_bank_base | m_latch); - prg16_cdef(m_bank_base | 0x0f); - } - + m_reg = (m_reg & 0x70) | (data & 0x0f); + prg16_89ab(m_reg); } - else + else if (!m_lock) { - m_latch = data & 0x0f; - prg16_89ab(m_bank_base | m_latch); + m_lock = BIT(data, 3); + m_reg = (m_reg & 0x0f) | (data & 0x07) << 4; + prg16_89ab(m_reg); + prg16_cdef(m_reg | 0x0f); } } diff --git a/src/devices/bus/nes/camerica.h b/src/devices/bus/nes/camerica.h index 3346628f324..0c2c2487361 100644 --- a/src/devices/bus/nes/camerica.h +++ b/src/devices/bus/nes/camerica.h @@ -14,9 +14,9 @@ class nes_bf9093_device : public nes_nrom_device { public: // construction/destruction - nes_bf9093_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + nes_bf9093_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; virtual void pcb_reset() override; }; @@ -28,19 +28,31 @@ class nes_bf9096_device : public nes_nrom_device { public: // construction/destruction - nes_bf9096_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + nes_bf9096_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_m(offs_t offset, uint8_t data) override { write_h(offset, data); } + virtual void write_h(offs_t offset, u8 data) override; virtual void pcb_reset() override; protected: + nes_bf9096_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, bool page_swap); + // device-level overrides virtual void device_start() override; private: - uint8_t m_bank_base, m_latch; + u8 m_reg; + const bool m_page_swap; +}; + + +// ======================> nes_bf9096a_device + +class nes_bf9096a_device : public nes_bf9096_device +{ +public: + // construction/destruction + nes_bf9096a_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; @@ -50,9 +62,9 @@ class nes_golden5_device : public nes_nrom_device { public: // construction/destruction - nes_golden5_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + nes_golden5_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; virtual void pcb_reset() override; @@ -61,13 +73,14 @@ protected: virtual void device_start() override; private: - uint8_t m_bank_base, m_latch; + u8 m_lock, m_reg; }; // device type definition DECLARE_DEVICE_TYPE(NES_BF9093, nes_bf9093_device) DECLARE_DEVICE_TYPE(NES_BF9096, nes_bf9096_device) +DECLARE_DEVICE_TYPE(NES_BF9096A, nes_bf9096a_device) DECLARE_DEVICE_TYPE(NES_GOLDEN5, nes_golden5_device) #endif // MAME_BUS_NES_CAMERICA_H diff --git a/src/devices/bus/nes/irem.h b/src/devices/bus/nes/irem.h index 7aa6c47a11f..476d85f6735 100644 --- a/src/devices/bus/nes/irem.h +++ b/src/devices/bus/nes/irem.h @@ -73,7 +73,8 @@ protected: u8 m_latch; private: - u8 m_reg, m_prg_mask; + u8 m_reg; + const u8 m_prg_mask; }; diff --git a/src/devices/bus/nes/jaleco.h b/src/devices/bus/nes/jaleco.h index 55c3161126c..0b81626c4bf 100644 --- a/src/devices/bus/nes/jaleco.h +++ b/src/devices/bus/nes/jaleco.h @@ -76,7 +76,7 @@ protected: private: u8 m_latch; - bool m_prg_flip; + const bool m_prg_flip; }; diff --git a/src/devices/bus/nes/mmc3_clones.cpp b/src/devices/bus/nes/mmc3_clones.cpp index 890924b2de1..432f305b758 100644 --- a/src/devices/bus/nes/mmc3_clones.cpp +++ b/src/devices/bus/nes/mmc3_clones.cpp @@ -193,7 +193,7 @@ nes_pikay2k_device::nes_pikay2k_device(const machine_config &mconfig, const char { } -nes_8237_device::nes_8237_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, int board) +nes_8237_device::nes_8237_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 board) : nes_txrom_device(mconfig, type, tag, owner, clock), m_board(board) { } @@ -223,7 +223,7 @@ nes_kasing_device::nes_kasing_device(const machine_config &mconfig, const char * { } -nes_sglionk_device::nes_sglionk_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, int board) +nes_sglionk_device::nes_sglionk_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 board) : nes_kasing_device(mconfig, type, tag, owner, clock), m_board(board) { } diff --git a/src/devices/bus/nes/mmc3_clones.h b/src/devices/bus/nes/mmc3_clones.h index b6d65994393..9c97a04f69e 100644 --- a/src/devices/bus/nes/mmc3_clones.h +++ b/src/devices/bus/nes/mmc3_clones.h @@ -143,7 +143,7 @@ public: protected: // construction/destruction - nes_8237_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, int board); + nes_8237_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 board); // device-level overrides virtual void device_start() override; @@ -151,7 +151,7 @@ protected: private: void update_banks(); u8 m_reg[3]; - const int m_board; + const u8 m_board; }; @@ -224,10 +224,10 @@ public: protected: // construction/destruction - nes_sglionk_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, int board); + nes_sglionk_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 board); private: - const int m_board; + const u8 m_board; }; diff --git a/src/devices/bus/nes/nes_carts.cpp b/src/devices/bus/nes/nes_carts.cpp index 5ea9c587d12..701d12eda22 100644 --- a/src/devices/bus/nes/nes_carts.cpp +++ b/src/devices/bus/nes/nes_carts.cpp @@ -191,6 +191,7 @@ void nes_cart(device_slot_interface &device) device.option_add_internal("nina006", NES_NINA006); device.option_add_internal("bf9093", NES_BF9093); device.option_add_internal("bf9096", NES_BF9096); + device.option_add_internal("bf9096a", NES_BF9096A); device.option_add_internal("goldenfive", NES_GOLDEN5); device.option_add_internal("ade", NES_ALADDIN); device.option_add_internal("cne_decathl", NES_CNE_DECATHL); diff --git a/src/devices/bus/nes/nes_ines.hxx b/src/devices/bus/nes/nes_ines.hxx index fc08abcffef..1d5266520e7 100644 --- a/src/devices/bus/nes/nes_ines.hxx +++ b/src/devices/bus/nes/nes_ines.hxx @@ -763,10 +763,9 @@ void nes_cart_slot_device::call_load_ines() m_cart->set_ce(0x03, ce_state); } // iNES Mapper 232 - else if (mapper == 210 && submapper == 1) + else if (mapper == 232 && submapper == 1) { - submapper = 0; - logerror("Unimplemented NES 2.0 submapper: CAMERICA-BF9096.\n"); + pcb_id = CAMERICA_BF9096_ALT; } // 268: SMD133 boards else if (mapper == 268) @@ -1283,6 +1282,11 @@ const char * nes_cart_slot_device::get_default_card_ines(get_default_card_softwa { pcb_id = SOMARI_HUANG2; // Mapper 116 is used for 2 diff boards } + // iNES Mapper 232 + else if (mapper == 232 && submapper == 1) + { + pcb_id = CAMERICA_BF9096_ALT; + } } // solve mapper conflicts diff --git a/src/devices/bus/nes/nes_pcb.hxx b/src/devices/bus/nes/nes_pcb.hxx index 48c7995417d..8e75f82aa01 100644 --- a/src/devices/bus/nes/nes_pcb.hxx +++ b/src/devices/bus/nes/nes_pcb.hxx @@ -102,6 +102,7 @@ static const nes_pcb pcb_list[] = { "maxi15", AVE_MAXI15 }, { "bf9093", CAMERICA_BF9093 }, { "bf9096", CAMERICA_BF9096 }, + { "bf9096a", CAMERICA_BF9096_ALT }, { "goldenfive", CAMERICA_GOLDENFIVE }, { "ade" , CAMERICA_ALADDIN }, { "cne_decathl", CNE_DECATHLON }, diff --git a/src/devices/bus/nes/nes_slot.h b/src/devices/bus/nes/nes_slot.h index 6370269332f..374c60b0233 100644 --- a/src/devices/bus/nes/nes_slot.h +++ b/src/devices/bus/nes/nes_slot.h @@ -45,8 +45,8 @@ enum // Caltron CALTRON_6IN1, CALTRON_9IN1, // Camerica - CAMERICA_BF9093, CAMERICA_BF9096, CAMERICA_ALADDIN, - CAMERICA_GOLDENFIVE, GG_NROM, + CAMERICA_BF9093, CAMERICA_BF9096, CAMERICA_BF9096_ALT, + CAMERICA_ALADDIN, CAMERICA_GOLDENFIVE, GG_NROM, // Dreamtech DREAMTECH_BOARD, // Irem -- cgit v1.2.3