diff --git a/hash/nes.xml b/hash/nes.xml index 452fd85df01..489387cc8ba 100644 --- a/hash/nes.xml +++ b/hash/nes.xml @@ -64381,6 +64381,26 @@ We don't include these hacks because they were not burned into real carts nor so + + Sangokushi III - Haou no Tairiku (Asia, Sangokushi II pirate) + 199? + <pirate> + + + + + + + + + + + + + + + + San Guo Zhi II (Chi) 19?? diff --git a/src/devices/bus/nes/bootleg.cpp b/src/devices/bus/nes/bootleg.cpp index 4382bf7ec43..842b932869f 100644 --- a/src/devices/bus/nes/bootleg.cpp +++ b/src/devices/bus/nes/bootleg.cpp @@ -53,6 +53,7 @@ DEFINE_DEVICE_TYPE(NES_SMB2JB, nes_smb2jb_device, "nes_smb2jb", "N DEFINE_DEVICE_TYPE(NES_N32_4IN1, nes_n32_4in1_device, "nes_n32_4in1", "NES Cart N-32 4 in 1 PCB") DEFINE_DEVICE_TYPE(NES_0353, nes_0353_device, "nes_0353", "NES Cart 0353 PCB") DEFINE_DEVICE_TYPE(NES_09034A, nes_09034a_device, "nes_09034a", "NES Cart 09-034A PCB") +DEFINE_DEVICE_TYPE(NES_L001, nes_l001_device, "nes_l001", "NES Cart L-001 PCB") DEFINE_DEVICE_TYPE(NES_BATMANFS, nes_batmanfs_device, "nes_batmanfs", "NES Cart Batman Pirate PCB") DEFINE_DEVICE_TYPE(NES_PALTHENA, nes_palthena_device, "nes_palthena", "NES Cart Palthena no Kagami Pirate PCB") DEFINE_DEVICE_TYPE(NES_TOBIDASE, nes_tobidase_device, "nes_tobidase", "NES Cart Tobidase Daisakusen Pirate PCB") @@ -144,6 +145,11 @@ nes_09034a_device::nes_09034a_device(const machine_config &mconfig, const char * { } +nes_l001_device::nes_l001_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : nes_nrom_device(mconfig, NES_L001, tag, owner, clock), m_irq_count(0), irq_timer(nullptr) +{ +} + nes_batmanfs_device::nes_batmanfs_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : nes_nrom_device(mconfig, NES_BATMANFS, tag, owner, clock), m_irq_count(0), m_irq_enable(0), irq_timer(nullptr) { @@ -499,6 +505,23 @@ void nes_09034a_device::pcb_reset() m_reg = 0; } +void nes_l001_device::device_start() +{ + common_start(); + irq_timer = timer_alloc(TIMER_IRQ); + irq_timer->adjust(attotime::zero, 0, clocks_to_attotime(1)); + + save_item(NAME(m_irq_count)); +} + +void nes_l001_device::pcb_reset() +{ + prg32((m_prg_chunks >> 1) - 1); + chr8(0, CHRROM); + + m_irq_count = 0; +} + void nes_palthena_device::device_start() { common_start(); @@ -1548,6 +1571,64 @@ u8 nes_09034a_device::read_m(offs_t offset) return m_prg[(((m_reg + 4) * 0x2000) + offset) & (m_prg_size - 1)]; } +/*------------------------------------------------- + + Board L-001 + + Games: Sangokushi III (Sangokushi II bootleg) + + This board has swappable 8K PRG banks at 0x8000, 0xa000, + and 0xc000, while 0xe000 is fixed to the final bank. + CHRROM and CIRAM are also swappable in 1K banks. + The board has a 16-bit IRQ counter with the enable bit + acting as the MSB. The enhanced audio of the original + Namco 163 board is not retained. + + NES 2.0: mapper 330 + + In MAME: Supported. + + -------------------------------------------------*/ + +void nes_l001_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + if (id == TIMER_IRQ) + { + if (BIT(m_irq_count, 15)) + { + if (++m_irq_count == 0) + set_irq_line(ASSERT_LINE); + } + } +} + +void nes_l001_device::write_h(offs_t offset, u8 data) +{ + LOG_MMC(("l-001 write_h, offset: %04x, data: %02x\n", offset, data)); + + switch (offset & 0x6400) + { + case 0x0000: + case 0x2000: + chr1_x((offset >> 11) & 0x07, data, CHRROM); + break; + case 0x0400: + m_irq_count = (m_irq_count & 0xff00) | data; + break; + case 0x2400: + m_irq_count = (m_irq_count & 0x00ff) | data << 8; + set_irq_line(CLEAR_LINE); + break; + case 0x4000: + set_nt_page((offset >> 11) & 0x03, CIRAM, data & 1, 1); + break; + case 0x6000: + if (offset < 0x7800) + prg8_x((offset >> 11) & 0x03, data & 0x1f); + break; + } +} + /*------------------------------------------------- BTL-BATMANFS @@ -2207,7 +2288,7 @@ void nes_shuiguan_device::write_h(offs_t offset, uint8_t data) { case 0x00: m_irq_count = (m_irq_count & 0xf0) | ((data & 0x0f) << 0); break; case 0x04: m_irq_count = (m_irq_count & 0x0f) | ((data & 0x0f) << 4); break; - case 0x08: m_irq_enable= data; break; + case 0x08: m_irq_enable = data; break; case 0x0c: break; } break; diff --git a/src/devices/bus/nes/bootleg.h b/src/devices/bus/nes/bootleg.h index 7eeaaaf2ff9..081173d3e2e 100644 --- a/src/devices/bus/nes/bootleg.h +++ b/src/devices/bus/nes/bootleg.h @@ -320,6 +320,31 @@ private: }; +// ======================> nes_l001_device + +class nes_l001_device : public nes_nrom_device +{ +public: + // construction/destruction + nes_l001_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + virtual void write_h(offs_t offset, u8 data) override; + + virtual void pcb_reset() override; + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + +private: + u16 m_irq_count; + + static const device_timer_id TIMER_IRQ = 0; + emu_timer *irq_timer; +}; + + // ======================> nes_batmanfs_device class nes_batmanfs_device : public nes_nrom_device @@ -327,6 +352,7 @@ class nes_batmanfs_device : public nes_nrom_device public: // construction/destruction nes_batmanfs_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + virtual void write_h(offs_t offset, u8 data) override; virtual void pcb_reset() override; @@ -751,6 +777,7 @@ DECLARE_DEVICE_TYPE(NES_SMB2JB, nes_smb2jb_device) DECLARE_DEVICE_TYPE(NES_N32_4IN1, nes_n32_4in1_device) DECLARE_DEVICE_TYPE(NES_0353, nes_0353_device) DECLARE_DEVICE_TYPE(NES_09034A, nes_09034a_device) +DECLARE_DEVICE_TYPE(NES_L001, nes_l001_device) DECLARE_DEVICE_TYPE(NES_BATMANFS, nes_batmanfs_device) DECLARE_DEVICE_TYPE(NES_PALTHENA, nes_palthena_device) DECLARE_DEVICE_TYPE(NES_TOBIDASE, nes_tobidase_device) diff --git a/src/devices/bus/nes/nes_carts.cpp b/src/devices/bus/nes/nes_carts.cpp index 53609bf5d41..e45b4cbc7f4 100644 --- a/src/devices/bus/nes/nes_carts.cpp +++ b/src/devices/bus/nes/nes_carts.cpp @@ -313,6 +313,7 @@ void nes_cart(device_slot_interface &device) device.option_add_internal("yung08", NES_YUNG08); device.option_add_internal("btl_0353", NES_0353); // used by Lucky (Roger) Rabbit FDS conversion device.option_add_internal("09034a", NES_09034A); + device.option_add_internal("l001", NES_L001); device.option_add_internal("batmanfs", NES_BATMANFS); device.option_add_internal("palthena", NES_PALTHENA); // used by Palthena no Kagami FDS conversion device.option_add_internal("tobidase", NES_TOBIDASE); // mapper 120 diff --git a/src/devices/bus/nes/nes_ines.hxx b/src/devices/bus/nes/nes_ines.hxx index d4872d0844c..2bbea2571d4 100644 --- a/src/devices/bus/nes/nes_ines.hxx +++ b/src/devices/bus/nes/nes_ines.hxx @@ -365,7 +365,7 @@ static const nes_mmc mmc_list[] = // 327 BMC-10-24-C-A1 6-in-1 { 328, UNL_RT01 }, // test cart (Russia) { 329, UNL_EDU2K }, - // 330 Sangokushi II - Haou no Tairiku hack - N163 bootleg + { 330, BTL_L001 }, // Sangokushi II bootleg (retitled part III) { 331, BMC_12IN1 }, { 332, BMC_WS }, { 333, BMC_8IN1 }, diff --git a/src/devices/bus/nes/nes_pcb.hxx b/src/devices/bus/nes/nes_pcb.hxx index 656edc41193..a6909062ffe 100644 --- a/src/devices/bus/nes/nes_pcb.hxx +++ b/src/devices/bus/nes/nes_pcb.hxx @@ -216,6 +216,7 @@ static const nes_pcb pcb_list[] = { "yung08", BTL_YUNG08 }, { "btl_0353", BTL_0353 }, { "09034a", BTL_09034A }, + { "l001", BTL_L001 }, { "batmanfs", BTL_BATMANFS }, { "palthena", BTL_PALTHENA }, { "tobidase", BTL_TOBIDASE }, // mapper 120 diff --git a/src/devices/bus/nes/nes_slot.h b/src/devices/bus/nes/nes_slot.h index f634c7c1dc7..e86d22f3312 100644 --- a/src/devices/bus/nes/nes_slot.h +++ b/src/devices/bus/nes/nes_slot.h @@ -116,9 +116,9 @@ enum UNL_43272, UNL_TF1201, UNL_CITYFIGHT, UNL_NINJARYU, UNL_EH8813A, UNL_RT01, // Bootleg boards BTL_0353, BTL_09034A, BTL_AISENSHINICOL, BTL_BATMANFS, - BTL_CONTRAJ, BTL_DRAGONNINJA, BTL_MARIOBABY, BTL_PALTHENA, - BTL_PIKACHUY2K, BTL_SBROS11, BTL_SMB2JA, BTL_SMB2JB, - BTL_SMB3, BTL_SHUIGUAN, BTL_TOBIDASE, BTL_YUNG08, + BTL_CONTRAJ, BTL_DRAGONNINJA, BTL_L001, BTL_MARIOBABY, + BTL_PALTHENA, BTL_PIKACHUY2K, BTL_SBROS11, BTL_SHUIGUAN, + BTL_SMB2JA, BTL_SMB2JB, BTL_SMB3, BTL_TOBIDASE, BTL_YUNG08, // Shenzhen Jncota JNCOTA_KT1001, // Kaiser