Switch from m_machine to machine() everywhere. In some cases this

meant adding a machine() accessor but it's worth it for consistency.
This will allow future changes from reference to pointer to happen
transparently for devices. [Aaron Giles]

Simple S&R:
m_machine( *[^ (!=;])
machine()\1
This commit is contained in:
Aaron Giles 2011-04-18 20:06:43 +00:00
parent 4e7f194a63
commit fecfc465df
96 changed files with 643 additions and 626 deletions

View File

@ -1125,7 +1125,7 @@ cheat_manager::cheat_manager(running_machine &machine)
void cheat_manager::set_enable(bool enable) void cheat_manager::set_enable(bool enable)
{ {
// if the cheat engine is disabled, we're done // if the cheat engine is disabled, we're done
if (!m_machine.options().cheat()) if (!machine().options().cheat())
return; return;
// if we're enabled currently and we don't want to be, turn things off // if we're enabled currently and we don't want to be, turn things off
@ -1160,7 +1160,7 @@ void cheat_manager::set_enable(bool enable)
void cheat_manager::reload() void cheat_manager::reload()
{ {
// if the cheat engine is disabled, we're done // if the cheat engine is disabled, we're done
if (!m_machine.options().cheat()) if (!machine().options().cheat())
return; return;
// free everything // free everything
@ -1175,7 +1175,7 @@ void cheat_manager::reload()
// load the cheat file, MESS will load a crc32.xml ( eg. 01234567.xml ) // load the cheat file, MESS will load a crc32.xml ( eg. 01234567.xml )
// and MAME will load gamename.xml // and MAME will load gamename.xml
device_image_interface *image = NULL; device_image_interface *image = NULL;
for (bool gotone = m_machine.m_devicelist.first(image); gotone; gotone = image->next(image)) for (bool gotone = machine().m_devicelist.first(image); gotone; gotone = image->next(image))
if (image->exists()) if (image->exists())
{ {
// if we are loading through software lists, try to load shortname.xml // if we are loading through software lists, try to load shortname.xml
@ -1199,7 +1199,7 @@ void cheat_manager::reload()
// if we haven't found the cheats yet, load by basename // if we haven't found the cheats yet, load by basename
if (m_cheatlist.count() == 0) if (m_cheatlist.count() == 0)
load_cheats(m_machine.basename()); load_cheats(machine().basename());
// temporary: save the file back out as output.xml for comparison // temporary: save the file back out as output.xml for comparison
if (m_cheatlist.count() != 0) if (m_cheatlist.count() != 0)
@ -1215,7 +1215,7 @@ void cheat_manager::reload()
bool cheat_manager::save_all(const char *filename) bool cheat_manager::save_all(const char *filename)
{ {
// open the file with the proper name // open the file with the proper name
emu_file cheatfile(m_machine.options().cheat_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); emu_file cheatfile(machine().options().cheat_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
file_error filerr = cheatfile.open(filename, ".xml"); file_error filerr = cheatfile.open(filename, ".xml");
// if that failed, return nothing // if that failed, return nothing
@ -1262,7 +1262,7 @@ void cheat_manager::render_text(render_container &container)
{ {
// output the text // output the text
ui_draw_text_full(&container, m_output[linenum], ui_draw_text_full(&container, m_output[linenum],
0.0f, (float)linenum * ui_get_line_height(m_machine), 1.0f, 0.0f, (float)linenum * ui_get_line_height(machine()), 1.0f,
m_justify[linenum], WRAP_NEVER, DRAW_OPAQUE, m_justify[linenum], WRAP_NEVER, DRAW_OPAQUE,
ARGB_WHITE, ARGB_BLACK, NULL, NULL); ARGB_WHITE, ARGB_BLACK, NULL, NULL);
} }
@ -1389,7 +1389,7 @@ void cheat_manager::frame_update()
{ {
// set up for accumulating output // set up for accumulating output
m_lastline = 0; m_lastline = 0;
m_numlines = floor(1.0f / ui_get_line_height(m_machine)); m_numlines = floor(1.0f / ui_get_line_height(machine()));
m_numlines = MIN(m_numlines, ARRAY_LENGTH(m_output)); m_numlines = MIN(m_numlines, ARRAY_LENGTH(m_output));
for (int linenum = 0; linenum < ARRAY_LENGTH(m_output); linenum++) for (int linenum = 0; linenum < ARRAY_LENGTH(m_output); linenum++)
m_output[linenum].reset(); m_output[linenum].reset();
@ -1411,7 +1411,7 @@ void cheat_manager::frame_update()
void cheat_manager::load_cheats(const char *filename) void cheat_manager::load_cheats(const char *filename)
{ {
xml_data_node *rootnode = NULL; xml_data_node *rootnode = NULL;
emu_file cheatfile(m_machine.options().cheat_path(), OPEN_FLAG_READ); emu_file cheatfile(machine().options().cheat_path(), OPEN_FLAG_READ);
try try
{ {
// open the file with the proper name // open the file with the proper name
@ -1446,7 +1446,7 @@ void cheat_manager::load_cheats(const char *filename)
for (xml_data_node *cheatnode = xml_get_sibling(mamecheatnode->child, "cheat"); cheatnode != NULL; cheatnode = xml_get_sibling(cheatnode->next, "cheat")) for (xml_data_node *cheatnode = xml_get_sibling(mamecheatnode->child, "cheat"); cheatnode != NULL; cheatnode = xml_get_sibling(cheatnode->next, "cheat"))
{ {
// load this entry // load this entry
cheat_entry *curcheat = auto_alloc(m_machine, cheat_entry(*this, m_symtable, filename, *cheatnode)); cheat_entry *curcheat = auto_alloc(machine(), cheat_entry(*this, m_symtable, filename, *cheatnode));
// make sure we're not a duplicate // make sure we're not a duplicate
cheat_entry *scannode = NULL; cheat_entry *scannode = NULL;
@ -1462,7 +1462,7 @@ void cheat_manager::load_cheats(const char *filename)
if (scannode == NULL) if (scannode == NULL)
m_cheatlist.append(*curcheat); m_cheatlist.append(*curcheat);
else else
auto_free(m_machine, curcheat); auto_free(machine(), curcheat);
} }
// free the file and loop for the next one // free the file and loop for the next one

View File

@ -1263,7 +1263,7 @@ void adsp21xx_device::execute_set_input(int inputnum, int state)
void adsp21xx_device::execute_run() void adsp21xx_device::execute_run()
{ {
bool check_debugger = ((device_t::m_machine.debug_flags & DEBUG_FLAG_ENABLED) != 0); bool check_debugger = ((device_t::machine().debug_flags & DEBUG_FLAG_ENABLED) != 0);
check_irqs(); check_irqs();

View File

@ -635,7 +635,7 @@ void asap_device::execute_run()
check_irqs(); check_irqs();
// core execution loop // core execution loop
if ((device_t::m_machine.debug_flags & DEBUG_FLAG_ENABLED) == 0) if ((device_t::machine().debug_flags & DEBUG_FLAG_ENABLED) == 0)
{ {
do do
{ {

View File

@ -726,7 +726,7 @@ inline void cosmac_device::run()
inline void cosmac_device::debug() inline void cosmac_device::debug()
{ {
if (device_t::m_machine.debug_flags & DEBUG_FLAG_ENABLED) if (device_t::machine().debug_flags & DEBUG_FLAG_ENABLED)
{ {
debugger_instruction_hook(this, R[P]); debugger_instruction_hook(this, R[P]);
} }

View File

@ -232,7 +232,7 @@ void dsp16_device::execute_set_input(int inputnum, int state)
void dsp16_device::execute_run() void dsp16_device::execute_run()
{ {
bool check_debugger = ((device_t::m_machine.debug_flags & DEBUG_FLAG_ENABLED) != 0); bool check_debugger = ((device_t::machine().debug_flags & DEBUG_FLAG_ENABLED) != 0);
do do
{ {

View File

@ -232,7 +232,7 @@ void psxcpu_device::set_biu( UINT32 data, UINT32 mem_mask )
void psxcpu_device::stop() void psxcpu_device::stop()
{ {
debugger_break( m_machine ); debugger_break( machine() );
debugger_instruction_hook( this, m_pc ); debugger_instruction_hook( this, m_pc );
} }

View File

@ -100,10 +100,10 @@
void tms3203x_device::illegal(UINT32 op) void tms3203x_device::illegal(UINT32 op)
{ {
if ((m_machine.debug_flags & DEBUG_FLAG_ENABLED) != 0) if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0)
{ {
logerror("Illegal op @ %06X: %08X (tbl=%03X)\n", m_pc - 1, op, op >> 21); logerror("Illegal op @ %06X: %08X (tbl=%03X)\n", m_pc - 1, op, op >> 21);
debugger_break(m_machine); debugger_break(machine());
} }
} }
@ -5496,7 +5496,7 @@ inline void tms3203x_device::execute_delayed(UINT32 newpc)
{ {
m_delayed = true; m_delayed = true;
if ((m_machine.debug_flags & DEBUG_FLAG_ENABLED) == 0) if ((machine().debug_flags & DEBUG_FLAG_ENABLED) == 0)
{ {
execute_one(); execute_one();
execute_one(); execute_one();

View File

@ -819,7 +819,7 @@ void tms3203x_device::execute_run()
} }
// non-debug case // non-debug case
if ((m_machine.debug_flags & DEBUG_FLAG_ENABLED) == 0) if ((machine().debug_flags & DEBUG_FLAG_ENABLED) == 0)
{ {
while (m_icount > 0) while (m_icount > 0)
{ {
@ -854,7 +854,7 @@ void tms3203x_device::execute_run()
{ {
// watch for out-of-range stack pointers // watch for out-of-range stack pointers
if (IREG(TMR_SP) & 0xff000000) if (IREG(TMR_SP) & 0xff000000)
debugger_break(m_machine); debugger_break(machine());
if ((IREG(TMR_ST) & RMFLAG) && m_pc == IREG(TMR_RE) + 1) if ((IREG(TMR_ST) & RMFLAG) && m_pc == IREG(TMR_RE) + 1)
{ {
if ((INT32)--IREG(TMR_RC) >= 0) if ((INT32)--IREG(TMR_RC) >= 0)

View File

@ -400,7 +400,7 @@ void necdsp_device::execute_run()
do do
{ {
// call debugger hook if necessary // call debugger hook if necessary
if (device_t::m_machine.debug_flags & DEBUG_FLAG_ENABLED) if (device_t::machine().debug_flags & DEBUG_FLAG_ENABLED)
{ {
debugger_instruction_hook(this, regs.pc); debugger_instruction_hook(this, regs.pc);
} }

View File

@ -147,7 +147,7 @@ void debug_view_source_list::reset()
{ {
debug_view_source *source = m_head; debug_view_source *source = m_head;
m_head = source->m_next; m_head = source->m_next;
auto_free(m_machine, source); auto_free(machine(), source);
} }
// reset the tail pointer and index // reset the tail pointer and index
@ -256,8 +256,8 @@ void debug_view::end_update()
if (size > m_viewdata_size) if (size > m_viewdata_size)
{ {
m_viewdata_size = size; m_viewdata_size = size;
auto_free(m_machine, m_viewdata); auto_free(machine(), m_viewdata);
m_viewdata = auto_alloc_array(m_machine, debug_view_char, m_viewdata_size); m_viewdata = auto_alloc_array(machine(), debug_view_char, m_viewdata_size);
} }
// update the view // update the view
@ -450,7 +450,7 @@ debug_view_manager::~debug_view_manager()
{ {
debug_view *oldhead = m_viewlist; debug_view *oldhead = m_viewlist;
m_viewlist = oldhead->m_next; m_viewlist = oldhead->m_next;
auto_free(m_machine, oldhead); auto_free(machine(), oldhead);
} }
} }
@ -464,25 +464,25 @@ debug_view *debug_view_manager::alloc_view(debug_view_type type, debug_view_osd_
switch (type) switch (type)
{ {
case DVT_CONSOLE: case DVT_CONSOLE:
return append(auto_alloc(m_machine, debug_view_console(m_machine, osdupdate, osdprivate))); return append(auto_alloc(machine(), debug_view_console(machine(), osdupdate, osdprivate)));
case DVT_STATE: case DVT_STATE:
return append(auto_alloc(m_machine, debug_view_state(m_machine, osdupdate, osdprivate))); return append(auto_alloc(machine(), debug_view_state(machine(), osdupdate, osdprivate)));
case DVT_DISASSEMBLY: case DVT_DISASSEMBLY:
return append(auto_alloc(m_machine, debug_view_disasm(m_machine, osdupdate, osdprivate))); return append(auto_alloc(machine(), debug_view_disasm(machine(), osdupdate, osdprivate)));
case DVT_MEMORY: case DVT_MEMORY:
return append(auto_alloc(m_machine, debug_view_memory(m_machine, osdupdate, osdprivate))); return append(auto_alloc(machine(), debug_view_memory(machine(), osdupdate, osdprivate)));
case DVT_LOG: case DVT_LOG:
return append(auto_alloc(m_machine, debug_view_log(m_machine, osdupdate, osdprivate))); return append(auto_alloc(machine(), debug_view_log(machine(), osdupdate, osdprivate)));
case DVT_TIMERS: case DVT_TIMERS:
// return append(auto_alloc(m_machine, debug_view_timers(m_machine, osdupdate, osdprivate))); // return append(auto_alloc(machine(), debug_view_timers(machine(), osdupdate, osdprivate)));
case DVT_ALLOCS: case DVT_ALLOCS:
// return append(auto_alloc(m_machine, debug_view_allocs(m_machine, osdupdate, osdprivate))); // return append(auto_alloc(machine(), debug_view_allocs(machine(), osdupdate, osdprivate)));
default: default:
fatalerror("Attempt to create invalid debug view type %d\n", type); fatalerror("Attempt to create invalid debug view type %d\n", type);
@ -502,7 +502,7 @@ void debug_view_manager::free_view(debug_view &view)
if (*viewptr == &view) if (*viewptr == &view)
{ {
*viewptr = view.m_next; *viewptr = view.m_next;
auto_free(m_machine, &view); auto_free(machine(), &view);
break; break;
} }
} }
@ -581,7 +581,7 @@ debug_view_expression::~debug_view_expression()
void debug_view_expression::set_context(symbol_table *context) void debug_view_expression::set_context(symbol_table *context)
{ {
m_parsed.set_symbols((context != NULL) ? context : debug_cpu_get_global_symtable(m_machine)); m_parsed.set_symbols((context != NULL) ? context : debug_cpu_get_global_symtable(machine()));
m_dirty = true; m_dirty = true;
} }

View File

@ -165,6 +165,7 @@ public:
~debug_view_source_list(); ~debug_view_source_list();
// getters // getters
running_machine &machine() const { return m_machine; }
const debug_view_source *head() const { return m_head; } const debug_view_source *head() const { return m_head; }
int count() const { return m_count; } int count() const { return m_count; }
int index(const debug_view_source &source) const; int index(const debug_view_source &source) const;
@ -274,6 +275,9 @@ public:
debug_view_manager(running_machine &machine); debug_view_manager(running_machine &machine);
~debug_view_manager(); ~debug_view_manager();
// getters
running_machine &machine() const { return m_machine; }
// view allocation // view allocation
debug_view *alloc_view(debug_view_type type, debug_view_osd_update_func osdupdate, void *osdprivate); debug_view *alloc_view(debug_view_type type, debug_view_osd_update_func osdupdate, void *osdprivate);
void free_view(debug_view &view); void free_view(debug_view &view);
@ -301,6 +305,7 @@ public:
~debug_view_expression(); ~debug_view_expression();
// getters // getters
running_machine &machine() const { return m_machine; }
bool dirty() const { return m_dirty; } bool dirty() const { return m_dirty; }
UINT64 last_value() const { return m_result; } UINT64 last_value() const { return m_result; }
UINT64 value() { recompute(); return m_result; } UINT64 value() { recompute(); return m_result; }

View File

@ -116,8 +116,8 @@ debug_view_disasm::debug_view_disasm(running_machine &machine, debug_view_osd_up
debug_view_disasm::~debug_view_disasm() debug_view_disasm::~debug_view_disasm()
{ {
auto_free(m_machine, m_byteaddress); auto_free(machine(), m_byteaddress);
auto_free(m_machine, m_dasm); auto_free(machine(), m_dasm);
} }
@ -134,10 +134,10 @@ void debug_view_disasm::enumerate_sources()
// iterate over devices with disassembly interfaces // iterate over devices with disassembly interfaces
device_disasm_interface *dasm = NULL; device_disasm_interface *dasm = NULL;
astring name; astring name;
for (bool gotone = m_machine.m_devicelist.first(dasm); gotone; gotone = dasm->next(dasm)) for (bool gotone = machine().m_devicelist.first(dasm); gotone; gotone = dasm->next(dasm))
{ {
name.printf("%s '%s'", dasm->device().name(), dasm->device().tag()); name.printf("%s '%s'", dasm->device().name(), dasm->device().tag());
m_source_list.append(*auto_alloc(m_machine, debug_view_disasm_source(name, dasm->device()))); m_source_list.append(*auto_alloc(machine(), debug_view_disasm_source(name, dasm->device())));
} }
// reset the source to a known good entry // reset the source to a known good entry
@ -377,12 +377,12 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines)
m_allocated = m_total; m_allocated = m_total;
// allocate address array // allocate address array
auto_free(m_machine, m_byteaddress); auto_free(machine(), m_byteaddress);
m_byteaddress = auto_alloc_array(m_machine, offs_t, m_allocated.y); m_byteaddress = auto_alloc_array(machine(), offs_t, m_allocated.y);
// allocate disassembly buffer // allocate disassembly buffer
auto_free(m_machine, m_dasm); auto_free(machine(), m_dasm);
m_dasm = auto_alloc_array(m_machine, char, m_allocated.x * m_allocated.y); m_dasm = auto_alloc_array(machine(), char, m_allocated.x * m_allocated.y);
} }
// iterate over lines // iterate over lines

View File

@ -153,22 +153,22 @@ void debug_view_memory::enumerate_sources()
// first add all the devices' address spaces // first add all the devices' address spaces
device_memory_interface *memintf = NULL; device_memory_interface *memintf = NULL;
for (bool gotone = m_machine.m_devicelist.first(memintf); gotone; gotone = memintf->next(memintf)) for (bool gotone = machine().m_devicelist.first(memintf); gotone; gotone = memintf->next(memintf))
for (address_spacenum spacenum = AS_0; spacenum < ADDRESS_SPACES; spacenum++) for (address_spacenum spacenum = AS_0; spacenum < ADDRESS_SPACES; spacenum++)
{ {
address_space *space = memintf->space(spacenum); address_space *space = memintf->space(spacenum);
if (space != NULL) if (space != NULL)
{ {
name.printf("%s '%s' %s space memory", memintf->device().name(), memintf->device().tag(), space->name()); name.printf("%s '%s' %s space memory", memintf->device().name(), memintf->device().tag(), space->name());
m_source_list.append(*auto_alloc(m_machine, debug_view_memory_source(name, *space))); m_source_list.append(*auto_alloc(machine(), debug_view_memory_source(name, *space)));
} }
} }
// then add all the memory regions // then add all the memory regions
for (const memory_region *region = m_machine.first_region(); region != NULL; region = region->next()) for (const memory_region *region = machine().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(m_machine, debug_view_memory_source(name, *region))); m_source_list.append(*auto_alloc(machine(), debug_view_memory_source(name, *region)));
} }
// finally add all global array symbols // finally add all global array symbols
@ -177,7 +177,7 @@ void debug_view_memory::enumerate_sources()
// stop when we run out of items // stop when we run out of items
UINT32 valsize, valcount; UINT32 valsize, valcount;
void *base; void *base;
const char *itemname = m_machine.state().indexed_item(itemnum, base, valsize, valcount); const char *itemname = machine().state().indexed_item(itemnum, base, valsize, valcount);
if (itemname == NULL) if (itemname == NULL)
break; break;
@ -185,7 +185,7 @@ void debug_view_memory::enumerate_sources()
if (valcount > 1 && strstr(itemname, "globals/")) if (valcount > 1 && strstr(itemname, "globals/"))
{ {
name.cpy(strrchr(itemname, '/') + 1); name.cpy(strrchr(itemname, '/') + 1);
m_source_list.append(*auto_alloc(m_machine, debug_view_memory_source(name, base, valsize, valcount))); m_source_list.append(*auto_alloc(machine(), debug_view_memory_source(name, base, valsize, valcount)));
} }
} }
@ -707,10 +707,10 @@ 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 == m_machine.region("user2")) if (source.m_base == machine().region("user2"))
{ {
extern void fd1094_regenerate_key(running_machine &machine); extern void fd1094_regenerate_key(running_machine &machine);
fd1094_regenerate_key(m_machine); fd1094_regenerate_key(machine());
} }
#endif #endif
} }

View File

@ -105,10 +105,10 @@ void debug_view_state::enumerate_sources()
// iterate over devices that have state interfaces // iterate over devices that have state interfaces
device_state_interface *state = NULL; device_state_interface *state = NULL;
astring name; astring name;
for (bool gotone = m_machine.m_devicelist.first(state); gotone; gotone = state->next(state)) for (bool gotone = machine().m_devicelist.first(state); gotone; gotone = state->next(state))
{ {
name.printf("%s '%s'", state->device().name(), state->device().tag()); name.printf("%s '%s'", state->device().name(), state->device().tag());
m_source_list.append(*auto_alloc(m_machine, debug_view_state_source(name, state->device()))); m_source_list.append(*auto_alloc(machine(), debug_view_state_source(name, state->device())));
} }
// reset the source to a known good entry // reset the source to a known good entry
@ -127,7 +127,7 @@ void debug_view_state::reset()
{ {
state_item *oldhead = m_state_list; state_item *oldhead = m_state_list;
m_state_list = oldhead->m_next; m_state_list = oldhead->m_next;
auto_free(m_machine, oldhead); auto_free(machine(), oldhead);
} }
} }
@ -146,34 +146,34 @@ void debug_view_state::recompute()
// add a cycles entry: cycles:99999999 // add a cycles entry: cycles:99999999
state_item **tailptr = &m_state_list; state_item **tailptr = &m_state_list;
*tailptr = auto_alloc(m_machine, state_item(REG_CYCLES, "cycles", 8)); *tailptr = auto_alloc(machine(), state_item(REG_CYCLES, "cycles", 8));
tailptr = &(*tailptr)->m_next; tailptr = &(*tailptr)->m_next;
// add a beam entry: beamx:1234 // add a beam entry: beamx:1234
*tailptr = auto_alloc(m_machine, state_item(REG_BEAMX, "beamx", 4)); *tailptr = auto_alloc(machine(), state_item(REG_BEAMX, "beamx", 4));
tailptr = &(*tailptr)->m_next; tailptr = &(*tailptr)->m_next;
// add a beam entry: beamy:5678 // add a beam entry: beamy:5678
*tailptr = auto_alloc(m_machine, state_item(REG_BEAMY, "beamy", 4)); *tailptr = auto_alloc(machine(), state_item(REG_BEAMY, "beamy", 4));
tailptr = &(*tailptr)->m_next; tailptr = &(*tailptr)->m_next;
// add a beam entry: frame:123456 // add a beam entry: frame:123456
*tailptr = auto_alloc(m_machine, state_item(REG_FRAME, "frame", 6)); *tailptr = auto_alloc(machine(), state_item(REG_FRAME, "frame", 6));
tailptr = &(*tailptr)->m_next; tailptr = &(*tailptr)->m_next;
// add a flags entry: flags:xxxxxxxx // add a flags entry: flags:xxxxxxxx
*tailptr = auto_alloc(m_machine, state_item(STATE_GENFLAGS, "flags", source.m_stateintf->state_string_max_length(STATE_GENFLAGS))); *tailptr = auto_alloc(machine(), state_item(STATE_GENFLAGS, "flags", source.m_stateintf->state_string_max_length(STATE_GENFLAGS)));
tailptr = &(*tailptr)->m_next; tailptr = &(*tailptr)->m_next;
// add a divider entry // add a divider entry
*tailptr = auto_alloc(m_machine, state_item(REG_DIVIDER, "", 0)); *tailptr = auto_alloc(machine(), state_item(REG_DIVIDER, "", 0));
tailptr = &(*tailptr)->m_next; tailptr = &(*tailptr)->m_next;
// add all registers into it // add all registers into it
for (const device_state_entry *entry = source.m_stateintf->state_first(); entry != NULL; entry = entry->next()) for (const device_state_entry *entry = source.m_stateintf->state_first(); entry != NULL; entry = entry->next())
if (entry->visible()) if (entry->visible())
{ {
*tailptr = auto_alloc(m_machine, state_item(entry->index(), entry->symbol(), source.m_stateintf->state_string_max_length(entry->index()))); *tailptr = auto_alloc(machine(), state_item(entry->index(), entry->symbol(), source.m_stateintf->state_string_max_length(entry->index())));
tailptr = &(*tailptr)->m_next; tailptr = &(*tailptr)->m_next;
} }
@ -235,7 +235,7 @@ void debug_view_state::view_update()
curitem = curitem->m_next; curitem = curitem->m_next;
// loop over visible rows // loop over visible rows
screen_device *screen = m_machine.primary_screen; screen_device *screen = machine().primary_screen;
debug_view_char *dest = m_viewdata; debug_view_char *dest = m_viewdata;
for (UINT32 row = 0; row < m_visible.y; row++) for (UINT32 row = 0; row < m_visible.y; row++)
{ {

View File

@ -186,7 +186,7 @@ public:
~DView() ~DView()
{ {
this->target->debug_free(*this->container); this->target->debug_free(*this->container);
m_machine->debug_view().free_view(*this->view); machine().debug_view().free_view(*this->view);
} }
running_machine &machine() const { assert(m_machine != NULL); return *m_machine; } running_machine &machine() const { assert(m_machine != NULL); return *m_machine; }

View File

@ -320,7 +320,7 @@ bool legacy_image_device_base::load_software(char *swlist, char *swname, rom_ent
// " swlist % clonename % parentname " // " swlist % clonename % parentname "
// below, we have the code to split the elements and to create paths to load from // below, we have the code to split the elements and to create paths to load from
software_list *software_list_ptr = software_list_open(m_machine.options(), swlist, FALSE, NULL); software_list *software_list_ptr = software_list_open(machine().options(), swlist, FALSE, NULL);
if (software_list_ptr) if (software_list_ptr)
{ {
for (software_info *swinfo = software_list_find(software_list_ptr, swname, NULL); swinfo != NULL; ) for (software_info *swinfo = software_list_find(software_list_ptr, swname, NULL); swinfo != NULL; )
@ -332,7 +332,7 @@ bool legacy_image_device_base::load_software(char *swlist, char *swname, rom_ent
locationtag.cat(breakstr); locationtag.cat(breakstr);
//printf("%s\n", locationtag.cstr()); //printf("%s\n", locationtag.cstr());
} }
const char *parentname = software_get_clone(m_machine.options(), swlist, swinfo->shortname); const char *parentname = software_get_clone(machine().options(), swlist, swinfo->shortname);
if (parentname != NULL) if (parentname != NULL)
swinfo = software_list_find(software_list_ptr, parentname, NULL); swinfo = software_list_find(software_list_ptr, parentname, NULL);
else else
@ -343,10 +343,10 @@ bool legacy_image_device_base::load_software(char *swlist, char *swname, rom_ent
software_list_close(software_list_ptr); software_list_close(software_list_ptr);
} }
if (software_get_support(m_machine.options(), swlist, swname) == SOFTWARE_SUPPORTED_PARTIAL) if (software_get_support(machine().options(), swlist, swname) == SOFTWARE_SUPPORTED_PARTIAL)
mame_printf_error("WARNING: support for software %s (in list %s) is only partial\n", swname, swlist); mame_printf_error("WARNING: support for software %s (in list %s) is only partial\n", swname, swlist);
if (software_get_support(m_machine.options(), swlist, swname) == SOFTWARE_SUPPORTED_NO) if (software_get_support(machine().options(), swlist, swname) == SOFTWARE_SUPPORTED_NO)
mame_printf_error("WARNING: support for software %s (in list %s) is only preliminary\n", swname, swlist); mame_printf_error("WARNING: support for software %s (in list %s) is only preliminary\n", swname, swlist);
// check if locationtag actually contains two locations separated by '%' // check if locationtag actually contains two locations separated by '%'
@ -376,16 +376,16 @@ bool legacy_image_device_base::load_software(char *swlist, char *swname, rom_ent
// - if we are using lists, we have: list/clonename, list/parentname, clonename, parentname // - if we are using lists, we have: list/clonename, list/parentname, clonename, parentname
// try to load from list/setname // try to load from list/setname
if ((m_mame_file == NULL) && (tag2.cstr() != NULL)) if ((m_mame_file == NULL) && (tag2.cstr() != NULL))
filerr = common_process_file(m_machine.options(), tag2.cstr(), has_crc, crc, romp, &m_mame_file); filerr = common_process_file(machine().options(), tag2.cstr(), has_crc, crc, romp, &m_mame_file);
// try to load from list/parentname // try to load from list/parentname
if ((m_mame_file == NULL) && (tag3.cstr() != NULL)) if ((m_mame_file == NULL) && (tag3.cstr() != NULL))
filerr = common_process_file(m_machine.options(), tag3.cstr(), has_crc, crc, romp, &m_mame_file); filerr = common_process_file(machine().options(), tag3.cstr(), has_crc, crc, romp, &m_mame_file);
// try to load from setname // try to load from setname
if ((m_mame_file == NULL) && (tag4.cstr() != NULL)) if ((m_mame_file == NULL) && (tag4.cstr() != NULL))
filerr = common_process_file(m_machine.options(), tag4.cstr(), has_crc, crc, romp, &m_mame_file); filerr = common_process_file(machine().options(), tag4.cstr(), has_crc, crc, romp, &m_mame_file);
// try to load from parentname // try to load from parentname
if ((m_mame_file == NULL) && (tag5.cstr() != NULL)) if ((m_mame_file == NULL) && (tag5.cstr() != NULL))
filerr = common_process_file(m_machine.options(), tag5.cstr(), has_crc, crc, romp, &m_mame_file); filerr = common_process_file(machine().options(), tag5.cstr(), has_crc, crc, romp, &m_mame_file);
if (filerr == FILERR_NONE) if (filerr == FILERR_NONE)
{ {
@ -489,7 +489,7 @@ done:
if (m_err!=0) { if (m_err!=0) {
if (!m_init_phase) if (!m_init_phase)
{ {
if (m_machine.phase() == MACHINE_PHASE_RUNNING) if (machine().phase() == MACHINE_PHASE_RUNNING)
popmessage("Error: Unable to %s image '%s': %s\n", is_create ? "create" : "load", path, error()); popmessage("Error: Unable to %s image '%s': %s\n", is_create ? "create" : "load", path, error());
else else
mame_printf_error("Error: Unable to %s image '%s': %s", is_create ? "create" : "load", path, error()); mame_printf_error("Error: Unable to %s image '%s': %s", is_create ? "create" : "load", path, error());
@ -504,7 +504,7 @@ done:
{ {
if (!m_init_phase) if (!m_init_phase)
{ {
if (m_machine.phase() == MACHINE_PHASE_RUNNING) if (machine().phase() == MACHINE_PHASE_RUNNING)
popmessage("Image '%s' was successfully %s.", path, is_create ? "created" : "loaded"); popmessage("Image '%s' was successfully %s.", path, is_create ? "created" : "loaded");
else else
mame_printf_info("Image '%s' was successfully %s.\n", path, is_create ? "created" : "loaded"); mame_printf_info("Image '%s' was successfully %s.\n", path, is_create ? "created" : "loaded");

View File

@ -114,7 +114,7 @@ void device_list::import_config_list(const device_config_list &list, running_mac
// append each device from the configuration list // append each device from the configuration list
for (const device_config *devconfig = list.first(); devconfig != NULL; devconfig = devconfig->next()) for (const device_config *devconfig = list.first(); devconfig != NULL; devconfig = devconfig->next())
{ {
device_t *newdevice = devconfig->alloc_device(*m_machine); device_t *newdevice = devconfig->alloc_device(machine);
append(devconfig->tag(), *newdevice); append(devconfig->tag(), *newdevice);
newdevice->find_interfaces(); newdevice->find_interfaces();
} }
@ -130,12 +130,12 @@ void device_list::start_all()
{ {
// add exit and reset callbacks // add exit and reset callbacks
assert(m_machine != NULL); assert(m_machine != NULL);
m_machine->add_notifier(MACHINE_NOTIFY_RESET, static_reset); machine().add_notifier(MACHINE_NOTIFY_RESET, static_reset);
m_machine->add_notifier(MACHINE_NOTIFY_EXIT, static_exit); machine().add_notifier(MACHINE_NOTIFY_EXIT, static_exit);
// add pre-save and post-load callbacks // add pre-save and post-load callbacks
m_machine->state().register_presave(static_pre_save, this); machine().state().register_presave(static_pre_save, this);
m_machine->state().register_postload(static_post_load, this); machine().state().register_postload(static_post_load, this);
// iterate over devices to start them // iterate over devices to start them
device_t *nextdevice; device_t *nextdevice;
@ -596,7 +596,7 @@ device_t::device_t(running_machine &_machine, const device_config &config)
device_t::~device_t() device_t::~device_t()
{ {
auto_free(m_machine, m_debug); auto_free(machine(), m_debug);
} }
@ -613,7 +613,7 @@ const memory_region *device_t::subregion(const char *_tag) const
// build a fully-qualified name // build a fully-qualified name
astring tempstring; astring tempstring;
return m_machine.region(subtag(tempstring, _tag)); return machine().region(subtag(tempstring, _tag));
} }
@ -630,7 +630,7 @@ device_t *device_t::subdevice(const char *_tag) const
// build a fully-qualified name // build a fully-qualified name
astring tempstring; astring tempstring;
return m_machine.device(subtag(tempstring, _tag)); return machine().device(subtag(tempstring, _tag));
} }
@ -647,7 +647,7 @@ device_t *device_t::siblingdevice(const char *_tag) const
// build a fully-qualified name // build a fully-qualified name
astring tempstring; astring tempstring;
return m_machine.device(siblingtag(tempstring, _tag)); return machine().device(siblingtag(tempstring, _tag));
} }
@ -714,7 +714,7 @@ UINT64 device_t::attotime_to_clocks(attotime duration) const
emu_timer *device_t::timer_alloc(device_timer_id id, void *ptr) emu_timer *device_t::timer_alloc(device_timer_id id, void *ptr)
{ {
return m_machine.scheduler().timer_alloc(*this, id, ptr); return machine().scheduler().timer_alloc(*this, id, ptr);
} }
@ -725,7 +725,7 @@ emu_timer *device_t::timer_alloc(device_timer_id id, void *ptr)
void device_t::timer_set(attotime duration, device_timer_id id, int param, void *ptr) void device_t::timer_set(attotime duration, device_timer_id id, int param, void *ptr)
{ {
m_machine.scheduler().timer_set(duration, *this, id, param, ptr); machine().scheduler().timer_set(duration, *this, id, param, ptr);
} }
@ -749,7 +749,7 @@ void device_t::find_interfaces()
void device_t::start() void device_t::start()
{ {
// populate the region field // populate the region field
m_region = m_machine.region(tag()); m_region = machine().region(tag());
// find all the registered devices // find all the registered devices
for (auto_finder_base *autodev = m_auto_finder_list; autodev != NULL; autodev = autodev->m_next) for (auto_finder_base *autodev = m_auto_finder_list; autodev != NULL; autodev = autodev->m_next)
@ -760,19 +760,19 @@ void device_t::start()
intf->interface_pre_start(); intf->interface_pre_start();
// remember the number of state registrations // remember the number of state registrations
int state_registrations = m_machine.state().registration_count(); int state_registrations = machine().state().registration_count();
// start the device // start the device
device_start(); device_start();
// complain if nothing was registered by the device // complain if nothing was registered by the device
state_registrations = m_machine.state().registration_count() - state_registrations; state_registrations = machine().state().registration_count() - state_registrations;
device_execute_interface *exec; device_execute_interface *exec;
device_sound_interface *sound; device_sound_interface *sound;
if (state_registrations == 0 && (interface(exec) || interface(sound))) if (state_registrations == 0 && (interface(exec) || interface(sound)))
{ {
logerror("Device '%s' did not register any state to save!\n", tag()); logerror("Device '%s' did not register any state to save!\n", tag());
if ((m_machine.system().flags & GAME_SUPPORTS_SAVE) != 0) if ((machine().system().flags & GAME_SUPPORTS_SAVE) != 0)
fatalerror("Device '%s' did not register any state to save!", tag()); fatalerror("Device '%s' did not register any state to save!", tag());
} }
@ -784,9 +784,9 @@ void device_t::start()
notify_clock_changed(); notify_clock_changed();
// if we're debugging, create a device_debug object // if we're debugging, create a device_debug object
if ((m_machine.debug_flags & DEBUG_FLAG_ENABLED) != 0) if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0)
{ {
m_debug = auto_alloc(m_machine, device_debug(*this)); m_debug = auto_alloc(machine(), device_debug(*this));
debug_setup(); debug_setup();
} }

View File

@ -241,6 +241,8 @@ public:
device_list(resource_pool &pool = global_resource_pool); device_list(resource_pool &pool = global_resource_pool);
void import_config_list(const device_config_list &list, running_machine &machine); void import_config_list(const device_config_list &list, running_machine &machine);
running_machine &machine() const { assert(m_machine != NULL); return *m_machine; }
void start_all(); void start_all();
void reset_all(); void reset_all();
}; };

View File

@ -218,7 +218,7 @@ legacy_device_base::legacy_device_base(running_machine &_machine, const device_c
{ {
int tokenbytes = m_config.get_legacy_config_int(DEVINFO_INT_TOKEN_BYTES); int tokenbytes = m_config.get_legacy_config_int(DEVINFO_INT_TOKEN_BYTES);
if (tokenbytes != 0) if (tokenbytes != 0)
m_token = auto_alloc_array_clear(m_machine, UINT8, tokenbytes); m_token = auto_alloc_array_clear(machine(), UINT8, tokenbytes);
} }

View File

@ -887,7 +887,7 @@ memory_region::memory_region(running_machine &machine, const char *name, UINT32
memory_region::~memory_region() memory_region::~memory_region()
{ {
auto_free(m_machine, m_base.v); auto_free(machine(), m_base.v);
} }
@ -1035,7 +1035,7 @@ void driver_device::driver_start()
void driver_device::machine_start() void driver_device::machine_start()
{ {
if (m_config.m_callbacks[driver_device_config_base::CB_MACHINE_START] != NULL) if (m_config.m_callbacks[driver_device_config_base::CB_MACHINE_START] != NULL)
(*m_config.m_callbacks[driver_device_config_base::CB_MACHINE_START])(m_machine); (*m_config.m_callbacks[driver_device_config_base::CB_MACHINE_START])(machine());
} }
@ -1047,7 +1047,7 @@ void driver_device::machine_start()
void driver_device::sound_start() void driver_device::sound_start()
{ {
if (m_config.m_callbacks[driver_device_config_base::CB_SOUND_START] != NULL) if (m_config.m_callbacks[driver_device_config_base::CB_SOUND_START] != NULL)
(*m_config.m_callbacks[driver_device_config_base::CB_SOUND_START])(m_machine); (*m_config.m_callbacks[driver_device_config_base::CB_SOUND_START])(machine());
} }
@ -1059,7 +1059,7 @@ void driver_device::sound_start()
void driver_device::video_start() void driver_device::video_start()
{ {
if (m_config.m_callbacks[driver_device_config_base::CB_VIDEO_START] != NULL) if (m_config.m_callbacks[driver_device_config_base::CB_VIDEO_START] != NULL)
(*m_config.m_callbacks[driver_device_config_base::CB_VIDEO_START])(m_machine); (*m_config.m_callbacks[driver_device_config_base::CB_VIDEO_START])(machine());
} }
@ -1081,7 +1081,7 @@ void driver_device::driver_reset()
void driver_device::machine_reset() void driver_device::machine_reset()
{ {
if (m_config.m_callbacks[driver_device_config_base::CB_MACHINE_RESET] != NULL) if (m_config.m_callbacks[driver_device_config_base::CB_MACHINE_RESET] != NULL)
(*m_config.m_callbacks[driver_device_config_base::CB_MACHINE_RESET])(m_machine); (*m_config.m_callbacks[driver_device_config_base::CB_MACHINE_RESET])(machine());
} }
@ -1093,7 +1093,7 @@ void driver_device::machine_reset()
void driver_device::sound_reset() void driver_device::sound_reset()
{ {
if (m_config.m_callbacks[driver_device_config_base::CB_SOUND_RESET] != NULL) if (m_config.m_callbacks[driver_device_config_base::CB_SOUND_RESET] != NULL)
(*m_config.m_callbacks[driver_device_config_base::CB_SOUND_RESET])(m_machine); (*m_config.m_callbacks[driver_device_config_base::CB_SOUND_RESET])(machine());
} }
@ -1105,7 +1105,7 @@ void driver_device::sound_reset()
void driver_device::video_reset() void driver_device::video_reset()
{ {
if (m_config.m_callbacks[driver_device_config_base::CB_VIDEO_RESET] != NULL) if (m_config.m_callbacks[driver_device_config_base::CB_VIDEO_RESET] != NULL)
(*m_config.m_callbacks[driver_device_config_base::CB_VIDEO_RESET])(m_machine); (*m_config.m_callbacks[driver_device_config_base::CB_VIDEO_RESET])(machine());
} }
@ -1143,14 +1143,14 @@ void driver_device::device_start()
// call the game-specific init // call the game-specific init
if (m_config.m_system->driver_init != NULL) if (m_config.m_system->driver_init != NULL)
(*m_config.m_system->driver_init)(m_machine); (*m_config.m_system->driver_init)(machine());
// finish image devices init process // finish image devices init process
image_postdevice_init(m_machine); image_postdevice_init(machine());
// call palette_init if present // call palette_init if present
if (m_config.m_palette_init != NULL) if (m_config.m_palette_init != NULL)
(*m_config.m_palette_init)(m_machine, m_machine.region("proms")->base()); (*m_config.m_palette_init)(machine(), machine().region("proms")->base());
// start the various pieces // start the various pieces
driver_start(); driver_start();

View File

@ -214,6 +214,7 @@ class memory_region
public: public:
// getters // getters
running_machine &machine() const { return m_machine; }
memory_region *next() const { return m_next; } memory_region *next() const { return m_next; }
UINT8 *base() const { return (this != NULL) ? m_base.u8 : NULL; } UINT8 *base() const { return (this != NULL) ? m_base.u8 : NULL; }
UINT8 *end() const { return (this != NULL) ? m_base.u8 + m_length : NULL; } UINT8 *end() const { return (this != NULL) ? m_base.u8 + m_length : NULL; }

View File

@ -169,7 +169,7 @@ UINT16 via6522_device::get_counter1_value()
} }
else else
{ {
val = 0xffff - time_to_cycles(m_machine.time() - m_time1); val = 0xffff - time_to_cycles(machine().time() - m_time1);
} }
return val; return val;
@ -217,7 +217,7 @@ void via6522_device::device_start()
m_t1lh = 0xb5; /* ports are not written by kernel! */ m_t1lh = 0xb5; /* ports are not written by kernel! */
m_t2ll = 0xff; /* taken from vice */ m_t2ll = 0xff; /* taken from vice */
m_t2lh = 0xff; m_t2lh = 0xff;
m_time2 = m_time1 = m_machine.time(); m_time2 = m_time1 = machine().time();
m_t1 = timer_alloc(TIMER_T1); m_t1 = timer_alloc(TIMER_T1);
m_t2 = timer_alloc(TIMER_T2); m_t2 = timer_alloc(TIMER_T2);
m_shift_timer = timer_alloc(TIMER_SHIFT); m_shift_timer = timer_alloc(TIMER_SHIFT);
@ -225,7 +225,7 @@ void via6522_device::device_start()
/* Default clock is from CPU1 */ /* Default clock is from CPU1 */
if (clock() == 0) if (clock() == 0)
{ {
set_unscaled_clock(m_machine.firstcpu->clock()); set_unscaled_clock(machine().firstcpu->clock());
} }
/* save state register */ /* save state register */
@ -304,7 +304,7 @@ void via6522_device::set_int(int data)
m_ifr |= data; m_ifr |= data;
if (TRACE_VIA) if (TRACE_VIA)
{ {
logerror("%s:6522VIA chip %s: IFR = %02X\n", m_machine.describe_context(), tag(), m_ifr); logerror("%s:6522VIA chip %s: IFR = %02X\n", machine().describe_context(), tag(), m_ifr);
} }
if (m_ier & m_ifr) if (m_ier & m_ifr)
@ -325,7 +325,7 @@ void via6522_device::clear_int(int data)
if (TRACE_VIA) if (TRACE_VIA)
{ {
logerror("%s:6522VIA chip %s: IFR = %02X\n", m_machine.describe_context(), tag(), m_ifr); logerror("%s:6522VIA chip %s: IFR = %02X\n", machine().describe_context(), tag(), m_ifr);
} }
if (m_ifr & m_ier) if (m_ifr & m_ier)
@ -441,7 +441,7 @@ void via6522_device::device_timer(emu_timer &timer, device_timer_id id, int para
m_out_b |= 0x80; m_out_b |= 0x80;
} }
m_t1_active = 0; m_t1_active = 0;
m_time1 = m_machine.time(); m_time1 = machine().time();
} }
if (m_ddr_b) if (m_ddr_b)
{ {
@ -458,7 +458,7 @@ void via6522_device::device_timer(emu_timer &timer, device_timer_id id, int para
// t2 timeout // t2 timeout
case TIMER_T2: case TIMER_T2:
m_t2_active = 0; m_t2_active = 0;
m_time2 = m_machine.time(); m_time2 = machine().time();
if (!(m_ifr & INT_T2)) if (!(m_ifr & INT_T2))
{ {
@ -492,7 +492,7 @@ READ8_MEMBER( via6522_device::read )
} }
else else
{ {
logerror("%s:6522VIA chip %s: Port B is being read but has no handler\n", m_machine.describe_context(), tag()); logerror("%s:6522VIA chip %s: Port B is being read but has no handler\n", machine().describe_context(), tag());
} }
} }
} }
@ -522,7 +522,7 @@ READ8_MEMBER( via6522_device::read )
} }
else else
{ {
logerror("%s:6522VIA chip %s: Port A is being read but has no handler\n", m_machine.describe_context(), tag()); logerror("%s:6522VIA chip %s: Port A is being read but has no handler\n", machine().describe_context(), tag());
} }
} }
} }
@ -558,7 +558,7 @@ READ8_MEMBER( via6522_device::read )
} }
else else
{ {
logerror("%s:6522VIA chip %s: Port A is being read but has no handler\n", m_machine.describe_context(), tag()); logerror("%s:6522VIA chip %s: Port A is being read but has no handler\n", machine().describe_context(), tag());
} }
} }
@ -605,7 +605,7 @@ READ8_MEMBER( via6522_device::read )
} }
else else
{ {
val = (0x10000 - (time_to_cycles(m_machine.time() - m_time2) & 0xffff) - 1) & 0xff; val = (0x10000 - (time_to_cycles(machine().time() - m_time2) & 0xffff) - 1) & 0xff;
} }
} }
break; break;
@ -623,7 +623,7 @@ READ8_MEMBER( via6522_device::read )
} }
else else
{ {
val = (0x10000 - (time_to_cycles(m_machine.time() - m_time2) & 0xffff) - 1) >> 8; val = (0x10000 - (time_to_cycles(machine().time() - m_time2) & 0xffff) - 1) >> 8;
} }
} }
break; break;
@ -825,7 +825,7 @@ WRITE8_MEMBER( via6522_device::write )
{ {
m_t2->adjust(cycles_to_time(TIMER2_VALUE)); m_t2->adjust(cycles_to_time(TIMER2_VALUE));
m_t2_active = 1; m_t2_active = 1;
m_time2 = m_machine.time(); m_time2 = machine().time();
} }
break; break;
@ -848,7 +848,7 @@ WRITE8_MEMBER( via6522_device::write )
if (TRACE_VIA) if (TRACE_VIA)
{ {
logerror("%s:6522VIA chip %s: PCR = %02X\n", m_machine.describe_context(), tag(), data); logerror("%s:6522VIA chip %s: PCR = %02X\n", machine().describe_context(), tag(), data);
} }
if (CA2_FIX_OUTPUT(data) && CA2_OUTPUT_LEVEL(data) ^ m_out_ca2) if (CA2_FIX_OUTPUT(data) && CA2_OUTPUT_LEVEL(data) ^ m_out_ca2)
@ -942,7 +942,7 @@ WRITE_LINE_MEMBER( via6522_device::write_ca1 )
if (state != m_in_ca1) if (state != m_in_ca1)
{ {
if (TRACE_VIA) if (TRACE_VIA)
logerror("%s:6522VIA chip %s: CA1 = %02X\n", m_machine.describe_context(), tag(), state); logerror("%s:6522VIA chip %s: CA1 = %02X\n", machine().describe_context(), tag(), state);
if ((CA1_LOW_TO_HIGH(m_pcr) && state) || (CA1_HIGH_TO_LOW(m_pcr) && !state)) if ((CA1_LOW_TO_HIGH(m_pcr) && state) || (CA1_HIGH_TO_LOW(m_pcr) && !state))
{ {
@ -954,7 +954,7 @@ WRITE_LINE_MEMBER( via6522_device::write_ca1 )
} }
else else
{ {
logerror("%s:6522VIA chip %s: Port A is being read but has no handler\n", m_machine.describe_context(), tag()); logerror("%s:6522VIA chip %s: Port A is being read but has no handler\n", machine().describe_context(), tag());
} }
} }
@ -1024,7 +1024,7 @@ WRITE_LINE_MEMBER( via6522_device::write_cb1 )
} }
else else
{ {
logerror("%s:6522VIA chip %s: Port B is being read but has no handler\n", m_machine.describe_context(), tag()); logerror("%s:6522VIA chip %s: Port B is being read but has no handler\n", machine().describe_context(), tag());
} }
} }
if (SO_EXT_CONTROL(m_acr) || SI_EXT_CONTROL(m_acr)) if (SO_EXT_CONTROL(m_acr) || SI_EXT_CONTROL(m_acr))

View File

@ -200,7 +200,7 @@ void mos6526_device::device_start()
for (int t = 0; t < (sizeof(m_timer) / sizeof(m_timer[0])); t++) for (int t = 0; t < (sizeof(m_timer) / sizeof(m_timer[0])); t++)
{ {
cia_timer *timer = &m_timer[t]; cia_timer *timer = &m_timer[t];
timer->m_timer = m_machine.scheduler().timer_alloc(FUNC(timer_proc), (void*)this); timer->m_timer = machine().scheduler().timer_alloc(FUNC(timer_proc), (void*)this);
timer->m_cia = this; timer->m_cia = this;
timer->m_irq = 0x01 << t; timer->m_irq = 0x01 << t;
} }
@ -208,7 +208,7 @@ void mos6526_device::device_start()
/* setup TOD timer, if appropriate */ /* setup TOD timer, if appropriate */
if (m_config.m_tod_clock != 0) if (m_config.m_tod_clock != 0)
{ {
m_machine.scheduler().timer_pulse(attotime::from_hz(m_config.m_tod_clock), FUNC(clock_tod_callback), 0, (void *)this); machine().scheduler().timer_pulse(attotime::from_hz(m_config.m_tod_clock), FUNC(clock_tod_callback), 0, (void *)this);
} }
/* state save support */ /* state save support */

View File

@ -121,7 +121,7 @@ void riot6532_device::update_irqstate()
} }
else else
{ {
logerror("%s:6532RIOT chip #%d: no irq callback function\n", m_machine.describe_context(), m_index); logerror("%s:6532RIOT chip #%d: no irq callback function\n", machine().describe_context(), m_index);
} }
} }
@ -238,7 +238,7 @@ void riot6532_device::reg_w(UINT8 offset, UINT8 data)
if ((offset & 0x14) == 0x14) if ((offset & 0x14) == 0x14)
{ {
static const UINT8 timershift[4] = { 0, 3, 6, 10 }; static const UINT8 timershift[4] = { 0, 3, 6, 10 };
attotime curtime = m_machine.time(); attotime curtime = machine().time();
INT64 target; INT64 target;
/* A0-A1 contain the timer divisor */ /* A0-A1 contain the timer divisor */
@ -302,7 +302,7 @@ void riot6532_device::reg_w(UINT8 offset, UINT8 data)
} }
else else
{ {
logerror("%s:6532RIOT chip %s: Port %c is being written to but has no handler. %02X\n", m_machine.describe_context(), tag(), 'A' + (offset & 1), data); logerror("%s:6532RIOT chip %s: Port %c is being written to but has no handler. %02X\n", machine().describe_context(), tag(), 'A' + (offset & 1), data);
} }
} }
@ -390,7 +390,7 @@ UINT8 riot6532_device::reg_r(UINT8 offset)
} }
else else
{ {
logerror("%s:6532RIOT chip %s: Port %c is being read but has no handler\n", m_machine.describe_context(), tag(), 'A' + (offset & 1)); logerror("%s:6532RIOT chip %s: Port %c is being read but has no handler\n", machine().describe_context(), tag(), 'A' + (offset & 1));
} }
/* apply the DDR to the result */ /* apply the DDR to the result */
@ -522,7 +522,7 @@ void riot6532_device::device_start()
assert(this != NULL); assert(this != NULL);
/* set static values */ /* set static values */
m_index = m_machine.m_devicelist.indexof(RIOT6532, tag()); m_index = machine().m_devicelist.indexof(RIOT6532, tag());
/* configure the ports */ /* configure the ports */
devcb_resolve_read8(&m_port[0].m_in_func, &m_config.m_in_a_func, this); devcb_resolve_read8(&m_port[0].m_in_func, &m_config.m_in_a_func, this);
@ -534,7 +534,7 @@ void riot6532_device::device_start()
devcb_resolve_write_line(&m_irq_func, &m_config.m_irq_func, this); devcb_resolve_write_line(&m_irq_func, &m_config.m_irq_func, this);
/* allocate timers */ /* allocate timers */
m_timer = m_machine.scheduler().timer_alloc(FUNC(timer_end_callback), (void *)this); m_timer = machine().scheduler().timer_alloc(FUNC(timer_end_callback), (void *)this);
/* register for save states */ /* register for save states */
save_item(NAME(m_port[0].m_in)); save_item(NAME(m_port[0].m_in));

View File

@ -132,9 +132,9 @@ void ptm6840_device::device_start()
} }
m_timer[0] = m_machine.scheduler().timer_alloc(FUNC(ptm6840_timer1_cb), (void *)this); m_timer[0] = machine().scheduler().timer_alloc(FUNC(ptm6840_timer1_cb), (void *)this);
m_timer[1] = m_machine.scheduler().timer_alloc(FUNC(ptm6840_timer2_cb), (void *)this); m_timer[1] = machine().scheduler().timer_alloc(FUNC(ptm6840_timer2_cb), (void *)this);
m_timer[2] = m_machine.scheduler().timer_alloc(FUNC(ptm6840_timer3_cb), (void *)this); m_timer[2] = machine().scheduler().timer_alloc(FUNC(ptm6840_timer3_cb), (void *)this);
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
{ {
@ -500,7 +500,7 @@ READ8_DEVICE_HANDLER_TRAMPOLINE(ptm6840, ptm6840_read)
case PTM_6840_STATUS: case PTM_6840_STATUS:
{ {
PLOG(("%s: MC6840 #%s: Status read = %04X\n", m_machine.describe_context(), tag(), m_status_reg)); PLOG(("%s: MC6840 #%s: Status read = %04X\n", machine().describe_context(), tag(), m_status_reg));
m_status_read_since_int |= m_status_reg & 0x07; m_status_read_since_int |= m_status_reg & 0x07;
val = m_status_reg; val = m_status_reg;
break; break;
@ -522,7 +522,7 @@ READ8_DEVICE_HANDLER_TRAMPOLINE(ptm6840, ptm6840_read)
m_lsb_buffer = result & 0xff; m_lsb_buffer = result & 0xff;
PLOG(("%s: MC6840 #%s: Counter %d read = %04X\n", m_machine.describe_context(), tag(), idx, result >> 8)); PLOG(("%s: MC6840 #%s: Counter %d read = %04X\n", machine().describe_context(), tag(), idx, result >> 8));
val = result >> 8; val = result >> 8;
break; break;
} }
@ -633,7 +633,7 @@ WRITE8_DEVICE_HANDLER_TRAMPOLINE(ptm6840, ptm6840_write)
reload_count(idx); reload_count(idx);
} }
PLOG(("%s:MC6840 #%s: Counter %d latch = %04X\n", m_machine.describe_context(), tag(), idx, m_latch[idx])); PLOG(("%s:MC6840 #%s: Counter %d latch = %04X\n", machine().describe_context(), tag(), idx, m_latch[idx]));
break; break;
} }
} }

