Previous 199869 Revisions Next

r19005 Saturday 17th November, 2012 at 14:37:02 UTC by Michael Zapf
[MESS] ti99/geneve: Now accepts a variant of the disk format which has
768 additional bytes at the end used as a bad sector map.
[src/lib/formats]ti99_dsk.c

trunk/src/lib/formats/ti99_dsk.c
r19004r19005
1212 * without track data. The first sector of the disk is located at the start of
1313 * the image, while the last sector is at its end.
1414 *
15 * There is also a variant of the SDF which adds three sectors at the end
16 * containing a map of bad sectors. This was introduced by a tool to read
17 * real TI floppy disks on a PC. As other emulators tolerate this additional
18 * bad sector map, we just check whether there are 3 more sectors and ignore
19 * them.
20 *
1521 * The Track Dump Format is also known as pc99 (again, named after the first
1622 * TI emulator to use this format). It is a contiguous sequence of track
1723 * contents, containing all information including address marks and CRC, but it
r19004r19005
118124   use_80_track_drives = use80;
119125}
120126
121#define TI99_DSK_TAG   "ti99dsktag"
127#define TI99_DSK_TAG    "ti99dsktag"
122128#define TI99DSK_BLOCKNOTFOUND -1
123129
124130/*
r19004r19005
276282   int totsecs;
277283   typedef struct ti99_vib
278284   {
279      char   name[10];      // volume name (10 characters, pad with spaces)
280      UINT8   totsecsMSB;      // disk length in sectors (big-endian) (usually 360, 720 or 1440)
281      UINT8   totsecsLSB;
282      UINT8   secspertrack;   // sectors per track (usually 9 (FM) or 18 (MFM))
283      UINT8   id[3];         // String "DSK"
284      UINT8   protection;      // 'P' if disk is protected, ' ' otherwise.
285      UINT8   tracksperside;   // tracks per side (usually 40)
286      UINT8   sides;         // sides (1 or 2)
287      UINT8   density;      // 0,1 (FM) or 2,3,4 (MFM)
288      UINT8   res[36];      // Empty for traditional disks, or up to 3 directory pointers
289      UINT8   abm[200];      // allocation bitmap: a 1 for each sector in use (sector 0 is LSBit of byte 0,
285      char    name[10];       // volume name (10 characters, pad with spaces)
286      UINT8   totsecsMSB;     // disk length in sectors (big-endian) (usually 360, 720 or 1440)
287      UINT8   totsecsLSB;
288      UINT8   secspertrack;   // sectors per track (usually 9 (FM) or 18 (MFM))
289      UINT8   id[3];          // String "DSK"
290      UINT8   protection;     // 'P' if disk is protected, ' ' otherwise.
291      UINT8   tracksperside;  // tracks per side (usually 40)
292      UINT8   sides;          // sides (1 or 2)
293      UINT8   density;        // 0,1 (FM) or 2,3,4 (MFM)
294      UINT8   res[36];        // Empty for traditional disks, or up to 3 directory pointers
295      UINT8   abm[200];       // allocation bitmap: a 1 for each sector in use (sector 0 is LSBit of byte 0,
290296                        // sector 7 is MSBit of byte 0, sector 8 is LSBit of byte 1, etc.)
291297   } ti99_vib;
292298
r19004r19005
339345   // and assume that the VIB did not contain reliable data. For the
340346   // ambiguous case we choose the most common format.
341347
348   // Adding support for another sector image format which adds 768 bytes
349   // as a bad sector map
350   if ((file_size / 256) % 10 == 3)
351   {
352      LOG_FORMATS("Stripping map of bad sectors at image end\n");
353      file_size -= 768;
354   }
355
342356   switch (file_size)
343357   {
344358   case 1*40*9*256:
r19004r19005
809823   {
810824      *offset = (imgtrack * tag->sectors + sector) * SECTOR_SIZE;
811825   }
812   else      /* track numbers increasing towards outer track */
826   else        /* track numbers increasing towards outer track */
813827   {
814828      *offset = (((2*tag->tracks)-1-imgtrack) * tag->sectors + sector) * SECTOR_SIZE;
815829   }
r19004r19005
941955   {
942956      /* create */
943957      memset(&geometry, 0, sizeof(geometry));
944      geometry.sides            = option_resolution_lookup_int(params, PARAM_HEADS);
945      geometry.tracksperside         = option_resolution_lookup_int(params, PARAM_TRACKS);
946      geometry.secspertrack         = option_resolution_lookup_int(params, PARAM_SECTORS);
958      geometry.sides              = option_resolution_lookup_int(params, PARAM_HEADS);
959      geometry.tracksperside          = option_resolution_lookup_int(params, PARAM_TRACKS);
960      geometry.secspertrack           = option_resolution_lookup_int(params, PARAM_SECTORS);
947961
948962      /* We don't have headers for geometry */
949963      /* check for usage in imgtool - we want to be able to create useful disks */
r19004r19005
20222036/* ----------------------------------------------------------------------- */
20232037
20242038LEGACY_FLOPPY_OPTIONS_START( ti99 )
2025   LEGACY_FLOPPY_OPTION( ti99_sdf, "dsk",         "TI99 sector dump (v9t9)",   ti99_sdf_identify,   ti99_sdf_construct, NULL,
2039   LEGACY_FLOPPY_OPTION( ti99_sdf, "dsk",          "TI99 sector dump (v9t9)",  ti99_sdf_identify,  ti99_sdf_construct, NULL,
20262040      HEADS([1]-2)
20272041      TRACKS(35-[40]-80)
20282042      SECTORS(8/9/16/[18]/36)
20292043      SECTOR_LENGTH([256])
20302044      FIRST_SECTOR_ID(0))
2031   LEGACY_FLOPPY_OPTION( ti99_tdf, "dsk,dtk",         "TI99 track dump (pc99)",   ti99_tdf_identify,   ti99_tdf_construct, NULL,
2045   LEGACY_FLOPPY_OPTION( ti99_tdf, "dsk,dtk",          "TI99 track dump (pc99)",   ti99_tdf_identify,  ti99_tdf_construct, NULL,
20322046      TRACKS(35-[40]-80)
20332047      SECTORS(8/9/16/[18]/36)
20342048      SECTOR_LENGTH([256])

Previous 199869 Revisions Next


© 1997-2024 The MAME Team