diff options
author | 2011-04-18 20:06:43 +0000 | |
---|---|---|
committer | 2011-04-18 20:06:43 +0000 | |
commit | fecfc465df47655554aeb0ea33eccb0f33d498a7 (patch) | |
tree | 842317d1595fa823a6bd290b7667a66d2fc09a81 | |
parent | 4e7f194a638d0955374d2acf984017d5b1ed0e65 (diff) |
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
96 files changed, 642 insertions, 625 deletions
diff --git a/src/emu/cheat.c b/src/emu/cheat.c index e26b1ad0af6..34e27803f8e 100644 --- a/src/emu/cheat.c +++ b/src/emu/cheat.c @@ -1125,7 +1125,7 @@ cheat_manager::cheat_manager(running_machine &machine) void cheat_manager::set_enable(bool enable) { // if the cheat engine is disabled, we're done - if (!m_machine.options().cheat()) + if (!machine().options().cheat()) return; // 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() { // if the cheat engine is disabled, we're done - if (!m_machine.options().cheat()) + if (!machine().options().cheat()) return; // free everything @@ -1175,7 +1175,7 @@ void cheat_manager::reload() // load the cheat file, MESS will load a crc32.xml ( eg. 01234567.xml ) // and MAME will load gamename.xml 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 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 (m_cheatlist.count() == 0) - load_cheats(m_machine.basename()); + load_cheats(machine().basename()); // temporary: save the file back out as output.xml for comparison if (m_cheatlist.count() != 0) @@ -1215,7 +1215,7 @@ void cheat_manager::reload() bool cheat_manager::save_all(const char *filename) { // 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"); // if that failed, return nothing @@ -1262,7 +1262,7 @@ void cheat_manager::render_text(render_container &container) { // output the text 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, ARGB_WHITE, ARGB_BLACK, NULL, NULL); } @@ -1389,7 +1389,7 @@ void cheat_manager::frame_update() { // set up for accumulating output 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)); for (int linenum = 0; linenum < ARRAY_LENGTH(m_output); linenum++) m_output[linenum].reset(); @@ -1411,7 +1411,7 @@ void cheat_manager::frame_update() void cheat_manager::load_cheats(const char *filename) { 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 { // 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")) { // 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 cheat_entry *scannode = NULL; @@ -1462,7 +1462,7 @@ void cheat_manager::load_cheats(const char *filename) if (scannode == NULL) m_cheatlist.append(*curcheat); else - auto_free(m_machine, curcheat); + auto_free(machine(), curcheat); } // free the file and loop for the next one diff --git a/src/emu/cpu/adsp2100/adsp2100.c b/src/emu/cpu/adsp2100/adsp2100.c index fb38ee505da..e5c261f21e2 100644 --- a/src/emu/cpu/adsp2100/adsp2100.c +++ b/src/emu/cpu/adsp2100/adsp2100.c @@ -1263,7 +1263,7 @@ void adsp21xx_device::execute_set_input(int inputnum, int state) 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(); diff --git a/src/emu/cpu/asap/asap.c b/src/emu/cpu/asap/asap.c index adaed749d75..538fe8621a6 100644 --- a/src/emu/cpu/asap/asap.c +++ b/src/emu/cpu/asap/asap.c @@ -635,7 +635,7 @@ void asap_device::execute_run() check_irqs(); // 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 { diff --git a/src/emu/cpu/cosmac/cosmac.c b/src/emu/cpu/cosmac/cosmac.c index b7cbbfc17d6..df6b5a3c7eb 100644 --- a/src/emu/cpu/cosmac/cosmac.c +++ b/src/emu/cpu/cosmac/cosmac.c @@ -726,7 +726,7 @@ inline void cosmac_device::run() 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]); } diff --git a/src/emu/cpu/dsp16/dsp16.c b/src/emu/cpu/dsp16/dsp16.c index 5ee8f991faf..9b0e5a8b13a 100644 --- a/src/emu/cpu/dsp16/dsp16.c +++ b/src/emu/cpu/dsp16/dsp16.c @@ -232,7 +232,7 @@ void dsp16_device::execute_set_input(int inputnum, int state) 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 { diff --git a/src/emu/cpu/mips/psx.c b/src/emu/cpu/mips/psx.c index 2437f082721..199dc2d3235 100644 --- a/src/emu/cpu/mips/psx.c +++ b/src/emu/cpu/mips/psx.c @@ -232,7 +232,7 @@ void psxcpu_device::set_biu( UINT32 data, UINT32 mem_mask ) void psxcpu_device::stop() { - debugger_break( m_machine ); + debugger_break( machine() ); debugger_instruction_hook( this, m_pc ); } diff --git a/src/emu/cpu/tms32031/32031ops.c b/src/emu/cpu/tms32031/32031ops.c index 4a3654b5c03..31482d4a407 100644 --- a/src/emu/cpu/tms32031/32031ops.c +++ b/src/emu/cpu/tms32031/32031ops.c @@ -100,10 +100,10 @@ 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); - debugger_break(m_machine); + debugger_break(machine()); } } @@ -5496,7 +5496,7 @@ inline void tms3203x_device::execute_delayed(UINT32 newpc) { m_delayed = true; - if ((m_machine.debug_flags & DEBUG_FLAG_ENABLED) == 0) + if ((machine().debug_flags & DEBUG_FLAG_ENABLED) == 0) { execute_one(); execute_one(); diff --git a/src/emu/cpu/tms32031/tms32031.c b/src/emu/cpu/tms32031/tms32031.c index 32e37e8b874..c56d0007022 100644 --- a/src/emu/cpu/tms32031/tms32031.c +++ b/src/emu/cpu/tms32031/tms32031.c @@ -819,7 +819,7 @@ void tms3203x_device::execute_run() } // non-debug case - if ((m_machine.debug_flags & DEBUG_FLAG_ENABLED) == 0) + if ((machine().debug_flags & DEBUG_FLAG_ENABLED) == 0) { while (m_icount > 0) { @@ -854,7 +854,7 @@ void tms3203x_device::execute_run() { // watch for out-of-range stack pointers if (IREG(TMR_SP) & 0xff000000) - debugger_break(m_machine); + debugger_break(machine()); if ((IREG(TMR_ST) & RMFLAG) && m_pc == IREG(TMR_RE) + 1) { if ((INT32)--IREG(TMR_RC) >= 0) diff --git a/src/emu/cpu/upd7725/upd7725.c b/src/emu/cpu/upd7725/upd7725.c index f2fef9f2e2f..7d8f85ab4e2 100755 --- a/src/emu/cpu/upd7725/upd7725.c +++ b/src/emu/cpu/upd7725/upd7725.c @@ -400,7 +400,7 @@ void necdsp_device::execute_run() do { // 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); } diff --git a/src/emu/debug/debugvw.c b/src/emu/debug/debugvw.c index 9d652f5078d..39ebd3b312a 100644 --- a/src/emu/debug/debugvw.c +++ b/src/emu/debug/debugvw.c @@ -147,7 +147,7 @@ void debug_view_source_list::reset() { debug_view_source *source = m_head; m_head = source->m_next; - auto_free(m_machine, source); + auto_free(machine(), source); } // reset the tail pointer and index @@ -256,8 +256,8 @@ void debug_view::end_update() if (size > m_viewdata_size) { m_viewdata_size = size; - auto_free(m_machine, m_viewdata); - m_viewdata = auto_alloc_array(m_machine, debug_view_char, m_viewdata_size); + auto_free(machine(), m_viewdata); + m_viewdata = auto_alloc_array(machine(), debug_view_char, m_viewdata_size); } // update the view @@ -450,7 +450,7 @@ debug_view_manager::~debug_view_manager() { debug_view *oldhead = m_viewlist; 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) { 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: - 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: - 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: - 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: - 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: -// 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: -// 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: 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) { *viewptr = view.m_next; - auto_free(m_machine, &view); + auto_free(machine(), &view); break; } } @@ -581,7 +581,7 @@ debug_view_expression::~debug_view_expression() 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; } diff --git a/src/emu/debug/debugvw.h b/src/emu/debug/debugvw.h index 612c748276b..c79173e4b8b 100644 --- a/src/emu/debug/debugvw.h +++ b/src/emu/debug/debugvw.h @@ -165,6 +165,7 @@ public: ~debug_view_source_list(); // getters + running_machine &machine() const { return m_machine; } const debug_view_source *head() const { return m_head; } int count() const { return m_count; } int index(const debug_view_source &source) const; @@ -273,6 +274,9 @@ public: // construction/destruction debug_view_manager(running_machine &machine); ~debug_view_manager(); + + // getters + running_machine &machine() const { return m_machine; } // view allocation debug_view *alloc_view(debug_view_type type, debug_view_osd_update_func osdupdate, void *osdprivate); @@ -301,6 +305,7 @@ public: ~debug_view_expression(); // getters + running_machine &machine() const { return m_machine; } bool dirty() const { return m_dirty; } UINT64 last_value() const { return m_result; } UINT64 value() { recompute(); return m_result; } diff --git a/src/emu/debug/dvdisasm.c b/src/emu/debug/dvdisasm.c index 5275eea49db..f32e4fde4a4 100644 --- a/src/emu/debug/dvdisasm.c +++ b/src/emu/debug/dvdisasm.c @@ -116,8 +116,8 @@ debug_view_disasm::debug_view_disasm(running_machine &machine, debug_view_osd_up debug_view_disasm::~debug_view_disasm() { - auto_free(m_machine, m_byteaddress); - auto_free(m_machine, m_dasm); + auto_free(machine(), m_byteaddress); + auto_free(machine(), m_dasm); } @@ -134,10 +134,10 @@ void debug_view_disasm::enumerate_sources() // iterate over devices with disassembly interfaces device_disasm_interface *dasm = NULL; 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()); - 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 @@ -377,12 +377,12 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines) m_allocated = m_total; // allocate address array - auto_free(m_machine, m_byteaddress); - m_byteaddress = auto_alloc_array(m_machine, offs_t, m_allocated.y); + auto_free(machine(), m_byteaddress); + m_byteaddress = auto_alloc_array(machine(), offs_t, m_allocated.y); // allocate disassembly buffer - auto_free(m_machine, m_dasm); - m_dasm = auto_alloc_array(m_machine, char, m_allocated.x * m_allocated.y); + auto_free(machine(), m_dasm); + m_dasm = auto_alloc_array(machine(), char, m_allocated.x * m_allocated.y); } // iterate over lines diff --git a/src/emu/debug/dvmemory.c b/src/emu/debug/dvmemory.c index 440ec69d1ae..18e775d423b 100644 --- a/src/emu/debug/dvmemory.c +++ b/src/emu/debug/dvmemory.c @@ -153,22 +153,22 @@ void debug_view_memory::enumerate_sources() // first add all the devices' address spaces 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++) { address_space *space = memintf->space(spacenum); if (space != NULL) { 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 - 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()); - 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 @@ -177,7 +177,7 @@ void debug_view_memory::enumerate_sources() // stop when we run out of items UINT32 valsize, valcount; 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) break; @@ -185,7 +185,7 @@ void debug_view_memory::enumerate_sources() if (valcount > 1 && strstr(itemname, "globals/")) { 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 #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); - fd1094_regenerate_key(m_machine); + fd1094_regenerate_key(machine()); } #endif } diff --git a/src/emu/debug/dvstate.c b/src/emu/debug/dvstate.c index 296dadc6c35..796ab379b0a 100644 --- a/src/emu/debug/dvstate.c +++ b/src/emu/debug/dvstate.c @@ -105,10 +105,10 @@ void debug_view_state::enumerate_sources() // iterate over devices that have state interfaces device_state_interface *state = NULL; 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()); - 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 @@ -127,7 +127,7 @@ void debug_view_state::reset() { state_item *oldhead = m_state_list; 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 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; // 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; // 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; // 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; // 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; // 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; // add all registers into it for (const device_state_entry *entry = source.m_stateintf->state_first(); entry != NULL; entry = entry->next()) 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; } @@ -235,7 +235,7 @@ void debug_view_state::view_update() curitem = curitem->m_next; // loop over visible rows - screen_device *screen = m_machine.primary_screen; + screen_device *screen = machine().primary_screen; debug_view_char *dest = m_viewdata; for (UINT32 row = 0; row < m_visible.y; row++) { diff --git a/src/emu/debugint/debugint.c b/src/emu/debugint/debugint.c index 82a393105f0..45351d302ca 100644 --- a/src/emu/debugint/debugint.c +++ b/src/emu/debugint/debugint.c @@ -186,7 +186,7 @@ public: ~DView() { 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; } diff --git a/src/emu/devimage.c b/src/emu/devimage.c index dd06c5397c8..d4c53c11e3a 100644 --- a/src/emu/devimage.c +++ b/src/emu/devimage.c @@ -320,7 +320,7 @@ bool legacy_image_device_base::load_software(char *swlist, char *swname, rom_ent // " swlist % clonename % parentname " // 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) { 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); //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) swinfo = software_list_find(software_list_ptr, parentname, NULL); else @@ -343,10 +343,10 @@ bool legacy_image_device_base::load_software(char *swlist, char *swname, rom_ent 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); - 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); // 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 // try to load from list/setname 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 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 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 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) { @@ -489,7 +489,7 @@ done: if (m_err!=0) { 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()); else 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_machine.phase() == MACHINE_PHASE_RUNNING) + if (machine().phase() == MACHINE_PHASE_RUNNING) popmessage("Image '%s' was successfully %s.", path, is_create ? "created" : "loaded"); else mame_printf_info("Image '%s' was successfully %s.\n", path, is_create ? "created" : "loaded"); diff --git a/src/emu/devintrf.c b/src/emu/devintrf.c index 6e424c3f9f8..a91d699a92c 100644 --- a/src/emu/devintrf.c +++ b/src/emu/devintrf.c @@ -114,7 +114,7 @@ void device_list::import_config_list(const device_config_list &list, running_mac // append each device from the configuration list 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); newdevice->find_interfaces(); } @@ -130,12 +130,12 @@ void device_list::start_all() { // add exit and reset callbacks assert(m_machine != NULL); - m_machine->add_notifier(MACHINE_NOTIFY_RESET, static_reset); - m_machine->add_notifier(MACHINE_NOTIFY_EXIT, static_exit); + machine().add_notifier(MACHINE_NOTIFY_RESET, static_reset); + machine().add_notifier(MACHINE_NOTIFY_EXIT, static_exit); // add pre-save and post-load callbacks - m_machine->state().register_presave(static_pre_save, this); - m_machine->state().register_postload(static_post_load, this); + machine().state().register_presave(static_pre_save, this); + machine().state().register_postload(static_post_load, this); // iterate over devices to start them device_t *nextdevice; @@ -596,7 +596,7 @@ device_t::device_t(running_machine &_machine, const device_config &config) 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 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 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 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) { - 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) { - 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() { // populate the region field - m_region = m_machine.region(tag()); + m_region = machine().region(tag()); // find all the registered devices 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(); // remember the number of state registrations - int state_registrations = m_machine.state().registration_count(); + int state_registrations = machine().state().registration_count(); // start the device device_start(); // 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_sound_interface *sound; if (state_registrations == 0 && (interface(exec) || interface(sound))) { 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()); } @@ -784,9 +784,9 @@ void device_t::start() notify_clock_changed(); // 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(); } diff --git a/src/emu/devintrf.h b/src/emu/devintrf.h index 3e05c742089..e17addcf7dd 100644 --- a/src/emu/devintrf.h +++ b/src/emu/devintrf.h @@ -241,6 +241,8 @@ public: device_list(resource_pool &pool = global_resource_pool); 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 reset_all(); }; diff --git a/src/emu/devlegcy.c b/src/emu/devlegcy.c index 0b72a5aeb72..b15fdcd6b65 100644 --- a/src/emu/devlegcy.c +++ b/src/emu/devlegcy.c @@ -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); if (tokenbytes != 0) - m_token = auto_alloc_array_clear(m_machine, UINT8, tokenbytes); + m_token = auto_alloc_array_clear(machine(), UINT8, tokenbytes); } diff --git a/src/emu/machine.c b/src/emu/machine.c index 931e15c92f2..1a266f794ca 100644 --- a/src/emu/machine.c +++ b/src/emu/machine.c @@ -887,7 +887,7 @@ memory_region::memory_region(running_machine &machine, const char *name, UINT32 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() { 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() { 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() { 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() { 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() { 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() { 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 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 - image_postdevice_init(m_machine); + image_postdevice_init(machine()); // call palette_init if present 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 driver_start(); diff --git a/src/emu/machine.h b/src/emu/machine.h index 2b64c949f90..a2f03761c40 100644 --- a/src/emu/machine.h +++ b/src/emu/machine.h @@ -214,6 +214,7 @@ class memory_region public: // getters + running_machine &machine() const { return m_machine; } memory_region *next() const { return m_next; } UINT8 *base() const { return (this != NULL) ? m_base.u8 : NULL; } UINT8 *end() const { return (this != NULL) ? m_base.u8 + m_length : NULL; } diff --git a/src/emu/machine/6522via.c b/src/emu/machine/6522via.c index 7a956c37897..fd40ae03caf 100644 --- a/src/emu/machine/6522via.c +++ b/src/emu/machine/6522via.c @@ -169,7 +169,7 @@ UINT16 via6522_device::get_counter1_value() } else { - val = 0xffff - time_to_cycles(m_machine.time() - m_time1); + val = 0xffff - time_to_cycles(machine().time() - m_time1); } return val; @@ -217,7 +217,7 @@ void via6522_device::device_start() m_t1lh = 0xb5; /* ports are not written by kernel! */ m_t2ll = 0xff; /* taken from vice */ m_t2lh = 0xff; - m_time2 = m_time1 = m_machine.time(); + m_time2 = m_time1 = machine().time(); m_t1 = timer_alloc(TIMER_T1); m_t2 = timer_alloc(TIMER_T2); m_shift_timer = timer_alloc(TIMER_SHIFT); @@ -225,7 +225,7 @@ void via6522_device::device_start() /* Default clock is from CPU1 */ if (clock() == 0) { - set_unscaled_clock(m_machine.firstcpu->clock()); + set_unscaled_clock(machine().firstcpu->clock()); } /* save state register */ @@ -304,7 +304,7 @@ void via6522_device::set_int(int data) m_ifr |= data; 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) @@ -325,7 +325,7 @@ void via6522_device::clear_int(int data) 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) @@ -441,7 +441,7 @@ void via6522_device::device_timer(emu_timer &timer, device_timer_id id, int para m_out_b |= 0x80; } m_t1_active = 0; - m_time1 = m_machine.time(); + m_time1 = machine().time(); } if (m_ddr_b) { @@ -458,7 +458,7 @@ void via6522_device::device_timer(emu_timer &timer, device_timer_id id, int para // t2 timeout case TIMER_T2: m_t2_active = 0; - m_time2 = m_machine.time(); + m_time2 = machine().time(); if (!(m_ifr & INT_T2)) { @@ -492,7 +492,7 @@ READ8_MEMBER( via6522_device::read ) } 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 { - 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 { - 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 { - 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; @@ -623,7 +623,7 @@ READ8_MEMBER( via6522_device::read ) } 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; @@ -825,7 +825,7 @@ WRITE8_MEMBER( via6522_device::write ) { m_t2->adjust(cycles_to_time(TIMER2_VALUE)); m_t2_active = 1; - m_time2 = m_machine.time(); + m_time2 = machine().time(); } break; @@ -848,7 +848,7 @@ WRITE8_MEMBER( via6522_device::write ) 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) @@ -942,7 +942,7 @@ WRITE_LINE_MEMBER( via6522_device::write_ca1 ) if (state != m_in_ca1) { 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)) { @@ -954,7 +954,7 @@ WRITE_LINE_MEMBER( via6522_device::write_ca1 ) } 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 { - 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)) diff --git a/src/emu/machine/6526cia.c b/src/emu/machine/6526cia.c index 00d74718e59..e8c6796e03f 100644 --- a/src/emu/machine/6526cia.c +++ b/src/emu/machine/6526cia.c @@ -200,7 +200,7 @@ void mos6526_device::device_start() for (int t = 0; t < (sizeof(m_timer) / sizeof(m_timer[0])); 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_irq = 0x01 << t; } @@ -208,7 +208,7 @@ void mos6526_device::device_start() /* setup TOD timer, if appropriate */ 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 */ diff --git a/src/emu/machine/6532riot.c b/src/emu/machine/6532riot.c index 426277e8e06..521516e2a7c 100644 --- a/src/emu/machine/6532riot.c +++ b/src/emu/machine/6532riot.c @@ -121,7 +121,7 @@ void riot6532_device::update_irqstate() } 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) { static const UINT8 timershift[4] = { 0, 3, 6, 10 }; - attotime curtime = m_machine.time(); + attotime curtime = machine().time(); INT64 target; /* A0-A1 contain the timer divisor */ @@ -302,7 +302,7 @@ void riot6532_device::reg_w(UINT8 offset, UINT8 data) } 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 { - 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 */ @@ -522,7 +522,7 @@ void riot6532_device::device_start() assert(this != NULL); /* set static values */ - m_index = m_machine.m_devicelist.indexof(RIOT6532, tag()); + m_index = machine().m_devicelist.indexof(RIOT6532, tag()); /* configure the ports */ 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); /* 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 */ save_item(NAME(m_port[0].m_in)); diff --git a/src/emu/machine/6840ptm.c b/src/emu/machine/6840ptm.c index e239e5b0446..26b0f52a501 100644 --- a/src/emu/machine/6840ptm.c +++ b/src/emu/machine/6840ptm.c @@ -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[1] = m_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[0] = machine().scheduler().timer_alloc(FUNC(ptm6840_timer1_cb), (void *)this); + m_timer[1] = machine().scheduler().timer_alloc(FUNC(ptm6840_timer2_cb), (void *)this); + m_timer[2] = machine().scheduler().timer_alloc(FUNC(ptm6840_timer3_cb), (void *)this); for (int i = 0; i < 3; i++) { @@ -500,7 +500,7 @@ READ8_DEVICE_HANDLER_TRAMPOLINE(ptm6840, ptm6840_read) 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; val = m_status_reg; break; @@ -522,7 +522,7 @@ READ8_DEVICE_HANDLER_TRAMPOLINE(ptm6840, ptm6840_read) 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; break; } @@ -633,7 +633,7 @@ WRITE8_DEVICE_HANDLER_TRAMPOLINE(ptm6840, ptm6840_write) 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; } } diff --git a/src/emu/machine/6850acia.c b/src/emu/machine/6850acia.c index fba99000c12..17192e99e3a 100644 --- a/src/emu/machine/6850acia.c +++ b/src/emu/machine/6850acia.c @@ -116,8 +116,8 @@ void acia6850_device::device_start() m_tx_clock = m_config.m_tx_clock; m_tx_counter = 0; m_rx_counter = 0; - m_rx_timer = m_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_rx_timer = machine().scheduler().timer_alloc(FUNC(receive_event_callback), (void *)this); + m_tx_timer = machine().scheduler().timer_alloc(FUNC(transmit_event_callback), (void *)this); m_first_reset = 1; m_status_read = 0; m_brk = 0; @@ -349,7 +349,7 @@ WRITE8_DEVICE_HANDLER_TRAMPOLINE(acia6850, acia6850_data_w) } 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); } } diff --git a/src/emu/machine/74123.c b/src/emu/machine/74123.c index 8a6338d7149..5dd9bb6a657 100644 --- a/src/emu/machine/74123.c +++ b/src/emu/machine/74123.c @@ -106,7 +106,7 @@ ttl74123_device::ttl74123_device(running_machine &_machine, const ttl74123_devic 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 */ m_a = m_config.m_a; @@ -202,7 +202,7 @@ void ttl74123_device::set_output() { 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); } diff --git a/src/emu/machine/8237dma.c b/src/emu/machine/8237dma.c index 1dde83781ec..0648e2925ff 100644 --- a/src/emu/machine/8237dma.c +++ b/src/emu/machine/8237dma.c @@ -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); } - 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); } diff --git a/src/emu/machine/at28c16.c b/src/emu/machine/at28c16.c index ff7bc172ddc..f7090fa3671 100644 --- a/src/emu/machine/at28c16.c +++ b/src/emu/machine/at28c16.c @@ -129,7 +129,7 @@ at28c16_device::at28c16_device( running_machine &_machine, const at28c16_device_ 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_oe_12v) ); @@ -187,7 +187,7 @@ void at28c16_device::nvram_default() 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 ); @@ -196,7 +196,7 @@ void at28c16_device::nvram_read( emu_file &file ) 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 ) { - 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++ ) { @@ -215,7 +215,7 @@ void at28c16_device::nvram_write( emu_file &file ) file.write( buffer, AT28C16_TOTAL_BYTES ); - auto_free( m_machine, buffer ); + auto_free( machine(), buffer ); } diff --git a/src/emu/machine/ds1302.c b/src/emu/machine/ds1302.c index 63b732d446b..55f4728cdf0 100644 --- a/src/emu/machine/ds1302.c +++ b/src/emu/machine/ds1302.c @@ -151,7 +151,7 @@ WRITE8_DEVICE_HANDLER_TRAMPOLINE(ds1302, ds1302_clk_w) if(m_icount == 8) //Command start { system_time systime; - m_machine.base_datetime(systime); + machine().base_datetime(systime); switch(m_shift_in) { diff --git a/src/emu/machine/ds2401.c b/src/emu/machine/ds2401.c index 2902a033c03..c3bee02b0e0 100644 --- a/src/emu/machine/ds2401.c +++ b/src/emu/machine/ds2401.c @@ -20,7 +20,7 @@ inline void ATTR_PRINTF(3,4) ds2401_device::verboselog(int n_level, const char * va_start(v, s_fmt); vsprintf(buf, s_fmt, 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); } } diff --git a/src/emu/machine/ds2404.c b/src/emu/machine/ds2404.c index c16ca1b5ca7..4c4c43fedc2 100644 --- a/src/emu/machine/ds2404.c +++ b/src/emu/machine/ds2404.c @@ -129,7 +129,7 @@ void ds2404_device::device_start() m_rtc[3] = (current_time >> 16) & 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)); } diff --git a/src/emu/machine/eeprom.c b/src/emu/machine/eeprom.c index 5c5a3bbe9e0..14cfbefa011 100644 --- a/src/emu/machine/eeprom.c +++ b/src/emu/machine/eeprom.c @@ -302,11 +302,11 @@ void eeprom_device::nvram_read(emu_file &file) UINT32 eeprom_length = 1 << m_config.m_address_bits; 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); for (offs_t offs = 0; offs < eeprom_bytes; 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_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++) buffer[offs] = m_addrspace[0]->read_byte(offs); file.write(buffer, eeprom_bytes); - auto_free(m_machine, buffer); + auto_free(machine(), buffer); } diff --git a/src/emu/machine/f3853.c b/src/emu/machine/f3853.c index 98040b3fd9d..19ff8f563ea 100644 --- a/src/emu/machine/f3853.c +++ b/src/emu/machine/f3853.c @@ -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_low) ); diff --git a/src/emu/machine/i2cmem.c b/src/emu/machine/i2cmem.c index 063030d6b23..d6577137cbe 100644 --- a/src/emu/machine/i2cmem.c +++ b/src/emu/machine/i2cmem.c @@ -182,7 +182,7 @@ i2cmem_device::i2cmem_device( running_machine &_machine, const i2cmem_device_con { 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 ) { 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 ); @@ -271,7 +271,7 @@ void i2cmem_device::nvram_read( emu_file &file ) 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 ) { 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++ ) { @@ -291,7 +291,7 @@ void i2cmem_device::nvram_write( emu_file &file ) file.write( buffer, i2cmem_bytes ); - auto_free( m_machine, buffer ); + auto_free( machine(), buffer ); } diff --git a/src/emu/machine/ins8154.c b/src/emu/machine/ins8154.c index f075ad39a13..ff319ad785a 100644 --- a/src/emu/machine/ins8154.c +++ b/src/emu/machine/ins8154.c @@ -133,7 +133,7 @@ READ8_DEVICE_HANDLER_TRAMPOLINE(ins8154, ins8154_r) { 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; } @@ -207,7 +207,7 @@ WRITE8_DEVICE_HANDLER_TRAMPOLINE(ins8154, ins8154_w) { 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; } @@ -225,7 +225,7 @@ WRITE8_DEVICE_HANDLER_TRAMPOLINE(ins8154, ins8154_w) case 0x22: 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; @@ -234,7 +234,7 @@ WRITE8_DEVICE_HANDLER_TRAMPOLINE(ins8154, ins8154_w) case 0x23: 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; @@ -243,7 +243,7 @@ WRITE8_DEVICE_HANDLER_TRAMPOLINE(ins8154, ins8154_w) case 0x24: 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; diff --git a/src/emu/machine/k033906.c b/src/emu/machine/k033906.c index bea1fdd7c49..99e20ed6aee 100644 --- a/src/emu/machine/k033906.c +++ b/src/emu/machine/k033906.c @@ -63,10 +63,10 @@ k033906_device::k033906_device(running_machine &_machine, const k033906_device_c 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_ram = auto_alloc_array(m_machine, UINT32, 32768); + m_reg = auto_alloc_array(machine(), UINT32, 256); + m_ram = auto_alloc_array(machine(), UINT32, 32768); 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 default: - fatalerror("%s: k033906_reg_r: %08X", m_machine.describe_context(), reg); + fatalerror("%s: k033906_reg_r: %08X", machine().describe_context(), reg); } return 0; } @@ -139,7 +139,7 @@ void k033906_device::k033906_reg_w(int reg, UINT32 data) break; default: - fatalerror("%s:K033906_w: %08X, %08X", m_machine.describe_context(), data, reg); + fatalerror("%s:K033906_w: %08X, %08X", machine().describe_context(), data, reg); } } diff --git a/src/emu/machine/k056230.c b/src/emu/machine/k056230.c index 9d8f194e911..979db7186fa 100644 --- a/src/emu/machine/k056230.c +++ b/src/emu/machine/k056230.c @@ -65,7 +65,7 @@ void k056230_device::device_start() { if(m_config.m_cpu) { - m_cpu = m_machine.device(m_config.m_cpu); + m_cpu = machine().device(m_config.m_cpu); } else { @@ -74,7 +74,7 @@ void k056230_device::device_start() 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); } @@ -128,7 +128,7 @@ WRITE8_DEVICE_HANDLER_TRAMPOLINE(k056230, k056230_w) { 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 diff --git a/src/emu/machine/mb3773.c b/src/emu/machine/mb3773.c index ae114786ab7..e6e1eac96d7 100644 --- a/src/emu/machine/mb3773.c +++ b/src/emu/machine/mb3773.c @@ -105,7 +105,7 @@ mb3773_device::mb3773_device( running_machine &_machine, const mb3773_device_con 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(); save_item( NAME(m_ck) ); @@ -156,5 +156,5 @@ void mb3773_device::reset_timer() 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(); } diff --git a/src/emu/machine/mc146818.c b/src/emu/machine/mc146818.c index 8f31779a58b..a80fe6784ac 100644 --- a/src/emu/machine/mc146818.c +++ b/src/emu/machine/mc146818.c @@ -183,7 +183,7 @@ mc146818_device::mc146818_device(running_machine &_machine, const mc146818_devic void mc146818_device::device_start() { - m_last_refresh = m_machine.time(); + m_last_refresh = machine().time(); emu_timer *timer = timer_alloc(); 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 @@ -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_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::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; diff --git a/src/emu/machine/nvram.c b/src/emu/machine/nvram.c index c7a3fc7152d..7671f316fb7 100644 --- a/src/emu/machine/nvram.c +++ b/src/emu/machine/nvram.c @@ -179,7 +179,7 @@ void nvram_device::nvram_default() { UINT8 *nvram = reinterpret_cast<UINT8 *>(m_base); for (int index = 0; index < m_length; index++) - nvram[index] = m_machine.rand(); + nvram[index] = machine().rand(); break; } @@ -231,7 +231,7 @@ void nvram_device::determine_final_base() // find our shared pointer with the target RAM 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) throw emu_fatalerror("NVRAM device '%s' has no corresponding AM_SHARE region", tag()); } diff --git a/src/emu/machine/timekpr.c b/src/emu/machine/timekpr.c index 79bd13627ca..998c9bcc2c6 100644 --- a/src/emu/machine/timekpr.c +++ b/src/emu/machine/timekpr.c @@ -200,7 +200,7 @@ void timekeeper_device::device_start() /* validate some basic stuff */ assert(this != NULL); - m_machine.base_datetime(systime); + machine().base_datetime(systime); m_control = 0; 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_year = 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(); if (m_default_data) diff --git a/src/emu/machine/x76f041.c b/src/emu/machine/x76f041.c index 6070a120a54..c42b5571b34 100644 --- a/src/emu/machine/x76f041.c +++ b/src/emu/machine/x76f041.c @@ -25,7 +25,7 @@ inline void ATTR_PRINTF(3,4) x76f041_device::verboselog(int n_level, const char va_start(v, s_fmt); vsprintf(buf, s_fmt, 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); } } diff --git a/src/emu/machine/x76f100.c b/src/emu/machine/x76f100.c index e89ec08b015..89db4b05e4b 100644 --- a/src/emu/machine/x76f100.c +++ b/src/emu/machine/x76f100.c @@ -23,7 +23,7 @@ inline void ATTR_PRINTF(3,4) x76f100_device::verboselog(int n_level, const char va_start(v, s_fmt); vsprintf(buf, s_fmt, 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); } } diff --git a/src/emu/machine/z80dart.c b/src/emu/machine/z80dart.c index 6058d8d7148..8bb3c212cf8 100644 --- a/src/emu/machine/z80dart.c +++ b/src/emu/machine/z80dart.c @@ -293,28 +293,28 @@ void z80dart_device::device_start() if (m_config.m_rx_clock_a != 0) { // 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)); } if (m_config.m_tx_clock_a != 0) { // 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)); } if (m_config.m_rx_clock_b != 0) { // 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)); } if (m_config.m_tx_clock_b != 0) { // 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)); } diff --git a/src/emu/machine/z80dma.c b/src/emu/machine/z80dma.c index 0ae998debcd..bfdcea40ead 100644 --- a/src/emu/machine/z80dma.c +++ b/src/emu/machine/z80dma.c @@ -236,7 +236,7 @@ void z80dma_device::device_start() devcb_resolve_write8(&m_out_iorq_func, &m_config.m_out_iorq_func, this); // 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 save_item(NAME(m_regs)); @@ -876,7 +876,7 @@ void z80dma_device::rdy_write_callback(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); - m_machine.scheduler().synchronize(FUNC(static_rdy_write_callback), state, (void *)this); + machine().scheduler().synchronize(FUNC(static_rdy_write_callback), state, (void *)this); } diff --git a/src/emu/machine/z80sio.c b/src/emu/machine/z80sio.c index 71e99630a02..ecc93d16913 100644 --- a/src/emu/machine/z80sio.c +++ b/src/emu/machine/z80sio.c @@ -561,7 +561,7 @@ void z80sio_device::sio_channel::control_write(UINT8 data) int regnum = m_regs[0] & 7; 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 UINT8 old = m_regs[regnum]; @@ -579,7 +579,7 @@ void z80sio_device::sio_channel::control_write(UINT8 data) switch (data & SIO_WR0_COMMAND_MASK) { 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(); break; @@ -640,7 +640,7 @@ UINT8 z80sio_device::sio_channel::control_read() 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]; } @@ -652,7 +652,7 @@ UINT8 z80sio_device::sio_channel::control_read() 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 (!(m_regs[5] & SIO_WR5_TX_ENABLE)) @@ -681,7 +681,7 @@ UINT8 z80sio_device::sio_channel::data_read() // reset the receive interrupt 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; } diff --git a/src/emu/machine/z80sti.c b/src/emu/machine/z80sti.c index 6be81805b97..2dfc89e7c9a 100644 --- a/src/emu/machine/z80sti.c +++ b/src/emu/machine/z80sti.c @@ -244,22 +244,22 @@ void z80sti_device::device_start() devcb_resolve_write_line(&m_out_int_func, &m_config.m_out_int_func, this); // create the counter timers - m_timer[TIMER_A] = m_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_C] = m_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_A] = 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] = 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 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)); } // create serial transmit clock timer 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)); } diff --git a/src/emu/memory.c b/src/emu/memory.c index 252353bcae1..954515f0d64 100644 --- a/src/emu/memory.c +++ b/src/emu/memory.c @@ -262,6 +262,7 @@ public: ~memory_block(); // getters + running_machine &machine() const { return m_machine; } memory_block *next() const { return m_next; } offs_t bytestart() const { return m_bytestart; } offs_t byteend() const { return m_byteend; } @@ -336,6 +337,7 @@ public: // getters memory_bank *next() const { return m_next; } + running_machine &machine() const { return m_machine; } int index() const { return m_index; } int entry() const { return m_curentry; } 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() { - 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; // 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); // 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)); - memory_share *share = auto_alloc(m_machine, memory_share(entry->m_byteend + 1 - entry->m_bytestart)); - m_machine.memory_data->sharemap.add(entry->m_share, share, false); + memory_share *share = auto_alloc(machine(), memory_share(entry->m_byteend + 1 - entry->m_bytestart)); + 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 @@ -1980,7 +1982,7 @@ void address_space::prepare_map() // validate adjusted addresses against implicit regions 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) 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 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 @@ -2068,13 +2070,13 @@ void address_space::populate_map_entry(const address_map_entry &entry, read_or_w case AMH_DEVICE_DELEGATE: if (data.m_type == AMH_DRIVER_DELEGATE) { - object = m_machine.driver_data<driver_device>(); + object = machine().driver_data<driver_device>(); 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()); } else { - object = m_machine.device(data.m_tag); + object = machine().device(data.m_tag); 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()); } @@ -2117,7 +2119,7 @@ void address_space::populate_map_entry(const address_map_entry &entry, read_or_w break; case AMH_LEGACY_DEVICE_HANDLER: - device = m_machine.device(data.m_tag); + device = machine().device(data.m_tag); 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()); @@ -2162,14 +2164,14 @@ void address_space::populate_map_entry(const address_map_entry &entry, read_or_w 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 // we do this to make sure they are found by space_find_backing_memory first memory_block *prev_memblock_tail = blocklist.last(); for (address_map_entry *entry = m_map->m_entrylist.first(); entry != NULL; entry = entry->next()) 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 address_map_entry *unassigned = NULL; @@ -2216,7 +2218,7 @@ void address_space::allocate_memory() // we now have a block to allocate; do it offs_t curbytestart = curblockstart * MEMORY_BLOCK_CHUNK; 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 unassigned = block_assign_intersecting(curbytestart, curbyteend, block.data()); @@ -2237,19 +2239,19 @@ void address_space::locate_memory() if (entry->m_baseptr != NULL) *entry->m_baseptr = entry->m_memory; 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) - *(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) *entry->m_sizeptr = entry->m_byteend - entry->m_bytestart + 1; 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) - *(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 - 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)) { // 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; // 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 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) { - memory_private *memdata = m_machine.memory_data; + memory_private *memdata = machine().memory_data; address_map_entry *unassigned = NULL; // 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) { // find the port - const input_port_config *port = m_machine.port(rtag); + const input_port_config *port = machine().port(rtag); 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()); @@ -2456,7 +2458,7 @@ void address_space::install_readwrite_port(offs_t addrstart, offs_t addrend, off if (wtag != NULL) { // find the port - const input_port_config *port = m_machine.port(wtag); + const input_port_config *port = machine().port(wtag); 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()); @@ -2466,7 +2468,7 @@ void address_space::install_readwrite_port(offs_t addrstart, offs_t addrend, off } // 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 - 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) { - 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", 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 (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!"); - 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()); } } @@ -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 (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!"); - 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()); } } @@ -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); read().handler_read(entry).set_delegate(handler, unitmask); - generate_memdump(m_machine); + generate_memdump(machine()); 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); write().handler_write(entry).set_delegate(handler, unitmask); - generate_memdump(m_machine); + generate_memdump(machine()); 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); 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)); } @@ -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); 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)); } @@ -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); 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)); } @@ -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); 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)); } @@ -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); read().handler_read(entry).set_delegate(handler, unitmask); - generate_memdump(m_machine); + generate_memdump(machine()); 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); write().handler_write(entry).set_delegate(handler, unitmask); - generate_memdump(m_machine); + generate_memdump(machine()); 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); 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)); } @@ -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); 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)); } @@ -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); 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)); } @@ -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); 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)); } @@ -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); read().handler_read(entry).set_delegate(handler, unitmask); - generate_memdump(m_machine); + generate_memdump(machine()); 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); write().handler_write(entry).set_delegate(handler, unitmask); - generate_memdump(m_machine); + generate_memdump(machine()); 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); 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)); } @@ -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); 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)); } @@ -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); 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)); } @@ -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); 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)); } @@ -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); read().handler_read(entry).set_delegate(handler, unitmask); - generate_memdump(m_machine); + generate_memdump(machine()); 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); write().handler_write(entry).set_delegate(handler, unitmask); - generate_memdump(m_machine); + generate_memdump(machine()); 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); 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)); } @@ -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); 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)); } @@ -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); 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)); } @@ -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); 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)); } @@ -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 - 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)) { 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 (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) return true; } @@ -3019,7 +3021,7 @@ bool address_space::needs_backing_store(const address_map_entry *entry) 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 - 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 || (entry->m_read.m_type == AMH_ROM && (m_spacenum != AS_0 || region == NULL || entry->m_addrstart >= region->bytes()))) 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_private *memdata = m_machine.memory_data; + memory_private *memdata = machine().memory_data; // adjust the addresses, handling mirrors and such 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 - 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); // 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() { 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() { - 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; // 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); memset(&newentry[m_entry_count], 0, (newcount - m_entry_count) * sizeof(m_entry[0])); // 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_count = newcount; } diff --git a/src/emu/render.c b/src/emu/render.c index f13ded089ff..dd3291466c9 100644 --- a/src/emu/render.c +++ b/src/emu/render.c @@ -2530,7 +2530,7 @@ float render_manager::max_update_rate() const 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) { - 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) { - 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 *container = auto_alloc(m_machine, render_container(*this, screen)); + render_container *container = auto_alloc(machine(), render_container(*this, screen)); if (screen != NULL) m_screen_container_list.append(*container); return container; @@ -2675,7 +2675,7 @@ render_container *render_manager::container_alloc(screen_device *screen) void render_manager::container_free(render_container *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); // 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); 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); 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); changed = true; diff --git a/src/emu/rendlay.c b/src/emu/rendlay.c index c3df4c94c9c..a42d58c8e6b 100644 --- a/src/emu/rendlay.c +++ b/src/emu/rendlay.c @@ -509,7 +509,7 @@ layout_element::layout_element(running_machine &machine, xml_data_node &elemnode layout_element::~layout_element() { // 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_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; } @@ -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); // 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() { if (m_element != NULL) - m_element->m_machine.render().texture_free(m_texture); + m_element->machine().render().texture_free(m_texture); } diff --git a/src/emu/schedule.c b/src/emu/schedule.c index 33cbac54fe6..bbcd6ccd79f 100644 --- a/src/emu/schedule.c +++ b/src/emu/schedule.c @@ -290,11 +290,11 @@ void emu_timer::register_save() } // save the bits - m_machine->state().save_item("timer", name, index, NAME(m_param)); - m_machine->state().save_item("timer", name, index, NAME(m_enabled)); - m_machine->state().save_item("timer", name, index, NAME(m_period)); - m_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_param)); + machine().state().save_item("timer", name, index, NAME(m_enabled)); + machine().state().save_item("timer", name, index, NAME(m_period)); + machine().state().save_item("timer", name, index, NAME(m_start)); + 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) { // 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); // register global states - m_machine.state().save_item(NAME(m_basetime)); - m_machine.state().register_postload(&state_postload_stub<device_scheduler, &device_scheduler::postload>, this); + machine.state().save_item(NAME(m_basetime)); + 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() { - 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 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) { - 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) { - 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) { - 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) { // 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 (min_quantum == attotime::zero) min_quantum = attotime::from_hz(60); // 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) - 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; 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); } @@ -756,7 +756,7 @@ void device_scheduler::rebuild_execute_list() // iterate over all devices 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 exec->m_nextexec = NULL; @@ -875,7 +875,7 @@ void device_scheduler::execute_timers() if (timer.m_device != NULL) timer.m_device->timer_expired(timer, timer.m_id, timer.m_param, timer.m_ptr); 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(); } diff --git a/src/emu/schedule.h b/src/emu/schedule.h index 4c8e936fd45..56af090538e 100644 --- a/src/emu/schedule.h +++ b/src/emu/schedule.h @@ -159,6 +159,7 @@ public: ~device_scheduler(); // getters + running_machine &machine() const { return m_machine; } attotime time() const; emu_timer *first_timer() const { return m_timer_list; } device_execute_interface *currently_executing() const { return m_executing_device; } diff --git a/src/emu/screen.c b/src/emu/screen.c index 8908fd69fe7..df7b37627af 100644 --- a/src/emu/screen.c +++ b/src/emu/screen.c @@ -347,8 +347,8 @@ screen_device::screen_device(running_machine &_machine, const screen_device_conf screen_device::~screen_device() { - m_machine.render().texture_free(m_texture[0]); - m_machine.render().texture_free(m_texture[1]); + machine().render().texture_free(m_texture[0]); + machine().render().texture_free(m_texture[1]); if (m_burnin != NULL) finalize_burnin(); global_free(m_screen_overlay_bitmap); @@ -371,15 +371,15 @@ void screen_device::device_start() m_container->set_user_settings(settings); // allocate the VBLANK timers - m_vblank_begin_timer = m_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_begin_timer = machine().scheduler().timer_alloc(FUNC(static_vblank_begin_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 - 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 - if ((m_machine.config().m_video_attributes & VIDEO_UPDATE_SCANLINE) != 0) - m_scanline_timer = m_machine.scheduler().timer_alloc(FUNC(static_scanline_update_callback), (void *)this); + if ((machine().config().m_video_attributes & VIDEO_UPDATE_SCANLINE) != 0) + m_scanline_timer = machine().scheduler().timer_alloc(FUNC(static_scanline_update_callback), (void *)this); // configure the screen with the default parameters 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); // 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)); // create burn-in bitmap - if (m_machine.options().burnin()) + if (machine().options().burnin()) { 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; - 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) fatalerror("Error allocating burn-in bitmap for screen at (%dx%d)\n", width, height); bitmap_fill(m_burnin, NULL, 0); } // load the effect overlay - const char *overname = m_machine.options().effect(); + const char *overname = machine().options().effect(); if (overname != NULL && strcmp(overname, "none") != 0) 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()); // 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) { // 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_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) { // free what we have currently - m_machine.render().texture_free(m_texture[0]); - m_machine.render().texture_free(m_texture[1]); - auto_free(m_machine, m_bitmap[0]); - auto_free(m_machine, m_bitmap[1]); + machine().render().texture_free(m_texture[0]); + machine().render().texture_free(m_texture[1]); + auto_free(machine(), m_bitmap[0]); + auto_free(machine(), m_bitmap[1]); // compute new width/height curwidth = MAX(m_width, curwidth); @@ -552,22 +552,22 @@ void screen_device::realloc_screen_bitmaps() palette_t *palette = NULL; 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_RGB32: m_texture_format = TEXFORMAT_RGB32; palette = NULL; break; default: fatalerror("Invalid bitmap format!"); break; } // allocate bitmaps - m_bitmap[0] = auto_alloc(m_machine, bitmap_t(curwidth, curheight, m_config.m_format)); - bitmap_set_palette(m_bitmap[0], m_machine.palette); - m_bitmap[1] = auto_alloc(m_machine, bitmap_t(curwidth, curheight, m_config.m_format)); - bitmap_set_palette(m_bitmap[1], m_machine.palette); + m_bitmap[0] = auto_alloc(machine(), bitmap_t(curwidth, curheight, m_config.m_format)); + bitmap_set_palette(m_bitmap[0], machine().palette); + m_bitmap[1] = auto_alloc(machine(), bitmap_t(curwidth, curheight, m_config.m_format)); + bitmap_set_palette(m_bitmap[1], machine().palette); // 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[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); } } @@ -609,17 +609,17 @@ bool screen_device::update_partial(int scanline) LOG_PARTIAL_UPDATES(("Partial: update_partial(%s, %d): ", tag(), scanline)); // 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 (m_machine.video().skip_this_frame()) + if (machine().video().skip_this_frame()) { LOG_PARTIAL_UPDATES(("skipped due to frameskipping\n")); return FALSE; } // 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")); return FALSE; @@ -696,7 +696,7 @@ void screen_device::update_now() 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; // round to the nearest pixel @@ -717,7 +717,7 @@ int screen_device::vpos() 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 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; // 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) targetdelta += m_frame_period; while (targetdelta <= curdelta) @@ -777,7 +777,7 @@ attotime screen_device::time_until_vblank_end() const attotime target_time = m_vblank_end_time; if (!vblank()) 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 (*itemptr == NULL) { - *itemptr = auto_alloc(m_machine, callback_item); + *itemptr = auto_alloc(machine(), callback_item); (*itemptr)->m_next = NULL; (*itemptr)->m_callback = vblank_callback; (*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() { // 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); // call the screen specific callbacks @@ -824,8 +824,8 @@ void screen_device::vblank_begin_callback() (*item->m_callback)(*this, item->m_param, true); // 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)) - m_machine.video().frame_update(); + if (this == machine().primary_screen && !(machine().config().m_video_attributes & VIDEO_UPDATE_AFTER_VBLANK)) + machine().video().frame_update(); // reset the VBLANK start timer for the next frame 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); // 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)) - m_machine.video().frame_update(); + if (this == machine().primary_screen && (machine().config().m_video_attributes & VIDEO_UPDATE_AFTER_VBLANK)) + machine().video().frame_update(); // increment the frame number counter m_frame_number++; @@ -899,19 +899,19 @@ void screen_device::scanline_update_callback(int scanline) bool screen_device::update_quads() { // 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 - 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 (!m_machine.video().skip_this_frame() && m_changed) + if (!machine().video().skip_this_frame() && m_changed) { rectangle fixedvis = m_visarea; fixedvis.max_x++; 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_curtexture = m_curbitmap; @@ -965,7 +965,7 @@ void screen_device::update_burnin() if (srcbitmap->format == BITMAP_FORMAT_INDEXED16) { 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) { 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; // 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, BITMAP_FORMAT_ARGB32)); @@ -1057,8 +1057,8 @@ void screen_device::finalize_burnin() // write the final PNG // 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); - file_error filerr = file.open(m_machine.basename(), PATH_SEPARATOR "burnin-", tag(), ".png") ; + emu_file file(machine().options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + file_error filerr = file.open(machine().basename(), PATH_SEPARATOR "burnin-", tag(), ".png") ; if (filerr == FILERR_NONE) { png_info pnginfo = { 0 }; @@ -1068,7 +1068,7 @@ void screen_device::finalize_burnin() // add two text entries describing the image sprintf(text, APPNAME " %s", build_version); 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); // now do the actual work @@ -1094,7 +1094,7 @@ void screen_device::load_effect_overlay(const char *filename) fullname.cat(".png"); // 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); if (m_screen_overlay_bitmap != NULL) 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) { return (*m_config.m_screen_update)(this, &bitmap, &cliprect); } else { - m_machine.driver_data<driver_device>()->screen_update(*this, bitmap, cliprect); + machine().driver_data<driver_device>()->screen_update(*this, bitmap, cliprect); } return 0; } @@ -1125,9 +1125,9 @@ bool screen_device::screen_update(bitmap_t &bitmap, const rectangle &cliprect) void screen_device::screen_eof() { 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 { - m_machine.driver_data<driver_device>()->screen_eof(); + machine().driver_data<driver_device>()->screen_eof(); } } diff --git a/src/emu/screen.h b/src/emu/screen.h index 2c7f9d3ae25..28df0a4b524 100644 --- a/src/emu/screen.h +++ b/src/emu/screen.h @@ -175,14 +175,14 @@ public: // beam positioning and state int vpos() 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); } // timing 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_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 frame_period() const { return (this == NULL || !started()) ? DEFAULT_FRAME_PERIOD : attotime(0, m_frame_period); }; UINT64 frame_number() const { return m_frame_number; } @@ -194,7 +194,7 @@ public: // additional helpers 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 bool update_quads(); diff --git a/src/emu/sound.c b/src/emu/sound.c index 64ffa942bef..3597f328ff8 100644 --- a/src/emu/sound.c +++ b/src/emu/sound.c @@ -849,7 +849,7 @@ sound_stream *sound_manager::stream_alloc(device_t &device, int inputs, int outp void sound_manager::set_attenuation(int 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 { // 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()) { @@ -1003,11 +1003,11 @@ void sound_manager::update() // force all the speaker streams to generate the proper number of samples 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)); // now downmix the final result - UINT32 finalmix_step = m_machine.video().speed_factor(); + UINT32 finalmix_step = machine().video().speed_factor(); UINT32 finalmix_offset = 0; INT16 *finalmix = m_finalmix; int sample; @@ -1037,14 +1037,14 @@ void sound_manager::update() if (finalmix_offset > 0) { if (!m_nosound_mode) - m_machine.osd().update_audio_stream(finalmix, finalmix_offset / 2); - m_machine.video().add_sound_to_recording(finalmix, finalmix_offset / 2); + machine().osd().update_audio_stream(finalmix, finalmix_offset / 2); + machine().video().add_sound_to_recording(finalmix, finalmix_offset / 2); if (m_wavfile != NULL) wav_add_data_16(m_wavfile, finalmix, finalmix_offset); } // see if we ticked over to the next second - attotime curtime = m_machine.time(); + attotime curtime = machine().time(); bool second_tick = false; if (curtime.seconds != m_last_update.seconds) { diff --git a/src/emu/sound.h b/src/emu/sound.h index 10ac49ef987..dfda66a9395 100644 --- a/src/emu/sound.h +++ b/src/emu/sound.h @@ -220,6 +220,7 @@ public: ~sound_manager(); // getters + running_machine &machine() const { return m_machine; } int attenuation() const { return m_attenuation; } sound_stream *first_stream() const { return m_stream_list.first(); } attotime last_update() const { return m_last_update; } diff --git a/src/emu/sound/asc.c b/src/emu/sound/asc.c index 824c04a92c3..68445169e85 100644 --- a/src/emu/sound/asc.c +++ b/src/emu/sound/asc.c @@ -129,7 +129,7 @@ asc_device::asc_device(running_machine &_machine, const asc_device_config &confi void asc_device::device_start() { // 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)); diff --git a/src/emu/sound/bsmt2000.c b/src/emu/sound/bsmt2000.c index 7e172fc6a98..11f790e5458 100644 --- a/src/emu/sound/bsmt2000.c +++ b/src/emu/sound/bsmt2000.c @@ -226,7 +226,7 @@ void bsmt2000_device::device_start() // in theory we should generate a 24MHz stream, but that's certainly overkill // 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 - 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 save_item(NAME(m_register_select)); @@ -326,7 +326,7 @@ void bsmt2000_device::write_data(UINT16 data) synchronize(TIMER_ID_DATA_WRITE, data); // 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)); } diff --git a/src/emu/sound/cdp1869.c b/src/emu/sound/cdp1869.c index f003bed0791..16c54a4e07f 100644 --- a/src/emu/sound/cdp1869.c +++ b/src/emu/sound/cdp1869.c @@ -416,7 +416,7 @@ cdp1869_device::cdp1869_device(running_machine &_machine, const cdp1869_device_c void cdp1869_device::device_start() { // 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); // resolve callbacks @@ -434,7 +434,7 @@ void cdp1869_device::device_start() initialize_palette(); // 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 save_item(NAME(m_prd)); @@ -496,7 +496,7 @@ void cdp1869_device::initialize_palette() 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) @@ -504,7 +504,7 @@ void cdp1869_device::initialize_palette() { 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++; } } @@ -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 amplitude = m_toneamp * ((0.78*5) / 15); - int rate = m_machine.sample_rate() / 2; + int rate = machine().sample_rate() / 2; /* get progress through wave */ int incr = m_incr; diff --git a/src/emu/sound/discrete.c b/src/emu/sound/discrete.c index b2bb8036238..4224700093a 100644 --- a/src/emu/sound/discrete.c +++ b/src/emu/sound/discrete.c @@ -688,7 +688,7 @@ void discrete_device::init_nodes(const sound_block_list_t &block_list) /* make sure we have one simple task * 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); } @@ -722,7 +722,7 @@ void discrete_device::init_nodes(const sound_block_list_t &block_list) { if (task != NULL) 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]; if (task->task_group < 0 || task->task_group >= DISCRETE_MAX_TASK_GROUPS) 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() { // 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(); char name[32]; @@ -1021,7 +1021,7 @@ void discrete_sound_device::device_start() fatalerror("init_nodes() - Couldn't find an output node"); /* 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 */ for_each(discrete_dss_input_stream_node **, node, &m_input_stream_list) diff --git a/src/emu/sound/ics2115.c b/src/emu/sound/ics2115.c index 02fe11b9eca..33a39e95ea2 100644 --- a/src/emu/sound/ics2115.c +++ b/src/emu/sound/ics2115.c @@ -47,9 +47,9 @@ ics2115_device::ics2115_device(running_machine &machine, const ics2115_device_co void ics2115_device::device_start() { m_rom = *region(); - m_timer[0].timer = m_machine.scheduler().timer_alloc(FUNC(timer_cb_0), this); - m_timer[1].timer = m_machine.scheduler().timer_alloc(FUNC(timer_cb_1), this); - m_stream = m_machine.sound().stream_alloc(*this, 0, 2, 33075); + m_timer[0].timer = machine().scheduler().timer_alloc(FUNC(timer_cb_0), this); + m_timer[1].timer = machine().scheduler().timer_alloc(FUNC(timer_cb_1), this); + m_stream = machine().sound().stream_alloc(*this, 0, 2, 33075); //Exact formula as per patent 5809466 //This seems to give the ok fit but it is not good enough. diff --git a/src/emu/sound/okim6295.c b/src/emu/sound/okim6295.c index af27711b7d3..c316038f74e 100644 --- a/src/emu/sound/okim6295.c +++ b/src/emu/sound/okim6295.c @@ -177,7 +177,7 @@ void okim6295_device::device_start() // create the stream 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_bank_offs)); @@ -266,7 +266,7 @@ void okim6295_device::set_bank_base(offs_t base) if (m_bank_installed) { m_bank_offs = base; - memory_set_bankptr(m_machine, tag(), m_region->base() + base); + memory_set_bankptr(machine(), tag(), m_region->base() + base); } } diff --git a/src/emu/sound/okim9810.c b/src/emu/sound/okim9810.c index 095c811f9ad..8704f05490c 100644 --- a/src/emu/sound/okim9810.c +++ b/src/emu/sound/okim9810.c @@ -150,7 +150,7 @@ void okim9810_device::device_start() // create the stream //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 // m_TMP_register diff --git a/src/emu/sound/spu.c b/src/emu/sound/spu.c index e64f58f4e3a..65a05dd6ff0 100644 --- a/src/emu/sound/spu.c +++ b/src/emu/sound/spu.c @@ -1148,7 +1148,7 @@ void spu_device::init_stream() { 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); diff --git a/src/emu/speaker.c b/src/emu/speaker.c index 052a581a676..1151fb8306f 100644 --- a/src/emu/speaker.c +++ b/src/emu/speaker.c @@ -170,7 +170,7 @@ void speaker_device::device_start() } // 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() { - m_mixer_stream->set_sample_rate(m_machine.sample_rate()); + m_mixer_stream->set_sample_rate(machine().sample_rate()); } diff --git a/src/emu/state.c b/src/emu/state.c index 880875d88f3..aac7ac7f2d2 100644 --- a/src/emu/state.c +++ b/src/emu/state.c @@ -156,7 +156,7 @@ void state_manager::register_presave(prepost_func func, void *param) fatalerror("Duplicate save state function (%p, %p)", param, func); // 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); // 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) { 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); m_illegal_regs++; return; @@ -222,7 +222,7 @@ void state_manager::save_memory(const char *module, const char *tag, UINT32 inde } // 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 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; // 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 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; } @@ -314,7 +314,7 @@ state_save_error state_manager::write_file(emu_file &file) memcpy(&header[0], s_magic_num, 8); header[8] = SAVE_VERSION; 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 *)&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 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 for (state_entry *entry = m_entry_list.first(); entry != NULL; entry = entry->next()) diff --git a/src/emu/state.h b/src/emu/state.h index dacfef66673..140fdc298e6 100644 --- a/src/emu/state.h +++ b/src/emu/state.h @@ -148,6 +148,7 @@ public: state_manager(running_machine &machine); // getters + running_machine &machine() const { return m_machine; } int registration_count() const { return m_entry_list.count(); } bool registration_allowed() const { return m_reg_allowed; } diff --git a/src/emu/timer.c b/src/emu/timer.c index eb4a2020ef9..a2b0c781ebd 100644 --- a/src/emu/timer.c +++ b/src/emu/timer.c @@ -280,7 +280,7 @@ void timer_device::device_start() { // fetch the screen 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 m_timer = timer_alloc(); diff --git a/src/emu/video.c b/src/emu/video.c index 84576f7b8d6..cbe71be6644 100644 --- a/src/emu/video.c +++ b/src/emu/video.c @@ -218,9 +218,9 @@ void video_manager::set_frameskip(int frameskip) void video_manager::frame_update(bool debug) { // 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; - 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(); @@ -234,24 +234,24 @@ void video_manager::frame_update(bool debug) } // 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 - debugint_update_during_game(m_machine); + debugint_update_during_game(machine()); // if we're throttling, synchronize before rendering - attotime current_time = m_machine.time(); + attotime current_time = machine().time(); if (!debug && !skipped_it && effective_throttle()) update_throttle(current_time); // ask the OSD to update g_profiler.start(PROFILER_BLIT); - m_machine.osd().update(!debug && skipped_it); + machine().osd().update(!debug && skipped_it); g_profiler.stop(); // perform tasks for this frame if (!debug) - m_machine.call_notifiers(MACHINE_NOTIFY_FRAME); + machine().call_notifiers(MACHINE_NOTIFY_FRAME); // update frameskipping if (!debug) @@ -265,14 +265,14 @@ void video_manager::frame_update(bool debug) if (phase == MACHINE_PHASE_RUNNING) { // 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))) - m_machine.primary_screen->scanline0_callback(); + if (machine().primary_screen != NULL && (machine().paused() || debug || debugger_within_instruction_hook(machine()))) + machine().primary_screen->scanline0_callback(); // otherwise, call the video EOF callback else { 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(); g_profiler.stop(); } @@ -290,7 +290,7 @@ astring &video_manager::speed_text(astring &string) string.reset(); // if we're paused, just display Paused - bool paused = m_machine.paused(); + bool paused = machine().paused(); if (paused) string.cat("paused"); @@ -312,7 +312,7 @@ astring &video_manager::speed_text(astring &string) // display the number of partial updates as well 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(); if (partials > 1) 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 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_add_text(&pnginfo, "Software", text1); png_add_text(&pnginfo, "System", text2); // now do the actual work - const rgb_t *palette = (m_machine.palette != NULL) ? palette_entry_list_adjusted(m_machine.palette) : NULL; - png_error error = png_write_bitmap(file, &pnginfo, m_snap_bitmap, m_machine.total_colors(), palette); + 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, machine().total_colors(), palette); if (error != PNGERR_NONE) 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) { // write one snapshot per visible screen - for (screen_device *screen = m_machine.first_screen(); screen != NULL; screen = screen->next_screen()) - if (m_machine.render().is_live(*screen)) + for (screen_device *screen = machine().first_screen(); screen != NULL; screen = screen->next_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"); if (filerr == FILERR_NONE) save_snapshot(screen, file); @@ -376,7 +376,7 @@ void video_manager::save_active_screen_snapshots() // otherwise, just write a single snapshot 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"); if (filerr == FILERR_NONE) save_snapshot(NULL, file); @@ -398,7 +398,7 @@ void video_manager::begin_recording(const char *name, movie_format format) // reset the state m_movie_frame = 0; - m_movie_next_frame_time = m_machine.time(); + m_movie_next_frame_time = machine().time(); // start up an AVI recording 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 avi_movie_info info; 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_numsamples = 0; 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.audio_format = 0; - info.audio_timescale = m_machine.sample_rate(); + info.audio_timescale = machine().sample_rate(); info.audio_sampletime = 1; info.audio_numsamples = 0; info.audio_channels = 2; info.audio_samplebits = 16; - info.audio_samplerate = m_machine.sample_rate(); + info.audio_samplerate = machine().sample_rate(); // create a new temporary movie file file_error filerr; 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) filerr = tempfile.open(name); else @@ -452,7 +452,7 @@ void video_manager::begin_recording(const char *name, movie_format format) else if (format == MF_MNG) { // 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; if (name != NULL) filerr = m_mngfile->open(name); @@ -462,7 +462,7 @@ void video_manager::begin_recording(const char *name, movie_format format) if (filerr == FILERR_NONE) { // 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); if (pngerr != PNGERR_NONE) return end_recording(); @@ -497,7 +497,7 @@ void video_manager::end_recording() if (m_mngfile != NULL) { mng_capture_stop(*m_mngfile); - auto_free(m_machine, m_mngfile); + auto_free(machine(), m_mngfile); m_mngfile = NULL; } @@ -547,10 +547,10 @@ void video_manager::exit() // free all the graphics elements 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 - m_machine.render().target_free(m_snap_target); + machine().render().target_free(m_snap_target); if (m_snap_bitmap != NULL) global_free(m_snap_bitmap); @@ -584,7 +584,7 @@ TIMER_CALLBACK( video_manager::screenless_update_callback ) 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 { // if we're fast forwarding or paused, autoframeskip is disabled - if (m_fastforward || m_machine.paused()) + if (m_fastforward || machine().paused()) return false; // 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 { // 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; // 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 { - 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() { // 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); // now add the quads for all the screens 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()) anything_changed = true; // update our movie recording and burn-in state - if (!m_machine.paused()) + if (!machine().paused()) { record_frame(); // 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(); } // 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); 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 ... // 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 - if (m_machine.paused()) + if (machine().paused()) { m_throttle_emutime = emutime - attotime(0, ATTOSECONDS_PER_SECOND / PAUSED_REFRESH_RATE); 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 // and we're not frameskipping due to autoframeskip, or if we're paused 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; - if (m_machine.paused()) + if (machine().paused()) allowed_to_sleep = true; // loop until we reach our target @@ -956,15 +956,15 @@ void video_manager::update_frameskip() void video_manager::update_refresh_speed() { // 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) { // 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 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; if (period != 0) @@ -998,7 +998,7 @@ void video_manager::update_refresh_speed() 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 (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_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 (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 - emu_file file(m_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"); + emu_file file(machine().options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + file_error filerr = file.open(machine().basename(), PATH_SEPARATOR "final.png"); if (filerr == FILERR_NONE) - save_snapshot(m_machine.primary_screen, file); + save_snapshot(machine().primary_screen, file); } // 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 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); 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) - auto_free(m_machine, m_snap_bitmap); - m_snap_bitmap = auto_alloc(m_machine, bitmap_t(width, height, BITMAP_FORMAT_RGB32)); + auto_free(machine(), m_snap_bitmap); + m_snap_bitmap = auto_alloc(machine(), bitmap_t(width, height, BITMAP_FORMAT_RGB32)); } // render the screen there @@ -1105,7 +1105,7 @@ file_error video_manager::open_next(emu_file &file, const char *extension) UINT32 origflags = file.openflags(); // handle defaults - const char *snapname = m_machine.options().snap_name(); + const char *snapname = machine().options().snap_name(); if (snapname == NULL || snapname[0] == 0) 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 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 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 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 astring fname; @@ -1235,7 +1235,7 @@ void video_manager::record_frame() // start the profiler and get the current time g_profiler.start(PROFILER_MOVIE_REC); - attotime curtime = m_machine.time(); + attotime curtime = machine().time(); // create the bitmap create_snapshot_bitmap(NULL); @@ -1263,14 +1263,14 @@ void video_manager::record_frame() if (m_movie_frame == 0) { 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, "System", text2); } // write the next frame - const rgb_t *palette = (m_machine.palette != NULL) ? palette_entry_list_adjusted(m_machine.palette) : NULL; - png_error error = mng_capture_frame(*m_mngfile, &pnginfo, m_snap_bitmap, m_machine.total_colors(), palette); + 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, machine().total_colors(), palette); png_free(&pnginfo); if (error != PNGERR_NONE) { diff --git a/src/emu/video.h b/src/emu/video.h index b928f9b6d0f..ce660ff657c 100644 --- a/src/emu/video.h +++ b/src/emu/video.h @@ -86,6 +86,7 @@ public: video_manager(running_machine &machine); // getters + running_machine &machine() const { return m_machine; } bool skip_this_frame() const { return m_skipping_this_frame; } int speed_factor() const { return m_speed; } int frameskip() const { return m_auto_frameskip ? -1 : m_frameskip_level; } diff --git a/src/emu/video/cdp1861.c b/src/emu/video/cdp1861.c index 879c34a43c6..1c275d89df6 100644 --- a/src/emu/video/cdp1861.c +++ b/src/emu/video/cdp1861.c @@ -95,9 +95,9 @@ void cdp1861_device::device_start() m_dma_timer = timer_alloc(TIMER_DMA); // find devices - m_cpu = m_machine.device<cpu_device>(m_config.m_cpu_tag); - m_screen = m_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_cpu = machine().device<cpu_device>(m_config.m_cpu_tag); + m_screen = machine().device<screen_device>(m_config.m_screen_tag); + m_bitmap = auto_bitmap_alloc(machine(), m_screen->width(), m_screen->height(), m_screen->format()); // register for state saving save_item(NAME(m_disp)); @@ -274,6 +274,6 @@ void cdp1861_device::update_screen(bitmap_t *bitmap, const rectangle *cliprect) } else { - bitmap_fill(bitmap, cliprect, get_black_pen(m_machine)); + bitmap_fill(bitmap, cliprect, get_black_pen(machine())); } } diff --git a/src/emu/video/cdp1862.c b/src/emu/video/cdp1862.c index 554930e958f..bdc4dab6cd8 100644 --- a/src/emu/video/cdp1862.c +++ b/src/emu/video/cdp1862.c @@ -103,7 +103,7 @@ inline void cdp1862_device::initialize_palette() g = (i & 1) ? 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); // find devices - m_screen = m_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_screen = machine().device<screen_device>(m_config.m_screen_tag); + m_bitmap = auto_bitmap_alloc(machine(), m_screen->width(), m_screen->height(), m_screen->format()); // init palette initialize_palette(); diff --git a/src/emu/video/crt9007.c b/src/emu/video/crt9007.c index 88ea8b4a6ad..be7632ef461 100644 --- a/src/emu/video/crt9007.c +++ b/src/emu/video/crt9007.c @@ -566,7 +566,7 @@ void crt9007_device::device_start() devcb_resolve_write_line(&m_out_sld_func, &m_config.out_sld_func, this); // 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); // set horizontal pixels per column diff --git a/src/emu/video/crt9021.c b/src/emu/video/crt9021.c index dd159dd2ba4..66fad0b45b5 100644 --- a/src/emu/video/crt9021.c +++ b/src/emu/video/crt9021.c @@ -166,7 +166,7 @@ void crt9021_device::device_start() devcb_resolve_read_line(&m_in_atten_func, &m_config.in_atten_func, this); // 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); // register for state saving diff --git a/src/emu/video/hd44102.c b/src/emu/video/hd44102.c index c2624416d62..73fb8d6e710 100644 --- a/src/emu/video/hd44102.c +++ b/src/emu/video/hd44102.c @@ -117,7 +117,7 @@ hd44102_device::hd44102_device(running_machine &_machine, const hd44102_device_c void hd44102_device::device_start() { // 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 save_item(NAME(m_ram[0])); diff --git a/src/emu/video/hd61830.c b/src/emu/video/hd61830.c index 0bcdf1af56c..94c8e59ce98 100644 --- a/src/emu/video/hd61830.c +++ b/src/emu/video/hd61830.c @@ -208,7 +208,7 @@ void hd61830_device::device_start() // resolve callbacks 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 save_item(NAME(m_bf)); diff --git a/src/emu/video/msm6255.c b/src/emu/video/msm6255.c index e8984719ddc..0b85e56cf8b 100644 --- a/src/emu/video/msm6255.c +++ b/src/emu/video/msm6255.c @@ -143,7 +143,7 @@ msm6255_device::msm6255_device(running_machine &_machine, const msm6255_device_c void msm6255_device::device_start() { // 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 save_item(NAME(m_ir)); @@ -447,6 +447,6 @@ void msm6255_device::update_screen(bitmap_t *bitmap, const rectangle *cliprect) } else { - bitmap_fill(bitmap, cliprect, get_black_pen(m_machine)); + bitmap_fill(bitmap, cliprect, get_black_pen(machine())); } } diff --git a/src/emu/video/upd3301.c b/src/emu/video/upd3301.c index cb72a677c04..99c7fcf4d27 100644 --- a/src/emu/video/upd3301.c +++ b/src/emu/video/upd3301.c @@ -269,7 +269,7 @@ void upd3301_device::device_start() devcb_resolve_write_line(&m_out_vrtc_func, &m_config.m_out_vrtc_func, this); // 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); // state saving @@ -663,6 +663,6 @@ void upd3301_device::update_screen(bitmap_t *bitmap, const rectangle *cliprect) } else { - bitmap_fill(bitmap, cliprect, get_black_pen(m_machine)); + bitmap_fill(bitmap, cliprect, get_black_pen(machine())); } } diff --git a/src/mame/drivers/beathead.c b/src/mame/drivers/beathead.c index 6ffdb5d4412..5bed0f4a434 100644 --- a/src/mame/drivers/beathead.c +++ b/src/mame/drivers/beathead.c @@ -142,7 +142,7 @@ static TIMER_DEVICE_CALLBACK( scanline_callback ) 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); /* 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; - timer_device *scanline_timer = m_machine.device<timer_device>("scan_timer"); - scanline_timer->adjust(m_machine.primary_screen->time_until_pos(0) - m_hblank_offset); + m_hblank_offset = machine().primary_screen->scan_period() * (455 - 336 - 25) / 455; + timer_device *scanline_timer = machine().device<timer_device>("scan_timer"); + scanline_timer->adjust(machine().primary_screen->time_until_pos(0) - m_hblank_offset); /* reset IRQs */ m_irq_line_state = CLEAR_LINE; @@ -192,7 +192,7 @@ void beathead_state::update_interrupts() { m_irq_line_state = gen_int; //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 //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 ) { - 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_cpu_to_sound_ready) result ^= 0x20; return result; @@ -287,7 +287,7 @@ WRITE32_MEMBER( beathead_state::sound_data_w ) WRITE32_MEMBER( beathead_state::sound_reset_w ) { 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 ) { - coin_counter_w(m_machine, 0, !offset); + coin_counter_w(machine(), 0, !offset); } diff --git a/src/mame/drivers/cidelsa.c b/src/mame/drivers/cidelsa.c index 2b68d7be1e4..4aaf43af327 100644 --- a/src/mame/drivers/cidelsa.c +++ b/src/mame/drivers/cidelsa.c @@ -45,7 +45,7 @@ WRITE8_MEMBER( draco_state::sound_bankswitch_w ) 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 ) @@ -127,9 +127,9 @@ WRITE8_MEMBER( cidelsa_state::altair_out1_w ) 7 CONT. M1 */ - set_led_status(m_machine, 0, data & 0x08); // 1P - set_led_status(m_machine, 1, data & 0x10); // 2P - set_led_status(m_machine, 2, data & 0x20); // FIRE + set_led_status(machine(), 0, data & 0x08); // 1P + set_led_status(machine(), 1, data & 0x10); // 2P + set_led_status(machine(), 2, data & 0x20); // FIRE } WRITE8_MEMBER( draco_state::out1_w ) @@ -442,8 +442,8 @@ void cidelsa_state::machine_start() void draco_state::machine_start() { /* setup COP402 memory banking */ - memory_configure_bank(m_machine, "bank1", 0, 2, m_machine.region(COP402N_TAG)->base(), 0x400); - memory_set_bank(m_machine, "bank1", 0); + memory_configure_bank(machine(), "bank1", 0, 2, machine().region(COP402N_TAG)->base(), 0x400); + memory_set_bank(machine(), "bank1", 0); /* register for state saving */ save_item(NAME(m_reset)); @@ -457,7 +457,7 @@ void cidelsa_state::machine_reset() { /* reset the CPU */ 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 */ diff --git a/src/mame/drivers/itech32.c b/src/mame/drivers/itech32.c index c14f4543cbb..8935cdb2298 100644 --- a/src/mame/drivers/itech32.c +++ b/src/mame/drivers/itech32.c @@ -895,11 +895,11 @@ static READ32_DEVICE_HANDLER( timekeeper_32be_r ) 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 int start = (base == state->m_main_ram) ? 0x80 : 0x00; 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 if (state->m_is_drivedge) diff --git a/src/mame/drivers/liberatr.c b/src/mame/drivers/liberatr.c index 3e926dd6e4e..a43ddb6bfa3 100644 --- a/src/mame/drivers/liberatr.c +++ b/src/mame/drivers/liberatr.c @@ -161,13 +161,13 @@ void liberatr_state::machine_start() 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 ) { - ::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 */ if (((data ^ m_ctrld) & 0x10) && (data & 0x10)) { - UINT8 trackball = input_port_read(m_machine, "FAKE"); - UINT8 switches = input_port_read(m_machine, "IN0"); + UINT8 trackball = input_port_read(machine(), "FAKE"); + UINT8 switches = input_port_read(machine(), "IN0"); m_trackball_offset = ((trackball & 0xf0) - (switches & 0xf0)) | ((trackball - switches) & 0x0f); } 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 (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); } /* otherwise, the LS191 is simply passing through the raw switch inputs */ else - return input_port_read(m_machine, "IN0"); + return input_port_read(machine(), "IN0"); } diff --git a/src/mame/machine/cdicdic.c b/src/mame/machine/cdicdic.c index 2c8699ec2ae..2edc37e1606 100644 --- a/src/mame/machine/cdicdic.c +++ b/src/mame/machine/cdicdic.c @@ -448,7 +448,7 @@ void cdicdic_device::decode_audio_sector(const UINT8 *xa, INT32 triggered) { // 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; INT32 channels; INT32 bits = 4; @@ -460,7 +460,7 @@ void cdicdic_device::decode_audio_sector(const UINT8 *xa, INT32 triggered) 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 { @@ -573,7 +573,7 @@ void cdicdic_device::sample_trigger() { 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); return; } @@ -581,13 +581,13 @@ void cdicdic_device::sample_trigger() if(!m_decode_delay) { // 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; // Set the CDIC interrupt line - verboselog(m_machine, 0, "Setting CDIC interrupt line for soundmap decode\n" ); - device_set_input_line_vector(m_machine.device("maincpu"), M68K_IRQ_4, 128); - cputag_set_input_line(m_machine, "maincpu", M68K_IRQ_4, ASSERT_LINE); + verboselog(machine(), 0, "Setting CDIC interrupt line for soundmap decode\n" ); + device_set_input_line_vector(machine().device("maincpu"), M68K_IRQ_4, 128); + cputag_set_input_line(machine(), "maincpu", M68K_IRQ_4, ASSERT_LINE); } else { @@ -596,7 +596,7 @@ void cdicdic_device::sample_trigger() 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_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 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 - 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_audio_sample_timer->adjust(m_decode_period); //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 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_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); //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); @@ -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)) && (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_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); //printf( "Setting CDIC interrupt line\n" ); - verboselog(m_machine, 0, "Setting CDIC interrupt line for audio sector\n" ); - device_set_input_line_vector(m_machine.device("maincpu"), M68K_IRQ_4, 128); - cputag_set_input_line(m_machine, "maincpu", M68K_IRQ_4, ASSERT_LINE); + verboselog(machine(), 0, "Setting CDIC interrupt line for audio sector\n" ); + device_set_input_line_vector(machine().device("maincpu"), M68K_IRQ_4, 128); + 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) { @@ -758,13 +758,13 @@ void cdicdic_device::process_delayed_command() (buffer[CDIC_SECTOR_SUBMODE2] & CDIC_SUBMODE_EOF) == CDIC_SUBMODE_EOF) { //printf( "Setting CDIC interrupt line\n" ); - verboselog(m_machine, 0, "Setting CDIC interrupt line for message sector\n" ); - device_set_input_line_vector(m_machine.device("maincpu"), M68K_IRQ_4, 128); - cputag_set_input_line(m_machine, "maincpu", M68K_IRQ_4, ASSERT_LINE); + verboselog(machine(), 0, "Setting CDIC interrupt line for message sector\n" ); + device_set_input_line_vector(machine().device("maincpu"), M68K_IRQ_4, 128); + cputag_set_input_line(machine(), "maincpu", M68K_IRQ_4, ASSERT_LINE); } else { - verboselog(m_machine, 0, "Message sector, ignored\n" ); + verboselog(machine(), 0, "Message sector, ignored\n" ); } } else @@ -778,9 +778,9 @@ void cdicdic_device::process_delayed_command() } //printf( "Setting CDIC interrupt line\n" ); - verboselog(m_machine, 0, "Setting CDIC interrupt line for data sector\n" ); - device_set_input_line_vector(m_machine.device("maincpu"), M68K_IRQ_4, 128); - cputag_set_input_line(m_machine, "maincpu", M68K_IRQ_4, ASSERT_LINE); + verboselog(machine(), 0, "Setting CDIC interrupt line for data sector\n" ); + device_set_input_line_vector(machine().device("maincpu"), M68K_IRQ_4, 128); + cputag_set_input_line(machine(), "maincpu", M68K_IRQ_4, ASSERT_LINE); } 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)) { 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 @@ -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]; } - verboselog(m_machine, 0, "Setting CDIC interrupt line for CDDA sector\n" ); - device_set_input_line_vector(m_machine.device("maincpu"), M68K_IRQ_4, 128); - cputag_set_input_line(m_machine, "maincpu", M68K_IRQ_4, ASSERT_LINE); + verboselog(machine(), 0, "Setting CDIC interrupt line for CDDA sector\n" ); + device_set_input_line_vector(machine().device("maincpu"), M68K_IRQ_4, 128); + cputag_set_input_line(machine(), "maincpu", M68K_IRQ_4, ASSERT_LINE); break; } case 0x2c: // Seek @@ -924,9 +924,9 @@ void cdicdic_device::process_delayed_command() m_time = next_msf << 8; - verboselog(m_machine, 0, "Setting CDIC interrupt line for Seek sector\n" ); - device_set_input_line_vector(m_machine.device("maincpu"), M68K_IRQ_4, 128); - cputag_set_input_line(m_machine, "maincpu", M68K_IRQ_4, ASSERT_LINE); + verboselog(machine(), 0, "Setting CDIC interrupt line for Seek sector\n" ); + device_set_input_line_vector(machine().device("maincpu"), M68K_IRQ_4, 128); + cputag_set_input_line(machine(), "maincpu", M68K_IRQ_4, ASSERT_LINE); break; } } @@ -944,31 +944,31 @@ UINT16 cdicdic_device::register_read(const UINT32 offset, const UINT16 mem_mask) switch(addr) { 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; 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; 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; 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; 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; 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; 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; case 0x3ff4/2: // ABUF @@ -977,11 +977,11 @@ UINT16 cdicdic_device::register_read(const UINT32 offset, const UINT16 mem_mask) m_audio_buffer &= 0x7fff; if(!((m_audio_buffer | m_x_buffer) & 0x8000)) { - cputag_set_input_line(m_machine, "maincpu", M68K_IRQ_4, CLEAR_LINE); - verboselog(m_machine, 0, "Clearing CDIC interrupt line\n" ); + cputag_set_input_line(machine(), "maincpu", M68K_IRQ_4, CLEAR_LINE); + verboselog(machine(), 0, "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; } @@ -991,11 +991,11 @@ UINT16 cdicdic_device::register_read(const UINT32 offset, const UINT16 mem_mask) m_x_buffer &= 0x7fff; if(!((m_audio_buffer | m_x_buffer) & 0x8000)) { - cputag_set_input_line(m_machine, "maincpu", M68K_IRQ_4, CLEAR_LINE); - verboselog(m_machine, 0, "Clearing CDIC interrupt line\n" ); + cputag_set_input_line(machine(), "maincpu", M68K_IRQ_4, CLEAR_LINE); + verboselog(machine(), 0, "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; } @@ -1005,17 +1005,17 @@ UINT16 cdicdic_device::register_read(const UINT32 offset, const UINT16 mem_mask) { 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; } 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; } 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; } } @@ -1027,58 +1027,58 @@ WRITE16_DEVICE_HANDLER( cdic_w ) 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; switch(addr) { 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); break; case 0x3c02/2: // Time register (MSW) m_time &= ~(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; case 0x3c04/2: // Time register (LSW) m_time &= ~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; 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); break; case 0x3c08/2: // Channel register (MSW) m_channel &= ~(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; case 0x3c0a/2: // Channel register (LSW) m_channel &= ~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; 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); break; 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); break; 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); break; @@ -1090,9 +1090,9 @@ void cdicdic_device::register_write(const UINT32 offset, const UINT16 data, cons UINT32 index = 0; UINT32 device_index = (data & 0x3fff) >> 1; UINT16 *memory = state->m_planea; - verboselog(m_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(m_machine, 0, "Doing copy, transferring %04x bytes\n", count * 2 ); + verboselog(machine(), 0, "memory address counter: %08x\n", scc68070->dma.channel[0].memory_address_counter); + verboselog(machine(), 0, "cdic_w: DMA Control Register = %04x & %04x\n", data, mem_mask); + verboselog(machine(), 0, "Doing copy, transferring %04x bytes\n", count * 2 ); ////printf("Doing copy, transferring %04x bytes\n", count * 2 ); if((start & 0x00f00000) == 0x00200000) { @@ -1116,7 +1116,7 @@ void cdicdic_device::register_write(const UINT32 offset, const UINT16 data, cons 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); if(m_z_buffer & 0x2000) { @@ -1136,12 +1136,12 @@ void cdicdic_device::register_write(const UINT32 offset, const UINT16 data, cons break; } 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); break; 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); if(m_data_buffer & 0x8000) { @@ -1156,7 +1156,7 @@ void cdicdic_device::register_write(const UINT32 offset, const UINT16 data, cons break; } case 0x2b: // Stop CDDA - cdda_stop_audio(m_machine.device("cdda")); + cdda_stop_audio(machine().device("cdda")); m_interrupt_timer->adjust(attotime::never); break; case 0x23: // Reset Mode 1 @@ -1180,7 +1180,7 @@ void cdicdic_device::register_write(const UINT32 offset, const UINT16 data, cons break; } default: - verboselog(m_machine, 0, "Unknown CDIC command: %02x\n", m_command ); + verboselog(machine(), 0, "Unknown CDIC command: %02x\n", m_command ); break; } } @@ -1188,7 +1188,7 @@ void cdicdic_device::register_write(const UINT32 offset, const UINT16 data, cons break; } 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; } } @@ -1216,13 +1216,13 @@ void cdicdic_device::device_start() { 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_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_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(); - device_t *cdrom_dev = m_machine.device("cdrom"); + device_t *cdrom_dev = machine().device("cdrom"); if( cdrom_dev ) { // MESS case (has CDROM device) 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 { // MAME case - m_cd = cdrom_open(get_disk_handle(m_machine, "cdrom")); - cdda_set_cdrom(m_machine.device("cdda"), m_cd); + m_cd = cdrom_open(get_disk_handle(machine(), "cdrom")); + 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) { - 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]); } @@ -1305,7 +1305,7 @@ READ16_DEVICE_HANDLER( cdic_ram_r ) 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]; } diff --git a/src/mame/machine/cdislave.c b/src/mame/machine/cdislave.c index ec4a6dfe793..f6f8d8bfb1b 100644 --- a/src/mame/machine/cdislave.c +++ b/src/mame/machine/cdislave.c @@ -90,9 +90,9 @@ TIMER_CALLBACK( cdislave_device::trigger_readback_int ) void cdislave_device::readback_trigger() { - verboselog(m_machine, 0, "Asserting IRQ2\n" ); - device_set_input_line_vector(m_machine.device("maincpu"), M68K_IRQ_2, 26); - cputag_set_input_line(m_machine, "maincpu", M68K_IRQ_2, ASSERT_LINE); + verboselog(machine(), 0, "Asserting IRQ2\n" ); + device_set_input_line_vector(machine().device("maincpu"), M68K_IRQ_2, 26); + cputag_set_input_line(machine(), "maincpu", M68K_IRQ_2, ASSERT_LINE); 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() { - UINT16 x = input_port_read(m_machine, "MOUSEX"); - UINT16 y = input_port_read(m_machine, "MOUSEY"); - UINT8 buttons = input_port_read(m_machine, "MOUSEBTN"); + UINT16 x = input_port_read(machine(), "MOUSEX"); + UINT16 y = input_port_read(machine(), "MOUSEY"); + UINT8 buttons = input_port_read(machine(), "MOUSEBTN"); UINT16 old_mouse_x = m_real_mouse_x; 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) { 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) { 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 0xf4: case 0xf7: - verboselog(m_machine, 0, "slave_r: De-asserting IRQ2\n" ); - cputag_set_input_line(m_machine, "maincpu", M68K_IRQ_2, CLEAR_LINE); + verboselog(machine(), 0, "slave_r: De-asserting IRQ2\n" ); + cputag_set_input_line(machine(), "maincpu", M68K_IRQ_2, CLEAR_LINE); break; } } @@ -191,7 +191,7 @@ UINT16 cdislave_device::register_read(const UINT32 offset, const UINT16 mem_mask } 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; } @@ -220,14 +220,14 @@ WRITE16_DEVICE_HANDLER( slave_w ) 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) { case 0: 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_index++; 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 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: - 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; break; 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; break; } @@ -277,7 +277,7 @@ void cdislave_device::register_write(const UINT32 offset, const UINT16 data, con case 1: 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_index++; 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) { 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); m_in_index = 0; m_in_count = 0; @@ -314,7 +314,7 @@ void cdislave_device::register_write(const UINT32 offset, const UINT16 data, con case 2: 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_index++; 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) { 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); m_in_index = 0; m_in_count = 0; //cdic->audio_sample_timer->adjust(attotime::never); break; 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); m_in_index = 0; m_in_count = 0; break; 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; break; 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); m_in_index = 0; m_in_count = 0; @@ -368,7 +368,7 @@ void cdislave_device::register_write(const UINT32 offset, const UINT16 data, con case 3: 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_index++; 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) { 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; break; 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; break; 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); m_in_index = 0; break; 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; prepare_readback(attotime::from_hz(10000), 2, 2, 0xf3, 1, 0, 0, 0xf3); break; 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; prepare_readback(attotime::from_hz(10000), 2, 2, 0xf4, 0, 0, 0, 0xf4); break; 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); m_in_index = 0; break; 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_in_index = 0; break; 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_in_index = 0; break; 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); m_in_index = 0; m_in_count = 0; @@ -474,7 +474,7 @@ void cdislave_device::device_start() { 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); } diff --git a/src/mame/machine/zs01.c b/src/mame/machine/zs01.c index 0a9e6b8e8d4..007ad070af4 100644 --- a/src/mame/machine/zs01.c +++ b/src/mame/machine/zs01.c @@ -22,7 +22,7 @@ inline void ATTR_PRINTF(3,4) zs01_device::verboselog(int n_level, const char *s_ va_start(v, s_fmt); vsprintf(buf, s_fmt, 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]) { case 0xfd: { /* 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++) read_buffer[2+i] = ds2401->direct_read(SIZE_DATA_BUFFER-i-1); break; diff --git a/src/mame/video/beathead.c b/src/mame/video/beathead.c index 10feec0b642..50e52b2a3bb 100644 --- a/src/mame/video/beathead.c +++ b/src/mame/video/beathead.c @@ -17,11 +17,11 @@ void beathead_state::video_start() { - state_save_register_global(m_machine, m_finescroll); - state_save_register_global(m_machine, m_vram_latch_offset); - state_save_register_global(m_machine, m_hsyncram_offset); - state_save_register_global(m_machine, m_hsyncram_start); - state_save_register_global_array(m_machine, m_hsyncram); + state_save_register_global(machine(), m_finescroll); + state_save_register_global(machine(), m_vram_latch_offset); + state_save_register_global(machine(), m_hsyncram_offset); + state_save_register_global(machine(), m_hsyncram_start); + state_save_register_global_array(machine(), m_hsyncram); } diff --git a/src/mame/video/cidelsa.c b/src/mame/video/cidelsa.c index 3ea1f5c191e..419806e97e7 100644 --- a/src/mame/video/cidelsa.c +++ b/src/mame/video/cidelsa.c @@ -163,8 +163,8 @@ static CDP1869_INTERFACE( draco_vis_intf ) void cidelsa_state::video_start() { // allocate memory - m_pcbram = auto_alloc_array(m_machine, UINT8, CIDELSA_CHARRAM_SIZE); - m_charram = auto_alloc_array(m_machine, UINT8, CIDELSA_CHARRAM_SIZE); + m_pcbram = auto_alloc_array(machine(), UINT8, CIDELSA_CHARRAM_SIZE); + m_charram = auto_alloc_array(machine(), UINT8, CIDELSA_CHARRAM_SIZE); // register for state saving save_item(NAME(m_cdp1869_pcb)); diff --git a/src/mame/video/gp9001.c b/src/mame/video/gp9001.c index d7669a297a2..a9093a53ff5 100644 --- a/src/mame/video/gp9001.c +++ b/src/mame/video/gp9001.c @@ -343,12 +343,12 @@ void gp9001vdp_device::create_tilemaps(int region) void gp9001vdp_device::device_start() { - top.vram16 = auto_alloc_array_clear(m_machine, UINT16, GP9001_TOP_VRAM_SIZE/2); - fg.vram16 = auto_alloc_array_clear(m_machine, UINT16, GP9001_FG_VRAM_SIZE/2); - bg.vram16 = auto_alloc_array_clear(m_machine, UINT16, GP9001_BG_VRAM_SIZE/2); + top.vram16 = auto_alloc_array_clear(machine(), UINT16, GP9001_TOP_VRAM_SIZE/2); + fg.vram16 = auto_alloc_array_clear(machine(), UINT16, GP9001_FG_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_buffer = 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(machine(), UINT16, GP9001_SPRITERAM_SIZE/2); create_tilemaps(m_gfxregion); diff --git a/src/mame/video/liberatr.c b/src/mame/video/liberatr.c index 0128e6452d9..7a92a652ece 100644 --- a/src/mame/video/liberatr.c +++ b/src/mame/video/liberatr.c @@ -68,8 +68,8 @@ void liberatr_state::init_planet(planet &liberatr_planet, UINT8 *planet_rom) { UINT16 longitude; - const UINT8 *latitude_scale = m_machine.region("user1")->base(); - const UINT8 *longitude_scale = m_machine.region("user2")->base(); + const UINT8 *latitude_scale = machine().region("user1")->base(); + const UINT8 *longitude_scale = machine().region("user2")->base(); /* for each starting 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 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; @@ -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 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++) { @@ -212,8 +212,8 @@ void liberatr_state::init_planet(planet &liberatr_planet, UINT8 *planet_rom) void liberatr_state::video_start() { // for each planet in the planet ROMs - init_planet(m_planets[0], &m_machine.region("gfx1")->base()[0x2000]); - init_planet(m_planets[1], &m_machine.region("gfx1")->base()[0x0000]); + init_planet(m_planets[0], &machine().region("gfx1")->base()[0x2000]); + init_planet(m_planets[1], &machine().region("gfx1")->base()[0x0000]); } diff --git a/src/mame/video/n64.c b/src/mame/video/n64.c index 57fb80f8050..62de765f85a 100644 --- a/src/mame/video/n64.c +++ b/src/mame/video/n64.c @@ -412,7 +412,7 @@ void Processor::ColorCombiner1Cycle(bool 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]); @@ -428,7 +428,7 @@ void Processor::ColorCombiner2Cycle(bool 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]); @@ -939,7 +939,7 @@ void Processor::GetDitherValues(int x, int y, int* cdith, int* adith) break; case 2: *cdith = s_magic_matrix[dithindex]; - *adith = m_machine->rand() & 7; + *adith = machine().rand() & 7; break; case 3: *cdith = s_magic_matrix[dithindex]; @@ -954,26 +954,26 @@ void Processor::GetDitherValues(int x, int y, int* cdith, int* adith) break; case 6: *cdith = s_bayer_matrix[dithindex]; - *adith = m_machine->rand() & 7; + *adith = machine().rand() & 7; break; case 7: *cdith = s_bayer_matrix[dithindex]; *adith = 0; break; case 8: - *cdith = m_machine->rand() & 7; + *cdith = machine().rand() & 7; *adith = s_magic_matrix[dithindex]; break; case 9: - *cdith = m_machine->rand() & 7; + *cdith = machine().rand() & 7; *adith = (~s_magic_matrix[dithindex]) & 7; break; case 10: - *cdith = m_machine->rand() & 7; + *cdith = machine().rand() & 7; *adith = (*cdith + 17) & 7; break; case 11: - *cdith = m_machine->rand() & 7; + *cdith = machine().rand() & 7; *adith = 0; break; case 12: diff --git a/src/mame/video/n64.h b/src/mame/video/n64.h index f4c71a080cc..41efa3d69df 100644 --- a/src/mame/video/n64.h +++ b/src/mame/video/n64.h @@ -419,22 +419,21 @@ class Processor m_span_dady = da; m_span_dzdy = dz; } + + running_machine &machine() const { assert(m_machine != NULL); return *m_machine; } void InitInternalState() { - if(m_machine) - { - m_tmem = auto_alloc_array(*m_machine, UINT8, 0x1000); - memset(m_tmem, 0, 0x1000); + m_tmem = auto_alloc_array(machine(), UINT8, 0x1000); + memset(m_tmem, 0, 0x1000); - UINT8 *normpoint = m_machine->region("normpoint")->base(); - UINT8 *normslope = m_machine->region("normslope")->base(); + UINT8 *normpoint = machine().region("normpoint")->base(); + UINT8 *normslope = 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]; - } + 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]; } } diff --git a/src/mame/video/rdpblend.c b/src/mame/video/rdpblend.c index 7a48b28c813..46f73d39b79 100644 --- a/src/mame/video/rdpblend.c +++ b/src/mame/video/rdpblend.c @@ -243,7 +243,7 @@ bool Blender::AlphaCompare(UINT8 alpha) INT32 threshold; 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) { return false; diff --git a/src/mame/video/rdpblend.h b/src/mame/video/rdpblend.h index ad3dcb5bead..778ea18e68f 100644 --- a/src/mame/video/rdpblend.h +++ b/src/mame/video/rdpblend.h @@ -36,6 +36,8 @@ class Blender void SetShiftA(INT32 shift) { m_shift_a = shift; } void SetShiftB(INT32 shift) { m_shift_b = shift; } + running_machine &machine() const { assert(m_machine != NULL); return *m_machine; } + private: running_machine* m_machine; OtherModes* m_other_modes; diff --git a/src/mame/video/rdpspn16.c b/src/mame/video/rdpspn16.c index b5ab87826d6..09105a1240c 100644 --- a/src/mame/video/rdpspn16.c +++ b/src/mame/video/rdpspn16.c @@ -34,7 +34,7 @@ void Processor::RenderSpans(int start, int end, int tilenum, bool flip) for(int i = start; i <= end; i++) { - m_span[i].SetMachine(*m_machine); + m_span[i].SetMachine(machine()); switch(m_other_modes.cycle_type) { case CYCLE_TYPE_1: m_span[i].Draw1Cycle(i, tilenum, flip); break; diff --git a/src/mame/video/rdpspn16.h b/src/mame/video/rdpspn16.h index 8a3f0c7db22..051289cd481 100644 --- a/src/mame/video/rdpspn16.h +++ b/src/mame/video/rdpspn16.h @@ -42,6 +42,8 @@ class Span void DrawCopy(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: int m_lx; int m_rx; |