diff options
author | 2021-08-20 06:34:16 -0800 | |
---|---|---|
committer | 2021-08-20 10:34:16 -0400 | |
commit | f41d29f579b6ffbc32e9b5a9706dcb678b86090d (patch) | |
tree | 24fb6f1531841531ceeb4d631c6f704a27e35d59 | |
parent | d64f928c36856a908608997b09b81aa6ed2b6bda (diff) |
bus/nes: Fixed a Boogerman bootleg. (#8472)
- Reorganized sglionk (Super Game bootleg games) around lookup tables for its register/address scrambling.
- Implemented Boogerman in terms of sglionk, since it is functionally identical with different scrambling permutations.
New working software list additions (nes.xml)
-----------------------------------
The Lion King (pirate, alt 2) [Consolethinks]
Software list items promoted to working (nes.xml)
---------------------------------------
Boogerman (Rus)
-rw-r--r-- | hash/nes.xml | 24 | ||||
-rw-r--r-- | src/devices/bus/nes/mmc3_clones.cpp | 127 | ||||
-rw-r--r-- | src/devices/bus/nes/mmc3_clones.h | 27 |
3 files changed, 111 insertions, 67 deletions
diff --git a/hash/nes.xml b/hash/nes.xml index b9e96892c00..09a26739851 100644 --- a/hash/nes.xml +++ b/hash/nes.xml @@ -72287,7 +72287,7 @@ Other </part> </software> - <software name="booger" supported="no"> + <software name="booger"> <description>Boogerman (Rus)</description> <year>19??</year> <publisher>Sugar Softec</publisher> @@ -73437,9 +73437,9 @@ Other </software> <software name="lionkingp2" cloneof="lionking"> - <description>The Lion King (Pirate, Super Game, Alt)</description> - <year>19??</year> - <publisher><pirate></publisher> + <description>The Lion King (pirate, alt)</description> + <year>199?</year> + <publisher>Super Game</publisher> <part name="cart" interface="nes_cart"> <feature name="slot" value="sg_lionk" /> <feature name="pcb" value="UNL-SUPERGAME" /> @@ -73452,6 +73452,22 @@ Other </part> </software> + <software name="lionkingp3" cloneof="lionking"> + <description>The Lion King (pirate, alt 2)</description> + <year>199?</year> + <publisher>Super Game</publisher> + <part name="cart" interface="nes_cart"> + <feature name="slot" value="sg_lionk" /> + <feature name="pcb" value="UNL-SUPERGAME" /> + <dataarea name="prg" size="262144"> + <rom name="super lion king (rev0).prg" size="262144" crc="6de1fc41" sha1="2be2b2f4639a1e0b9a654e0cca7736da5486fd91" status="baddump" /> + </dataarea> + <dataarea name="chr" size="262144"> + <rom name="super lion king (rev0).chr" size="262144" crc="cf6908dd" sha1="2bb3d606ce7f84f540279ef4458a32d9560407bc" status="baddump" /> + </dataarea> + </part> + </software> + <software name="mermaidh" cloneof="mermaid"> <description>Little Mermaid (Pirate)</description> <year>19??</year> diff --git a/src/devices/bus/nes/mmc3_clones.cpp b/src/devices/bus/nes/mmc3_clones.cpp index 328efb0837e..0d49c23e1d6 100644 --- a/src/devices/bus/nes/mmc3_clones.cpp +++ b/src/devices/bus/nes/mmc3_clones.cpp @@ -109,13 +109,33 @@ nes_8237_device::nes_8237_device(const machine_config &mconfig, const char *tag, { } -nes_sglionk_device::nes_sglionk_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : nes_txrom_device(mconfig, NES_SG_LIONK, tag, owner, clock), m_reg(0), m_reg_enabled(0) +nes_sglionk_device::nes_sglionk_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, const u8 *reg_table, const u16 *addr_table) + : nes_txrom_device(mconfig, type, tag, owner, clock) + , m_mmc3_mode(true) + , m_reg_table(reg_table) + , m_addr_table(addr_table) { } -nes_sgboog_device::nes_sgboog_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : nes_txrom_device(mconfig, NES_SG_BOOG, tag, owner, clock), m_mode(0) +nes_sglionk_device::nes_sglionk_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : nes_sglionk_device(mconfig, + NES_SG_LIONK, + tag, + owner, + clock, + (const u8 []) {0, 3, 1, 5, 6, 7, 2, 4}, + (const u16 []) {0xa001, 0xa000, 0x8000, 0xc000, 0x8001, 0xc001, 0xe000, 0xe001}) +{ +} + +nes_sgboog_device::nes_sgboog_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : nes_sglionk_device(mconfig, + NES_SG_BOOG, + tag, + owner, + clock, + (const u8 []) {0, 2, 5, 3, 6, 1, 7, 4}, + (const u16 []) {0xa001, 0x8001, 0x8000, 0xc001, 0xa000, 0xc000, 0xe000, 0xe001}) { } @@ -338,18 +358,18 @@ void nes_8237_device::pcb_reset() void nes_sglionk_device::device_start() { mmc3_start(); - save_item(NAME(m_reg)); - save_item(NAME(m_reg_enabled)); + save_item(NAME(m_mmc3_mode)); } void nes_sglionk_device::pcb_reset() { m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; - m_reg = m_reg_enabled = 0; + m_mmc3_mode = true; mmc3_common_initialize(0xff, 0xff, 0); } +/* void nes_sgboog_device::device_start() { mmc3_start(); @@ -369,6 +389,7 @@ void nes_sgboog_device::pcb_reset() set_prg(m_prg_base, m_prg_mask); set_chr(m_chr_source, m_chr_base, m_chr_mask); } +*/ void nes_kasing_device::device_start() { @@ -1008,89 +1029,78 @@ void nes_8237_device::write_h(offs_t offset, uint8_t data) Bootleg Board by Super Game - Games: The Lion King + Games: The Lion King, Aladdin, Boogerman - MMC3 clone. + MMC3 clone with register and address scrambling and + a few extra banking modes by writing 0x6000-0x7fff. iNES: mapper 114 - In MESS: Supported. + In MAME: Supported. + + TODO: pocohon and sdkong should also work on this device. -------------------------------------------------*/ -void nes_sglionk_device::write_m(offs_t offset, uint8_t data) +void nes_sglionk_device::prg_cb(int start, int bank) { - LOG_MMC(("sglionk write_m, offset: %04x, data: %02x\n", offset, data)); - - m_reg = data; - - if (m_reg & 0x80) - { - prg16_89ab(data & 0x1f); - prg16_cdef(data & 0x1f); - } - else - set_prg(m_prg_base, m_prg_mask); - + if (m_mmc3_mode) + nes_txrom_device::prg_cb(start, bank); } -void nes_sglionk_device::write_h(offs_t offset, uint8_t data) +void nes_sglionk_device::write_m(offs_t offset, u8 data) { - static const uint8_t conv_table[8] = {0, 3, 1, 5, 6, 7, 2, 4}; - LOG_MMC(("sglionk write_h, offset: %04x, data: %02x\n", offset, data)); + LOG_MMC(("sglionk write_m, offset: %04x, data: %02x\n", offset, data)); - if (offset < 0x6000) + if (BIT(offset, 0)) { - switch (offset & 0x6000) - { - case 0x0000: - set_nt_mirroring(BIT(data, 0) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); - break; - case 0x2000: - m_reg_enabled = 1; - data = (data & 0xc0) | conv_table[data & 0x07]; - txrom_write(0x0000, data); - break; - case 0x4000: - if (m_reg_enabled && (m_reg & 0x80) == 0) - { - m_reg_enabled = 0; - txrom_write(0x0001, data); - } - break; - } + m_chr_base = BIT(data, 0) << 8; + set_chr(m_chr_source, m_chr_base, m_chr_mask); } else { - switch (offset & 0x03) + m_mmc3_mode = !BIT(data, 7); + if (m_mmc3_mode) + set_prg(m_prg_base, m_prg_mask); + else { - case 0x02: - txrom_write(0x6000, data); - break; - case 0x03: - txrom_write(0x6001, data); - txrom_write(0x4000, data); - txrom_write(0x4001, data); - break; + u8 bank = data & 0x0f; + u8 mode = BIT(data, 5); + prg16_89ab(bank & ~mode); + prg16_cdef(bank | mode); } } } +void nes_sglionk_device::write_h(offs_t offset, u8 data) +{ + LOG_MMC(("sglionk write_h, offset: %04x, data: %02x\n", offset, data)); + + u16 addr = m_addr_table[bitswap<3>(offset, 14, 13, 0)]; + if (addr == 0x8000) + data = (data & 0xc0) | m_reg_table[data & 0x07]; + txrom_write(addr & 0x6001, data); +} + /*------------------------------------------------- Bootleg Board by Super Game - Games: Boogerman, Mortal Kombat III + Games: Mortal Kombat III - MMC3 clone. Also, it probably needs a hack to support both - variants (Boogerman & MK3). + MMC3 clone. iNES: mapper 215 In MESS: Preliminary support. - -------------------------------------------------*/ + FIXME: Set "booger" has moved to sglionk's mapper 114 implementation. We have + three competing implementations left for mapper 215: 8237_device, gc6in1, and + this commented out sgboog, plus unimplemented 8237a is a similar variant. None + of them work for all the mapper 215 games (old sgboog games never worked!) + -------------------------------------------------*/ +/* void nes_sgboog_device::prg_cb(int start, int bank) { if (!(m_reg[0] & 0x80)) // if this is != 0 we should never even arrive here @@ -1227,6 +1237,7 @@ void nes_sgboog_device::write_h(offs_t offset, uint8_t data) else txrom_write(offset, data); } +*/ /*------------------------------------------------- diff --git a/src/devices/bus/nes/mmc3_clones.h b/src/devices/bus/nes/mmc3_clones.h index 5e0f926543c..3c2f6f6e540 100644 --- a/src/devices/bus/nes/mmc3_clones.h +++ b/src/devices/bus/nes/mmc3_clones.h @@ -129,23 +129,39 @@ class nes_sglionk_device : public nes_txrom_device { public: // construction/destruction - nes_sglionk_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + nes_sglionk_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); - virtual void write_m(offs_t offset, uint8_t data) override; - virtual void write_h(offs_t offset, uint8_t data) override; + virtual void write_m(offs_t offset, u8 data) override; + virtual void write_h(offs_t offset, u8 data) override; + virtual void prg_cb(int start, int bank) override; virtual void pcb_reset() override; protected: + // construction/destruction + nes_sglionk_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, const u8 *reg_table, const u16 *addr_table); + // device-level overrides virtual void device_start() override; private: - uint8_t m_reg; - int m_reg_enabled; + bool m_mmc3_mode; + const u8 *m_reg_table; + const u16 *m_addr_table; +}; + + +// ======================> nes_sgboog_device + +class nes_sgboog_device : public nes_sglionk_device +{ +public: + // construction/destruction + nes_sgboog_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; +/* // ======================> nes_sgboog_device class nes_sgboog_device : public nes_txrom_device @@ -171,6 +187,7 @@ private: uint8_t m_reg[3]; uint8_t m_mode; }; +*/ // ======================> nes_kasing_device |