mirror of
https://github.com/libretro/mame.git
synced 2024-12-11 19:53:49 +00:00
(MESS) nes.c: slightly more refined open bus emulation (still not 100% accurate, but it suffices
to make happy the two games which had issues with previous implementation). nw
This commit is contained in:
parent
e794ee5bc4
commit
3a78dea789
@ -969,7 +969,7 @@ READ8_MEMBER(nes_smb2j_device::read_l)
|
||||
if (offset >= 0x1000)
|
||||
return m_prg[0x10000 + (offset & 0x0fff)];
|
||||
|
||||
return ((offset + 0x4000) & 0xff00) >> 8; // open bus
|
||||
return m_open_bus; // open bus
|
||||
}
|
||||
|
||||
READ8_MEMBER(nes_smb2j_device::read_m)
|
||||
|
@ -283,7 +283,7 @@ READ8_MEMBER(nes_jy_typea_device::read_l)
|
||||
if ((offset & 3) == 3)
|
||||
return m_latch;
|
||||
}
|
||||
return ((offset + 0x4000) & 0xff00) >> 8; // open bus
|
||||
return m_open_bus; // open bus
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(nes_jy_typea_device::write_l)
|
||||
@ -310,7 +310,7 @@ READ8_MEMBER(nes_jy_typea_device::read_m)
|
||||
if (m_reg[0] & 0x80)
|
||||
return m_prg[(m_bank_6000 & m_prg_mask) * 0x2000 + (offset & 0x1fff)];
|
||||
|
||||
return ((offset + 0x6000) & 0xff00) >> 8; // open bus
|
||||
return m_open_bus; // open bus
|
||||
}
|
||||
|
||||
|
||||
|
@ -476,7 +476,7 @@ READ8_MEMBER(nes_ks7017_device::read_ex)
|
||||
return temp;
|
||||
}
|
||||
|
||||
return ((offset + 0x4000) & 0xff00) >> 8; // open bus
|
||||
return m_open_bus; // open bus
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
|
@ -295,7 +295,7 @@ READ8_MEMBER(nes_konami_vrc2_device::read_m)
|
||||
else if (m_prgram)
|
||||
return m_prgram[offset & (m_prgram_size - 1)];
|
||||
else // sort of protection? it returns open bus in $7000-$7fff and (open bus & 0xfe) | m_latch in $6000-$6fff
|
||||
return (offset < 0x1000) ? ((((offset + 0x8000) & 0xfe00) >> 8) | (m_latch & 1)) : (((offset + 0x8000) & 0xff00) >> 8);
|
||||
return (offset < 0x1000) ? ((m_open_bus & 0xfe) | (m_latch & 1)) : m_open_bus;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(nes_konami_vrc2_device::write_m)
|
||||
@ -602,9 +602,7 @@ WRITE8_MEMBER(nes_konami_vrc6_device::write_h)
|
||||
}
|
||||
}
|
||||
else // saw
|
||||
{
|
||||
m_vrc6snd->write(space, (add_lines>>8) | 0x200, data);
|
||||
}
|
||||
break;
|
||||
case 0x5000:
|
||||
case 0x6000:
|
||||
|
@ -293,7 +293,7 @@ READ8_MEMBER(nes_sxrom_device::read_m)
|
||||
return m_prgram[((bank * 0x2000) + offset) & (m_prgram_size - 1)];
|
||||
}
|
||||
|
||||
return ((offset + 0x6000) & 0xff00) >> 8; // open bus
|
||||
return m_open_bus; // open bus
|
||||
}
|
||||
|
||||
// SOROM has two RAM banks, the first is not battery backed up, the second is.
|
||||
@ -324,7 +324,7 @@ READ8_MEMBER(nes_sorom_device::read_m)
|
||||
return m_prgram[offset & (m_prgram_size - 1)];
|
||||
}
|
||||
|
||||
return ((offset + 0x6000) & 0xff00) >> 8; // open bus
|
||||
return m_open_bus; // open bus
|
||||
}
|
||||
|
||||
// MMC1A boards have no wram enable/disable bit
|
||||
@ -349,7 +349,7 @@ READ8_MEMBER(nes_sxrom_a_device::read_m)
|
||||
if (m_prgram)
|
||||
return m_prgram[((bank * 0x2000) + offset) & (m_prgram_size - 1)];
|
||||
|
||||
return ((offset + 0x6000) & 0xff00) >> 8; // open bus
|
||||
return m_open_bus; // open bus
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(nes_sorom_a_device::write_m)
|
||||
|
@ -340,7 +340,7 @@ READ8_MEMBER(nes_txrom_device::read_m)
|
||||
return m_prgram[offset & (m_prgram_size - 1)];
|
||||
}
|
||||
|
||||
return ((offset + 0x6000) & 0xff00) >> 8; // open bus
|
||||
return m_open_bus; // open bus
|
||||
}
|
||||
|
||||
|
||||
@ -376,10 +376,10 @@ READ8_MEMBER(nes_hkrom_device::read_m)
|
||||
LOG_MMC(("hkrom read_m, offset: %04x\n", offset));
|
||||
|
||||
if (offset < 0x1000)
|
||||
return 0xff; // here it should be open bus
|
||||
return m_open_bus; // open bus
|
||||
|
||||
if (!(m_mmc6_reg & 0xa0))
|
||||
return 0xff; // here it should be open bus
|
||||
return m_open_bus; // open bus
|
||||
|
||||
if (BIT(offset, 9) && BIT(m_mmc6_reg, 7)) // access to upper half of 1k when upper read is enabled
|
||||
return m_mmc6_ram[offset & 0x3ff];
|
||||
|
@ -444,10 +444,10 @@ void nes_a9746_device::pcb_reset()
|
||||
{
|
||||
m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM;
|
||||
|
||||
mmc3_common_initialize(0x7f, 0xff, 0);
|
||||
m_reg[0] = 0;
|
||||
m_reg[1] = 0;
|
||||
m_reg[2] = 0;
|
||||
mmc3_common_initialize(0x7f, 0xff, 0);
|
||||
}
|
||||
|
||||
void nes_fk23c_device::device_start()
|
||||
@ -1797,7 +1797,7 @@ READ8_MEMBER( nes_sachen_shero_device::read_l )
|
||||
{
|
||||
// DSW read!
|
||||
}
|
||||
return (offset & 0xff00) >> 8; // open bus
|
||||
return m_open_bus; // open bus
|
||||
}
|
||||
|
||||
|
||||
|
@ -1476,7 +1476,7 @@ READ8_MEMBER(nes_bmc_gb63_device::read_h)
|
||||
// m_dipsetting = ioport("CARTDIPS")->read();
|
||||
|
||||
if (m_latch == 1)
|
||||
return (offset & 0xff00) >> 8; // open bus
|
||||
return m_open_bus; // open bus
|
||||
else
|
||||
return hi_access_rom(offset);
|
||||
}
|
||||
@ -2458,7 +2458,7 @@ READ8_MEMBER(nes_bmc_gold150_device::read_h)
|
||||
LOG_MMC(("bmc_gold150 read_h, offset: %04x\n", offset));
|
||||
|
||||
if (m_latch) // open bus
|
||||
return (offset & 0xff00) >> 8;
|
||||
return m_open_bus;
|
||||
else
|
||||
return hi_access_rom(offset);
|
||||
}
|
||||
@ -2511,7 +2511,7 @@ READ8_MEMBER(nes_bmc_ch001_device::read_h)
|
||||
LOG_MMC(("bmc_ch001 read_h, offset: %04x\n", offset));
|
||||
|
||||
if (m_latch && offset < 0x4000) // open bus
|
||||
return (offset & 0xff00) >> 8;
|
||||
return m_open_bus;
|
||||
else
|
||||
return hi_access_rom(offset);
|
||||
}
|
||||
|
@ -520,7 +520,7 @@ READ8_MEMBER(nes_namcot175_device::read_m)
|
||||
if (m_battery && offset < m_battery_size && m_wram_enable)
|
||||
return m_battery[offset & (m_battery_size - 1)];
|
||||
|
||||
return ((offset + 0x6000) & 0xff00) >> 8; // open bus
|
||||
return m_open_bus; // open bus
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(nes_namcot175_device::write_m)
|
||||
@ -602,7 +602,7 @@ READ8_MEMBER(nes_namcot163_device::read_m)
|
||||
if (m_battery && offset < m_battery_size)
|
||||
return m_battery[offset & (m_battery_size - 1)];
|
||||
|
||||
return ((offset + 0x6000) & 0xff00) >> 8; // open bus
|
||||
return m_open_bus; // open bus
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(nes_namcot163_device::write_m)
|
||||
|
@ -1384,6 +1384,6 @@ READ8_MEMBER(nes_fujiya_device::read_m)
|
||||
if (offset == 0x7001 || offset == 0x7777)
|
||||
return m_latch | ((offset >> 8) & 0x7f);
|
||||
|
||||
return (offset & 0xff00) >> 8; // open bus
|
||||
return m_open_bus; // open bus
|
||||
}
|
||||
#endif
|
||||
|
@ -130,6 +130,7 @@ device_nes_cart_interface::device_nes_cart_interface(const machine_config &mconf
|
||||
m_has_trainer(FALSE),
|
||||
m_x1_005_alt_mirroring(FALSE),
|
||||
m_bus_conflict(TRUE),
|
||||
m_open_bus(0),
|
||||
m_prg_chunks(0),
|
||||
m_prg_mask(0xffff),
|
||||
m_chr_source(CHRRAM),
|
||||
@ -656,7 +657,7 @@ READ8_MEMBER(device_nes_cart_interface::nt_r)
|
||||
|
||||
READ8_MEMBER(device_nes_cart_interface::read_l)
|
||||
{
|
||||
return ((offset + 0x4100) & 0xff00) >> 8; // open bus
|
||||
return m_open_bus;
|
||||
}
|
||||
|
||||
READ8_MEMBER(device_nes_cart_interface::read_m)
|
||||
@ -666,7 +667,7 @@ READ8_MEMBER(device_nes_cart_interface::read_m)
|
||||
if (m_prgram)
|
||||
return m_prgram[offset & (m_prgram_size - 1)];
|
||||
|
||||
return ((offset + 0x6000) & 0xff00) >> 8; // open bus
|
||||
return m_open_bus;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(device_nes_cart_interface::write_l)
|
||||
@ -993,7 +994,12 @@ const char * nes_cart_slot_device::get_default_card_software(const machine_confi
|
||||
READ8_MEMBER(nes_cart_slot_device::read_l)
|
||||
{
|
||||
if (m_cart)
|
||||
return m_cart->read_l(space, offset);
|
||||
{
|
||||
UINT8 val = m_cart->read_l(space, offset);
|
||||
// update open bus
|
||||
m_cart->set_open_bus(((offset + 0x4100) & 0xff00) >> 8);
|
||||
return val;
|
||||
}
|
||||
else
|
||||
return 0xff;
|
||||
}
|
||||
@ -1001,7 +1007,12 @@ READ8_MEMBER(nes_cart_slot_device::read_l)
|
||||
READ8_MEMBER(nes_cart_slot_device::read_m)
|
||||
{
|
||||
if (m_cart)
|
||||
return m_cart->read_m(space, offset);
|
||||
{
|
||||
UINT8 val = m_cart->read_m(space, offset);
|
||||
// update open bus
|
||||
m_cart->set_open_bus(((offset + 0x6000) & 0xff00) >> 8);
|
||||
return val;
|
||||
}
|
||||
else
|
||||
return 0xff;
|
||||
}
|
||||
@ -1009,7 +1020,12 @@ READ8_MEMBER(nes_cart_slot_device::read_m)
|
||||
READ8_MEMBER(nes_cart_slot_device::read_h)
|
||||
{
|
||||
if (m_cart)
|
||||
return m_cart->read_h(space, offset);
|
||||
{
|
||||
UINT8 val = m_cart->read_h(space, offset);
|
||||
// update open bus
|
||||
m_cart->set_open_bus(((offset + 0x8000) & 0xff00) >> 8);
|
||||
return val;
|
||||
}
|
||||
else
|
||||
return 0xff;
|
||||
}
|
||||
@ -1017,7 +1033,12 @@ READ8_MEMBER(nes_cart_slot_device::read_h)
|
||||
READ8_MEMBER(nes_cart_slot_device::read_ex)
|
||||
{
|
||||
if (m_cart)
|
||||
return m_cart->read_ex(space, offset);
|
||||
{
|
||||
UINT8 val = m_cart->read_ex(space, offset);
|
||||
// update open bus
|
||||
m_cart->set_open_bus(((offset + 0x4020) & 0xff00) >> 8);
|
||||
return val;
|
||||
}
|
||||
else
|
||||
return 0xff;
|
||||
}
|
||||
@ -1030,25 +1051,41 @@ READ8_MEMBER(nes_cart_slot_device::read_ex)
|
||||
WRITE8_MEMBER(nes_cart_slot_device::write_l)
|
||||
{
|
||||
if (m_cart)
|
||||
{
|
||||
m_cart->write_l(space, offset, data);
|
||||
// update open bus
|
||||
m_cart->set_open_bus(((offset + 0x4100) & 0xff00) >> 8);
|
||||
}
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(nes_cart_slot_device::write_m)
|
||||
{
|
||||
if (m_cart)
|
||||
{
|
||||
m_cart->write_m(space, offset, data);
|
||||
// update open bus
|
||||
m_cart->set_open_bus(((offset + 0x6000) & 0xff00) >> 8);
|
||||
}
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(nes_cart_slot_device::write_h)
|
||||
{
|
||||
if (m_cart)
|
||||
{
|
||||
m_cart->write_h(space, offset, data);
|
||||
// update open bus
|
||||
m_cart->set_open_bus(((offset + 0x8000) & 0xff00) >> 8);
|
||||
}
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(nes_cart_slot_device::write_ex)
|
||||
{
|
||||
if (m_cart)
|
||||
{
|
||||
m_cart->write_ex(space, offset, data);
|
||||
// update open bus
|
||||
m_cart->set_open_bus(((offset + 0x4020) & 0xff00) >> 8);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -192,6 +192,7 @@ public:
|
||||
void set_vrc_lines(int PRG_A, int PRG_B, int CHR) { m_vrc_ls_prg_a = PRG_A; m_vrc_ls_prg_b = PRG_B; m_vrc_ls_chr = CHR; }
|
||||
void set_x1_005_alt(bool val) { m_x1_005_alt_mirroring = val; }
|
||||
void set_bus_conflict(bool val) { m_bus_conflict = val; }
|
||||
void set_open_bus(UINT8 val) { m_open_bus = val; }
|
||||
|
||||
UINT8* get_prg_base() { return m_prg; }
|
||||
UINT8* get_prgram_base() { return m_prgram; }
|
||||
@ -252,6 +253,7 @@ protected:
|
||||
bool m_pcb_ctrl_mirror, m_four_screen_vram, m_has_trainer;
|
||||
bool m_x1_005_alt_mirroring; // temp hack for two kind of mirroring in Taito X1-005 boards (to be replaced with pin checking)
|
||||
bool m_bus_conflict;
|
||||
UINT8 m_open_bus;
|
||||
|
||||
// PRG
|
||||
inline int prg_8k_bank_num(int bank);
|
||||
|
@ -443,7 +443,7 @@ READ8_MEMBER(nes_sunsoft_4_device::read_m)
|
||||
if (m_prgram && m_wram_enable)
|
||||
return m_prgram[offset & (m_prgram_size - 1)];
|
||||
|
||||
return ((offset + 0x6000) & 0xff00) >> 8; // open bus
|
||||
return m_open_bus; // open bus
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
@ -564,7 +564,7 @@ READ8_MEMBER(nes_sunsoft_fme7_device::read_m)
|
||||
return m_prgram[((bank * 0x2000) + offset) & (m_prgram_size - 1)];
|
||||
}
|
||||
|
||||
return ((offset + 0x6000) & 0xff00) >> 8; // open bus
|
||||
return m_open_bus; // open bus
|
||||
}
|
||||
|
||||
|
||||
|
@ -231,7 +231,7 @@ READ8_MEMBER(nes_sunsoft_dcs_device::read_h)
|
||||
if (m_timer_on)
|
||||
return m_subslot->m_cart->read(space, offset, mem_mask);
|
||||
else
|
||||
return ((offset + 0x8000) & 0xff00) >> 8; // after the timer is off, this returns open bus...
|
||||
return m_open_bus; // after the timer is off, this returns open bus...
|
||||
}
|
||||
else
|
||||
return hi_access_rom(offset);
|
||||
@ -262,7 +262,7 @@ READ8_MEMBER(nes_sunsoft_dcs_device::read_m)
|
||||
if (m_prgram && m_wram_enable)
|
||||
return m_prgram[offset & (m_prgram_size - 1)];
|
||||
|
||||
return ((offset + 0x6000) & 0xff00) >> 8; // open bus
|
||||
return m_open_bus; // open bus
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
|
@ -366,7 +366,7 @@ READ8_MEMBER(nes_x1_005_device::read_m)
|
||||
if (offset >= 0x1f00 && m_latch == 0xa3)
|
||||
return m_x1_005_ram[offset & 0x7f];
|
||||
|
||||
return ((offset + 0x6000) & 0xff00) >> 8; // open bus
|
||||
return m_open_bus; // open bus
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
@ -469,5 +469,5 @@ READ8_MEMBER(nes_x1_017_device::read_m)
|
||||
if (offset < 0x1400 && m_reg[2] == 0x84)
|
||||
return m_x1_017_ram[0x1000 + (offset & 0x3ff)];
|
||||
|
||||
return ((offset + 0x6000) & 0xff00) >> 8; // open bus
|
||||
return m_open_bus; // open bus
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user