View File

@ -116,8 +116,8 @@ void acia6850_device::device_start()
m_tx_clock = m_config.m_tx_clock; m_tx_clock = m_config.m_tx_clock;
m_tx_counter = 0; m_tx_counter = 0;
m_rx_counter = 0; m_rx_counter = 0;
m_rx_timer = m_machine.scheduler().timer_alloc(FUNC(receive_event_callback), (void *)this); m_rx_timer = machine().scheduler().timer_alloc(FUNC(receive_event_callback), (void *)this);
m_tx_timer = m_machine.scheduler().timer_alloc(FUNC(transmit_event_callback), (void *)this); m_tx_timer = machine().scheduler().timer_alloc(FUNC(transmit_event_callback), (void *)this);
m_first_reset = 1; m_first_reset = 1;
m_status_read = 0; m_status_read = 0;
m_brk = 0; m_brk = 0;
@ -349,7 +349,7 @@ WRITE8_DEVICE_HANDLER_TRAMPOLINE(acia6850, acia6850_data_w)
} }
else else
{ {
logerror("%s:ACIA %p: Data write while in reset!\n", m_machine.describe_context(), this); logerror("%s:ACIA %p: Data write while in reset!\n", machine().describe_context(), this);
} }
} }

View File

@ -106,7 +106,7 @@ ttl74123_device::ttl74123_device(running_machine &_machine, const ttl74123_devic
void ttl74123_device::device_start() void ttl74123_device::device_start()
{ {
m_timer = m_machine.scheduler().timer_alloc(FUNC(clear_callback), (void *)this); m_timer = machine().scheduler().timer_alloc(FUNC(clear_callback), (void *)this);
/* start with the defaults */ /* start with the defaults */
m_a = m_config.m_a; m_a = m_config.m_a;
@ -202,7 +202,7 @@ void ttl74123_device::set_output()
{ {
int output = timer_running(); int output = timer_running();
m_machine.scheduler().timer_set( attotime::zero, FUNC(output_callback ), output, (void *)this); machine().scheduler().timer_set( attotime::zero, FUNC(output_callback ), output, (void *)this);
if (LOG) logerror("74123 %s: Output: %d\n", tag(), output); if (LOG) logerror("74123 %s: Output: %d\n", tag(), output);
} }

View File

@ -124,7 +124,7 @@ void i8237_device::device_start()
devcb_resolve_write_line(&m_chan[i].m_out_dack_func, &m_config.m_out_dack_func[i], this); devcb_resolve_write_line(&m_chan[i].m_out_dack_func, &m_config.m_out_dack_func[i], this);
} }
m_timer = m_machine.scheduler().timer_alloc(FUNC(i8237_timerproc_callback), (void *)this); m_timer = machine().scheduler().timer_alloc(FUNC(i8237_timerproc_callback), (void *)this);
} }

View File

@ -129,7 +129,7 @@ at28c16_device::at28c16_device( running_machine &_machine, const at28c16_device_
void at28c16_device::device_start() void at28c16_device::device_start()
{ {
m_write_timer = m_machine.scheduler().timer_alloc( FUNC(write_finished), this ); m_write_timer = machine().scheduler().timer_alloc( FUNC(write_finished), this );
save_item( NAME(m_a9_12v) ); save_item( NAME(m_a9_12v) );
save_item( NAME(m_oe_12v) ); save_item( NAME(m_oe_12v) );
@ -187,7 +187,7 @@ void at28c16_device::nvram_default()
void at28c16_device::nvram_read( emu_file &file ) void at28c16_device::nvram_read( emu_file &file )
{ {
UINT8 *buffer = auto_alloc_array( m_machine, UINT8, AT28C16_TOTAL_BYTES ); UINT8 *buffer = auto_alloc_array( machine(), UINT8, AT28C16_TOTAL_BYTES );
file.read( buffer, AT28C16_TOTAL_BYTES ); file.read( buffer, AT28C16_TOTAL_BYTES );
@ -196,7 +196,7 @@ void at28c16_device::nvram_read( emu_file &file )
m_addrspace[ 0 ]->write_byte( offs, buffer[ offs ] ); m_addrspace[ 0 ]->write_byte( offs, buffer[ offs ] );
} }
auto_free( m_machine, buffer ); auto_free( machine(), buffer );
} }
//------------------------------------------------- //-------------------------------------------------
@ -206,7 +206,7 @@ void at28c16_device::nvram_read( emu_file &file )
void at28c16_device::nvram_write( emu_file &file ) void at28c16_device::nvram_write( emu_file &file )
{ {
UINT8 *buffer = auto_alloc_array( m_machine, UINT8, AT28C16_TOTAL_BYTES ); UINT8 *buffer = auto_alloc_array( machine(), UINT8, AT28C16_TOTAL_BYTES );
for( offs_t offs = 0; offs < AT28C16_TOTAL_BYTES; offs++ ) for( offs_t offs = 0; offs < AT28C16_TOTAL_BYTES; offs++ )
{ {
@ -215,7 +215,7 @@ void at28c16_device::nvram_write( emu_file &file )
file.write( buffer, AT28C16_TOTAL_BYTES ); file.write( buffer, AT28C16_TOTAL_BYTES );
auto_free( m_machine, buffer ); auto_free( machine(), buffer );
} }

View File

@ -151,7 +151,7 @@ WRITE8_DEVICE_HANDLER_TRAMPOLINE(ds1302, ds1302_clk_w)
if(m_icount == 8) //Command start if(m_icount == 8) //Command start
{ {
system_time systime; system_time systime;
m_machine.base_datetime(systime); machine().base_datetime(systime);
switch(m_shift_in) switch(m_shift_in)
{ {

View File

@ -20,7 +20,7 @@ inline void ATTR_PRINTF(3,4) ds2401_device::verboselog(int n_level, const char *
va_start(v, s_fmt); va_start(v, s_fmt);
vsprintf(buf, s_fmt, v); vsprintf(buf, s_fmt, v);
va_end(v); va_end(v);
logerror("ds2401 %s %s: %s", config.tag(), m_machine.describe_context(), buf); logerror("ds2401 %s %s: %s", config.tag(), machine().describe_context(), buf);
} }
} }

View File

@ -129,7 +129,7 @@ void ds2404_device::device_start()
m_rtc[3] = (current_time >> 16) & 0xff; m_rtc[3] = (current_time >> 16) & 0xff;
m_rtc[4] = (current_time >> 24) & 0xff; m_rtc[4] = (current_time >> 24) & 0xff;
emu_timer *timer = m_machine.scheduler().timer_alloc(FUNC(ds2404_tick_callback), (void *)this); emu_timer *timer = machine().scheduler().timer_alloc(FUNC(ds2404_tick_callback), (void *)this);
timer->adjust(attotime::from_hz(256), 0, attotime::from_hz(256)); timer->adjust(attotime::from_hz(256), 0, attotime::from_hz(256));
} }

View File

@ -302,11 +302,11 @@ void eeprom_device::nvram_read(emu_file &file)
UINT32 eeprom_length = 1 << m_config.m_address_bits; UINT32 eeprom_length = 1 << m_config.m_address_bits;
UINT32 eeprom_bytes = eeprom_length * m_config.m_data_bits / 8; UINT32 eeprom_bytes = eeprom_length * m_config.m_data_bits / 8;
UINT8 *buffer = auto_alloc_array(m_machine, UINT8, eeprom_bytes); UINT8 *buffer = auto_alloc_array(machine(), UINT8, eeprom_bytes);
file.read(buffer, eeprom_bytes); file.read(buffer, eeprom_bytes);
for (offs_t offs = 0; offs < eeprom_bytes; offs++) for (offs_t offs = 0; offs < eeprom_bytes; offs++)
m_addrspace[0]->write_byte(offs, buffer[offs]); m_addrspace[0]->write_byte(offs, buffer[offs]);
auto_free(m_machine, buffer); auto_free(machine(), buffer);
} }
@ -320,11 +320,11 @@ void eeprom_device::nvram_write(emu_file &file)
UINT32 eeprom_length = 1 << m_config.m_address_bits; UINT32 eeprom_length = 1 << m_config.m_address_bits;
UINT32 eeprom_bytes = eeprom_length * m_config.m_data_bits / 8; UINT32 eeprom_bytes = eeprom_length * m_config.m_data_bits / 8;
UINT8 *buffer = auto_alloc_array(m_machine, UINT8, eeprom_bytes); UINT8 *buffer = auto_alloc_array(machine(), UINT8, eeprom_bytes);
for (offs_t offs = 0; offs < eeprom_bytes; offs++) for (offs_t offs = 0; offs < eeprom_bytes; offs++)
buffer[offs] = m_addrspace[0]->read_byte(offs); buffer[offs] = m_addrspace[0]->read_byte(offs);
file.write(buffer, eeprom_bytes); file.write(buffer, eeprom_bytes);
auto_free(m_machine, buffer); auto_free(machine(), buffer);
} }

View File

@ -134,7 +134,7 @@ void f3853_device::device_start()
} }
} }
m_timer = m_machine.scheduler().timer_alloc(FUNC(f3853_timer_callback), (void *)this ); m_timer = machine().scheduler().timer_alloc(FUNC(f3853_timer_callback), (void *)this );
save_item(NAME(m_high) ); save_item(NAME(m_high) );
save_item(NAME(m_low) ); save_item(NAME(m_low) );

View File

@ -182,7 +182,7 @@ i2cmem_device::i2cmem_device( running_machine &_machine, const i2cmem_device_con
{ {
if( m_config.m_page_size > 0 ) if( m_config.m_page_size > 0 )
{ {
m_page = auto_alloc_array( m_machine, UINT8, m_config.m_page_size ); m_page = auto_alloc_array( machine(), UINT8, m_config.m_page_size );
} }
} }
@ -262,7 +262,7 @@ void i2cmem_device::nvram_default()
void i2cmem_device::nvram_read( emu_file &file ) void i2cmem_device::nvram_read( emu_file &file )
{ {
int i2cmem_bytes = m_config.m_data_size; int i2cmem_bytes = m_config.m_data_size;
UINT8 *buffer = auto_alloc_array( m_machine, UINT8, i2cmem_bytes ); UINT8 *buffer = auto_alloc_array( machine(), UINT8, i2cmem_bytes );
file.read( buffer, i2cmem_bytes ); file.read( buffer, i2cmem_bytes );
@ -271,7 +271,7 @@ void i2cmem_device::nvram_read( emu_file &file )
m_addrspace[ 0 ]->write_byte( offs, buffer[ offs ] ); m_addrspace[ 0 ]->write_byte( offs, buffer[ offs ] );
} }
auto_free( m_machine, buffer ); auto_free( machine(), buffer );
} }
//------------------------------------------------- //-------------------------------------------------
@ -282,7 +282,7 @@ void i2cmem_device::nvram_read( emu_file &file )
void i2cmem_device::nvram_write( emu_file &file ) void i2cmem_device::nvram_write( emu_file &file )
{ {
int i2cmem_bytes = m_config.m_data_size; int i2cmem_bytes = m_config.m_data_size;
UINT8 *buffer = auto_alloc_array( m_machine, UINT8, i2cmem_bytes ); UINT8 *buffer = auto_alloc_array( machine(), UINT8, i2cmem_bytes );
for( offs_t offs = 0; offs < i2cmem_bytes; offs++ ) for( offs_t offs = 0; offs < i2cmem_bytes; offs++ )
{ {
@ -291,7 +291,7 @@ void i2cmem_device::nvram_write( emu_file &file )
file.write( buffer, i2cmem_bytes ); file.write( buffer, i2cmem_bytes );
auto_free( m_machine, buffer ); auto_free( machine(), buffer );
} }

View File

@ -133,7 +133,7 @@ READ8_DEVICE_HANDLER_TRAMPOLINE(ins8154, ins8154_r)
{ {
if (VERBOSE) if (VERBOSE)
{ {
logerror("%s: INS8154 '%s' Read from invalid offset %02x!\n", m_machine.describe_context(), tag(), offset); logerror("%s: INS8154 '%s' Read from invalid offset %02x!\n", machine().describe_context(), tag(), offset);
} }
return 0xff; return 0xff;
} }
@ -207,7 +207,7 @@ WRITE8_DEVICE_HANDLER_TRAMPOLINE(ins8154, ins8154_w)
{ {
if (VERBOSE) if (VERBOSE)
{ {
logerror("%s: INS8154 '%s' Write %02x to invalid offset %02x!\n", m_machine.describe_context(), tag(), data, offset); logerror("%s: INS8154 '%s' Write %02x to invalid offset %02x!\n", machine().describe_context(), tag(), data, offset);
} }
return; return;
} }
@ -225,7 +225,7 @@ WRITE8_DEVICE_HANDLER_TRAMPOLINE(ins8154, ins8154_w)
case 0x22: case 0x22:
if (VERBOSE) if (VERBOSE)
{ {
logerror("%s: INS8154 '%s' ODRA set to %02x\n", m_machine.describe_context(), tag(), data); logerror("%s: INS8154 '%s' ODRA set to %02x\n", machine().describe_context(), tag(), data);
} }
m_odra = data; m_odra = data;
@ -234,7 +234,7 @@ WRITE8_DEVICE_HANDLER_TRAMPOLINE(ins8154, ins8154_w)
case 0x23: case 0x23:
if (VERBOSE) if (VERBOSE)
{ {
logerror("%s: INS8154 '%s' ODRB set to %02x\n", m_machine.describe_context(), tag(), data); logerror("%s: INS8154 '%s' ODRB set to %02x\n", machine().describe_context(), tag(), data);
} }
m_odrb = data; m_odrb = data;
@ -243,7 +243,7 @@ WRITE8_DEVICE_HANDLER_TRAMPOLINE(ins8154, ins8154_w)
case 0x24: case 0x24:
if (VERBOSE) if (VERBOSE)
{ {
logerror("%s: INS8154 '%s' MDR set to %02x\n", m_machine.describe_context(), tag(), data); logerror("%s: INS8154 '%s' MDR set to %02x\n", machine().describe_context(), tag(), data);
} }
m_mdr = data; m_mdr = data;

View File

@ -63,10 +63,10 @@ k033906_device::k033906_device(running_machine &_machine, const k033906_device_c
void k033906_device::device_start() void k033906_device::device_start()
{ {
m_voodoo = m_machine.device(m_config.m_voodoo_tag); m_voodoo = machine().device(m_config.m_voodoo_tag);
m_reg = auto_alloc_array(m_machine, UINT32, 256); m_reg = auto_alloc_array(machine(), UINT32, 256);
m_ram = auto_alloc_array(m_machine, UINT32, 32768); m_ram = auto_alloc_array(machine(), UINT32, 32768);
m_reg_set = 0; m_reg_set = 0;
@ -91,7 +91,7 @@ UINT32 k033906_device::k033906_reg_r(int reg)
case 0x0f: return m_reg[0x0f]; // interrupt_line, interrupt_pin, min_gnt, max_lat case 0x0f: return m_reg[0x0f]; // interrupt_line, interrupt_pin, min_gnt, max_lat
default: default:
fatalerror("%s: k033906_reg_r: %08X", m_machine.describe_context(), reg); fatalerror("%s: k033906_reg_r: %08X", machine().describe_context(), reg);
} }
return 0; return 0;
} }
@ -139,7 +139,7 @@ void k033906_device::k033906_reg_w(int reg, UINT32 data)
break; break;
default: default:
fatalerror("%s:K033906_w: %08X, %08X", m_machine.describe_context(), data, reg); fatalerror("%s:K033906_w: %08X, %08X", machine().describe_context(), data, reg);
} }
} }

