예제 #1
0
bool flex_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
{
	int spt = info.last_sec;
	int bps = 256;
	int cell_count = (form_factor == floppy_image::FF_525) ? 50000 : 100000;
	int offset = 0;
	int head_num = 1;
	int total_tracks = info.last_trk+1;
	bool double_sided = false;

	if(total_tracks == 40 && spt == 36)
		double_sided = true;
	if(total_tracks == 77 && spt == 30)
		double_sided = true;
	if(total_tracks == 80 && spt == 40)  // 800kB
		double_sided = true;
	if(total_tracks == 80 && spt == 72)  // 1.44MB
		double_sided = true;
	if(spt >= 20)
		double_sided = true;

	if(double_sided)
	{
		spt = spt / 2;
		head_num = 2;
	}

	for(int track=0; track < total_tracks; track++)
		for(int head=0;head < head_num;head++)
		{
			desc_pc_sector sects[80];
			UINT8 sect_data[20000];
			int sdatapos = 0;
			for(int i=0; i<spt; i++)
			{
				sects[i].track       = track;
				sects[i].head        = head;  // no side select?
				if(head == 0)
					sects[i].sector      = i+1;
				else
					sects[i].sector      = i+1+spt;
				sects[i].actual_size = bps;
				sects[i].size        = 1;
				sects[i].deleted     = false;
				sects[i].bad_crc     = false;
				sects[i].data        = &sect_data[sdatapos];
				io_generic_read(io, sects[i].data, offset, bps);
				offset += bps;
				sdatapos += bps;
			}
			// gap sizes unverified
			if(total_tracks == 35 && spt == 18 && (track >= 1 && track <= 2))  // handle Gimix Flex 3.6 disk image, which the boot sector loads tracks 1 and 2 as MFM
				build_wd_track_mfm(track, head, image, cell_count*2, spt, sects, 50, 32, 22);
			else
				build_wd_track_fm(track, head, image, cell_count, spt, sects, 24, 16, 11);
		}
	return true;
}
예제 #2
0
파일: fsd_dsk.cpp 프로젝트: Fulg/mame
bool fsd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
{
	UINT64 size = io_generic_size(io);
	dynamic_buffer img(size);
	io_generic_read(io, &img[0], 0, size);

	UINT64 pos;
	std::string title;
	for(pos=8; pos < size && img[pos] != '\0'; pos++)
		title += char(img[pos]);
	pos++;

	if(pos >= size)
		return false;

	//popmessage("Loading image of '%s'\n", title);

	desc_pc_sector sects[256];
	UINT8 total_tracks = img[pos++];
	UINT8 tnum, hnum, snum, ssize, error;

	hnum = 0;
	LOG_FORMATS("%02d Tracks\n", total_tracks+1);
	LOG_FORMATS("Tr.#  No.S  Sec.# Tr.ID Head# SecID IDsiz REsiz Error\n");
	for(int curr_track=0; curr_track <= total_tracks; curr_track++)
	{
		UINT8 track = img[pos++];
		UINT8 spt = img[pos++];
		LOG_FORMATS("%02X    %02X\n", track, spt);
		if (spt > 0) // formatted
		{
			UINT8 readable = img[pos++];
			for (int i = 0; i < spt; i++)
			{
				tnum = img[pos++];  // logical track
				hnum = img[pos++];  // head number
				snum = img[pos++];  // logical sector
				ssize = img[pos++]; // reported size
				sects[i].track = tnum;
				sects[i].head = hnum;
				sects[i].sector = snum;
				sects[i].size = ssize;
				if (readable == 0xff)
				{
					sects[i].actual_size = 1 << (img[pos++] + 7);
					error = img[pos++];
					sects[i].deleted = (error & 0x20) == 0x20;
					sects[i].bad_crc = (error & 0x0e) == 0x0e;
					sects[i].data = &img[pos];
					pos += sects[i].actual_size;
					LOG_FORMATS("Read        %02X    %02X    %02X    %02X    %02X    %02X   %02X\n", i, sects[i].track, sects[i].head, sects[i].sector, sects[i].size, sects[i].actual_size, error);
				}
				else
				{
					LOG_FORMATS("Unreadable sector on track %02d sector %02X head %02d", track, i, hnum);
					sects[i].actual_size = 0;
					sects[i].deleted = false;
					sects[i].bad_crc = false;
					sects[i].data = nullptr;
					LOG_FORMATS("Unread      %02X    %02X    %02X    %02X    %02X    %02X   %02X\n", i, sects[i].track, sects[i].head, sects[i].sector, sects[i].size, sects[i].actual_size, 0);
				}
			}
		}
		else // unformatted
		{
			sects[0].track = curr_track;
			sects[0].head = hnum;
			sects[0].sector = 0;
			sects[0].size = 0;
			LOG_FORMATS("Unform      %02X    %02X    %02X    %02X    %02X    %02X   %02X\n", 0, sects[0].track, sects[0].head, sects[0].sector, sects[0].size, sects[0].actual_size, 0);
		}
		build_wd_track_fm(curr_track, hnum, image, 50000, spt, sects, 10, 40, 10);
	}
	return true;
}
예제 #3
0
파일: poly_dsk.cpp 프로젝트: MASHinfo/mame
bool poly_cpm_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
	int total_tracks, spt, bps, head_num;

	uint64_t size = io_generic_size(io);

	switch (size)
	{
	case 622592:
		// CP/M 3" disk DSSD
		total_tracks = 76;
		spt = 8;
		bps = 512;
		head_num = 2;
		break;
	case 256256:
		// CP/M 8" disk SDSD
		total_tracks = 77;
		spt = 26;
		bps = 128;
		head_num = 1;
		break;
	default:
		// CP/M 8" disk DSSD
		total_tracks = 77;
		spt = 8;
		bps = 512;
		head_num = 2;
		break;
	}

	int cell_count = (form_factor == floppy_image::FF_525) ? 50000 : 100000;
	int offset = 0;

	for (int track = 0; track < total_tracks; track++)
		for (int head = 0; head < head_num; head++)
		{
			desc_pc_sector sects[80];
			uint8_t sect_data[20000];
			int sdatapos = 0;
			for (int i = 0; i<spt; i++)
			{
				sects[i].track = track;
				sects[i].head = head;
				if (head == 0)
					sects[i].sector = i + 1;
				else
					sects[i].sector = i + 1 + spt;
				sects[i].actual_size = bps;
				sects[i].size = bps >> 8;
				sects[i].deleted = false;
				sects[i].bad_crc = false;
				sects[i].data = &sect_data[sdatapos];
				io_generic_read(io, sects[i].data, offset, bps);
				offset += bps;
				sdatapos += bps;
			}
			// gap sizes unverified
			build_wd_track_fm(track, head, image, cell_count, spt, sects, 24, 16, 11);
		}
	return true;
}