summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/nes/2a03pur.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/bus/nes/2a03pur.cpp')
-rw-r--r--src/devices/bus/nes/2a03pur.cpp27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/devices/bus/nes/2a03pur.cpp b/src/devices/bus/nes/2a03pur.cpp
index ed285bab98a..9425cfdadcf 100644
--- a/src/devices/bus/nes/2a03pur.cpp
+++ b/src/devices/bus/nes/2a03pur.cpp
@@ -19,12 +19,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"
//-------------------------------------------------
@@ -34,7 +33,7 @@
DEFINE_DEVICE_TYPE(NES_2A03PURITANS, nes_2a03pur_device, "nes_2a03pur", "NES Cart 2A03 Puritans Album PCB")
-nes_2a03pur_device::nes_2a03pur_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+nes_2a03pur_device::nes_2a03pur_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: nes_nrom_device(mconfig, NES_2A03PURITANS, tag, owner, clock)
{
}
@@ -45,14 +44,12 @@ void nes_2a03pur_device::device_start()
{
common_start();
save_item(NAME(m_reg));
- memset(m_reg, 0x00, sizeof(m_reg));
- m_reg[7] = 0xff & ((m_prg_chunks << 2) - 1);
+ std::fill(std::begin(m_reg), std::end(m_reg), 0x00);
+ m_reg[7] = 0xff;
}
void nes_2a03pur_device::pcb_reset()
{
- m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM;
- chr8(0, m_chr_source);
// register content is not touched by reset
}
@@ -93,17 +90,17 @@ void nes_2a03pur_device::pcb_reset()
This has been assigned to iNES mapper 31.
-------------------------------------------------*/
-void nes_2a03pur_device::write_l(offs_t offset, uint8_t data)
+void nes_2a03pur_device::write_l(offs_t offset, u8 data)
{
- LOG_MMC(("2a03 puritans write_l, offset: %04x, data: %02x\n", offset, data));
+ LOG("2a03 puritans write_l, offset: %04x, data: %02x\n", offset, data);
offset += 0x100;
if (offset >= 0x1000)
- m_reg[offset & 7] = data & ((m_prg_chunks << 2) - 1);
+ m_reg[offset & 7] = data;
}
-uint8_t nes_2a03pur_device::read_h(offs_t offset)
+u8 nes_2a03pur_device::read_h(offs_t offset)
{
- LOG_MMC(("2a03 puritans read_h, offset: %04x\n", offset));
+ LOG("2a03 puritans read_h, offset: %04x\n", offset);
- return m_prg[(m_reg[(offset >> 12) & 7] * 0x1000) + (offset & 0x0fff)];
+ return m_prg[((m_reg[BIT(offset, 12, 3)] * 0x1000) + (offset & 0x0fff)) & (m_prg_size - 1)];
}