예제 #1
0
파일: flopdrv.cpp 프로젝트: comano/mame
bool legacy_floppy_image_device::call_load()
{
	int retVal = internal_floppy_device_load(-1, nullptr);
	if (retVal==IMAGE_INIT_PASS) {
		/* if we have one of our hacky unload procs, call it */
		if (m_load_proc)
			m_load_proc(*this);
	}

	/* push disk halfway into drive */
	m_wpt = CLEAR_LINE;
	//m_out_wpt_func(m_wpt);

	/* set timer for disk load */
	int next_wpt;

	if (!is_readonly())
		next_wpt = ASSERT_LINE;
	else
		next_wpt = CLEAR_LINE;

	machine().scheduler().timer_set(attotime::from_msec(250), timer_expired_delegate(FUNC(legacy_floppy_image_device::set_wpt),this), next_wpt);

	return retVal;
}
예제 #2
0
image_init_result legacy_floppy_image_device::internal_floppy_device_load(bool is_create, int create_format, util::option_resolution *create_args)
{
	floperr_t err;
	const struct FloppyFormat *floppy_options;
	int floppy_flags, i;

	device_image_interface *image = nullptr;
	interface(image);   /* figure out the floppy options */
	floppy_options = m_config->formats;

	if (is_create)
	{
		/* creating an image */
		assert(create_format >= 0);
		err = floppy_create((void *) image, &image_ioprocs, &floppy_options[create_format], create_args, &m_floppy);
		if (err)
			goto error;
	}
	else
	{
		/* opening an image */
		floppy_flags = !is_readonly() ? FLOPPY_FLAGS_READWRITE : FLOPPY_FLAGS_READONLY;
		err = floppy_open_choices((void *) image, &image_ioprocs, filetype(), floppy_options, floppy_flags, &m_floppy);
		if (err)
			goto error;
	}
	if (floppy_callbacks(m_floppy)->get_heads_per_disk && floppy_callbacks(m_floppy)->get_tracks_per_disk)
	{
		floppy_drive_set_geometry_absolute(floppy_get_tracks_per_disk(m_floppy),floppy_get_heads_per_disk(m_floppy));
	}
	/* disk changed */
	m_dskchg = CLEAR_LINE;

	// If we have one of our hacky load procs, call it
	if (m_load_proc)
		m_load_proc(*this, is_create);

	return image_init_result::PASS;

error:
	for (i = 0; i < ARRAY_LENGTH(errmap); i++)
	{
		if (err == errmap[i].ferr)
			seterror(errmap[i].ierr, errmap[i].message);
	}
	return image_init_result::FAIL;
}