summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author ajrhacker <ajrhacker@users.noreply.github.com>2021-08-21 11:22:50 -0400
committer GitHub <noreply@github.com>2021-08-21 11:22:50 -0400
commitd59f84feec17b275dda6da3cf52501fbb5eed373 (patch)
tree4614028a173ca56268b1e55ae424b9209b2d6684
parent8db344fcc57c17704e5267f8d93ed69bbd33d399 (diff)
parentd1c911e69972852805a8731fae3aefd69a9ada72 (diff)
Merge pull request #8479 from 0kmg/nes-114-redux
bus/nes: Revised Boogerman fix to more straightforward approach.
-rw-r--r--src/devices/bus/nes/mmc3_clones.cpp39
-rw-r--r--src/devices/bus/nes/mmc3_clones.h5
2 files changed, 20 insertions, 24 deletions
diff --git a/src/devices/bus/nes/mmc3_clones.cpp b/src/devices/bus/nes/mmc3_clones.cpp
index 7de58b6a127..7f230744bc7 100644
--- a/src/devices/bus/nes/mmc3_clones.cpp
+++ b/src/devices/bus/nes/mmc3_clones.cpp
@@ -112,33 +112,18 @@ nes_8237_device::nes_8237_device(const machine_config &mconfig, const char *tag,
{
}
-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_sglionk_device::nes_sglionk_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, int board)
+ : nes_txrom_device(mconfig, type, tag, owner, clock), m_mmc3_mode(true), m_board(board)
{
}
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_sglionk_device(mconfig, NES_SG_LIONK, tag, owner, clock, 0)
{
}
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})
+ : nes_sglionk_device(mconfig, NES_SG_BOOG, tag, owner, clock, 1)
{
}
@@ -1118,9 +1103,21 @@ 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)];
+ static constexpr u8 reg_table[2][8] =
+ {
+ {0, 3, 1, 5, 6, 7, 2, 4},
+ {0, 2, 5, 3, 6, 1, 7, 4}
+ };
+
+ static constexpr u16 addr_table[2][8] =
+ {
+ {0xa001, 0xa000, 0x8000, 0xc000, 0x8001, 0xc001, 0xe000, 0xe001},
+ {0xa001, 0x8001, 0x8000, 0xc001, 0xa000, 0xc000, 0xe000, 0xe001}
+ };
+
+ u16 addr = addr_table[m_board][bitswap<3>(offset, 14, 13, 0)];
if (addr == 0x8000)
- data = (data & 0xc0) | m_reg_table[data & 0x07];
+ data = (data & 0xc0) | reg_table[m_board][data & 0x07];
txrom_write(addr & 0x6001, data);
}
diff --git a/src/devices/bus/nes/mmc3_clones.h b/src/devices/bus/nes/mmc3_clones.h
index 6f71cd90295..662262a4313 100644
--- a/src/devices/bus/nes/mmc3_clones.h
+++ b/src/devices/bus/nes/mmc3_clones.h
@@ -139,15 +139,14 @@ public:
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);
+ nes_sglionk_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, int board);
// device-level overrides
virtual void device_start() override;
private:
bool m_mmc3_mode;
- const u8 *m_reg_table;
- const u16 *m_addr_table;
+ int m_board;
};