summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/formats
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2014-12-31 07:53:27 +0100
committer Miodrag Milanovic <mmicko@gmail.com>2014-12-31 07:53:27 +0100
commite6f78d5ed281850d9e8b391c049b8bf696e140bf (patch)
treec76def6dc672e2b56d3a9b3fb61fec02f0b21f8c /src/lib/formats
parentbfd87ef73a6850f475e2020c2c2935993f932c56 (diff)
Cleanups and version bumpmame0157
Diffstat (limited to 'src/lib/formats')
-rw-r--r--src/lib/formats/dcp_dsk.c56
-rw-r--r--src/lib/formats/dip_dsk.c20
-rw-r--r--src/lib/formats/fdd_dsk.c38
-rw-r--r--src/lib/formats/nfd_dsk.c54
-rw-r--r--src/lib/formats/victor9k_dsk.c76
5 files changed, 122 insertions, 122 deletions
diff --git a/src/lib/formats/dcp_dsk.c b/src/lib/formats/dcp_dsk.c
index 7d0c854f5ed..bdcc2966036 100644
--- a/src/lib/formats/dcp_dsk.c
+++ b/src/lib/formats/dcp_dsk.c
@@ -7,17 +7,17 @@
PC98 DCP & DCU disk images
0xA2 header, followed by track data
- header[0] - disk format
+ header[0] - disk format
header[1-0xA1] - track map (1=track used, 0=track unused/unformatted)
- header[0xA2] - all tracks used?
+ header[0xA2] - all tracks used?
(there seems to be a diff in its usage between DCP and DCU)
- TODO:
+ TODO:
- add support for track map. images available for tests were all
of type 0x01, with all 154 tracks present. combined with pete_j
reporting some images have faulty track map, we need some more
test cases to properly handle these disks!
-
+
*********************************************************************/
#include "emu.h"
@@ -52,7 +52,7 @@ int dcp_format::identify(io_generic *io, UINT32 form_factor)
io_generic_read(io, h, 0, 0xa2);
// First byte is the disk format (see below in load() for details)
- switch (h[0])
+ switch (h[0])
{
case 0x01:
default:
@@ -99,7 +99,7 @@ int dcp_format::identify(io_generic *io, UINT32 form_factor)
if (h[i])
count_tracks++;
- // in theory track map should be enough (former check), but some images have it wrong!
+ // in theory track map should be enough (former check), but some images have it wrong!
// hence, if this check fails, we also allow for images with all tracks and wrong track map
if (size - 0xa2 == (heads * count_tracks * spt * bps) || size - 0xa2 == (heads * tracks * spt * bps))
return 100;
@@ -107,7 +107,7 @@ int dcp_format::identify(io_generic *io, UINT32 form_factor)
// for disk type 0x11 the head 0 track 0 has 26 sectors of half width, so we need to compensate calculation
if (is_hdb && (size - 0xa2 + (0x80 * 26) == (heads * count_tracks * spt * bps) || size - 0xa2 + (0x80 * 26) == (heads * tracks * spt * bps)))
return 100;
-
+
return 0;
}
@@ -116,11 +116,11 @@ bool dcp_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
UINT8 h[0xa2];
int heads, tracks, spt, bps;
bool is_hdb = false;
-
+
io_generic_read(io, h, 0, 0xa2);
-
+
// First byte is the disk format:
- switch (h[0])
+ switch (h[0])
{
case 0x01:
default:
@@ -212,11 +212,11 @@ bool dcp_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
if (!is_hdb)
{
for (int track = 0; track < tracks; track++)
- for (int head = 0; head < heads; head++)
+ for (int head = 0; head < heads; head++)
{
io_generic_read(io, sect_data, 0xa2 + bps * spt * (track * heads + head), bps * spt);
-
- for (int i = 0; i < spt; i++)
+
+ for (int i = 0; i < spt; i++)
{
sects[i].track = track;
sects[i].head = head;
@@ -227,16 +227,16 @@ bool dcp_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
sects[i].bad_crc = false;
sects[i].data = sect_data + i * bps;
}
-
+
build_pc_track_mfm(track, head, image, cell_count, spt, sects, calc_default_pc_gap3_size(form_factor, bps));
}
}
- else // FIXME: the code below is untested, because no image was found... there might be some silly mistake in the disk geometry!
+ else // FIXME: the code below is untested, because no image was found... there might be some silly mistake in the disk geometry!
{
// Read Head 0 Track 0 is FM with 26 sectors of 128bytes instead of 256
io_generic_read(io, sect_data, 0xa2, 128 * spt);
-
- for (int i = 0; i < spt; i++)
+
+ for (int i = 0; i < spt; i++)
{
sects[i].track = 0;
sects[i].head = 0;
@@ -247,13 +247,13 @@ bool dcp_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
sects[i].bad_crc = false;
sects[i].data = sect_data + i * 128;
}
-
+
build_pc_track_fm(0, 0, image, cell_count, spt, sects, calc_default_pc_gap3_size(form_factor, 128));
-
+
// Read Head 1 Track 0 is MFM with 26 sectors of 256bytes
io_generic_read(io, sect_data, 0xa2 + 128 * spt, bps * spt);
-
- for (int i = 0; i < spt; i++)
+
+ for (int i = 0; i < spt; i++)
{
sects[i].track = 0;
sects[i].head = 1;
@@ -264,17 +264,17 @@ bool dcp_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
sects[i].bad_crc = false;
sects[i].data = sect_data + i * bps;
}
-
+
build_pc_track_mfm(0, 1, image, cell_count, spt, sects, calc_default_pc_gap3_size(form_factor, bps));
-
+
// Read other tracks as usual
UINT32 data_offs = 0xa2 + (26 * 0x80) + (26 * 0x100);
for (int track = 1; track < tracks; track++)
- for (int head = 0; head < heads; head++)
+ for (int head = 0; head < heads; head++)
{
io_generic_read(io, sect_data, data_offs + bps * spt * ((track - 1) * heads + head), bps * spt);
-
- for (int i = 0; i < spt; i++)
+
+ for (int i = 0; i < spt; i++)
{
sects[i].track = track;
sects[i].head = head;
@@ -285,11 +285,11 @@ bool dcp_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
sects[i].bad_crc = false;
sects[i].data = sect_data + i * bps;
}
-
+
build_pc_track_mfm(track, head, image, cell_count, spt, sects, calc_default_pc_gap3_size(form_factor, bps));
}
}
-
+
return true;
}
diff --git a/src/lib/formats/dip_dsk.c b/src/lib/formats/dip_dsk.c
index a245a69d824..85f142df8fa 100644
--- a/src/lib/formats/dip_dsk.c
+++ b/src/lib/formats/dip_dsk.c
@@ -5,11 +5,11 @@
formats/dip_dsk.h
PC98 DIP disk images
-
+
0x100 header, followed by track data
TODO:
- - Investigate header structure
+ - Investigate header structure
- can this format be used to support different disc types?
*********************************************************************/
@@ -56,21 +56,21 @@ bool dip_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
tracks = 77;
spt = 8;
bps = 1024;
-
+
int cell_count = form_factor == floppy_image::FF_35 ? 200000 : 166666;
-
+
int ssize;
for (ssize = 0; (128 << ssize) < bps; ssize++);
-
+
desc_pc_sector sects[256];
UINT8 sect_data[65536];
-
+
for (int track = 0; track < tracks; track++)
- for (int head = 0; head < heads; head++)
+ for (int head = 0; head < heads; head++)
{
io_generic_read(io, sect_data, 0x100 + bps * spt * (track * heads + head), bps * spt);
-
- for (int i = 0; i < spt; i++)
+
+ for (int i = 0; i < spt; i++)
{
sects[i].track = track;
sects[i].head = head;
@@ -81,7 +81,7 @@ bool dip_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
sects[i].bad_crc = false;
sects[i].data = sect_data + i * bps;
}
-
+
build_pc_track_mfm(track, head, image, cell_count, spt, sects, calc_default_pc_gap3_size(form_factor, bps));
}
diff --git a/src/lib/formats/fdd_dsk.c b/src/lib/formats/fdd_dsk.c
index 06af2734e74..e9d76a99973 100644
--- a/src/lib/formats/fdd_dsk.c
+++ b/src/lib/formats/fdd_dsk.c
@@ -5,7 +5,7 @@
formats/fdd_dsk.h
PC98 FDD disk images
-
+
0xC3FC header, followed by track data
Sector map starts at offset 0xDC, with 12bytes for each sector
@@ -15,15 +15,15 @@
- 0x2 = sector number
- 0x3 = sector size (128 << this byte)
- 0x4 = fill byte. if it's not 0xff, then this sector in the original
- disk consisted of this single value repeated for the whole
- sector size, and the sector is skipped in the .fdd file.
- if it's 0xff, then this sector is wholly contained in the .fdd
+ disk consisted of this single value repeated for the whole
+ sector size, and the sector is skipped in the .fdd file.
+ if it's 0xff, then this sector is wholly contained in the .fdd
file
- 0x5 = ??
- 0x6 = ??
- 0x7 = ??
- 0x8-0x0b = absolute offset of the data for this sector, or 0xfffffff
- if the sector was skipped in the .fdd (and it has to be
+ if the sector was skipped in the .fdd (and it has to be
filled with the value at 0x4)
TODO:
@@ -55,19 +55,19 @@ const char *fdd_format::extensions() const
int fdd_format::identify(io_generic *io, UINT32 form_factor)
{
- UINT8 h[7];
+ UINT8 h[7];
io_generic_read(io, h, 0, 7);
-
+
if (strncmp((const char *)h, "VFD1.0", 6) == 0)
return 100;
-
+
return 0;
}
bool fdd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
{
- UINT8 hsec[0x0c];
-
+ UINT8 hsec[0x0c];
+
// sector map
UINT8 num_secs[160];
UINT8 tracks[160 * 26];
@@ -76,9 +76,9 @@ bool fdd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
UINT8 fill_vals[160 * 26];
UINT32 sec_offs[160 * 26];
UINT8 sec_sizes[160 * 26];
-
+
int pos = 0xdc;
-
+
for (int track = 0; track < 160; track++)
{
int curr_num_sec = 0, curr_track_size = 0;
@@ -87,10 +87,10 @@ bool fdd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
// read sector map for this sector
io_generic_read(io, hsec, pos, 0x0c);
pos += 0x0c;
-
- if (hsec[0] == 0xff) // unformatted/unused sector
+
+ if (hsec[0] == 0xff) // unformatted/unused sector
continue;
-
+
tracks[(track * 26) + sect] = hsec[0];
heads[(track * 26) + sect] = hsec[1];
secs[(track * 26) + sect] = hsec[2];
@@ -110,9 +110,9 @@ bool fdd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
int cur_sec_map = 0, sector_size;
for (int track = 0; track < 160; track++)
- {
+ {
int cur_pos = 0;
- for (int i = 0; i < num_secs[track]; i++)
+ for (int i = 0; i < num_secs[track]; i++)
{
cur_sec_map = track * 26 + i;
sector_size = 128 << sec_sizes[cur_sec_map];
@@ -121,7 +121,7 @@ bool fdd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
memset(sect_data + cur_pos, fill_vals[cur_sec_map], sector_size);
else
io_generic_read(io, sect_data + cur_pos, sec_offs[cur_sec_map], sector_size);
-
+
sects[i].track = tracks[cur_sec_map];
sects[i].head = heads[cur_sec_map];
sects[i].sector = secs[cur_sec_map];
@@ -135,7 +135,7 @@ bool fdd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
build_pc_track_mfm(track / 2, track % 2, image, cell_count, num_secs[track], sects, calc_default_pc_gap3_size(form_factor, (128 << sec_sizes[track * 26])));
}
-
+
return true;
}
diff --git a/src/lib/formats/nfd_dsk.c b/src/lib/formats/nfd_dsk.c
index 7f55e22dd45..ea886e9dd3a 100644
--- a/src/lib/formats/nfd_dsk.c
+++ b/src/lib/formats/nfd_dsk.c
@@ -30,22 +30,22 @@
0xA = PDA (disk type)
0xB-0xF = reserved and equal to 0x00 (possibly available for future format extensions?)
-
- Revision 1
+
+ Revision 1
==========
-
+
header structure (variable length > 0x120, header length = DWORD at 0x110)
0x000-0x11F = same as Rev. 0 format
- 0x120-0x3AF = 164 DWORDs containing, for each track, the absolute position of the sector maps
+ 0x120-0x3AF = 164 DWORDs containing, for each track, the absolute position of the sector maps
for sectors of the track. for unformatted/unused tracks 0 is used
0x3B0-0x3B3 = absolute position of addintional info in the header, if any
0x3B4-0x3BF = reserved
- 0x120-EOHeader = sector map + special data for each track:
+ 0x120-EOHeader = sector map + special data for each track:
first 0x10 of each track = #sectors (WORD), #extra data (WORD), reserved 0xc bytes zeroed
then 0x10 for each sector of this track and 0x10 for each extra data chunk
sector map structure
- 0x0 = track number
+ 0x0 = track number
0x1 = head
0x2 = sector number
0x3 = sector size (in 128byte chunks)
@@ -74,7 +74,7 @@
- add support for DDAM in Rev. 0 (need an image which set it in some sector)
- investigate the READ DATA bytes of sector headers
- investigate RETRY DATA chunks
-
+
*********************************************************************/
#include "emu.h"
@@ -101,9 +101,9 @@ const char *nfd_format::extensions() const
int nfd_format::identify(io_generic *io, UINT32 form_factor)
{
- UINT8 h[16];
+ UINT8 h[16];
io_generic_read(io, h, 0, 16);
-
+
if (strncmp((const char *)h, "T98FDDIMAGE.R0", 14) == 0 || strncmp((const char *)h, "T98FDDIMAGE.R1", 14) == 0)
return 100;
@@ -113,7 +113,7 @@ int nfd_format::identify(io_generic *io, UINT32 form_factor)
bool nfd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
{
UINT64 size = io_generic_size(io);
- UINT8 h[0x120], hsec[0x10];
+ UINT8 h[0x120], hsec[0x10];
io_generic_read(io, h, 0, 0x120);
int format_version = !strncmp((const char *)h, "T98FDDIMAGE.R0", 14) ? 0 : 1;
@@ -156,17 +156,17 @@ bool nfd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
for (int sect = 0; sect < num_secs[track]; sect++)
{
io_generic_read(io, hsec, secmap_addr, 0x10);
-
+
if (track == 0 && sect == 0)
- disk_type = hsec[0xb]; // can this change across the disk? I don't think so...
+ disk_type = hsec[0xb]; // can this change across the disk? I don't think so...
secmap_addr += 0x10;
-
+
tracks[(track * 26) + sect] = hsec[0];
heads[(track * 26) + sect] = hsec[1];
secs[(track * 26) + sect] = hsec[2];
sec_sizes[(track * 26) + sect] = hsec[3];
mfm[(track * 26) + sect] = hsec[4];
-
+
curr_track_size += (128 << hsec[3]);
}
@@ -174,7 +174,7 @@ bool nfd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
{
for (int sect = 0; sect < num_specials[track]; sect++)
{
- io_generic_read(io, hsec, secmap_addr, 0x10);
+ io_generic_read(io, hsec, secmap_addr, 0x10);
secmap_addr += 0x10;
curr_track_size += (hsec[9] + 1) * LITTLE_ENDIANIZE_INT32(*(UINT32 *)(hsec + 0x0a));
}
@@ -200,18 +200,18 @@ bool nfd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
io_generic_read(io, hsec, pos, 0x10);
if (track == 0 && sect == 0)
- disk_type = hsec[0xa]; // can this change across the disk? I don't think so...
+ disk_type = hsec[0xa]; // can this change across the disk? I don't think so...
pos += 0x10;
-
- if (hsec[0] == 0xff) // unformatted/unused sector
+
+ if (hsec[0] == 0xff) // unformatted/unused sector
continue;
-
+
tracks[(track * 26) + sect] = hsec[0];
heads[(track * 26) + sect] = hsec[1];
secs[(track * 26) + sect] = hsec[2];
sec_sizes[(track * 26) + sect] = hsec[3];
mfm[(track * 26) + sect] = hsec[4];
-
+
curr_track_size += (128 << hsec[3]);
curr_num_sec++;
}
@@ -226,12 +226,12 @@ bool nfd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
switch (disk_type)
{
- case 0x10: // 640K disk, 2DD
+ case 0x10: // 640K disk, 2DD
image->set_variant(floppy_image::DSDD);
break;
- //case 0x30: // 1.44M disk, ?? (no images found)
- // break;
- case 0x90: // 1.2M disk, 2HD
+ //case 0x30: // 1.44M disk, ?? (no images found)
+ // break;
+ case 0x90: // 1.2M disk, 2HD
default:
image->set_variant(floppy_image::DSHD);
break;
@@ -246,7 +246,7 @@ bool nfd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
{
io_generic_read(io, sect_data, pos, track_sizes[track]);
- for (int i = 0; i < num_secs[track]; i++)
+ for (int i = 0; i < num_secs[track]; i++)
{
cur_sec_map = track * 26 + i;
sector_size = 128 << sec_sizes[cur_sec_map];
@@ -261,7 +261,7 @@ bool nfd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
}
pos += track_sizes[track];
- // notice that the operation below might fail if sectors of the same track have variable sec_sizes,
+ // notice that the operation below might fail if sectors of the same track have variable sec_sizes,
// because the gap3 calculation would account correctly only for the first sector...
// examined images had constant sec_sizes in the each track, so probably this is not an issue
if (mfm[track * 26])
@@ -269,7 +269,7 @@ bool nfd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
else
build_pc_track_fm(track / 2, track % 2, image, cell_count, num_secs[track], sects, calc_default_pc_gap3_size(form_factor, (128 << sec_sizes[track * 26])));
}
-
+
return true;
}
diff --git a/src/lib/formats/victor9k_dsk.c b/src/lib/formats/victor9k_dsk.c
index f98b9f6e9d8..694ac3dbf80 100644
--- a/src/lib/formats/victor9k_dsk.c
+++ b/src/lib/formats/victor9k_dsk.c
@@ -40,61 +40,61 @@
cell 2.13 usec
- Boot Disc Label Format
- Track 0 Sector 0
+ Boot Disc Label Format
+ Track 0 Sector 0
- Byte
- Offset Name Description
+ Byte
+ Offset Name Description
- 0 System disc ID literally, ff,00h for a system
- disc
+ 0 System disc ID literally, ff,00h for a system
+ disc
- 2 Load address paragraph to load booted
- program at. If zero then boot
- loads in high memory.
+ 2 Load address paragraph to load booted
+ program at. If zero then boot
+ loads in high memory.
- 4 Length paragraph count to load.
+ 4 Length paragraph count to load.
- 6 Entry offset I.P. value for transfer of
- control.
+ 6 Entry offset I.P. value for transfer of
+ control.
- 8 Entry segment C.S. value for transfer of
- control.
+ 8 Entry segment C.S. value for transfer of
+ control.
- 10 I.D. disc identifier.
+ 10 I.D. disc identifier.
- 18 Part number system identifier - displayed
- by early versions of boot.
+ 18 Part number system identifier - displayed
+ by early versions of boot.
- 26 Sector size byte count for sectors.
+ 26 Sector size byte count for sectors.
- 28 Data start first data sector on disc
- (absolute sectors).
+ 28 Data start first data sector on disc
+ (absolute sectors).
- 30 Boot start first absolute sector of
- program for boot to load at
- 'load address' for 'length'
- paragraphs.
+ 30 Boot start first absolute sector of
+ program for boot to load at
+ 'load address' for 'length'
+ paragraphs.
- 32 Flags indicators:
- bit meaning
- 15-12 interleave factor
- (0-15)
- 0 0=single sided
- 1=double sided
+ 32 Flags indicators:
+ bit meaning
+ 15-12 interleave factor
+ (0-15)
+ 0 0=single sided
+ 1=double sided
- 34 Disc type 00 = CP/M
- 01 = MS-DOS
+ 34 Disc type 00 = CP/M
+ 01 = MS-DOS
- 35 Reserved
+ 35 Reserved
- 38 Speed table information for speed control
- proc.
+ 38 Speed table information for speed control
+ proc.
- 56 Zone table high track for each zone.
+ 56 Zone table high track for each zone.
- 71 Sector/track sectors per track for each
- zone.
+ 71 Sector/track sectors per track for each
+ zone.
*/
#include "emu.h"