diff options
Diffstat (limited to 'src/devices/bus/nes/bandai.cpp')
-rw-r--r-- | src/devices/bus/nes/bandai.cpp | 87 |
1 files changed, 39 insertions, 48 deletions
diff --git a/src/devices/bus/nes/bandai.cpp b/src/devices/bus/nes/bandai.cpp index 1dd82f1747d..66bd016c45a 100644 --- a/src/devices/bus/nes/bandai.cpp +++ b/src/devices/bus/nes/bandai.cpp @@ -34,13 +34,14 @@ #include "emu.h" #include "bandai.h" +#define LOG_UNHANDLED (1U << 1) + #ifdef NES_PCB_DEBUG -#define VERBOSE 1 +#define VERBOSE (LOG_UNHANDLED | LOG_GENERAL) #else -#define VERBOSE 0 +#define VERBOSE (LOG_UNHANDLED) #endif - -#define LOG_MMC(x) do { if (VERBOSE) logerror x; } while (0) +#include "logmacro.h" @@ -115,7 +116,6 @@ void nes_oekakids_device::pcb_reset() prg32(0); chr4_0(0, CHRRAM); chr4_4(3, CHRRAM); - set_nt_mirroring(PPU_MIRROR_LOW); m_latch = 0; m_reg = 0; } @@ -123,7 +123,7 @@ void nes_oekakids_device::pcb_reset() void nes_fcg_device::device_start() { common_start(); - irq_timer = timer_alloc(TIMER_IRQ); + irq_timer = timer_alloc(FUNC(nes_fcg_device::irq_timer_tick), this); irq_timer->adjust(attotime::zero, 0, clocks_to_attotime(1)); save_item(NAME(m_irq_enable)); @@ -132,7 +132,6 @@ void nes_fcg_device::device_start() void nes_fcg_device::pcb_reset() { - m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; prg16_89ab(0); prg16_cdef(m_prg_chunks - 1); chr8(0, m_chr_source); @@ -144,7 +143,7 @@ void nes_fcg_device::pcb_reset() void nes_lz93d50_24c01_device::device_start() { common_start(); - irq_timer = timer_alloc(TIMER_IRQ); + irq_timer = timer_alloc(FUNC(nes_lz93d50_24c01_device::irq_timer_tick), this); irq_timer->adjust(attotime::zero, 0, clocks_to_attotime(1)); save_item(NAME(m_irq_enable)); @@ -154,7 +153,6 @@ void nes_lz93d50_24c01_device::device_start() void nes_lz93d50_24c01_device::pcb_reset() { - m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; prg16_89ab(0); prg16_cdef(m_prg_chunks - 1); chr8(0, m_chr_source); @@ -167,7 +165,7 @@ void nes_lz93d50_24c01_device::pcb_reset() void nes_fjump2_device::device_start() { common_start(); - irq_timer = timer_alloc(TIMER_IRQ); + irq_timer = timer_alloc(FUNC(nes_fjump2_device::irq_timer_tick), this); irq_timer->adjust(attotime::zero, 0, clocks_to_attotime(1)); save_item(NAME(m_reg)); @@ -200,39 +198,35 @@ void nes_fjump2_device::pcb_reset() iNES: mapper 96 - In MESS: Preliminary Support. + In MAME: Preliminary Support. -------------------------------------------------*/ void nes_oekakids_device::nt_w(offs_t offset, uint8_t data) { - int page = ((offset & 0xc00) >> 10); - #if 0 if (!(offset & 0x1000) && (offset & 0x3ff) < 0x3c0) { - m_latch = (offset & 0x300) >> 8; + m_latch = BIT(offset, 8, 2); chr4_0(m_reg | m_latch, CHRRAM); } #endif - m_nt_access[page][offset & 0x3ff] = data; + device_nes_cart_interface::nt_w(offset, data); } uint8_t nes_oekakids_device::nt_r(offs_t offset) { - int page = ((offset & 0xc00) >> 10); - #if 0 if (!(offset & 0x1000) && (offset & 0x3ff) < 0x3c0) { - m_latch = (offset & 0x300) >> 8; + m_latch = BIT(offset, 8, 2); chr4_0(m_reg | m_latch, CHRRAM); } #endif - return m_nt_access[page][offset & 0x3ff]; + return device_nes_cart_interface::nt_r(offset); } void nes_oekakids_device::update_chr() @@ -247,7 +241,7 @@ void nes_oekakids_device::ppu_latch(offs_t offset) #if 0 if ((offset & 0x3000) == 0x2000) { - m_latch = (offset & 0x300) >> 8; + m_latch = BIT(offset, 8, 2); update_chr(); } #endif @@ -255,7 +249,7 @@ void nes_oekakids_device::ppu_latch(offs_t offset) void nes_oekakids_device::write_h(offs_t offset, uint8_t data) { - LOG_MMC(("oeka kids write_h, offset: %04x, data: %02x\n", offset, data)); + LOG("oeka kids write_h, offset: %04x, data: %02x\n", offset, data); prg32(data & 0x03); m_reg = data & 0x04; @@ -281,36 +275,33 @@ void nes_oekakids_device::write_h(offs_t offset, uint8_t data) iNES: mappers 16, 153 (see below), 157 & 159 - In MESS: Supported + In MAME: Supported -------------------------------------------------*/ -void nes_fcg_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +TIMER_CALLBACK_MEMBER(nes_fcg_device::irq_timer_tick) { - if (id == TIMER_IRQ) + if (m_irq_enable) { - if (m_irq_enable) + // 16bit counter, IRQ fired when the counter goes from 1 to 0 + // after firing, the counter is *not* reloaded, but next clock + // counter wraps around from 0 to 0xffff + if (!m_irq_count) + m_irq_count = 0xffff; + else + m_irq_count--; + + if (!m_irq_count) { - // 16bit counter, IRQ fired when the counter goes from 1 to 0 - // after firing, the counter is *not* reloaded, but next clock - // counter wraps around from 0 to 0xffff - if (!m_irq_count) - m_irq_count = 0xffff; - else - m_irq_count--; - - if (!m_irq_count) - { - set_irq_line(ASSERT_LINE); - m_irq_enable = 0; - } + set_irq_line(ASSERT_LINE); + m_irq_enable = 0; } } } void nes_fcg_device::fcg_write(offs_t offset, uint8_t data) { - LOG_MMC(("lz93d50_write, offset: %04x, data: %02x\n", offset, data)); + LOG("lz93d50_write, offset: %04x, data: %02x\n", offset, data); switch (offset & 0x0f) { @@ -341,14 +332,14 @@ void nes_fcg_device::fcg_write(offs_t offset, uint8_t data) m_irq_count = (m_irq_count & 0x00ff) | (data << 8); break; default: - logerror("lz93d50_write uncaught write, offset: %04x, data: %02x\n", offset, data); + LOGMASKED(LOG_UNHANDLED, "lz93d50_write uncaught write, offset: %04x, data: %02x\n", offset, data); break; } } void nes_fcg_device::write_m(offs_t offset, uint8_t data) { - LOG_MMC(("lz93d50 write_m, offset: %04x, data: %02x\n", offset, data)); + LOG("lz93d50 write_m, offset: %04x, data: %02x\n", offset, data); if (m_battery.empty() && m_prgram.empty()) fcg_write(offset & 0x0f, data); @@ -363,7 +354,7 @@ void nes_fcg_device::write_m(offs_t offset, uint8_t data) void nes_lz93d50_24c01_device::write_h(offs_t offset, uint8_t data) { - LOG_MMC(("lz93d50_24c01 write_h, offset: %04x, data: %02x\n", offset, data)); + LOG("lz93d50_24c01 write_h, offset: %04x, data: %02x\n", offset, data); switch (offset & 0x0f) { @@ -380,7 +371,7 @@ void nes_lz93d50_24c01_device::write_h(offs_t offset, uint8_t data) uint8_t nes_lz93d50_24c01_device::read_m(offs_t offset) { - LOG_MMC(("lz93d50 EEPROM read, offset: %04x\n", offset)); + LOG("lz93d50 EEPROM read, offset: %04x\n", offset); if (m_i2c_dir) return (m_i2cmem->read_sda() & 1) << 4; else @@ -393,7 +384,7 @@ uint8_t nes_lz93d50_24c01_device::read_m(offs_t offset) void nes_lz93d50_24c01_device::device_add_mconfig(machine_config &config) { - I2C_24C01(config, m_i2cmem); + I2C_X24C01(config, m_i2cmem); } void nes_lz93d50_24c02_device::device_add_mconfig(machine_config &config) @@ -415,7 +406,7 @@ void nes_lz93d50_24c02_device::device_add_mconfig(machine_config &config) iNES: mappers 153 - In MESS: Supported + In MAME: Supported -------------------------------------------------*/ @@ -432,19 +423,19 @@ void nes_fjump2_device::set_prg() uint8_t nes_fjump2_device::read_m(offs_t offset) { - LOG_MMC(("fjump2 read_m, offset: %04x\n", offset)); + LOG("fjump2 read_m, offset: %04x\n", offset); return m_battery[offset & (m_battery.size() - 1)]; } void nes_fjump2_device::write_m(offs_t offset, uint8_t data) { - LOG_MMC(("fjump2 write_m, offset: %04x, data: %02x\n", offset, data)); + LOG("fjump2 write_m, offset: %04x, data: %02x\n", offset, data); m_battery[offset & (m_battery.size() - 1)] = data; } void nes_fjump2_device::write_h(offs_t offset, uint8_t data) { - LOG_MMC(("fjump2 write_h, offset: %04x, data: %02x\n", offset, data)); + LOG("fjump2 write_h, offset: %04x, data: %02x\n", offset, data); switch (offset & 0x0f) { |