Changed device->subregion to device->memregion. Moved

memory_region management into the memory manager instead
of directly in the machine. Hid the global region method;
now all regions must be looked up relative to a device.

If you're a member function, you can just use memregion("tag") 
directly. If you're a global function or a device referencing
global regions, use machine().root_device().memregion("tag")
to look up regions relative to the root.

S&R to convert all references:

machine([()]*)\.region
machine\1\.root_device\(\).subregion

Then remove redundant machine().root_device() within src/mame:

([ \t])machine\(\)\.root_device\(\)\.
\1

And use state->memregion() if we have a state variable present:

(state *= *[^;]+driver_data[^}]+)([^ \t]*)machine[()]*\.root_device\(\)\.
\1state->

Finally some cleanup:

screen.state->
state->

device->state->
state->

space->state->
state->

And a few hand-tweaks.
This commit is contained in:
Aaron Giles 2012-04-20 05:54:39 +00:00
parent 776d29c90f
commit 18f33f4eff
1180 changed files with 4250 additions and 4334 deletions

View File

@ -279,7 +279,7 @@ static CPU_INIT( cquestsnd )
memset(cpustate, 0, sizeof(*cpustate)); memset(cpustate, 0, sizeof(*cpustate));
cpustate->dac_w = _config->dac_w; cpustate->dac_w = _config->dac_w;
cpustate->sound_data = (UINT16*)device->machine().region(_config->sound_data_region)->base(); cpustate->sound_data = (UINT16*)device->machine().root_device().memregion(_config->sound_data_region)->base();
cpustate->device = device; cpustate->device = device;
cpustate->program = device->space(AS_PROGRAM); cpustate->program = device->space(AS_PROGRAM);

View File

@ -256,7 +256,7 @@ static CPU_INIT( esrip )
/* Register configuration structure callbacks */ /* Register configuration structure callbacks */
cpustate->fdt_r = _config->fdt_r; cpustate->fdt_r = _config->fdt_r;
cpustate->fdt_w = _config->fdt_w; cpustate->fdt_w = _config->fdt_w;
cpustate->lbrm = (UINT8*)device->machine().region(_config->lbrm_prom)->base(); cpustate->lbrm = (UINT8*)device->machine().root_device().memregion(_config->lbrm_prom)->base();
cpustate->status_in = _config->status_in; cpustate->status_in = _config->status_in;
cpustate->draw = _config->draw; cpustate->draw = _config->draw;

View File

@ -119,7 +119,7 @@ static CPU_INIT( mb86233 )
{ {
cpustate->fifo_read_cb = _config->fifo_read_cb; cpustate->fifo_read_cb = _config->fifo_read_cb;
cpustate->fifo_write_cb = _config->fifo_write_cb; cpustate->fifo_write_cb = _config->fifo_write_cb;
cpustate->Tables = (UINT32*) device->machine().region(_config->tablergn)->base(); cpustate->Tables = (UINT32*) device->machine().root_device().memregion(_config->tablergn)->base();
} }
cpustate->RAM = auto_alloc_array(device->machine(), UINT32, 2 * 0x200); /* 2x 2KB */ cpustate->RAM = auto_alloc_array(device->machine(), UINT32, 2 * 0x200); /* 2x 2KB */

View File

