diff options
Diffstat (limited to 'src/mess/machine/nes_bootleg.c')
-rw-r--r-- | src/mess/machine/nes_bootleg.c | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/src/mess/machine/nes_bootleg.c b/src/mess/machine/nes_bootleg.c index be9d4471635..6916240c468 100644 --- a/src/mess/machine/nes_bootleg.c +++ b/src/mess/machine/nes_bootleg.c @@ -53,6 +53,7 @@ const device_type NES_09034A = &device_creator<nes_09034a_device>; const device_type NES_TOBIDASE = &device_creator<nes_tobidase_device>; const device_type NES_LH32 = &device_creator<nes_lh32_device>; const device_type NES_LH10 = &device_creator<nes_lh10_device>; +const device_type NES_LH53 = &device_creator<nes_lh53_device>; const device_type NES_2708 = &device_creator<nes_2708_device>; const device_type NES_AC08 = &device_creator<nes_ac08_device>; const device_type NES_UNL_BB = &device_creator<nes_unl_bb_device>; @@ -130,6 +131,11 @@ nes_lh10_device::nes_lh10_device(const machine_config &mconfig, const char *tag, { } +nes_lh53_device::nes_lh53_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : nes_nrom_device(mconfig, NES_LH53, "NES Cart LH-53 Pirate PCB", tag, owner, clock, "nes_lh53", __FILE__) +{ +} + nes_2708_device::nes_2708_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : nes_nrom_device(mconfig, NES_2708, "NES Cart BTL-2708 Pirate PCB", tag, owner, clock, "nes_2708", __FILE__) { @@ -419,6 +425,30 @@ void nes_lh10_device::pcb_reset() m_latch = 0; } +void nes_lh53_device::device_start() +{ + common_start(); + irq_timer = timer_alloc(TIMER_IRQ); + irq_timer->adjust(attotime::zero, 0, machine().device<cpu_device>("maincpu")->cycles_to_attotime(1)); + + save_item(NAME(m_irq_enable)); + save_item(NAME(m_irq_count)); + save_item(NAME(m_reg)); +} + +void nes_lh53_device::pcb_reset() +{ + chr8(0, CHRRAM); + + prg8_89(0xc); + prg8_ab(0xd); // last 2K are overlayed by WRAM + prg8_cd(0xe); // first 6K are overlayed by WRAM + prg8_ef(0xf); + m_reg = 0; + m_irq_count = 0; + m_irq_enable = 0; +} + void nes_2708_device::device_start() { common_start(); @@ -1275,6 +1305,77 @@ WRITE8_MEMBER(nes_lh10_device::write_h) } /*------------------------------------------------- + + UNL-LH53 + + Games: Nazo no Murasamejou (FDS conversion) + + This PCB maps WRAM (w/battery) in 0xb800-0xd7ff and + PRG in 0x6000-0x7fff + + iNES: + + In MESS: Preliminar Support only. + + -------------------------------------------------*/ + +void nes_lh53_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + if (id == TIMER_IRQ) + { + if (m_irq_enable) + { + m_irq_count++; + if (m_irq_count > 7560)//value from FCEUMM... + { + m_irq_count = 0; + machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, ASSERT_LINE); + } + } + } +} + +READ8_MEMBER(nes_lh53_device::read_m) +{ + LOG_MMC(("lh53 read_m, offset: %04x\n", offset)); + return m_prg[(m_reg * 0x2000) + (offset & 0x1fff)]; +} + +READ8_MEMBER(nes_lh53_device::read_h) +{ + LOG_MMC(("lh53 read_h, offset: %04x\n", offset)); + + if (offset >= 0x3800 && offset < 0x5800) + return m_battery[offset & 0x1fff]; + + return hi_access_rom(offset); +} + +WRITE8_MEMBER(nes_lh53_device::write_h) +{ + LOG_MMC(("lh53 write_h, offset: %04x, data: %02x\n", offset, data)); + + if (offset >= 0x3800 && offset < 0x5800) + m_battery[offset & 0x1fff] = data; + + else + { + switch (offset & 0x7000) + { + case 0x6000: + m_irq_enable = BIT(data, 1); + m_irq_count = 0; + if (!m_irq_enable) + machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, CLEAR_LINE); + break; + case 0x7000: + m_reg = data & 0x0f; + break; + } + } +} + +/*------------------------------------------------- BTL-2708 |