summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/nes/somari.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/bus/nes/somari.cpp')
-rw-r--r--src/devices/bus/nes/somari.cpp27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/devices/bus/nes/somari.cpp b/src/devices/bus/nes/somari.cpp
index cacbae4bd3b..15382d01111 100644
--- a/src/devices/bus/nes/somari.cpp
+++ b/src/devices/bus/nes/somari.cpp
@@ -17,12 +17,11 @@
#ifdef NES_PCB_DEBUG
-#define VERBOSE 1
+#define VERBOSE (LOG_GENERAL)
#else
-#define VERBOSE 0
+#define VERBOSE (0)
#endif
-
-#define LOG_MMC(x) do { if (VERBOSE) logerror x; } while (0)
+#include "logmacro.h"
#define SOMARI_VRC2_MODE 0
#define SOMARI_MMC3_MODE 1
@@ -37,18 +36,18 @@ DEFINE_DEVICE_TYPE(NES_SOMARI, nes_somari_device, "nes_somari", "NES Cart Team S
DEFINE_DEVICE_TYPE(NES_HUANG2, nes_huang2_device, "nes_huang2", "NES Cart Huang-2 PCB")
-nes_somari_device::nes_somari_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock)
- : nes_txrom_device(mconfig, type, tag, owner, clock), m_board_mode(0), m_mmc1_count(0), m_mmc1_latch(0), m_mmc1_prg_shift(type == NES_HUANG2), m_vrc_mirror(0)
+nes_somari_device::nes_somari_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 mmc1_prg_shift)
+ : nes_txrom_device(mconfig, type, tag, owner, clock), m_board_mode(0), m_mmc1_count(0), m_mmc1_latch(0), m_mmc1_prg_shift(mmc1_prg_shift), m_vrc_mirror(0)
{
}
nes_somari_device::nes_somari_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : nes_somari_device(mconfig, NES_SOMARI, tag, owner, clock)
+ : nes_somari_device(mconfig, NES_SOMARI, tag, owner, clock, 0)
{
}
nes_huang2_device::nes_huang2_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : nes_somari_device(mconfig, NES_HUANG2, tag, owner, clock)
+ : nes_somari_device(mconfig, NES_HUANG2, tag, owner, clock, 1)
{
}
@@ -73,8 +72,6 @@ void nes_somari_device::device_start()
void nes_somari_device::pcb_reset()
{
m_board_mode = SOMARI_MMC3_MODE;
-
- m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM;
mmc3_common_initialize(0xff, 0xff, 0);
// MMC1 regs
@@ -148,7 +145,7 @@ void nes_somari_device::mmc1_w(offs_t offset, u8 data)
m_mmc1_count = (m_mmc1_count + 1) % 5;
if (!m_mmc1_count)
{
- m_mmc1_reg[(offset & 0x6000) >> 13] = m_mmc1_latch;
+ m_mmc1_reg[BIT(offset, 13, 2)] = m_mmc1_latch;
update_all_banks();
}
}
@@ -196,7 +193,7 @@ void nes_somari_device::update_prg()
set_prg(m_prg_base, m_prg_mask);
break;
case SOMARI_MMC1_MODE:
- switch ((m_mmc1_reg[0] >> 2) & 3)
+ switch (BIT(m_mmc1_reg[0], 2, 2))
{
case 0:
case 1:
@@ -233,7 +230,7 @@ void nes_somari_device::update_chr()
chr4_4(m_mmc1_reg[2] & 0x1f, CHRROM);
}
else
- chr8((m_mmc1_reg[1] & 0x1f) >> 1, CHRROM);
+ chr8(BIT(m_mmc1_reg[1], 1, 4), CHRROM);
break;
}
}
@@ -262,7 +259,7 @@ void nes_somari_device::update_mirror()
void nes_somari_device::write_h(offs_t offset, u8 data)
{
- LOG_MMC(("somari write_h, mode %d, offset: %04x, data: %02x\n", m_board_mode, offset, data));
+ LOG("somari write_h, mode %d, offset: %04x, data: %02x\n", m_board_mode, offset, data);
switch (m_board_mode)
{
@@ -281,7 +278,7 @@ void nes_somari_device::update_all_banks()
void nes_somari_device::write_m(offs_t offset, u8 data)
{
- LOG_MMC(("somari write_m, offset: %04x, data: %02x\n", offset, data));
+ LOG("somari write_m, offset: %04x, data: %02x\n", offset, data);
if (offset & 0x100)
{