View File

@ -65,7 +65,7 @@ void k056230_device::device_start()
{ {
if(m_config.m_cpu) if(m_config.m_cpu)
{ {
m_cpu = m_machine.device(m_config.m_cpu); m_cpu = machine().device(m_config.m_cpu);
} }
else else
{ {
@ -74,7 +74,7 @@ void k056230_device::device_start()
m_is_thunderh = m_config.m_is_thunderh; m_is_thunderh = m_config.m_is_thunderh;
m_ram = auto_alloc_array(m_machine, UINT32, 0x2000); m_ram = auto_alloc_array(machine(), UINT32, 0x2000);
save_pointer(NAME(m_ram), 0x2000); save_pointer(NAME(m_ram), 0x2000);
} }
@ -128,7 +128,7 @@ WRITE8_DEVICE_HANDLER_TRAMPOLINE(k056230, k056230_w)
{ {
device_set_input_line(m_cpu, INPUT_LINE_IRQ2, ASSERT_LINE); device_set_input_line(m_cpu, INPUT_LINE_IRQ2, ASSERT_LINE);
} }
m_machine.scheduler().timer_set(attotime::from_usec(10), FUNC(network_irq_clear_callback), 0, (void*)this); machine().scheduler().timer_set(attotime::from_usec(10), FUNC(network_irq_clear_callback), 0, (void*)this);
} }
} }
// else // else

View File

@ -105,7 +105,7 @@ mb3773_device::mb3773_device( running_machine &_machine, const mb3773_device_con
void mb3773_device::device_start() void mb3773_device::device_start()
{ {
m_watchdog_timer = m_machine.scheduler().timer_alloc( FUNC(watchdog_timeout), this ); m_watchdog_timer = machine().scheduler().timer_alloc( FUNC(watchdog_timeout), this );
reset_timer(); reset_timer();
save_item( NAME(m_ck) ); save_item( NAME(m_ck) );
@ -156,5 +156,5 @@ void mb3773_device::reset_timer()
TIMER_CALLBACK( mb3773_device::watchdog_timeout ) TIMER_CALLBACK( mb3773_device::watchdog_timeout )
{ {
reinterpret_cast<mb3773_device *>(ptr)->m_machine.schedule_soft_reset(); reinterpret_cast<mb3773_device *>(ptr)->machine().schedule_soft_reset();
} }

View File

@ -183,7 +183,7 @@ mc146818_device::mc146818_device(running_machine &_machine, const mc146818_devic
void mc146818_device::device_start() void mc146818_device::device_start()
{ {
m_last_refresh = m_machine.time(); m_last_refresh = machine().time();
emu_timer *timer = timer_alloc(); emu_timer *timer = timer_alloc();
if (m_config.m_type == mc146818_device_config::MC146818_UTC) { if (m_config.m_type == mc146818_device_config::MC146818_UTC) {
// hack: for apollo we increase the update frequency to stay in sync with real time // hack: for apollo we increase the update frequency to stay in sync with real time
@ -327,7 +327,7 @@ void mc146818_device::device_timer(emu_timer &timer, device_timer_id id, int par
} }
m_updated = true; /* clock has been updated */ m_updated = true; /* clock has been updated */
m_last_refresh = m_machine.time(); m_last_refresh = machine().time();
} }
@ -387,7 +387,7 @@ void mc146818_device::set_base_datetime()
system_time systime; system_time systime;
system_time::full_time current_time; system_time::full_time current_time;
m_machine.base_datetime(systime); machine().base_datetime(systime);
current_time = m_config.m_type == mc146818_device_config::MC146818_UTC ? systime.utc_time: systime.local_time; current_time = m_config.m_type == mc146818_device_config::MC146818_UTC ? systime.utc_time: systime.local_time;

View File

@ -179,7 +179,7 @@ void nvram_device::nvram_default()
{ {
UINT8 *nvram = reinterpret_cast<UINT8 *>(m_base); UINT8 *nvram = reinterpret_cast<UINT8 *>(m_base);
for (int index = 0; index < m_length; index++) for (int index = 0; index < m_length; index++)
nvram[index] = m_machine.rand(); nvram[index] = machine().rand();
break; break;
} }
@ -231,7 +231,7 @@ void nvram_device::determine_final_base()
// find our shared pointer with the target RAM // find our shared pointer with the target RAM
if (m_base == NULL) if (m_base == NULL)
{ {
m_base = memory_get_shared(m_machine, tag(), m_length); m_base = memory_get_shared(machine(), tag(), m_length);
if (m_base == NULL) if (m_base == NULL)
throw emu_fatalerror("NVRAM device '%s' has no corresponding AM_SHARE region", tag()); throw emu_fatalerror("NVRAM device '%s' has no corresponding AM_SHARE region", tag());
} }

View File

@ -200,7 +200,7 @@ void timekeeper_device::device_start()
/* validate some basic stuff */ /* validate some basic stuff */
assert(this != NULL); assert(this != NULL);
m_machine.base_datetime(systime); machine().base_datetime(systime);
m_control = 0; m_control = 0;
m_seconds = make_bcd( systime.local_time.second ); m_seconds = make_bcd( systime.local_time.second );
@ -211,7 +211,7 @@ void timekeeper_device::device_start()
m_month = make_bcd( systime.local_time.month + 1 ); m_month = make_bcd( systime.local_time.month + 1 );
m_year = make_bcd( systime.local_time.year % 100 ); m_year = make_bcd( systime.local_time.year % 100 );
m_century = make_bcd( systime.local_time.year / 100 ); m_century = make_bcd( systime.local_time.year / 100 );
m_data = auto_alloc_array( m_machine, UINT8, m_size ); m_data = auto_alloc_array( machine(), UINT8, m_size );
m_default_data = *region(); m_default_data = *region();
if (m_default_data) if (m_default_data)

View File

@ -25,7 +25,7 @@ inline void ATTR_PRINTF(3,4) x76f041_device::verboselog(int n_level, const char
va_start(v, s_fmt); va_start(v, s_fmt);
vsprintf(buf, s_fmt, v); vsprintf(buf, s_fmt, v);
va_end(v); va_end(v);
logerror("x76f041 %s %s: %s", config.tag(), m_machine.describe_context(), buf); logerror("x76f041 %s %s: %s", config.tag(), machine().describe_context(), buf);
} }
} }

View File

@ -23,7 +23,7 @@ inline void ATTR_PRINTF(3,4) x76f100_device::verboselog(int n_level, const char
va_start(v, s_fmt); va_start(v, s_fmt);
vsprintf(buf, s_fmt, v); vsprintf(buf, s_fmt, v);
va_end(v); va_end(v);
logerror("x76f100 %s %s: %s", config.tag(), m_machine.describe_context(), buf); logerror("x76f100 %s %s: %s", config.tag(), machine().describe_context(), buf);
} }
} }

View File

@ -293,28 +293,28 @@ void z80dart_device::device_start()
if (m_config.m_rx_clock_a != 0) if (m_config.m_rx_clock_a != 0)
{ {
// allocate channel A receive timer // allocate channel A receive timer
m_rxca_timer = m_machine.scheduler().timer_alloc(FUNC(dart_channel::static_rxc_tick), (void *)&m_channel[CHANNEL_A]); m_rxca_timer = machine().scheduler().timer_alloc(FUNC(dart_channel::static_rxc_tick), (void *)&m_channel[CHANNEL_A]);
m_rxca_timer->adjust(attotime::zero, 0, attotime::from_hz(m_config.m_rx_clock_a)); m_rxca_timer->adjust(attotime::zero, 0, attotime::from_hz(m_config.m_rx_clock_a));
} }
if (m_config.m_tx_clock_a != 0) if (m_config.m_tx_clock_a != 0)
{ {
// allocate channel A transmit timer // allocate channel A transmit timer
m_txca_timer = m_machine.scheduler().timer_alloc(FUNC(dart_channel::static_txc_tick), (void *)&m_channel[CHANNEL_A]); m_txca_timer = machine().scheduler().timer_alloc(FUNC(dart_channel::static_txc_tick), (void *)&m_channel[CHANNEL_A]);
m_txca_timer->adjust(attotime::zero, 0, attotime::from_hz(m_config.m_tx_clock_a)); m_txca_timer->adjust(attotime::zero, 0, attotime::from_hz(m_config.m_tx_clock_a));
} }
if (m_config.m_rx_clock_b != 0) if (m_config.m_rx_clock_b != 0)
{ {
// allocate channel B receive timer // allocate channel B receive timer
m_rxcb_timer = m_machine.scheduler().timer_alloc(FUNC(dart_channel::static_rxc_tick), (void *)&m_channel[CHANNEL_B]); m_rxcb_timer = machine().scheduler().timer_alloc(FUNC(dart_channel::static_rxc_tick), (void *)&m_channel[CHANNEL_B]);
m_rxcb_timer->adjust(attotime::zero, 0, attotime::from_hz(m_config.m_rx_clock_b)); m_rxcb_timer->adjust(attotime::zero, 0, attotime::from_hz(m_config.m_rx_clock_b));
} }
if (m_config.m_tx_clock_b != 0) if (m_config.m_tx_clock_b != 0)
{ {
// allocate channel B transmit timer // allocate channel B transmit timer
m_txcb_timer = m_machine.scheduler().timer_alloc(FUNC(dart_channel::static_txc_tick), (void *)&m_channel[CHANNEL_B]); m_txcb_timer = machine().scheduler().timer_alloc(FUNC(dart_channel::static_txc_tick), (void *)&m_channel[CHANNEL_B]);
m_txcb_timer->adjust(attotime::zero, 0, attotime::from_hz(m_config.m_tx_clock_b)); m_txcb_timer->adjust(attotime::zero, 0, attotime::from_hz(m_config.m_tx_clock_b));
} }

View File

@ -236,7 +236,7 @@ void z80dma_device::device_start()
devcb_resolve_write8(&m_out_iorq_func, &m_config.m_out_iorq_func, this); devcb_resolve_write8(&m_out_iorq_func, &m_config.m_out_iorq_func, this);
// allocate timer // allocate timer
m_timer = m_machine.scheduler().timer_alloc(FUNC(static_timerproc), (void *)this); m_timer = machine().scheduler().timer_alloc(FUNC(static_timerproc), (void *)this);
// register for state saving // register for state saving
save_item(NAME(m_regs)); save_item(NAME(m_regs));
@ -876,7 +876,7 @@ void z80dma_device::rdy_write_callback(int state)
void z80dma_device::rdy_w(int state) void z80dma_device::rdy_w(int state)
{ {
if (LOG) logerror("Z80DMA '%s' RDY: %d Active High: %d\n", tag(), state, READY_ACTIVE_HIGH); if (LOG) logerror("Z80DMA '%s' RDY: %d Active High: %d\n", tag(), state, READY_ACTIVE_HIGH);
m_machine.scheduler().synchronize(FUNC(static_rdy_write_callback), state, (void *)this); machine().scheduler().synchronize(FUNC(static_rdy_write_callback), state, (void *)this);
} }

View File

@ -561,7 +561,7 @@ void z80sio_device::sio_channel::control_write(UINT8 data)
int regnum = m_regs[0] & 7; int regnum = m_regs[0] & 7;
if (regnum != 0 || (regnum & 0xf8) != 0) if (regnum != 0 || (regnum & 0xf8) != 0)
VPRINTF(("%s:sio_reg_w(%c,%d) = %02X\n", m_device->m_machine.describe_context(), 'A' + m_index, regnum, data)); VPRINTF(("%s:sio_reg_w(%c,%d) = %02X\n", m_device->machine().describe_context(), 'A' + m_index, regnum, data));
// write a new value to the selected register // write a new value to the selected register
UINT8 old = m_regs[regnum]; UINT8 old = m_regs[regnum];
@ -579,7 +579,7 @@ void z80sio_device::sio_channel::control_write(UINT8 data)
switch (data & SIO_WR0_COMMAND_MASK) switch (data & SIO_WR0_COMMAND_MASK)
{ {
case SIO_WR0_COMMAND_CH_RESET: case SIO_WR0_COMMAND_CH_RESET:
VPRINTF(("%s:SIO reset channel %c\n", m_device->m_machine.describe_context(), 'A' + m_index)); VPRINTF(("%s:SIO reset channel %c\n", m_device->machine().describe_context(), 'A' + m_index));
reset(); reset();
break; break;
@ -640,7 +640,7 @@ UINT8 z80sio_device::sio_channel::control_read()
break; break;
} }
VPRINTF(("%s:sio_reg_r(%c,%d) = %02x\n", m_device->m_machine.describe_context(), 'A' + m_index, regnum, m_status[regnum])); VPRINTF(("%s:sio_reg_r(%c,%d) = %02x\n", m_device->machine().describe_context(), 'A' + m_index, regnum, m_status[regnum]));
return m_status[regnum]; return m_status[regnum];
} }
@ -652,7 +652,7 @@ UINT8 z80sio_device::sio_channel::control_read()
void z80sio_device::sio_channel::data_write(UINT8 data) void z80sio_device::sio_channel::data_write(UINT8 data)
{ {
VPRINTF(("%s:sio_data_w(%c) = %02X\n", m_device->m_machine.describe_context(), 'A' + m_index, data)); VPRINTF(("%s:sio_data_w(%c) = %02X\n", m_device->machine().describe_context(), 'A' + m_index, data));
// if tx not enabled, just ignore it // if tx not enabled, just ignore it
if (!(m_regs[5] & SIO_WR5_TX_ENABLE)) if (!(m_regs[5] & SIO_WR5_TX_ENABLE))
@ -681,7 +681,7 @@ UINT8 z80sio_device::sio_channel::data_read()
// reset the receive interrupt // reset the receive interrupt
clear_interrupt(INT_RECEIVE); clear_interrupt(INT_RECEIVE);
VPRINTF(("%s:sio_data_r(%c) = %02X\n", m_device->m_machine.describe_context(), 'A' + m_index, m_inbuf)); VPRINTF(("%s:sio_data_r(%c) = %02X\n", m_device->machine().describe_context(), 'A' + m_index, m_inbuf));
return m_inbuf; return m_inbuf;
} }

View File

@ -244,22 +244,22 @@ void z80sti_device::device_start()
devcb_resolve_write_line(&m_out_int_func, &m_config.m_out_int_func, this); devcb_resolve_write_line(&m_out_int_func, &m_config.m_out_int_func, this);
// create the counter timers // create the counter timers
m_timer[TIMER_A] = m_machine.scheduler().timer_alloc(FUNC(static_timer_count), (void *)this); m_timer[TIMER_A] = machine().scheduler().timer_alloc(FUNC(static_timer_count), (void *)this);
m_timer[TIMER_B] = m_machine.scheduler().timer_alloc(FUNC(static_timer_count), (void *)this); m_timer[TIMER_B] = machine().scheduler().timer_alloc(FUNC(static_timer_count), (void *)this);
m_timer[TIMER_C] = m_machine.scheduler().timer_alloc(FUNC(static_timer_count), (void *)this); m_timer[TIMER_C] = machine().scheduler().timer_alloc(FUNC(static_timer_count), (void *)this);
m_timer[TIMER_D] = m_machine.scheduler().timer_alloc(FUNC(static_timer_count), (void *)this); m_timer[TIMER_D] = machine().scheduler().timer_alloc(FUNC(static_timer_count), (void *)this);
// create serial receive clock timer // create serial receive clock timer
if (m_config.m_rx_clock > 0) if (m_config.m_rx_clock > 0)
{ {
m_rx_timer = m_machine.scheduler().timer_alloc(FUNC(static_rx_tick), (void *)this); m_rx_timer = machine().scheduler().timer_alloc(FUNC(static_rx_tick), (void *)this);
m_rx_timer->adjust(attotime::zero, 0, attotime::from_hz(m_config.m_rx_clock)); m_rx_timer->adjust(attotime::zero, 0, attotime::from_hz(m_config.m_rx_clock));
} }
// create serial transmit clock timer // create serial transmit clock timer
if (m_config.m_tx_clock > 0) if (m_config.m_tx_clock > 0)
{ {
m_tx_timer = m_machine.scheduler().timer_alloc(FUNC(static_tx_tick), (void *)this); m_tx_timer = machine().scheduler().timer_alloc(FUNC(static_tx_tick), (void *)this);
m_tx_timer->adjust(attotime::zero, 0, attotime::from_hz(m_config.m_tx_clock)); m_tx_timer->adjust(attotime::zero, 0, attotime::from_hz(m_config.m_tx_clock));
} }

View File

