bus/nes: Simplified KOF96 board. Removed deprecated poke(). (#9117)

Software list items promoted to working (nes.xml)
---------------------------------------
The King of Fighters 96 (Asia) [kmg]
This commit is contained in:
0kmg 2022-01-08 13:58:29 -09:00 committed by GitHub
parent b13f29d657
commit 1cc54bc30d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 107 deletions

View File

@ -77460,7 +77460,7 @@ be better to redump them properly. -->
</part> </part>
</software> </software>
<software name="kof96" supported="no"> <software name="kof96">
<description>The King of Fighters 96 (Asia)</description> <description>The King of Fighters 96 (Asia)</description>
<year>19??</year> <year>19??</year>
<publisher>&lt;unknown&gt;</publisher> <publisher>&lt;unknown&gt;</publisher>

View File

@ -242,8 +242,8 @@ nes_kof97_device::nes_kof97_device(const machine_config &mconfig, const char *ta
{ {
} }
nes_kof96_device::nes_kof96_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) nes_kof96_device::nes_kof96_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: nes_txrom_device(mconfig, NES_KOF96, tag, owner, clock) : nes_txrom_device(mconfig, NES_KOF96, tag, owner, clock), m_mmc3_mode(true)
{ {
} }
@ -547,7 +547,6 @@ void nes_kasing_device::device_start()
void nes_kasing_device::pcb_reset() void nes_kasing_device::pcb_reset()
{ {
m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM;
m_mmc3_mode = true; m_mmc3_mode = true;
mmc3_common_initialize(0xff, 0xff, 0); mmc3_common_initialize(0xff, 0xff, 0);
} }
@ -601,13 +600,13 @@ void nes_6035052_device::pcb_reset()
void nes_kof96_device::device_start() void nes_kof96_device::device_start()
{ {
mmc3_start(); mmc3_start();
save_item(NAME(m_reg)); save_item(NAME(m_mmc3_mode));
} }
void nes_kof96_device::pcb_reset() void nes_kof96_device::pcb_reset()
{ {
m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM;
memset(m_reg, 0, sizeof(m_reg)); m_mmc3_mode = true;
mmc3_common_initialize(0xff, 0xff, 0); mmc3_common_initialize(0xff, 0xff, 0);
} }
@ -1861,129 +1860,59 @@ void nes_kof97_device::write_h(offs_t offset, uint8_t data)
Bootleg Board for KOF96 Bootleg Board for KOF96
Games: The King of Fighters 96, Sonic 3D Blast 6, Street Games: The King of Fighters 96, Street Fighter Zero 2
Fighter Zero 2
MMC3 clone MMC3 clone
iNES: mapper 187 iNES: mapper 187
In MESS: Preliminary Support. In MAME: Supported.
-------------------------------------------------*/ -------------------------------------------------*/
void nes_kof96_device::prg_cb(int start, int bank) void nes_kof96_device::prg_cb(int start, int bank)
{ {
if (!(m_reg[0] & 0x80)) if (m_mmc3_mode)
prg8_x(start, bank); nes_txrom_device::prg_cb(start, bank);
} }
void nes_kof96_device::chr_cb(int start, int bank, int source) void nes_kof96_device::chr_cb(int start, int bank, int source)
{ {
uint8_t chr_page = (m_latch & 0x80) >> 5; bank |= (m_latch << 1) & (start << 6) & 0x100;
if ((start & 0x04) == chr_page)
bank |= 0x100;
chr1_x(start, bank, source); chr1_x(start, bank, source);
} }
void nes_kof96_device::write_l(offs_t offset, uint8_t data) void nes_kof96_device::write_l(offs_t offset, u8 data)
{ {
uint8_t new_bank;
LOG_MMC(("kof96 write_l, offset: %04x, data: %02x\n", offset, data)); LOG_MMC(("kof96 write_l, offset: %04x, data: %02x\n", offset, data));
offset += 0x100; offset += 0x100;
if ((offset & 0x5001) == 0x1000)
if (offset == 0x1000)
{ {
m_reg[0] = data; m_mmc3_mode = !BIT(data, 7);
if (m_mmc3_mode)
if (m_reg[0] & 0x80)
{
new_bank = (m_reg[0] & 0x1f);
if (m_reg[0] & 0x20)
prg32(new_bank >> 2);
else
{
prg16_89ab(new_bank);
prg16_cdef(new_bank);
}
}
else
set_prg(m_prg_base, m_prg_mask); set_prg(m_prg_base, m_prg_mask);
} else
if (offset >= 0x1000)
{ {
switch (data & 0x03) u8 bank = (data >> 1) & 0x0f;
{ u8 mode = BIT(data, 5);
case 0x00: prg16_89ab(bank & ~mode);
case 0x01: prg16_cdef(bank | mode);
m_reg[1] = 0x83;
break;
case 0x02:
m_reg[1] = 0x42;
break;
case 0x03:
m_reg[1] = 0x00;
break;
} }
}
if (!m_reg[3] && offset > 0x1000)
{
m_reg[3] = 1;
poke(0x4017, 0x40); // FIXME
} }
} }
uint8_t nes_kof96_device::read_l(offs_t offset) u8 nes_kof96_device::read_l(offs_t offset)
{ {
LOG_MMC(("kof96 read_l, offset: %04x\n", offset)); LOG_MMC(("kof96 read_l, offset: %04x\n", offset));
offset += 0x100;
if (!(offset < 0x1000)) offset += 0x100;
return m_reg[1]; if (offset >= 0x1000)
return 0x80; // unknown protection read, kof96 expects that MSB is set
else else
return 0; return 0;
} }
void nes_kof96_device::write_h(offs_t offset, uint8_t data)
{
LOG_MMC(("kof96 write_h, offset: %04x, data: %02x\n", offset, data));
switch (offset & 0x6003)
{
case 0x0000:
m_reg[2] = 1;
txrom_write(0x0000, data);
break;
case 0x0001:
if (m_reg[2])
txrom_write(0x0001, data);
break;
case 0x0002:
break;
case 0x0003:
m_reg[2] = 0;
if (data == 0x28)
prg8_cd(0x17);
else if (data == 0x2a)
prg8_ab(0x0f);
break;
default:
txrom_write(offset, data);
break;
}
}
/*------------------------------------------------- /*-------------------------------------------------
Bootleg Board for Super Fighter III Bootleg Board for Super Fighter III

View File

@ -356,11 +356,10 @@ class nes_kof96_device : public nes_txrom_device
{ {
public: public:
// construction/destruction // construction/destruction
nes_kof96_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); nes_kof96_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
virtual uint8_t read_l(offs_t offset) override; virtual u8 read_l(offs_t offset) override;
virtual void write_l(offs_t offset, uint8_t data) override; virtual void write_l(offs_t offset, u8 data) override;
virtual void write_h(offs_t offset, uint8_t data) override; // offset does not really count for this mapper
virtual void prg_cb(int start, int bank) override; virtual void prg_cb(int start, int bank) override;
virtual void chr_cb(int start, int bank, int source) override; virtual void chr_cb(int start, int bank, int source) override;
@ -371,7 +370,7 @@ protected:
virtual void device_start() override; virtual void device_start() override;
private: private:
uint8_t m_reg[4]; bool m_mmc3_mode;
}; };

View File

@ -574,12 +574,6 @@ void device_nes_cart_interface::reset_cpu()
m_maincpu->set_pc(0xfffc); m_maincpu->set_pc(0xfffc);
} }
void device_nes_cart_interface::poke(offs_t offset, uint8_t data)
{
// even worse hack
m_maincpu->space(AS_PROGRAM).write_byte(offset, data);
}
//------------------------------------------------- //-------------------------------------------------
// Other helpers // Other helpers
//------------------------------------------------- //-------------------------------------------------

View File

@ -269,7 +269,6 @@ protected:
DECLARE_WRITE_LINE_MEMBER(set_irq_line); DECLARE_WRITE_LINE_MEMBER(set_irq_line);
[[deprecated("IRQs should be cleared explicitly")]] void hold_irq_line(); [[deprecated("IRQs should be cleared explicitly")]] void hold_irq_line();
void reset_cpu(); void reset_cpu();
[[deprecated("devices should stop poking into memory spaces where they don't belong")]] void poke(offs_t offset, uint8_t data);
// internal state // internal state
uint8_t *m_prg; uint8_t *m_prg;