diff options
Diffstat (limited to 'src/devices/bus/nes/rcm.cpp')
-rw-r--r-- | src/devices/bus/nes/rcm.cpp | 226 |
1 files changed, 47 insertions, 179 deletions
diff --git a/src/devices/bus/nes/rcm.cpp b/src/devices/bus/nes/rcm.cpp index fdd07830381..73b78644170 100644 --- a/src/devices/bus/nes/rcm.cpp +++ b/src/devices/bus/nes/rcm.cpp @@ -8,14 +8,11 @@ Here we emulate the following PCBs + * RCM GS2004 [mapper 283] + * RCM GS2013 [mapper 283 also] * RCM GS2015 [mapper 216] - * RCM GS2004 - * RCM GS2013 * RCM Tetris Family 9in1 [mapper 61] - * RCM 3D Block - - TODO: - - investigate why 3D Block does not work + * RCM 3D Block [mapper 355] ***********************************************************************************************************/ @@ -24,23 +21,21 @@ #include "rcm.h" - #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" //------------------------------------------------- // constructor //------------------------------------------------- -DEFINE_DEVICE_TYPE(NES_GS2015, nes_gs2015_device, "nes_g2015", "NES Cart RCM GS-2015 PCB") -DEFINE_DEVICE_TYPE(NES_GS2004, nes_gs2004_device, "nes_g2004", "NES Cart RCM GS-2004 PCB") -DEFINE_DEVICE_TYPE(NES_GS2013, nes_gs2013_device, "nes_g2013", "NES Cart RCM GS-2013 PCB") +DEFINE_DEVICE_TYPE(NES_GS2004, nes_gs2004_device, "nes_gs2004", "NES Cart RCM GS-2004 PCB") +DEFINE_DEVICE_TYPE(NES_GS2013, nes_gs2013_device, "nes_gs2013", "NES Cart RCM GS-2013 PCB") +DEFINE_DEVICE_TYPE(NES_GS2015, nes_gs2015_device, "nes_gs2015", "NES Cart RCM GS-2015 PCB") DEFINE_DEVICE_TYPE(NES_TF9IN1, nes_tf9_device, "nes_tetrisfam", "NES Cart RCM Tetris Family 9 in 1 PCB") DEFINE_DEVICE_TYPE(NES_3DBLOCK, nes_3dblock_device, "nes_3dblock", "NES Cart RCM 3D Block PCB") @@ -50,93 +45,29 @@ nes_gs2015_device::nes_gs2015_device(const machine_config &mconfig, const char * { } -nes_gs2004_device::nes_gs2004_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : nes_nrom_device(mconfig, NES_GS2004, tag, owner, clock) -{ -} - -nes_gs2013_device::nes_gs2013_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : nes_nrom_device(mconfig, NES_GS2013, tag, owner, clock) -{ -} - -nes_tf9_device::nes_tf9_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : nes_nrom_device(mconfig, NES_TF9IN1, tag, owner, clock) -{ -} - -nes_3dblock_device::nes_3dblock_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : nes_nrom_device(mconfig, NES_3DBLOCK, tag, owner, clock), m_irq_count(0) -{ -} - - - - -void nes_gs2015_device::device_start() -{ - common_start(); -} - -void nes_gs2015_device::pcb_reset() -{ - m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; - prg32(0); - chr8(0, m_chr_source); -} - -void nes_gs2004_device::device_start() -{ - common_start(); -} - -void nes_gs2004_device::pcb_reset() +nes_gs2004_device::nes_gs2004_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, int bank) + : nes_nrom_device(mconfig, type, tag, owner, clock), m_base(bank * 0x2000) { - m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; - prg32(0xff); - chr8(0, m_chr_source); } -void nes_gs2013_device::device_start() +nes_gs2004_device::nes_gs2004_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : nes_gs2004_device(mconfig, NES_GS2004, tag, owner, clock, 0x20) { - common_start(); } -void nes_gs2013_device::pcb_reset() +nes_gs2013_device::nes_gs2013_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : nes_gs2004_device(mconfig, NES_GS2013, tag, owner, clock, 0x1f) { - m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; - prg32(0xff); - chr8(0, m_chr_source); } -void nes_tf9_device::device_start() -{ - common_start(); -} - -void nes_tf9_device::pcb_reset() -{ - m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; - prg32(0); - chr8(0, m_chr_source); -} - -void nes_3dblock_device::device_start() +nes_tf9_device::nes_tf9_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : nes_nrom_device(mconfig, NES_TF9IN1, tag, owner, clock) { - common_start(); - save_item(NAME(m_reg)); - save_item(NAME(m_irq_count)); } -void nes_3dblock_device::pcb_reset() +nes_3dblock_device::nes_3dblock_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : nes_nrom_device(mconfig, NES_3DBLOCK, tag, owner, clock) { - prg32(0); - chr8(0, CHRRAM); - m_reg[0] = 0; - m_reg[1] = 0; - m_reg[2] = 0; - m_reg[3] = 0; - m_irq_count = 0; } @@ -157,13 +88,14 @@ void nes_3dblock_device::pcb_reset() iNES: mapper 216 - In MESS: Supported. + In MAME: Partially supported. Bonza games have some + sort of card inputs for gambling purposes. -------------------------------------------------*/ void nes_gs2015_device::write_h(offs_t offset, uint8_t data) { - LOG_MMC(("gs2015 write_h, offset: %04x, data: %02x\n", offset, data)); + LOG("gs2015 write_h, offset: %04x, data: %02x\n", offset, data); prg32(offset); chr8(offset >> 1, m_chr_source); @@ -171,47 +103,32 @@ void nes_gs2015_device::write_h(offs_t offset, uint8_t data) uint8_t nes_gs2015_device::read_m(offs_t offset) { - LOG_MMC(("gs2015 read_m, offset: %04x\n", offset)); + LOG("gs2015 read_m, offset: %04x\n", offset); return 0; // Videopoker Bonza needs this (sort of protection? or related to inputs?) } /*------------------------------------------------- - Board BMC-GS2004 + Boards BMC-GS2004, BMC-GS2013 - Games: Tetris Family 6-in-1 + Games: Tetris Family 6-in-1, 5-in-1, 12-in-1 - In MESS: Preliminary Support. It also misses WRAM handling - (we need reads from 0x6000-0x7fff) + NES 2.0: mapper 283 + + In MAME: Supported. -------------------------------------------------*/ -void nes_gs2004_device::write_h(offs_t offset, uint8_t data) +u8 nes_gs2004_device::read_m(offs_t offset) { - LOG_MMC(("gs2004 write_h, offset: %04x, data: %02x\n", offset, data)); - - prg32(data); + LOG("gs2004 read_m, offset: %04x\n", offset); + return m_prg[m_base + offset]; // fixed base differs per device } -/*------------------------------------------------- - - Board BMC-GS2013 - - Games: Tetris Family 12-in-1 - - In MESS: Preliminary Support. It also misses WRAM handling - (we need reads from 0x6000-0x7fff) - - -------------------------------------------------*/ - -void nes_gs2013_device::write_h(offs_t offset, uint8_t data) +void nes_gs2004_device::write_h(offs_t offset, u8 data) { - LOG_MMC(("gs2013 write_h, offset: %04x, data: %02x\n", offset, data)); - - if (data & 0x08) - prg32(data & 0x09); - else - prg32(data & 0x07); + LOG("gs2004 write_h, offset: %04x, data: %02x\n", offset, data); + prg32(data); } /*------------------------------------------------- @@ -220,35 +137,22 @@ void nes_gs2013_device::write_h(offs_t offset, uint8_t data) Games: Tetris Family 9 in 1, 20 in 1 - Simple Mapper: prg/chr/nt are swapped depending on the offset - of writes in 0x8000-0xffff. offset&0x80 set NT mirroring, - when (offset&0x30) is 0,3 prg32 is set; when it is 1,2 - two 16k prg banks are set. See below for the values used in - these banks. - iNES: mapper 61 - In MESS: Supported. + In MAME: Supported. -------------------------------------------------*/ -void nes_tf9_device::write_h(offs_t offset, uint8_t data) +void nes_tf9_device::write_h(offs_t offset, u8 data) { - LOG_MMC(("tetrisfam write_h, offset: %04x, data: %02x\n", offset, data)); - - switch (offset & 0x30) - { - case 0x00: - case 0x30: - prg32(offset & 0x0f); - break; - case 0x10: - case 0x20: - prg16_89ab(((offset & 0x0f) << 1) | ((offset & 0x20) >> 4)); - prg16_cdef(((offset & 0x0f) << 1) | ((offset & 0x20) >> 4)); - break; - } - set_nt_mirroring(BIT(data, 7) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); + LOG("tetrisfam write_h, offset: %04x, data: %02x\n", offset, data); + + u8 bank = (offset & 0x0f) << 1 | BIT(offset, 5); + u8 mode = !BIT(offset, 4); + prg16_89ab(bank & ~mode); + prg16_cdef(bank | mode); + + set_nt_mirroring(BIT(offset, 7) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); } /*------------------------------------------------- @@ -257,46 +161,10 @@ void nes_tf9_device::write_h(offs_t offset, uint8_t data) Games: 3-D Block Hwang Shinwei version - iNES: + NES 2.0: mapper 355 - In MESS: Very Preliminary Support. What is the purpose - of the writes to $4800-$4900-$4a00? These writes - also happens on the RCM version, which however works - (probably an unused leftover code in that version) + In MAME: Not supported. - FCEUmm suggests it might be IRQ related, but - it does not seem to help much... + TODO: implement PIC16C54 protection -------------------------------------------------*/ - -void nes_3dblock_device::hblank_irq(int scanline, int vblank, int blanked) -{ - if (m_irq_count) - { - m_irq_count--; - if (!m_irq_count) - hold_irq_line(); - } -} - -void nes_3dblock_device::write_l(offs_t offset, uint8_t data) -{ - LOG_MMC(("3dblock write_l, offset: %04x, data: %02x\n", offset, data)); - offset += 0x100; - - switch (offset) - { - case 0x800: // $4800 - m_reg[0] = data; - break; - case 0x900: // $4900 - m_reg[1] = data; - break; - case 0xa00: // $4a00 - m_reg[2] = data; - break; - case 0xe00: // $4e00 - m_reg[3] = data; m_irq_count = 0x10; - break; - } -} |