diff options
Diffstat (limited to 'src/devices/bus/nes/waixing.cpp')
-rw-r--r-- | src/devices/bus/nes/waixing.cpp | 387 |
1 files changed, 103 insertions, 284 deletions
diff --git a/src/devices/bus/nes/waixing.cpp b/src/devices/bus/nes/waixing.cpp index 3706d64b26e..b10df1b3f59 100644 --- a/src/devices/bus/nes/waixing.cpp +++ b/src/devices/bus/nes/waixing.cpp @@ -17,14 +17,14 @@ #include "emu.h" #include "waixing.h" +#define LOG_HIFREQ (1U << 1) #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" //------------------------------------------------- @@ -38,6 +38,7 @@ DEFINE_DEVICE_TYPE(NES_WAIXING_C, nes_waixing_c_device, "nes_waixing_c", DEFINE_DEVICE_TYPE(NES_WAIXING_D, nes_waixing_d_device, "nes_waixing_d", "NES Cart Waixing Type D PCB") DEFINE_DEVICE_TYPE(NES_WAIXING_E, nes_waixing_e_device, "nes_waixing_e", "NES Cart Waixing Type E PCB") DEFINE_DEVICE_TYPE(NES_WAIXING_F, nes_waixing_f_device, "nes_waixing_f", "NES Cart Waixing Type F PCB") +DEFINE_DEVICE_TYPE(NES_WAIXING_F1, nes_waixing_f1_device, "nes_waixing_f1", "NES Cart Waixing Type F1 PCB") DEFINE_DEVICE_TYPE(NES_WAIXING_G, nes_waixing_g_device, "nes_waixing_g", "NES Cart Waixing Type G PCB") DEFINE_DEVICE_TYPE(NES_WAIXING_H, nes_waixing_h_device, "nes_waixing_h", "NES Cart Waixing Type H PCB") DEFINE_DEVICE_TYPE(NES_WAIXING_H1, nes_waixing_h1_device, "nes_waixing_h1", "NES Cart Waixing Type H (Alt) PCB") @@ -45,7 +46,6 @@ DEFINE_DEVICE_TYPE(NES_WAIXING_I, nes_waixing_i_device, "nes_waixing_i", DEFINE_DEVICE_TYPE(NES_WAIXING_J, nes_waixing_j_device, "nes_waixing_j", "NES Cart Waixing Type J PCB") DEFINE_DEVICE_TYPE(NES_WAIXING_SH2, nes_waixing_sh2_device, "nes_waixing_sh2", "NES Cart Waixing SH2 PCB") DEFINE_DEVICE_TYPE(NES_WAIXING_SEC, nes_waixing_sec_device, "nes_waixing_sec", "NES Cart Waixing Security Chip PCB") -DEFINE_DEVICE_TYPE(NES_WAIXING_SGZ, nes_waixing_sgz_device, "nes_waixing_sgz", "NES Cart Waixing San Guo Zhi PCB") DEFINE_DEVICE_TYPE(NES_WAIXING_SGZLZ, nes_waixing_sgzlz_device, "nes_waixing_sgzlz", "NES Cart Waixing San Guo Zhong Lie Zhuan PCB") DEFINE_DEVICE_TYPE(NES_WAIXING_FFV, nes_waixing_ffv_device, "nes_waixing_ffv", "NES Cart Waixing Final Fantasy V PCB") DEFINE_DEVICE_TYPE(NES_WAIXING_WXZS, nes_waixing_wxzs_device, "nes_waixing_wxzs", "NES Cart Waixing Wai Xing Zhan Shi PCB") @@ -89,8 +89,18 @@ nes_waixing_e_device::nes_waixing_e_device(const machine_config &mconfig, const { } -nes_waixing_f_device::nes_waixing_f_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : nes_waixing_a_device(mconfig, NES_WAIXING_F, tag, owner, clock) +nes_waixing_f_device::nes_waixing_f_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) + : nes_txrom_device(mconfig, type, tag, owner, clock) +{ +} + +nes_waixing_f_device::nes_waixing_f_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : nes_waixing_f_device(mconfig, NES_WAIXING_F, tag, owner, clock) +{ +} + +nes_waixing_f1_device::nes_waixing_f1_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : nes_waixing_f_device(mconfig, NES_WAIXING_F1, tag, owner, clock) { } @@ -124,7 +134,7 @@ nes_waixing_j_device::nes_waixing_j_device(const machine_config &mconfig, const { } -nes_waixing_sh2_device::nes_waixing_sh2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +nes_waixing_sh2_device::nes_waixing_sh2_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : nes_txrom_device(mconfig, NES_WAIXING_SH2, tag, owner, clock) { } @@ -134,11 +144,6 @@ nes_waixing_sec_device::nes_waixing_sec_device(const machine_config &mconfig, co { } -nes_waixing_sgz_device::nes_waixing_sgz_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : nes_nrom_device(mconfig, NES_WAIXING_SGZ, tag, owner, clock), m_irq_count(0), m_irq_count_latch(0), m_irq_enable(0), m_irq_enable_latch(0) -{ -} - nes_waixing_sgzlz_device::nes_waixing_sgzlz_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : nes_nrom_device(mconfig, NES_WAIXING_SGZLZ, tag, owner, clock), m_reg{ 0, 0, 0, 0 } { @@ -178,28 +183,13 @@ void nes_waixing_a_device::device_start() void nes_waixing_a_device::pcb_reset() { - m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; mmc3_common_initialize(0xff, 0xff, 0); std::fill(std::begin(mapper_ram), std::end(mapper_ram), 0x00); } -void nes_waixing_f_device::pcb_reset() -{ - m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; - mmc3_common_initialize(0xff, 0xff, 0); - - std::fill(std::begin(mapper_ram), std::end(mapper_ram), 0x00); - m_mmc_prg_bank[0] = 0x00; - m_mmc_prg_bank[1] = 0x01; - m_mmc_prg_bank[2] = 0x4e; - m_mmc_prg_bank[3] = 0x4f; - set_prg(m_prg_base, m_prg_mask); -} - void nes_waixing_g_device::pcb_reset() { - m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; mmc3_common_initialize(0xff, 0xff, 0); std::fill(std::begin(mapper_ram), std::end(mapper_ram), 0x00); @@ -227,8 +217,6 @@ void nes_waixing_j_device::device_start() void nes_waixing_j_device::pcb_reset() { - m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; - m_reg[0] = 0x01; m_reg[1] = 0x02; m_reg[2] = 0x7e; @@ -245,10 +233,9 @@ void nes_waixing_sh2_device::device_start() void nes_waixing_sh2_device::pcb_reset() { - m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; - m_reg[0] = m_reg[1] = 0; mmc3_common_initialize(0xff, 0xff, 0); + set_nt_mirroring(PPU_MIRROR_VERT); // first Fire Emblem doesn't properly set mirroring like the other games do } void nes_waixing_sec_device::device_start() @@ -259,37 +246,10 @@ void nes_waixing_sec_device::device_start() void nes_waixing_sec_device::pcb_reset() { - m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; - m_reg = 0; mmc3_common_initialize(0xff, 0xff, 0); } -void nes_waixing_sgz_device::device_start() -{ - common_start(); - save_item(NAME(m_irq_enable)); - save_item(NAME(m_irq_enable_latch)); - save_item(NAME(m_irq_count)); - save_item(NAME(m_irq_count_latch)); - save_item(NAME(m_mmc_vrom_bank)); -} - -void nes_waixing_sgz_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); - - m_irq_enable = 0; - m_irq_enable_latch = 0; - m_irq_count = 0; - m_irq_count_latch = 0; - - std::fill(std::begin(m_mmc_vrom_bank), std::end(m_mmc_vrom_bank), 0x00); -} - void nes_waixing_sgzlz_device::device_start() { common_start(); @@ -298,7 +258,6 @@ void nes_waixing_sgzlz_device::device_start() void nes_waixing_sgzlz_device::pcb_reset() { - m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; prg32(0); chr8(0, m_chr_source); @@ -313,7 +272,6 @@ void nes_waixing_ffv_device::device_start() void nes_waixing_ffv_device::pcb_reset() { - m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; prg16_89ab(0); prg16_cdef(0x1f); chr8(0, m_chr_source); @@ -321,43 +279,6 @@ void nes_waixing_ffv_device::pcb_reset() m_reg[0] = m_reg[1] = 0; } -void nes_waixing_wxzs_device::device_start() -{ - common_start(); -} - -void nes_waixing_wxzs_device::pcb_reset() -{ - m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; - prg32(0); - chr8(0, m_chr_source); -} - -void nes_waixing_dq8_device::device_start() -{ - common_start(); -} - -void nes_waixing_dq8_device::pcb_reset() -{ - m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; - prg32(0); - chr8(0, m_chr_source); -} - -void nes_waixing_wxzs2_device::device_start() -{ - common_start(); -} - -void nes_waixing_wxzs2_device::pcb_reset() -{ - m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; - prg32(0); - chr8(0, m_chr_source); - set_nt_mirroring(PPU_MIRROR_VERT); -} - void nes_waixing_fs304_device::device_start() { common_start(); @@ -366,7 +287,6 @@ void nes_waixing_fs304_device::device_start() void nes_waixing_fs304_device::pcb_reset() { - m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; prg32(0); chr8(0, m_chr_source); @@ -394,7 +314,7 @@ void nes_waixing_fs304_device::pcb_reset() iNES: mapper 74 - In MESS: Supported + In MAME: Supported -------------------------------------------------*/ @@ -414,7 +334,7 @@ void nes_waixing_a_device::set_mirror(uint8_t nt) set_nt_mirroring(PPU_MIRROR_HIGH); break; default: - LOG_MMC(("Mapper set NT to invalid value %02x", nt)); + LOG("Mapper set NT to invalid value %02x", nt); break; } } @@ -435,7 +355,7 @@ void nes_waixing_a1_device::chr_cb(int start, int bank, int source) void nes_waixing_a_device::waixing_write(offs_t offset, uint8_t data) { - LOG_MMC(("waixing_write, offset: %04x, data: %02x\n", offset, data)); + LOG("waixing_write, offset: %04x, data: %02x\n", offset, data); switch (offset & 0x6001) { @@ -454,7 +374,7 @@ void nes_waixing_a_device::waixing_write(offs_t offset, uint8_t data) uint8_t nes_waixing_a_device::read_l(offs_t offset) { - LOG_MMC(("waixing read_l, offset: %04x\n", offset)); + LOG("waixing read_l, offset: %04x\n", offset); offset += 0x100; if (offset >= 0x1000 && offset < 0x1400) return mapper_ram[offset & 0x3ff]; @@ -464,7 +384,7 @@ uint8_t nes_waixing_a_device::read_l(offs_t offset) void nes_waixing_a_device::write_l(offs_t offset, uint8_t data) { - LOG_MMC(("waixing write_l, offset: %04x, data: %02x\n", offset, data)); + LOG("waixing write_l, offset: %04x, data: %02x\n", offset, data); offset += 0x100; if (offset >= 0x1000 && offset < 0x1400) mapper_ram[offset & 0x3ff] = data; @@ -483,7 +403,7 @@ void nes_waixing_a_device::write_l(offs_t offset, uint8_t data) iNES: mapper 191 - In MESS: Supported. + In MAME: Supported. -------------------------------------------------*/ @@ -505,7 +425,7 @@ void nes_waixing_b_device::chr_cb(int start, int bank, int source) iNES: mapper 192 - In MESS: Supported. + In MAME: Supported. -------------------------------------------------*/ @@ -527,7 +447,7 @@ void nes_waixing_c_device::chr_cb(int start, int bank, int source) iNES: mapper 194 - In MESS: Supported. + In MAME: Supported. -------------------------------------------------*/ @@ -550,7 +470,7 @@ void nes_waixing_d_device::chr_cb(int start, int bank, int source) iNES: mapper 195 - In MESS: Supported. + In MAME: Supported. -------------------------------------------------*/ @@ -560,77 +480,49 @@ void nes_waixing_e_device::chr_cb(int start, int bank, int source) chr1_x(start, bank, chr_src); } - /*------------------------------------------------- - Waixing Board Type F + Waixing Board Type F, F1 - Games: Tenchi wo Kurau II (C) + Games: Tenchi wo Kurau II translations (mapper 198), + and (mapper 199) Chengjisihan, Tangmu Lixian Ji, + Fengse Huanxiang, Datang Fengyun VI Dai - MMC3 clone. + MMC3 clone with an extra 4K WRAM at 0x5000-0x5fff. + Mapper 198 banks its 8K CHR RAM and 199 does not. - iNES: mapper 198 + iNES: mappers 198, 199 - In MESS: Preliminary support. + In MAME: Supported. + + TODO: Sort out G board games which were assigned + to mapper 199 previously. -------------------------------------------------*/ -void nes_waixing_f_device::chr_cb(int start, int bank, int source) +u8 nes_waixing_f_device::read_l(offs_t offset) { - chr1_x(start, bank, CHRRAM); -} + LOGMASKED(LOG_HIFREQ, "waixing_f read_l, offset: %04x\n", offset); -void nes_waixing_f_device::prg_cb(int start, int bank) -{ -// if (bank > 0x3f) -// bank = 0x40 | (bank & 0xf); - prg8_x(start, bank); + offset += 0x100; + if (!m_prgram.empty() && offset >= 0x1000) + return m_prgram[offset & 0x0fff & (m_prgram.size() - 1)]; + + return get_open_bus(); } -void nes_waixing_f_device::set_prg( int prg_base, int prg_mask ) +void nes_waixing_f_device::write_l(offs_t offset, u8 data) { - uint8_t prg_flip = (m_latch & 0x40) ? 2 : 0; + LOGMASKED(LOG_HIFREQ, "waixing_f write_l, offset: %04x, data: %02x\n", offset, data); - prg_cb(0, m_mmc_prg_bank[0 ^ prg_flip]); - prg_cb(1, m_mmc_prg_bank[1]); - prg_cb(2, m_mmc_prg_bank[2 ^ prg_flip]); - prg_cb(3, m_mmc_prg_bank[3]); + offset += 0x100; + if (!m_prgram.empty() && offset >= 0x1000) + m_prgram[offset & 0x0fff & (m_prgram.size() - 1)] = data; } -void nes_waixing_f_device::write_h(offs_t offset, uint8_t data) +void nes_waixing_f1_device::set_chr(u8 chr, int chr_base, int chr_mask) { - uint8_t cmd; - LOG_MMC(("waixing_f write_h, offset: %04x, data: %02x\n", offset, data)); - - switch (offset & 0x6001) - { - case 0x0001: - cmd = m_latch & 0x07; - switch (cmd) - { - case 0: case 1: // these do not need to be separated: we take care of them in set_chr! - case 2: case 3: case 4: case 5: - m_mmc_vrom_bank[cmd] = data; - set_chr(m_chr_source, m_chr_base, m_chr_mask); - break; - case 6: - case 7: - case 8: - case 9: - m_mmc_prg_bank[cmd - 6] = data; - //printf("prg bank %d value %x\n", cmd - 6, data); - set_prg(m_prg_base, m_prg_mask); - break; - } - break; - - case 0x2001: - break; - - default: - waixing_write(offset, data); - break; - } +// ignore CHR banking as all F1 games use 8K unbanked CHR RAM } /*------------------------------------------------- @@ -644,7 +536,7 @@ void nes_waixing_f_device::write_h(offs_t offset, uint8_t data) iNES: mapper 199 - In MESS: Supported. + In MAME: Supported. -------------------------------------------------*/ @@ -671,7 +563,7 @@ void nes_waixing_g_device::set_chr(uint8_t chr, int chr_base, int chr_mask) void nes_waixing_g_device::write_h(offs_t offset, uint8_t data) { uint8_t cmd; - LOG_MMC(("waixing_g write_h, offset: %04x, data: %02x\n", offset, data)); + LOG("waixing_g write_h, offset: %04x, data: %02x\n", offset, data); switch (offset & 0x6001) { @@ -721,7 +613,7 @@ void nes_waixing_g_device::write_h(offs_t offset, uint8_t data) iNES: mapper 245 - In MESS: Supported. + In MAME: Supported. -------------------------------------------------*/ @@ -734,7 +626,7 @@ void nes_waixing_h_device::chr_cb(int start, int bank, int source) void nes_waixing_h_device::write_h(offs_t offset, uint8_t data) { uint8_t cmd; - LOG_MMC(("waixing_h write_h, offset: %04x, data: %02x\n", offset, data)); + LOG("waixing_h write_h, offset: %04x, data: %02x\n", offset, data); switch (offset & 0x6001) { @@ -746,6 +638,7 @@ void nes_waixing_h_device::write_h(offs_t offset, uint8_t data) m_prg_base = (data << 5) & 0x40; m_prg_mask = 0x3f; set_prg(m_prg_base, m_prg_mask); + [[fallthrough]]; case 1: case 2: case 3: case 4: case 5: m_mmc_vrom_bank[cmd] = data; @@ -775,7 +668,7 @@ void nes_waixing_h_device::write_h(offs_t offset, uint8_t data) void nes_waixing_h1_device::write_h(offs_t offset, uint8_t data) { uint8_t cmd; - LOG_MMC(("waixing_h1 write_h, offset: %04x, data: %02x\n", offset, data)); + LOG("waixing_h1 write_h, offset: %04x, data: %02x\n", offset, data); switch (offset & 0x6001) { @@ -787,6 +680,7 @@ void nes_waixing_h1_device::write_h(offs_t offset, uint8_t data) m_prg_base = (data << 5) & 0x40; m_prg_mask = 0x3f; set_prg(m_prg_base, m_prg_mask); + [[fallthrough]]; case 1: case 2: case 3: case 4: case 5: m_mmc_vrom_bank[cmd] = data; @@ -818,7 +712,7 @@ void nes_waixing_h1_device::write_h(offs_t offset, uint8_t data) MMC3 clone. - In MESS: Preliminary support. + In MAME: Preliminary support. -------------------------------------------------*/ @@ -835,7 +729,7 @@ void nes_waixing_j_device::set_prg( int prg_base, int prg_mask ) void nes_waixing_j_device::write_h(offs_t offset, uint8_t data) { uint8_t cmd; - LOG_MMC(("waixing_f write_h, offset: %04x, data: %02x\n", offset, data)); + LOG("waixing_f write_h, offset: %04x, data: %02x\n", offset, data); switch (offset & 0x6001) { @@ -871,41 +765,39 @@ void nes_waixing_j_device::write_h(offs_t offset, uint8_t data) Waixing SH2 Board - Games: Fire Emblem (C) and Fire Emblem Gaiden (C) + Games: Fire Emblem (C), Fire Emblem Gaiden (C), + Zhentian Shi Yongshi - MMC3 clone with different access to CHR + MMC3 clone with MMC2-like CHR banking. iNES: mapper 165 - In MESS: Partially Supported. + In MAME: Supported. -------------------------------------------------*/ -void nes_waixing_sh2_device::chr_cb(int start, int bank, int source) +void nes_waixing_sh2_device::set_chr(u8 chr, int chr_base, int chr_mask) { - chr4_0(m_reg[0], m_reg[0] ? CHRRAM : CHRROM); - chr4_4(m_reg[1], m_reg[1] ? CHRRAM : CHRROM); + int bank1 = m_mmc_vrom_bank[m_reg[0] ? 1 : 0] >> 2; + int bank2 = m_mmc_vrom_bank[m_reg[1] ? 4 : 2] >> 2; + + chr4_0(bank1, bank1 ? CHRROM : CHRRAM); + chr4_4(bank2, bank2 ? CHRROM : CHRRAM); } -uint8_t nes_waixing_sh2_device::chr_r(offs_t offset) +u8 nes_waixing_sh2_device::chr_r(offs_t offset) { - int bank = offset >> 10; - uint8_t val = m_chr_access[bank][offset & 0x3ff]; // this would be usual return value - int chr_helper; + int val = device_nes_cart_interface::chr_r(offset); switch (offset & 0xff8) { - case 0xfd0: chr_helper = (bank & 0x4) | 0x0; break; - case 0xfe8: chr_helper = (bank & 0x4) | 0x2; break; - default: return val; + case 0xfd0: + case 0xfe8: + m_reg[BIT(offset, 12)] = BIT(offset, 3); + set_chr(m_chr_source, m_chr_base, m_chr_mask); + break; } - m_reg[offset >> 12] = chr_helper; - if (offset & 0x1000) - chr4_4(m_reg[1], m_reg[1] ? CHRRAM : CHRROM); - else - chr4_0(m_reg[0], m_reg[0] ? CHRRAM : CHRROM); - return val; } @@ -920,7 +812,7 @@ uint8_t nes_waixing_sh2_device::chr_r(offs_t offset) iNES: mapper 249 - In MESS: Partially Supported. + In MAME: Partially Supported. -------------------------------------------------*/ @@ -942,7 +834,7 @@ void nes_waixing_sec_device::chr_cb(int start, int bank, int source) void nes_waixing_sec_device::write_l(offs_t offset, uint8_t data) { - LOG_MMC(("waixing_sec write_l, offset: %04x, data: %02x\n", offset, data)); + LOG("waixing_sec write_l, offset: %04x, data: %02x\n", offset, data); offset += 0x100; if (offset == 0x1000) @@ -955,81 +847,6 @@ void nes_waixing_sec_device::write_l(offs_t offset, uint8_t data) /*------------------------------------------------- - Waixing San Guo Zhi Board - - Games: San Guo Zhi - - This board uses Konami IRQ - - iNES: mapper 252 - - In MESS: Unsupported. - - -------------------------------------------------*/ - -// same as Konami IRQ -void nes_waixing_sgz_device::hblank_irq(int scanline, int vblank, int blanked) -{ - /* Increment & check the IRQ scanline counter */ - if (m_irq_enable && (++m_irq_count == 0x100)) - { - m_irq_count = m_irq_count_latch; - m_irq_enable = m_irq_enable_latch; - hold_irq_line(); - } -} - -void nes_waixing_sgz_device::write_h(offs_t offset, uint8_t data) -{ - uint8_t helper, bank; - LOG_MMC(("waixing_sgz write_h, offset: %04x, data: %02x\n", offset, data)); - - switch (offset & 0x7000) - { - case 0x0000: - prg8_89(data); - break; - case 0x2000: - prg8_ab(data); - break; - case 0x3000: - case 0x4000: - case 0x5000: - case 0x6000: - bank = ((offset & 0x7000) - 0x3000) / 0x0800 + ((offset & 0x0008) >> 3); - helper = offset & 0x04; - if (helper) - m_mmc_vrom_bank[bank] = (m_mmc_vrom_bank[bank] & 0x0f) | ((data & 0x0f) << 4); - else - m_mmc_vrom_bank[bank] = (m_mmc_vrom_bank[bank] & 0xf0) | (data & 0x0f); - chr1_x(bank, m_mmc_vrom_bank[bank], CHRROM); - break; - case 0x7000: - switch (offset & 0x0c) - { - case 0x00: - m_irq_count_latch = (m_irq_count_latch & 0xf0) | (data & 0x0f); - break; - case 0x04: - m_irq_count_latch = (m_irq_count_latch & 0x0f) | ((data & 0x0f) << 4); - break; - case 0x08: - m_irq_enable = data & 0x02; - m_irq_count_latch = data & 0x01; - if (data & 0x02) - m_irq_count = m_irq_count_latch; - break; - case 0x0c: - m_irq_enable = m_irq_enable_latch; - break; - } - break; - } -} - - -/*------------------------------------------------- - Waixing San Guo Zhong Lie Zhuan Board Games: Fan Kong Jing Ying, San Guo Zhong Lie Zhuan, Xing @@ -1037,7 +854,7 @@ void nes_waixing_sgz_device::write_h(offs_t offset, uint8_t data) iNES: mapper 178 - In MESS: Supported. + In MAME: Supported. Implementations wildly vary between emulators, but Cah4e3's implementation boots up both the games and @@ -1049,7 +866,7 @@ void nes_waixing_sgz_device::write_h(offs_t offset, uint8_t data) void nes_waixing_sgzlz_device::write_l(offs_t offset, uint8_t data) { - LOG_MMC(("waixing_sgzlz write_l, offset: %04x, data: %02x\n", offset, data)); + LOG("waixing_sgzlz write_l, offset: %04x, data: %02x\n", offset, data); if (offset >= 0x700 && offset <= 0xEFF) { m_reg[offset & 0x03] = data; @@ -1108,14 +925,14 @@ void nes_waixing_sgzlz_device::write_l(offs_t offset, uint8_t data) iNES: mapper 164 - In MESS: Supported. + In MAME: Supported. -------------------------------------------------*/ void nes_waixing_ffv_device::write_l(offs_t offset, uint8_t data) { uint8_t helper; - LOG_MMC(("waixing_ffv write_l, offset: %04x, data: %02x\n", offset, data)); + LOG("waixing_ffv write_l, offset: %04x, data: %02x\n", offset, data); offset += 0x100; /* the checks work better on addresses */ if ((offset & 0x1200) == 0x1000) @@ -1157,13 +974,13 @@ void nes_waixing_ffv_device::write_l(offs_t offset, uint8_t data) iNES: mapper 242 - In MESS: Supported. + In MAME: Supported. -------------------------------------------------*/ void nes_waixing_wxzs_device::write_h(offs_t offset, uint8_t data) { - LOG_MMC(("waixing_zs write_h, offset: %04x, data: %02x\n", offset, data)); + LOG("waixing_zs write_h, offset: %04x, data: %02x\n", offset, data); prg32(offset >> 3); @@ -1187,13 +1004,13 @@ void nes_waixing_wxzs_device::write_h(offs_t offset, uint8_t data) iNES: mapper 242 - In MESS: Supported. + In MAME: Supported. -------------------------------------------------*/ void nes_waixing_dq8_device::write_h(offs_t offset, uint8_t data) { - LOG_MMC(("waixing_dq8 write_h, offset: %04x, data: %02x\n", offset, data)); + LOG("waixing_dq8 write_h, offset: %04x, data: %02x\n", offset, data); prg32(offset >> 3); } @@ -1206,18 +1023,21 @@ void nes_waixing_dq8_device::write_h(offs_t offset, uint8_t data) Games: Wai Xing Zhan Shi 2 (aka Phantasy Star 2), Bao Xiao Tien Guo, Bio Hazard, Pokemon Gold, Subor (R) - iNES: mapper 15 - - In MESS: Supported + FIXME: This used to be mapper 15. NesDev research says the + only two games found on board K-1029 (now in multigame.cpp) + are the two Contra multicarts. All other Waixing games + appear to be ROM hacks to work with mapper 15. Games on + this device need to be reassigned to correct device and/or + replaced with original dumps that match the original boards. -------------------------------------------------*/ void nes_waixing_wxzs2_device::write_h(offs_t offset, uint8_t data) { - uint8_t flip = (data & 0x80) >> 7; - uint8_t helper = (data & 0x7f) << 1; + uint8_t flip = BIT(data, 7); + uint8_t helper = data << 1; - LOG_MMC(("waixing_wxzs2 write_h, offset: %04x, data: %02x\n", offset, data)); + LOG("waixing_wxzs2 write_h, offset: %04x, data: %02x\n", offset, data); set_nt_mirroring(BIT(data, 6) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); @@ -1261,20 +1081,19 @@ void nes_waixing_wxzs2_device::write_h(offs_t offset, uint8_t data) iNES: mapper 162? (only found in UNIF format) - In MESS: Supported. + In MAME: Supported. -------------------------------------------------*/ void nes_waixing_fs304_device::write_l(offs_t offset, uint8_t data) { - LOG_MMC(("fs304 write_l, offset: %04x, data: %02x\n", offset, data)); - int bank; - offset += 0x100; + LOG("fs304 write_l, offset: %04x, data: %02x\n", offset, data); + offset += 0x100; if (offset >= 0x1000) { - m_reg[(offset >> 8) & 3] = data; - bank = ((m_reg[2] & 0x0f) << 4) | BIT(m_reg[1], 1) | (m_reg[0] & 0x0e); + m_reg[BIT(offset, 8, 2)] = data; + int bank = ((m_reg[2] & 0x0f) << 4) | BIT(m_reg[1], 1) | (m_reg[0] & 0x0e); prg32(bank); chr8(0, CHRRAM); } |