@ -1285,7 +1285,7 @@ static UINT64 expression_read_program_direct(address_space *_space, int opcode,
static UINT64 expression_read_memory_region(running_machine &machine, const char *rgntag, offs_t address, int size) static UINT64 expression_read_memory_region(running_machine &machine, const char *rgntag, offs_t address, int size)
{ {
const memory_region *region = machine.region(rgntag); memory_region *region = machine.root_device().memregion(rgntag);
UINT64 result = ~(UINT64)0 >> (64 - 8*size); UINT64 result = ~(UINT64)0 >> (64 - 8*size);
/* make sure we get a valid base before proceeding */ /* make sure we get a valid base before proceeding */
@ -1462,7 +1462,7 @@ static void expression_write_program_direct(address_space *_space, int opcode, o
static void expression_write_memory_region(running_machine &machine, const char *rgntag, offs_t address, int size, UINT64 data) static void expression_write_memory_region(running_machine &machine, const char *rgntag, offs_t address, int size, UINT64 data)
{ {
debugcpu_private *global = machine.debugcpu_data; debugcpu_private *global = machine.debugcpu_data;
const memory_region *region = machine.region(rgntag); memory_region *region = machine.root_device().memregion(rgntag);
/* make sure we get a valid base before proceeding */ /* make sure we get a valid base before proceeding */
if (region != NULL) if (region != NULL)
@ -1571,7 +1571,7 @@ static expression_error::error_code expression_validate(void *param, const char
case EXPSPACE_REGION: case EXPSPACE_REGION:
if (name == NULL) if (name == NULL)
return expression_error::MISSING_MEMORY_NAME; return expression_error::MISSING_MEMORY_NAME;
if (machine.region(name)->base() == NULL) if (machine.root_device().memregion(name)->base() == NULL)
return expression_error::INVALID_MEMORY_NAME; return expression_error::INVALID_MEMORY_NAME;
break; break;

View File

@ -84,7 +84,7 @@ debug_view_memory_source::debug_view_memory_source(const char *name, address_spa
{ {
} }
debug_view_memory_source::debug_view_memory_source(const char *name, const memory_region &region) debug_view_memory_source::debug_view_memory_source(const char *name, memory_region &region)
: debug_view_source(name), : debug_view_source(name),
m_space(NULL), m_space(NULL),
m_memintf(NULL), m_memintf(NULL),
@ -165,7 +165,7 @@ void debug_view_memory::enumerate_sources()
} }
// then add all the memory regions // then add all the memory regions
for (const memory_region *region = machine().first_region(); region != NULL; region = region->next()) for (memory_region *region = machine().memory().first_region(); region != NULL; region = region->next())
{ {
name.printf("Region '%s'", region->name()); name.printf("Region '%s'", region->name());
m_source_list.append(*auto_alloc(machine(), debug_view_memory_source(name, *region))); m_source_list.append(*auto_alloc(machine(), debug_view_memory_source(name, *region)));
@ -707,7 +707,7 @@ void debug_view_memory::write(UINT8 size, offs_t offs, UINT64 data)
// hack for FD1094 editing // hack for FD1094 editing
#ifdef FD1094_HACK #ifdef FD1094_HACK
if (source.m_base == machine().region("user2")) if (source.m_base == machine().root_device().memregion("user2"))
{ {
extern void fd1094_regenerate_key(running_machine &machine); extern void fd1094_regenerate_key(running_machine &machine);
fd1094_regenerate_key(machine()); fd1094_regenerate_key(machine());

View File

@ -53,7 +53,7 @@ class debug_view_memory_source : public debug_view_source
friend class debug_view_memory; friend class debug_view_memory;
debug_view_memory_source(const char *name, address_space &space); debug_view_memory_source(const char *name, address_space &space);
debug_view_memory_source(const char *name, const memory_region &region); debug_view_memory_source(const char *name, memory_region &region);
debug_view_memory_source(const char *name, void *base, int element_size, int num_elements); debug_view_memory_source(const char *name, void *base, int element_size, int num_elements);
public: public:

View File

@ -186,11 +186,11 @@ device_t::~device_t()
//------------------------------------------------- //-------------------------------------------------
// subregion - return a pointer to the region // memregion - return a pointer to the region
// info for a given region // info for a given region
//------------------------------------------------- //-------------------------------------------------
const memory_region *device_t::subregion(const char *_tag) const memory_region *device_t::memregion(const char *_tag) const
{ {
// safety first // safety first
if (this == NULL) if (this == NULL)
@ -198,12 +198,12 @@ const memory_region *device_t::subregion(const char *_tag) const
// build a fully-qualified name and look it up // build a fully-qualified name and look it up
astring fullpath; astring fullpath;
return machine().region(subtag(fullpath, _tag)); return machine().memory().region(subtag(fullpath, _tag));
} }
//------------------------------------------------- //-------------------------------------------------
// subregion - return a pointer to the memory // memregion - return a pointer to the memory
// bank info for a given bank // bank info for a given bank
//------------------------------------------------- //-------------------------------------------------
@ -397,7 +397,7 @@ void device_t::set_machine(running_machine &machine)
void device_t::start() void device_t::start()
{ {
// populate the machine and the region field // populate the machine and the region field
m_region = machine().region(tag()); m_region = machine().root_device().memregion(tag());
// find all the registered devices // find all the registered devices
bool allfound = true; bool allfound = true;

View File

@ -183,13 +183,13 @@ public:
device_t *first_subdevice() const { return m_subdevice_list.first(); } device_t *first_subdevice() const { return m_subdevice_list.first(); }
astring &subtag(astring &dest, const char *tag) const; astring &subtag(astring &dest, const char *tag) const;
astring &siblingtag(astring &dest, const char *tag) const { return (this != NULL && m_owner != NULL) ? m_owner->subtag(dest, tag) : dest.cpy(tag); } astring &siblingtag(astring &dest, const char *tag) const { return (this != NULL && m_owner != NULL) ? m_owner->subtag(dest, tag) : dest.cpy(tag); }
const memory_region *subregion(const char *tag) const; memory_region *memregion(const char *tag) const;
memory_bank *membank(const char *tag) const; memory_bank *membank(const char *tag) const;
device_t *subdevice(const char *tag) const; device_t *subdevice(const char *tag) const;
device_t *siblingdevice(const char *tag) const; device_t *siblingdevice(const char *tag) const;
template<class _DeviceClass> inline _DeviceClass *subdevice(const char *tag) const { return downcast<_DeviceClass *>(subdevice(tag)); } template<class _DeviceClass> inline _DeviceClass *subdevice(const char *tag) const { return downcast<_DeviceClass *>(subdevice(tag)); }
template<class _DeviceClass> inline _DeviceClass *siblingdevice(const char *tag) const { return downcast<_DeviceClass *>(siblingdevice(tag)); } template<class _DeviceClass> inline _DeviceClass *siblingdevice(const char *tag) const { return downcast<_DeviceClass *>(siblingdevice(tag)); }
const memory_region *region() const { return m_region; } memory_region *region() const { return m_region; }
// configuration helpers // configuration helpers
static void static_set_clock(device_t &device, UINT32 clock); static void static_set_clock(device_t &device, UINT32 clock);
@ -296,7 +296,7 @@ protected:
attoseconds_t m_attoseconds_per_clock;// period in attoseconds attoseconds_t m_attoseconds_per_clock;// period in attoseconds
device_debug * m_debug; device_debug * m_debug;
const memory_region * m_region; // our device-local region memory_region * m_region; // our device-local region
const machine_config & m_machine_config; // reference to the machine's configuration const machine_config & m_machine_config; // reference to the machine's configuration
const void * m_static_config; // static device configuration const void * m_static_config; // static device configuration
const input_device_default *m_input_defaults; // devices input ports default overrides const input_device_default *m_input_defaults; // devices input ports default overrides

View File

@ -422,7 +422,7 @@ UINT8 *device_image_interface::get_software_region(const char *tag)
return NULL; return NULL;
sprintf( full_tag, "%s:%s", device().tag(), tag ); sprintf( full_tag, "%s:%s", device().tag(), tag );
return device().machine().region( full_tag )->base(); return device().machine().root_device().memregion( full_tag )->base();
} }
@ -435,7 +435,7 @@ UINT32 device_image_interface::get_software_region_length(const char *tag)
char full_tag[256]; char full_tag[256];
sprintf( full_tag, "%s:%s", device().tag(), tag ); sprintf( full_tag, "%s:%s", device().tag(), tag );
return device().machine().region( full_tag )->bytes(); return device().machine().root_device().memregion( full_tag )->bytes();
} }

View File

@ -94,7 +94,7 @@ void gfx_init(running_machine &machine)
for (curgfx = 0; curgfx < MAX_GFX_ELEMENTS && gfxdecodeinfo[curgfx].gfxlayout != NULL; curgfx++) for (curgfx = 0; curgfx < MAX_GFX_ELEMENTS && gfxdecodeinfo[curgfx].gfxlayout != NULL; curgfx++)
{ {
const gfx_decode_entry *gfxdecode = &gfxdecodeinfo[curgfx]; const gfx_decode_entry *gfxdecode = &gfxdecodeinfo[curgfx];
const memory_region *region = (gfxdecode->memory_region != NULL) ? machine.region(gfxdecode->memory_region) : NULL; memory_region *region = (gfxdecode->memory_region != NULL) ? machine.root_device().memregion(gfxdecode->memory_region) : NULL;
UINT32 region_length = (region != NULL) ? (8 * region->bytes()) : 0; UINT32 region_length = (region != NULL) ? (8 * region->bytes()) : 0;
const UINT8 *region_base = (region != NULL) ? region->base() : NULL; const UINT8 *region_base = (region != NULL) ? region->base() : NULL;
UINT32 xscale = (gfxdecode->xscale == 0) ? 1 : gfxdecode->xscale; UINT32 xscale = (gfxdecode->xscale == 0) ? 1 : gfxdecode->xscale;

View File

@ -78,7 +78,7 @@ int cartslot_image_device::load_cartridge(const rom_entry *romrgn, const rom_ent
offset = ROM_GETOFFSET(roment); offset = ROM_GETOFFSET(roment);
size = ROM_GETLENGTH(roment); size = ROM_GETLENGTH(roment);
flags = ROM_GETFLAGS(roment); flags = ROM_GETFLAGS(roment);
ptr = ((UINT8 *) device().machine().region(region)->base()) + offset; ptr = ((UINT8 *) device().machine().root_device().memregion(region)->base()) + offset;
if (load) if (load)
{ {

View File

@ -150,10 +150,6 @@ running_machine::running_machine(const machine_config &_config, osd_interface &o
m_config(_config), m_config(_config),
m_system(_config.gamedrv()), m_system(_config.gamedrv()),
m_osd(osd), m_osd(osd),
m_regionlist(m_respool),
m_save(*this),
m_scheduler(*this),
m_memory(NULL),
m_cheat(NULL), m_cheat(NULL),
m_render(NULL), m_render(NULL),
m_input(NULL), m_input(NULL),
@ -176,7 +172,11 @@ running_machine::running_machine(const machine_config &_config, osd_interface &o
m_saveload_schedule(SLS_NONE), m_saveload_schedule(SLS_NONE),
m_saveload_schedule_time(attotime::zero), m_saveload_schedule_time(attotime::zero),
m_saveload_searchpath(NULL), m_saveload_searchpath(NULL),
m_logerror_list(m_respool) m_logerror_list(m_respool),
m_save(*this),
m_memory(*this),
m_scheduler(*this)
{ {
memset(gfx, 0, sizeof(gfx)); memset(gfx, 0, sizeof(gfx));
memset(&m_base_time, 0, sizeof(m_base_time)); memset(&m_base_time, 0, sizeof(m_base_time));
@ -276,7 +276,7 @@ void running_machine::start()
// first load ROMs, then populate memory, and finally initialize CPUs // first load ROMs, then populate memory, and finally initialize CPUs
// these operations must proceed in this order // these operations must proceed in this order
rom_init(*this); rom_init(*this);
m_memory = auto_alloc(*this, memory_manager(*this)); m_memory.initialize();
m_watchdog_timer = m_scheduler.timer_alloc(timer_expired_delegate(FUNC(running_machine::watchdog_fired), this)); m_watchdog_timer = m_scheduler.timer_alloc(timer_expired_delegate(FUNC(running_machine::watchdog_fired), this));
save().save_item(NAME(m_watchdog_enabled)); save().save_item(NAME(m_watchdog_enabled));
save().save_item(NAME(m_watchdog_counter)); save().save_item(NAME(m_watchdog_counter));
@ -605,33 +605,6 @@ void running_machine::resume()
} }
//-------------------------------------------------
// region_alloc - allocates memory for a region
//-------------------------------------------------
memory_region *running_machine::region_alloc(const char *name, UINT32 length, UINT8 width, endianness_t endian)
{
mame_printf_verbose("Region '%s' created\n", name);
// make sure we don't have a region of the same name; also find the end of the list
memory_region *info = m_regionlist.find(name);
if (info != NULL)
fatalerror("region_alloc called with duplicate region name \"%s\"\n", name);
// allocate the region
return &m_regionlist.append(name, *auto_alloc(*this, memory_region(*this, name, length, width, endian)));
}
//-------------------------------------------------
// region_free - releases memory for a region
//-------------------------------------------------
void running_machine::region_free(const char *name)
{
m_regionlist.remove(name);
}
//------------------------------------------------- //-------------------------------------------------
// add_notifier - add a notifier of the // add_notifier - add a notifier of the
// given type // given type
@ -1059,38 +1032,6 @@ void running_machine::postload_all_devices()
/***************************************************************************
MEMORY REGIONS
***************************************************************************/
//-------------------------------------------------
// memory_region - constructor
//-------------------------------------------------
memory_region::memory_region(running_machine &machine, const char *name, UINT32 length, UINT8 width, endianness_t endian)
: m_machine(machine),
m_next(NULL),
m_name(name),
m_length(length),
m_width(width),
m_endianness(endian)
{
assert(width == 1 || width == 2 || width == 4 || width == 8);
m_base.u8 = auto_alloc_array(machine, UINT8, length);
}
//-------------------------------------------------
// ~memory_region - destructor
//-------------------------------------------------
memory_region::~memory_region()
{
auto_free(machine(), m_base.v);
}
//************************************************************************** //**************************************************************************
// CALLBACK ITEMS // CALLBACK ITEMS
//************************************************************************** //**************************************************************************

View File

@ -160,64 +160,6 @@ typedef struct _debugcpu_private debugcpu_private;
typedef struct _generic_machine_private generic_machine_private; typedef struct _generic_machine_private generic_machine_private;
// ======================> memory_region
// memory region object; should eventually be renamed memory_region
class memory_region
{
DISABLE_COPYING(memory_region);
friend class running_machine;
friend class simple_list<memory_region>;
friend resource_pool_object<memory_region>::~resource_pool_object();
// construction/destruction
memory_region(running_machine &machine, const char *name, UINT32 length, UINT8 width, endianness_t endian);
~memory_region();
public:
// getters
running_machine &machine() const { return m_machine; }
memory_region *next() const { return m_next; }
UINT8 *base() const { return (this != NULL) ? m_base.u8 : NULL; }
UINT8 *end() const { return (this != NULL) ? m_base.u8 + m_length : NULL; }
UINT32 bytes() const { return (this != NULL) ? m_length : 0; }
const char *name() const { return m_name; }
// flag expansion
endianness_t endianness() const { return m_endianness; }
UINT8 width() const { return m_width; }
// data access
UINT8 &u8(offs_t offset = 0) const { return m_base.u8[offset]; }
UINT16 &u16(offs_t offset = 0) const { return m_base.u16[offset]; }
UINT32 &u32(offs_t offset = 0) const { return m_base.u32[offset]; }
UINT64 &u64(offs_t offset = 0) const { return m_base.u64[offset]; }
// allow passing a region for any common pointer
operator void *() const { return (this != NULL) ? m_base.v : NULL; }
operator INT8 *() const { return (this != NULL) ? m_base.i8 : NULL; }
operator UINT8 *() const { return (this != NULL) ? m_base.u8 : NULL; }
operator INT16 *() const { return (this != NULL) ? m_base.i16 : NULL; }
operator UINT16 *() const { return (this != NULL) ? m_base.u16 : NULL; }
operator INT32 *() const { return (this != NULL) ? m_base.i32 : NULL; }
operator UINT32 *() const { return (this != NULL) ? m_base.u32 : NULL; }
operator INT64 *() const { return (this != NULL) ? m_base.i64 : NULL; }
operator UINT64 *() const { return (this != NULL) ? m_base.u64 : NULL; }
private:
// internal data
running_machine & m_machine;
memory_region * m_next;
astring m_name;
generic_ptr m_base;
UINT32 m_length;
UINT8 m_width;
endianness_t m_endianness;
};
// ======================> system_time // ======================> system_time
// system time description, both local and UTC // system time description, both local and UTC
@ -279,7 +221,7 @@ public:
resource_pool &respool() { return m_respool; } resource_pool &respool() { return m_respool; }
device_scheduler &scheduler() { return m_scheduler; } device_scheduler &scheduler() { return m_scheduler; }
save_manager &save() { return m_save; } save_manager &save() { return m_save; }
memory_manager &memory() { assert(m_memory != NULL); return *m_memory; } memory_manager &memory() { return m_memory; }
cheat_manager &cheat() const { assert(m_cheat != NULL); return *m_cheat; } cheat_manager &cheat() const { assert(m_cheat != NULL); return *m_cheat; }
render_manager &render() const { assert(m_render != NULL); return *m_render; } render_manager &render() const { assert(m_render != NULL); return *m_render; }
input_manager &input() const { assert(m_input != NULL); return *m_input; } input_manager &input() const { assert(m_input != NULL); return *m_input; }
@ -302,7 +244,6 @@ public:
// additional helpers // additional helpers
emu_options &options() const { return m_config.options(); } emu_options &options() const { return m_config.options(); }
memory_region *first_region() const { return m_regionlist.first(); }
attotime time() const { return m_scheduler.time(); } attotime time() const { return m_scheduler.time(); }
bool scheduled_event_pending() const { return m_exit_pending || m_hard_reset_pending; } bool scheduled_event_pending() const { return m_exit_pending || m_hard_reset_pending; }
@ -310,7 +251,6 @@ public:
inline device_t *device(const char *tag) { return root_device().subdevice(tag); } inline device_t *device(const char *tag) { return root_device().subdevice(tag); }
template<class _DeviceClass> inline _DeviceClass *device(const char *tag) { return downcast<_DeviceClass *>(device(tag)); } template<class _DeviceClass> inline _DeviceClass *device(const char *tag) { return downcast<_DeviceClass *>(device(tag)); }
inline const input_port_config *port(const char *tag); inline const input_port_config *port(const char *tag);
inline const memory_region *region(const char *tag);
// configuration helpers // configuration helpers
device_t &add_dynamic_device(device_t &owner, device_type type, const char *tag, UINT32 clock); device_t &add_dynamic_device(device_t &owner, device_type type, const char *tag, UINT32 clock);
@ -337,10 +277,6 @@ public:
void base_datetime(system_time &systime); void base_datetime(system_time &systime);
void current_datetime(system_time &systime); void current_datetime(system_time &systime);
// regions
memory_region *region_alloc(const char *name, UINT32 length, UINT8 width, endianness_t endian);
void region_free(const char *name);
// watchdog control // watchdog control
void watchdog_reset(); void watchdog_reset();
void watchdog_enable(bool enable = true); void watchdog_enable(bool enable = true);
@ -404,13 +340,7 @@ private:
const game_driver & m_system; // reference to the definition of the game machine const game_driver & m_system; // reference to the definition of the game machine
osd_interface & m_osd; // reference to OSD system osd_interface & m_osd; // reference to OSD system
// embedded managers and objects
tagged_list<memory_region> m_regionlist; // list of memory regions
save_manager m_save; // save manager
device_scheduler m_scheduler; // scheduler object
// managers // managers
memory_manager * m_memory; // internal data from memory.c
cheat_manager * m_cheat; // internal data from cheat.c cheat_manager * m_cheat; // internal data from cheat.c
render_manager * m_render; // internal data from render.c render_manager * m_render; // internal data from render.c
input_manager * m_input; // internal data from input.c input_manager * m_input; // internal data from input.c
@ -484,6 +414,11 @@ private:
logerror_callback m_func; logerror_callback m_func;
}; };
simple_list<logerror_callback_item> m_logerror_list; simple_list<logerror_callback_item> m_logerror_list;
// embedded managers and objects
save_manager m_save; // save manager
memory_manager m_memory; // memory manager
device_scheduler m_scheduler; // scheduler object
}; };
@ -503,16 +438,5 @@ inline const input_port_config *running_machine::port(const char *tag)
return m_portlist.find(root_device().subtag(fulltag, tag).cstr()); return m_portlist.find(root_device().subtag(fulltag, tag).cstr());
} }
inline const memory_region *running_machine::region(const char *tag)
{
// if tag begins with a :, it's absolute
if (tag[0] == ':')
return m_regionlist.find(tag);
// otherwise, compute it relative to the root device
astring fulltag;
return m_regionlist.find(root_device().subtag(fulltag, tag).cstr());
}
#endif /* __MACHINE_H__ */ #endif /* __MACHINE_H__ */

View File

@ -294,7 +294,7 @@ void laserdisc_device::static_set_overlay(device_t &device, UINT32 width, UINT32
//------------------------------------------------- //-------------------------------------------------
// static_set_overlay - set the overlay visible // static_set_overlay - set the overlay visible
// subregion // memregion
//------------------------------------------------- //-------------------------------------------------
void laserdisc_device::static_set_overlay_clip(device_t &device, INT32 minx, INT32 maxx, INT32 miny, INT32 maxy) void laserdisc_device::static_set_overlay_clip(device_t &device, INT32 minx, INT32 maxx, INT32 miny, INT32 maxy)

View File

@ -371,9 +371,9 @@ void mccs1850_device::nvram_default()
{ {
memset(m_ram, 0xff, RAM_SIZE); memset(m_ram, 0xff, RAM_SIZE);
if (machine().region(tag()) != NULL) if (machine().root_device().memregion(tag()) != NULL)
{ {
UINT8 *nvram = machine().region(tag())->base(); UINT8 *nvram = machine().root_device().memregion(tag())->base();
// initialize NVRAM // initialize NVRAM
memcpy(m_ram, nvram, 0x20); memcpy(m_ram, nvram, 0x20);

View File

@ -31,7 +31,7 @@ const device_type PLS100 = &device_creator<pls100_device>;
inline void pls100_device::parse_fusemap() inline void pls100_device::parse_fusemap()
{ {
jed_data jed; jed_data jed;
jedbin_parse(machine().region(tag())->base(), machine().region(tag())->bytes(), &jed); jedbin_parse(machine().root_device().memregion(tag())->base(), machine().root_device().memregion(tag())->bytes(), &jed);
UINT32 fusenum = 0; UINT32 fusenum = 0;
m_xor = 0; m_xor = 0;
@ -113,7 +113,7 @@ pls100_device::pls100_device(const machine_config &mconfig, const char *tag, dev
void pls100_device::device_start() void pls100_device::device_start()
{ {
// parse fusemap // parse fusemap
assert(machine().region(tag()) != NULL); assert(machine().root_device().memregion(tag()) != NULL);
parse_fusemap(); parse_fusemap();
// register for state saving // register for state saving

View File

@ -1499,11 +1499,11 @@ static void generate_memdump(running_machine &machine);
//************************************************************************** //**************************************************************************
// CORE SYSTEM OPERATIONS // MEMORY MANAGER
//************************************************************************** //**************************************************************************
//------------------------------------------------- //-------------------------------------------------
// memory_init - initialize the memory system // memory_manager - constructor
//------------------------------------------------- //-------------------------------------------------
memory_manager::memory_manager(running_machine &machine) memory_manager::memory_manager(running_machine &machine)
@ -1513,9 +1513,17 @@ memory_manager::memory_manager(running_machine &machine)
{ {
memset(m_bank_ptr, 0, sizeof(m_bank_ptr)); memset(m_bank_ptr, 0, sizeof(m_bank_ptr));
memset(m_bankd_ptr, 0, sizeof(m_bankd_ptr)); memset(m_bankd_ptr, 0, sizeof(m_bankd_ptr));
}
//-------------------------------------------------
// initialize - initialize the memory system
//-------------------------------------------------
void memory_manager::initialize()
{
// loop over devices and spaces within each device // loop over devices and spaces within each device
memory_interface_iterator iter(machine.root_device()); memory_interface_iterator iter(machine().root_device());
for (device_memory_interface *memory = iter.first(); memory != NULL; memory = iter.next()) for (device_memory_interface *memory = iter.first(); memory != NULL; memory = iter.next())
for (address_spacenum spacenum = AS_0; spacenum < ADDRESS_SPACES; spacenum++) for (address_spacenum spacenum = AS_0; spacenum < ADDRESS_SPACES; spacenum++)
{ {
@ -1542,21 +1550,16 @@ memory_manager::memory_manager(running_machine &machine)
space->locate_memory(); space->locate_memory();
// register a callback to reset banks when reloading state // register a callback to reset banks when reloading state
machine.save().register_postload(save_prepost_delegate(FUNC(memory_manager::bank_reattach), this)); machine().save().register_postload(save_prepost_delegate(FUNC(memory_manager::bank_reattach), this));
// dump the final memory configuration // dump the final memory configuration
generate_memdump(machine); generate_memdump(machine());
// we are now initialized // we are now initialized
m_initialized = true; m_initialized = true;
} }
//**************************************************************************
// MEMORY BANKING
//**************************************************************************
//------------------------------------------------- //-------------------------------------------------
// shared - get a pointer to a shared memory // shared - get a pointer to a shared memory
// region by tag // region by tag
@ -1603,6 +1606,33 @@ void memory_manager::dump(FILE *file)
} }
//-------------------------------------------------
// region_alloc - allocates memory for a region
//-------------------------------------------------
memory_region *memory_manager::region_alloc(const char *name, UINT32 length, UINT8 width, endianness_t endian)
{
mame_printf_verbose("Region '%s' created\n", name);
// make sure we don't have a region of the same name; also find the end of the list
memory_region *info = m_regionlist.find(name);
if (info != NULL)
fatalerror("region_alloc called with duplicate region name \"%s\"\n", name);
// allocate the region
return &m_regionlist.append(name, *global_alloc(memory_region(machine(), name, length, width, endian)));
}
//-------------------------------------------------
// region_free - releases memory for a region
//-------------------------------------------------
void memory_manager::region_free(const char *name)
{
m_regionlist.remove(name);
}
//------------------------------------------------- //-------------------------------------------------
// generate_memdump - internal memory dump // generate_memdump - internal memory dump
//------------------------------------------------- //-------------------------------------------------
@ -1789,7 +1819,7 @@ inline void address_space::adjust_addresses(offs_t &start, offs_t &end, offs_t &
void address_space::prepare_map() void address_space::prepare_map()
{ {
const memory_region *devregion = (m_spacenum == AS_0) ? machine().region(m_device.tag()) : NULL; memory_region *devregion = (m_spacenum == AS_0) ? machine().root_device().memregion(m_device.tag()) : NULL;
UINT32 devregionsize = (devregion != NULL) ? devregion->bytes() : 0; UINT32 devregionsize = (devregion != NULL) ? devregion->bytes() : 0;
// allocate the address map // allocate the address map
@ -1848,7 +1878,7 @@ void address_space::prepare_map()
device().siblingtag(fulltag, entry->m_region); device().siblingtag(fulltag, entry->m_region);
// find the region // find the region
const memory_region *region = machine().region(fulltag); memory_region *region = machine().root_device().memregion(fulltag);
if (region == NULL) if (region == NULL)
fatalerror("Error: device '%s' %s space memory map entry %X-%X references non-existant region \"%s\"", m_device.tag(), m_name, entry->m_addrstart, entry->m_addrend, entry->m_region); fatalerror("Error: device '%s' %s space memory map entry %X-%X references non-existant region \"%s\"", m_device.tag(), m_name, entry->m_addrstart, entry->m_addrend, entry->m_region);
@ -1865,7 +1895,7 @@ void address_space::prepare_map()
device().siblingtag(fulltag, entry->m_region); device().siblingtag(fulltag, entry->m_region);
// set the memory address // set the memory address
entry->m_memory = machine().region(fulltag.cstr())->base() + entry->m_rgnoffs; entry->m_memory = machine().root_device().memregion(fulltag.cstr())->base() + entry->m_rgnoffs;
} }
} }
@ -2865,7 +2895,7 @@ bool address_space::needs_backing_store(const address_map_entry *entry)
return true; return true;
// if we're reading from RAM or from ROM outside of address space 0 or its region, then yes, we do need backing // if we're reading from RAM or from ROM outside of address space 0 or its region, then yes, we do need backing
const memory_region *region = machine().region(m_device.tag()); memory_region *region = machine().root_device().memregion(m_device.tag());
if (entry->m_read.m_type == AMH_RAM || if (entry->m_read.m_type == AMH_RAM ||
(entry->m_read.m_type == AMH_ROM && (m_spacenum != AS_0 || region == NULL || entry->m_addrstart >= region->bytes()))) (entry->m_read.m_type == AMH_ROM && (m_spacenum != AS_0 || region == NULL || entry->m_addrstart >= region->bytes())))
return true; return true;
@ -4143,8 +4173,8 @@ memory_block::memory_block(address_space &space, offs_t bytestart, offs_t byteen
} }
// register for saving, but only if we're not part of a memory region // register for saving, but only if we're not part of a memory region
const memory_region *region; memory_region *region;
for (region = space.machine().first_region(); region != NULL; region = region->next()) for (region = space.machine().memory().first_region(); region != NULL; region = region->next())
if (m_data >= region->base() && (m_data + (byteend - bytestart + 1)) < region->end()) if (m_data >= region->base() && (m_data + (byteend - bytestart + 1)) < region->end())
{ {
VPRINTF(("skipping save of this memory block as it is covered by a memory region\n")); VPRINTF(("skipping save of this memory block as it is covered by a memory region\n"));
@ -4415,6 +4445,27 @@ void memory_bank::configure_decrypted_entries(int startentry, int numentries, vo
} }
//**************************************************************************
// MEMORY REGIONS
//**************************************************************************
//-------------------------------------------------
// memory_region - constructor
//-------------------------------------------------
memory_region::memory_region(running_machine &machine, const char *name, UINT32 length, UINT8 width, endianness_t endian)
: m_machine(machine),
m_next(NULL),
m_name(name),
m_buffer(length),
m_width(width),
m_endianness(endian)
{
assert(width == 1 || width == 2 || width == 4 || width == 8);
}
//************************************************************************** //**************************************************************************
// HANDLER ENTRY // HANDLER ENTRY
//************************************************************************** //**************************************************************************

View File

@ -740,6 +740,62 @@ private:
}; };
// ======================> memory_region
// memory region object
class memory_region
{
DISABLE_COPYING(memory_region);
friend class memory_manager;
friend class simple_list<memory_region>;
friend resource_pool_object<memory_region>::~resource_pool_object();
// construction/destruction
memory_region(running_machine &machine, const char *name, UINT32 length, UINT8 width, endianness_t endian);
public:
// getters
running_machine &machine() const { return m_machine; }
memory_region *next() const { return m_next; }
UINT8 *base() { return (this != NULL) ? &m_buffer[0] : NULL; }
UINT8 *end() { return (this != NULL) ? base() + m_buffer.count() : NULL; }
UINT32 bytes() const { return (this != NULL) ? m_buffer.count() : 0; }
const char *name() const { return m_name; }
// flag expansion
endianness_t endianness() const { return m_endianness; }
UINT8 width() const { return m_width; }
// data access
UINT8 &u8(offs_t offset = 0) { return m_buffer[offset]; }
UINT16 &u16(offs_t offset = 0) { return reinterpret_cast<UINT16 *>(base())[offset]; }
UINT32 &u32(offs_t offset = 0) { return reinterpret_cast<UINT32 *>(base())[offset]; }
UINT64 &u64(offs_t offset = 0) { return reinterpret_cast<UINT64 *>(base())[offset]; }
// allow passing a region for any common pointer
operator void *() { return (this != NULL) ? reinterpret_cast<void *>(base()) : NULL; }
operator INT8 *() { return (this != NULL) ? reinterpret_cast<INT8 *>(base()) : NULL; }
operator UINT8 *() { return (this != NULL) ? reinterpret_cast<UINT8 *>(base()) : NULL; }
operator INT16 *() { return (this != NULL) ? reinterpret_cast<INT16 *>(base()) : NULL; }
operator UINT16 *() { return (this != NULL) ? reinterpret_cast<UINT16 *>(base()) : NULL; }
operator INT32 *() { return (this != NULL) ? reinterpret_cast<INT32 *>(base()) : NULL; }
operator UINT32 *() { return (this != NULL) ? reinterpret_cast<UINT32 *>(base()) : NULL; }
operator INT64 *() { return (this != NULL) ? reinterpret_cast<INT64 *>(base()) : NULL; }
operator UINT64 *() { return (this != NULL) ? reinterpret_cast<UINT64 *>(base()) : NULL; }
private:
// internal data
running_machine & m_machine;
memory_region * m_next;
astring m_name;
dynamic_buffer m_buffer;
UINT8 m_width;
endianness_t m_endianness;
};
// ======================> memory_manager // ======================> memory_manager
// holds internal state for the memory system // holds internal state for the memory system
@ -748,14 +804,17 @@ class memory_manager
friend class address_space; friend class address_space;
friend class address_table; friend class address_table;
friend class device_t; friend class device_t;
friend class memory_block;
public: public:
// construction/destruction // construction/destruction
memory_manager(running_machine &machine); memory_manager(running_machine &machine);
void initialize();
// getters // getters
running_machine &machine() const { return m_machine; } running_machine &machine() const { return m_machine; }
address_space *first_space() const { return m_spacelist.first(); } address_space *first_space() const { return m_spacelist.first(); }
memory_region *first_region() const { return m_regionlist.first(); }
// get a pointer to a shared memory region by tag // get a pointer to a shared memory region by tag
memory_share *shared(const char *tag); memory_share *shared(const char *tag);
@ -767,10 +826,15 @@ public:
// pointers to a bank pointer (internal usage only) // pointers to a bank pointer (internal usage only)
UINT8 **bank_pointer_addr(UINT8 index, bool decrypted = false) { return decrypted ? &m_bankd_ptr[index] : &m_bank_ptr[index]; } UINT8 **bank_pointer_addr(UINT8 index, bool decrypted = false) { return decrypted ? &m_bankd_ptr[index] : &m_bank_ptr[index]; }
// regions
memory_region *region_alloc(const char *name, UINT32 length, UINT8 width, endianness_t endian);
void region_free(const char *name);
private: private:
// internal helpers // internal helpers
memory_bank *first_bank() const { return m_banklist.first(); } memory_bank *first_bank() const { return m_banklist.first(); }
memory_bank *bank(const char *tag) const { return m_bankmap.find_hash_only(tag); } memory_bank *bank(const char *tag) const { return m_bankmap.find(tag); }
memory_region *region(const char *tag) { return m_regionlist.find(tag); }
void bank_reattach(); void bank_reattach();
// internal state // internal state
@ -788,6 +852,8 @@ private:
UINT8 m_banknext; // next bank to allocate UINT8 m_banknext; // next bank to allocate
tagged_list<memory_share> m_sharelist; // map for share lookups tagged_list<memory_share> m_sharelist; // map for share lookups
tagged_list<memory_region> m_regionlist; // list of memory regions
}; };

View File

@ -518,7 +518,7 @@ static void display_rom_load_results(rom_load_data *romdata)
static void region_post_process(rom_load_data *romdata, const char *rgntag, bool invert) static void region_post_process(rom_load_data *romdata, const char *rgntag, bool invert)
{ {
const memory_region *region = romdata->machine().region(rgntag); memory_region *region = romdata->machine().root_device().memregion(rgntag);
UINT8 *base; UINT8 *base;
int i, j; int i, j;
@ -832,7 +832,7 @@ static void copy_rom_data(rom_load_data *romdata, const rom_entry *romp)
fatalerror("Error in RomModule definition: COPY has an invalid length\n"); fatalerror("Error in RomModule definition: COPY has an invalid length\n");
/* make sure the source was valid */ /* make sure the source was valid */
const memory_region *region = romdata->machine().region(srcrgntag); memory_region *region = romdata->machine().root_device().memregion(srcrgntag);
if (region == NULL) if (region == NULL)
fatalerror("Error in RomModule definition: COPY from an invalid region\n"); fatalerror("Error in RomModule definition: COPY from an invalid region\n");
@ -1328,18 +1328,18 @@ void load_software_part_region(device_t *device, char *swlist, char *swname, rom
/* if this is a device region, override with the device width and endianness */ /* if this is a device region, override with the device width and endianness */
endianness_t endianness = ROMREGION_ISBIGENDIAN(region) ? ENDIANNESS_BIG : ENDIANNESS_LITTLE; endianness_t endianness = ROMREGION_ISBIGENDIAN(region) ? ENDIANNESS_BIG : ENDIANNESS_LITTLE;
UINT8 width = ROMREGION_GETWIDTH(region) / 8; UINT8 width = ROMREGION_GETWIDTH(region) / 8;
const memory_region *memregion = romdata->machine().region(regiontag); memory_region *memregion = romdata->machine().root_device().memregion(regiontag);
if (memregion != NULL) if (memregion != NULL)
{ {
if (romdata->machine().device(regiontag) != NULL) if (romdata->machine().device(regiontag) != NULL)
normalize_flags_for_device(romdata->machine(), regiontag, width, endianness); normalize_flags_for_device(romdata->machine(), regiontag, width, endianness);
/* clear old region (todo: should be moved to an image unload function) */ /* clear old region (todo: should be moved to an image unload function) */
romdata->machine().region_free(memregion->name()); romdata->machine().memory().region_free(memregion->name());
} }
/* remember the base and length */ /* remember the base and length */
romdata->region = romdata->machine().region_alloc(regiontag, regionlength, width, endianness); romdata->region = romdata->machine().memory().region_alloc(regiontag, regionlength, width, endianness);
LOG(("Allocated %X bytes @ %p\n", romdata->region->bytes(), romdata->region->base())); LOG(("Allocated %X bytes @ %p\n", romdata->region->bytes(), romdata->region->base()));
/* clear the region if it's requested */ /* clear the region if it's requested */
@ -1404,7 +1404,7 @@ static void process_region_list(rom_load_data *romdata)
normalize_flags_for_device(romdata->machine(), regiontag, width, endianness); normalize_flags_for_device(romdata->machine(), regiontag, width, endianness);
/* remember the base and length */ /* remember the base and length */
romdata->region = romdata->machine().region_alloc(regiontag, regionlength, width, endianness); romdata->region = romdata->machine().memory().region_alloc(regiontag, regionlength, width, endianness);
LOG(("Allocated %X bytes @ %p\n", romdata->region->bytes(), romdata->region->base())); LOG(("Allocated %X bytes @ %p\n", romdata->region->bytes(), romdata->region->base()));
/* clear the region if it's requested */ /* clear the region if it's requested */

View File

@ -951,7 +951,7 @@ void screen_device::finalize_burnin()
scaledvis.min_y = m_visarea.min_y * m_burnin.height() / m_height; scaledvis.min_y = m_visarea.min_y * m_burnin.height() / m_height;
scaledvis.max_y = m_visarea.max_y * m_burnin.height() / m_height; scaledvis.max_y = m_visarea.max_y * m_burnin.height() / m_height;
// wrap a bitmap around the subregion we care about // wrap a bitmap around the memregion we care about
bitmap_argb32 finalmap(scaledvis.width(), scaledvis.height()); bitmap_argb32 finalmap(scaledvis.width(), scaledvis.height());
int srcwidth = m_burnin.width(); int srcwidth = m_burnin.width();
int srcheight = m_burnin.height(); int srcheight = m_burnin.height();

View File

@ -164,8 +164,8 @@ static DEVICE_START( ym2610 )
pcmbufa = *device->region(); pcmbufa = *device->region();
pcmsizea = device->region()->bytes(); pcmsizea = device->region()->bytes();
name.printf("%s.deltat", device->tag()); name.printf("%s.deltat", device->tag());
pcmbufb = (void *)(device->machine().region(name)->base()); pcmbufb = (void *)(device->machine().root_device().memregion(name)->base());
pcmsizeb = device->machine().region(name)->bytes(); pcmsizeb = device->machine().root_device().memregion(name)->bytes();
if (pcmbufb == NULL || pcmsizeb == 0) if (pcmbufb == NULL || pcmsizeb == 0)
{ {
pcmbufb = pcmbufa; pcmbufb = pcmbufa;

View File

@ -648,7 +648,7 @@ static DEVICE_START(digitalker)
{ {
digitalker *dg = get_safe_token(device); digitalker *dg = get_safe_token(device);
dg->device = device; dg->device = device;
dg->rom = device->machine().region(device->tag())->base(); dg->rom = device->machine().root_device().memregion(device->tag())->base();
dg->stream = device->machine().sound().stream_alloc(*device, 0, 1, device->clock()/4, dg, digitalker_update); dg->stream = device->machine().sound().stream_alloc(*device, 0, 1, device->clock()/4, dg, digitalker_update);
dg->dac_index = 128; dg->dac_index = 128;
dg->data = 0xff; dg->data = 0xff;

View File

@ -913,10 +913,10 @@ static void es5506_start_common(device_t *device, const void *config, device_typ
chip->stream = device->machine().sound().stream_alloc(*device, 0, 2, device->clock() / (16*32), chip, es5506_update); chip->stream = device->machine().sound().stream_alloc(*device, 0, 2, device->clock() / (16*32), chip, es5506_update);
/* initialize the regions */ /* initialize the regions */
chip->region_base[0] = intf->region0 ? (UINT16 *)device->machine().region(intf->region0)->base() : NULL; chip->region_base[0] = intf->region0 ? (UINT16 *)device->machine().root_device().memregion(intf->region0)->base() : NULL;
chip->region_base[1] = intf->region1 ? (UINT16 *)device->machine().region(intf->region1)->base() : NULL; chip->region_base[1] = intf->region1 ? (UINT16 *)device->machine().root_device().memregion(intf->region1)->base() : NULL;
chip->region_base[2] = intf->region2 ? (UINT16 *)device->machine().region(intf->region2)->base() : NULL; chip->region_base[2] = intf->region2 ? (UINT16 *)device->machine().root_device().memregion(intf->region2)->base() : NULL;
chip->region_base[3] = intf->region3 ? (UINT16 *)device->machine().region(intf->region3)->base() : NULL; chip->region_base[3] = intf->region3 ? (UINT16 *)device->machine().root_device().memregion(intf->region3)->base() : NULL;
/* initialize the rest of the structure */ /* initialize the rest of the structure */
chip->device = device; chip->device = device;

View File

@ -4230,17 +4230,17 @@ void ym2610_reset_chip(void *chip)
/* setup PCM buffers again */ /* setup PCM buffers again */
name.printf("%s",dev->tag()); name.printf("%s",dev->tag());
F2610->pcmbuf = (const UINT8 *)dev->machine().region(name)->base(); F2610->pcmbuf = (const UINT8 *)dev->machine().root_device().memregion(name)->base();
F2610->pcm_size = dev->machine().region(name)->bytes(); F2610->pcm_size = dev->machine().root_device().memregion(name)->bytes();
name.printf("%s.deltat",dev->tag()); name.printf("%s.deltat",dev->tag());
F2610->deltaT.memory = (UINT8 *)dev->machine().region(name)->base(); F2610->deltaT.memory = (UINT8 *)dev->machine().root_device().memregion(name)->base();
if(F2610->deltaT.memory == NULL) if(F2610->deltaT.memory == NULL)
{ {
F2610->deltaT.memory = (UINT8*)F2610->pcmbuf; F2610->deltaT.memory = (UINT8*)F2610->pcmbuf;
F2610->deltaT.memory_size = F2610->pcm_size; F2610->deltaT.memory_size = F2610->pcm_size;
} }
else else
F2610->deltaT.memory_size = dev->machine().region(name)->bytes(); F2610->deltaT.memory_size = dev->machine().root_device().memregion(name)->bytes();
/* Reset Prescaler */ /* Reset Prescaler */
OPNSetPres( OPN, 6*24, 6*24, 4*2); /* OPN 1/6 , SSG 1/4 */ OPNSetPres( OPN, 6*24, 6*24, 4*2); /* OPN 1/6 , SSG 1/4 */

View File

@ -260,7 +260,7 @@ static DEVICE_START( gaelco )
info->banks[j] = intf->banks[j]; info->banks[j] = intf->banks[j];
} }
info->stream = device->machine().sound().stream_alloc(*device, 0, 2, 8000, info, gaelco_update); info->stream = device->machine().sound().stream_alloc(*device, 0, 2, 8000, info, gaelco_update);
info->snd_data = (UINT8 *)device->machine().region(intf->gfxregion)->base(); info->snd_data = (UINT8 *)device->machine().root_device().memregion(intf->gfxregion)->base();
if (info->snd_data == NULL) if (info->snd_data == NULL)
info->snd_data = *device->region(); info->snd_data = *device->region();

View File

@ -43,8 +43,8 @@ void i5000snd_device::device_start()
// create the stream // create the stream
m_stream = machine().sound().stream_alloc(*this, 0, 2, clock() / 0x400, this); m_stream = machine().sound().stream_alloc(*this, 0, 2, clock() / 0x400, this);
m_rom_base = (UINT16 *)device().machine().region(":i5000snd")->base(); m_rom_base = (UINT16 *)device().machine().root_device().memregion(":i5000snd")->base();
m_rom_mask = device().machine().region(":i5000snd")->bytes() / 2 - 1; m_rom_mask = device().machine().root_device().memregion(":i5000snd")->bytes() / 2 - 1;
} }

View File

@ -221,7 +221,7 @@ static DEVICE_START( k053260 )
ic->mode = 0; ic->mode = 0;
const memory_region *region = (ic->intf->rgnoverride != NULL) ? device->machine().region(ic->intf->rgnoverride) : device->region(); memory_region *region = (ic->intf->rgnoverride != NULL) ? device->machine().root_device().memregion(ic->intf->rgnoverride) : device->region();
ic->rom = *region; ic->rom = *region;
ic->rom_size = region->bytes(); ic->rom_size = region->bytes();

View File

@ -317,7 +317,7 @@ void k054539_device::init_chip()
cur_ptr = 0; cur_ptr = 0;
memset(ram, 0, 0x4000); memset(ram, 0, 0x4000);
const memory_region *reg = (rgnoverride != NULL) ? machine().region(rgnoverride) : region(); memory_region *reg = (rgnoverride != NULL) ? machine().root_device().memregion(rgnoverride) : region();
rom = *reg; rom = *reg;
rom_size = reg->bytes(); rom_size = reg->bytes();
rom_mask = 0xffffffffU; rom_mask = 0xffffffffU;

View File

@ -1415,7 +1415,7 @@ static DEVICE_START( tmsprom )
tms->rom = *device->region(); tms->rom = *device->region();
assert_always(tms->rom != NULL, "Error creating TMSPROM chip: No rom region found"); assert_always(tms->rom != NULL, "Error creating TMSPROM chip: No rom region found");
tms->prom = device->machine().region(tms->intf->prom_region)->base(); tms->prom = device->machine().root_device().memregion(tms->intf->prom_region)->base();
assert_always(tms->rom != NULL, "Error creating TMSPROM chip: No prom region found"); assert_always(tms->rom != NULL, "Error creating TMSPROM chip: No prom region found");
tms->device = device; tms->device = device;

View File

@ -1167,7 +1167,7 @@ void votrax_sc01_device::device_start()
m_master_clock_freq = clock(); m_master_clock_freq = clock();
m_stream = stream_alloc(0, 1, m_master_clock_freq / 16); m_stream = stream_alloc(0, 1, m_master_clock_freq / 16);
m_phoneme_timer = timer_alloc(); m_phoneme_timer = timer_alloc();
m_rom = subregion("phoneme")->base(); m_rom = memregion("phoneme")->base();
// reset inputs // reset inputs
m_inflection = 0; m_inflection = 0;

View File

@ -733,7 +733,7 @@ void ymz770_device::device_start()
channels[i].decoder = new amm; channels[i].decoder = new amm;
} }
rom_base = device().machine().region(":ymz770")->base(); rom_base = device().machine().root_device().memregion(":ymz770")->base();
save_item(NAME(cur_reg)); save_item(NAME(cur_reg));
for (int i = 0; i < 8; i++) for (int i = 0; i < 8; i++)

View File

@ -228,7 +228,7 @@ static DEVICE_START( zsg2 )
info->stream = device->machine().sound().stream_alloc(*device, 0, 2, info->sample_rate, info, update_stereo); info->stream = device->machine().sound().stream_alloc(*device, 0, 2, info->sample_rate, info, update_stereo);
info->bank_samples = device->machine().region(intf->samplergn)->base(); info->bank_samples = device->machine().root_device().memregion(intf->samplergn)->base();
} }
/************************************************************************** /**************************************************************************

View File

@ -1616,7 +1616,7 @@ void sega315_5124_device::device_start()
/* Allocate video RAM */ /* Allocate video RAM */
astring tempstring; astring tempstring;
m_CRAM = machine().region_alloc(subtag(tempstring,"vdp_cram"), SEGA315_5378_CRAM_SIZE, 1, ENDIANNESS_LITTLE); m_CRAM = machine().memory().region_alloc(subtag(tempstring,"vdp_cram"), SEGA315_5378_CRAM_SIZE, 1, ENDIANNESS_LITTLE);
m_line_buffer = auto_alloc_array(machine(), int, 256 * 5); m_line_buffer = auto_alloc_array(machine(), int, 256 * 5);
m_frame_timing = (m_is_pal) ? pal_192 : ntsc_192; m_frame_timing = (m_is_pal) ? pal_192 : ntsc_192;

View File

@ -160,7 +160,7 @@ PALETTE_INIT( monochrome_green )
PALETTE_INIT( RRRR_GGGG_BBBB ) PALETTE_INIT( RRRR_GGGG_BBBB )
{ {
const UINT8 *color_prom = machine.region("proms")->base(); const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
int i; int i;
for (i = 0; i < machine.total_colors(); i++) for (i = 0; i < machine.total_colors(); i++)

View File

@ -478,7 +478,7 @@ void hd61830_device::draw_char(bitmap_ind16 &bitmap, const rectangle &cliprect,
addr = 160*7 + (md - 0xe0) * 11 + cl; addr = 160*7 + (md - 0xe0) * 11 + cl;
} }
data = subregion("hd61830")->u8(addr); data = memregion("hd61830")->u8(addr);
} }
int cursor = m_mcr & MODE_CURSOR; int cursor = m_mcr & MODE_CURSOR;

View File

@ -292,7 +292,7 @@ static int internal_pc_cga_video_start(running_machine &machine)
memset(&cga, 0, sizeof(cga)); memset(&cga, 0, sizeof(cga));
cga.update_row = NULL; cga.update_row = NULL;
cga.chr_gen = machine.region( "gfx1" )->base() + 0x1000; cga.chr_gen = machine.root_device().memregion( "gfx1" )->base() + 0x1000;
state_save_register_item(machine, "pccga", NULL, 0, cga.mode_control); state_save_register_item(machine, "pccga", NULL, 0, cga.mode_control);
state_save_register_item(machine, "pccga", NULL, 0, cga.color_select); state_save_register_item(machine, "pccga", NULL, 0, cga.color_select);
@ -386,7 +386,7 @@ static VIDEO_START( pc_cga32k )
SCREEN_UPDATE_RGB32( mc6845_cga ) SCREEN_UPDATE_RGB32( mc6845_cga )
{ {
UINT8 *gfx = screen.machine().region("gfx1")->base(); UINT8 *gfx = screen.machine().root_device().memregion("gfx1")->base();
mc6845_device *mc6845 = screen.machine().device<mc6845_device>(CGA_MC6845_NAME); mc6845_device *mc6845 = screen.machine().device<mc6845_device>(CGA_MC6845_NAME);
mc6845->screen_update( screen, bitmap, cliprect); mc6845->screen_update( screen, bitmap, cliprect);
@ -407,12 +407,12 @@ SCREEN_UPDATE_RGB32( mc6845_cga )
static VIDEO_START( cga_poisk2 ) static VIDEO_START( cga_poisk2 )
{ {
VIDEO_START_CALL(pc_cga); VIDEO_START_CALL(pc_cga);
cga.chr_gen = machine.region( "gfx1" )->base() + 0x0000; cga.chr_gen = machine.root_device().memregion( "gfx1" )->base() + 0x0000;
} }
static SCREEN_UPDATE_RGB32( cga_poisk2 ) static SCREEN_UPDATE_RGB32( cga_poisk2 )
{ {
UINT8 *gfx = screen.machine().region("gfx1")->base(); UINT8 *gfx = screen.machine().root_device().memregion("gfx1")->base();
mc6845_device *mc6845 = screen.machine().device<mc6845_device>(CGA_MC6845_NAME); mc6845_device *mc6845 = screen.machine().device<mc6845_device>(CGA_MC6845_NAME);
mc6845->screen_update( screen, bitmap, cliprect); mc6845->screen_update( screen, bitmap, cliprect);
@ -1103,7 +1103,7 @@ static void pc_cga_plantronics_w(running_machine &machine, int data)
static WRITE8_HANDLER ( char_ram_w ) static WRITE8_HANDLER ( char_ram_w )
{ {
UINT8 *gfx = space->machine().region("gfx1")->base(); UINT8 *gfx = space->machine().root_device().memregion("gfx1")->base();
logerror("write char ram %04x %02x\n",offset,data); logerror("write char ram %04x %02x\n",offset,data);
gfx[offset + 0x0000] = data; gfx[offset + 0x0000] = data;
gfx[offset + 0x0800] = data; gfx[offset + 0x0800] = data;
@ -1116,7 +1116,7 @@ static WRITE32_HANDLER( char_ram_32_w ) { write32le_with_write8_handler(char_r
static READ8_HANDLER ( char_ram_r ) static READ8_HANDLER ( char_ram_r )
{ {
UINT8 *gfx = space->machine().region("gfx1")->base(); UINT8 *gfx = space->machine().root_device().memregion("gfx1")->base();
return gfx[offset]; return gfx[offset];
} }
@ -1629,7 +1629,7 @@ static VIDEO_START( pc1512 )
static SCREEN_UPDATE_RGB32( mc6845_pc1512 ) static SCREEN_UPDATE_RGB32( mc6845_pc1512 )
{ {
UINT8 *gfx = screen.machine().region("gfx1")->base(); UINT8 *gfx = screen.machine().root_device().memregion("gfx1")->base();
mc6845_device *mc6845 = screen.machine().device<mc6845_device>(CGA_MC6845_NAME); mc6845_device *mc6845 = screen.machine().device<mc6845_device>(CGA_MC6845_NAME);
mc6845->screen_update(screen, bitmap, cliprect); mc6845->screen_update(screen, bitmap, cliprect);

View File

@ -274,7 +274,7 @@ static DEVICE_START( tms9927 )
/* get the self-load PROM */ /* get the self-load PROM */
if (tms->intf->selfload_region != NULL) if (tms->intf->selfload_region != NULL)
{ {
tms->selfload = device->machine().region(tms->intf->selfload_region)->base(); tms->selfload = device->machine().root_device().memregion(tms->intf->selfload_region)->base();
assert(tms->selfload != NULL); assert(tms->selfload != NULL);
} }
} }

View File

@ -133,7 +133,7 @@ void atarijsa_init(running_machine &machine, const char *testport, int testmask)
test_mask = testmask; test_mask = testmask;
/* predetermine the bank base */ /* predetermine the bank base */
rgn = machine.region("jsa")->base(); rgn = machine.root_device().memregion("jsa")->base();
bank_base = &rgn[0x03000]; bank_base = &rgn[0x03000];
bank_source_data = &rgn[0x10000]; bank_source_data = &rgn[0x10000];
@ -161,8 +161,8 @@ void atarijsa_init(running_machine &machine, const char *testport, int testmask)
/* the upper 128k is fixed, the lower 128k is bankswitched */ /* the upper 128k is fixed, the lower 128k is bankswitched */
for (rgn = 0; rgn < ARRAY_LENGTH(regions); rgn++) for (rgn = 0; rgn < ARRAY_LENGTH(regions); rgn++)
{ {
UINT8 *base = machine.region(regions[rgn])->base(); UINT8 *base = machine.root_device().memregion(regions[rgn])->base();
if (base != NULL && machine.region(regions[rgn])->bytes() >= 0x80000) if (base != NULL && machine.root_device().memregion(regions[rgn])->bytes() >= 0x80000)
{ {
const char *bank = (rgn != 2) ? "bank12" : "bank14"; const char *bank = (rgn != 2) ? "bank12" : "bank14";
const char *bank_plus_1 = (rgn != 2) ? "bank13" : "bank15"; const char *bank_plus_1 = (rgn != 2) ? "bank13" : "bank15";

View File

@ -165,8 +165,8 @@ void cage_init(running_machine &machine, offs_t speedup)
state->irqhandler = NULL; state->irqhandler = NULL;
machine.root_device().membank("bank10")->set_base(machine.region("cageboot")->base()); machine.root_device().membank("bank10")->set_base(machine.root_device().memregion("cageboot")->base());
machine.root_device().membank("bank11")->set_base(machine.region("cage")->base()); machine.root_device().membank("bank11")->set_base(machine.root_device().memregion("cage")->base());
state->cpu = machine.device<cpu_device>("cage"); state->cpu = machine.device<cpu_device>("cage");
cage_cpu_clock_period = attotime::from_hz(state->cpu->clock()); cage_cpu_clock_period = attotime::from_hz(state->cpu->clock());

View File

@ -17,16 +17,16 @@ static SAMPLES_START( cclimber_sh_start )
{ {
running_machine &machine = device.machine(); running_machine &machine = device.machine();
samplebuf = 0; samplebuf = 0;
if (machine.region("samples")->base()) if (machine.root_device().memregion("samples")->base())
samplebuf = auto_alloc_array(machine, INT16, 2 * machine.region("samples")->bytes()); samplebuf = auto_alloc_array(machine, INT16, 2 * machine.root_device().memregion("samples")->bytes());
} }
static void cclimber_play_sample(running_machine &machine, int start,int freq,int volume) static void cclimber_play_sample(running_machine &machine, int start,int freq,int volume)
{ {
int len; int len;
int romlen = machine.region("samples")->bytes(); int romlen = machine.root_device().memregion("samples")->bytes();
const UINT8 *rom = machine.region("samples")->base(); const UINT8 *rom = machine.root_device().memregion("samples")->base();
samples_device *samples = machine.device<samples_device>("samples"); samples_device *samples = machine.device<samples_device>("samples");

View File

@ -1612,7 +1612,7 @@ static MACHINE_RESET( qb3_sound )
/* this patch prevents the sound ROM from eating itself when command $0A is sent */ /* this patch prevents the sound ROM from eating itself when command $0A is sent */
/* on a cube rotate */ /* on a cube rotate */
machine.region("audiocpu")->base()[0x11dc] = 0x09; state->memregion("audiocpu")->base()[0x11dc] = 0x09;
} }

View File

@ -174,7 +174,7 @@ WRITE8_MEMBER(circus_state::circus_clown_z_w)
{ {
m_clown_z = (data & 0x0f); m_clown_z = (data & 0x0f);
*(machine().region("maincpu")->base() + 0x8000) = data; logerror("Z:%02x\n",data); //DEBUG *(machine().root_device().memregion("maincpu")->base() + 0x8000) = data; logerror("Z:%02x\n",data); //DEBUG
/* Bits 4-6 enable/disable trigger different events */ /* Bits 4-6 enable/disable trigger different events */
switch (m_game_id) switch (m_game_id)

View File

@ -20,7 +20,7 @@ void cyberbal_sound_reset(running_machine &machine)
cyberbal_state *state = machine.driver_data<cyberbal_state>(); cyberbal_state *state = machine.driver_data<cyberbal_state>();
/* reset the sound system */ /* reset the sound system */
state->m_bank_base = &machine.region("audiocpu")->base()[0x10000]; state->m_bank_base = &state->memregion("audiocpu")->base()[0x10000];
state->membank("soundbank")->set_base(&state->m_bank_base[0x0000]); state->membank("soundbank")->set_base(&state->m_bank_base[0x0000]);
state->m_fast_68k_int = state->m_io_68k_int = 0; state->m_fast_68k_int = state->m_io_68k_int = 0;
state->m_sound_data_from_68k = state->m_sound_data_from_6502 = 0; state->m_sound_data_from_68k = state->m_sound_data_from_6502 = 0;

View File

@ -955,8 +955,8 @@ void dcs_init(running_machine &machine)
dcs.dmadac[0] = machine.device<dmadac_sound_device>("dac"); dcs.dmadac[0] = machine.device<dmadac_sound_device>("dac");
/* configure boot and sound ROMs */ /* configure boot and sound ROMs */
dcs.bootrom = (UINT16 *)machine.region("dcs")->base(); dcs.bootrom = (UINT16 *)machine.root_device().memregion("dcs")->base();
dcs.bootrom_words = machine.region("dcs")->bytes() / 2; dcs.bootrom_words = machine.root_device().memregion("dcs")->bytes() / 2;
dcs.sounddata = dcs.bootrom; dcs.sounddata = dcs.bootrom;
dcs.sounddata_words = dcs.bootrom_words; dcs.sounddata_words = dcs.bootrom_words;
dcs.sounddata_banks = dcs.sounddata_words / 0x1000; dcs.sounddata_banks = dcs.sounddata_words / 0x1000;
@ -1008,8 +1008,8 @@ void dcs2_init(running_machine &machine, int dram_in_mb, offs_t polling_offset)
dcs.dmadac[1] = machine.device<dmadac_sound_device>("dac2"); dcs.dmadac[1] = machine.device<dmadac_sound_device>("dac2");
/* always boot from the base of "dcs" */ /* always boot from the base of "dcs" */
dcs.bootrom = (UINT16 *)machine.region("dcs")->base(); dcs.bootrom = (UINT16 *)machine.root_device().memregion("dcs")->base();
dcs.bootrom_words = machine.region("dcs")->bytes() / 2; dcs.bootrom_words = machine.root_device().memregion("dcs")->bytes() / 2;
/* supports both RAM and ROM variants */ /* supports both RAM and ROM variants */
if (dram_in_mb != 0) if (dram_in_mb != 0)

View File

@ -1116,7 +1116,7 @@ static SOUND_START( dkong)
{ {
dkong_state *state = machine.driver_data<dkong_state>(); dkong_state *state = machine.driver_data<dkong_state>();
state->m_snd_rom = machine.region("soundcpu")->base(); state->m_snd_rom = state->memregion("soundcpu")->base();
} }

View File

@ -175,7 +175,7 @@ static DEVICE_START( exidy440_sound )
state->stream = device->machine().sound().stream_alloc(*device, 0, 2, device->clock(), NULL, channel_update); state->stream = device->machine().sound().stream_alloc(*device, 0, 2, device->clock(), NULL, channel_update);
/* allocate the sample cache */ /* allocate the sample cache */
length = machine.region("cvsd")->bytes() * 16 + MAX_CACHE_ENTRIES * sizeof(sound_cache_entry); length = machine.root_device().memregion("cvsd")->bytes() * 16 + MAX_CACHE_ENTRIES * sizeof(sound_cache_entry);
state->sound_cache = (sound_cache_entry *)auto_alloc_array(machine, UINT8, length); state->sound_cache = (sound_cache_entry *)auto_alloc_array(machine, UINT8, length);
/* determine the hard end of the cache and reset */ /* determine the hard end of the cache and reset */
@ -696,7 +696,7 @@ static INT16 *find_or_add_to_sound_cache(device_t *device, int address, int leng
if (current->address == address && current->length == length && current->bits == bits && current->frequency == frequency) if (current->address == address && current->length == length && current->bits == bits && current->frequency == frequency)
return current->data; return current->data;
return add_to_sound_cache(device, &device->machine().region("cvsd")->base()[address], address, length, bits, frequency); return add_to_sound_cache(device, &device->machine().root_device().memregion("cvsd")->base()[address], address, length, bits, frequency);
} }

View File

@ -190,8 +190,8 @@ static DEVICE_START( flower_sound )
/* extract globals from the interface */ /* extract globals from the interface */
state->m_last_channel = state->m_channel_list + 8; state->m_last_channel = state->m_channel_list + 8;
state->m_sample_rom = machine.region("sound1")->base(); state->m_sample_rom = machine.root_device().memregion("sound1")->base();
state->m_volume_rom = machine.region("sound2")->base(); state->m_volume_rom = machine.root_device().memregion("sound2")->base();
/* register for savestates */ /* register for savestates */
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)

View File

@ -192,7 +192,7 @@ static DEVICE_START( gomoku_sound )
state->m_num_voices = MAX_VOICES; state->m_num_voices = MAX_VOICES;
state->m_last_channel = state->m_channel_list + state->m_num_voices; state->m_last_channel = state->m_channel_list + state->m_num_voices;
state->m_sound_rom = machine.region("gomoku")->base(); state->m_sound_rom = machine.root_device().memregion("gomoku")->base();
/* start with sound enabled, many games don't have a sound enable register */ /* start with sound enabled, many games don't have a sound enable register */
state->m_sound_enable = 1; state->m_sound_enable = 1;

View File

@ -24,8 +24,8 @@
void hdsnd_init(running_machine &machine) void hdsnd_init(running_machine &machine)
{ {
harddriv_state *state = machine.driver_data<harddriv_state>(); harddriv_state *state = machine.driver_data<harddriv_state>();
state->m_rombase = (UINT8 *)machine.region("serialroms")->base(); state->m_rombase = (UINT8 *)state->memregion("serialroms")->base();
state->m_romsize = machine.region("serialroms")->bytes(); state->m_romsize = state->memregion("serialroms")->bytes();
} }

View File

@ -551,7 +551,7 @@ static DEVICE_START( common_sh_start )
/* if we have a 2151, install an externally driven DAC stream */ /* if we have a 2151, install an externally driven DAC stream */
if (state->m_has_ym2151) if (state->m_has_ym2151)
{ {
state->m_ext_base = machine.region("dac")->base(); state->m_ext_base = machine.root_device().memregion("dac")->base();
state->m_extern_stream = device->machine().sound().stream_alloc(*device, 0, 1, OUTPUT_RATE, NULL, leland_80186_extern_update); state->m_extern_stream = device->machine().sound().stream_alloc(*device, 0, 1, OUTPUT_RATE, NULL, leland_80186_extern_update);
} }

View File

@ -124,8 +124,8 @@ static DEVICE_START( m72_audio )
{ {
m72_audio_state *state = get_safe_token(device); m72_audio_state *state = get_safe_token(device);
state->samples = device->machine().region("samples")->base(); state->samples = device->machine().root_device().memregion("samples")->base();
state->samples_size = device->machine().region("samples")->bytes(); state->samples_size = device->machine().root_device().memregion("samples")->bytes();
state->space = device->machine().device("soundcpu")->memory().space(AS_IO); state->space = device->machine().device("soundcpu")->memory().space(AS_IO);
state->dac = device->machine().device("dac"); state->dac = device->machine().device("dac");

View File

@ -416,7 +416,7 @@ static SOUND_START( mario )
mario_state *state = machine.driver_data<mario_state>(); mario_state *state = machine.driver_data<mario_state>();
device_t *audiocpu = machine.device("audiocpu"); device_t *audiocpu = machine.device("audiocpu");
#if USE_8039 #if USE_8039
UINT8 *SND = machine.region("audiocpu")->base(); UINT8 *SND = machine.root_device().memregion("audiocpu")->base();
SND[0x1001] = 0x01; SND[0x1001] = 0x01;
#endif #endif
@ -426,8 +426,8 @@ static SOUND_START( mario )
{ {
state->m_eabank = "bank1"; state->m_eabank = "bank1";
audiocpu->memory().space(AS_PROGRAM)->install_read_bank(0x000, 0x7ff, "bank1"); audiocpu->memory().space(AS_PROGRAM)->install_read_bank(0x000, 0x7ff, "bank1");
state->membank("bank1")->configure_entry(0, machine.region("audiocpu")->base()); state->membank("bank1")->configure_entry(0, machine.root_device().memregion("audiocpu")->base());
state->membank("bank1")->configure_entry(1, machine.region("audiocpu")->base() + 0x1000); state->membank("bank1")->configure_entry(1, state->memregion("audiocpu")->base() + 0x1000);
} }
state->save_item(NAME(state->m_last)); state->save_item(NAME(state->m_last));
@ -482,8 +482,8 @@ READ8_MEMBER(mario_state::mario_sh_t1_r)
READ8_MEMBER(mario_state::mario_sh_tune_r) READ8_MEMBER(mario_state::mario_sh_tune_r)
{ {
UINT8 *SND = machine().region("audiocpu")->base(); UINT8 *SND = memregion("audiocpu")->base();
UINT16 mask = machine().region("audiocpu")->bytes()-1; UINT16 mask = memregion("audiocpu")->bytes()-1;
UINT8 p2 = I8035_P2_R(*&space); UINT8 p2 = I8035_P2_R(*&space);
if ((p2 >> 7) & 1) if ((p2 >> 7) & 1)

View File

@ -231,7 +231,7 @@ void midway_ssio_device::compute_ay8910_modulation()
// //
// loop over all possible values of the duty cycle // loop over all possible values of the duty cycle
UINT8 *prom = machine().region("proms")->base(); UINT8 *prom = memregion("proms")->base();
for (int volval = 0; volval < 16; volval++) for (int volval = 0; volval < 16; volval++)
{ {
// loop over all the clocks until we run out; look up in the PROM // loop over all the clocks until we run out; look up in the PROM
@ -448,6 +448,27 @@ static MACHINE_CONFIG_FRAGMENT( midway_ssio )
MACHINE_CONFIG_END MACHINE_CONFIG_END
//-------------------------------------------------
// ROM definitions
//-------------------------------------------------
ROM_START( midway_ssio )
ROM_REGION( 0x0020, "proms", 0 )
ROM_LOAD( "82s123.12d", 0x0000, 0x0020, CRC(e1281ee9) SHA1(9ac9b01d24affc0ee9227a4364c4fd8f8290343a) ) /* from shollow, assuming it's the same */
ROM_END
//-------------------------------------------------
// device_mconfig_additions - return a pointer to
// the device's machine fragment
//-------------------------------------------------
const rom_entry *midway_ssio_device::device_rom_region() const
{
return ROM_NAME(midway_ssio);
}
//------------------------------------------------- //-------------------------------------------------
// device_mconfig_additions - return a pointer to // device_mconfig_additions - return a pointer to
// the device's machine fragment // the device's machine fragment

View File

@ -121,6 +121,7 @@ public:
protected: protected:
// device-level overrides // device-level overrides
virtual const rom_entry *device_rom_region() const;
virtual machine_config_constructor device_mconfig_additions() const; virtual machine_config_constructor device_mconfig_additions() const;
virtual ioport_constructor device_input_ports() const; virtual ioport_constructor device_input_ports() const;
virtual void device_start(); virtual void device_start();

View File

@ -80,7 +80,7 @@ static STREAM_UPDATE( engine_sound_update )
/* determine the volume */ /* determine the volume */
slot = (state->m_sample_msb >> 3) & 7; slot = (state->m_sample_msb >> 3) & 7;
volume = volume_table[slot]; volume = volume_table[slot];
base = &device->machine().region("engine")->base()[slot * 0x800]; base = &device->machine().root_device().memregion("engine")->base()[slot * 0x800];
/* fill in the sample */ /* fill in the sample */
while (samples--) while (samples--)

View File

@ -488,7 +488,7 @@ static WRITE8_DEVICE_HANDLER( sega005_sound_a_w )
INLINE void sega005_update_sound_data(running_machine &machine) INLINE void sega005_update_sound_data(running_machine &machine)
{ {
segag80r_state *state = machine.driver_data<segag80r_state>(); segag80r_state *state = machine.driver_data<segag80r_state>();
UINT8 newval = machine.region("005")->base()[state->m_sound_addr]; UINT8 newval = state->memregion("005")->base()[state->m_sound_addr];
UINT8 diff = newval ^ state->m_sound_data; UINT8 diff = newval ^ state->m_sound_data;
//mame_printf_debug(" [%03X] = %02X\n", state->m_sound_addr, newval); //mame_printf_debug(" [%03X] = %02X\n", state->m_sound_addr, newval);
@ -589,7 +589,7 @@ DEVICE_GET_INFO( sega005_sound )
static STREAM_UPDATE( sega005_stream_update ) static STREAM_UPDATE( sega005_stream_update )
{ {
segag80r_state *state = device->machine().driver_data<segag80r_state>(); segag80r_state *state = device->machine().driver_data<segag80r_state>();
const UINT8 *sound_prom = device->machine().region("proms")->base(); const UINT8 *sound_prom = state->memregion("proms")->base();
int i; int i;
/* no implementation yet */ /* no implementation yet */
@ -881,7 +881,7 @@ static WRITE8_DEVICE_HANDLER( monsterb_sound_a_w )
tms36xx_note_w(tms, 0, data & 15); tms36xx_note_w(tms, 0, data & 15);
/* Top four data lines address an 82S123 ROM that enables/disables voices */ /* Top four data lines address an 82S123 ROM that enables/disables voices */
enable_val = device->machine().region("prom")->base()[(data & 0xF0) >> 4]; enable_val = device->machine().root_device().memregion("prom")->base()[(data & 0xF0) >> 4];
tms3617_enable_w(tms, enable_val >> 2); tms3617_enable_w(tms, enable_val >> 2);
} }
@ -963,7 +963,7 @@ static WRITE8_DEVICE_HANDLER( n7751_rom_control_w )
case 3: case 3:
state->m_sound_addr &= 0xfff; state->m_sound_addr &= 0xfff;
{ {
int numroms = device->machine().region("n7751")->bytes() / 0x1000; int numroms = state->memregion("n7751")->bytes() / 0x1000;
if (!(data & 0x01) && numroms >= 1) state->m_sound_addr |= 0x0000; if (!(data & 0x01) && numroms >= 1) state->m_sound_addr |= 0x0000;
if (!(data & 0x02) && numroms >= 2) state->m_sound_addr |= 0x1000; if (!(data & 0x02) && numroms >= 2) state->m_sound_addr |= 0x1000;
if (!(data & 0x04) && numroms >= 3) state->m_sound_addr |= 0x2000; if (!(data & 0x04) && numroms >= 3) state->m_sound_addr |= 0x2000;
@ -977,7 +977,7 @@ static WRITE8_DEVICE_HANDLER( n7751_rom_control_w )
READ8_MEMBER(segag80r_state::n7751_rom_r) READ8_MEMBER(segag80r_state::n7751_rom_r)
{ {
/* read from BUS */ /* read from BUS */
return machine().region("n7751")->base()[m_sound_addr]; return memregion("n7751")->base()[m_sound_addr];
} }

View File

@ -155,7 +155,7 @@ static DEVICE_START( speech_sound )
{ {
speech_state *state = get_safe_speech(device); speech_state *state = get_safe_speech(device);
state->speech = device->machine().region("speech")->base(); state->speech = device->machine().root_device().memregion("speech")->base();
} }

View File

@ -106,7 +106,7 @@ void seibu_sound_decrypt(running_machine &machine,const char *cpu,int length)
{ {
address_space *space = machine.device(cpu)->memory().space(AS_PROGRAM); address_space *space = machine.device(cpu)->memory().space(AS_PROGRAM);
UINT8 *decrypt = auto_alloc_array(machine, UINT8, length); UINT8 *decrypt = auto_alloc_array(machine, UINT8, length);
UINT8 *rom = machine.region(cpu)->base(); UINT8 *rom = machine.root_device().memregion(cpu)->base();
int i; int i;
space->set_decrypted_region(0x0000, (length < 0x10000) ? (length - 1) : 0x1fff, decrypt); space->set_decrypted_region(0x0000, (length < 0x10000) ? (length - 1) : 0x1fff, decrypt);
@ -190,7 +190,7 @@ static DEVICE_START( seibu_adpcm )
state->m_playing = 0; state->m_playing = 0;
state->m_stream = device->machine().sound().stream_alloc(*device, 0, 1, device->clock(), state, seibu_adpcm_callback); state->m_stream = device->machine().sound().stream_alloc(*device, 0, 1, device->clock(), state, seibu_adpcm_callback);
state->m_base = machine.region(intf->rom_region)->base(); state->m_base = machine.root_device().memregion(intf->rom_region)->base();
state->m_adpcm.reset(); state->m_adpcm.reset();
} }
@ -217,8 +217,8 @@ DEVICE_GET_INFO( seibu_adpcm )
void seibu_adpcm_decrypt(running_machine &machine, const char *region) void seibu_adpcm_decrypt(running_machine &machine, const char *region)
{ {
UINT8 *ROM = machine.region(region)->base(); UINT8 *ROM = machine.root_device().memregion(region)->base();
int len = machine.region(region)->bytes(); int len = machine.root_device().memregion(region)->bytes();
int i; int i;
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
@ -346,8 +346,8 @@ void seibu_ym2203_irqhandler(device_t *device, int linestate)
MACHINE_RESET( seibu_sound ) MACHINE_RESET( seibu_sound )
{ {
int romlength = machine.region("audiocpu")->bytes(); int romlength = machine.root_device().memregion("audiocpu")->bytes();
UINT8 *rom = machine.region("audiocpu")->base(); UINT8 *rom = machine.root_device().memregion("audiocpu")->base();
sound_cpu = machine.device("audiocpu"); sound_cpu = machine.device("audiocpu");
update_irq_lines(machine, VECTOR_INIT); update_irq_lines(machine, VECTOR_INIT);

View File

@ -1171,7 +1171,7 @@ WRITE8_DEVICE_HANDLER( spc_io_w )
if ((data & 0x80) != (spc700->ram[0xf1] & 0x80)) if ((data & 0x80) != (spc700->ram[0xf1] & 0x80))
{ {
if (data & 0x80) if (data & 0x80)
memcpy(spc700->ipl_region, device->machine().region("user5")->base(), 64); memcpy(spc700->ipl_region, device->machine().root_device().memregion("user5")->base(), 64);
else else
memcpy(spc700->ipl_region, &spc700->ram[0xffc0], 64); memcpy(spc700->ipl_region, &spc700->ram[0xffc0], 64);
} }
@ -1319,7 +1319,7 @@ static DEVICE_START( snes_sound )
spc700->ram[0xf1] = 0x80; spc700->ram[0xf1] = 0x80;
/* put IPL image at the top of RAM */ /* put IPL image at the top of RAM */
memcpy(spc700->ipl_region, machine.region("user5")->base(), 64); memcpy(spc700->ipl_region, machine.root_device().memregion("user5")->base(), 64);
/* Initialize the timers */ /* Initialize the timers */
spc700->timer[0] = machine.scheduler().timer_alloc(FUNC(snes_spc_timer), spc700); spc700->timer[0] = machine.scheduler().timer_alloc(FUNC(snes_spc_timer), spc700);

View File

@ -654,7 +654,7 @@ static DEVICE_START( snk6502_sound )
snk6502_sound_state *state = get_safe_token(device); snk6502_sound_state *state = get_safe_token(device);
state->m_samples = device->machine().device<samples_device>("samples"); state->m_samples = device->machine().device<samples_device>("samples");
state->m_ROM = device->machine().region("snk6502")->base(); state->m_ROM = device->machine().root_device().memregion("snk6502")->base();
// adjusted // adjusted
snk6502_set_music_freq(device->machine(), 43000); snk6502_set_music_freq(device->machine(), 43000);

View File

@ -52,8 +52,8 @@ SAMPLES_START( suna8_sh_start )
{ {
suna8_state *state = device.machine().driver_data<suna8_state>(); suna8_state *state = device.machine().driver_data<suna8_state>();
running_machine &machine = device.machine(); running_machine &machine = device.machine();
int i, len = machine.region("samples")->bytes(); int i, len = machine.root_device().memregion("samples")->bytes();
UINT8 *ROM = machine.region("samples")->base(); UINT8 *ROM = state->memregion("samples")->base();
state->m_samplebuf = auto_alloc_array(machine, INT16, len); state->m_samplebuf = auto_alloc_array(machine, INT16, len);

View File

@ -49,7 +49,7 @@ static WRITE16_HANDLER(f3_68000_share_w)
static WRITE16_HANDLER( f3_es5505_bank_w ) static WRITE16_HANDLER( f3_es5505_bank_w )
{ {
UINT32 max_banks_this_game=(space->machine().region("ensoniq.0")->bytes()/0x200000)-1; UINT32 max_banks_this_game=(space->machine().root_device().memregion("ensoniq.0")->bytes()/0x200000)-1;
#if 0 #if 0
{ {
@ -222,7 +222,7 @@ static READ16_HANDLER(es5510_dsp_r)
static WRITE16_HANDLER(es5510_dsp_w) static WRITE16_HANDLER(es5510_dsp_w)
{ {
UINT8 *snd_mem = (UINT8 *)space->machine().region("ensoniq.0")->base(); UINT8 *snd_mem = (UINT8 *)space->machine().root_device().memregion("ensoniq.0")->base();
// if (offset>4 && offset!=0x80 && offset!=0xa0 && offset!=0xc0 && offset!=0xe0) // if (offset>4 && offset!=0x80 && offset!=0xa0 && offset!=0xc0 && offset!=0xe0)
// logerror("%06x: DSP write offset %04x %04x\n",cpu_get_pc(&space->device()),offset,data); // logerror("%06x: DSP write offset %04x %04x\n",cpu_get_pc(&space->device()),offset,data);
@ -304,7 +304,7 @@ ADDRESS_MAP_END
SOUND_RESET( taito_f3_soundsystem_reset ) SOUND_RESET( taito_f3_soundsystem_reset )
{ {
/* Sound cpu program loads to 0xc00000 so we use a bank */ /* Sound cpu program loads to 0xc00000 so we use a bank */
UINT16 *ROM = (UINT16 *)machine.region("audiocpu")->base(); UINT16 *ROM = (UINT16 *)machine.root_device().memregion("audiocpu")->base();
UINT16 *sound_ram = (UINT16 *)machine.memory().shared("share1")->ptr(); UINT16 *sound_ram = (UINT16 *)machine.memory().shared("share1")->ptr();
machine.root_device().membank("bank1")->set_base(&ROM[0x80000]); machine.root_device().membank("bank1")->set_base(&ROM[0x80000]);
machine.root_device().membank("bank2")->set_base(&ROM[0x90000]); machine.root_device().membank("bank2")->set_base(&ROM[0x90000]);

View File

@ -115,7 +115,7 @@ WRITE8_HANDLER( targ_audio_2_w )
if ((data & 0x01) && !(port_2_last & 0x01)) if ((data & 0x01) && !(port_2_last & 0x01))
{ {
samples_device *samples = space->machine().device<samples_device>("samples"); samples_device *samples = space->machine().device<samples_device>("samples");
UINT8 *prom = space->machine().region("targ")->base(); UINT8 *prom = space->machine().root_device().memregion("targ")->base();
tone_pointer = (tone_pointer + 1) & 0x0f; tone_pointer = (tone_pointer + 1) & 0x0f;

View File

@ -302,7 +302,7 @@ machine_config_constructor williams_cvsd_sound_device::device_mconfig_additions(
void williams_cvsd_sound_device::device_start() void williams_cvsd_sound_device::device_start()
{ {
// configure master CPU banks // configure master CPU banks
UINT8 *rom = subregion("cpu")->base(); UINT8 *rom = memregion("cpu")->base();
for (int bank = 0; bank < 16; bank++) for (int bank = 0; bank < 16; bank++)
{ {
// //
@ -650,7 +650,7 @@ machine_config_constructor williams_narc_sound_device::device_mconfig_additions(
void williams_narc_sound_device::device_start() void williams_narc_sound_device::device_start()
{ {
// configure master CPU banks // configure master CPU banks
UINT8 *rom = subregion("cpu0")->base(); UINT8 *rom = memregion("cpu0")->base();
for (int bank = 0; bank < 16; bank++) for (int bank = 0; bank < 16; bank++)
{ {
// //
@ -664,7 +664,7 @@ void williams_narc_sound_device::device_start()
membank("masterupper")->set_base(&rom[0x10000 + 0x4000 + 0x8000 + 0x10000 + 0x20000 * 3]); membank("masterupper")->set_base(&rom[0x10000 + 0x4000 + 0x8000 + 0x10000 + 0x20000 * 3]);
// configure slave CPU banks // configure slave CPU banks
rom = subregion("cpu1")->base(); rom = memregion("cpu1")->base();
for (int bank = 0; bank < 16; bank++) for (int bank = 0; bank < 16; bank++)
{ {
// //
@ -929,12 +929,12 @@ machine_config_constructor williams_adpcm_sound_device::device_mconfig_additions
void williams_adpcm_sound_device::device_start() void williams_adpcm_sound_device::device_start()
{ {
// configure banks // configure banks
UINT8 *rom = subregion("cpu")->base(); UINT8 *rom = memregion("cpu")->base();
membank("rombank")->configure_entries(0, 8, &rom[0x10000], 0x8000); membank("rombank")->configure_entries(0, 8, &rom[0x10000], 0x8000);
membank("romupper")->set_base(&rom[0x10000 + 0x4000 + 7 * 0x8000]); membank("romupper")->set_base(&rom[0x10000 + 0x4000 + 7 * 0x8000]);
// expand ADPCM data // expand ADPCM data
rom = subregion("oki")->base(); rom = memregion("oki")->base();
// it is assumed that U12 is loaded @ 0x00000 and U13 is loaded @ 0x40000 // it is assumed that U12 is loaded @ 0x00000 and U13 is loaded @ 0x40000
membank("okibank")->configure_entry(0, &rom[0x40000]); membank("okibank")->configure_entry(0, &rom[0x40000]);
membank("okibank")->configure_entry(1, &rom[0x40000]); membank("okibank")->configure_entry(1, &rom[0x40000]);

View File

@ -193,8 +193,8 @@ static DEVICE_START( wiping_sound )
state->m_num_voices = 8; state->m_num_voices = 8;
state->m_last_channel = state->m_channel_list + state->m_num_voices; state->m_last_channel = state->m_channel_list + state->m_num_voices;
state->m_sound_rom = machine.region("samples")->base(); state->m_sound_rom = machine.root_device().memregion("samples")->base();
state->m_sound_prom = machine.region("soundproms")->base(); state->m_sound_prom = machine.root_device().memregion("soundproms")->base();
/* start with sound enabled, many games don't have a sound enable register */ /* start with sound enabled, many games don't have a sound enable register */
state->m_sound_enable = 1; state->m_sound_enable = 1;

View File

@ -505,7 +505,7 @@ ROM_END
static DRIVER_INIT( 1942 ) static DRIVER_INIT( 1942 )
{ {
UINT8 *ROM = machine.region("maincpu")->base(); UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
machine.root_device().membank("bank1")->configure_entries(0, 3, &ROM[0x10000], 0x4000); machine.root_device().membank("bank1")->configure_entries(0, 3, &ROM[0x10000], 0x4000);
} }

View File

@ -643,7 +643,7 @@ ROM_END
static DRIVER_INIT( 1943 ) static DRIVER_INIT( 1943 )
{ {
UINT8 *ROM = machine.region("maincpu")->base(); UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
machine.root_device().membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x4000); machine.root_device().membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x4000);
} }

View File

@ -144,7 +144,7 @@ static void set_bankptr(running_machine &machine)
_20pacgal_state *state = machine.driver_data<_20pacgal_state>(); _20pacgal_state *state = machine.driver_data<_20pacgal_state>();
if (state->m_game_selected == 0) if (state->m_game_selected == 0)
{ {
UINT8 *rom = machine.region("maincpu")->base(); UINT8 *rom = state->memregion("maincpu")->base();
state->membank("bank1")->set_base(rom + 0x08000); state->membank("bank1")->set_base(rom + 0x08000);
} }
else else

View File

@ -495,8 +495,8 @@ static void tile_decode(running_machine &machine)
{ {
UINT8 lsb,msb; UINT8 lsb,msb;
UINT32 offset,i; UINT32 offset,i;
UINT8 *gfx = machine.region("gfx2")->base(); UINT8 *gfx = machine.root_device().memregion("gfx2")->base();
int size=machine.region("gfx2")->bytes(); int size=machine.root_device().memregion("gfx2")->bytes();
int data; int data;
/* Setup ROM formats: /* Setup ROM formats:
@ -528,8 +528,8 @@ static void tile_decode(running_machine &machine)
offset+=4; offset+=4;
} }
gfx = machine.region("gfx1")->base(); gfx = machine.root_device().memregion("gfx1")->base();
size=machine.region("gfx1")->bytes(); size=machine.root_device().memregion("gfx1")->bytes();
offset = size/2; offset = size/2;
for (i = size/2+size/4; i<size; i++) for (i = size/2+size/4; i<size; i++)

View File

@ -1569,7 +1569,7 @@ static void pxa255_start(running_machine& machine)
static MACHINE_START(39in1) static MACHINE_START(39in1)
{ {
UINT8 *ROM = machine.region("maincpu")->base(); UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
int i; int i;
for (i = 0; i < 0x80000; i += 2) for (i = 0; i < 0x80000; i += 2)

View File

@ -135,11 +135,11 @@ static MACHINE_RESET( 3do )
state->m_maincpu = downcast<legacy_cpu_device*>( machine.device("maincpu") ); state->m_maincpu = downcast<legacy_cpu_device*>( machine.device("maincpu") );
state->membank("bank2")->set_base(machine.region("user1")->base()); state->membank("bank2")->set_base(machine.root_device().memregion("user1")->base());
/* configure overlay */ /* configure overlay */
state->membank("bank1")->configure_entry(0, state->m_dram); state->membank("bank1")->configure_entry(0, state->m_dram);
state->membank("bank1")->configure_entry(1, machine.region("user1")->base()); state->membank("bank1")->configure_entry(1, state->memregion("user1")->base());
/* start with overlay enabled */ /* start with overlay enabled */
state->membank("bank1")->set_entry(1); state->membank("bank1")->set_entry(1);

View File

@ -566,7 +566,7 @@ READ8_MEMBER(fortyl_state::undoukai_mcu_status_r)
static DRIVER_INIT( undoukai ) static DRIVER_INIT( undoukai )
{ {
fortyl_state *state = machine.driver_data<fortyl_state>(); fortyl_state *state = machine.driver_data<fortyl_state>();
UINT8 *ROM = machine.region("maincpu")->base(); UINT8 *ROM = state->memregion("maincpu")->base();
state->membank("bank1")->configure_entries(0, 2, &ROM[0x10000], 0x2000); state->membank("bank1")->configure_entries(0, 2, &ROM[0x10000], 0x2000);
state->m_pix_color[0] = 0x000; state->m_pix_color[0] = 0x000;
@ -578,14 +578,14 @@ static DRIVER_INIT( undoukai )
static DRIVER_INIT( 40love ) static DRIVER_INIT( 40love )
{ {
fortyl_state *state = machine.driver_data<fortyl_state>(); fortyl_state *state = machine.driver_data<fortyl_state>();
UINT8 *ROM = machine.region("maincpu")->base(); UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
state->membank("bank1")->configure_entries(0, 2, &ROM[0x10000], 0x2000); state->membank("bank1")->configure_entries(0, 2, &ROM[0x10000], 0x2000);
#if 0 #if 0
/* character ROM hack /* character ROM hack
to show a white line on the opponent side */ to show a white line on the opponent side */
UINT8 *ROM = machine.region("gfx2")->base(); UINT8 *ROM = state->memregion("gfx2")->base();
int adr = 0x10 * 0x022b; int adr = 0x10 * 0x022b;
ROM[adr + 0x000a] = 0x00; ROM[adr + 0x000a] = 0x00;
ROM[adr + 0x000b] = 0x00; ROM[adr + 0x000b] = 0x00;

View File

@ -79,7 +79,7 @@ static WRITE8_DEVICE_HANDLER( sound_control_w )
READ8_MEMBER(_4enraya_state::fenraya_custom_map_r) READ8_MEMBER(_4enraya_state::fenraya_custom_map_r)
{ {
UINT8 *prom = machine().region("pal_prom")->base(); UINT8 *prom = memregion("pal_prom")->base();
UINT8 prom_routing = (prom[offset >> 12] & 0xf) ^ 0xf; UINT8 prom_routing = (prom[offset >> 12] & 0xf) ^ 0xf;
UINT8 res; UINT8 res;
@ -87,13 +87,13 @@ READ8_MEMBER(_4enraya_state::fenraya_custom_map_r)
if(prom_routing & 1) //ROM5 if(prom_routing & 1) //ROM5
{ {
UINT8 *rom = machine().region("maincpu")->base(); UINT8 *rom = memregion("maincpu")->base();
res |= rom[offset & 0x7fff]; res |= rom[offset & 0x7fff];
} }
if(prom_routing & 2) //ROM4 if(prom_routing & 2) //ROM4
{ {
UINT8 *rom = machine().region("maincpu")->base(); UINT8 *rom = memregion("maincpu")->base();
res |= rom[(offset & 0x7fff) | 0x8000]; res |= rom[(offset & 0x7fff) | 0x8000];
} }
@ -112,7 +112,7 @@ READ8_MEMBER(_4enraya_state::fenraya_custom_map_r)
WRITE8_MEMBER(_4enraya_state::fenraya_custom_map_w) WRITE8_MEMBER(_4enraya_state::fenraya_custom_map_w)
{ {
UINT8 *prom = machine().region("pal_prom")->base(); UINT8 *prom = memregion("pal_prom")->base();
UINT8 prom_routing = (prom[offset >> 12] & 0xf) ^ 0xf; UINT8 prom_routing = (prom[offset >> 12] & 0xf) ^ 0xf;
if(prom_routing & 1) //ROM5 if(prom_routing & 1) //ROM5
@ -392,7 +392,7 @@ ROM_END
static DRIVER_INIT( unkpacg ) static DRIVER_INIT( unkpacg )
{ {
_4enraya_state *state = machine.driver_data<_4enraya_state>(); _4enraya_state *state = machine.driver_data<_4enraya_state>();
UINT8 *rom = machine.region("maincpu")->base(); UINT8 *rom = state->memregion("maincpu")->base();
state->m_snd_latch_bit = 2; state->m_snd_latch_bit = 2;

View File

@ -537,7 +537,7 @@ static SCREEN_UPDATE_IND16( fclown )
static PALETTE_INIT( fclown ) static PALETTE_INIT( fclown )
{ {
const UINT8 *color_prom = machine.region("proms")->base(); const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
/* /*
7654 3210 7654 3210
---- ---x RED component. ---- ---x RED component.
@ -1205,7 +1205,7 @@ static DRIVER_INIT( fclown )
/* Decrypting main program */ /* Decrypting main program */
int x; int x;
UINT8 *src = machine.region( "maincpu" )->base(); UINT8 *src = state->memregion( "maincpu" )->base();
for (x = 0x0000; x < 0x10000; x++) for (x = 0x0000; x < 0x10000; x++)
{ {
@ -1215,8 +1215,8 @@ static DRIVER_INIT( fclown )
/* Decrypting GFX by segments */ /* Decrypting GFX by segments */
UINT8 *gfx1_src = machine.region( "gfx1" )->base(); UINT8 *gfx1_src = machine.root_device().memregion( "gfx1" )->base();
UINT8 *gfx2_src = machine.region( "gfx2" )->base(); UINT8 *gfx2_src = machine.root_device().memregion( "gfx2" )->base();
for (x = 0x2000; x < 0x3000; x++) for (x = 0x2000; x < 0x3000; x++)
{ {
@ -1236,7 +1236,7 @@ static DRIVER_INIT( fclown )
/* Decrypting sound samples */ /* Decrypting sound samples */
UINT8 *samples_src = machine.region( "oki6295" )->base(); UINT8 *samples_src = machine.root_device().memregion( "oki6295" )->base();
for (x = 0x0000; x < 0x10000; x++) for (x = 0x0000; x < 0x10000; x++)
{ {

View File

@ -2162,8 +2162,8 @@ MACHINE_CONFIG_END
/* decrypt function for vortex */ /* decrypt function for vortex */
static DRIVER_INIT( vortex ) static DRIVER_INIT( vortex )
{ {
UINT8 *rom = machine.region("maincpu")->base(); UINT8 *rom = machine.root_device().memregion("maincpu")->base();
int length = machine.region("maincpu")->bytes(); int length = machine.root_device().memregion("maincpu")->bytes();
UINT8 *buf1 = auto_alloc_array(machine, UINT8, length); UINT8 *buf1 = auto_alloc_array(machine, UINT8, length);
UINT32 x; UINT32 x;
for (x = 0; x < length; x++) for (x = 0; x < length; x++)

View File

@ -266,7 +266,7 @@ INPUT_PORTS_END
static KONAMI_SETLINES_CALLBACK( k88games_banking ) static KONAMI_SETLINES_CALLBACK( k88games_banking )
{ {
_88games_state *state = device->machine().driver_data<_88games_state>(); _88games_state *state = device->machine().driver_data<_88games_state>();
UINT8 *RAM = device->machine().region("maincpu")->base(); UINT8 *RAM = state->memregion("maincpu")->base();
int offs; int offs;
logerror("%04x: bank select %02x\n", cpu_get_pc(device), lines); logerror("%04x: bank select %02x\n", cpu_get_pc(device), lines);
@ -330,7 +330,7 @@ static MACHINE_RESET( 88games )
_88games_state *state = machine.driver_data<_88games_state>(); _88games_state *state = machine.driver_data<_88games_state>();
konami_configure_set_lines(machine.device("maincpu"), k88games_banking); konami_configure_set_lines(machine.device("maincpu"), k88games_banking);
state->m_generic_paletteram_8.set_target(&machine.region("maincpu")->base()[0x20000], 0x1000); state->m_generic_paletteram_8.set_target(&state->memregion("maincpu")->base()[0x20000], 0x1000);
state->m_videobank = 0; state->m_videobank = 0;
state->m_zoomreadroms = 0; state->m_zoomreadroms = 0;

View File

@ -604,7 +604,7 @@ MACHINE_CONFIG_END
static DRIVER_INIT( sidewndr ) static DRIVER_INIT( sidewndr )
{ {
UINT8 *ROM = machine.region( "maincpu" )->base(); UINT8 *ROM = machine.root_device().memregion( "maincpu" )->base();
/* replace "ret nc" ( 0xd0 ) with "di" */ /* replace "ret nc" ( 0xd0 ) with "di" */
ROM[ 0 ] = 0xf3; ROM[ 0 ] = 0xf3;
/* this is either a bad dump or the cpu core should set the carry flag on reset */ /* this is either a bad dump or the cpu core should set the carry flag on reset */

View File

@ -1237,7 +1237,7 @@ extern void descramble_crystal( UINT8* region, int start, int end, UINT8 extra_x
DRIVER_INIT( ace_cr ) DRIVER_INIT( ace_cr )
{ {
descramble_crystal(machine.region( "maincpu" )->base(), 0x0000, 0x10000, 0x00); descramble_crystal(machine.root_device().memregion( "maincpu" )->base(), 0x0000, 0x10000, 0x00);
} }
DRIVER_INIT( ace_sp ) DRIVER_INIT( ace_sp )

View File

@ -319,7 +319,7 @@ static MACHINE_START( skattv )
// hack to handle acrt rom // hack to handle acrt rom
{ {
UINT16 *rom = (UINT16*)machine.region("gfx1")->base(); UINT16 *rom = (UINT16*)state->memregion("gfx1")->base();
int i; int i;
device_t *hd63484 = machine.device("hd63484"); device_t *hd63484 = machine.device("hd63484");
@ -637,7 +637,7 @@ static const ay8910_interface ay8910_config =
READ8_MEMBER(adp_state::h63484_rom_r) READ8_MEMBER(adp_state::h63484_rom_r)
{ {
UINT8 *rom = machine().region("gfx1")->base(); UINT8 *rom = memregion("gfx1")->base();
return rom[offset]; return rom[offset];
} }

View File

@ -227,8 +227,8 @@ static MACHINE_START( formatz )
{ {
aeroboto_state *state = machine.driver_data<aeroboto_state>(); aeroboto_state *state = machine.driver_data<aeroboto_state>();
state->m_stars_rom = machine.region("gfx2")->base(); state->m_stars_rom = machine.root_device().memregion("gfx2")->base();
state->m_stars_length = machine.region("gfx2")->bytes(); state->m_stars_length = state->memregion("gfx2")->bytes();
state->save_item(NAME(state->m_disable_irq)); state->save_item(NAME(state->m_disable_irq));
state->save_item(NAME(state->m_count)); state->save_item(NAME(state->m_count));

View File

@ -129,7 +129,7 @@ static WRITE16_DEVICE_HANDLER( aerfboo2_okim6295_banking_w )
WRITE8_MEMBER(aerofgt_state::aerfboot_okim6295_banking_w) WRITE8_MEMBER(aerofgt_state::aerfboot_okim6295_banking_w)
{ {
UINT8 *oki = machine().region("oki")->base(); UINT8 *oki = memregion("oki")->base();
/*bit 2 (0x4) setted too?*/ /*bit 2 (0x4) setted too?*/
if (data & 0x4) if (data & 0x4)
memcpy(&oki[0x20000], &oki[((data & 0x3) * 0x20000) + 0x40000], 0x20000); memcpy(&oki[0x20000], &oki[((data & 0x3) * 0x20000) + 0x40000], 0x20000);
@ -1302,7 +1302,7 @@ static MACHINE_START( common )
static MACHINE_START( aerofgt ) static MACHINE_START( aerofgt )
{ {
UINT8 *rom = machine.region("audiocpu")->base(); UINT8 *rom = machine.root_device().memregion("audiocpu")->base();
machine.root_device().membank("bank1")->configure_entries(0, 4, &rom[0x10000], 0x8000); machine.root_device().membank("bank1")->configure_entries(0, 4, &rom[0x10000], 0x8000);

View File

@ -571,9 +571,9 @@ static INTERRUPT_GEN( slave_interrupt )
static MACHINE_START( airbustr ) static MACHINE_START( airbustr )
{ {
airbustr_state *state = machine.driver_data<airbustr_state>(); airbustr_state *state = machine.driver_data<airbustr_state>();
UINT8 *MASTER = machine.region("master")->base(); UINT8 *MASTER = machine.root_device().memregion("master")->base();
UINT8 *SLAVE = machine.region("slave")->base(); UINT8 *SLAVE = machine.root_device().memregion("slave")->base();
UINT8 *AUDIO = machine.region("audiocpu")->base(); UINT8 *AUDIO = state->memregion("audiocpu")->base();
state->membank("bank1")->configure_entries(0, 3, &MASTER[0x00000], 0x4000); state->membank("bank1")->configure_entries(0, 3, &MASTER[0x00000], 0x4000);
state->membank("bank1")->configure_entries(3, 5, &MASTER[0x10000], 0x4000); state->membank("bank1")->configure_entries(3, 5, &MASTER[0x10000], 0x4000);

View File

@ -40,7 +40,7 @@ public:
static PALETTE_INIT( hanaroku ) static PALETTE_INIT( hanaroku )
{ {
const UINT8 *color_prom = machine.region("proms")->base(); const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
int i; int i;
int r, g, b; int r, g, b;

View File

@ -357,7 +357,7 @@ INPUT_PORTS_END
static MACHINE_START( yumefuda ) static MACHINE_START( yumefuda )
{ {
albazg_state *state = machine.driver_data<albazg_state>(); albazg_state *state = machine.driver_data<albazg_state>();
UINT8 *ROM = machine.region("maincpu")->base(); UINT8 *ROM = state->memregion("maincpu")->base();
state->membank("bank1")->configure_entries(0, 4, &ROM[0x10000], 0x2000); state->membank("bank1")->configure_entries(0, 4, &ROM[0x10000], 0x2000);

View File

@ -837,7 +837,7 @@ MACHINE_CONFIG_END
static DRIVER_INIT( aleck64 ) static DRIVER_INIT( aleck64 )
{ {
UINT8 *rom = machine.region("user2")->base(); UINT8 *rom = machine.root_device().memregion("user2")->base();
rom[0x67c] = 0; rom[0x67c] = 0;
rom[0x67d] = 0; rom[0x67d] = 0;

View File

@ -700,7 +700,7 @@ static void alg_init(running_machine &machine)
/* set up memory */ /* set up memory */
state->membank("bank1")->configure_entry(0, state->m_chip_ram); state->membank("bank1")->configure_entry(0, state->m_chip_ram);
state->membank("bank1")->configure_entry(1, machine.region("user1")->base()); state->membank("bank1")->configure_entry(1, machine.root_device().memregion("user1")->base());
} }
@ -713,8 +713,8 @@ static void alg_init(running_machine &machine)
static DRIVER_INIT( palr1 ) static DRIVER_INIT( palr1 )
{ {
UINT32 length = machine.region("user2")->bytes(); UINT32 length = machine.root_device().memregion("user2")->bytes();
UINT8 *rom = machine.region("user2")->base(); UINT8 *rom = machine.root_device().memregion("user2")->base();
UINT8 *original = auto_alloc_array(machine, UINT8, length); UINT8 *original = auto_alloc_array(machine, UINT8, length);
UINT32 srcaddr; UINT32 srcaddr;
@ -733,8 +733,8 @@ static DRIVER_INIT( palr1 )
static DRIVER_INIT( palr3 ) static DRIVER_INIT( palr3 )
{ {
UINT32 length = machine.region("user2")->bytes(); UINT32 length = machine.root_device().memregion("user2")->bytes();
UINT8 *rom = machine.region("user2")->base(); UINT8 *rom = machine.root_device().memregion("user2")->base();
UINT8 *original = auto_alloc_array(machine, UINT8, length); UINT8 *original = auto_alloc_array(machine, UINT8, length);
UINT32 srcaddr; UINT32 srcaddr;
@ -752,8 +752,8 @@ static DRIVER_INIT( palr3 )
static DRIVER_INIT( palr6 ) static DRIVER_INIT( palr6 )
{ {
UINT32 length = machine.region("user2")->bytes(); UINT32 length = machine.root_device().memregion("user2")->bytes();
UINT8 *rom = machine.region("user2")->base(); UINT8 *rom = machine.root_device().memregion("user2")->base();
UINT8 *original = auto_alloc_array(machine, UINT8, length); UINT8 *original = auto_alloc_array(machine, UINT8, length);
UINT32 srcaddr; UINT32 srcaddr;
@ -774,7 +774,7 @@ static DRIVER_INIT( palr6 )
static DRIVER_INIT( aplatoon ) static DRIVER_INIT( aplatoon )
{ {
/* NOT DONE TODO FIGURE OUT THE RIGHT ORDER!!!! */ /* NOT DONE TODO FIGURE OUT THE RIGHT ORDER!!!! */
UINT8 *rom = machine.region("user2")->base(); UINT8 *rom = machine.root_device().memregion("user2")->base();
UINT8 *decrypted = auto_alloc_array(machine, UINT8, 0x40000); UINT8 *decrypted = auto_alloc_array(machine, UINT8, 0x40000);
int i; int i;

View File

@ -230,7 +230,7 @@ static const k051960_interface aliens_k051960_intf =
static MACHINE_START( aliens ) static MACHINE_START( aliens )
{ {
aliens_state *state = machine.driver_data<aliens_state>(); aliens_state *state = machine.driver_data<aliens_state>();
UINT8 *ROM = machine.region("maincpu")->base(); UINT8 *ROM = state->memregion("maincpu")->base();
state->membank("bank1")->configure_entries(0, 20, &ROM[0x10000], 0x2000); state->membank("bank1")->configure_entries(0, 20, &ROM[0x10000], 0x2000);
state->membank("bank1")->set_entry(0); state->membank("bank1")->set_entry(0);

View File

@ -1903,7 +1903,7 @@ static MACHINE_RESET( common )
static MACHINE_START( alpha68k_V ) static MACHINE_START( alpha68k_V )
{ {
alpha68k_state *state = machine.driver_data<alpha68k_state>(); alpha68k_state *state = machine.driver_data<alpha68k_state>();
UINT8 *ROM = machine.region("audiocpu")->base(); UINT8 *ROM = state->memregion("audiocpu")->base();
state->membank("bank7")->configure_entries(0, 32, &ROM[0x10000], 0x4000); state->membank("bank7")->configure_entries(0, 32, &ROM[0x10000], 0x4000);
@ -1939,7 +1939,7 @@ static MACHINE_RESET( alpha68k_II )
static MACHINE_START( alpha68k_II ) static MACHINE_START( alpha68k_II )
{ {
alpha68k_state *state = machine.driver_data<alpha68k_state>(); alpha68k_state *state = machine.driver_data<alpha68k_state>();
UINT8 *ROM = machine.region("audiocpu")->base(); UINT8 *ROM = state->memregion("audiocpu")->base();
state->membank("bank7")->configure_entries(0, 28, &ROM[0x10000], 0x4000); state->membank("bank7")->configure_entries(0, 28, &ROM[0x10000], 0x4000);
@ -3222,7 +3222,7 @@ static DRIVER_INIT( btlfieldb )
static DRIVER_INIT( skysoldr ) static DRIVER_INIT( skysoldr )
{ {
alpha68k_state *state = machine.driver_data<alpha68k_state>(); alpha68k_state *state = machine.driver_data<alpha68k_state>();
state->membank("bank8")->set_base((machine.region("user1")->base()) + 0x40000); state->membank("bank8")->set_base((state->memregion("user1")->base()) + 0x40000);
state->m_invert_controls = 0; state->m_invert_controls = 0;
state->m_microcontroller_id = 0; state->m_microcontroller_id = 0;
state->m_coin_id = 0x22 | (0x22 << 8); state->m_coin_id = 0x22 | (0x22 << 8);
@ -3241,7 +3241,7 @@ static DRIVER_INIT( goldmedl )
static DRIVER_INIT( goldmedla ) static DRIVER_INIT( goldmedla )
{ {
alpha68k_state *state = machine.driver_data<alpha68k_state>(); alpha68k_state *state = machine.driver_data<alpha68k_state>();
state->membank("bank8")->set_base(machine.region("maincpu")->base() + 0x20000); state->membank("bank8")->set_base(state->memregion("maincpu")->base() + 0x20000);
state->m_invert_controls = 0; state->m_invert_controls = 0;
state->m_microcontroller_id = 0x8803; //Guess - routine to handle coinage is the same as in 'goldmedl' state->m_microcontroller_id = 0x8803; //Guess - routine to handle coinage is the same as in 'goldmedl'
state->m_coin_id = 0x23 | (0x24 << 8); state->m_coin_id = 0x23 | (0x24 << 8);
@ -3269,7 +3269,7 @@ static DRIVER_INIT( skyadvntu )
static DRIVER_INIT( gangwarsu ) static DRIVER_INIT( gangwarsu )
{ {
alpha68k_state *state = machine.driver_data<alpha68k_state>(); alpha68k_state *state = machine.driver_data<alpha68k_state>();
state->membank("bank8")->set_base(machine.region("user1")->base()); state->membank("bank8")->set_base(state->memregion("user1")->base());
state->m_invert_controls = 0; state->m_invert_controls = 0;
state->m_microcontroller_id = 0x8512; state->m_microcontroller_id = 0x8512;
state->m_coin_id = 0x23 | (0x24 << 8); state->m_coin_id = 0x23 | (0x24 << 8);
@ -3279,7 +3279,7 @@ static DRIVER_INIT( gangwarsu )
static DRIVER_INIT( gangwars ) static DRIVER_INIT( gangwars )
{ {
alpha68k_state *state = machine.driver_data<alpha68k_state>(); alpha68k_state *state = machine.driver_data<alpha68k_state>();
state->membank("bank8")->set_base(machine.region("user1")->base()); state->membank("bank8")->set_base(state->memregion("user1")->base());
state->m_invert_controls = 0; state->m_invert_controls = 0;
state->m_microcontroller_id = 0x8512; state->m_microcontroller_id = 0x8512;
state->m_coin_id = 0x23 | (0x24 << 8); state->m_coin_id = 0x23 | (0x24 << 8);
@ -3289,7 +3289,7 @@ static DRIVER_INIT( gangwars )
static DRIVER_INIT( sbasebal ) static DRIVER_INIT( sbasebal )
{ {
alpha68k_state *state = machine.driver_data<alpha68k_state>(); alpha68k_state *state = machine.driver_data<alpha68k_state>();
UINT16 *rom = (UINT16 *)machine.region("maincpu")->base(); UINT16 *rom = (UINT16 *)state->memregion("maincpu")->base();
/* Patch protection check, it does a divide by zero because the MCU is trying to /* Patch protection check, it does a divide by zero because the MCU is trying to
calculate the ball speed when a strike is scored, notice that current emulation calculate the ball speed when a strike is scored, notice that current emulation

View File

@ -413,7 +413,7 @@ static SCREEN_UPDATE_IND16( amaticmg )
static PALETTE_INIT( amaticmg ) static PALETTE_INIT( amaticmg )
{ {
const UINT8 *color_prom = machine.region("proms")->base(); const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
int bit0, bit1, bit2 , r, g, b; int bit0, bit1, bit2 , r, g, b;
int i; int i;
@ -440,7 +440,7 @@ static PALETTE_INIT( amaticmg )
static PALETTE_INIT( amaticmg3 ) static PALETTE_INIT( amaticmg3 )
{ {
const UINT8 *color_prom = machine.region("proms")->base(); const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
int r, g, b; int r, g, b;
int i; int i;

View File

@ -1405,8 +1405,8 @@ ROM_END
static DRIVER_INIT( rabbitpk ) static DRIVER_INIT( rabbitpk )
{ {
UINT8 *rom = machine.region("maincpu")->base(); UINT8 *rom = machine.root_device().memregion("maincpu")->base();
int size = machine.region("maincpu")->bytes(); int size = machine.root_device().memregion("maincpu")->bytes();
int start = 0; int start = 0;
int i; int i;
@ -1457,7 +1457,7 @@ static DRIVER_INIT( piccolop )
*/ */
UINT8 *rom = machine.region("maincpu")->base(); UINT8 *rom = machine.root_device().memregion("maincpu")->base();
/* NOP'ing the mortal jump... */ /* NOP'ing the mortal jump... */
rom[0x154b] = 0x00; rom[0x154b] = 0x00;

View File

@ -93,7 +93,7 @@ ADDRESS_MAP_END
READ8_MEMBER(amspdwy_state::amspdwy_port_r) READ8_MEMBER(amspdwy_state::amspdwy_port_r)
{ {
UINT8 *tracks = machine().region("maincpu")->base() + 0x10000; UINT8 *tracks = memregion("maincpu")->base() + 0x10000;
return tracks[offset]; return tracks[offset];
} }

View File

@ -744,13 +744,13 @@ ROM_END
static DRIVER_INIT( angelkds ) static DRIVER_INIT( angelkds )
{ {
UINT8 *RAM = machine.region("user1")->base(); UINT8 *RAM = machine.root_device().memregion("user1")->base();
machine.root_device().membank("bank1")->configure_entries(0, 8, &RAM[0x0000], 0x4000); machine.root_device().membank("bank1")->configure_entries(0, 8, &RAM[0x0000], 0x4000);
} }
static DRIVER_INIT( spcpostn ) static DRIVER_INIT( spcpostn )
{ {
UINT8 *RAM = machine.region("user1")->base(); UINT8 *RAM = machine.root_device().memregion("user1")->base();
sega_317_0005_decode(machine, "maincpu"); sega_317_0005_decode(machine, "maincpu");
machine.root_device().membank("bank1")->configure_entries(0, 10, &RAM[0x0000], 0x4000); machine.root_device().membank("bank1")->configure_entries(0, 10, &RAM[0x0000], 0x4000);

View File

@ -177,7 +177,7 @@ static void appoooh_adpcm_int(device_t *device)
{ {
if (state->m_adpcm_data == 0xffffffff) if (state->m_adpcm_data == 0xffffffff)
{ {
UINT8 *RAM = device->machine().region("adpcm")->base(); UINT8 *RAM = state->memregion("adpcm")->base();
state->m_adpcm_data = RAM[state->m_adpcm_address++]; state->m_adpcm_data = RAM[state->m_adpcm_address++];
msm5205_data_w(device, state->m_adpcm_data >> 4); msm5205_data_w(device, state->m_adpcm_data >> 4);
@ -604,7 +604,7 @@ static DRIVER_INIT(robowres)
static DRIVER_INIT(robowresb) static DRIVER_INIT(robowresb)
{ {
address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM); address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
space->set_decrypted_region(0x0000, 0x7fff, machine.region("maincpu")->base() + 0x1c000); space->set_decrypted_region(0x0000, 0x7fff, machine.root_device().memregion("maincpu")->base() + 0x1c000);
} }

View File

@ -239,13 +239,13 @@ static const gfx_layout tilelayout =
static DRIVER_INIT( aquarium ) static DRIVER_INIT( aquarium )
{ {
UINT8 *Z80 = machine.region("audiocpu")->base(); UINT8 *Z80 = machine.root_device().memregion("audiocpu")->base();
/* The BG tiles are 5bpp, this rearranges the data from /* The BG tiles are 5bpp, this rearranges the data from
the roms containing the 1bpp data so we can decode it the roms containing the 1bpp data so we can decode it
correctly */ correctly */
UINT8 *DAT2 = machine.region("gfx1")->base() + 0x080000; UINT8 *DAT2 = machine.root_device().memregion("gfx1")->base() + 0x080000;
UINT8 *DAT = machine.region("user1")->base(); UINT8 *DAT = machine.root_device().memregion("user1")->base();
int len = 0x0200000; int len = 0x0200000;
for (len = 0; len < 0x020000; len++) for (len = 0; len < 0x020000; len++)
@ -260,8 +260,8 @@ static DRIVER_INIT( aquarium )
DAT2[len * 4 + 2] |= (DAT[len] & 0x01) << 3; DAT2[len * 4 + 2] |= (DAT[len] & 0x01) << 3;
} }
DAT2 = machine.region("gfx4")->base() + 0x080000; DAT2 = machine.root_device().memregion("gfx4")->base() + 0x080000;
DAT = machine.region("user2")->base(); DAT = machine.root_device().memregion("user2")->base();
for (len = 0; len < 0x020000; len++) for (len = 0; len < 0x020000; len++)
{ {

View File

@ -398,7 +398,7 @@ ROM_END
static DRIVER_INIT( sparkz ) static DRIVER_INIT( sparkz )
{ {
memset(machine.region("gfx1")->base(), 0, machine.region("gfx1")->bytes()); memset(machine.root_device().memregion("gfx1")->base(), 0, machine.root_device().memregion("gfx1")->bytes());
} }

View File

@ -757,7 +757,7 @@ ROM_END
INLINE void generic_decode(running_machine &machine, const char *tag, int bit7, int bit6, int bit5, int bit4, int bit3, int bit2, int bit1, int bit0) INLINE void generic_decode(running_machine &machine, const char *tag, int bit7, int bit6, int bit5, int bit4, int bit3, int bit2, int bit1, int bit0)
{ {
UINT16 *rom = (UINT16 *)machine.region(tag)->base(); UINT16 *rom = (UINT16 *)machine.root_device().memregion(tag)->base();
int i; int i;
/* only the low byte of ROMs are encrypted in these games */ /* only the low byte of ROMs are encrypted in these games */
@ -766,8 +766,8 @@ INLINE void generic_decode(running_machine &machine, const char *tag, int bit7,
#if 0 #if 0
{ {
UINT8 *ROM = machine.region(tag)->base(); UINT8 *ROM = machine.root_device().memregion(tag)->base();
int size = machine.region(tag)->bytes(); int size = machine.root_device().memregion(tag)->bytes();
FILE *fp; FILE *fp;
char filename[256]; char filename[256];
@ -809,10 +809,10 @@ static void arcadia_init(running_machine &machine)
/* set up memory */ /* set up memory */
state->membank("bank1")->configure_entry(0, state->m_chip_ram); state->membank("bank1")->configure_entry(0, state->m_chip_ram);
state->membank("bank1")->configure_entry(1, machine.region("user1")->base()); state->membank("bank1")->configure_entry(1, machine.root_device().memregion("user1")->base());
/* OnePlay bios is encrypted, TenPlay is not */ /* OnePlay bios is encrypted, TenPlay is not */
biosrom = (UINT16 *)machine.region("user2")->base(); biosrom = (UINT16 *)machine.root_device().memregion("user2")->base();
if (biosrom[0] != 0x4afc) if (biosrom[0] != 0x4afc)
generic_decode(machine, "user2", 6, 1, 0, 2, 3, 4, 5, 7); generic_decode(machine, "user2", 6, 1, 0, 2, 3, 4, 5, 7);
} }

View File

@ -176,7 +176,7 @@ static const ym2203_interface ym2203_config =
WRITE8_MEMBER(argus_state::argus_bankselect_w) WRITE8_MEMBER(argus_state::argus_bankselect_w)
{ {
UINT8 *RAM = machine().region("maincpu")->base(); UINT8 *RAM = memregion("maincpu")->base();
int bankaddress; int bankaddress;
bankaddress = 0x10000 + ((data & 7) * 0x4000); bankaddress = 0x10000 + ((data & 7) * 0x4000);

View File

@ -1587,7 +1587,7 @@ static const ppi8255_interface ppi8255_intf1 =
/* same as Casino Winner HW */ /* same as Casino Winner HW */
static PALETTE_INIT( aristmk4 ) static PALETTE_INIT( aristmk4 )
{ {
const UINT8 *color_prom = machine.region("proms")->base(); const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
int i; int i;
for (i = 0;i < machine.total_colors();i++) for (i = 0;i < machine.total_colors();i++)
@ -1614,7 +1614,7 @@ static PALETTE_INIT( aristmk4 )
static DRIVER_INIT( aristmk4 ) static DRIVER_INIT( aristmk4 )
{ {
aristmk4_state *state = machine.driver_data<aristmk4_state>(); aristmk4_state *state = machine.driver_data<aristmk4_state>();
state->m_shapeRomPtr = (UINT8 *)machine.region("tile_gfx")->base(); state->m_shapeRomPtr = (UINT8 *)state->memregion("tile_gfx")->base();
memcpy(state->m_shapeRom,state->m_shapeRomPtr,sizeof(state->m_shapeRom)); // back up memcpy(state->m_shapeRom,state->m_shapeRomPtr,sizeof(state->m_shapeRom)); // back up
state->m_nvram = auto_alloc_array(machine, UINT8, 0x1000); state->m_nvram = auto_alloc_array(machine, UINT8, 0x1000);
} }

View File

@ -359,8 +359,8 @@ INPUT_PORTS_END
static DRIVER_INIT( aristmk5 ) static DRIVER_INIT( aristmk5 )
{ {
UINT8 *SRAM = machine.region("sram")->base(); UINT8 *SRAM = machine.root_device().memregion("sram")->base();
UINT8 *SRAM_NZ = machine.region("sram")->base(); UINT8 *SRAM_NZ = machine.root_device().memregion("sram")->base();
archimedes_driver_init(machine); archimedes_driver_init(machine);
@ -392,15 +392,15 @@ static MACHINE_RESET( aristmk5 )
/* load the roms according to what the operator wants */ /* load the roms according to what the operator wants */
{ {
UINT8 *ROM = machine.region("maincpu")->base(); UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
UINT8 *PRG;// = machine.region("prg_code")->base(); UINT8 *PRG;// = state->memregion("prg_code")->base();
int i; int i;
UINT8 op_mode; UINT8 op_mode;
static const char *const rom_region[] = { "set_chip_4.04", "set_chip_4.4", "clear_chip", "game_prg" }; static const char *const rom_region[] = { "set_chip_4.04", "set_chip_4.4", "clear_chip", "game_prg" };
op_mode = input_port_read(machine, "ROM_LOAD"); op_mode = input_port_read(machine, "ROM_LOAD");
PRG = machine.region(rom_region[op_mode & 3])->base(); PRG = machine.root_device().memregion(rom_region[op_mode & 3])->base();
if(PRG!=NULL) if(PRG!=NULL)

View File

@ -33,7 +33,7 @@ SCREEN_UPDATE_RGB32(aristmk6)
aristmk6_state *state = screen.machine().driver_data<aristmk6_state>(); aristmk6_state *state = screen.machine().driver_data<aristmk6_state>();
int x,y,count; int x,y,count;
const UINT8 *blit_ram = screen.machine().region("maincpu")->base(); const UINT8 *blit_ram = state->memregion("maincpu")->base();
if(screen.machine().input().code_pressed(KEYCODE_Z)) if(screen.machine().input().code_pressed(KEYCODE_Z))
state->m_test_x++; state->m_test_x++;

Some files were not shown because too many files have changed in this diff Show More