summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/midzeus.c
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2010-09-04 17:01:46 +0000
committer Aaron Giles <aaron@aarongiles.com>2010-09-04 17:01:46 +0000
commit5b6c078aebe05f8415acc9a7e3d423f89342b628 (patch)
tree3492d73afc9907d181f2d025f3382cf728d9fc3a /src/mame/drivers/midzeus.c
parent8969b0b7ee3a47b281d767dfea9f31b14a09b692 (diff)
Added templates required_shared_ptr<> and optional_shared_ptr<> which
work just like required_device<> and optional_device<> for retrieving a pointer by tag from an address space that specifies AM_SHARE("tag"). Also added templates required_shared_size<> and optional_shared_size<> for retrieving the size of the AM_SHARE region. Created a new generic NVRAM device. It can be configured to default to 0-fill, 1-fill, random-fill, or custom fill. In all cases, a same-named memory region overrides the default fill. The address range where the NVRAM can be found is now identified by an AM_SHARE() region of the same tag as the NVRAM device. Drivers can also explicitly configure a separately-allocated NVRAM region via nvram_device::set_base(). Replaced all instances of MDRV_NVRAM_HANDLER(generic_*) with MDRV_NVRAM_ADD_*("nvram"). Replaced all AM_BASE_GENERIC/AM_SIZE_GENERIC(nvram) with AM_SHARE("nvram"). For all remaining drivers that referenced the generic.nvram directly, changed them to hold a required_shared_ptr<UINTx> to the NVRAM in their driver state, and use that instead. Removed nvram and nvram_size from the generic_ptrs.
Diffstat (limited to 'src/mame/drivers/midzeus.c')
-rw-r--r--src/mame/drivers/midzeus.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/mame/drivers/midzeus.c b/src/mame/drivers/midzeus.c
index 39509fffd33..537362f2db8 100644
--- a/src/mame/drivers/midzeus.c
+++ b/src/mame/drivers/midzeus.c
@@ -36,6 +36,7 @@ The Grid v1.2 10/18/2000
#include "machine/midwayic.h"
#include "machine/timekpr.h"
#include "audio/dcs.h"
+#include "machine/nvram.h"
#include "crusnexo.lh"
@@ -132,8 +133,9 @@ static INTERRUPT_GEN( display_irq )
static WRITE32_HANDLER( cmos_w )
{
+ midzeus_state *state = space->machine->driver_data<midzeus_state>();
if (bitlatch[2] && !cmos_protected)
- COMBINE_DATA(&space->machine->generic.nvram.u32[offset]);
+ COMBINE_DATA(&state->m_nvram[offset]);
else
logerror("%06X:timekeeper_w with bitlatch[2] = %d, cmos_protected = %d\n", cpu_get_pc(space->cpu), bitlatch[2], cmos_protected);
cmos_protected = TRUE;
@@ -142,7 +144,8 @@ static WRITE32_HANDLER( cmos_w )
static READ32_HANDLER( cmos_r )
{
- return space->machine->generic.nvram.u32[offset] | 0xffffff00;
+ midzeus_state *state = space->machine->driver_data<midzeus_state>();
+ return state->m_nvram[offset] | 0xffffff00;
}
@@ -591,7 +594,7 @@ static ADDRESS_MAP_START( zeus_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x8d0000, 0x8d0004) AM_READWRITE(bitlatches_r, bitlatches_w)
AM_RANGE(0x990000, 0x99000f) AM_READWRITE(midway_ioasic_r, midway_ioasic_w)
AM_RANGE(0x9e0000, 0x9e0000) AM_WRITENOP // watchdog?
- AM_RANGE(0x9f0000, 0x9f7fff) AM_READWRITE(cmos_r, cmos_w) AM_BASE_SIZE_GENERIC(nvram)
+ AM_RANGE(0x9f0000, 0x9f7fff) AM_READWRITE(cmos_r, cmos_w) AM_SHARE("nvram")
AM_RANGE(0x9f8000, 0x9f8000) AM_WRITE(cmos_protect_w)
AM_RANGE(0xa00000, 0xffffff) AM_ROM AM_REGION("user1", 0)
ADDRESS_MAP_END
@@ -1107,7 +1110,7 @@ INPUT_PORTS_END
*
*************************************/
-static MACHINE_CONFIG_START( midzeus, driver_device )
+static MACHINE_CONFIG_START( midzeus, midzeus_state )
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", TMS32032, CPU_CLOCK)
@@ -1116,7 +1119,7 @@ static MACHINE_CONFIG_START( midzeus, driver_device )
MDRV_MACHINE_START(midzeus)
MDRV_MACHINE_RESET(midzeus)
- MDRV_NVRAM_HANDLER(generic_1fill)
+ MDRV_NVRAM_ADD_1FILL("nvram")
/* video hardware */
MDRV_PALETTE_LENGTH(32768)