Пример #1
0
address_map::address_map(device_t &device, address_spacenum spacenum)
	: m_spacenum(spacenum),
	  m_databits(0xff),
	  m_unmapval(0),
	  m_globalmask(0)
{
	// get our memory interface
	const device_memory_interface *memintf;
	if (!device.interface(memintf))
		throw emu_fatalerror("No memory interface defined for device '%s'\n", device.tag());

	// and then the configuration for the current address space
	const address_space_config *spaceconfig = memintf->space_config(spacenum);
	if (!device.interface(memintf))
		throw emu_fatalerror("No memory address space configuration found for device '%s', space %d\n", device.tag(), spacenum);

	// append the internal device map (first so it takes priority) */
	if (spaceconfig->m_internal_map != NULL)
		(*spaceconfig->m_internal_map)(*this, device);

	// construct the standard map */
	if (memintf->address_map(spacenum) != NULL)
		(*memintf->address_map(spacenum))(*this, *device.owner());

	// append the default device map (last so it can be overridden) */
	if (spaceconfig->m_default_map != NULL)
		(*spaceconfig->m_default_map)(*this, device);
}
Пример #2
0
address_map::address_map(device_t &device, address_spacenum spacenum)
	: m_spacenum(spacenum),
		m_databits(0xff),
		m_unmapval(0),
		m_globalmask(0)
{
	// get our memory interface
	const device_memory_interface *memintf;
	if (!device.interface(memintf))
		throw emu_fatalerror("No memory interface defined for device '%s'\n", device.tag());

	// and then the configuration for the current address space
	const address_space_config *spaceconfig = memintf->space_config(spacenum);
	if (!device.interface(memintf))
		throw emu_fatalerror("No memory address space configuration found for device '%s', space %d\n", device.tag(), spacenum);

	// construct the internal device map (first so it takes priority)
	if (spaceconfig->m_internal_map != NULL)
		(*spaceconfig->m_internal_map)(*this, device);
	if (!spaceconfig->m_internal_map_delegate.isnull())
		spaceconfig->m_internal_map_delegate(*this, device);

	// append the map provided by the owner
	if (memintf->address_map(spacenum) != NULL)
		(*memintf->address_map(spacenum))(*this, *device.owner());
	else
	{
		// if the owner didn't provide a map, use the default device map
		if (spaceconfig->m_default_map != NULL)
			(*spaceconfig->m_default_map)(*this, device);
		if (!spaceconfig->m_default_map_delegate.isnull())
			spaceconfig->m_default_map_delegate(*this, device);
	}
}
Пример #3
0
void device_slot_interface::static_option_add(device_t &device, const char *name, const device_type &devtype)
{
	device_slot_interface &intf = dynamic_cast<device_slot_interface &>(device);
	device_slot_option *option = intf.option(name);

	if (option != nullptr)
		throw emu_fatalerror("slot '%s' duplicate option '%s'\n", device.tag(), name);
	if (intf.m_options.count(name) != 0) throw tag_add_exception(name);
	intf.m_options.emplace(std::make_pair(name, std::make_unique<device_slot_option>(name, devtype)));
}
Пример #4
0
void device_slot_interface::static_option_add(device_t &device, const char *name, const device_type &devtype)
{
	device_slot_interface &intf = dynamic_cast<device_slot_interface &>(device);
	device_slot_option *option = intf.option(name);

	if (option != NULL)
		throw emu_fatalerror("slot '%s' duplicate option '%s\n", device.tag(), name);

	intf.m_options.append(name, *global_alloc(device_slot_option(name, devtype)));
}
Пример #5
0
static astring nvram_filename(device_t &device, astring &result)
{
    running_machine &machine = device.machine();
    astring name = astring(device.tag()).replacechr(':','_');
    if (rom_system_bios(machine) == 0 || rom_default_bios(machine) == rom_system_bios(machine)) {
        result.printf("%s\\%s",machine.basename(),name.cstr());
    } else {
        result.printf("%s_%d\\%s",machine.basename(),rom_system_bios(machine) - 1,name.cstr());
    }
    return result;
}
Пример #6
0
inline void map_handler_data::set_tag(const device_t &device, const char *tag)
{
	if (strcmp(tag, DEVICE_SELF) == 0)
		m_tag = device.tag();
	else if (strcmp(tag, DEVICE_SELF_OWNER) == 0)
	{
		assert(device.owner() != NULL);
		m_tag = device.owner()->tag();
	}
	else
		m_tag = device.subtag(m_derived_tag, tag);
}
Пример #7
0
void info_xml_creator::output_chips(device_t &device, const char *root_tag)
{
	// iterate over executable devices
	execute_interface_iterator execiter(device);
	for (device_execute_interface *exec = execiter.first(); exec != NULL; exec = execiter.next())
	{
		if (strcmp(exec->device().tag(), device.tag()))
		{
			astring newtag(exec->device().tag()), oldtag(":");
			newtag.substr(newtag.find(oldtag.cat(root_tag)) + oldtag.len());

			fprintf(m_output, "\t\t<chip");
			fprintf(m_output, " type=\"cpu\"");
			fprintf(m_output, " tag=\"%s\"", xml_normalize_string(newtag));
			fprintf(m_output, " name=\"%s\"", xml_normalize_string(exec->device().name()));
			fprintf(m_output, " clock=\"%d\"", exec->device().clock());
			fprintf(m_output, "/>\n");
		}
	}

	// iterate over sound devices
	sound_interface_iterator sounditer(device);
	for (device_sound_interface *sound = sounditer.first(); sound != NULL; sound = sounditer.next())
	{
		if (strcmp(sound->device().tag(), device.tag()))
		{
			astring newtag(sound->device().tag()), oldtag(":");
			newtag.substr(newtag.find(oldtag.cat(root_tag)) + oldtag.len());

			fprintf(m_output, "\t\t<chip");
			fprintf(m_output, " type=\"audio\"");
			fprintf(m_output, " tag=\"%s\"", xml_normalize_string(newtag));
			fprintf(m_output, " name=\"%s\"", xml_normalize_string(sound->device().name()));
			if (sound->device().clock() != 0)
				fprintf(m_output, " clock=\"%d\"", sound->device().clock());
			fprintf(m_output, "/>\n");
		}
	}
}
Пример #8
0
void info_xml_creator::output_images(device_t &device, const char *root_tag)
{
	image_interface_iterator iter(device);
	for (const device_image_interface *imagedev = iter.first(); imagedev != NULL; imagedev = iter.next())
	{
		if (strcmp(imagedev->device().tag(), device.tag()))
		{
			astring newtag(imagedev->device().tag()), oldtag(":");
			newtag.substr(newtag.find(oldtag.cat(root_tag)) + oldtag.len());

			// print m_output device type
			fprintf(m_output, "\t\t<device type=\"%s\"", xml_normalize_string(imagedev->image_type_name()));

			// does this device have a tag?
			if (imagedev->device().tag())
				fprintf(m_output, " tag=\"%s\"", xml_normalize_string(newtag));

			// is this device mandatory?
			if (imagedev->must_be_loaded())
				fprintf(m_output, " mandatory=\"1\"");

			if (imagedev->image_interface() && imagedev->image_interface()[0])
				fprintf(m_output, " interface=\"%s\"", xml_normalize_string(imagedev->image_interface()));

			// close the XML tag
			fprintf(m_output, ">\n");

			const char *name = imagedev->instance_name();
			const char *shortname = imagedev->brief_instance_name();

			fprintf(m_output, "\t\t\t<instance");
			fprintf(m_output, " name=\"%s\"", xml_normalize_string(name));
			fprintf(m_output, " briefname=\"%s\"", xml_normalize_string(shortname));
			fprintf(m_output, "/>\n");

			astring extensions(imagedev->file_extensions());

			char *ext = strtok((char *)extensions.cstr(), ",");
			while (ext != NULL)
			{
				fprintf(m_output, "\t\t\t<extension");
				fprintf(m_output, " name=\"%s\"", xml_normalize_string(ext));
				fprintf(m_output, "/>\n");
				ext = strtok(NULL, ",");
			}

			fprintf(m_output, "\t\t</device>\n");
		}
	}
}
Пример #9
0
void rom_load_manager::determine_bios_rom(device_t &device, const char *specbios)
{
	const char *defaultname = nullptr;
	const rom_entry *rom;
	int default_no = 1;
	int bios_count = 0;

	device.set_system_bios(0);

	/* first determine the default BIOS name */
	for (rom = device.rom_region(); !ROMENTRY_ISEND(rom); rom++)
		if (ROMENTRY_ISDEFAULT_BIOS(rom))
			defaultname = ROM_GETNAME(rom);

	/* look for a BIOS with a matching name */
	for (rom = device.rom_region(); !ROMENTRY_ISEND(rom); rom++)
		if (ROMENTRY_ISSYSTEM_BIOS(rom))
		{
			const char *biosname = ROM_GETNAME(rom);
			int bios_flags = ROM_GETBIOSFLAGS(rom);
			char bios_number[20];

			/* Allow '-bios n' to still be used */
			sprintf(bios_number, "%d", bios_flags - 1);
			if (core_stricmp(bios_number, specbios) == 0 || core_stricmp(biosname, specbios) == 0)
				device.set_system_bios(bios_flags);
			if (defaultname != nullptr && core_stricmp(biosname, defaultname) == 0)
				default_no = bios_flags;
			bios_count++;
		}

	/* if none found, use the default */
	if (device.system_bios() == 0 && bios_count > 0)
	{
		/* if we got neither an empty string nor 'default' then warn the user */
		if (specbios[0] != 0 && strcmp(specbios, "default") != 0)
		{
			m_errorstring.append(string_format("%s: invalid bios, reverting to default\n", specbios));
			m_warnings++;
		}

		/* set to default */
		device.set_system_bios(default_no);
	}
	device.set_default_bios(default_no);
	LOG(("For \"%s\" using System BIOS: %d\n", device.tag(), device.system_bios()));
}
Пример #10
0
void info_xml_creator::output_slots(device_t &device, const char *root_tag)
{
	slot_interface_iterator iter(device);
	for (const device_slot_interface *slot = iter.first(); slot != NULL; slot = iter.next())
	{
		if (slot->fixed()) continue;    // or shall we list these as non-configurable?

		if (strcmp(slot->device().tag(), device.tag()))
		{
			std::string newtag(slot->device().tag()), oldtag(":");
			newtag = newtag.substr(newtag.find(oldtag.append(root_tag)) + oldtag.length());

			// print m_output device type
			fprintf(m_output, "\t\t<slot name=\"%s\">\n", xml_normalize_string(newtag.c_str()));

			/*
			 if (slot->slot_interface()[0])
			 fprintf(m_output, " interface=\"%s\"", xml_normalize_string(slot->slot_interface()));
			 */

			for (const device_slot_option *option = slot->first_option(); option != NULL; option = option->next())
			{
				if (option->selectable())
				{
					device_t *dev = const_cast<machine_config &>(m_drivlist.config()).device_add(&m_drivlist.config().root_device(), "dummy", option->devtype(), 0);
					if (!dev->configured())
						dev->config_complete();

					fprintf(m_output, "\t\t\t<slotoption");
					fprintf(m_output, " name=\"%s\"", xml_normalize_string(option->name()));
					fprintf(m_output, " devname=\"%s\"", xml_normalize_string(dev->shortname()));
					if (slot->default_option())
					{
						if (strcmp(slot->default_option(),option->name())==0)
							fprintf(m_output, " default=\"yes\"");
					}
					fprintf(m_output, "/>\n");
					const_cast<machine_config &>(m_drivlist.config()).device_remove(&m_drivlist.config().root_device(), "dummy");
				}
			}

			fprintf(m_output, "\t\t</slot>\n");
		}
	}
}
Пример #11
0
void machine_config::remove_references(device_t &device)
{
	// remove default layouts for subdevices
	char const *const tag(device.tag());
	std::size_t const taglen(std::strlen(tag));
	default_layout_map::iterator it(m_default_layouts.lower_bound(tag));
	while ((m_default_layouts.end() != it) && !std::strncmp(tag, it->first, taglen))
	{
		if (!it->first[taglen] || (':' == it->first[taglen]))
			it = m_default_layouts.erase(it);
		else
			++it;
	}

	// iterate over all devices and remove any references
	for (device_t &scan : device_iterator(root_device()))
		scan.subdevices().m_tagmap.clear();
}
Пример #12
0
void consolewin_info::set_cpu(device_t &device)
{
	// first set all the views to the new cpu number
	m_views[0]->set_source_for_device(device);
	m_views[1]->set_source_for_device(device);

	// then update the caption
	char curtitle[256];
	astring title;

	title.printf("Debug: %s - %s '%s'", device.machine().system().name, device.name(), device.tag());
	win_get_window_text_utf8(window(), curtitle, ARRAY_LENGTH(curtitle));
	if (title.cmp(curtitle) != 0)
		win_set_window_text_utf8(window(), title.c_str());

	// and recompute the children
	recompute_children();
}
Пример #13
0
void info_xml_creator::output_slots(device_t &device, const char *root_tag)
{
	slot_interface_iterator iter(device);
	for (const device_slot_interface *slot = iter.first(); slot != NULL; slot = iter.next())
	{
		if (slot->fixed()) continue;    // or shall we list these as non-configurable?

		if (strcmp(slot->device().tag(), device.tag()))
		{
			astring newtag(slot->device().tag()), oldtag(":");
			newtag.substr(newtag.find(oldtag.cat(root_tag)) + oldtag.len());

			// print m_output device type
			fprintf(m_output, "\t\t<slot name=\"%s\">\n", xml_normalize_string(newtag));

			/*
			 if (slot->slot_interface()[0])
			 fprintf(m_output, " interface=\"%s\"", xml_normalize_string(slot->slot_interface()));
			 */

			const slot_interface* intf = slot->get_slot_interfaces();
			for (int i = 0; intf && intf[i].name != NULL && !intf[i].internal; i++)
			{
				device_t *dev = const_cast<machine_config &>(m_drivlist.config()).device_add(&m_drivlist.config().root_device(), "dummy", intf[i].devtype, 0);
				if (!dev->configured())
					dev->config_complete();

				fprintf(m_output, "\t\t\t<slotoption");
				fprintf(m_output, " name=\"%s\"", xml_normalize_string(intf[i].name));
				fprintf(m_output, " devname=\"%s\"", xml_normalize_string(dev->shortname()));
				if (slot->get_default_card())
				{
					if (strcmp(slot->get_default_card(),intf[i].name)==0)
						fprintf(m_output, " default=\"yes\"");
				}
				fprintf(m_output, "/>\n");
				const_cast<machine_config &>(m_drivlist.config()).device_remove(&m_drivlist.config().root_device(), "dummy");
			}

			fprintf(m_output, "\t\t</slot>\n");
		}
	}
}
Пример #14
0
void device_memory_interface::static_set_addrmap(device_t &device, address_spacenum spacenum, address_map_constructor map)
{
	device_memory_interface *memory;
	if (!device.interface(memory))
		throw emu_fatalerror("MCFG_DEVICE_ADDRESS_MAP called on device '%s' with no memory interface", device.tag());
	if (spacenum >= ARRAY_LENGTH(memory->m_address_map))
		throw emu_fatalerror("MCFG_DEVICE_ADDRESS_MAP called on device '%s' with out-of-range space number %d", device.tag(), spacenum);
	memory->m_address_map[spacenum] = map;
}
Пример #15
0
void device_slot_interface::static_set_slot_info(device_t &device, const slot_interface *slots_info, const char *default_card,const input_device_default *default_input, const void *default_config, UINT32 default_clock, bool fixed)
{
	device_slot_interface *slot;
	if (!device.interface(slot))
		throw emu_fatalerror("set_default_slot_card called on device '%s' with no slot interface", device.tag());

	slot->m_slot_interfaces = slots_info;
	slot->m_default_card = default_card;
	slot->m_input_defaults = default_input;
	slot->m_default_config = default_config;
	slot->m_default_clock = default_clock;
	slot->m_fixed = fixed;
}
Пример #16
0
void address_map::map_validity_check(validity_checker &valid, const device_t &device, address_spacenum spacenum) const
{
	// it's safe to assume here that the device has a memory interface and a config for this space
	const address_space_config &spaceconfig = *device.memory().space_config(spacenum);
	int datawidth = spaceconfig.m_databus_width;
	int alignunit = datawidth / 8;

	bool detected_overlap = DETECT_OVERLAPPING_MEMORY ? false : true;

	// if this is an empty map, just ignore it
	if (m_entrylist.first() == nullptr)
		return;

	// validate the global map parameters
	if (m_spacenum != spacenum)
		osd_printf_error("Space %d has address space %d handlers!\n", spacenum, m_spacenum);
	if (m_databits != datawidth)
		osd_printf_error("Wrong memory handlers provided for %s space! (width = %d, memory = %08x)\n", spaceconfig.m_name, datawidth, m_databits);

	// loop over entries and look for errors
	for (address_map_entry &entry : m_entrylist)
	{
		UINT32 bytestart = spaceconfig.addr2byte(entry.m_addrstart);
		UINT32 byteend = spaceconfig.addr2byte_end(entry.m_addrend);

		// look for overlapping entries
		if (!detected_overlap)
		{
			for (address_map_entry &scan : m_entrylist)
			{
				if (&scan == &entry)
					break;
				if (entry.m_addrstart <= scan.m_addrend && entry.m_addrend >= scan.m_addrstart &&
					((entry.m_read.m_type != AMH_NONE && scan.m_read.m_type != AMH_NONE) ||
						(entry.m_write.m_type != AMH_NONE && scan.m_write.m_type != AMH_NONE)))
				{
					osd_printf_warning("%s space has overlapping memory (%X-%X,%d,%d) vs (%X-%X,%d,%d)\n", spaceconfig.m_name, entry.m_addrstart, entry.m_addrend, entry.m_read.m_type, entry.m_write.m_type, scan.m_addrstart, scan.m_addrend, scan.m_read.m_type, scan.m_write.m_type);
					detected_overlap = true;
					break;
				}
			}
		}

		// look for inverted start/end pairs
		if (byteend < bytestart)
			osd_printf_error("Wrong %s memory read handler start = %08x > end = %08x\n", spaceconfig.m_name, entry.m_addrstart, entry.m_addrend);

		// look for misaligned entries
		if ((bytestart & (alignunit - 1)) != 0 || (byteend & (alignunit - 1)) != (alignunit - 1))
			osd_printf_error("Wrong %s memory read handler start = %08x, end = %08x ALIGN = %d\n", spaceconfig.m_name, entry.m_addrstart, entry.m_addrend, alignunit);

		// if this is a program space, auto-assign implicit ROM entries
		if (entry.m_read.m_type == AMH_ROM && entry.m_region == nullptr)
		{
			entry.m_region = device.tag();
			entry.m_rgnoffs = entry.m_addrstart;
		}

		// if this entry references a memory region, validate it
		if (entry.m_region != nullptr && entry.m_share == nullptr)
		{
			// make sure we can resolve the full path to the region
			bool found = false;
			std::string entry_region = entry.m_devbase.subtag(entry.m_region);

			// look for the region
			for (device_t &dev : device_iterator(device.mconfig().root_device()))
				for (const rom_entry *romp = rom_first_region(dev); romp != nullptr && !found; romp = rom_next_region(romp))
				{
					if (rom_region_name(dev, romp) == entry_region)
					{
						// verify the address range is within the region's bounds
						offs_t length = ROMREGION_GETLENGTH(romp);
						if (entry.m_rgnoffs + (byteend - bytestart + 1) > length)
							osd_printf_error("%s space memory map entry %X-%X extends beyond region '%s' size (%X)\n", spaceconfig.m_name, entry.m_addrstart, entry.m_addrend, entry.m_region, length);
						found = true;
					}
				}

			// error if not found
			if (!found)
				osd_printf_error("%s space memory map entry %X-%X references non-existant region '%s'\n", spaceconfig.m_name, entry.m_addrstart, entry.m_addrend, entry.m_region);
		}

		// make sure all devices exist
		if (entry.m_read.m_type == AMH_DEVICE_DELEGATE)
		{
			// extract the device tag from the proto-delegate
			const char *devtag = nullptr;
			switch (entry.m_read.m_bits)
			{
				case 8: devtag = entry.m_rproto8.device_name(); break;
				case 16: devtag = entry.m_rproto16.device_name(); break;
				case 32: devtag = entry.m_rproto32.device_name(); break;
				case 64: devtag = entry.m_rproto64.device_name(); break;
			}
			if (entry.m_devbase.subdevice(devtag) == nullptr)
				osd_printf_error("%s space memory map entry reads from nonexistent device '%s'\n", spaceconfig.m_name,
					devtag != nullptr ? devtag : "<unspecified>");
		}
		if (entry.m_write.m_type == AMH_DEVICE_DELEGATE)
		{
			// extract the device tag from the proto-delegate
			const char *devtag = nullptr;
			switch (entry.m_write.m_bits)
			{
				case 8: devtag = entry.m_wproto8.device_name(); break;
				case 16: devtag = entry.m_wproto16.device_name(); break;
				case 32: devtag = entry.m_wproto32.device_name(); break;
				case 64: devtag = entry.m_wproto64.device_name(); break;
			}
			if (entry.m_devbase.subdevice(devtag) == nullptr)
				osd_printf_error("%s space memory map entry writes to nonexistent device '%s'\n", spaceconfig.m_name,
					devtag != nullptr ? devtag : "<unspecified>");
		}
		if (entry.m_setoffsethd.m_type == AMH_DEVICE_DELEGATE)
		{
			// extract the device tag from the proto-delegate
			const char *devtag = entry.m_soproto.device_name();
			if (entry.m_devbase.subdevice(devtag) == nullptr)
				osd_printf_error("%s space memory map entry references nonexistent device '%s'\n", spaceconfig.m_name,
					devtag != nullptr ? devtag : "<unspecified>");
		}

		// make sure ports exist
//      if ((entry.m_read.m_type == AMH_PORT && entry.m_read.m_tag != nullptr && portlist.find(entry.m_read.m_tag) == nullptr) ||
//          (entry.m_write.m_type == AMH_PORT && entry.m_write.m_tag != nullptr && portlist.find(entry.m_write.m_tag) == nullptr))
//          osd_printf_error("%s space memory map entry references nonexistent port tag '%s'\n", spaceconfig.m_name, entry.m_read.m_tag);

		// validate bank and share tags
		if (entry.m_read.m_type == AMH_BANK)
			valid.validate_tag(entry.m_read.m_tag);
		if (entry.m_write.m_type == AMH_BANK)
			valid.validate_tag(entry.m_write.m_tag);
		if (entry.m_share != nullptr)
			valid.validate_tag(entry.m_share);
	}
}
Пример #17
0
void device_execute_interface::static_set_irq_acknowledge_callback(device_t &device, device_irq_acknowledge_delegate callback)
{
	device_execute_interface *exec;
	if (!device.interface(exec))
		throw emu_fatalerror("MCFG_DEVICE_IRQ_ACKNOWLEDGE called on device '%s' with no execute interface", device.tag());
	exec->m_driver_irq = callback;
}
Пример #18
0
void device_sound_interface::static_add_route(device_t &device, UINT32 output, const char *target, double gain, UINT32 input)
{
	// find our sound interface
	device_sound_interface *sound;
	if (!device.dev_interface(sound))
		throw emu_fatalerror("MCFG_SOUND_ROUTE called on device '%s' with no sound interface", device.tag());

	// append a new route to the list
	astring devtag;
	device.siblingtag(devtag, target);
	sound->m_route_list.append(*global_alloc(sound_route(output, input, gain, core_strdup(devtag.cstr()))));
}
Пример #19
0
void device_gfx_interface::static_set_palette(device_t &device, const char *tag)
{
	device_gfx_interface *gfx;
	if (!device.interface(gfx))
		throw emu_fatalerror("MCFG_GFX_PALETTE called on device '%s' with no gfx interface\n", device.tag());

	gfx->m_palette_tag = tag;
	gfx->m_palette_is_sibling = true;
}
Пример #20
0
void device_gfx_interface::static_set_info(device_t &device, const gfx_decode_entry *gfxinfo)
{
	device_gfx_interface *gfx;
	if (!device.interface(gfx))
		throw emu_fatalerror("MCFG_GFX_INFO called on device '%s' with no gfx interface\n", device.tag());

	gfx->m_gfxdecodeinfo = gfxinfo;
}
Пример #21
0
//-------------------------------------------------
//  static_set_daisy_config - configuration helper
//  to set up the daisy chain
//-------------------------------------------------
void z80_daisy_chain_interface::static_set_daisy_config(device_t &device, const z80_daisy_config *config)
{
	z80_daisy_chain_interface *daisyintf;
	if (!device.interface(daisyintf))
		throw emu_fatalerror("MCFG_Z80_DAISY_CHAIN called on device '%s' with no daisy chain interface", device.tag());
	daisyintf->m_daisy_config = config;
}
Пример #22
0
void device_slot_interface::static_set_slot_info(device_t &device, const slot_interface *slots_info, const char *default_card, bool fixed)
{
	device_slot_interface *slot;
	if (!device.interface(slot))
		throw emu_fatalerror("set_default_slot_card called on device '%s' with no slot interface", device.tag());

	slot->m_slot_interfaces = slots_info;
	slot->m_default_card = default_card;
	slot->m_fixed = fixed;
}
Пример #23
0
void device_execute_interface::static_set_vblank_int(device_t &device, device_interrupt_delegate function, const char *tag, int rate)
{
	device_execute_interface *exec;
	if (!device.interface(exec))
		throw emu_fatalerror("MCFG_DEVICE_VBLANK_INT called on device '%s' with no execute interface", device.tag());
	exec->m_vblank_interrupt = function;
	exec->m_vblank_interrupt_screen = tag;
}
Пример #24
0
void info_xml_creator::output_display(device_t &device, const char *root_tag)
{
	// iterate over screens
	screen_device_iterator iter(device);
	for (const screen_device *screendev = iter.first(); screendev != NULL; screendev = iter.next())
	{
		if (strcmp(screendev->tag(), device.tag()))
		{
			astring newtag(screendev->tag()), oldtag(":");
			newtag.substr(newtag.find(oldtag.cat(root_tag)) + oldtag.len());

			fprintf(m_output, "\t\t<display");
			fprintf(m_output, " tag=\"%s\"", xml_normalize_string(newtag));

			switch (screendev->screen_type())
			{
				case SCREEN_TYPE_RASTER:    fprintf(m_output, " type=\"raster\"");  break;
				case SCREEN_TYPE_VECTOR:    fprintf(m_output, " type=\"vector\"");  break;
				case SCREEN_TYPE_LCD:       fprintf(m_output, " type=\"lcd\"");     break;
				default:                    fprintf(m_output, " type=\"unknown\""); break;
			}

			// output the orientation as a string
			switch (m_drivlist.driver().flags & ORIENTATION_MASK)
			{
				case ORIENTATION_FLIP_X:
					fprintf(m_output, " rotate=\"0\" flipx=\"yes\"");
					break;
				case ORIENTATION_FLIP_Y:
					fprintf(m_output, " rotate=\"180\" flipx=\"yes\"");
					break;
				case ORIENTATION_FLIP_X|ORIENTATION_FLIP_Y:
					fprintf(m_output, " rotate=\"180\"");
					break;
				case ORIENTATION_SWAP_XY:
					fprintf(m_output, " rotate=\"90\" flipx=\"yes\"");
					break;
				case ORIENTATION_SWAP_XY|ORIENTATION_FLIP_X:
					fprintf(m_output, " rotate=\"90\"");
					break;
				case ORIENTATION_SWAP_XY|ORIENTATION_FLIP_Y:
					fprintf(m_output, " rotate=\"270\"");
					break;
				case ORIENTATION_SWAP_XY|ORIENTATION_FLIP_X|ORIENTATION_FLIP_Y:
					fprintf(m_output, " rotate=\"270\" flipx=\"yes\"");
					break;
				default:
					fprintf(m_output, " rotate=\"0\"");
					break;
			}

			// output width and height only for games that are not vector
			if (screendev->screen_type() != SCREEN_TYPE_VECTOR)
			{
				const rectangle &visarea = screendev->visible_area();
				fprintf(m_output, " width=\"%d\"", visarea.width());
				fprintf(m_output, " height=\"%d\"", visarea.height());
			}

			// output refresh rate
			fprintf(m_output, " refresh=\"%f\"", ATTOSECONDS_TO_HZ(screendev->refresh_attoseconds()));

			// output raw video parameters only for games that are not vector
			// and had raw parameters specified
			if (screendev->screen_type() != SCREEN_TYPE_VECTOR && !screendev->oldstyle_vblank_supplied())
			{
				int pixclock = screendev->width() * screendev->height() * ATTOSECONDS_TO_HZ(screendev->refresh_attoseconds());

				fprintf(m_output, " pixclock=\"%d\"", pixclock);
				fprintf(m_output, " htotal=\"%d\"", screendev->width());
				fprintf(m_output, " hbend=\"%d\"", screendev->visible_area().min_x);
				fprintf(m_output, " hbstart=\"%d\"", screendev->visible_area().max_x+1);
				fprintf(m_output, " vtotal=\"%d\"", screendev->height());
				fprintf(m_output, " vbend=\"%d\"", screendev->visible_area().min_y);
				fprintf(m_output, " vbstart=\"%d\"", screendev->visible_area().max_y+1);
			}
			fprintf(m_output, " />\n");
		}
	}
}
Пример #25
0
void device_execute_interface::static_set_periodic_int(device_t &device, device_interrupt_delegate function, const attotime &rate)
{
	device_execute_interface *exec;
	if (!device.interface(exec))
		throw emu_fatalerror("MCFG_DEVICE_PERIODIC_INT called on device '%s' with no execute interface", device.tag());
	exec->m_timed_interrupt = function;
	exec->m_timed_interrupt_period = rate;
}
Пример #26
0
void consolewin_info::set_cpu(device_t &device)
{
	// first set all the views to the new cpu number
	m_views[0]->set_source_for_device(device);
	m_views[1]->set_source_for_device(device);

	// then update the caption
	std::string title = string_format("Debug: %s - %s '%s'", device.machine().system().name, device.name(), device.tag());
	std::string curtitle = win_get_window_text_utf8(window());
	if (title != curtitle)
		win_set_window_text_utf8(window(), title.c_str());

	// and recompute the children
	recompute_children();
}
Пример #27
0
void device_execute_interface::static_set_disable(device_t &device)
{
	device_execute_interface *exec;
	if (!device.interface(exec))
		throw emu_fatalerror("MCFG_DEVICE_DISABLE called on device '%s' with no execute interface", device.tag());
	exec->m_disabled = true;
}
Пример #28
0
void device_disasm_interface::static_set_dasm_override(device_t &device, dasm_override_delegate dasm_override)
{
    device_disasm_interface *dasm;
    if (!device.interface(dasm))
        throw emu_fatalerror("MCFG_DEVICE_DISASSEMBLE_OVERRIDE called on device '%s' with no disasm interface", device.tag());
    dasm->m_dasm_override = dasm_override;
}
Пример #29
0
void device_video_interface::static_set_screen(device_t &device, const char *tag)
{
	// find our video interface
	device_video_interface *video;
	if (!device.interface(video))
		throw emu_fatalerror("MCFG_VIDEO_SET_SCREEN called on device '%s' with no video interface", device.tag());
	video->m_screen_tag = tag;
}
Пример #30
0
void device_sound_interface::static_reset_routes(device_t &device)
{
	// find our sound interface
	device_sound_interface *sound;
	if (!device.dev_interface(sound))
		throw emu_fatalerror("MCFG_SOUND_ROUTES_RESET called on device '%s' with no sound interface", device.tag());

	// reset the routine list
	sound->m_route_list.reset();
}