(MESS) nes_mmc5: further cleanups (this time for NT-RAM handling). no visible improvements,
but it bothered me that we were saving as NVRAM the external RAM, while it was volatile in real carts. nw.
This commit is contained in:
parent
dd91beb013
commit
1aa7194558
@ -79,9 +79,6 @@ void nes_exrom_device::device_start()
|
||||
|
||||
m_exram = auto_alloc_array_clear(machine(), UINT8, 0x400);
|
||||
save_pointer(NAME(m_exram), 0x400);
|
||||
|
||||
m_mapper_sram_size = 0x400;
|
||||
m_mapper_sram = m_exram;
|
||||
}
|
||||
|
||||
void nes_exrom_device::pcb_reset()
|
||||
@ -121,22 +118,6 @@ void nes_exrom_device::pcb_reset()
|
||||
}
|
||||
|
||||
|
||||
READ8_MEMBER(nes_exrom_device::nt_r)
|
||||
{
|
||||
int page = ((offset & 0xc00) >> 10);
|
||||
|
||||
if (m_nt_src[page] == MMC5FILL)
|
||||
{
|
||||
if ((offset & 0x3ff) >= 0x3c0)
|
||||
return m_floodattr;
|
||||
|
||||
return m_floodtile;
|
||||
}
|
||||
return m_nt_access[page][offset & 0x3ff];
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
mapper specific handlers
|
||||
-------------------------------------------------*/
|
||||
@ -348,16 +329,16 @@ void nes_exrom_device::set_mirror(int page, int src)
|
||||
{
|
||||
switch (src)
|
||||
{
|
||||
case 0: /* CIRAM0 */
|
||||
case 0:
|
||||
set_nt_page(page, CIRAM, 0, 1);
|
||||
break;
|
||||
case 1: /* CIRAM1 */
|
||||
case 1:
|
||||
set_nt_page(page, CIRAM, 1, 1);
|
||||
break;
|
||||
case 2: /* ExRAM */
|
||||
set_nt_page(page, EXRAM, 0, 1); // actually only works during rendering.
|
||||
case 2:
|
||||
set_nt_page(page, EXRAM, 0, 1);
|
||||
break;
|
||||
case 3: /* Fill Registers */
|
||||
case 3:
|
||||
set_nt_page(page, MMC5FILL, 0, 0);
|
||||
break;
|
||||
default:
|
||||
@ -366,6 +347,51 @@ void nes_exrom_device::set_mirror(int page, int src)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
READ8_MEMBER(nes_exrom_device::nt_r)
|
||||
{
|
||||
int page = ((offset & 0xc00) >> 10);
|
||||
|
||||
switch (m_nt_src[page])
|
||||
{
|
||||
case MMC5FILL:
|
||||
if ((offset & 0x3ff) >= 0x3c0)
|
||||
return m_floodattr;
|
||||
return m_floodtile;
|
||||
|
||||
case EXRAM:
|
||||
if (!BIT(m_exram_control, 1))
|
||||
return m_exram[offset & 0x3ff];
|
||||
else
|
||||
return 0x00;
|
||||
|
||||
case CIRAM:
|
||||
default:
|
||||
return m_nt_access[page][offset & 0x3ff];
|
||||
}
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(nes_exrom_device::nt_w)
|
||||
{
|
||||
int page = ((offset & 0xc00) >> 10);
|
||||
|
||||
if (!m_nt_writable[page])
|
||||
return;
|
||||
|
||||
switch (m_nt_src[page])
|
||||
{
|
||||
case EXRAM:
|
||||
m_exram[offset & 0x3ff] = data;
|
||||
break;
|
||||
|
||||
case CIRAM:
|
||||
default:
|
||||
m_nt_access[page][offset & 0x3ff] = data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
READ8_MEMBER(nes_exrom_device::read_l)
|
||||
{
|
||||
int value;
|
||||
|
@ -19,6 +19,7 @@ public:
|
||||
virtual DECLARE_WRITE8_MEMBER(write_l);
|
||||
virtual DECLARE_WRITE8_MEMBER(write_m);
|
||||
virtual DECLARE_READ8_MEMBER(nt_r);
|
||||
virtual DECLARE_WRITE8_MEMBER(nt_w);
|
||||
|
||||
virtual void hblank_irq(int scanline, int vblank, int blanked);
|
||||
virtual void pcb_reset();
|
||||
|
@ -503,15 +503,13 @@ void device_nes_cart_interface::set_nt_page(int page, int source, int bank, int
|
||||
case CART_NTRAM:
|
||||
base_ptr = m_ext_ntram;
|
||||
break;
|
||||
case MMC5FILL:
|
||||
base_ptr = NULL;
|
||||
break;
|
||||
case VROM:
|
||||
bank &= ((m_vrom_chunks << 3) - 1);
|
||||
base_ptr = m_vrom;
|
||||
break;
|
||||
case EXRAM:
|
||||
base_ptr = m_mapper_sram;
|
||||
case MMC5FILL:
|
||||
base_ptr = NULL;
|
||||
break;
|
||||
case CIRAM:
|
||||
default:
|
||||
@ -522,7 +520,7 @@ void device_nes_cart_interface::set_nt_page(int page, int source, int bank, int
|
||||
page &= 3; /* mask down to the 4 logical pages */
|
||||
m_nt_src[page] = source;
|
||||
|
||||
if (base_ptr != NULL)
|
||||
if (base_ptr)
|
||||
{
|
||||
m_nt_orig[page] = bank * 0x400;
|
||||
m_nt_access[page] = base_ptr + m_nt_orig[page];
|
||||
|
Loading…
Reference in New Issue
Block a user