@ -262,6 +262,7 @@ public:
~memory_block(); ~memory_block();
// getters // getters
running_machine &machine() const { return m_machine; }
memory_block *next() const { return m_next; } memory_block *next() const { return m_next; }
offs_t bytestart() const { return m_bytestart; } offs_t bytestart() const { return m_bytestart; }
offs_t byteend() const { return m_byteend; } offs_t byteend() const { return m_byteend; }
@ -336,6 +337,7 @@ public:
// getters // getters
memory_bank *next() const { return m_next; } memory_bank *next() const { return m_next; }
running_machine &machine() const { return m_machine; }
int index() const { return m_index; } int index() const { return m_index; }
int entry() const { return m_curentry; } int entry() const { return m_curentry; }
bool anonymous() const { return m_anonymous; } bool anonymous() const { return m_anonymous; }
@ -1934,7 +1936,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) ? m_machine.region(m_device.tag()) : NULL; const memory_region *devregion = (m_spacenum == AS_0) ? machine().region(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
@ -1959,11 +1961,11 @@ void address_space::prepare_map()
adjust_addresses(entry->m_bytestart, entry->m_byteend, entry->m_bytemask, entry->m_bytemirror); adjust_addresses(entry->m_bytestart, entry->m_byteend, entry->m_bytemask, entry->m_bytemirror);
// if we have a share entry, add it to our map // if we have a share entry, add it to our map
if (entry->m_share != NULL && m_machine.memory_data->sharemap.find(entry->m_share) == NULL) if (entry->m_share != NULL && machine().memory_data->sharemap.find(entry->m_share) == NULL)
{ {
VPRINTF(("Creating share '%s' of length 0x%X\n", entry->m_share, entry->m_byteend + 1 - entry->m_bytestart)); VPRINTF(("Creating share '%s' of length 0x%X\n", entry->m_share, entry->m_byteend + 1 - entry->m_bytestart));
memory_share *share = auto_alloc(m_machine, memory_share(entry->m_byteend + 1 - entry->m_bytestart)); memory_share *share = auto_alloc(machine(), memory_share(entry->m_byteend + 1 - entry->m_bytestart));
m_machine.memory_data->sharemap.add(entry->m_share, share, false); machine().memory_data->sharemap.add(entry->m_share, share, false);
} }
// if this is a ROM handler without a specified region, attach it to the implicit region // if this is a ROM handler without a specified region, attach it to the implicit region
@ -1980,7 +1982,7 @@ void address_space::prepare_map()
// validate adjusted addresses against implicit regions // validate adjusted addresses against implicit regions
if (entry->m_region != NULL && entry->m_share == NULL && entry->m_baseptr == NULL) if (entry->m_region != NULL && entry->m_share == NULL && entry->m_baseptr == NULL)
{ {
const memory_region *region = m_machine.region(entry->m_region); const memory_region *region = machine().region(entry->m_region);
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);
@ -1991,7 +1993,7 @@ void address_space::prepare_map()
// convert any region-relative entries to their memory pointers // convert any region-relative entries to their memory pointers
if (entry->m_region != NULL) if (entry->m_region != NULL)
entry->m_memory = m_machine.region(entry->m_region)->base() + entry->m_rgnoffs; entry->m_memory = machine().region(entry->m_region)->base() + entry->m_rgnoffs;
} }
// now loop over all the handlers and enforce the address mask // now loop over all the handlers and enforce the address mask
@ -2068,13 +2070,13 @@ void address_space::populate_map_entry(const address_map_entry &entry, read_or_w
case AMH_DEVICE_DELEGATE: case AMH_DEVICE_DELEGATE:
if (data.m_type == AMH_DRIVER_DELEGATE) if (data.m_type == AMH_DRIVER_DELEGATE)
{ {
object = m_machine.driver_data<driver_device>(); object = machine().driver_data<driver_device>();
if (object == NULL) if (object == NULL)
throw emu_fatalerror("Attempted to map a driver delegate in space %s of device '%s' when there is no driver data\n", m_name, m_device.tag()); throw emu_fatalerror("Attempted to map a driver delegate in space %s of device '%s' when there is no driver data\n", m_name, m_device.tag());
} }
else else
{ {
object = m_machine.device(data.m_tag); object = machine().device(data.m_tag);
if (object == NULL) if (object == NULL)
throw emu_fatalerror("Attempted to map a non-existent device '%s' in space %s of device '%s'\n", data.m_tag, m_name, m_device.tag()); throw emu_fatalerror("Attempted to map a non-existent device '%s' in space %s of device '%s'\n", data.m_tag, m_name, m_device.tag());
} }
@ -2117,7 +2119,7 @@ void address_space::populate_map_entry(const address_map_entry &entry, read_or_w
break; break;
case AMH_LEGACY_DEVICE_HANDLER: case AMH_LEGACY_DEVICE_HANDLER:
device = m_machine.device(data.m_tag); device = machine().device(data.m_tag);
if (device == NULL) if (device == NULL)
fatalerror("Attempted to map a non-existent device '%s' in space %s of device '%s'\n", data.m_tag, m_name, m_device.tag()); fatalerror("Attempted to map a non-existent device '%s' in space %s of device '%s'\n", data.m_tag, m_name, m_device.tag());
@ -2162,14 +2164,14 @@ void address_space::populate_map_entry(const address_map_entry &entry, read_or_w
void address_space::allocate_memory() void address_space::allocate_memory()
{ {
simple_list<memory_block> &blocklist = m_machine.memory_data->blocklist; simple_list<memory_block> &blocklist = machine().memory_data->blocklist;
// make a first pass over the memory map and track blocks with hardcoded pointers // make a first pass over the memory map and track blocks with hardcoded pointers
// we do this to make sure they are found by space_find_backing_memory first // we do this to make sure they are found by space_find_backing_memory first
memory_block *prev_memblock_tail = blocklist.last(); memory_block *prev_memblock_tail = blocklist.last();
for (address_map_entry *entry = m_map->m_entrylist.first(); entry != NULL; entry = entry->next()) for (address_map_entry *entry = m_map->m_entrylist.first(); entry != NULL; entry = entry->next())
if (entry->m_memory != NULL) if (entry->m_memory != NULL)
blocklist.append(*auto_alloc(m_machine, memory_block(*this, entry->m_bytestart, entry->m_byteend, entry->m_memory))); blocklist.append(*auto_alloc(machine(), memory_block(*this, entry->m_bytestart, entry->m_byteend, entry->m_memory)));
// loop over all blocks just allocated and assign pointers from them // loop over all blocks just allocated and assign pointers from them
address_map_entry *unassigned = NULL; address_map_entry *unassigned = NULL;
@ -2216,7 +2218,7 @@ void address_space::allocate_memory()
// we now have a block to allocate; do it // we now have a block to allocate; do it
offs_t curbytestart = curblockstart * MEMORY_BLOCK_CHUNK; offs_t curbytestart = curblockstart * MEMORY_BLOCK_CHUNK;
offs_t curbyteend = curblockend * MEMORY_BLOCK_CHUNK + (MEMORY_BLOCK_CHUNK - 1); offs_t curbyteend = curblockend * MEMORY_BLOCK_CHUNK + (MEMORY_BLOCK_CHUNK - 1);
memory_block &block = blocklist.append(*auto_alloc(m_machine, memory_block(*this, curbytestart, curbyteend))); memory_block &block = blocklist.append(*auto_alloc(machine(), memory_block(*this, curbytestart, curbyteend)));
// assign memory that intersected the new block // assign memory that intersected the new block
unassigned = block_assign_intersecting(curbytestart, curbyteend, block.data()); unassigned = block_assign_intersecting(curbytestart, curbyteend, block.data());
@ -2237,19 +2239,19 @@ void address_space::locate_memory()
if (entry->m_baseptr != NULL) if (entry->m_baseptr != NULL)
*entry->m_baseptr = entry->m_memory; *entry->m_baseptr = entry->m_memory;
if (entry->m_baseptroffs_plus1 != 0) if (entry->m_baseptroffs_plus1 != 0)
*(void **)(reinterpret_cast<UINT8 *>(m_machine.driver_data<void>()) + entry->m_baseptroffs_plus1 - 1) = entry->m_memory; *(void **)(reinterpret_cast<UINT8 *>(machine().driver_data<void>()) + entry->m_baseptroffs_plus1 - 1) = entry->m_memory;
if (entry->m_genbaseptroffs_plus1 != 0) if (entry->m_genbaseptroffs_plus1 != 0)
*(void **)((UINT8 *)&m_machine.generic + entry->m_genbaseptroffs_plus1 - 1) = entry->m_memory; *(void **)((UINT8 *)&machine().generic + entry->m_genbaseptroffs_plus1 - 1) = entry->m_memory;
if (entry->m_sizeptr != NULL) if (entry->m_sizeptr != NULL)
*entry->m_sizeptr = entry->m_byteend - entry->m_bytestart + 1; *entry->m_sizeptr = entry->m_byteend - entry->m_bytestart + 1;
if (entry->m_sizeptroffs_plus1 != 0) if (entry->m_sizeptroffs_plus1 != 0)
*(size_t *)(reinterpret_cast<UINT8 *>(m_machine.driver_data<void>()) + entry->m_sizeptroffs_plus1 - 1) = entry->m_byteend - entry->m_bytestart + 1; *(size_t *)(reinterpret_cast<UINT8 *>(machine().driver_data<void>()) + entry->m_sizeptroffs_plus1 - 1) = entry->m_byteend - entry->m_bytestart + 1;
if (entry->m_gensizeptroffs_plus1 != 0) if (entry->m_gensizeptroffs_plus1 != 0)
*(size_t *)((UINT8 *)&m_machine.generic + entry->m_gensizeptroffs_plus1 - 1) = entry->m_byteend - entry->m_bytestart + 1; *(size_t *)((UINT8 *)&machine().generic + entry->m_gensizeptroffs_plus1 - 1) = entry->m_byteend - entry->m_bytestart + 1;
} }
// once this is done, find the starting bases for the banks // once this is done, find the starting bases for the banks
for (memory_bank *bank = m_machine.memory_data->banklist.first(); bank != NULL; bank = bank->next()) for (memory_bank *bank = machine().memory_data->banklist.first(); bank != NULL; bank = bank->next())
if (bank->base() == NULL && bank->references_space(*this, ROW_READWRITE)) if (bank->base() == NULL && bank->references_space(*this, ROW_READWRITE))
{ {
// set the initial bank pointer // set the initial bank pointer
@ -2280,7 +2282,7 @@ void address_space::set_decrypted_region(offs_t addrstart, offs_t addrend, void
bool found = false; bool found = false;
// loop over banks looking for a match // loop over banks looking for a match
for (memory_bank *bank = m_machine.memory_data->banklist.first(); bank != NULL; bank = bank->next()) for (memory_bank *bank = machine().memory_data->banklist.first(); bank != NULL; bank = bank->next())
{ {
// consider this bank if it is used for reading and matches the address space // consider this bank if it is used for reading and matches the address space
if (bank->references_space(*this, ROW_READ)) if (bank->references_space(*this, ROW_READ))
@ -2312,7 +2314,7 @@ void address_space::set_decrypted_region(offs_t addrstart, offs_t addrend, void
address_map_entry *address_space::block_assign_intersecting(offs_t bytestart, offs_t byteend, UINT8 *base) address_map_entry *address_space::block_assign_intersecting(offs_t bytestart, offs_t byteend, UINT8 *base)
{ {
memory_private *memdata = m_machine.memory_data; memory_private *memdata = machine().memory_data;
address_map_entry *unassigned = NULL; address_map_entry *unassigned = NULL;
// loop over the adjusted map and assign memory to any blocks we can // loop over the adjusted map and assign memory to any blocks we can
@ -2444,7 +2446,7 @@ void address_space::install_readwrite_port(offs_t addrstart, offs_t addrend, off
if (rtag != NULL) if (rtag != NULL)
{ {
// find the port // find the port
const input_port_config *port = m_machine.port(rtag); const input_port_config *port = machine().port(rtag);
if (port == NULL) if (port == NULL)
throw emu_fatalerror("Attempted to map non-existent port '%s' for read in space %s of device '%s'\n", rtag, m_name, m_device.tag()); throw emu_fatalerror("Attempted to map non-existent port '%s' for read in space %s of device '%s'\n", rtag, m_name, m_device.tag());
@ -2456,7 +2458,7 @@ void address_space::install_readwrite_port(offs_t addrstart, offs_t addrend, off
if (wtag != NULL) if (wtag != NULL)
{ {
// find the port // find the port
const input_port_config *port = m_machine.port(wtag); const input_port_config *port = machine().port(wtag);
if (port == NULL) if (port == NULL)
fatalerror("Attempted to map non-existent port '%s' for write in space %s of device '%s'\n", wtag, m_name, m_device.tag()); fatalerror("Attempted to map non-existent port '%s' for write in space %s of device '%s'\n", wtag, m_name, m_device.tag());
@ -2466,7 +2468,7 @@ void address_space::install_readwrite_port(offs_t addrstart, offs_t addrend, off
} }
// update the memory dump // update the memory dump
generate_memdump(m_machine); generate_memdump(machine());
} }
@ -2497,7 +2499,7 @@ void address_space::install_bank_generic(offs_t addrstart, offs_t addrend, offs_
} }
// update the memory dump // update the memory dump
generate_memdump(m_machine); generate_memdump(machine());
} }
@ -2508,7 +2510,7 @@ void address_space::install_bank_generic(offs_t addrstart, offs_t addrend, offs_
void *address_space::install_ram_generic(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read_or_write readorwrite, void *baseptr) void *address_space::install_ram_generic(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read_or_write readorwrite, void *baseptr)
{ {
memory_private *memdata = m_machine.memory_data; memory_private *memdata = machine().memory_data;
VPRINTF(("address_space::install_ram_generic(%s-%s mask=%s mirror=%s, %s, %p)\n", VPRINTF(("address_space::install_ram_generic(%s-%s mask=%s mirror=%s, %s, %p)\n",
core_i64_hex_format(addrstart, m_addrchars), core_i64_hex_format(addrend, m_addrchars), core_i64_hex_format(addrstart, m_addrchars), core_i64_hex_format(addrend, m_addrchars),
@ -2538,9 +2540,9 @@ void *address_space::install_ram_generic(offs_t addrstart, offs_t addrend, offs_
// if we still don't have a pointer, and we're past the initialization phase, allocate a new block // if we still don't have a pointer, and we're past the initialization phase, allocate a new block
if (bank.base() == NULL && memdata->initialized) if (bank.base() == NULL && memdata->initialized)
{ {
if (m_machine.phase() >= MACHINE_PHASE_RESET) if (machine().phase() >= MACHINE_PHASE_RESET)
fatalerror("Attempted to call install_ram_generic() after initialization time without a baseptr!"); fatalerror("Attempted to call install_ram_generic() after initialization time without a baseptr!");
memory_block &block = memdata->blocklist.append(*auto_alloc(m_machine, memory_block(*this, address_to_byte(addrstart), address_to_byte_end(addrend)))); memory_block &block = memdata->blocklist.append(*auto_alloc(machine(), memory_block(*this, address_to_byte(addrstart), address_to_byte_end(addrend))));
bank.set_base(block.data()); bank.set_base(block.data());
} }
} }
@ -2567,9 +2569,9 @@ void *address_space::install_ram_generic(offs_t addrstart, offs_t addrend, offs_
// if we still don't have a pointer, and we're past the initialization phase, allocate a new block // if we still don't have a pointer, and we're past the initialization phase, allocate a new block
if (bank.base() == NULL && memdata->initialized) if (bank.base() == NULL && memdata->initialized)
{ {
if (m_machine.phase() >= MACHINE_PHASE_RESET) if (machine().phase() >= MACHINE_PHASE_RESET)
fatalerror("Attempted to call install_ram_generic() after initialization time without a baseptr!"); fatalerror("Attempted to call install_ram_generic() after initialization time without a baseptr!");
memory_block &block = memdata->blocklist.append(*auto_alloc(m_machine, memory_block(*this, address_to_byte(addrstart), address_to_byte_end(addrend)))); memory_block &block = memdata->blocklist.append(*auto_alloc(machine(), memory_block(*this, address_to_byte(addrstart), address_to_byte_end(addrend))));
bank.set_base(block.data()); bank.set_base(block.data());
} }
} }
@ -2592,7 +2594,7 @@ UINT8 *address_space::install_read_handler(offs_t addrstart, offs_t addrend, off
UINT32 entry = read().map_range(addrstart, addrend, addrmask, addrmirror); UINT32 entry = read().map_range(addrstart, addrend, addrmask, addrmirror);
read().handler_read(entry).set_delegate(handler, unitmask); read().handler_read(entry).set_delegate(handler, unitmask);
generate_memdump(m_machine); generate_memdump(machine());
return reinterpret_cast<UINT8 *>(find_backing_memory(addrstart, addrend)); return reinterpret_cast<UINT8 *>(find_backing_memory(addrstart, addrend));
} }
@ -2605,7 +2607,7 @@ UINT8 *address_space::install_write_handler(offs_t addrstart, offs_t addrend, of
UINT32 entry = write().map_range(addrstart, addrend, addrmask, addrmirror); UINT32 entry = write().map_range(addrstart, addrend, addrmask, addrmirror);
write().handler_write(entry).set_delegate(handler, unitmask); write().handler_write(entry).set_delegate(handler, unitmask);
generate_memdump(m_machine); generate_memdump(machine());
return reinterpret_cast<UINT8 *>(find_backing_memory(addrstart, addrend)); return reinterpret_cast<UINT8 *>(find_backing_memory(addrstart, addrend));
} }
@ -2631,7 +2633,7 @@ UINT8 *address_space::install_legacy_read_handler(offs_t addrstart, offs_t addre
UINT32 entry = read().map_range(addrstart, addrend, addrmask, addrmirror); UINT32 entry = read().map_range(addrstart, addrend, addrmask, addrmirror);
read().handler_read(entry).set_legacy_func(*this, rhandler, rname, unitmask); read().handler_read(entry).set_legacy_func(*this, rhandler, rname, unitmask);
generate_memdump(m_machine); generate_memdump(machine());
return reinterpret_cast<UINT8 *>(find_backing_memory(addrstart, addrend)); return reinterpret_cast<UINT8 *>(find_backing_memory(addrstart, addrend));
} }
@ -2644,7 +2646,7 @@ UINT8 *address_space::install_legacy_write_handler(offs_t addrstart, offs_t addr
UINT32 entry = write().map_range(addrstart, addrend, addrmask, addrmirror); UINT32 entry = write().map_range(addrstart, addrend, addrmask, addrmirror);
write().handler_write(entry).set_legacy_func(*this, whandler, wname, unitmask); write().handler_write(entry).set_legacy_func(*this, whandler, wname, unitmask);
generate_memdump(m_machine); generate_memdump(machine());
return reinterpret_cast<UINT8 *>(find_backing_memory(addrstart, addrend)); return reinterpret_cast<UINT8 *>(find_backing_memory(addrstart, addrend));
} }
@ -2669,7 +2671,7 @@ UINT8 *address_space::install_legacy_read_handler(device_t &device, offs_t addrs
UINT32 entry = read().map_range(addrstart, addrend, addrmask, addrmirror); UINT32 entry = read().map_range(addrstart, addrend, addrmask, addrmirror);
read().handler_read(entry).set_legacy_func(device, rhandler, rname, unitmask); read().handler_read(entry).set_legacy_func(device, rhandler, rname, unitmask);
generate_memdump(m_machine); generate_memdump(machine());
return reinterpret_cast<UINT8 *>(find_backing_memory(addrstart, addrend)); return reinterpret_cast<UINT8 *>(find_backing_memory(addrstart, addrend));
} }
@ -2682,7 +2684,7 @@ UINT8 *address_space::install_legacy_write_handler(device_t &device, offs_t addr
UINT32 entry = write().map_range(addrstart, addrend, addrmask, addrmirror); UINT32 entry = write().map_range(addrstart, addrend, addrmask, addrmirror);
write().handler_write(entry).set_legacy_func(device, whandler, wname, unitmask); write().handler_write(entry).set_legacy_func(device, whandler, wname, unitmask);
generate_memdump(m_machine); generate_memdump(machine());
return reinterpret_cast<UINT8 *>(find_backing_memory(addrstart, addrend)); return reinterpret_cast<UINT8 *>(find_backing_memory(addrstart, addrend));
} }
@ -2702,7 +2704,7 @@ UINT16 *address_space::install_read_handler(offs_t addrstart, offs_t addrend, of
{ {
UINT32 entry = read().map_range(addrstart, addrend, addrmask, addrmirror); UINT32 entry = read().map_range(addrstart, addrend, addrmask, addrmirror);
read().handler_read(entry).set_delegate(handler, unitmask); read().handler_read(entry).set_delegate(handler, unitmask);
generate_memdump(m_machine); generate_memdump(machine());
return reinterpret_cast<UINT16 *>(find_backing_memory(addrstart, addrend)); return reinterpret_cast<UINT16 *>(find_backing_memory(addrstart, addrend));
} }
@ -2710,7 +2712,7 @@ UINT16 *address_space::install_write_handler(offs_t addrstart, offs_t addrend, o
{ {
UINT32 entry = write().map_range(addrstart, addrend, addrmask, addrmirror); UINT32 entry = write().map_range(addrstart, addrend, addrmask, addrmirror);
write().handler_write(entry).set_delegate(handler, unitmask); write().handler_write(entry).set_delegate(handler, unitmask);
generate_memdump(m_machine); generate_memdump(machine());
return reinterpret_cast<UINT16 *>(find_backing_memory(addrstart, addrend)); return reinterpret_cast<UINT16 *>(find_backing_memory(addrstart, addrend));
} }
@ -2731,7 +2733,7 @@ UINT16 *address_space::install_legacy_read_handler(offs_t addrstart, offs_t addr
{ {
UINT32 entry = read().map_range(addrstart, addrend, addrmask, addrmirror); UINT32 entry = read().map_range(addrstart, addrend, addrmask, addrmirror);
read().handler_read(entry).set_legacy_func(*this, rhandler, rname, unitmask); read().handler_read(entry).set_legacy_func(*this, rhandler, rname, unitmask);
generate_memdump(m_machine); generate_memdump(machine());
return reinterpret_cast<UINT16 *>(find_backing_memory(addrstart, addrend)); return reinterpret_cast<UINT16 *>(find_backing_memory(addrstart, addrend));
} }
@ -2739,7 +2741,7 @@ UINT16 *address_space::install_legacy_write_handler(offs_t addrstart, offs_t add
{ {
UINT32 entry = write().map_range(addrstart, addrend, addrmask, addrmirror); UINT32 entry = write().map_range(addrstart, addrend, addrmask, addrmirror);
write().handler_write(entry).set_legacy_func(*this, whandler, wname, unitmask); write().handler_write(entry).set_legacy_func(*this, whandler, wname, unitmask);
generate_memdump(m_machine); generate_memdump(machine());
return reinterpret_cast<UINT16 *>(find_backing_memory(addrstart, addrend)); return reinterpret_cast<UINT16 *>(find_backing_memory(addrstart, addrend));
} }
@ -2759,7 +2761,7 @@ UINT16 *address_space::install_legacy_read_handler(device_t &device, offs_t addr
{ {
UINT32 entry = read().map_range(addrstart, addrend, addrmask, addrmirror); UINT32 entry = read().map_range(addrstart, addrend, addrmask, addrmirror);
read().handler_read(entry).set_legacy_func(device, rhandler, rname, unitmask); read().handler_read(entry).set_legacy_func(device, rhandler, rname, unitmask);
generate_memdump(m_machine); generate_memdump(machine());
return reinterpret_cast<UINT16 *>(find_backing_memory(addrstart, addrend)); return reinterpret_cast<UINT16 *>(find_backing_memory(addrstart, addrend));
} }
@ -2767,7 +2769,7 @@ UINT16 *address_space::install_legacy_write_handler(device_t &device, offs_t add
{ {
UINT32 entry = write().map_range(addrstart, addrend, addrmask, addrmirror); UINT32 entry = write().map_range(addrstart, addrend, addrmask, addrmirror);
write().handler_write(entry).set_legacy_func(device, whandler, wname, unitmask); write().handler_write(entry).set_legacy_func(device, whandler, wname, unitmask);
generate_memdump(m_machine); generate_memdump(machine());
return reinterpret_cast<UINT16 *>(find_backing_memory(addrstart, addrend)); return reinterpret_cast<UINT16 *>(find_backing_memory(addrstart, addrend));
} }
@ -2787,7 +2789,7 @@ UINT32 *address_space::install_read_handler(offs_t addrstart, offs_t addrend, of
{ {
UINT32 entry = read().map_range(addrstart, addrend, addrmask, addrmirror); UINT32 entry = read().map_range(addrstart, addrend, addrmask, addrmirror);
read().handler_read(entry).set_delegate(handler, unitmask); read().handler_read(entry).set_delegate(handler, unitmask);
generate_memdump(m_machine); generate_memdump(machine());
return reinterpret_cast<UINT32 *>(find_backing_memory(addrstart, addrend)); return reinterpret_cast<UINT32 *>(find_backing_memory(addrstart, addrend));
} }
@ -2795,7 +2797,7 @@ UINT32 *address_space::install_write_handler(offs_t addrstart, offs_t addrend, o
{ {
UINT32 entry = write().map_range(addrstart, addrend, addrmask, addrmirror); UINT32 entry = write().map_range(addrstart, addrend, addrmask, addrmirror);
write().handler_write(entry).set_delegate(handler, unitmask); write().handler_write(entry).set_delegate(handler, unitmask);
generate_memdump(m_machine); generate_memdump(machine());
return reinterpret_cast<UINT32 *>(find_backing_memory(addrstart, addrend)); return reinterpret_cast<UINT32 *>(find_backing_memory(addrstart, addrend));
} }
@ -2816,7 +2818,7 @@ UINT32 *address_space::install_legacy_read_handler(offs_t addrstart, offs_t addr
{ {
UINT32 entry = read().map_range(addrstart, addrend, addrmask, addrmirror); UINT32 entry = read().map_range(addrstart, addrend, addrmask, addrmirror);
read().handler_read(entry).set_legacy_func(*this, rhandler, rname, unitmask); read().handler_read(entry).set_legacy_func(*this, rhandler, rname, unitmask);
generate_memdump(m_machine); generate_memdump(machine());
return reinterpret_cast<UINT32 *>(find_backing_memory(addrstart, addrend)); return reinterpret_cast<UINT32 *>(find_backing_memory(addrstart, addrend));
} }
@ -2824,7 +2826,7 @@ UINT32 *address_space::install_legacy_write_handler(offs_t addrstart, offs_t add
{ {
UINT32 entry = write().map_range(addrstart, addrend, addrmask, addrmirror); UINT32 entry = write().map_range(addrstart, addrend, addrmask, addrmirror);
write().handler_write(entry).set_legacy_func(*this, whandler, wname, unitmask); write().handler_write(entry).set_legacy_func(*this, whandler, wname, unitmask);
generate_memdump(m_machine); generate_memdump(machine());
return reinterpret_cast<UINT32 *>(find_backing_memory(addrstart, addrend)); return reinterpret_cast<UINT32 *>(find_backing_memory(addrstart, addrend));
} }
@ -2844,7 +2846,7 @@ UINT32 *address_space::install_legacy_read_handler(device_t &device, offs_t addr
{ {
UINT32 entry = read().map_range(addrstart, addrend, addrmask, addrmirror); UINT32 entry = read().map_range(addrstart, addrend, addrmask, addrmirror);
read().handler_read(entry).set_legacy_func(device, rhandler, rname, unitmask); read().handler_read(entry).set_legacy_func(device, rhandler, rname, unitmask);
generate_memdump(m_machine); generate_memdump(machine());
return reinterpret_cast<UINT32 *>(find_backing_memory(addrstart, addrend)); return reinterpret_cast<UINT32 *>(find_backing_memory(addrstart, addrend));
} }
@ -2852,7 +2854,7 @@ UINT32 *address_space::install_legacy_write_handler(device_t &device, offs_t add
{ {
UINT32 entry = write().map_range(addrstart, addrend, addrmask, addrmirror); UINT32 entry = write().map_range(addrstart, addrend, addrmask, addrmirror);
write().handler_write(entry).set_legacy_func(device, whandler, wname, unitmask); write().handler_write(entry).set_legacy_func(device, whandler, wname, unitmask);
generate_memdump(m_machine); generate_memdump(machine());
return reinterpret_cast<UINT32 *>(find_backing_memory(addrstart, addrend)); return reinterpret_cast<UINT32 *>(find_backing_memory(addrstart, addrend));
} }
@ -2872,7 +2874,7 @@ UINT64 *address_space::install_read_handler(offs_t addrstart, offs_t addrend, of
{ {
UINT32 entry = read().map_range(addrstart, addrend, addrmask, addrmirror); UINT32 entry = read().map_range(addrstart, addrend, addrmask, addrmirror);
read().handler_read(entry).set_delegate(handler, unitmask); read().handler_read(entry).set_delegate(handler, unitmask);
generate_memdump(m_machine); generate_memdump(machine());
return reinterpret_cast<UINT64 *>(find_backing_memory(addrstart, addrend)); return reinterpret_cast<UINT64 *>(find_backing_memory(addrstart, addrend));
} }
@ -2880,7 +2882,7 @@ UINT64 *address_space::install_write_handler(offs_t addrstart, offs_t addrend, o
{ {
UINT32 entry = write().map_range(addrstart, addrend, addrmask, addrmirror); UINT32 entry = write().map_range(addrstart, addrend, addrmask, addrmirror);
write().handler_write(entry).set_delegate(handler, unitmask); write().handler_write(entry).set_delegate(handler, unitmask);
generate_memdump(m_machine); generate_memdump(machine());
return reinterpret_cast<UINT64 *>(find_backing_memory(addrstart, addrend)); return reinterpret_cast<UINT64 *>(find_backing_memory(addrstart, addrend));
} }
@ -2901,7 +2903,7 @@ UINT64 *address_space::install_legacy_read_handler(offs_t addrstart, offs_t addr
{ {
UINT32 entry = read().map_range(addrstart, addrend, addrmask, addrmirror); UINT32 entry = read().map_range(addrstart, addrend, addrmask, addrmirror);
read().handler_read(entry).set_legacy_func(*this, rhandler, rname, unitmask); read().handler_read(entry).set_legacy_func(*this, rhandler, rname, unitmask);
generate_memdump(m_machine); generate_memdump(machine());
return reinterpret_cast<UINT64 *>(find_backing_memory(addrstart, addrend)); return reinterpret_cast<UINT64 *>(find_backing_memory(addrstart, addrend));
} }
@ -2909,7 +2911,7 @@ UINT64 *address_space::install_legacy_write_handler(offs_t addrstart, offs_t add
{ {
UINT32 entry = write().map_range(addrstart, addrend, addrmask, addrmirror); UINT32 entry = write().map_range(addrstart, addrend, addrmask, addrmirror);
write().handler_write(entry).set_legacy_func(*this, whandler, wname, unitmask); write().handler_write(entry).set_legacy_func(*this, whandler, wname, unitmask);
generate_memdump(m_machine); generate_memdump(machine());
return reinterpret_cast<UINT64 *>(find_backing_memory(addrstart, addrend)); return reinterpret_cast<UINT64 *>(find_backing_memory(addrstart, addrend));
} }
@ -2929,7 +2931,7 @@ UINT64 *address_space::install_legacy_read_handler(device_t &device, offs_t addr
{ {
UINT32 entry = read().map_range(addrstart, addrend, addrmask, addrmirror); UINT32 entry = read().map_range(addrstart, addrend, addrmask, addrmirror);
read().handler_read(entry).set_legacy_func(device, rhandler, rname, unitmask); read().handler_read(entry).set_legacy_func(device, rhandler, rname, unitmask);
generate_memdump(m_machine); generate_memdump(machine());
return reinterpret_cast<UINT64 *>(find_backing_memory(addrstart, addrend)); return reinterpret_cast<UINT64 *>(find_backing_memory(addrstart, addrend));
} }
@ -2937,7 +2939,7 @@ UINT64 *address_space::install_legacy_write_handler(device_t &device, offs_t add
{ {
UINT32 entry = write().map_range(addrstart, addrend, addrmask, addrmirror); UINT32 entry = write().map_range(addrstart, addrend, addrmask, addrmirror);
write().handler_write(entry).set_legacy_func(device, whandler, wname, unitmask); write().handler_write(entry).set_legacy_func(device, whandler, wname, unitmask);
generate_memdump(m_machine); generate_memdump(machine());
return reinterpret_cast<UINT64 *>(find_backing_memory(addrstart, addrend)); return reinterpret_cast<UINT64 *>(find_backing_memory(addrstart, addrend));
} }
@ -2982,7 +2984,7 @@ void *address_space::find_backing_memory(offs_t addrstart, offs_t addrend)
} }
// if not found there, look in the allocated blocks // if not found there, look in the allocated blocks
for (memory_block *block = m_machine.memory_data->blocklist.first(); block != NULL; block = block->next()) for (memory_block *block = machine().memory_data->blocklist.first(); block != NULL; block = block->next())
if (block->contains(*this, bytestart, byteend)) if (block->contains(*this, bytestart, byteend))
{ {
VPRINTF(("found in allocated memory block %08X-%08X [%p]\n", block->bytestart(), block->byteend(), block->data() + (bytestart - block->bytestart()))); VPRINTF(("found in allocated memory block %08X-%08X [%p]\n", block->bytestart(), block->byteend(), block->data() + (bytestart - block->bytestart())));
@ -3009,7 +3011,7 @@ bool address_space::needs_backing_store(const address_map_entry *entry)
// if we are sharing, and we don't have a pointer yet, create one // if we are sharing, and we don't have a pointer yet, create one
if (entry->m_share != NULL) if (entry->m_share != NULL)
{ {
memory_share *share = m_machine.memory_data->sharemap.find(entry->m_share); memory_share *share = machine().memory_data->sharemap.find(entry->m_share);
if (share != NULL && share->ptr() == NULL) if (share != NULL && share->ptr() == NULL)
return true; return true;
} }
@ -3019,7 +3021,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 = m_machine.region(m_device.tag()); const memory_region *region = machine().region(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;
@ -3042,7 +3044,7 @@ bool address_space::needs_backing_store(const address_map_entry *entry)
memory_bank &address_space::bank_find_or_allocate(const char *tag, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read_or_write readorwrite) memory_bank &address_space::bank_find_or_allocate(const char *tag, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read_or_write readorwrite)
{ {
memory_private *memdata = m_machine.memory_data; memory_private *memdata = machine().memory_data;
// adjust the addresses, handling mirrors and such // adjust the addresses, handling mirrors and such
offs_t bytemirror = addrmirror; offs_t bytemirror = addrmirror;
@ -3076,7 +3078,7 @@ memory_bank &address_space::bank_find_or_allocate(const char *tag, offs_t addrst
} }
// allocate the bank // allocate the bank
bank = auto_alloc(m_machine, memory_bank(*this, banknum, bytestart, byteend, tag)); bank = auto_alloc(machine(), memory_bank(*this, banknum, bytestart, byteend, tag));
memdata->banklist.append(*bank); memdata->banklist.append(*bank);
// for named banks, add to the map and register for save states // for named banks, add to the map and register for save states
@ -4104,7 +4106,7 @@ memory_block::memory_block(address_space &space, offs_t bytestart, offs_t byteen
memory_block::~memory_block() memory_block::~memory_block()
{ {
if (m_allocated != NULL) if (m_allocated != NULL)
auto_free(m_machine, m_allocated); auto_free(machine(), m_allocated);
} }
@ -4153,7 +4155,7 @@ memory_bank::memory_bank(address_space &space, int index, offs_t bytestart, offs
memory_bank::~memory_bank() memory_bank::~memory_bank()
{ {
auto_free(m_machine, m_entry); auto_free(machine(), m_entry);
} }
@ -4267,12 +4269,12 @@ void memory_bank::expand_entries(int entrynum)
int newcount = entrynum + 1; int newcount = entrynum + 1;
// allocate a new array and copy from the old one; zero out the new entries // allocate a new array and copy from the old one; zero out the new entries
bank_entry *newentry = auto_alloc_array(m_machine, bank_entry, newcount); bank_entry *newentry = auto_alloc_array(machine(), bank_entry, newcount);
memcpy(newentry, m_entry, sizeof(m_entry[0]) * m_entry_count); memcpy(newentry, m_entry, sizeof(m_entry[0]) * m_entry_count);
memset(&newentry[m_entry_count], 0, (newcount - m_entry_count) * sizeof(m_entry[0])); memset(&newentry[m_entry_count], 0, (newcount - m_entry_count) * sizeof(m_entry[0]));
// free the old array and set the updated values // free the old array and set the updated values
auto_free(m_machine, m_entry); auto_free(machine(), m_entry);
m_entry = newentry; m_entry = newentry;
m_entry_count = newcount; m_entry_count = newcount;
} }

View File

@ -2530,7 +2530,7 @@ float render_manager::max_update_rate() const
render_target *render_manager::target_alloc(const char *layoutfile, UINT32 flags) render_target *render_manager::target_alloc(const char *layoutfile, UINT32 flags)
{ {
return &m_targetlist.append(*auto_alloc(m_machine, render_target(*this, layoutfile, flags))); return &m_targetlist.append(*auto_alloc(machine(), render_target(*this, layoutfile, flags)));
} }
@ -2624,7 +2624,7 @@ void render_manager::texture_free(render_texture *texture)
render_font *render_manager::font_alloc(const char *filename) render_font *render_manager::font_alloc(const char *filename)
{ {
return auto_alloc(m_machine, render_font(*this, filename)); return auto_alloc(machine(), render_font(*this, filename));
} }
@ -2634,7 +2634,7 @@ render_font *render_manager::font_alloc(const char *filename)
void render_manager::font_free(render_font *font) void render_manager::font_free(render_font *font)
{ {
auto_free(m_machine, font); auto_free(machine(), font);
} }
@ -2661,7 +2661,7 @@ void render_manager::invalidate_all(void *refptr)
render_container *render_manager::container_alloc(screen_device *screen) render_container *render_manager::container_alloc(screen_device *screen)
{ {
render_container *container = auto_alloc(m_machine, render_container(*this, screen)); render_container *container = auto_alloc(machine(), render_container(*this, screen));
if (screen != NULL) if (screen != NULL)
m_screen_container_list.append(*container); m_screen_container_list.append(*container);
return container; return container;
@ -2675,7 +2675,7 @@ render_container *render_manager::container_alloc(screen_device *screen)
void render_manager::container_free(render_container *container) void render_manager::container_free(render_container *container)
{ {
m_screen_container_list.detach(*container); m_screen_container_list.detach(*container);
auto_free(m_machine, container); auto_free(machine(), container);
} }
@ -2799,19 +2799,19 @@ void render_manager::config_save(int config_type, xml_data_node *parentnode)
container->get_user_settings(settings); container->get_user_settings(settings);
// output the color controls // output the color controls
if (settings.m_brightness != m_machine.options().brightness()) if (settings.m_brightness != machine().options().brightness())
{ {
xml_set_attribute_float(screennode, "brightness", settings.m_brightness); xml_set_attribute_float(screennode, "brightness", settings.m_brightness);
changed = true; changed = true;
} }
if (settings.m_contrast != m_machine.options().contrast()) if (settings.m_contrast != machine().options().contrast())
{ {
xml_set_attribute_float(screennode, "contrast", settings.m_contrast); xml_set_attribute_float(screennode, "contrast", settings.m_contrast);
changed = true; changed = true;
} }
if (settings.m_gamma != m_machine.options().gamma()) if (settings.m_gamma != machine().options().gamma())
{ {
xml_set_attribute_float(screennode, "gamma", settings.m_gamma); xml_set_attribute_float(screennode, "gamma", settings.m_gamma);
changed = true; changed = true;

View File

@ -509,7 +509,7 @@ layout_element::layout_element(running_machine &machine, xml_data_node &elemnode
layout_element::~layout_element() layout_element::~layout_element()
{ {
// loop over all states and free their textures // loop over all states and free their textures
auto_free(m_machine, m_elemtex); auto_free(machine(), m_elemtex);
} }
@ -526,7 +526,7 @@ render_texture *layout_element::state_texture(int state)
{ {
m_elemtex[state].m_element = this; m_elemtex[state].m_element = this;
m_elemtex[state].m_state = state; m_elemtex[state].m_state = state;
m_elemtex[state].m_texture = m_machine.render().texture_alloc(element_scale, &m_elemtex[state]); m_elemtex[state].m_texture = machine().render().texture_alloc(element_scale, &m_elemtex[state]);
} }
return m_elemtex[state].m_texture; return m_elemtex[state].m_texture;
} }
@ -554,7 +554,7 @@ void layout_element::element_scale(bitmap_t &dest, const bitmap_t &source, const
bounds.max_y = render_round_nearest(curcomp->bounds().y1 * dest.height); bounds.max_y = render_round_nearest(curcomp->bounds().y1 * dest.height);
// based on the component type, add to the texture // based on the component type, add to the texture
curcomp->draw(elemtex->m_element->m_machine, dest, bounds, elemtex->m_state); curcomp->draw(elemtex->m_element->machine(), dest, bounds, elemtex->m_state);
} }
} }
@ -582,7 +582,7 @@ layout_element::texture::texture()
layout_element::texture::~texture() layout_element::texture::~texture()
{ {
if (m_element != NULL) if (m_element != NULL)
m_element->m_machine.render().texture_free(m_texture); m_element->machine().render().texture_free(m_texture);
} }

View File

@ -290,11 +290,11 @@ void emu_timer::register_save()
} }
// save the bits // save the bits
m_machine->state().save_item("timer", name, index, NAME(m_param)); machine().state().save_item("timer", name, index, NAME(m_param));
m_machine->state().save_item("timer", name, index, NAME(m_enabled)); machine().state().save_item("timer", name, index, NAME(m_enabled));
m_machine->state().save_item("timer", name, index, NAME(m_period)); machine().state().save_item("timer", name, index, NAME(m_period));
m_machine->state().save_item("timer", name, index, NAME(m_start)); machine().state().save_item("timer", name, index, NAME(m_start));
m_machine->state().save_item("timer", name, index, NAME(m_expire)); machine().state().save_item("timer", name, index, NAME(m_expire));
} }
@ -340,12 +340,12 @@ device_scheduler::device_scheduler(running_machine &machine) :
m_quantum_minimum(ATTOSECONDS_IN_NSEC(1) / 1000) m_quantum_minimum(ATTOSECONDS_IN_NSEC(1) / 1000)
{ {
// append a single never-expiring timer so there is always one in the list // append a single never-expiring timer so there is always one in the list
m_timer_list = &m_timer_allocator.alloc()->init(m_machine, NULL, NULL, NULL, true); m_timer_list = &m_timer_allocator.alloc()->init(machine, NULL, NULL, NULL, true);
m_timer_list->adjust(attotime::never); m_timer_list->adjust(attotime::never);
// register global states // register global states
m_machine.state().save_item(NAME(m_basetime)); machine.state().save_item(NAME(m_basetime));
m_machine.state().register_postload(&state_postload_stub<device_scheduler, &device_scheduler::postload>, this); machine.state().register_postload(&state_postload_stub<device_scheduler, &device_scheduler::postload>, this);
} }
@ -401,7 +401,7 @@ bool device_scheduler::can_save() const
void device_scheduler::timeslice() void device_scheduler::timeslice()
{ {
bool call_debugger = ((m_machine.debug_flags & DEBUG_FLAG_ENABLED) != 0); bool call_debugger = ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0);
// build the execution list if we don't have one yet // build the execution list if we don't have one yet
if (m_execute_list == NULL) if (m_execute_list == NULL)
@ -562,7 +562,7 @@ void device_scheduler::boost_interleave(attotime timeslice_time, attotime boost_
emu_timer *device_scheduler::timer_alloc(timer_expired_func callback, const char *name, void *ptr) emu_timer *device_scheduler::timer_alloc(timer_expired_func callback, const char *name, void *ptr)
{ {
return &m_timer_allocator.alloc()->init(m_machine, callback, name, ptr, false); return &m_timer_allocator.alloc()->init(machine(), callback, name, ptr, false);
} }
@ -574,7 +574,7 @@ emu_timer *device_scheduler::timer_alloc(timer_expired_func callback, const char
void device_scheduler::timer_set(attotime duration, timer_expired_func callback, const char *name, int param, void *ptr) void device_scheduler::timer_set(attotime duration, timer_expired_func callback, const char *name, int param, void *ptr)
{ {
m_timer_allocator.alloc()->init(m_machine, callback, name, ptr, true).adjust(duration, param); m_timer_allocator.alloc()->init(machine(), callback, name, ptr, true).adjust(duration, param);
} }
@ -586,7 +586,7 @@ void device_scheduler::timer_set(attotime duration, timer_expired_func callback,
void device_scheduler::timer_pulse(attotime period, timer_expired_func callback, const char *name, int param, void *ptr) void device_scheduler::timer_pulse(attotime period, timer_expired_func callback, const char *name, int param, void *ptr)
{ {
m_timer_allocator.alloc()->init(m_machine, callback, name, ptr, false).adjust(period, param, period); m_timer_allocator.alloc()->init(machine(), callback, name, ptr, false).adjust(period, param, period);
} }
@ -719,22 +719,22 @@ void device_scheduler::rebuild_execute_list()
if (m_quantum_list.first() == NULL) if (m_quantum_list.first() == NULL)
{ {
// set the core scheduling quantum // set the core scheduling quantum
attotime min_quantum = m_machine.config().m_minimum_quantum; attotime min_quantum = machine().config().m_minimum_quantum;
// if none specified default to 60Hz // if none specified default to 60Hz
if (min_quantum == attotime::zero) if (min_quantum == attotime::zero)
min_quantum = attotime::from_hz(60); min_quantum = attotime::from_hz(60);
// if the configuration specifies a device to make perfect, pick that as the minimum // if the configuration specifies a device to make perfect, pick that as the minimum
if (m_machine.config().m_perfect_cpu_quantum != NULL) if (machine().config().m_perfect_cpu_quantum != NULL)
{ {
device_t *device = m_machine.device(m_machine.config().m_perfect_cpu_quantum); device_t *device = machine().device(machine().config().m_perfect_cpu_quantum);
if (device == NULL) if (device == NULL)
fatalerror("Device '%s' specified for perfect interleave is not present!", m_machine.config().m_perfect_cpu_quantum); fatalerror("Device '%s' specified for perfect interleave is not present!", machine().config().m_perfect_cpu_quantum);
device_execute_interface *exec; device_execute_interface *exec;
if (!device->interface(exec)) if (!device->interface(exec))
fatalerror("Device '%s' specified for perfect interleave is not an executing device!", m_machine.config().m_perfect_cpu_quantum); fatalerror("Device '%s' specified for perfect interleave is not an executing device!", machine().config().m_perfect_cpu_quantum);
min_quantum = min(attotime(0, exec->minimum_quantum()), min_quantum); min_quantum = min(attotime(0, exec->minimum_quantum()), min_quantum);
} }
@ -756,7 +756,7 @@ void device_scheduler::rebuild_execute_list()
// iterate over all devices // iterate over all devices
device_execute_interface *exec = NULL; device_execute_interface *exec = NULL;
for (bool gotone = m_machine.m_devicelist.first(exec); gotone; gotone = exec->next(exec)) for (bool gotone = machine().m_devicelist.first(exec); gotone; gotone = exec->next(exec))
{ {
// append to the appropriate list // append to the appropriate list
exec->m_nextexec = NULL; exec->m_nextexec = NULL;
@ -875,7 +875,7 @@ void device_scheduler::execute_timers()
if (timer.m_device != NULL) if (timer.m_device != NULL)
timer.m_device->timer_expired(timer, timer.m_id, timer.m_param, timer.m_ptr); timer.m_device->timer_expired(timer, timer.m_id, timer.m_param, timer.m_ptr);
else if (timer.m_callback != NULL) else if (timer.m_callback != NULL)
(*timer.m_callback)(m_machine, timer.m_ptr, timer.m_param); (*timer.m_callback)(machine(), timer.m_ptr, timer.m_param);
g_profiler.stop(); g_profiler.stop();
} }

View File

@ -159,6 +159,7 @@ public:
~device_scheduler(); ~device_scheduler();
// getters // getters
running_machine &machine() const { return m_machine; }
attotime time() const; attotime time() const;
emu_timer *first_timer() const { return m_timer_list; } emu_timer *first_timer() const { return m_timer_list; }
device_execute_interface *currently_executing() const { return m_executing_device; } device_execute_interface *currently_executing() const { return m_executing_device; }

View File

@ -347,8 +347,8 @@ screen_device::screen_device(running_machine &_machine, const screen_device_conf
screen_device::~screen_device() screen_device::~screen_device()
{ {
m_machine.render().texture_free(m_texture[0]); machine().render().texture_free(m_texture[0]);
m_machine.render().texture_free(m_texture[1]); machine().render().texture_free(m_texture[1]);
if (m_burnin != NULL) if (m_burnin != NULL)
finalize_burnin(); finalize_burnin();
global_free(m_screen_overlay_bitmap); global_free(m_screen_overlay_bitmap);
@ -371,15 +371,15 @@ void screen_device::device_start()
m_container->set_user_settings(settings); m_container->set_user_settings(settings);
// allocate the VBLANK timers // allocate the VBLANK timers
m_vblank_begin_timer = m_machine.scheduler().timer_alloc(FUNC(static_vblank_begin_callback), (void *)this); m_vblank_begin_timer = machine().scheduler().timer_alloc(FUNC(static_vblank_begin_callback), (void *)this);
m_vblank_end_timer = m_machine.scheduler().timer_alloc(FUNC(static_vblank_end_callback), (void *)this); m_vblank_end_timer = machine().scheduler().timer_alloc(FUNC(static_vblank_end_callback), (void *)this);
// allocate a timer to reset partial updates // allocate a timer to reset partial updates
m_scanline0_timer = m_machine.scheduler().timer_alloc(FUNC(static_scanline0_callback), (void *)this); m_scanline0_timer = machine().scheduler().timer_alloc(FUNC(static_scanline0_callback), (void *)this);
// allocate a timer to generate per-scanline updates // allocate a timer to generate per-scanline updates
if ((m_machine.config().m_video_attributes & VIDEO_UPDATE_SCANLINE) != 0) if ((machine().config().m_video_attributes & VIDEO_UPDATE_SCANLINE) != 0)
m_scanline_timer = m_machine.scheduler().timer_alloc(FUNC(static_scanline_update_callback), (void *)this); m_scanline_timer = machine().scheduler().timer_alloc(FUNC(static_scanline_update_callback), (void *)this);
// configure the screen with the default parameters // configure the screen with the default parameters
configure(m_config.m_width, m_config.m_height, m_config.m_visarea, m_config.m_refresh); configure(m_config.m_width, m_config.m_height, m_config.m_visarea, m_config.m_refresh);
@ -389,23 +389,23 @@ void screen_device::device_start()
m_vblank_end_time = attotime(0, m_vblank_period); m_vblank_end_time = attotime(0, m_vblank_period);
// start the timer to generate per-scanline updates // start the timer to generate per-scanline updates
if ((m_machine.config().m_video_attributes & VIDEO_UPDATE_SCANLINE) != 0) if ((machine().config().m_video_attributes & VIDEO_UPDATE_SCANLINE) != 0)
m_scanline_timer->adjust(time_until_pos(0)); m_scanline_timer->adjust(time_until_pos(0));
// create burn-in bitmap // create burn-in bitmap
if (m_machine.options().burnin()) if (machine().options().burnin())
{ {
int width, height; int width, height;
if (sscanf(m_machine.options().snap_size(), "%dx%d", &width, &height) != 2 || width == 0 || height == 0) if (sscanf(machine().options().snap_size(), "%dx%d", &width, &height) != 2 || width == 0 || height == 0)
width = height = 300; width = height = 300;
m_burnin = auto_alloc(m_machine, bitmap_t(width, height, BITMAP_FORMAT_INDEXED64)); m_burnin = auto_alloc(machine(), bitmap_t(width, height, BITMAP_FORMAT_INDEXED64));
if (m_burnin == NULL) if (m_burnin == NULL)
fatalerror("Error allocating burn-in bitmap for screen at (%dx%d)\n", width, height); fatalerror("Error allocating burn-in bitmap for screen at (%dx%d)\n", width, height);
bitmap_fill(m_burnin, NULL, 0); bitmap_fill(m_burnin, NULL, 0);
} }
// load the effect overlay // load the effect overlay
const char *overname = m_machine.options().effect(); const char *overname = machine().options().effect();
if (overname != NULL && strcmp(overname, "none") != 0) if (overname != NULL && strcmp(overname, "none") != 0)
load_effect_overlay(overname); load_effect_overlay(overname);
@ -484,7 +484,7 @@ void screen_device::configure(int width, int height, const rectangle &visarea, a
m_vblank_begin_timer->adjust(time_until_vblank_start()); m_vblank_begin_timer->adjust(time_until_vblank_start());
// adjust speed if necessary // adjust speed if necessary
m_machine.video().update_refresh_speed(); machine().video().update_refresh_speed();
} }
@ -496,7 +496,7 @@ void screen_device::configure(int width, int height, const rectangle &visarea, a
void screen_device::reset_origin(int beamy, int beamx) void screen_device::reset_origin(int beamy, int beamx)
{ {
// compute the effective VBLANK start/end times // compute the effective VBLANK start/end times
attotime curtime = m_machine.time(); attotime curtime = machine().time();
m_vblank_end_time = curtime - attotime(0, beamy * m_scantime + beamx * m_pixeltime); m_vblank_end_time = curtime - attotime(0, beamy * m_scantime + beamx * m_pixeltime);
m_vblank_start_time = m_vblank_end_time - attotime(0, m_vblank_period); m_vblank_start_time = m_vblank_end_time - attotime(0, m_vblank_period);
@ -539,10 +539,10 @@ void screen_device::realloc_screen_bitmaps()
if (m_width > curwidth || m_height > curheight) if (m_width > curwidth || m_height > curheight)
{ {
// free what we have currently // free what we have currently
m_machine.render().texture_free(m_texture[0]); machine().render().texture_free(m_texture[0]);
m_machine.render().texture_free(m_texture[1]); machine().render().texture_free(m_texture[1]);
auto_free(m_machine, m_bitmap[0]); auto_free(machine(), m_bitmap[0]);
auto_free(m_machine, m_bitmap[1]); auto_free(machine(), m_bitmap[1]);
// compute new width/height // compute new width/height
curwidth = MAX(m_width, curwidth); curwidth = MAX(m_width, curwidth);
@ -552,22 +552,22 @@ void screen_device::realloc_screen_bitmaps()
palette_t *palette = NULL; palette_t *palette = NULL;
switch (m_config.m_format) switch (m_config.m_format)
{ {
case BITMAP_FORMAT_INDEXED16: m_texture_format = TEXFORMAT_PALETTE16; palette = m_machine.palette; break; case BITMAP_FORMAT_INDEXED16: m_texture_format = TEXFORMAT_PALETTE16; palette = machine().palette; break;
case BITMAP_FORMAT_RGB15: m_texture_format = TEXFORMAT_RGB15; palette = NULL; break; case BITMAP_FORMAT_RGB15: m_texture_format = TEXFORMAT_RGB15; palette = NULL; break;
case BITMAP_FORMAT_RGB32: m_texture_format = TEXFORMAT_RGB32; palette = NULL; break; case BITMAP_FORMAT_RGB32: m_texture_format = TEXFORMAT_RGB32; palette = NULL; break;
default: fatalerror("Invalid bitmap format!"); break; default: fatalerror("Invalid bitmap format!"); break;
} }
// allocate bitmaps // allocate bitmaps
m_bitmap[0] = auto_alloc(m_machine, bitmap_t(curwidth, curheight, m_config.m_format)); m_bitmap[0] = auto_alloc(machine(), bitmap_t(curwidth, curheight, m_config.m_format));
bitmap_set_palette(m_bitmap[0], m_machine.palette); bitmap_set_palette(m_bitmap[0], machine().palette);
m_bitmap[1] = auto_alloc(m_machine, bitmap_t(curwidth, curheight, m_config.m_format)); m_bitmap[1] = auto_alloc(machine(), bitmap_t(curwidth, curheight, m_config.m_format));
bitmap_set_palette(m_bitmap[1], m_machine.palette); bitmap_set_palette(m_bitmap[1], machine().palette);
// allocate textures // allocate textures
m_texture[0] = m_machine.render().texture_alloc(); m_texture[0] = machine().render().texture_alloc();
m_texture[0]->set_bitmap(m_bitmap[0], &m_visarea, m_texture_format, palette); m_texture[0]->set_bitmap(m_bitmap[0], &m_visarea, m_texture_format, palette);
m_texture[1] = m_machine.render().texture_alloc(); m_texture[1] = machine().render().texture_alloc();
m_texture[1]->set_bitmap(m_bitmap[1], &m_visarea, m_texture_format, palette); m_texture[1]->set_bitmap(m_bitmap[1], &m_visarea, m_texture_format, palette);
} }
} }
@ -609,17 +609,17 @@ bool screen_device::update_partial(int scanline)
LOG_PARTIAL_UPDATES(("Partial: update_partial(%s, %d): ", tag(), scanline)); LOG_PARTIAL_UPDATES(("Partial: update_partial(%s, %d): ", tag(), scanline));
// these two checks only apply if we're allowed to skip frames // these two checks only apply if we're allowed to skip frames
if (!(m_machine.config().m_video_attributes & VIDEO_ALWAYS_UPDATE)) if (!(machine().config().m_video_attributes & VIDEO_ALWAYS_UPDATE))
{ {
// if skipping this frame, bail // if skipping this frame, bail
if (m_machine.video().skip_this_frame()) if (machine().video().skip_this_frame())
{ {
LOG_PARTIAL_UPDATES(("skipped due to frameskipping\n")); LOG_PARTIAL_UPDATES(("skipped due to frameskipping\n"));
return FALSE; return FALSE;
} }
// skip if this screen is not visible anywhere // skip if this screen is not visible anywhere
if (!m_machine.render().is_live(*this)) if (!machine().render().is_live(*this))
{ {
LOG_PARTIAL_UPDATES(("skipped because screen not live\n")); LOG_PARTIAL_UPDATES(("skipped because screen not live\n"));
return FALSE; return FALSE;
@ -696,7 +696,7 @@ void screen_device::update_now()
int screen_device::vpos() const int screen_device::vpos() const
{ {
attoseconds_t delta = (m_machine.time() - m_vblank_start_time).as_attoseconds(); attoseconds_t delta = (machine().time() - m_vblank_start_time).as_attoseconds();
int vpos; int vpos;
// round to the nearest pixel // round to the nearest pixel
@ -717,7 +717,7 @@ int screen_device::vpos() const
int screen_device::hpos() const int screen_device::hpos() const
{ {
attoseconds_t delta = (m_machine.time() - m_vblank_start_time).as_attoseconds(); attoseconds_t delta = (machine().time() - m_vblank_start_time).as_attoseconds();
// round to the nearest pixel // round to the nearest pixel
delta += m_pixeltime / 2; delta += m_pixeltime / 2;
@ -753,7 +753,7 @@ attotime screen_device::time_until_pos(int vpos, int hpos) const
attoseconds_t targetdelta = (attoseconds_t)vpos * m_scantime + (attoseconds_t)hpos * m_pixeltime; attoseconds_t targetdelta = (attoseconds_t)vpos * m_scantime + (attoseconds_t)hpos * m_pixeltime;
// if we're past that time (within 1/2 of a pixel), head to the next frame // if we're past that time (within 1/2 of a pixel), head to the next frame
attoseconds_t curdelta = (m_machine.time() - m_vblank_start_time).as_attoseconds(); attoseconds_t curdelta = (machine().time() - m_vblank_start_time).as_attoseconds();
if (targetdelta <= curdelta + m_pixeltime / 2) if (targetdelta <= curdelta + m_pixeltime / 2)
targetdelta += m_frame_period; targetdelta += m_frame_period;
while (targetdelta <= curdelta) while (targetdelta <= curdelta)
@ -777,7 +777,7 @@ attotime screen_device::time_until_vblank_end() const
attotime target_time = m_vblank_end_time; attotime target_time = m_vblank_end_time;
if (!vblank()) if (!vblank())
target_time += attotime(0, m_frame_period); target_time += attotime(0, m_frame_period);
return target_time - m_machine.time(); return target_time - machine().time();
} }
@ -800,7 +800,7 @@ void screen_device::register_vblank_callback(vblank_state_changed_func vblank_ca
// if not found, register // if not found, register
if (*itemptr == NULL) if (*itemptr == NULL)
{ {
*itemptr = auto_alloc(m_machine, callback_item); *itemptr = auto_alloc(machine(), callback_item);
(*itemptr)->m_next = NULL; (*itemptr)->m_next = NULL;
(*itemptr)->m_callback = vblank_callback; (*itemptr)->m_callback = vblank_callback;
(*itemptr)->m_param = param; (*itemptr)->m_param = param;
@ -816,7 +816,7 @@ void screen_device::register_vblank_callback(vblank_state_changed_func vblank_ca
void screen_device::vblank_begin_callback() void screen_device::vblank_begin_callback()
{ {
// reset the starting VBLANK time // reset the starting VBLANK time
m_vblank_start_time = m_machine.time(); m_vblank_start_time = machine().time();
m_vblank_end_time = m_vblank_start_time + attotime(0, m_vblank_period); m_vblank_end_time = m_vblank_start_time + attotime(0, m_vblank_period);
// call the screen specific callbacks // call the screen specific callbacks
@ -824,8 +824,8 @@ void screen_device::vblank_begin_callback()
(*item->m_callback)(*this, item->m_param, true); (*item->m_callback)(*this, item->m_param, true);
// if this is the primary screen and we need to update now // if this is the primary screen and we need to update now
if (this == m_machine.primary_screen && !(m_machine.config().m_video_attributes & VIDEO_UPDATE_AFTER_VBLANK)) if (this == machine().primary_screen && !(machine().config().m_video_attributes & VIDEO_UPDATE_AFTER_VBLANK))
m_machine.video().frame_update(); machine().video().frame_update();
// reset the VBLANK start timer for the next frame // reset the VBLANK start timer for the next frame
m_vblank_begin_timer->adjust(time_until_vblank_start()); m_vblank_begin_timer->adjust(time_until_vblank_start());
@ -850,8 +850,8 @@ void screen_device::vblank_end_callback()
(*item->m_callback)(*this, item->m_param, false); (*item->m_callback)(*this, item->m_param, false);
// if this is the primary screen and we need to update now // if this is the primary screen and we need to update now
if (this == m_machine.primary_screen && (m_machine.config().m_video_attributes & VIDEO_UPDATE_AFTER_VBLANK)) if (this == machine().primary_screen && (machine().config().m_video_attributes & VIDEO_UPDATE_AFTER_VBLANK))
m_machine.video().frame_update(); machine().video().frame_update();
// increment the frame number counter // increment the frame number counter
m_frame_number++; m_frame_number++;
@ -899,19 +899,19 @@ void screen_device::scanline_update_callback(int scanline)
bool screen_device::update_quads() bool screen_device::update_quads()
{ {
// only update if live // only update if live
if (m_machine.render().is_live(*this)) if (machine().render().is_live(*this))
{ {
// only update if empty and not a vector game; otherwise assume the driver did it directly // only update if empty and not a vector game; otherwise assume the driver did it directly
if (m_config.m_type != SCREEN_TYPE_VECTOR && (m_machine.config().m_video_attributes & VIDEO_SELF_RENDER) == 0) if (m_config.m_type != SCREEN_TYPE_VECTOR && (machine().config().m_video_attributes & VIDEO_SELF_RENDER) == 0)
{ {
// if we're not skipping the frame and if the screen actually changed, then update the texture // if we're not skipping the frame and if the screen actually changed, then update the texture
if (!m_machine.video().skip_this_frame() && m_changed) if (!machine().video().skip_this_frame() && m_changed)
{ {
rectangle fixedvis = m_visarea; rectangle fixedvis = m_visarea;
fixedvis.max_x++; fixedvis.max_x++;
fixedvis.max_y++; fixedvis.max_y++;
palette_t *palette = (m_texture_format == TEXFORMAT_PALETTE16) ? m_machine.palette : NULL; palette_t *palette = (m_texture_format == TEXFORMAT_PALETTE16) ? machine().palette : NULL;
m_texture[m_curbitmap]->set_bitmap(m_bitmap[m_curbitmap], &fixedvis, m_texture_format, palette); m_texture[m_curbitmap]->set_bitmap(m_bitmap[m_curbitmap], &fixedvis, m_texture_format, palette);
m_curtexture = m_curbitmap; m_curtexture = m_curbitmap;
@ -965,7 +965,7 @@ void screen_device::update_burnin()
if (srcbitmap->format == BITMAP_FORMAT_INDEXED16) if (srcbitmap->format == BITMAP_FORMAT_INDEXED16)
{ {
const UINT16 *src = BITMAP_ADDR16(srcbitmap, srcy >> 16, 0); const UINT16 *src = BITMAP_ADDR16(srcbitmap, srcy >> 16, 0);
const rgb_t *palette = palette_entry_list_adjusted(m_machine.palette); const rgb_t *palette = palette_entry_list_adjusted(machine().palette);
for (x = 0, srcx = xstart; x < dstwidth; x++, srcx += xstep) for (x = 0, srcx = xstart; x < dstwidth; x++, srcx += xstep)
{ {
rgb_t pixel = palette[src[srcx >> 16]]; rgb_t pixel = palette[src[srcx >> 16]];
@ -1015,7 +1015,7 @@ void screen_device::finalize_burnin()
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 subregion we care about
bitmap_t *finalmap = auto_alloc(m_machine, bitmap_t(scaledvis.max_x + 1 - scaledvis.min_x, bitmap_t *finalmap = auto_alloc(machine(), bitmap_t(scaledvis.max_x + 1 - scaledvis.min_x,
scaledvis.max_y + 1 - scaledvis.min_y, scaledvis.max_y + 1 - scaledvis.min_y,
BITMAP_FORMAT_ARGB32)); BITMAP_FORMAT_ARGB32));
@ -1057,8 +1057,8 @@ void screen_device::finalize_burnin()
// write the final PNG // write the final PNG
// compute the name and create the file // compute the name and create the file
emu_file file(m_machine.options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); emu_file file(machine().options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
file_error filerr = file.open(m_machine.basename(), PATH_SEPARATOR "burnin-", tag(), ".png") ; file_error filerr = file.open(machine().basename(), PATH_SEPARATOR "burnin-", tag(), ".png") ;
if (filerr == FILERR_NONE) if (filerr == FILERR_NONE)
{ {
png_info pnginfo = { 0 }; png_info pnginfo = { 0 };
@ -1068,7 +1068,7 @@ void screen_device::finalize_burnin()
// add two text entries describing the image // add two text entries describing the image
sprintf(text, APPNAME " %s", build_version); sprintf(text, APPNAME " %s", build_version);
png_add_text(&pnginfo, "Software", text); png_add_text(&pnginfo, "Software", text);
sprintf(text, "%s %s", m_machine.system().manufacturer, m_machine.system().description); sprintf(text, "%s %s", machine().system().manufacturer, machine().system().description);
png_add_text(&pnginfo, "System", text); png_add_text(&pnginfo, "System", text);
// now do the actual work // now do the actual work
@ -1094,7 +1094,7 @@ void screen_device::load_effect_overlay(const char *filename)
fullname.cat(".png"); fullname.cat(".png");
// load the file // load the file
emu_file file(m_machine.options().art_path(), OPEN_FLAG_READ); emu_file file(machine().options().art_path(), OPEN_FLAG_READ);
m_screen_overlay_bitmap = render_load_png(file, NULL, fullname, NULL, NULL); m_screen_overlay_bitmap = render_load_png(file, NULL, fullname, NULL, NULL);
if (m_screen_overlay_bitmap != NULL) if (m_screen_overlay_bitmap != NULL)
m_container->set_overlay(m_screen_overlay_bitmap); m_container->set_overlay(m_screen_overlay_bitmap);
@ -1112,7 +1112,7 @@ bool screen_device::screen_update(bitmap_t &bitmap, const rectangle &cliprect)
if (m_config.m_screen_update != NULL) { if (m_config.m_screen_update != NULL) {
return (*m_config.m_screen_update)(this, &bitmap, &cliprect); return (*m_config.m_screen_update)(this, &bitmap, &cliprect);
} else { } else {
m_machine.driver_data<driver_device>()->screen_update(*this, bitmap, cliprect); machine().driver_data<driver_device>()->screen_update(*this, bitmap, cliprect);
} }
return 0; return 0;
} }
@ -1125,9 +1125,9 @@ bool screen_device::screen_update(bitmap_t &bitmap, const rectangle &cliprect)
void screen_device::screen_eof() void screen_device::screen_eof()
{ {
if (m_config.m_screen_eof != NULL) { if (m_config.m_screen_eof != NULL) {
return (*m_config.m_screen_eof)(this, m_machine); return (*m_config.m_screen_eof)(this, machine());
} else { } else {
m_machine.driver_data<driver_device>()->screen_eof(); machine().driver_data<driver_device>()->screen_eof();
} }
} }

View File

@ -175,14 +175,14 @@ public:
// beam positioning and state // beam positioning and state
int vpos() const; int vpos() const;
int hpos() const; int hpos() const;
bool vblank() const { return (m_machine.time() < m_vblank_end_time); } bool vblank() const { return (machine().time() < m_vblank_end_time); }
bool hblank() const { int curpos = hpos(); return (curpos < m_visarea.min_x || curpos > m_visarea.max_x); } bool hblank() const { int curpos = hpos(); return (curpos < m_visarea.min_x || curpos > m_visarea.max_x); }
// timing // timing
attotime time_until_pos(int vpos, int hpos = 0) const; attotime time_until_pos(int vpos, int hpos = 0) const;
attotime time_until_vblank_start() const { return time_until_pos(m_visarea.max_y + 1); } attotime time_until_vblank_start() const { return time_until_pos(m_visarea.max_y + 1); }
attotime time_until_vblank_end() const; attotime time_until_vblank_end() const;
attotime time_until_update() const { return (m_machine.config().m_video_attributes & VIDEO_UPDATE_AFTER_VBLANK) ? time_until_vblank_end() : time_until_vblank_start(); } attotime time_until_update() const { return (machine().config().m_video_attributes & VIDEO_UPDATE_AFTER_VBLANK) ? time_until_vblank_end() : time_until_vblank_start(); }
attotime scan_period() const { return attotime(0, m_scantime); } attotime scan_period() const { return attotime(0, m_scantime); }
attotime frame_period() const { return (this == NULL || !started()) ? DEFAULT_FRAME_PERIOD : attotime(0, m_frame_period); }; attotime frame_period() const { return (this == NULL || !started()) ? DEFAULT_FRAME_PERIOD : attotime(0, m_frame_period); };
UINT64 frame_number() const { return m_frame_number; } UINT64 frame_number() const { return m_frame_number; }
@ -194,7 +194,7 @@ public:
// additional helpers // additional helpers
void register_vblank_callback(vblank_state_changed_func vblank_callback, void *param); void register_vblank_callback(vblank_state_changed_func vblank_callback, void *param);
bitmap_t *alloc_compatible_bitmap(int width = 0, int height = 0) { return auto_bitmap_alloc(m_machine, (width == 0) ? m_width : width, (height == 0) ? m_height : height, m_config.m_format); } bitmap_t *alloc_compatible_bitmap(int width = 0, int height = 0) { return auto_bitmap_alloc(machine(), (width == 0) ? m_width : width, (height == 0) ? m_height : height, m_config.m_format); }
// internal to the video system // internal to the video system
bool update_quads(); bool update_quads();

View File

@ -849,7 +849,7 @@ sound_stream *sound_manager::stream_alloc(device_t &device, int inputs, int outp
void sound_manager::set_attenuation(int attenuation) void sound_manager::set_attenuation(int attenuation)
{ {
m_attenuation = attenuation; m_attenuation = attenuation;
m_machine.osd().set_mastervolume(m_muted ? -32 : m_attenuation); machine().osd().set_mastervolume(m_muted ? -32 : m_attenuation);
} }
@ -862,7 +862,7 @@ void sound_manager::set_attenuation(int attenuation)
bool sound_manager::indexed_speaker_input(int index, speaker_input &info) const bool sound_manager::indexed_speaker_input(int index, speaker_input &info) const
{ {
// scan through the speakers until we find the indexed input // scan through the speakers until we find the indexed input
for (info.speaker = downcast<speaker_device *>(m_machine.m_devicelist.first(SPEAKER)); info.speaker != NULL; info.speaker = info.speaker->next_speaker()) for (info.speaker = downcast<speaker_device *>(machine().m_devicelist.first(SPEAKER)); info.speaker != NULL; info.speaker = info.speaker->next_speaker())
{ {
if (index < info.speaker->inputs()) if (index < info.speaker->inputs())
{ {
@ -1003,11 +1003,11 @@ void sound_manager::update()
// force all the speaker streams to generate the proper number of samples // force all the speaker streams to generate the proper number of samples
int samples_this_update = 0; int samples_this_update = 0;
for (speaker_device *speaker = downcast<speaker_device *>(m_machine.m_devicelist.first(SPEAKER)); speaker != NULL; speaker = speaker->next_speaker()) for (speaker_device *speaker = downcast<speaker_device *>(machine().m_devicelist.first(SPEAKER)); speaker != NULL; speaker = speaker->next_speaker())
speaker->mix(m_leftmix, m_rightmix, samples_this_update, (m_muted & MUTE_REASON_SYSTEM)); speaker->mix(m_leftmix, m_rightmix, samples_this_update, (m_muted & MUTE_REASON_SYSTEM));
// now downmix the final result // now downmix the final result
UINT32 finalmix_step = m_machine.video().speed_factor(); UINT32 finalmix_step = machine().video().speed_factor();
UINT32 finalmix_offset = 0; UINT32 finalmix_offset = 0;
INT16 *finalmix = m_finalmix; INT16 *finalmix = m_finalmix;
int sample; int sample;
@ -1037,14 +1037,14 @@ void sound_manager::update()
if (finalmix_offset > 0) if (finalmix_offset > 0)
{ {
if (!m_nosound_mode) if (!m_nosound_mode)
m_machine.osd().update_audio_stream(finalmix, finalmix_offset / 2); machine().osd().update_audio_stream(finalmix, finalmix_offset / 2);
m_machine.video().add_sound_to_recording(finalmix, finalmix_offset / 2); machine().video().add_sound_to_recording(finalmix, finalmix_offset / 2);
if (m_wavfile != NULL) if (m_wavfile != NULL)
wav_add_data_16(m_wavfile, finalmix, finalmix_offset); wav_add_data_16(m_wavfile, finalmix, finalmix_offset);
} }
// see if we ticked over to the next second // see if we ticked over to the next second
attotime curtime = m_machine.time(); attotime curtime = machine().time();
bool second_tick = false; bool second_tick = false;
if (curtime.seconds != m_last_update.seconds) if (curtime.seconds != m_last_update.seconds)
{ {

View File

@ -220,6 +220,7 @@ public:
~sound_manager(); ~sound_manager();
// getters // getters
running_machine &machine() const { return m_machine; }
int attenuation() const { return m_attenuation; } int attenuation() const { return m_attenuation; }
sound_stream *first_stream() const { return m_stream_list.first(); } sound_stream *first_stream() const { return m_stream_list.first(); }
attotime last_update() const { return m_last_update; } attotime last_update() const { return m_last_update; }

View File

@ -129,7 +129,7 @@ asc_device::asc_device(running_machine &_machine, const asc_device_config &confi
void asc_device::device_start() void asc_device::device_start()
{ {
// create the stream // create the stream
m_stream = m_machine.sound().stream_alloc(*this, 0, 2, 22257, this); m_stream = machine().sound().stream_alloc(*this, 0, 2, 22257, this);
memset(m_regs, 0, sizeof(m_regs)); memset(m_regs, 0, sizeof(m_regs));

View File

@ -226,7 +226,7 @@ void bsmt2000_device::device_start()
// in theory we should generate a 24MHz stream, but that's certainly overkill // in theory we should generate a 24MHz stream, but that's certainly overkill
// internally at 24MHz the max output sample rate is 32kHz // internally at 24MHz the max output sample rate is 32kHz
// divided by 128 gives us 6x the max output rate which is plenty for oversampling // divided by 128 gives us 6x the max output rate which is plenty for oversampling
m_stream = m_machine.sound().stream_alloc(*this, 0, 2, clock() / 128); m_stream = machine().sound().stream_alloc(*this, 0, 2, clock() / 128);
// register for save states // register for save states
save_item(NAME(m_register_select)); save_item(NAME(m_register_select));
@ -326,7 +326,7 @@ void bsmt2000_device::write_data(UINT16 data)
synchronize(TIMER_ID_DATA_WRITE, data); synchronize(TIMER_ID_DATA_WRITE, data);
// boost the interleave on a write so that the caller detects the status more accurately // boost the interleave on a write so that the caller detects the status more accurately
m_machine.scheduler().boost_interleave(attotime::from_usec(1), attotime::from_usec(10)); machine().scheduler().boost_interleave(attotime::from_usec(1), attotime::from_usec(10));
} }

View File

@ -416,7 +416,7 @@ cdp1869_device::cdp1869_device(running_machine &_machine, const cdp1869_device_c
void cdp1869_device::device_start() void cdp1869_device::device_start()
{ {
// get the screen device // get the screen device
m_screen = m_machine.device<screen_device>(m_config.screen_tag); m_screen = machine().device<screen_device>(m_config.screen_tag);
assert(m_screen != NULL); assert(m_screen != NULL);
// resolve callbacks // resolve callbacks
@ -434,7 +434,7 @@ void cdp1869_device::device_start()
initialize_palette(); initialize_palette();
// create sound stream // create sound stream
m_stream = m_machine.sound().stream_alloc(*this, 0, 1, m_machine.sample_rate()); m_stream = machine().sound().stream_alloc(*this, 0, 1, machine().sample_rate());
// register for state saving // register for state saving
save_item(NAME(m_prd)); save_item(NAME(m_prd));
@ -496,7 +496,7 @@ void cdp1869_device::initialize_palette()
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
{ {
palette_set_color(m_machine, i, get_rgb(i, i, 15)); palette_set_color(machine(), i, get_rgb(i, i, 15));
} }
// tone-on-tone display (CFC=1) // tone-on-tone display (CFC=1)
@ -504,7 +504,7 @@ void cdp1869_device::initialize_palette()
{ {
for (int l = 0; l < 8; l++) for (int l = 0; l < 8; l++)
{ {
palette_set_color(m_machine, i, get_rgb(i, c, l)); palette_set_color(machine(), i, get_rgb(i, c, l));
i++; i++;
} }
} }
@ -529,7 +529,7 @@ void cdp1869_device::sound_stream_update(sound_stream &stream, stream_sample_t *
double frequency = (clock() / 2) / (512 >> m_tonefreq) / (m_tonediv + 1); double frequency = (clock() / 2) / (512 >> m_tonefreq) / (m_tonediv + 1);
// double amplitude = m_toneamp * ((0.78*5) / 15); // double amplitude = m_toneamp * ((0.78*5) / 15);
int rate = m_machine.sample_rate() / 2; int rate = machine().sample_rate() / 2;
/* get progress through wave */ /* get progress through wave */
int incr = m_incr; int incr = m_incr;

View File

@ -688,7 +688,7 @@ void discrete_device::init_nodes(const sound_block_list_t &block_list)
/* make sure we have one simple task /* make sure we have one simple task
* No need to create a node since there are no dependencies. * No need to create a node since there are no dependencies.
*/ */
task = auto_alloc_clear(m_machine, discrete_task(*this)); task = auto_alloc_clear(machine(), discrete_task(*this));
task_list.add(task); task_list.add(task);
} }
@ -722,7 +722,7 @@ void discrete_device::init_nodes(const sound_block_list_t &block_list)
{ {
if (task != NULL) if (task != NULL)
fatalerror("init_nodes() - Nested DISCRETE_START_TASK."); fatalerror("init_nodes() - Nested DISCRETE_START_TASK.");
task = auto_alloc_clear(m_machine, discrete_task(*this)); task = auto_alloc_clear(machine(), discrete_task(*this));
task->task_group = block->initial[0]; task->task_group = block->initial[0];
if (task->task_group < 0 || task->task_group >= DISCRETE_MAX_TASK_GROUPS) if (task->task_group < 0 || task->task_group >= DISCRETE_MAX_TASK_GROUPS)
fatalerror("discrete_dso_task: illegal task_group %d", task->task_group); fatalerror("discrete_dso_task: illegal task_group %d", task->task_group);
@ -921,7 +921,7 @@ discrete_device::~discrete_device(void)
void discrete_device::device_start() void discrete_device::device_start()
{ {
// create the stream // create the stream
//m_stream = m_machine.sound().stream_alloc(*this, 0, 2, 22257); //m_stream = machine().sound().stream_alloc(*this, 0, 2, 22257);
const discrete_block *intf_start = (m_config.m_intf != NULL) ? m_config.m_intf : (discrete_block *) baseconfig().static_config(); const discrete_block *intf_start = (m_config.m_intf != NULL) ? m_config.m_intf : (discrete_block *) baseconfig().static_config();
char name[32]; char name[32];
@ -1021,7 +1021,7 @@ void discrete_sound_device::device_start()
fatalerror("init_nodes() - Couldn't find an output node"); fatalerror("init_nodes() - Couldn't find an output node");
/* initialize the stream(s) */ /* initialize the stream(s) */
m_stream = m_machine.sound().stream_alloc(*this,m_input_stream_list.count(), m_output_list.count(), m_sample_rate); m_stream = machine().sound().stream_alloc(*this,m_input_stream_list.count(), m_output_list.count(), m_sample_rate);
/* Finalize stream_input_nodes */ /* Finalize stream_input_nodes */
for_each(discrete_dss_input_stream_node **, node, &m_input_stream_list) for_each(discrete_dss_input_stream_node **, node, &m_input_stream_list)

View File

@ -47,9 +47,9 @@ ics2115_device::ics2115_device(running_machine &machine, const ics2115_device_co
void ics2115_device::device_start() void ics2115_device::device_start()
{ {
m_rom = *region(); m_rom = *region();
m_timer[0].timer = m_machine.scheduler().timer_alloc(FUNC(timer_cb_0), this); m_timer[0].timer = machine().scheduler().timer_alloc(FUNC(timer_cb_0), this);
m_timer[1].timer = m_machine.scheduler().timer_alloc(FUNC(timer_cb_1), this); m_timer[1].timer = machine().scheduler().timer_alloc(FUNC(timer_cb_1), this);
m_stream = m_machine.sound().stream_alloc(*this, 0, 2, 33075); m_stream = machine().sound().stream_alloc(*this, 0, 2, 33075);
//Exact formula as per patent 5809466 //Exact formula as per patent 5809466
//This seems to give the ok fit but it is not good enough. //This seems to give the ok fit but it is not good enough.

View File

@ -177,7 +177,7 @@ void okim6295_device::device_start()
// create the stream // create the stream
int divisor = m_config.m_pin7 ? 132 : 165; int divisor = m_config.m_pin7 ? 132 : 165;
m_stream = m_machine.sound().stream_alloc(*this, 0, 1, clock() / divisor); m_stream = machine().sound().stream_alloc(*this, 0, 1, clock() / divisor);
save_item(NAME(m_command)); save_item(NAME(m_command));
save_item(NAME(m_bank_offs)); save_item(NAME(m_bank_offs));
@ -266,7 +266,7 @@ void okim6295_device::set_bank_base(offs_t base)
if (m_bank_installed) if (m_bank_installed)
{ {
m_bank_offs = base; m_bank_offs = base;
memory_set_bankptr(m_machine, tag(), m_region->base() + base); memory_set_bankptr(machine(), tag(), m_region->base() + base);
} }
} }

View File

@ -150,7 +150,7 @@ void okim9810_device::device_start()
// create the stream // create the stream
//int divisor = m_config.m_pin7 ? 132 : 165; //int divisor = m_config.m_pin7 ? 132 : 165;
m_stream = m_machine.sound().stream_alloc(*this, 0, 2, clock()); m_stream = machine().sound().stream_alloc(*this, 0, 2, clock());
// save state stuff // save state stuff
// m_TMP_register // m_TMP_register

View File

@ -1148,7 +1148,7 @@ void spu_device::init_stream()
{ {
const unsigned int hz=44100; const unsigned int hz=44100;
m_stream = m_machine.sound().stream_alloc(*this, 0, 2, hz); m_stream = machine().sound().stream_alloc(*this, 0, 2, hz);
rev=new reverb(hz); rev=new reverb(hz);

View File

@ -170,7 +170,7 @@ void speaker_device::device_start()
} }
// allocate the mixer stream // allocate the mixer stream
m_mixer_stream = m_machine.sound().stream_alloc(*this, m_auto_allocated_inputs, 1, m_machine.sample_rate()); m_mixer_stream = machine().sound().stream_alloc(*this, m_auto_allocated_inputs, 1, machine().sample_rate());
} }
@ -182,7 +182,7 @@ void speaker_device::device_start()
void speaker_device::device_post_load() void speaker_device::device_post_load()
{ {
m_mixer_stream->set_sample_rate(m_machine.sample_rate()); m_mixer_stream->set_sample_rate(machine().sample_rate());
} }

View File

@ -156,7 +156,7 @@ void state_manager::register_presave(prepost_func func, void *param)
fatalerror("Duplicate save state function (%p, %p)", param, func); fatalerror("Duplicate save state function (%p, %p)", param, func);
// allocate a new entry // allocate a new entry
m_presave_list.append(*auto_alloc(m_machine, state_callback(func, param))); m_presave_list.append(*auto_alloc(machine(), state_callback(func, param)));
} }
@ -177,7 +177,7 @@ void state_manager::register_postload(prepost_func func, void *param)
fatalerror("Duplicate save state function (%p, %p)", param, func); fatalerror("Duplicate save state function (%p, %p)", param, func);
// allocate a new entry // allocate a new entry
m_postload_list.append(*auto_alloc(m_machine, state_callback(func, param))); m_postload_list.append(*auto_alloc(machine(), state_callback(func, param)));
} }
@ -194,7 +194,7 @@ void state_manager::save_memory(const char *module, const char *tag, UINT32 inde
if (!m_reg_allowed) if (!m_reg_allowed)
{ {
logerror("Attempt to register save state entry after state registration is closed!\nModule %s tag %s name %s\n", module, tag, name); logerror("Attempt to register save state entry after state registration is closed!\nModule %s tag %s name %s\n", module, tag, name);
if (m_machine.system().flags & GAME_SUPPORTS_SAVE) if (machine().system().flags & GAME_SUPPORTS_SAVE)
fatalerror("Attempt to register save state entry after state registration is closed!\nModule %s tag %s name %s\n", module, tag, name); fatalerror("Attempt to register save state entry after state registration is closed!\nModule %s tag %s name %s\n", module, tag, name);
m_illegal_regs++; m_illegal_regs++;
return; return;
@ -222,7 +222,7 @@ void state_manager::save_memory(const char *module, const char *tag, UINT32 inde
} }
// insert us into the list // insert us into the list
m_entry_list.insert_after(*auto_alloc(m_machine, state_entry(val, totalname, valsize, valcount)), insert_after); m_entry_list.insert_after(*auto_alloc(machine(), state_entry(val, totalname, valsize, valcount)), insert_after);
} }
@ -273,7 +273,7 @@ state_save_error state_manager::read_file(emu_file &file)
// verify the header and report an error if it doesn't match // verify the header and report an error if it doesn't match
UINT32 sig = signature(); UINT32 sig = signature();
if (validate_header(header, m_machine.system().name, sig, popmessage, "Error: ") != STATERR_NONE) if (validate_header(header, machine().system().name, sig, popmessage, "Error: ") != STATERR_NONE)
return STATERR_INVALID_HEADER; return STATERR_INVALID_HEADER;
// determine whether or not to flip the data when done // determine whether or not to flip the data when done
@ -293,7 +293,7 @@ state_save_error state_manager::read_file(emu_file &file)
// call the post-load functions // call the post-load functions
for (state_callback *func = m_postload_list.first(); func != NULL; func = func->next()) for (state_callback *func = m_postload_list.first(); func != NULL; func = func->next())
(*func->m_func)(m_machine, func->m_param); (*func->m_func)(machine(), func->m_param);
return STATERR_NONE; return STATERR_NONE;
} }
@ -314,7 +314,7 @@ state_save_error state_manager::write_file(emu_file &file)
memcpy(&header[0], s_magic_num, 8); memcpy(&header[0], s_magic_num, 8);
header[8] = SAVE_VERSION; header[8] = SAVE_VERSION;
header[9] = NATIVE_ENDIAN_VALUE_LE_BE(0, SS_MSB_FIRST); header[9] = NATIVE_ENDIAN_VALUE_LE_BE(0, SS_MSB_FIRST);
strncpy((char *)&header[0x0a], m_machine.system().name, 0x1c - 0x0a); strncpy((char *)&header[0x0a], machine().system().name, 0x1c - 0x0a);
UINT32 sig = signature(); UINT32 sig = signature();
*(UINT32 *)&header[0x1c] = LITTLE_ENDIANIZE_INT32(sig); *(UINT32 *)&header[0x1c] = LITTLE_ENDIANIZE_INT32(sig);
@ -327,7 +327,7 @@ state_save_error state_manager::write_file(emu_file &file)
// call the pre-save functions // call the pre-save functions
for (state_callback *func = m_presave_list.first(); func != NULL; func = func->next()) for (state_callback *func = m_presave_list.first(); func != NULL; func = func->next())
(*func->m_func)(m_machine, func->m_param); (*func->m_func)(machine(), func->m_param);
// then write all the data // then write all the data
for (state_entry *entry = m_entry_list.first(); entry != NULL; entry = entry->next()) for (state_entry *entry = m_entry_list.first(); entry != NULL; entry = entry->next())

View File

@ -148,6 +148,7 @@ public:
state_manager(running_machine &machine); state_manager(running_machine &machine);
// getters // getters
running_machine &machine() const { return m_machine; }
int registration_count() const { return m_entry_list.count(); } int registration_count() const { return m_entry_list.count(); }
bool registration_allowed() const { return m_reg_allowed; } bool registration_allowed() const { return m_reg_allowed; }

View File

@ -280,7 +280,7 @@ void timer_device::device_start()
{ {
// fetch the screen // fetch the screen
if (m_config.m_screen != NULL) if (m_config.m_screen != NULL)
m_screen = downcast<screen_device *>(m_machine.device(m_config.m_screen)); m_screen = downcast<screen_device *>(machine().device(m_config.m_screen));
// allocate the timer // allocate the timer
m_timer = timer_alloc(); m_timer = timer_alloc();

View File

@ -218,9 +218,9 @@ void video_manager::set_frameskip(int frameskip)
void video_manager::frame_update(bool debug) void video_manager::frame_update(bool debug)
{ {
// only render sound and video if we're in the running phase // only render sound and video if we're in the running phase
int phase = m_machine.phase(); int phase = machine().phase();
bool skipped_it = m_skipping_this_frame; bool skipped_it = m_skipping_this_frame;
if (phase == MACHINE_PHASE_RUNNING && (!m_machine.paused() || m_machine.options().update_in_pause())) if (phase == MACHINE_PHASE_RUNNING && (!machine().paused() || machine().options().update_in_pause()))
{ {
bool anything_changed = finish_screen_updates(); bool anything_changed = finish_screen_updates();
@ -234,24 +234,24 @@ void video_manager::frame_update(bool debug)
} }
// draw the user interface // draw the user interface
ui_update_and_render(m_machine, &m_machine.render().ui_container()); ui_update_and_render(machine(), &machine().render().ui_container());
// update the internal render debugger // update the internal render debugger
debugint_update_during_game(m_machine); debugint_update_during_game(machine());
// if we're throttling, synchronize before rendering // if we're throttling, synchronize before rendering
attotime current_time = m_machine.time(); attotime current_time = machine().time();
if (!debug && !skipped_it && effective_throttle()) if (!debug && !skipped_it && effective_throttle())
update_throttle(current_time); update_throttle(current_time);
// ask the OSD to update // ask the OSD to update
g_profiler.start(PROFILER_BLIT); g_profiler.start(PROFILER_BLIT);
m_machine.osd().update(!debug && skipped_it); machine().osd().update(!debug && skipped_it);
g_profiler.stop(); g_profiler.stop();
// perform tasks for this frame // perform tasks for this frame
if (!debug) if (!debug)
m_machine.call_notifiers(MACHINE_NOTIFY_FRAME); machine().call_notifiers(MACHINE_NOTIFY_FRAME);
// update frameskipping // update frameskipping
if (!debug) if (!debug)
@ -265,14 +265,14 @@ void video_manager::frame_update(bool debug)
if (phase == MACHINE_PHASE_RUNNING) if (phase == MACHINE_PHASE_RUNNING)
{ {
// reset partial updates if we're paused or if the debugger is active // reset partial updates if we're paused or if the debugger is active
if (m_machine.primary_screen != NULL && (m_machine.paused() || debug || debugger_within_instruction_hook(m_machine))) if (machine().primary_screen != NULL && (machine().paused() || debug || debugger_within_instruction_hook(machine())))
m_machine.primary_screen->scanline0_callback(); machine().primary_screen->scanline0_callback();
// otherwise, call the video EOF callback // otherwise, call the video EOF callback
else else
{ {
g_profiler.start(PROFILER_VIDEO); g_profiler.start(PROFILER_VIDEO);
for (screen_device *screen = m_machine.first_screen(); screen != NULL; screen = screen->next_screen()) for (screen_device *screen = machine().first_screen(); screen != NULL; screen = screen->next_screen())
screen->screen_eof(); screen->screen_eof();
g_profiler.stop(); g_profiler.stop();
} }
@ -290,7 +290,7 @@ astring &video_manager::speed_text(astring &string)
string.reset(); string.reset();
// if we're paused, just display Paused // if we're paused, just display Paused
bool paused = m_machine.paused(); bool paused = machine().paused();
if (paused) if (paused)
string.cat("paused"); string.cat("paused");
@ -312,7 +312,7 @@ astring &video_manager::speed_text(astring &string)
// display the number of partial updates as well // display the number of partial updates as well
int partials = 0; int partials = 0;
for (screen_device *screen = m_machine.first_screen(); screen != NULL; screen = screen->next_screen()) for (screen_device *screen = machine().first_screen(); screen != NULL; screen = screen->next_screen())
partials += screen->partial_updates(); partials += screen->partial_updates();
if (partials > 1) if (partials > 1)
string.catprintf("\n%d partial updates", partials); string.catprintf("\n%d partial updates", partials);
@ -336,14 +336,14 @@ void video_manager::save_snapshot(screen_device *screen, emu_file &file)
// add two text entries describing the image // add two text entries describing the image
astring text1(APPNAME, " ", build_version); astring text1(APPNAME, " ", build_version);
astring text2(m_machine.system().manufacturer, " ", m_machine.system().description); astring text2(machine().system().manufacturer, " ", machine().system().description);
png_info pnginfo = { 0 }; png_info pnginfo = { 0 };
png_add_text(&pnginfo, "Software", text1); png_add_text(&pnginfo, "Software", text1);
png_add_text(&pnginfo, "System", text2); png_add_text(&pnginfo, "System", text2);
// now do the actual work // now do the actual work
const rgb_t *palette = (m_machine.palette != NULL) ? palette_entry_list_adjusted(m_machine.palette) : NULL; const rgb_t *palette = (machine().palette != NULL) ? palette_entry_list_adjusted(machine().palette) : NULL;
png_error error = png_write_bitmap(file, &pnginfo, m_snap_bitmap, m_machine.total_colors(), palette); png_error error = png_write_bitmap(file, &pnginfo, m_snap_bitmap, machine().total_colors(), palette);
if (error != PNGERR_NONE) if (error != PNGERR_NONE)
mame_printf_error("Error generating PNG for snapshot: png_error = %d\n", error); mame_printf_error("Error generating PNG for snapshot: png_error = %d\n", error);
@ -363,10 +363,10 @@ void video_manager::save_active_screen_snapshots()
if (m_snap_native) if (m_snap_native)
{ {
// write one snapshot per visible screen // write one snapshot per visible screen
for (screen_device *screen = m_machine.first_screen(); screen != NULL; screen = screen->next_screen()) for (screen_device *screen = machine().first_screen(); screen != NULL; screen = screen->next_screen())
if (m_machine.render().is_live(*screen)) if (machine().render().is_live(*screen))
{ {
emu_file file(m_machine.options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); emu_file file(machine().options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
file_error filerr = open_next(file, "png"); file_error filerr = open_next(file, "png");
if (filerr == FILERR_NONE) if (filerr == FILERR_NONE)
save_snapshot(screen, file); save_snapshot(screen, file);
@ -376,7 +376,7 @@ void video_manager::save_active_screen_snapshots()
// otherwise, just write a single snapshot // otherwise, just write a single snapshot
else else
{ {
emu_file file(m_machine.options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); emu_file file(machine().options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
file_error filerr = open_next(file, "png"); file_error filerr = open_next(file, "png");
if (filerr == FILERR_NONE) if (filerr == FILERR_NONE)
save_snapshot(NULL, file); save_snapshot(NULL, file);
@ -398,7 +398,7 @@ void video_manager::begin_recording(const char *name, movie_format format)
// reset the state // reset the state
m_movie_frame = 0; m_movie_frame = 0;
m_movie_next_frame_time = m_machine.time(); m_movie_next_frame_time = machine().time();
// start up an AVI recording // start up an AVI recording
if (format == MF_AVI) if (format == MF_AVI)
@ -406,7 +406,7 @@ void video_manager::begin_recording(const char *name, movie_format format)
// build up information about this new movie // build up information about this new movie
avi_movie_info info; avi_movie_info info;
info.video_format = 0; info.video_format = 0;
info.video_timescale = 1000 * ((m_machine.primary_screen != NULL) ? ATTOSECONDS_TO_HZ(m_machine.primary_screen->frame_period().attoseconds) : screen_device::DEFAULT_FRAME_RATE); info.video_timescale = 1000 * ((machine().primary_screen != NULL) ? ATTOSECONDS_TO_HZ(machine().primary_screen->frame_period().attoseconds) : screen_device::DEFAULT_FRAME_RATE);
info.video_sampletime = 1000; info.video_sampletime = 1000;
info.video_numsamples = 0; info.video_numsamples = 0;
info.video_width = m_snap_bitmap->width; info.video_width = m_snap_bitmap->width;
@ -414,18 +414,18 @@ void video_manager::begin_recording(const char *name, movie_format format)
info.video_depth = 24; info.video_depth = 24;
info.audio_format = 0; info.audio_format = 0;
info.audio_timescale = m_machine.sample_rate(); info.audio_timescale = machine().sample_rate();
info.audio_sampletime = 1; info.audio_sampletime = 1;
info.audio_numsamples = 0; info.audio_numsamples = 0;
info.audio_channels = 2; info.audio_channels = 2;
info.audio_samplebits = 16; info.audio_samplebits = 16;
info.audio_samplerate = m_machine.sample_rate(); info.audio_samplerate = machine().sample_rate();
// create a new temporary movie file // create a new temporary movie file
file_error filerr; file_error filerr;
astring fullpath; astring fullpath;
{ {
emu_file tempfile(m_machine.options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); emu_file tempfile(machine().options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
if (name != NULL) if (name != NULL)
filerr = tempfile.open(name); filerr = tempfile.open(name);
else else
@ -452,7 +452,7 @@ void video_manager::begin_recording(const char *name, movie_format format)
else if (format == MF_MNG) else if (format == MF_MNG)
{ {
// create a new movie file and start recording // create a new movie file and start recording
m_mngfile = auto_alloc(m_machine, emu_file(m_machine.options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS)); m_mngfile = auto_alloc(machine(), emu_file(machine().options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS));
file_error filerr; file_error filerr;
if (name != NULL) if (name != NULL)
filerr = m_mngfile->open(name); filerr = m_mngfile->open(name);
@ -462,7 +462,7 @@ void video_manager::begin_recording(const char *name, movie_format format)
if (filerr == FILERR_NONE) if (filerr == FILERR_NONE)
{ {
// start the capture // start the capture
int rate = (m_machine.primary_screen != NULL) ? ATTOSECONDS_TO_HZ(m_machine.primary_screen->frame_period().attoseconds) : screen_device::DEFAULT_FRAME_RATE; int rate = (machine().primary_screen != NULL) ? ATTOSECONDS_TO_HZ(machine().primary_screen->frame_period().attoseconds) : screen_device::DEFAULT_FRAME_RATE;
png_error pngerr = mng_capture_start(*m_mngfile, m_snap_bitmap, rate); png_error pngerr = mng_capture_start(*m_mngfile, m_snap_bitmap, rate);
if (pngerr != PNGERR_NONE) if (pngerr != PNGERR_NONE)
return end_recording(); return end_recording();
@ -497,7 +497,7 @@ void video_manager::end_recording()
if (m_mngfile != NULL) if (m_mngfile != NULL)
{ {
mng_capture_stop(*m_mngfile); mng_capture_stop(*m_mngfile);
auto_free(m_machine, m_mngfile); auto_free(machine(), m_mngfile);
m_mngfile = NULL; m_mngfile = NULL;
} }
@ -547,10 +547,10 @@ void video_manager::exit()
// free all the graphics elements // free all the graphics elements
for (int i = 0; i < MAX_GFX_ELEMENTS; i++) for (int i = 0; i < MAX_GFX_ELEMENTS; i++)
gfx_element_free(m_machine.gfx[i]); gfx_element_free(machine().gfx[i]);
// free the snapshot target // free the snapshot target
m_machine.render().target_free(m_snap_target); machine().render().target_free(m_snap_target);
if (m_snap_bitmap != NULL) if (m_snap_bitmap != NULL)
global_free(m_snap_bitmap); global_free(m_snap_bitmap);
@ -584,7 +584,7 @@ TIMER_CALLBACK( video_manager::screenless_update_callback )
void video_manager::postload() void video_manager::postload()
{ {
m_movie_next_frame_time = m_machine.time(); m_movie_next_frame_time = machine().time();
} }
@ -597,7 +597,7 @@ void video_manager::postload()
inline int video_manager::effective_autoframeskip() const inline int video_manager::effective_autoframeskip() const
{ {
// if we're fast forwarding or paused, autoframeskip is disabled // if we're fast forwarding or paused, autoframeskip is disabled
if (m_fastforward || m_machine.paused()) if (m_fastforward || machine().paused())
return false; return false;
// otherwise, it's up to the user // otherwise, it's up to the user
@ -631,7 +631,7 @@ inline int video_manager::effective_frameskip() const
inline bool video_manager::effective_throttle() const inline bool video_manager::effective_throttle() const
{ {
// if we're paused, or if the UI is active, we always throttle // if we're paused, or if the UI is active, we always throttle
if (m_machine.paused() || ui_is_menu_active()) if (machine().paused() || ui_is_menu_active())
return true; return true;
// if we're fast forwarding, we don't throttle // if we're fast forwarding, we don't throttle
@ -650,7 +650,7 @@ inline bool video_manager::effective_throttle() const
inline int video_manager::original_speed_setting() const inline int video_manager::original_speed_setting() const
{ {
return m_machine.options().speed() * 100.0 + 0.5; return machine().options().speed() * 100.0 + 0.5;
} }
@ -662,27 +662,27 @@ inline int video_manager::original_speed_setting() const
bool video_manager::finish_screen_updates() bool video_manager::finish_screen_updates()
{ {
// finish updating the screens // finish updating the screens
for (screen_device *screen = m_machine.first_screen(); screen != NULL; screen = screen->next_screen()) for (screen_device *screen = machine().first_screen(); screen != NULL; screen = screen->next_screen())
screen->update_partial(screen->visible_area().max_y); screen->update_partial(screen->visible_area().max_y);
// now add the quads for all the screens // now add the quads for all the screens
bool anything_changed = false; bool anything_changed = false;
for (screen_device *screen = m_machine.first_screen(); screen != NULL; screen = screen->next_screen()) for (screen_device *screen = machine().first_screen(); screen != NULL; screen = screen->next_screen())
if (screen->update_quads()) if (screen->update_quads())
anything_changed = true; anything_changed = true;
// update our movie recording and burn-in state // update our movie recording and burn-in state
if (!m_machine.paused()) if (!machine().paused())
{ {
record_frame(); record_frame();
// iterate over screens and update the burnin for the ones that care // iterate over screens and update the burnin for the ones that care
for (screen_device *screen = m_machine.first_screen(); screen != NULL; screen = screen->next_screen()) for (screen_device *screen = machine().first_screen(); screen != NULL; screen = screen->next_screen())
screen->update_burnin(); screen->update_burnin();
} }
// draw any crosshairs // draw any crosshairs
for (screen_device *screen = m_machine.first_screen(); screen != NULL; screen = screen->next_screen()) for (screen_device *screen = machine().first_screen(); screen != NULL; screen = screen->next_screen())
crosshair_render(*screen); crosshair_render(*screen);
return anything_changed; return anything_changed;
@ -761,7 +761,7 @@ void video_manager::update_throttle(attotime emutime)
// and explicitly reset our tracked real and emulated timers to that value ... // and explicitly reset our tracked real and emulated timers to that value ...
// this means we pretend that the last update was exactly 1/60th of a second // this means we pretend that the last update was exactly 1/60th of a second
// ago, and was in sync in both real and emulated time // ago, and was in sync in both real and emulated time
if (m_machine.paused()) if (machine().paused())
{ {
m_throttle_emutime = emutime - attotime(0, ATTOSECONDS_PER_SECOND / PAUSED_REFRESH_RATE); m_throttle_emutime = emutime - attotime(0, ATTOSECONDS_PER_SECOND / PAUSED_REFRESH_RATE);
m_throttle_realtime = m_throttle_emutime; m_throttle_realtime = m_throttle_emutime;
@ -850,9 +850,9 @@ osd_ticks_t video_manager::throttle_until_ticks(osd_ticks_t target_ticks)
// we're allowed to sleep via the OSD code only if we're configured to do so // we're allowed to sleep via the OSD code only if we're configured to do so
// and we're not frameskipping due to autoframeskip, or if we're paused // and we're not frameskipping due to autoframeskip, or if we're paused
bool allowed_to_sleep = false; bool allowed_to_sleep = false;
if (m_machine.options().sleep() && (!effective_autoframeskip() || effective_frameskip() == 0)) if (machine().options().sleep() && (!effective_autoframeskip() || effective_frameskip() == 0))
allowed_to_sleep = true; allowed_to_sleep = true;
if (m_machine.paused()) if (machine().paused())
allowed_to_sleep = true; allowed_to_sleep = true;
// loop until we reach our target // loop until we reach our target
@ -956,15 +956,15 @@ void video_manager::update_frameskip()
void video_manager::update_refresh_speed() void video_manager::update_refresh_speed()
{ {
// only do this if the refreshspeed option is used // only do this if the refreshspeed option is used
if (m_machine.options().refresh_speed()) if (machine().options().refresh_speed())
{ {
float minrefresh = m_machine.render().max_update_rate(); float minrefresh = machine().render().max_update_rate();
if (minrefresh != 0) if (minrefresh != 0)
{ {
// find the screen with the shortest frame period (max refresh rate) // find the screen with the shortest frame period (max refresh rate)
// note that we first check the token since this can get called before all screens are created // note that we first check the token since this can get called before all screens are created
attoseconds_t min_frame_period = ATTOSECONDS_PER_SECOND; attoseconds_t min_frame_period = ATTOSECONDS_PER_SECOND;
for (screen_device *screen = m_machine.first_screen(); screen != NULL; screen = screen->next_screen()) for (screen_device *screen = machine().first_screen(); screen != NULL; screen = screen->next_screen())
{ {
attoseconds_t period = screen->frame_period().attoseconds; attoseconds_t period = screen->frame_period().attoseconds;
if (period != 0) if (period != 0)
@ -998,7 +998,7 @@ void video_manager::update_refresh_speed()
void video_manager::recompute_speed(attotime emutime) void video_manager::recompute_speed(attotime emutime)
{ {
// if we don't have a starting time yet, or if we're paused, reset our starting point // if we don't have a starting time yet, or if we're paused, reset our starting point
if (m_speed_last_realtime == 0 || m_machine.paused()) if (m_speed_last_realtime == 0 || machine().paused())
{ {
m_speed_last_realtime = osd_ticks(); m_speed_last_realtime = osd_ticks();
m_speed_last_emutime = emutime; m_speed_last_emutime = emutime;
@ -1040,17 +1040,17 @@ void video_manager::recompute_speed(attotime emutime)
// if we're past the "time-to-execute" requested, signal an exit // if we're past the "time-to-execute" requested, signal an exit
if (m_seconds_to_run != 0 && emutime.seconds >= m_seconds_to_run) if (m_seconds_to_run != 0 && emutime.seconds >= m_seconds_to_run)
{ {
if (m_machine.primary_screen != NULL) if (machine().primary_screen != NULL)
{ {
// create a final screenshot // create a final screenshot
emu_file file(m_machine.options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); emu_file file(machine().options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
file_error filerr = file.open(m_machine.basename(), PATH_SEPARATOR "final.png"); file_error filerr = file.open(machine().basename(), PATH_SEPARATOR "final.png");
if (filerr == FILERR_NONE) if (filerr == FILERR_NONE)
save_snapshot(m_machine.primary_screen, file); save_snapshot(machine().primary_screen, file);
} }
// schedule our demise // schedule our demise
m_machine.schedule_exit(); machine().schedule_exit();
} }
} }
@ -1066,7 +1066,7 @@ void video_manager::create_snapshot_bitmap(device_t *screen)
// select the appropriate view in our dummy target // select the appropriate view in our dummy target
if (m_snap_native && screen != NULL) if (m_snap_native && screen != NULL)
{ {
int view_index = m_machine.m_devicelist.indexof(SCREEN, screen->tag()); int view_index = machine().m_devicelist.indexof(SCREEN, screen->tag());
assert(view_index != -1); assert(view_index != -1);
m_snap_target->set_view(view_index); m_snap_target->set_view(view_index);
} }
@ -1082,8 +1082,8 @@ void video_manager::create_snapshot_bitmap(device_t *screen)
if (m_snap_bitmap == NULL || width != m_snap_bitmap->width || height != m_snap_bitmap->height) if (m_snap_bitmap == NULL || width != m_snap_bitmap->width || height != m_snap_bitmap->height)
{ {
if (m_snap_bitmap != NULL) if (m_snap_bitmap != NULL)
auto_free(m_machine, m_snap_bitmap); auto_free(machine(), m_snap_bitmap);
m_snap_bitmap = auto_alloc(m_machine, bitmap_t(width, height, BITMAP_FORMAT_RGB32)); m_snap_bitmap = auto_alloc(machine(), bitmap_t(width, height, BITMAP_FORMAT_RGB32));
} }
// render the screen there // render the screen there
@ -1105,7 +1105,7 @@ file_error video_manager::open_next(emu_file &file, const char *extension)
UINT32 origflags = file.openflags(); UINT32 origflags = file.openflags();
// handle defaults // handle defaults
const char *snapname = m_machine.options().snap_name(); const char *snapname = machine().options().snap_name();
if (snapname == NULL || snapname[0] == 0) if (snapname == NULL || snapname[0] == 0)
snapname = "%g/%i"; snapname = "%g/%i";
@ -1154,7 +1154,7 @@ file_error video_manager::open_next(emu_file &file, const char *extension)
// verify that there is such a device for this system // verify that there is such a device for this system
device_image_interface *image = NULL; device_image_interface *image = NULL;
for (bool gotone = m_machine.m_devicelist.first(image); gotone; gotone = image->next(image)) for (bool gotone = machine().m_devicelist.first(image); gotone; gotone = image->next(image))
{ {
// get the device name // get the device name
astring tempdevname(image->image_config().brief_instance_name()); astring tempdevname(image->image_config().brief_instance_name());
@ -1191,7 +1191,7 @@ file_error video_manager::open_next(emu_file &file, const char *extension)
// substitute path and gamename up front // substitute path and gamename up front
snapstr.replace(0, "/", PATH_SEPARATOR); snapstr.replace(0, "/", PATH_SEPARATOR);
snapstr.replace(0, "%g", m_machine.basename()); snapstr.replace(0, "%g", machine().basename());
// determine if the template has an index; if not, we always use the same name // determine if the template has an index; if not, we always use the same name
astring fname; astring fname;
@ -1235,7 +1235,7 @@ void video_manager::record_frame()
// start the profiler and get the current time // start the profiler and get the current time
g_profiler.start(PROFILER_MOVIE_REC); g_profiler.start(PROFILER_MOVIE_REC);
attotime curtime = m_machine.time(); attotime curtime = machine().time();
// create the bitmap // create the bitmap
create_snapshot_bitmap(NULL); create_snapshot_bitmap(NULL);
@ -1263,14 +1263,14 @@ void video_manager::record_frame()
if (m_movie_frame == 0) if (m_movie_frame == 0)
{ {
astring text1(APPNAME, " ", build_version); astring text1(APPNAME, " ", build_version);
astring text2(m_machine.system().manufacturer, " ", m_machine.system().description); astring text2(machine().system().manufacturer, " ", machine().system().description);
png_add_text(&pnginfo, "Software", text1); png_add_text(&pnginfo, "Software", text1);
png_add_text(&pnginfo, "System", text2); png_add_text(&pnginfo, "System", text2);
} }
// write the next frame // write the next frame
const rgb_t *palette = (m_machine.palette != NULL) ? palette_entry_list_adjusted(m_machine.palette) : NULL; const rgb_t *palette = (machine().palette != NULL) ? palette_entry_list_adjusted(machine().palette) : NULL;
png_error error = mng_capture_frame(*m_mngfile, &pnginfo, m_snap_bitmap, m_machine.total_colors(), palette); png_error error = mng_capture_frame(*m_mngfile, &pnginfo, m_snap_bitmap, machine().total_colors(), palette);
png_free(&pnginfo); png_free(&pnginfo);
if (error != PNGERR_NONE) if (error != PNGERR_NONE)
{ {

View File

@ -86,6 +86,7 @@ public:
video_manager(running_machine &machine); video_manager(running_machine &machine);
// getters // getters
running_machine &machine() const { return m_machine; }
bool skip_this_frame() const { return m_skipping_this_frame; } bool skip_this_frame() const { return m_skipping_this_frame; }
int speed_factor() const { return m_speed; } int speed_factor() const { return m_speed; }
int frameskip() const { return m_auto_frameskip ? -1 : m_frameskip_level; } int frameskip() const { return m_auto_frameskip ? -1 : m_frameskip_level; }

View File

@ -95,9 +95,9 @@ void cdp1861_device::device_start()
m_dma_timer = timer_alloc(TIMER_DMA); m_dma_timer = timer_alloc(TIMER_DMA);
// find devices // find devices
m_cpu = m_machine.device<cpu_device>(m_config.m_cpu_tag); m_cpu = machine().device<cpu_device>(m_config.m_cpu_tag);
m_screen = m_machine.device<screen_device>(m_config.m_screen_tag); m_screen = machine().device<screen_device>(m_config.m_screen_tag);
m_bitmap = auto_bitmap_alloc(m_machine, m_screen->width(), m_screen->height(), m_screen->format()); m_bitmap = auto_bitmap_alloc(machine(), m_screen->width(), m_screen->height(), m_screen->format());
// register for state saving // register for state saving
save_item(NAME(m_disp)); save_item(NAME(m_disp));
@ -274,6 +274,6 @@ void cdp1861_device::update_screen(bitmap_t *bitmap, const rectangle *cliprect)
} }
else else
{ {
bitmap_fill(bitmap, cliprect, get_black_pen(m_machine)); bitmap_fill(bitmap, cliprect, get_black_pen(machine()));
} }
} }

View File

@ -103,7 +103,7 @@ inline void cdp1862_device::initialize_palette()
g = (i & 1) ? luma : 0; g = (i & 1) ? luma : 0;
b = (i & 2) ? luma : 0; b = (i & 2) ? luma : 0;
palette_set_color_rgb(m_machine, i, r, g, b); palette_set_color_rgb(machine(), i, r, g, b);
} }
} }
@ -136,8 +136,8 @@ void cdp1862_device::device_start()
devcb_resolve_read_line(&m_in_gd_func, &m_config.m_in_gd_func, this); devcb_resolve_read_line(&m_in_gd_func, &m_config.m_in_gd_func, this);
// find devices // find devices
m_screen = m_machine.device<screen_device>(m_config.m_screen_tag); m_screen = machine().device<screen_device>(m_config.m_screen_tag);
m_bitmap = auto_bitmap_alloc(m_machine, m_screen->width(), m_screen->height(), m_screen->format()); m_bitmap = auto_bitmap_alloc(machine(), m_screen->width(), m_screen->height(), m_screen->format());
// init palette // init palette
initialize_palette(); initialize_palette();

View File

@ -566,7 +566,7 @@ void crt9007_device::device_start()
devcb_resolve_write_line(&m_out_sld_func, &m_config.out_sld_func, this); devcb_resolve_write_line(&m_out_sld_func, &m_config.out_sld_func, this);
// get the screen device // get the screen device
m_screen = m_machine.device<screen_device>(m_config.screen_tag); m_screen = machine().device<screen_device>(m_config.screen_tag);
assert(m_screen != NULL); assert(m_screen != NULL);
// set horizontal pixels per column // set horizontal pixels per column

View File

@ -166,7 +166,7 @@ void crt9021_device::device_start()
devcb_resolve_read_line(&m_in_atten_func, &m_config.in_atten_func, this); devcb_resolve_read_line(&m_in_atten_func, &m_config.in_atten_func, this);
// get the screen device // get the screen device
m_screen = m_machine.device<screen_device>(m_config.screen_tag); m_screen = machine().device<screen_device>(m_config.screen_tag);
assert(m_screen != NULL); assert(m_screen != NULL);
// register for state saving // register for state saving

View File

@ -117,7 +117,7 @@ hd44102_device::hd44102_device(running_machine &_machine, const hd44102_device_c
void hd44102_device::device_start() void hd44102_device::device_start()
{ {
// find screen // find screen
m_screen = m_machine.device<screen_device>(m_config.m_screen_tag); m_screen = machine().device<screen_device>(m_config.m_screen_tag);
// register for state saving // register for state saving
save_item(NAME(m_ram[0])); save_item(NAME(m_ram[0]));

View File

@ -208,7 +208,7 @@ void hd61830_device::device_start()
// resolve callbacks // resolve callbacks
devcb_resolve_read8(&m_in_rd_func, &m_config.m_in_rd_func, this); devcb_resolve_read8(&m_in_rd_func, &m_config.m_in_rd_func, this);
m_screen = m_machine.device<screen_device>(m_config.screen_tag); m_screen = machine().device<screen_device>(m_config.screen_tag);
// register for state saving // register for state saving
save_item(NAME(m_bf)); save_item(NAME(m_bf));

View File

@ -143,7 +143,7 @@ msm6255_device::msm6255_device(running_machine &_machine, const msm6255_device_c
void msm6255_device::device_start() void msm6255_device::device_start()
{ {
// find screen // find screen
m_screen = m_machine.device<screen_device>(m_config.m_screen_tag); m_screen = machine().device<screen_device>(m_config.m_screen_tag);
// register for state saving // register for state saving
save_item(NAME(m_ir)); save_item(NAME(m_ir));
@ -447,6 +447,6 @@ void msm6255_device::update_screen(bitmap_t *bitmap, const rectangle *cliprect)
} }
else else
{ {
bitmap_fill(bitmap, cliprect, get_black_pen(m_machine)); bitmap_fill(bitmap, cliprect, get_black_pen(machine()));
} }
} }

View File

@ -269,7 +269,7 @@ void upd3301_device::device_start()
devcb_resolve_write_line(&m_out_vrtc_func, &m_config.m_out_vrtc_func, this); devcb_resolve_write_line(&m_out_vrtc_func, &m_config.m_out_vrtc_func, this);
// get the screen device // get the screen device
m_screen = m_machine.device<screen_device>(m_config.m_screen_tag); m_screen = machine().device<screen_device>(m_config.m_screen_tag);
assert(m_screen != NULL); assert(m_screen != NULL);
// state saving // state saving
@ -663,6 +663,6 @@ void upd3301_device::update_screen(bitmap_t *bitmap, const rectangle *cliprect)
} }
else else
{ {
bitmap_fill(bitmap, cliprect, get_black_pen(m_machine)); bitmap_fill(bitmap, cliprect, get_black_pen(machine()));
} }
} }

View File

@ -142,7 +142,7 @@ static TIMER_DEVICE_CALLBACK( scanline_callback )
void beathead_state::machine_start() void beathead_state::machine_start()
{ {
atarigen_init(m_machine); atarigen_init(machine());
} }
@ -159,9 +159,9 @@ void beathead_state::machine_reset()
memcpy(m_ram_base, m_rom_base, 0x40); memcpy(m_ram_base, m_rom_base, 0x40);
/* compute the timing of the HBLANK interrupt and set the first timer */ /* compute the timing of the HBLANK interrupt and set the first timer */
m_hblank_offset = m_machine.primary_screen->scan_period() * (455 - 336 - 25) / 455; m_hblank_offset = machine().primary_screen->scan_period() * (455 - 336 - 25) / 455;
timer_device *scanline_timer = m_machine.device<timer_device>("scan_timer"); timer_device *scanline_timer = machine().device<timer_device>("scan_timer");
scanline_timer->adjust(m_machine.primary_screen->time_until_pos(0) - m_hblank_offset); scanline_timer->adjust(machine().primary_screen->time_until_pos(0) - m_hblank_offset);
/* reset IRQs */ /* reset IRQs */
m_irq_line_state = CLEAR_LINE; m_irq_line_state = CLEAR_LINE;
@ -192,7 +192,7 @@ void beathead_state::update_interrupts()
{ {
m_irq_line_state = gen_int; m_irq_line_state = gen_int;
//if (m_irq_line_state != CLEAR_LINE) //if (m_irq_line_state != CLEAR_LINE)
cputag_set_input_line(m_machine, "maincpu", ASAP_IRQ0, m_irq_line_state); cputag_set_input_line(machine(), "maincpu", ASAP_IRQ0, m_irq_line_state);
//else //else
//asap_set_irq_line(ASAP_IRQ0, m_irq_line_state); //asap_set_irq_line(ASAP_IRQ0, m_irq_line_state);
} }
@ -257,7 +257,7 @@ WRITE32_MEMBER( beathead_state::eeprom_enable_w )
READ32_MEMBER( beathead_state::input_2_r ) READ32_MEMBER( beathead_state::input_2_r )
{ {
int result = input_port_read(m_machine, "IN2"); int result = input_port_read(machine(), "IN2");
if (m_sound_to_cpu_ready) result ^= 0x10; if (m_sound_to_cpu_ready) result ^= 0x10;
if (m_cpu_to_sound_ready) result ^= 0x20; if (m_cpu_to_sound_ready) result ^= 0x20;
return result; return result;
@ -287,7 +287,7 @@ WRITE32_MEMBER( beathead_state::sound_data_w )
WRITE32_MEMBER( beathead_state::sound_reset_w ) WRITE32_MEMBER( beathead_state::sound_reset_w )
{ {
logerror("Sound reset = %d\n", !offset); logerror("Sound reset = %d\n", !offset);
cputag_set_input_line(m_machine, "jsa", INPUT_LINE_RESET, offset ? CLEAR_LINE : ASSERT_LINE); cputag_set_input_line(machine(), "jsa", INPUT_LINE_RESET, offset ? CLEAR_LINE : ASSERT_LINE);
} }
@ -300,7 +300,7 @@ WRITE32_MEMBER( beathead_state::sound_reset_w )
WRITE32_MEMBER( beathead_state::coin_count_w ) WRITE32_MEMBER( beathead_state::coin_count_w )
{ {
coin_counter_w(m_machine, 0, !offset); coin_counter_w(machine(), 0, !offset);
} }

View File

@ -45,7 +45,7 @@ WRITE8_MEMBER( draco_state::sound_bankswitch_w )
int bank = BIT(data, 3); int bank = BIT(data, 3);
memory_set_bank(m_machine, "bank1", bank); memory_set_bank(machine(), "bank1", bank);
} }
WRITE8_MEMBER( draco_state::sound_g_w ) WRITE8_MEMBER( draco_state::sound_g_w )
@ -127,9 +127,9 @@ WRITE8_MEMBER( cidelsa_state::altair_out1_w )
7 CONT. M1 7 CONT. M1
*/ */
set_led_status(m_machine, 0, data & 0x08); // 1P set_led_status(machine(), 0, data & 0x08); // 1P
set_led_status(m_machine, 1, data & 0x10); // 2P set_led_status(machine(), 1, data & 0x10); // 2P
set_led_status(m_machine, 2, data & 0x20); // FIRE set_led_status(machine(), 2, data & 0x20); // FIRE
} }
WRITE8_MEMBER( draco_state::out1_w ) WRITE8_MEMBER( draco_state::out1_w )
@ -442,8 +442,8 @@ void cidelsa_state::machine_start()
void draco_state::machine_start() void draco_state::machine_start()
{ {
/* setup COP402 memory banking */ /* setup COP402 memory banking */
memory_configure_bank(m_machine, "bank1", 0, 2, m_machine.region(COP402N_TAG)->base(), 0x400); memory_configure_bank(machine(), "bank1", 0, 2, machine().region(COP402N_TAG)->base(), 0x400);
memory_set_bank(m_machine, "bank1", 0); memory_set_bank(machine(), "bank1", 0);
/* register for state saving */ /* register for state saving */
save_item(NAME(m_reset)); save_item(NAME(m_reset));
@ -457,7 +457,7 @@ void cidelsa_state::machine_reset()
{ {
/* reset the CPU */ /* reset the CPU */
m_reset = 0; m_reset = 0;
m_machine.scheduler().timer_set(attotime::from_msec(200), FUNC(set_cpu_mode)); machine().scheduler().timer_set(attotime::from_msec(200), FUNC(set_cpu_mode));
} }
/* Machine Drivers */ /* Machine Drivers */

View File

@ -895,11 +895,11 @@ static READ32_DEVICE_HANDLER( timekeeper_32be_r )
void itech32_state::nvram_init(nvram_device &nvram, void *base, size_t length) void itech32_state::nvram_init(nvram_device &nvram, void *base, size_t length)
{ {
itech32_state *state = m_machine.driver_data<itech32_state>(); itech32_state *state = machine().driver_data<itech32_state>();
// if nvram is the main RAM, don't overwrite exception vectors // if nvram is the main RAM, don't overwrite exception vectors
int start = (base == state->m_main_ram) ? 0x80 : 0x00; int start = (base == state->m_main_ram) ? 0x80 : 0x00;
for (int i = start; i < length; i++) for (int i = start; i < length; i++)
((UINT8 *)base)[i] = m_machine.rand(); ((UINT8 *)base)[i] = machine().rand();
// due to accessing uninitialized RAM, we need this hack // due to accessing uninitialized RAM, we need this hack
if (state->m_is_drivedge) if (state->m_is_drivedge)

View File

@ -161,13 +161,13 @@ void liberatr_state::machine_start()
WRITE8_MEMBER( liberatr_state::led_w ) WRITE8_MEMBER( liberatr_state::led_w )
{ {
set_led_status(m_machine, offset, ~data & 0x10); set_led_status(machine(), offset, ~data & 0x10);
} }
WRITE8_MEMBER( liberatr_state::coin_counter_w ) WRITE8_MEMBER( liberatr_state::coin_counter_w )
{ {
::coin_counter_w(m_machine, offset ^ 0x01, data & 0x10); ::coin_counter_w(machine(), offset ^ 0x01, data & 0x10);
} }
@ -184,8 +184,8 @@ WRITE8_MEMBER( liberatr_state::trackball_reset_w )
/* input becomes the starting point for the trackball counters */ /* input becomes the starting point for the trackball counters */
if (((data ^ m_ctrld) & 0x10) && (data & 0x10)) if (((data ^ m_ctrld) & 0x10) && (data & 0x10))
{ {
UINT8 trackball = input_port_read(m_machine, "FAKE"); UINT8 trackball = input_port_read(machine(), "FAKE");
UINT8 switches = input_port_read(m_machine, "IN0"); UINT8 switches = input_port_read(machine(), "IN0");
m_trackball_offset = ((trackball & 0xf0) - (switches & 0xf0)) | ((trackball - switches) & 0x0f); m_trackball_offset = ((trackball & 0xf0) - (switches & 0xf0)) | ((trackball - switches) & 0x0f);
} }
m_ctrld = data & 0x10; m_ctrld = data & 0x10;
@ -197,13 +197,13 @@ READ8_MEMBER( liberatr_state::port0_r )
/* if ctrld is high, the /ld signal on the LS191 is NOT set, meaning that the trackball is counting */ /* if ctrld is high, the /ld signal on the LS191 is NOT set, meaning that the trackball is counting */
if (m_ctrld) if (m_ctrld)
{ {
UINT8 trackball = input_port_read(m_machine, "FAKE"); UINT8 trackball = input_port_read(machine(), "FAKE");
return ((trackball & 0xf0) - (m_trackball_offset & 0xf0)) | ((trackball - m_trackball_offset) & 0x0f); return ((trackball & 0xf0) - (m_trackball_offset & 0xf0)) | ((trackball - m_trackball_offset) & 0x0f);
} }
/* otherwise, the LS191 is simply passing through the raw switch inputs */ /* otherwise, the LS191 is simply passing through the raw switch inputs */
else else
return input_port_read(m_machine, "IN0"); return input_port_read(machine(), "IN0");
} }

View File

@ -448,7 +448,7 @@ void cdicdic_device::decode_audio_sector(const UINT8 *xa, INT32 triggered)
{ {
// Get XA format from sector header // Get XA format from sector header
cdi_state *state = m_machine.driver_data<cdi_state>(); cdi_state *state = machine().driver_data<cdi_state>();
const UINT8 *hdr = xa + 4; const UINT8 *hdr = xa + 4;
INT32 channels; INT32 channels;
INT32 bits = 4; INT32 bits = 4;
@ -460,7 +460,7 @@ void cdicdic_device::decode_audio_sector(const UINT8 *xa, INT32 triggered)
return; return;
} }
verboselog(m_machine, 0, "decode_audio_sector, got header type %02x\n", hdr[2] ); verboselog(machine(), 0, "decode_audio_sector, got header type %02x\n", hdr[2] );
switch(hdr[2] & 0x3f) // ignore emphasis and reserved bits switch(hdr[2] & 0x3f) // ignore emphasis and reserved bits
{ {
@ -573,7 +573,7 @@ void cdicdic_device::sample_trigger()
{ {
if(m_decode_addr == 0xffff) if(m_decode_addr == 0xffff)
{ {
verboselog(m_machine, 0, "Decode stop requested, stopping playback\n" ); verboselog(machine(), 0, "Decode stop requested, stopping playback\n" );
m_audio_sample_timer->adjust(attotime::never); m_audio_sample_timer->adjust(attotime::never);
return; return;
} }
@ -581,13 +581,13 @@ void cdicdic_device::sample_trigger()
if(!m_decode_delay) if(!m_decode_delay)
{ {
// Indicate that data has been decoded // Indicate that data has been decoded
verboselog(m_machine, 0, "Flagging that audio data has been decoded\n" ); verboselog(machine(), 0, "Flagging that audio data has been decoded\n" );
m_audio_buffer |= 0x8000; m_audio_buffer |= 0x8000;
// Set the CDIC interrupt line // Set the CDIC interrupt line
verboselog(m_machine, 0, "Setting CDIC interrupt line for soundmap decode\n" ); verboselog(machine(), 0, "Setting CDIC interrupt line for soundmap decode\n" );
device_set_input_line_vector(m_machine.device("maincpu"), M68K_IRQ_4, 128); device_set_input_line_vector(machine().device("maincpu"), M68K_IRQ_4, 128);
cputag_set_input_line(m_machine, "maincpu", M68K_IRQ_4, ASSERT_LINE); cputag_set_input_line(machine(), "maincpu", M68K_IRQ_4, ASSERT_LINE);
} }
else else
{ {
@ -596,7 +596,7 @@ void cdicdic_device::sample_trigger()
if(CDIC_IS_VALID_SAMPLE_BUF(m_ram, m_decode_addr & 0x3ffe)) if(CDIC_IS_VALID_SAMPLE_BUF(m_ram, m_decode_addr & 0x3ffe))
{ {
verboselog(m_machine, 0, "Hit audio_sample_trigger, with m_decode_addr == %04x, calling decode_audio_sector\n", m_decode_addr ); verboselog(machine(), 0, "Hit audio_sample_trigger, with m_decode_addr == %04x, calling decode_audio_sector\n", m_decode_addr );
// Decode the data at Z+4, the same offset as a normal CD sector. // Decode the data at Z+4, the same offset as a normal CD sector.
decode_audio_sector(((UINT8*)m_ram) + (m_decode_addr & 0x3ffe) + 4, 1); decode_audio_sector(((UINT8*)m_ram) + (m_decode_addr & 0x3ffe) + 4, 1);
@ -604,10 +604,10 @@ void cdicdic_device::sample_trigger()
// Swap buffer positions to indicate our new buffer position at the next read // Swap buffer positions to indicate our new buffer position at the next read
m_decode_addr ^= 0x1a00; m_decode_addr ^= 0x1a00;
verboselog(m_machine, 0, "Updated m_decode_addr, new value is %04x\n", m_decode_addr ); verboselog(machine(), 0, "Updated m_decode_addr, new value is %04x\n", m_decode_addr );
//// Delay for Frequency * (18*28*2*size in bytes) before requesting more data //// Delay for Frequency * (18*28*2*size in bytes) before requesting more data
verboselog(m_machine, 0, "Data is valid, setting up a new callback\n" ); verboselog(machine(), 0, "Data is valid, setting up a new callback\n" );
m_decode_period = attotime::from_hz(CDIC_SAMPLE_BUF_FREQ(m_ram, m_decode_addr & 0x3ffe)) * (18*28*2*CDIC_SAMPLE_BUF_SIZE(m_ram, m_decode_addr & 0x3ffe)); m_decode_period = attotime::from_hz(CDIC_SAMPLE_BUF_FREQ(m_ram, m_decode_addr & 0x3ffe)) * (18*28*2*CDIC_SAMPLE_BUF_SIZE(m_ram, m_decode_addr & 0x3ffe));
m_audio_sample_timer->adjust(m_decode_period); m_audio_sample_timer->adjust(m_decode_period);
//dmadac_enable(&dmadac[0], 2, 0); //dmadac_enable(&dmadac[0], 2, 0);
@ -617,7 +617,7 @@ void cdicdic_device::sample_trigger()
// Swap buffer positions to indicate our new buffer position at the next read // Swap buffer positions to indicate our new buffer position at the next read
m_decode_addr ^= 0x1a00; m_decode_addr ^= 0x1a00;
verboselog(m_machine, 0, "Data is not valid, indicating to shut down on the next audio sample\n" ); verboselog(machine(), 0, "Data is not valid, indicating to shut down on the next audio sample\n" );
m_decode_addr = 0xffff; m_decode_addr = 0xffff;
m_audio_sample_timer->adjust(m_decode_period); m_audio_sample_timer->adjust(m_decode_period);
} }
@ -686,7 +686,7 @@ void cdicdic_device::process_delayed_command()
lba = nybbles[0] + nybbles[1]*10 + ((nybbles[2] + nybbles[3]*10)*75) + ((nybbles[4] + nybbles[5]*10)*75*60); lba = nybbles[0] + nybbles[1]*10 + ((nybbles[2] + nybbles[3]*10)*75) + ((nybbles[4] + nybbles[5]*10)*75*60);
//printf( "Reading Mode %d sector from MSF location %06x\n", m_command - 0x28, m_time | 2 ); //printf( "Reading Mode %d sector from MSF location %06x\n", m_command - 0x28, m_time | 2 );
verboselog(m_machine, 0, "Reading Mode %d sector from MSF location %06x\n", m_command - 0x28, m_time | 2 ); verboselog(machine(), 0, "Reading Mode %d sector from MSF location %06x\n", m_command - 0x28, m_time | 2 );
cdrom_read_data(m_cd, lba, buffer, CD_TRACK_RAW_DONTCARE); cdrom_read_data(m_cd, lba, buffer, CD_TRACK_RAW_DONTCARE);
@ -725,7 +725,7 @@ void cdicdic_device::process_delayed_command()
if(((buffer[CDIC_SECTOR_SUBMODE2] & (CDIC_SUBMODE_FORM | CDIC_SUBMODE_DATA | CDIC_SUBMODE_AUDIO | CDIC_SUBMODE_VIDEO)) == (CDIC_SUBMODE_FORM | CDIC_SUBMODE_AUDIO)) && if(((buffer[CDIC_SECTOR_SUBMODE2] & (CDIC_SUBMODE_FORM | CDIC_SUBMODE_DATA | CDIC_SUBMODE_AUDIO | CDIC_SUBMODE_VIDEO)) == (CDIC_SUBMODE_FORM | CDIC_SUBMODE_AUDIO)) &&
(m_channel & m_audio_channel & (1 << buffer[CDIC_SECTOR_CHAN2]))) (m_channel & m_audio_channel & (1 << buffer[CDIC_SECTOR_CHAN2])))
{ {
verboselog(m_machine, 0, "Audio sector\n" ); verboselog(machine(), 0, "Audio sector\n" );
m_x_buffer |= 0x8000; m_x_buffer |= 0x8000;
//m_data_buffer |= 0x4000; //m_data_buffer |= 0x4000;
@ -739,9 +739,9 @@ void cdicdic_device::process_delayed_command()
decode_audio_sector(((UINT8*)m_ram) + ((m_data_buffer & 5) * 0xa00 + 4), 0); decode_audio_sector(((UINT8*)m_ram) + ((m_data_buffer & 5) * 0xa00 + 4), 0);
//printf( "Setting CDIC interrupt line\n" ); //printf( "Setting CDIC interrupt line\n" );
verboselog(m_machine, 0, "Setting CDIC interrupt line for audio sector\n" ); verboselog(machine(), 0, "Setting CDIC interrupt line for audio sector\n" );
device_set_input_line_vector(m_machine.device("maincpu"), M68K_IRQ_4, 128); device_set_input_line_vector(machine().device("maincpu"), M68K_IRQ_4, 128);
cputag_set_input_line(m_machine, "maincpu", M68K_IRQ_4, ASSERT_LINE); cputag_set_input_line(machine(), "maincpu", M68K_IRQ_4, ASSERT_LINE);
} }
else if((buffer[CDIC_SECTOR_SUBMODE2] & (CDIC_SUBMODE_DATA | CDIC_SUBMODE_AUDIO | CDIC_SUBMODE_VIDEO)) == 0x00) else if((buffer[CDIC_SECTOR_SUBMODE2] & (CDIC_SUBMODE_DATA | CDIC_SUBMODE_AUDIO | CDIC_SUBMODE_VIDEO)) == 0x00)
{ {
@ -758,13 +758,13 @@ void cdicdic_device::process_delayed_command()
(buffer[CDIC_SECTOR_SUBMODE2] & CDIC_SUBMODE_EOF) == CDIC_SUBMODE_EOF) (buffer[CDIC_SECTOR_SUBMODE2] & CDIC_SUBMODE_EOF) == CDIC_SUBMODE_EOF)
{ {
//printf( "Setting CDIC interrupt line\n" ); //printf( "Setting CDIC interrupt line\n" );
verboselog(m_machine, 0, "Setting CDIC interrupt line for message sector\n" ); verboselog(machine(), 0, "Setting CDIC interrupt line for message sector\n" );
device_set_input_line_vector(m_machine.device("maincpu"), M68K_IRQ_4, 128); device_set_input_line_vector(machine().device("maincpu"), M68K_IRQ_4, 128);
cputag_set_input_line(m_machine, "maincpu", M68K_IRQ_4, ASSERT_LINE); cputag_set_input_line(machine(), "maincpu", M68K_IRQ_4, ASSERT_LINE);
} }
else else
{ {
verboselog(m_machine, 0, "Message sector, ignored\n" ); verboselog(machine(), 0, "Message sector, ignored\n" );
} }
} }
else else
@ -778,9 +778,9 @@ void cdicdic_device::process_delayed_command()
} }
//printf( "Setting CDIC interrupt line\n" ); //printf( "Setting CDIC interrupt line\n" );
verboselog(m_machine, 0, "Setting CDIC interrupt line for data sector\n" ); verboselog(machine(), 0, "Setting CDIC interrupt line for data sector\n" );
device_set_input_line_vector(m_machine.device("maincpu"), M68K_IRQ_4, 128); device_set_input_line_vector(machine().device("maincpu"), M68K_IRQ_4, 128);
cputag_set_input_line(m_machine, "maincpu", M68K_IRQ_4, ASSERT_LINE); cputag_set_input_line(machine(), "maincpu", M68K_IRQ_4, ASSERT_LINE);
} }
if((buffer[CDIC_SECTOR_SUBMODE2] & CDIC_SUBMODE_EOF) == 0 && m_command != 0x23) if((buffer[CDIC_SECTOR_SUBMODE2] & CDIC_SUBMODE_EOF) == 0 && m_command != 0x23)
@ -842,9 +842,9 @@ void cdicdic_device::process_delayed_command()
if(!(msf & 0x0000ff)) if(!(msf & 0x0000ff))
{ {
next_lba = next_nybbles[0] + next_nybbles[1]*10 + ((next_nybbles[2] + next_nybbles[3]*10)*75) + ((next_nybbles[4] + next_nybbles[5]*10)*75*60); next_lba = next_nybbles[0] + next_nybbles[1]*10 + ((next_nybbles[2] + next_nybbles[3]*10)*75) + ((next_nybbles[4] + next_nybbles[5]*10)*75*60);
verboselog(m_machine, 0, "Playing CDDA sector from MSF location %06x\n", m_time | 2 ); verboselog(machine(), 0, "Playing CDDA sector from MSF location %06x\n", m_time | 2 );
cdda_start_audio(m_machine.device("cdda"), lba, rounded_next_msf); cdda_start_audio(machine().device("cdda"), lba, rounded_next_msf);
} }
m_ram[(m_data_buffer & 5) * (0xa00/2) + 0x924/2] = 0x0001; // CTRL m_ram[(m_data_buffer & 5) * (0xa00/2) + 0x924/2] = 0x0001; // CTRL
@ -873,9 +873,9 @@ void cdicdic_device::process_delayed_command()
m_ram[(m_data_buffer & 5) * (0xa00/2) + (index - 6)] = (buffer[index*2] << 8) | buffer[index*2 + 1]; m_ram[(m_data_buffer & 5) * (0xa00/2) + (index - 6)] = (buffer[index*2] << 8) | buffer[index*2 + 1];
} }
verboselog(m_machine, 0, "Setting CDIC interrupt line for CDDA sector\n" ); verboselog(machine(), 0, "Setting CDIC interrupt line for CDDA sector\n" );
device_set_input_line_vector(m_machine.device("maincpu"), M68K_IRQ_4, 128); device_set_input_line_vector(machine().device("maincpu"), M68K_IRQ_4, 128);
cputag_set_input_line(m_machine, "maincpu", M68K_IRQ_4, ASSERT_LINE); cputag_set_input_line(machine(), "maincpu", M68K_IRQ_4, ASSERT_LINE);
break; break;
} }
case 0x2c: // Seek case 0x2c: // Seek
@ -924,9 +924,9 @@ void cdicdic_device::process_delayed_command()
m_time = next_msf << 8; m_time = next_msf << 8;
verboselog(m_machine, 0, "Setting CDIC interrupt line for Seek sector\n" ); verboselog(machine(), 0, "Setting CDIC interrupt line for Seek sector\n" );
device_set_input_line_vector(m_machine.device("maincpu"), M68K_IRQ_4, 128); device_set_input_line_vector(machine().device("maincpu"), M68K_IRQ_4, 128);
cputag_set_input_line(m_machine, "maincpu", M68K_IRQ_4, ASSERT_LINE); cputag_set_input_line(machine(), "maincpu", M68K_IRQ_4, ASSERT_LINE);
break; break;
} }
} }
@ -944,31 +944,31 @@ UINT16 cdicdic_device::register_read(const UINT32 offset, const UINT16 mem_mask)
switch(addr) switch(addr)
{ {
case 0x3c00/2: // Command register case 0x3c00/2: // Command register
verboselog(m_machine, 0, "cdic_r: Command Register = %04x & %04x\n", m_command, mem_mask); verboselog(machine(), 0, "cdic_r: Command Register = %04x & %04x\n", m_command, mem_mask);
return m_command; return m_command;
case 0x3c02/2: // Time register (MSW) case 0x3c02/2: // Time register (MSW)
verboselog(m_machine, 0, "cdic_r: Time Register (MSW) = %04x & %04x\n", m_time >> 16, mem_mask); verboselog(machine(), 0, "cdic_r: Time Register (MSW) = %04x & %04x\n", m_time >> 16, mem_mask);
return m_time >> 16; return m_time >> 16;
case 0x3c04/2: // Time register (LSW) case 0x3c04/2: // Time register (LSW)
verboselog(m_machine, 0, "cdic_r: Time Register (LSW) = %04x & %04x\n", (UINT16)(m_time & 0x0000ffff), mem_mask); verboselog(machine(), 0, "cdic_r: Time Register (LSW) = %04x & %04x\n", (UINT16)(m_time & 0x0000ffff), mem_mask);
return m_time & 0x0000ffff; return m_time & 0x0000ffff;
case 0x3c06/2: // File register case 0x3c06/2: // File register
verboselog(m_machine, 0, "cdic_r: File Register = %04x & %04x\n", m_file, mem_mask); verboselog(machine(), 0, "cdic_r: File Register = %04x & %04x\n", m_file, mem_mask);
return m_file; return m_file;
case 0x3c08/2: // Channel register (MSW) case 0x3c08/2: // Channel register (MSW)
verboselog(m_machine, 0, "cdic_r: Channel Register (MSW) = %04x & %04x\n", m_channel >> 16, mem_mask); verboselog(machine(), 0, "cdic_r: Channel Register (MSW) = %04x & %04x\n", m_channel >> 16, mem_mask);
return m_channel >> 16; return m_channel >> 16;
case 0x3c0a/2: // Channel register (LSW) case 0x3c0a/2: // Channel register (LSW)
verboselog(m_machine, 0, "cdic_r: Channel Register (LSW) = %04x & %04x\n", m_channel & 0x0000ffff, mem_mask); verboselog(machine(), 0, "cdic_r: Channel Register (LSW) = %04x & %04x\n", m_channel & 0x0000ffff, mem_mask);
return m_channel & 0x0000ffff; return m_channel & 0x0000ffff;
case 0x3c0c/2: // Audio Channel register case 0x3c0c/2: // Audio Channel register
verboselog(m_machine, 0, "cdic_r: Audio Channel Register = %04x & %04x\n", m_audio_channel, mem_mask); verboselog(machine(), 0, "cdic_r: Audio Channel Register = %04x & %04x\n", m_audio_channel, mem_mask);
return m_audio_channel; return m_audio_channel;
case 0x3ff4/2: // ABUF case 0x3ff4/2: // ABUF
@ -977,11 +977,11 @@ UINT16 cdicdic_device::register_read(const UINT32 offset, const UINT16 mem_mask)
m_audio_buffer &= 0x7fff; m_audio_buffer &= 0x7fff;
if(!((m_audio_buffer | m_x_buffer) & 0x8000)) if(!((m_audio_buffer | m_x_buffer) & 0x8000))
{ {
cputag_set_input_line(m_machine, "maincpu", M68K_IRQ_4, CLEAR_LINE); cputag_set_input_line(machine(), "maincpu", M68K_IRQ_4, CLEAR_LINE);
verboselog(m_machine, 0, "Clearing CDIC interrupt line\n" ); verboselog(machine(), 0, "Clearing CDIC interrupt line\n" );
////printf("Clearing CDIC interrupt line\n" ); ////printf("Clearing CDIC interrupt line\n" );
} }
verboselog(m_machine, 0, "cdic_r: Audio Buffer Register = %04x & %04x\n", temp, mem_mask); verboselog(machine(), 0, "cdic_r: Audio Buffer Register = %04x & %04x\n", temp, mem_mask);
return temp; return temp;
} }
@ -991,11 +991,11 @@ UINT16 cdicdic_device::register_read(const UINT32 offset, const UINT16 mem_mask)
m_x_buffer &= 0x7fff; m_x_buffer &= 0x7fff;
if(!((m_audio_buffer | m_x_buffer) & 0x8000)) if(!((m_audio_buffer | m_x_buffer) & 0x8000))
{ {
cputag_set_input_line(m_machine, "maincpu", M68K_IRQ_4, CLEAR_LINE); cputag_set_input_line(machine(), "maincpu", M68K_IRQ_4, CLEAR_LINE);
verboselog(m_machine, 0, "Clearing CDIC interrupt line\n" ); verboselog(machine(), 0, "Clearing CDIC interrupt line\n" );
////printf("Clearing CDIC interrupt line\n" ); ////printf("Clearing CDIC interrupt line\n" );
} }
verboselog(m_machine, 0, "cdic_r: X-Buffer Register = %04x & %04x\n", temp, mem_mask); verboselog(machine(), 0, "cdic_r: X-Buffer Register = %04x & %04x\n", temp, mem_mask);
return temp; return temp;
} }
@ -1005,17 +1005,17 @@ UINT16 cdicdic_device::register_read(const UINT32 offset, const UINT16 mem_mask)
{ {
m_z_buffer ^= 0x0001; m_z_buffer ^= 0x0001;
} }
verboselog(m_machine, 0, "cdic_r: Z-Buffer Register = %04x & %04x\n", m_z_buffer, mem_mask); verboselog(machine(), 0, "cdic_r: Z-Buffer Register = %04x & %04x\n", m_z_buffer, mem_mask);
return m_z_buffer; return m_z_buffer;
} }
case 0x3ffe/2: case 0x3ffe/2:
{ {
verboselog(m_machine, 0, "cdic_r: Data buffer Register = %04x & %04x\n", m_data_buffer, mem_mask); verboselog(machine(), 0, "cdic_r: Data buffer Register = %04x & %04x\n", m_data_buffer, mem_mask);
return m_data_buffer; return m_data_buffer;
} }
default: default:
verboselog(m_machine, 0, "cdic_r: UNIMPLEMENTED: Unknown address: %04x & %04x\n", addr*2, mem_mask); verboselog(machine(), 0, "cdic_r: UNIMPLEMENTED: Unknown address: %04x & %04x\n", addr*2, mem_mask);
return 0; return 0;
} }
} }
@ -1027,58 +1027,58 @@ WRITE16_DEVICE_HANDLER( cdic_w )
void cdicdic_device::register_write(const UINT32 offset, const UINT16 data, const UINT16 mem_mask) void cdicdic_device::register_write(const UINT32 offset, const UINT16 data, const UINT16 mem_mask)
{ {
cdi_state *state = m_machine.driver_data<cdi_state>(); cdi_state *state = machine().driver_data<cdi_state>();
UINT32 addr = offset + 0x3c00/2; UINT32 addr = offset + 0x3c00/2;
switch(addr) switch(addr)
{ {
case 0x3c00/2: // Command register case 0x3c00/2: // Command register
verboselog(m_machine, 0, "cdic_w: Command Register = %04x & %04x\n", data, mem_mask); verboselog(machine(), 0, "cdic_w: Command Register = %04x & %04x\n", data, mem_mask);
COMBINE_DATA(&m_command); COMBINE_DATA(&m_command);
break; break;
case 0x3c02/2: // Time register (MSW) case 0x3c02/2: // Time register (MSW)
m_time &= ~(mem_mask << 16); m_time &= ~(mem_mask << 16);
m_time |= (data & mem_mask) << 16; m_time |= (data & mem_mask) << 16;
verboselog(m_machine, 0, "cdic_w: Time Register (MSW) = %04x & %04x\n", data, mem_mask); verboselog(machine(), 0, "cdic_w: Time Register (MSW) = %04x & %04x\n", data, mem_mask);
break; break;
case 0x3c04/2: // Time register (LSW) case 0x3c04/2: // Time register (LSW)
m_time &= ~mem_mask; m_time &= ~mem_mask;
m_time |= data & mem_mask; m_time |= data & mem_mask;
verboselog(m_machine, 0, "cdic_w: Time Register (LSW) = %04x & %04x\n", data, mem_mask); verboselog(machine(), 0, "cdic_w: Time Register (LSW) = %04x & %04x\n", data, mem_mask);
break; break;
case 0x3c06/2: // File register case 0x3c06/2: // File register
verboselog(m_machine, 0, "cdic_w: File Register = %04x & %04x\n", data, mem_mask); verboselog(machine(), 0, "cdic_w: File Register = %04x & %04x\n", data, mem_mask);
COMBINE_DATA(&m_file); COMBINE_DATA(&m_file);
break; break;
case 0x3c08/2: // Channel register (MSW) case 0x3c08/2: // Channel register (MSW)
m_channel &= ~(mem_mask << 16); m_channel &= ~(mem_mask << 16);
m_channel |= (data & mem_mask) << 16; m_channel |= (data & mem_mask) << 16;
verboselog(m_machine, 0, "cdic_w: Channel Register (MSW) = %04x & %04x\n", data, mem_mask); verboselog(machine(), 0, "cdic_w: Channel Register (MSW) = %04x & %04x\n", data, mem_mask);
break; break;
case 0x3c0a/2: // Channel register (LSW) case 0x3c0a/2: // Channel register (LSW)
m_channel &= ~mem_mask; m_channel &= ~mem_mask;
m_channel |= data & mem_mask; m_channel |= data & mem_mask;
verboselog(m_machine, 0, "cdic_w: Channel Register (LSW) = %04x & %04x\n", data, mem_mask); verboselog(machine(), 0, "cdic_w: Channel Register (LSW) = %04x & %04x\n", data, mem_mask);
break; break;
case 0x3c0c/2: // Audio Channel register case 0x3c0c/2: // Audio Channel register
verboselog(m_machine, 0, "cdic_w: Audio Channel Register = %04x & %04x\n", data, mem_mask); verboselog(machine(), 0, "cdic_w: Audio Channel Register = %04x & %04x\n", data, mem_mask);
COMBINE_DATA(&m_audio_channel); COMBINE_DATA(&m_audio_channel);
break; break;
case 0x3ff4/2: case 0x3ff4/2:
verboselog(m_machine, 0, "cdic_w: Audio Buffer Register = %04x & %04x\n", data, mem_mask); verboselog(machine(), 0, "cdic_w: Audio Buffer Register = %04x & %04x\n", data, mem_mask);
COMBINE_DATA(&m_audio_buffer); COMBINE_DATA(&m_audio_buffer);
break; break;
case 0x3ff6/2: case 0x3ff6/2:
verboselog(m_machine, 0, "cdic_w: X Buffer Register = %04x & %04x\n", data, mem_mask); verboselog(machine(), 0, "cdic_w: X Buffer Register = %04x & %04x\n", data, mem_mask);
COMBINE_DATA(&m_x_buffer); COMBINE_DATA(&m_x_buffer);
break; break;
@ -1090,9 +1090,9 @@ void cdicdic_device::register_write(const UINT32 offset, const UINT16 data, cons
UINT32 index = 0; UINT32 index = 0;
UINT32 device_index = (data & 0x3fff) >> 1; UINT32 device_index = (data & 0x3fff) >> 1;
UINT16 *memory = state->m_planea; UINT16 *memory = state->m_planea;
verboselog(m_machine, 0, "memory address counter: %08x\n", scc68070->dma.channel[0].memory_address_counter); verboselog(machine(), 0, "memory address counter: %08x\n", scc68070->dma.channel[0].memory_address_counter);
verboselog(m_machine, 0, "cdic_w: DMA Control Register = %04x & %04x\n", data, mem_mask); verboselog(machine(), 0, "cdic_w: DMA Control Register = %04x & %04x\n", data, mem_mask);
verboselog(m_machine, 0, "Doing copy, transferring %04x bytes\n", count * 2 ); verboselog(machine(), 0, "Doing copy, transferring %04x bytes\n", count * 2 );
////printf("Doing copy, transferring %04x bytes\n", count * 2 ); ////printf("Doing copy, transferring %04x bytes\n", count * 2 );
if((start & 0x00f00000) == 0x00200000) if((start & 0x00f00000) == 0x00200000)
{ {
@ -1116,7 +1116,7 @@ void cdicdic_device::register_write(const UINT32 offset, const UINT16 data, cons
case 0x3ffa/2: case 0x3ffa/2:
{ {
verboselog(m_machine, 0, "cdic_w: Z-Buffer Register = %04x & %04x\n", data, mem_mask); verboselog(machine(), 0, "cdic_w: Z-Buffer Register = %04x & %04x\n", data, mem_mask);
COMBINE_DATA(&m_z_buffer); COMBINE_DATA(&m_z_buffer);
if(m_z_buffer & 0x2000) if(m_z_buffer & 0x2000)
{ {
@ -1136,12 +1136,12 @@ void cdicdic_device::register_write(const UINT32 offset, const UINT16 data, cons
break; break;
} }
case 0x3ffc/2: case 0x3ffc/2:
verboselog(m_machine, 0, "cdic_w: Interrupt Vector Register = %04x & %04x\n", data, mem_mask); verboselog(machine(), 0, "cdic_w: Interrupt Vector Register = %04x & %04x\n", data, mem_mask);
COMBINE_DATA(&m_interrupt_vector); COMBINE_DATA(&m_interrupt_vector);
break; break;
case 0x3ffe/2: case 0x3ffe/2:
{ {
verboselog(m_machine, 0, "cdic_w: Data Buffer Register = %04x & %04x\n", data, mem_mask); verboselog(machine(), 0, "cdic_w: Data Buffer Register = %04x & %04x\n", data, mem_mask);
COMBINE_DATA(&m_data_buffer); COMBINE_DATA(&m_data_buffer);
if(m_data_buffer & 0x8000) if(m_data_buffer & 0x8000)
{ {
@ -1156,7 +1156,7 @@ void cdicdic_device::register_write(const UINT32 offset, const UINT16 data, cons
break; break;
} }
case 0x2b: // Stop CDDA case 0x2b: // Stop CDDA
cdda_stop_audio(m_machine.device("cdda")); cdda_stop_audio(machine().device("cdda"));
m_interrupt_timer->adjust(attotime::never); m_interrupt_timer->adjust(attotime::never);
break; break;
case 0x23: // Reset Mode 1 case 0x23: // Reset Mode 1
@ -1180,7 +1180,7 @@ void cdicdic_device::register_write(const UINT32 offset, const UINT16 data, cons
break; break;
} }
default: default:
verboselog(m_machine, 0, "Unknown CDIC command: %02x\n", m_command ); verboselog(machine(), 0, "Unknown CDIC command: %02x\n", m_command );
break; break;
} }
} }
@ -1188,7 +1188,7 @@ void cdicdic_device::register_write(const UINT32 offset, const UINT16 data, cons
break; break;
} }
default: default:
verboselog(m_machine, 0, "cdic_w: UNIMPLEMENTED: Unknown address: %04x = %04x & %04x\n", addr*2, data, mem_mask); verboselog(machine(), 0, "cdic_w: UNIMPLEMENTED: Unknown address: %04x = %04x & %04x\n", addr*2, data, mem_mask);
break; break;
} }
} }
@ -1216,13 +1216,13 @@ void cdicdic_device::device_start()
{ {
register_globals(); register_globals();
m_interrupt_timer = m_machine.scheduler().timer_alloc(FUNC(trigger_readback_int)); m_interrupt_timer = machine().scheduler().timer_alloc(FUNC(trigger_readback_int));
m_interrupt_timer->adjust(attotime::never); m_interrupt_timer->adjust(attotime::never);
m_audio_sample_timer = m_machine.scheduler().timer_alloc(FUNC(audio_sample_trigger)); m_audio_sample_timer = machine().scheduler().timer_alloc(FUNC(audio_sample_trigger));
m_audio_sample_timer->adjust(attotime::never); m_audio_sample_timer->adjust(attotime::never);
m_ram = auto_alloc_array(m_machine, UINT16, 0x3c00/2); m_ram = auto_alloc_array(machine(), UINT16, 0x3c00/2);
} }
//------------------------------------------------- //-------------------------------------------------
@ -1233,18 +1233,18 @@ void cdicdic_device::device_reset()
{ {
init(); init();
device_t *cdrom_dev = m_machine.device("cdrom"); device_t *cdrom_dev = machine().device("cdrom");
if( cdrom_dev ) if( cdrom_dev )
{ {
// MESS case (has CDROM device) // MESS case (has CDROM device)
m_cd = cd_get_cdrom_file(cdrom_dev); m_cd = cd_get_cdrom_file(cdrom_dev);
cdda_set_cdrom(m_machine.device("cdda"), m_cd); cdda_set_cdrom(machine().device("cdda"), m_cd);
} }
else else
{ {
// MAME case // MAME case
m_cd = cdrom_open(get_disk_handle(m_machine, "cdrom")); m_cd = cdrom_open(get_disk_handle(machine(), "cdrom"));
cdda_set_cdrom(m_machine.device("cdda"), m_cd); cdda_set_cdrom(machine().device("cdda"), m_cd);
} }
} }
@ -1294,7 +1294,7 @@ WRITE16_DEVICE_HANDLER( cdic_ram_w )
void cdicdic_device::ram_write(const UINT32 offset, const UINT16 data, const UINT16 mem_mask) void cdicdic_device::ram_write(const UINT32 offset, const UINT16 data, const UINT16 mem_mask)
{ {
verboselog(m_machine, 5, "cdic_ram_w: %08x = %04x & %04x\n", 0x00300000 + offset*2, data, mem_mask); verboselog(machine(), 5, "cdic_ram_w: %08x = %04x & %04x\n", 0x00300000 + offset*2, data, mem_mask);
COMBINE_DATA(&m_ram[offset]); COMBINE_DATA(&m_ram[offset]);
} }
@ -1305,7 +1305,7 @@ READ16_DEVICE_HANDLER( cdic_ram_r )
UINT16 cdicdic_device::ram_read(const UINT32 offset, const UINT16 mem_mask) UINT16 cdicdic_device::ram_read(const UINT32 offset, const UINT16 mem_mask)
{ {
verboselog(m_machine, 5, "cdic_ram_r: %08x = %04x & %04x\n", 0x00300000 + offset * 2, m_ram[offset], mem_mask); verboselog(machine(), 5, "cdic_ram_r: %08x = %04x & %04x\n", 0x00300000 + offset * 2, m_ram[offset], mem_mask);
return m_ram[offset]; return m_ram[offset];
} }

View File

@ -90,9 +90,9 @@ TIMER_CALLBACK( cdislave_device::trigger_readback_int )
void cdislave_device::readback_trigger() void cdislave_device::readback_trigger()
{ {
verboselog(m_machine, 0, "Asserting IRQ2\n" ); verboselog(machine(), 0, "Asserting IRQ2\n" );
device_set_input_line_vector(m_machine.device("maincpu"), M68K_IRQ_2, 26); device_set_input_line_vector(machine().device("maincpu"), M68K_IRQ_2, 26);
cputag_set_input_line(m_machine, "maincpu", M68K_IRQ_2, ASSERT_LINE); cputag_set_input_line(machine(), "maincpu", M68K_IRQ_2, ASSERT_LINE);
m_interrupt_timer->adjust(attotime::never); m_interrupt_timer->adjust(attotime::never);
} }
@ -111,9 +111,9 @@ void cdislave_device::prepare_readback(attotime delay, UINT8 channel, UINT8 coun
void cdislave_device::perform_mouse_update() void cdislave_device::perform_mouse_update()
{ {
UINT16 x = input_port_read(m_machine, "MOUSEX"); UINT16 x = input_port_read(machine(), "MOUSEX");
UINT16 y = input_port_read(m_machine, "MOUSEY"); UINT16 y = input_port_read(machine(), "MOUSEY");
UINT8 buttons = input_port_read(m_machine, "MOUSEBTN"); UINT8 buttons = input_port_read(machine(), "MOUSEBTN");
UINT16 old_mouse_x = m_real_mouse_x; UINT16 old_mouse_x = m_real_mouse_x;
UINT16 old_mouse_y = m_real_mouse_y; UINT16 old_mouse_y = m_real_mouse_y;
@ -165,7 +165,7 @@ UINT16 cdislave_device::register_read(const UINT32 offset, const UINT16 mem_mask
if(m_channel[offset].m_out_count) if(m_channel[offset].m_out_count)
{ {
UINT8 ret = m_channel[offset].m_out_buf[m_channel[offset].m_out_index]; UINT8 ret = m_channel[offset].m_out_buf[m_channel[offset].m_out_index];
verboselog(m_machine, 0, "slave_r: Channel %d: %d, %02x\n", offset, m_channel[offset].m_out_index, ret ); verboselog(machine(), 0, "slave_r: Channel %d: %d, %02x\n", offset, m_channel[offset].m_out_index, ret );
if(m_channel[offset].m_out_index == 0) if(m_channel[offset].m_out_index == 0)
{ {
switch(m_channel[offset].m_out_cmd) switch(m_channel[offset].m_out_cmd)
@ -176,8 +176,8 @@ UINT16 cdislave_device::register_read(const UINT32 offset, const UINT16 mem_mask
case 0xf3: case 0xf3:
case 0xf4: case 0xf4:
case 0xf7: case 0xf7:
verboselog(m_machine, 0, "slave_r: De-asserting IRQ2\n" ); verboselog(machine(), 0, "slave_r: De-asserting IRQ2\n" );
cputag_set_input_line(m_machine, "maincpu", M68K_IRQ_2, CLEAR_LINE); cputag_set_input_line(machine(), "maincpu", M68K_IRQ_2, CLEAR_LINE);
break; break;
} }
} }
@ -191,7 +191,7 @@ UINT16 cdislave_device::register_read(const UINT32 offset, const UINT16 mem_mask
} }
return ret; return ret;
} }
verboselog(m_machine, 0, "slave_r: Channel %d: %d\n", offset, m_channel[offset].m_out_index ); verboselog(machine(), 0, "slave_r: Channel %d: %d\n", offset, m_channel[offset].m_out_index );
return 0xff; return 0xff;
} }
@ -220,14 +220,14 @@ WRITE16_DEVICE_HANDLER( slave_w )
void cdislave_device::register_write(const UINT32 offset, const UINT16 data, const UINT16 mem_mask) void cdislave_device::register_write(const UINT32 offset, const UINT16 data, const UINT16 mem_mask)
{ {
cdi_state *state = m_machine.driver_data<cdi_state>(); cdi_state *state = machine().driver_data<cdi_state>();
switch(offset) switch(offset)
{ {
case 0: case 0:
if(m_in_index) if(m_in_index)
{ {
verboselog(m_machine, 0, "slave_w: Channel %d: %d = %02x\n", offset, m_in_index, data & 0x00ff ); verboselog(machine(), 0, "slave_w: Channel %d: %d = %02x\n", offset, m_in_index, data & 0x00ff );
m_in_buf[m_in_index] = data & 0x00ff; m_in_buf[m_in_index] = data & 0x00ff;
m_in_index++; m_in_index++;
if(m_in_index == m_in_count) if(m_in_index == m_in_count)
@ -264,11 +264,11 @@ void cdislave_device::register_write(const UINT32 offset, const UINT16 data, con
case 0xe8: case 0xe9: case 0xea: case 0xeb: case 0xec: case 0xed: case 0xee: case 0xef: case 0xe8: case 0xe9: case 0xea: case 0xeb: case 0xec: case 0xed: case 0xee: case 0xef:
case 0xf0: case 0xf1: case 0xf2: case 0xf3: case 0xf4: case 0xf5: case 0xf6: case 0xf7: case 0xf0: case 0xf1: case 0xf2: case 0xf3: case 0xf4: case 0xf5: case 0xf6: case 0xf7:
case 0xf8: case 0xf9: case 0xfa: case 0xfb: case 0xfc: case 0xfd: case 0xfe: case 0xff: case 0xf8: case 0xf9: case 0xfa: case 0xfb: case 0xfc: case 0xfd: case 0xfe: case 0xff:
verboselog(m_machine, 0, "slave_w: Channel %d: Update Mouse Position (0x%02x)\n", offset, data & 0x00ff ); verboselog(machine(), 0, "slave_w: Channel %d: Update Mouse Position (0x%02x)\n", offset, data & 0x00ff );
m_in_count = 3; m_in_count = 3;
break; break;
default: default:
verboselog(m_machine, 0, "slave_w: Channel %d: Unknown register: %02x\n", offset, data & 0x00ff ); verboselog(machine(), 0, "slave_w: Channel %d: Unknown register: %02x\n", offset, data & 0x00ff );
m_in_index = 0; m_in_index = 0;
break; break;
} }
@ -277,7 +277,7 @@ void cdislave_device::register_write(const UINT32 offset, const UINT16 data, con
case 1: case 1:
if(m_in_index) if(m_in_index)
{ {
verboselog(m_machine, 0, "slave_w: Channel %d: %d = %02x\n", offset, m_in_index, data & 0x00ff ); verboselog(machine(), 0, "slave_w: Channel %d: %d = %02x\n", offset, m_in_index, data & 0x00ff );
m_in_buf[m_in_index] = data & 0x00ff; m_in_buf[m_in_index] = data & 0x00ff;
m_in_index++; m_in_index++;
if(m_in_index == m_in_count) if(m_in_index == m_in_count)
@ -303,7 +303,7 @@ void cdislave_device::register_write(const UINT32 offset, const UINT16 data, con
switch(data & 0x00ff) switch(data & 0x00ff)
{ {
default: default:
verboselog(m_machine, 0, "slave_w: Channel %d: Unknown register: %02x\n", offset, data & 0x00ff ); verboselog(machine(), 0, "slave_w: Channel %d: Unknown register: %02x\n", offset, data & 0x00ff );
memset(m_in_buf, 0, 17); memset(m_in_buf, 0, 17);
m_in_index = 0; m_in_index = 0;
m_in_count = 0; m_in_count = 0;
@ -314,7 +314,7 @@ void cdislave_device::register_write(const UINT32 offset, const UINT16 data, con
case 2: case 2:
if(m_in_index) if(m_in_index)
{ {
verboselog(m_machine, 0, "slave_w: Channel %d: %d = %02x\n", offset, m_in_index, data & 0x00ff ); verboselog(machine(), 0, "slave_w: Channel %d: %d = %02x\n", offset, m_in_index, data & 0x00ff );
m_in_buf[m_in_index] = data & 0x00ff; m_in_buf[m_in_index] = data & 0x00ff;
m_in_index++; m_in_index++;
if(m_in_index == m_in_count) if(m_in_index == m_in_count)
@ -340,24 +340,24 @@ void cdislave_device::register_write(const UINT32 offset, const UINT16 data, con
switch(data & 0x00ff) switch(data & 0x00ff)
{ {
case 0x82: // Mute Audio case 0x82: // Mute Audio
verboselog(m_machine, 0, "slave_w: Channel %d: Mute Audio (0x82)\n", offset ); verboselog(machine(), 0, "slave_w: Channel %d: Mute Audio (0x82)\n", offset );
dmadac_enable(&state->m_dmadac[0], 2, 0); dmadac_enable(&state->m_dmadac[0], 2, 0);
m_in_index = 0; m_in_index = 0;
m_in_count = 0; m_in_count = 0;
//cdic->audio_sample_timer->adjust(attotime::never); //cdic->audio_sample_timer->adjust(attotime::never);
break; break;
case 0x83: // Unmute Audio case 0x83: // Unmute Audio
verboselog(m_machine, 0, "slave_w: Channel %d: Unmute Audio (0x83)\n", offset ); verboselog(machine(), 0, "slave_w: Channel %d: Unmute Audio (0x83)\n", offset );
dmadac_enable(&state->m_dmadac[0], 2, 1); dmadac_enable(&state->m_dmadac[0], 2, 1);
m_in_index = 0; m_in_index = 0;
m_in_count = 0; m_in_count = 0;
break; break;
case 0xf0: // Set Front Panel LCD case 0xf0: // Set Front Panel LCD
verboselog(m_machine, 0, "slave_w: Channel %d: Set Front Panel LCD (0xf0)\n", offset ); verboselog(machine(), 0, "slave_w: Channel %d: Set Front Panel LCD (0xf0)\n", offset );
m_in_count = 17; m_in_count = 17;
break; break;
default: default:
verboselog(m_machine, 0, "slave_w: Channel %d: Unknown register: %02x\n", offset, data & 0x00ff ); verboselog(machine(), 0, "slave_w: Channel %d: Unknown register: %02x\n", offset, data & 0x00ff );
memset(m_in_buf, 0, 17); memset(m_in_buf, 0, 17);
m_in_index = 0; m_in_index = 0;
m_in_count = 0; m_in_count = 0;
@ -368,7 +368,7 @@ void cdislave_device::register_write(const UINT32 offset, const UINT16 data, con
case 3: case 3:
if(m_in_index) if(m_in_index)
{ {
verboselog(m_machine, 0, "slave_w: Channel %d: %d = %02x\n", offset, m_in_index, data & 0x00ff ); verboselog(machine(), 0, "slave_w: Channel %d: %d = %02x\n", offset, m_in_index, data & 0x00ff );
m_in_buf[m_in_index] = data & 0x00ff; m_in_buf[m_in_index] = data & 0x00ff;
m_in_index++; m_in_index++;
if(m_in_index == m_in_count) if(m_in_index == m_in_count)
@ -402,45 +402,45 @@ void cdislave_device::register_write(const UINT32 offset, const UINT16 data, con
switch(data & 0x00ff) switch(data & 0x00ff)
{ {
case 0xb0: // Request Disc Status case 0xb0: // Request Disc Status
verboselog(m_machine, 0, "slave_w: Channel %d: Request Disc Status (0xb0)\n", offset ); verboselog(machine(), 0, "slave_w: Channel %d: Request Disc Status (0xb0)\n", offset );
m_in_count = 4; m_in_count = 4;
break; break;
case 0xb1: // Request Disc Base case 0xb1: // Request Disc Base
verboselog(m_machine, 0, "slave_w: Channel %d: Request Disc Base (0xb1)\n", offset ); verboselog(machine(), 0, "slave_w: Channel %d: Request Disc Base (0xb1)\n", offset );
m_in_count = 4; m_in_count = 4;
break; break;
case 0xf0: // Request SLAVE Revision case 0xf0: // Request SLAVE Revision
verboselog(m_machine, 0, "slave_w: Channel %d: Request SLAVE Revision (0xf0)\n", offset ); verboselog(machine(), 0, "slave_w: Channel %d: Request SLAVE Revision (0xf0)\n", offset );
prepare_readback(attotime::from_hz(10000), 2, 2, 0xf0, 0x32, 0x31, 0, 0xf0); prepare_readback(attotime::from_hz(10000), 2, 2, 0xf0, 0x32, 0x31, 0, 0xf0);
m_in_index = 0; m_in_index = 0;
break; break;
case 0xf3: // Request Pointer Type case 0xf3: // Request Pointer Type
verboselog(m_machine, 0, "slave_w: Channel %d: Request Pointer Type (0xf3)\n", offset ); verboselog(machine(), 0, "slave_w: Channel %d: Request Pointer Type (0xf3)\n", offset );
m_in_index = 0; m_in_index = 0;
prepare_readback(attotime::from_hz(10000), 2, 2, 0xf3, 1, 0, 0, 0xf3); prepare_readback(attotime::from_hz(10000), 2, 2, 0xf3, 1, 0, 0, 0xf3);
break; break;
case 0xf4: // Request Test Plug Status case 0xf4: // Request Test Plug Status
verboselog(m_machine, 0, "slave_w: Channel %d: Request Test Plug Status (0xf4)\n", offset ); verboselog(machine(), 0, "slave_w: Channel %d: Request Test Plug Status (0xf4)\n", offset );
m_in_index = 0; m_in_index = 0;
prepare_readback(attotime::from_hz(10000), 2, 2, 0xf4, 0, 0, 0, 0xf4); prepare_readback(attotime::from_hz(10000), 2, 2, 0xf4, 0, 0, 0, 0xf4);
break; break;
case 0xf6: // Request NTSC/PAL Status case 0xf6: // Request NTSC/PAL Status
verboselog(m_machine, 0, "slave_w: Channel %d: Request NTSC/PAL Status (0xf6)\n", offset ); verboselog(machine(), 0, "slave_w: Channel %d: Request NTSC/PAL Status (0xf6)\n", offset );
prepare_readback(attotime::never, 2, 2, 0xf6, 2, 0, 0, 0xf6); prepare_readback(attotime::never, 2, 2, 0xf6, 2, 0, 0, 0xf6);
m_in_index = 0; m_in_index = 0;
break; break;
case 0xf7: // Enable Input Polling case 0xf7: // Enable Input Polling
verboselog(m_machine, 0, "slave_w: Channel %d: Activate Input Polling (0xf7)\n", offset ); verboselog(machine(), 0, "slave_w: Channel %d: Activate Input Polling (0xf7)\n", offset );
m_polling_active = 1; m_polling_active = 1;
m_in_index = 0; m_in_index = 0;
break; break;
case 0xfa: // Enable X-Bus Interrupts case 0xfa: // Enable X-Bus Interrupts
verboselog(m_machine, 0, "slave_w: Channel %d: X-Bus Interrupt Enable (0xfa)\n", offset ); verboselog(machine(), 0, "slave_w: Channel %d: X-Bus Interrupt Enable (0xfa)\n", offset );
m_xbus_interrupt_enable = 1; m_xbus_interrupt_enable = 1;
m_in_index = 0; m_in_index = 0;
break; break;
default: default:
verboselog(m_machine, 0, "slave_w: Channel %d: Unknown register: %02x\n", offset, data & 0x00ff ); verboselog(machine(), 0, "slave_w: Channel %d: Unknown register: %02x\n", offset, data & 0x00ff );
memset(m_in_buf, 0, 17); memset(m_in_buf, 0, 17);
m_in_index = 0; m_in_index = 0;
m_in_count = 0; m_in_count = 0;
@ -474,7 +474,7 @@ void cdislave_device::device_start()
{ {
register_globals(); register_globals();
m_interrupt_timer = m_machine.scheduler().timer_alloc(FUNC(trigger_readback_int)); m_interrupt_timer = machine().scheduler().timer_alloc(FUNC(trigger_readback_int));
m_interrupt_timer->adjust(attotime::never); m_interrupt_timer->adjust(attotime::never);
} }

View File

@ -22,7 +22,7 @@ inline void ATTR_PRINTF(3,4) zs01_device::verboselog(int n_level, const char *s_
va_start(v, s_fmt); va_start(v, s_fmt);
vsprintf(buf, s_fmt, v); vsprintf(buf, s_fmt, v);
va_end(v); va_end(v);
logerror("zs01 %s %s: %s", config.tag(), m_machine.describe_context(), buf); logerror("zs01 %s %s: %s", config.tag(), machine().describe_context(), buf);
} }
} }
@ -427,7 +427,7 @@ void zs01_device::scl_1()
switch(write_buffer[1]) { switch(write_buffer[1]) {
case 0xfd: { case 0xfd: {
/* TODO: use read/write to talk to the ds2401, which will require a timer. */ /* TODO: use read/write to talk to the ds2401, which will require a timer. */
ds2401_device *ds2401 = m_machine.device<ds2401_device>(config.ds2401_tag); ds2401_device *ds2401 = machine().device<ds2401_device>(config.ds2401_tag);
for(int i = 0; i < SIZE_DATA_BUFFER; i++) for(int i = 0; i < SIZE_DATA_BUFFER; i++)
read_buffer[2+i] = ds2401->direct_read(SIZE_DATA_BUFFER-i-1); read_buffer[2+i] = ds2401->direct_read(SIZE_DATA_BUFFER-i-1);
break; break;

View File

@ -17,11 +17,11 @@
void beathead_state::video_start() void beathead_state::video_start()
{ {
state_save_register_global(m_machine, m_finescroll); state_save_register_global(machine(), m_finescroll);
state_save_register_global(m_machine, m_vram_latch_offset); state_save_register_global(machine(), m_vram_latch_offset);
state_save_register_global(m_machine, m_hsyncram_offset); state_save_register_global(machine(), m_hsyncram_offset);
state_save_register_global(m_machine, m_hsyncram_start); state_save_register_global(machine(), m_hsyncram_start);
state_save_register_global_array(m_machine, m_hsyncram); state_save_register_global_array(machine(), m_hsyncram);
} }

View File

@ -163,8 +163,8 @@ static CDP1869_INTERFACE( draco_vis_intf )
void cidelsa_state::video_start() void cidelsa_state::video_start()
{ {
// allocate memory // allocate memory
m_pcbram = auto_alloc_array(m_machine, UINT8, CIDELSA_CHARRAM_SIZE); m_pcbram = auto_alloc_array(machine(), UINT8, CIDELSA_CHARRAM_SIZE);
m_charram = auto_alloc_array(m_machine, UINT8, CIDELSA_CHARRAM_SIZE); m_charram = auto_alloc_array(machine(), UINT8, CIDELSA_CHARRAM_SIZE);
// register for state saving // register for state saving
save_item(NAME(m_cdp1869_pcb)); save_item(NAME(m_cdp1869_pcb));

View File

@ -343,12 +343,12 @@ void gp9001vdp_device::create_tilemaps(int region)
void gp9001vdp_device::device_start() void gp9001vdp_device::device_start()
{ {
top.vram16 = auto_alloc_array_clear(m_machine, UINT16, GP9001_TOP_VRAM_SIZE/2); top.vram16 = auto_alloc_array_clear(machine(), UINT16, GP9001_TOP_VRAM_SIZE/2);
fg.vram16 = auto_alloc_array_clear(m_machine, UINT16, GP9001_FG_VRAM_SIZE/2); fg.vram16 = auto_alloc_array_clear(machine(), UINT16, GP9001_FG_VRAM_SIZE/2);
bg.vram16 = auto_alloc_array_clear(m_machine, UINT16, GP9001_BG_VRAM_SIZE/2); bg.vram16 = auto_alloc_array_clear(machine(), UINT16, GP9001_BG_VRAM_SIZE/2);
sp.vram16 = auto_alloc_array_clear(m_machine, UINT16, GP9001_SPRITERAM_SIZE/2); sp.vram16 = auto_alloc_array_clear(machine(), UINT16, GP9001_SPRITERAM_SIZE/2);
sp.vram16_buffer = auto_alloc_array_clear(m_machine, UINT16, GP9001_SPRITERAM_SIZE/2); sp.vram16_buffer = auto_alloc_array_clear(machine(), UINT16, GP9001_SPRITERAM_SIZE/2);
create_tilemaps(m_gfxregion); create_tilemaps(m_gfxregion);

View File

@ -68,8 +68,8 @@ void liberatr_state::init_planet(planet &liberatr_planet, UINT8 *planet_rom)
{ {
UINT16 longitude; UINT16 longitude;
const UINT8 *latitude_scale = m_machine.region("user1")->base(); const UINT8 *latitude_scale = machine().region("user1")->base();
const UINT8 *longitude_scale = m_machine.region("user2")->base(); const UINT8 *longitude_scale = machine().region("user2")->base();
/* for each starting longitude */ /* for each starting longitude */
for (longitude = 0; longitude < 0x100; longitude++) for (longitude = 0; longitude < 0x100; longitude++)
@ -171,7 +171,7 @@ void liberatr_state::init_planet(planet &liberatr_planet, UINT8 *planet_rom)
many segments it will take to store the description, allocate the many segments it will take to store the description, allocate the
space for it and copy the data to it. space for it and copy the data to it.
*/ */
buffer = auto_alloc_array(m_machine, UINT8, 2*(128 + total_segment_count)); buffer = auto_alloc_array(machine(), UINT8, 2*(128 + total_segment_count));
liberatr_planet.frames[longitude] = buffer; liberatr_planet.frames[longitude] = buffer;
@ -187,7 +187,7 @@ void liberatr_state::init_planet(planet &liberatr_planet, UINT8 *planet_rom)
/* calculate the bitmap's x coordinate for the western horizon /* calculate the bitmap's x coordinate for the western horizon
center of bitmap - (the number of planet pixels) / 4 */ center of bitmap - (the number of planet pixels) / 4 */
*buffer++ = (m_machine.primary_screen->width() / 2) - ((line->max_x + 2) / 4); *buffer++ = (machine().primary_screen->width() / 2) - ((line->max_x + 2) / 4);
for (i = 0; i < segment_count; i++) for (i = 0; i < segment_count; i++)
{ {
@ -212,8 +212,8 @@ void liberatr_state::init_planet(planet &liberatr_planet, UINT8 *planet_rom)
void liberatr_state::video_start() void liberatr_state::video_start()
{ {
// for each planet in the planet ROMs // for each planet in the planet ROMs
init_planet(m_planets[0], &m_machine.region("gfx1")->base()[0x2000]); init_planet(m_planets[0], &machine().region("gfx1")->base()[0x2000]);
init_planet(m_planets[1], &m_machine.region("gfx1")->base()[0x0000]); init_planet(m_planets[1], &machine().region("gfx1")->base()[0x0000]);
} }

View File

@ -412,7 +412,7 @@ void Processor::ColorCombiner1Cycle(bool noisecompute)
{ {
if (noisecompute) if (noisecompute)
{ {
m_noise_color.i.r = m_noise_color.i.g = m_noise_color.i.b = m_machine->rand() & 0xff; // Not accurate... m_noise_color.i.r = m_noise_color.i.g = m_noise_color.i.b = machine().rand() & 0xff; // Not accurate...
} }
m_pixel_color.i.r = ColorCombinerEquation(*m_color_inputs.combiner_rgbsub_a_r[1],*m_color_inputs.combiner_rgbsub_b_r[1],*m_color_inputs.combiner_rgbmul_r[1],*m_color_inputs.combiner_rgbadd_r[1]); m_pixel_color.i.r = ColorCombinerEquation(*m_color_inputs.combiner_rgbsub_a_r[1],*m_color_inputs.combiner_rgbsub_b_r[1],*m_color_inputs.combiner_rgbmul_r[1],*m_color_inputs.combiner_rgbadd_r[1]);
@ -428,7 +428,7 @@ void Processor::ColorCombiner2Cycle(bool noisecompute)
{ {
if (noisecompute) if (noisecompute)
{ {
m_noise_color.i.r = m_noise_color.i.g = m_noise_color.i.b = m_machine->rand() & 0xff; // HACK m_noise_color.i.r = m_noise_color.i.g = m_noise_color.i.b = machine().rand() & 0xff; // HACK
} }
m_combined_color.i.r = ColorCombinerEquation(*m_color_inputs.combiner_rgbsub_a_r[0],*m_color_inputs.combiner_rgbsub_b_r[0],*m_color_inputs.combiner_rgbmul_r[0],*m_color_inputs.combiner_rgbadd_r[0]); m_combined_color.i.r = ColorCombinerEquation(*m_color_inputs.combiner_rgbsub_a_r[0],*m_color_inputs.combiner_rgbsub_b_r[0],*m_color_inputs.combiner_rgbmul_r[0],*m_color_inputs.combiner_rgbadd_r[0]);
@ -939,7 +939,7 @@ void Processor::GetDitherValues(int x, int y, int* cdith, int* adith)
break; break;
case 2: case 2:
*cdith = s_magic_matrix[dithindex]; *cdith = s_magic_matrix[dithindex];
*adith = m_machine->rand() & 7; *adith = machine().rand() & 7;
break; break;
case 3: case 3:
*cdith = s_magic_matrix[dithindex]; *cdith = s_magic_matrix[dithindex];
@ -954,26 +954,26 @@ void Processor::GetDitherValues(int x, int y, int* cdith, int* adith)
break; break;
case 6: case 6:
*cdith = s_bayer_matrix[dithindex]; *cdith = s_bayer_matrix[dithindex];
*adith = m_machine->rand() & 7; *adith = machine().rand() & 7;
break; break;
case 7: case 7:
*cdith = s_bayer_matrix[dithindex]; *cdith = s_bayer_matrix[dithindex];
*adith = 0; *adith = 0;
break; break;
case 8: case 8:
*cdith = m_machine->rand() & 7; *cdith = machine().rand() & 7;
*adith = s_magic_matrix[dithindex]; *adith = s_magic_matrix[dithindex];
break; break;
case 9: case 9:
*cdith = m_machine->rand() & 7; *cdith = machine().rand() & 7;
*adith = (~s_magic_matrix[dithindex]) & 7; *adith = (~s_magic_matrix[dithindex]) & 7;
break; break;
case 10: case 10:
*cdith = m_machine->rand() & 7; *cdith = machine().rand() & 7;
*adith = (*cdith + 17) & 7; *adith = (*cdith + 17) & 7;
break; break;
case 11: case 11:
*cdith = m_machine->rand() & 7; *cdith = machine().rand() & 7;
*adith = 0; *adith = 0;
break; break;
case 12: case 12:

View File

@ -420,21 +420,20 @@ class Processor
m_span_dzdy = dz; m_span_dzdy = dz;
} }
running_machine &machine() const { assert(m_machine != NULL); return *m_machine; }
void InitInternalState() void InitInternalState()
{ {
if(m_machine) m_tmem = auto_alloc_array(machine(), UINT8, 0x1000);
memset(m_tmem, 0, 0x1000);
UINT8 *normpoint = machine().region("normpoint")->base();
UINT8 *normslope = machine().region("normslope")->base();
for(INT32 i = 0; i < 64; i++)
{ {
m_tmem = auto_alloc_array(*m_machine, UINT8, 0x1000); m_norm_point_rom[i] = (normpoint[(i << 1) + 1] << 8) | normpoint[i << 1];
memset(m_tmem, 0, 0x1000); m_norm_slope_rom[i] = (normslope[(i << 1) + 1] << 8) | normslope[i << 1];
UINT8 *normpoint = m_machine->region("normpoint")->base();
UINT8 *normslope = m_machine->region("normslope")->base();
for(INT32 i = 0; i < 64; i++)
{
m_norm_point_rom[i] = (normpoint[(i << 1) + 1] << 8) | normpoint[i << 1];
m_norm_slope_rom[i] = (normslope[(i << 1) + 1] << 8) | normslope[i << 1];
}
} }
} }

View File

@ -243,7 +243,7 @@ bool Blender::AlphaCompare(UINT8 alpha)
INT32 threshold; INT32 threshold;
if (m_other_modes->alpha_compare_en) if (m_other_modes->alpha_compare_en)
{ {
threshold = (m_other_modes->dither_alpha_en) ? (m_machine->rand() & 0xff) : m_rdp->GetBlendColor()->i.a; threshold = (m_other_modes->dither_alpha_en) ? (machine().rand() & 0xff) : m_rdp->GetBlendColor()->i.a;
if (alpha < threshold) if (alpha < threshold)
{ {
return false; return false;

View File

@ -36,6 +36,8 @@ class Blender
void SetShiftA(INT32 shift) { m_shift_a = shift; } void SetShiftA(INT32 shift) { m_shift_a = shift; }
void SetShiftB(INT32 shift) { m_shift_b = shift; } void SetShiftB(INT32 shift) { m_shift_b = shift; }
running_machine &machine() const { assert(m_machine != NULL); return *m_machine; }
private: private:
running_machine* m_machine; running_machine* m_machine;
OtherModes* m_other_modes; OtherModes* m_other_modes;

View File

@ -34,7 +34,7 @@ void Processor::RenderSpans(int start, int end, int tilenum, bool flip)
for(int i = start; i <= end; i++) for(int i = start; i <= end; i++)
{ {
m_span[i].SetMachine(*m_machine); m_span[i].SetMachine(machine());
switch(m_other_modes.cycle_type) switch(m_other_modes.cycle_type)
{ {
case CYCLE_TYPE_1: m_span[i].Draw1Cycle(i, tilenum, flip); break; case CYCLE_TYPE_1: m_span[i].Draw1Cycle(i, tilenum, flip); break;

View File

@ -42,6 +42,8 @@ class Span
void DrawCopy(int index, int tilenum, bool flip); void DrawCopy(int index, int tilenum, bool flip);
void DrawFill(int index, int tilenum, bool flip); void DrawFill(int index, int tilenum, bool flip);
running_machine &machine() const { assert(m_machine != NULL); return *m_machine; }
public: public:
int m_lx; int m_lx;
int m_rx; int m_rx;