Previous 199869 Revisions Next

r20301 Thursday 17th January, 2013 at 15:32:52 UTC by Curt Coder
(MESS) d64/g64 floppy modernization WIP. (nw)
[src/lib]lib.mak
[src/lib/formats]d64_dsk.c d64_dsk.h d67_dsk.c* d67_dsk.h* d80_dsk.c* d80_dsk.h* g64_dsk.c g64_dsk.h

trunk/src/lib/formats/d80_dsk.c
r0r20301
1/***************************************************************************
2
3    Copyright Olivier Galibert
4    All rights reserved.
5
6    Redistribution and use in source and binary forms, with or without
7    modification, are permitted provided that the following conditions are
8    met:
9
10        * Redistributions of source code must retain the above copyright
11          notice, this list of conditions and the following disclaimer.
12        * Redistributions in binary form must reproduce the above copyright
13          notice, this list of conditions and the following disclaimer in
14          the documentation and/or other materials provided with the
15          distribution.
16        * Neither the name 'MAME' nor the names of its contributors may be
17          used to endorse or promote products derived from this software
18          without specific prior written permission.
19
20    THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND ANY EXPRESS OR
21    IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23    DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT,
24    INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28    STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
29    IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30    POSSIBILITY OF SUCH DAMAGE.
31
32****************************************************************************/
33
34/*********************************************************************
35
36    formats/d80_dsk.c
37
38    Commodore 8050/8250/SFD-1001 sector disk image format
39
40*********************************************************************/
41
42#include "emu.h"
43#include "formats/d80_dsk.h"
44
45d80_format::d80_format() : d64_format(formats)
46{
47}
48
49const char *d80_format::name() const
50{
51   return "d80";
52}
53
54const char *d80_format::description() const
55{
56   return "Commodore 8050/8250/SFD-1001 disk image";
57}
58
59const char *d80_format::extensions() const
60{
61   return "d80,d82";
62}
63
64const d80_format::format d80_format::formats[] = {
65   { // d80, dos 2.5, 77 tracks, head/stepper 100 tpi
66      floppy_image::FF_525, floppy_image::SSQD, 2083, 77, 1, 256, 9, 8
67   },
68   { // d82, dos 2.5, 77 tracks, 2 heads, head/stepper 100 tpi
69      floppy_image::FF_525, floppy_image::DSQD, 2083, 77, 2, 256, 9, 8
70   },
71   {}
72};
73
74const UINT32 d80_format::cell_size[] =
75{
76   2667, // 12MHz/16/2
77   2500, // 12MHz/15/2
78   2333, // 12MHz/14/2
79   2167  // 12MHz/13/2
80};
81
82const int d80_format::sectors_per_track[] =
83{
84   29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, //  1-39
85   29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
86   27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,                         // 40-53
87   25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,                                     // 54-64
88   23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,                             // 65-77
89   23, 23, 23, 23, 23, 23, 23                                                      // 78-84
90};
91
92const int d80_format::speed_zone[] =
93{
94   3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, //  1-39
95   3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
96   2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,                   // 40-53
97   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,                            // 54-64
98   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,                      // 65-77
99   0, 0, 0, 0, 0, 0, 0                                         // 78-84
100};
101
102int d80_format::get_physical_track(const format &f, int track)
103{
104   return track;
105}
106
107UINT32 d80_format::get_cell_size(const format &f, int track)
108{
109   return cell_size[speed_zone[track]];
110}
111
112int d80_format::get_sectors_per_track(const format &f, int track)
113{
114   return sectors_per_track[track];
115}
116
117int d80_format::get_disk_id_offset(const format &f)
118{
119   return 282136;
120}
121
122const floppy_format_type FLOPPY_D80_FORMAT = &floppy_image_format_creator<d80_format>;
trunk/src/lib/formats/d80_dsk.h
r0r20301
1/*********************************************************************
2
3    formats/d80_dsk.h
4
5    Commodore 8050/8250/SFD-1001 sector disk image format
6
7*********************************************************************/
8
9#ifndef D80_DSK_H_
10#define D80_DSK_H_
11
12#include "d64_dsk.h"
13
14class d80_format : public d64_format {
15public:
16   d80_format();
17
18   virtual const char *name() const;
19   virtual const char *description() const;
20   virtual const char *extensions() const;
21
22protected:
23   virtual int get_physical_track(const format &f, int track);
24   virtual UINT32 get_cell_size(const format &f, int track);
25   virtual int get_sectors_per_track(const format &f, int track);
26   virtual int get_disk_id_offset(const format &f);
27
28   static const format formats[];
29
30   static const UINT32 cell_size[];
31   static const int speed_zone[];
32   static const int sectors_per_track[];
33};
34
35extern const floppy_format_type FLOPPY_D80_FORMAT;
36
37
38
39#endif
trunk/src/lib/formats/d64_dsk.c
r20300r20301
3535
3636    formats/d64_dsk.c
3737
38    Commodore 2040/8050/1541 sector disk image format
38    Commodore 2040/1541/1571 sector disk image format
3939
4040*********************************************************************/
4141
r20300r20301
4444
4545d64_format::d64_format()
4646{
47   formats = file_formats;
4748}
4849
50d64_format::d64_format(const format *_formats)
51{
52   formats = _formats;
53}
54
4955const char *d64_format::name() const
5056{
5157   return "d64";
r20300r20301
5359
5460const char *d64_format::description() const
5561{
56   return "Commodore 2040/8050/1541 disk image";
62   return "Commodore 4040/1541/1571 disk image";
5763}
5864
5965const char *d64_format::extensions() const
6066{
61   return "d64,d67,d71,d80,d82";
67   return "d64,d71";
6268}
6369
64const d64_format::format d64_format::formats[] = {
65   { // d67, dos 1, 35 tracks
66      floppy_image::FF_525, floppy_image::SSSD, DOS_1, 690, 35, 1, 9, 8
70const d64_format::format d64_format::file_formats[] = {
71   { // d64, dos 2, 35 tracks, head 48 tpi, stepper 96 tpi
72      floppy_image::FF_525, floppy_image::SSSD, 683, 35, 1, 256, 9, 8
6773   },
68   { // d64, dos 2, 35 tracks
69      floppy_image::FF_525, floppy_image::SSSD, DOS_2, 683, 35, 1, 9, 8
74   { // d64, dos 2, 40 tracks, head 48 tpi, stepper 96 tpi
75      floppy_image::FF_525, floppy_image::SSSD, 768, 35, 1, 256, 9, 8
7076   },
71   { // d64, dos 2, 40 tracks
72      floppy_image::FF_525, floppy_image::SSSD, DOS_2, 768, 35, 1, 9, 8
77   { // d64, dos 2, 42 tracks, head 48 tpi, stepper 96 tpi
78      floppy_image::FF_525, floppy_image::SSSD, 802, 35, 1, 256, 9, 8
7379   },
74   { // d64, dos 2, 42 tracks
75      floppy_image::FF_525, floppy_image::SSSD, DOS_2, 802, 35, 1, 9, 8
80   { // d71, dos 2, 35 tracks, 2 heads, head 48 tpi, stepper 96 tpi
81      floppy_image::FF_525, floppy_image::DSSD, 683, 35, 2, 256, 9, 8
7682   },
77   { // d71, dos 2, 35 tracks, 2 heads
78      floppy_image::FF_525, floppy_image::DSSD, DOS_2, 683, 35, 2, 9, 8
79   },
80   { // d80, dos 2.5, 77 tracks
81      floppy_image::FF_525, floppy_image::SSQD, DOS_25, 2083, 77, 1, 9, 8
82   },
83   { // d82, dos 2.5, 77 tracks, 2 heads
84      floppy_image::FF_525, floppy_image::DSQD, DOS_25, 2083, 77, 2, 9, 8
85   },
8683   {}
8784};
8885
89const UINT32 d64_format::dos1_cell_size[] =
86const UINT32 d64_format::cell_size[] =
9087{
9188   4000, // 16MHz/16/4
9289   3750, // 16MHz/15/4
r20300r20301
9491   3250  // 16MHz/13/4
9592};
9693
97const UINT32 d64_format::dos25_cell_size[] =
94const int d64_format::sectors_per_track[] =
9895{
99   2667, // 12MHz/16/2
100   2500, // 12MHz/15/2
101   2333, // 12MHz/14/2
102   2167  // 12MHz/13/2
103};
104
105const int d64_format::dos1_sectors_per_track[] =
106{
10796   21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, //  1-17
108   20, 20, 20, 20, 20, 20, 20,                                         // 18-24
109   18, 18, 18, 18, 18, 18,                                             // 25-30
110   17, 17, 17, 17, 17,                                                 // 31-35
111   17, 17, 17, 17, 17,                                                 // 36-40
112   17, 17                                                              // 41-42
113};
114
115const int d64_format::dos2_sectors_per_track[] =
116{
117   21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, //  1-17
11897   19, 19, 19, 19, 19, 19, 19,                                         // 18-24
11998   18, 18, 18, 18, 18, 18,                                             // 25-30
12099   17, 17, 17, 17, 17,                                                 // 31-35
r20300r20301
122101   17, 17                                                              // 41-42
123102};
124103
125const int d64_format::dos25_sectors_per_track[] =
104const int d64_format::speed_zone[] =
126105{
127   29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, //  1-39
128   29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
129   27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,                         // 40-53
130   25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,                                     // 54-64
131   23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,                             // 65-77
132   23, 23, 23, 23, 23, 23, 23                                                      // 78-84
133};
134
135const int d64_format::dos1_speed_zone[] =
136{
137106   3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, //  1-17
138107   2, 2, 2, 2, 2, 2, 2,                               // 18-24
139108   1, 1, 1, 1, 1, 1,                                  // 25-30
r20300r20301
142111   0, 0                                               // 41-42
143112};
144113
145const int d64_format::dos25_speed_zone[] =
146{
147   3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, //  1-39
148   3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
149   2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,                   // 40-53
150   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,                            // 54-64
151   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,                      // 65-77
152   0, 0, 0, 0, 0, 0, 0                                         // 78-84
153};
154
155114int d64_format::find_size(io_generic *io, UINT32 form_factor)
156115{
157116   int size = io_generic_size(io);
158117   for(int i=0; formats[i].sector_count; i++) {
159118      const format &f = formats[i];
160      if(size == f.sector_count*SECTOR_SIZE)
119      if(size == f.sector_count*f.sector_base_size)
161120         return i;
162      if(size == (f.sector_count*SECTOR_SIZE) + f.sector_count)
121      if(size == (f.sector_count*f.sector_base_size) + f.sector_count)
163122         return i;
164123   }
165124   return -1;
r20300r20301
176135
177136int d64_format::get_physical_track(const format &f, int track)
178137{
179   int physical_track = 0;
138   // skip halftracks
139   return track * 2;
140}
180141
181   switch (f.dos) {
182   case DOS_1: physical_track = track*2; break; // skip halftracks
183   case DOS_2: physical_track = track*2; break; // skip halftracks
184   case DOS_25: physical_track = track; break;
185   }
186
187   return physical_track;
142int d64_format::get_disk_id_offset(const format &f)
143{
144   return 101144;
188145}
189146
190147void d64_format::get_disk_id(const format &f, io_generic *io, UINT8 &id1, UINT8 &id2)
191148{
192   int offset = 0;
193
194   switch (f.dos) {
195   case DOS_1: offset = DOS1_DISK_ID_OFFSET; break;
196   case DOS_2: offset = DOS1_DISK_ID_OFFSET; break;
197   case DOS_25: offset = DOS25_DISK_ID_OFFSET; break;
198   }
199
200149   UINT8 id[2];
201   io_generic_read(io, id, offset, 2);
150   io_generic_read(io, id, get_disk_id_offset(f), 2);
202151   id1 = id[0];
203152   id2 = id[1];
204153}
205154
206155UINT32 d64_format::get_cell_size(const format &f, int track)
207156{
208   int cell_size = 0;
209
210   switch (f.dos) {
211   case DOS_1: cell_size = dos1_cell_size[dos1_speed_zone[track]]; break;
212   case DOS_2: cell_size = dos1_cell_size[dos1_speed_zone[track]]; break;
213   case DOS_25: cell_size = dos25_cell_size[dos25_speed_zone[track]]; break;
214   }
215
216   return cell_size;
157   return cell_size[speed_zone[track]];
217158}
218159
219160int d64_format::get_sectors_per_track(const format &f, int track)
220161{
221   int sector_count = 0;
222
223   switch (f.dos) {
224   case DOS_1: sector_count = dos1_sectors_per_track[track]; break;
225   case DOS_2: sector_count = dos2_sectors_per_track[track]; break;
226   case DOS_25: sector_count = dos25_sectors_per_track[track]; break;
227   }
228
229   return sector_count;
162   return sectors_per_track[track];
230163}
231164
232165floppy_image_format_t::desc_e* d64_format::get_sector_desc(const format &f, int &current_size, int track, int sector_count, UINT8 id1, UINT8 id2, int gap_2)
233166{
234167   static floppy_image_format_t::desc_e desc[] = {
235      /* 00 */ { SECTOR_LOOP_START, 0, sector_count-1 },
168      /* 00 */ { SECTOR_LOOP_START, 0, -1 },
236169      /* 01 */ {   RAWBYTE, 0xff, 5 },
237170      /* 02 */ {   GCR5, 0x08, 1 },
238171      /* 03 */ {   CRC, 1 },
r20300r20301
254187      /* 19 */ {   RAWBYTE, 0x55, gap_2 },
255188      /* 20 */ { SECTOR_LOOP_END },
256189      /* 21 */ { RAWBYTE, 0x55, 0 },
257      /* 22 */ { RAWBITS, 0xffff, 0 },
190      /* 22 */ { RAWBITS, 0x5555, 0 },
258191      /* 23 */ { END }
259192   };
260193
261   current_size = 40 + (1+1+4+2)*10 + (f.gap_1)*8 + 40 + (1+SECTOR_SIZE+1+2)*10 + gap_2*8;
262   current_size *= sector_count;
194   current_size = 40 + (1+1+4+2)*10 + (f.gap_1)*8 + 40 + (1+f.sector_base_size+1+2)*10 + gap_2*8;
263195
196   current_size *= sector_count;
264197   return desc;
265198}
266199
r20300r20301
268201{
269202   int cur_offset = 0;
270203
271   for(int i=0; i<f.sector_count; i++) {
204   for(int i=0; i<sector_count; i++) {
272205      sectors[i].data = sectdata + cur_offset;
273      sectors[i].size = SECTOR_SIZE;
206      sectors[i].size = f.sector_base_size;
274207      sectors[i].sector_id = i;
275208      sectors[i].sector_info = errordata[i];
276209
r20300r20301
288221   int size = io_generic_size(io);
289222   UINT8 *img;
290223
291   if(size == f.sector_count*SECTOR_SIZE) {
224   if(size == f.sector_count*f.sector_base_size) {
292225      img = global_alloc_array(UINT8, size + f.sector_count);
293      memset(&img[size + f.sector_count], ERROR_00, f.sector_count);
226      memset(&img[size], ERROR_00, f.sector_count);
294227   }
295228   else {
296229      img = global_alloc_array(UINT8, size);
r20300r20301
308241   for(int head=0; head < f.head_count; head++) {
309242      for(int track=0; track < f.track_count; track++) {
310243         int current_size = 0;
311         int total_size = 200000000/get_cell_size(f, track);
244         int total_size = 200000000/this->get_cell_size(f, track);
245         int physical_track = this->get_physical_track(f, track);
246         int sector_count = this->get_sectors_per_track(f, track);
247         int track_size = sector_count*f.sector_base_size;
312248
313         int physical_track = get_physical_track(f, track);
314         int sector_count = get_sectors_per_track(f, track);
315         int track_size = sector_count*SECTOR_SIZE;
316
317249         desc = get_sector_desc(f, current_size, track+1, sector_count, id1, id2, f.gap_2);
318250
319251         int remaining_size = total_size - current_size;
r20300r20301
325257         desc[22].p2 = remaining_size & 7;
326258         desc[22].p1 >>= 8-(remaining_size & 7);
327259
328         printf("track %u cursize %u totsize %u phystrack %u secnt %u trksize %u trkofs %u\n", track,current_size,total_size,physical_track,sector_count,track_size,track_offset);
329
330         build_sector_description(f, &img[track_offset], sectors, sector_count, &img[f.sector_count*SECTOR_SIZE + error_offset]);
260         build_sector_description(f, &img[track_offset], sectors, sector_count, &img[f.sector_count*f.sector_base_size + error_offset]);
331261         generate_track(desc, physical_track, head, sectors, sector_count, total_size, image);
332262         
333263         track_offset += track_size;
r20300r20301
340270   return true;
341271}
342272
273void d64_format::extract_sectors(floppy_image *image, const format &f, desc_s *sdesc, int track, int head)
274{
275
276}
277
343278bool d64_format::save(io_generic *io, floppy_image *image)
344279{
345280   return false;
trunk/src/lib/formats/g64_dsk.c
r20300r20301
3535
3636    formats/g64_dsk.c
3737
38    Commodore 1541 GCR disk image format
38    Commodore 1541/1571 GCR disk image format
3939
4040*********************************************************************/
4141
r20300r20301
6060
6161const char *g64_format::extensions() const
6262{
63   return "g64";
63   return "g64,g41,g71";
6464}
6565
6666const UINT32 g64_format::c1541_cell_size[] =
r20300r20301
7676   UINT8 header[8];
7777
7878   io_generic_read(io, &header, 0, sizeof(header));
79   if ( memcmp( header, G64_FORMAT_HEADER, 8 ) ==0) {
79   if ( memcmp( header, G64_FORMAT_HEADER, 8 ) == 0) {
8080      return 100;
8181   }
8282   return 0;
r20300r20301
8888   UINT8 *img = global_alloc_array(UINT8, size);
8989   io_generic_read(io, img, 0, size);
9090
91   int track_count = pick_integer_le(img, 9, 2);
91   int version = img[0x08];
92   if (version)
93      throw emu_fatalerror("g64_format: Unsupported version %u", version);
9294
95   int track_count = img[0x09];
96
9397   int pos = 0x0c;
9498   int track_offset[track_count];
9599   for(int track = 0; track < track_count; track++) {
r20300r20301
109113      if (pos > 0) {
110114         track_size = pick_integer_le(img, pos, 2);
111115         pos +=2;
112      }
113116     
114      if (speed_zone_offset[track] > 3)
115         throw emu_fatalerror("g64_format: Unsupported variable speed zones on track %d", track);
117         if (speed_zone_offset[track] > 3)
118            throw emu_fatalerror("g64_format: Unsupported variable speed zones on track %d", track);
116119
117      UINT32 cell_size = c1541_cell_size[speed_zone_offset[track]];
118      int total_size = 200000000/cell_size;
119      UINT32 *buffer = global_alloc_array_clear(UINT32, total_size);
120      int offset = 0;
120         UINT32 cell_size = c1541_cell_size[speed_zone_offset[track]];
121         int total_size = 200000000/cell_size;
122         UINT32 *buffer = global_alloc_array_clear(UINT32, total_size);
123         int offset = 0;
121124
122      if (pos > 0) {
123         for (int i=0; i<track_size; i++) {
124            raw_w(buffer, offset, 8, img[pos++], cell_size);
125         for (int i=0; i<track_size; i++, pos++) {
126            for (int bit=7; bit>=0; bit--) {
127               bit_w(buffer, offset++, BIT(img[pos], bit), cell_size);
128               if (offset == total_size) break;
129            }
125130         }
126131
127         if (offset >= total_size)
128            throw emu_fatalerror("g64_format: Too many cells for track %d", track);
132         if (offset < total_size) {
133            // pad the remainder of the track with sync
134            int count = (total_size-offset);
135            for (int i=0; i<count;i++) {
136               bit_w(buffer, offset++, 1, cell_size);
137            }
138         }
139
140         int physical_track = track >= 84 ? track - 84 : track;
141         int head = track >= 84;
142
143         generate_track_from_levels(physical_track, head, buffer, total_size, 0, image);
144         global_free(buffer);
129145      }
130
131      generate_track_from_levels(track, 0, buffer, total_size, 0, image);
132      global_free(buffer);
133146   }
134147
135148   image->set_variant(floppy_image::SSSD);
trunk/src/lib/formats/d64_dsk.h
r20300r20301
22
33    formats/d64_dsk.h
44
5    Commodore 2040/8050/1541 sector disk image format
5    Commodore 2040/1541/1571 sector disk image format
66
77*********************************************************************/
88
r20300r20301
1717      UINT32 form_factor;      // See floppy_image for possible values
1818      UINT32 variant;          // See floppy_image for possible values
1919
20      int dos;
2120      int sector_count;
2221      int track_count;
2322      int head_count;
23      int sector_base_size;
2424      int gap_1;
2525      int gap_2;
2626   };
2727
2828   d64_format();
29   d64_format(const format *formats);
2930
3031   virtual const char *name() const;
3132   virtual const char *description() const;
r20300r20301
3940protected:
4041   enum
4142   {
42      DOS_1,
43      DOS_2,
44      DOS_25
45   };
46
47   enum
48   {
4943      ERROR_00 = 1,
5044      ERROR_20,       /* header block not found */
5145      ERROR_21,       /* no sync character */
r20300r20301
6054      ERROR_74,       /* disk not ready (no device 1) UNIMPLEMENTED */
6155   };
6256
63   static const int SECTOR_SIZE = 256;
57   const format *formats;
6458
65   static const int DOS1_DISK_ID_OFFSET = 101144;
66   static const int DOS25_DISK_ID_OFFSET = 282136;
67
68   floppy_image_format_t::desc_e* get_sector_desc(const format &f, int &current_size, int track, int sector_count, UINT8 id1, UINT8 id2, int gap_2);
69
7059   int find_size(io_generic *io, UINT32 form_factor);
71   int get_physical_track(const format &f, int track);
72   UINT32 get_cell_size(const format &f, int track);
73   int get_sectors_per_track(const format &f, int track);
60   virtual int get_physical_track(const format &f, int track);
61   virtual UINT32 get_cell_size(const format &f, int track);
62   virtual int get_sectors_per_track(const format &f, int track);
63   virtual int get_disk_id_offset(const format &f);
7464   void get_disk_id(const format &f, io_generic *io, UINT8 &id1, UINT8 &id2);
65   floppy_image_format_t::desc_e* get_sector_desc(const format &f, int &current_size, int track, int sector_count, UINT8 id1, UINT8 id2, int gap_2);
7566   void build_sector_description(const format &f, UINT8 *sectdata, desc_s *sectors, int sector_count, UINT8 *errordata) const;
67   void extract_sectors(floppy_image *image, const format &f, desc_s *sdesc, int track, int head);
7668
77   static const format formats[];
69   static const format file_formats[];
7870
79   static const UINT32 dos1_cell_size[];
80   static const UINT32 dos25_cell_size[];
81   
82   static const int dos1_speed_zone[];
83   static const int dos25_speed_zone[];
84
85   static const int dos1_sectors_per_track[];
86   static const int dos2_sectors_per_track[];
87   static const int dos25_sectors_per_track[];
71   static const UINT32 cell_size[];
72   static const int sectors_per_track[];
73   static const int speed_zone[];
8874};
8975
9076extern const floppy_format_type FLOPPY_D64_FORMAT;
trunk/src/lib/formats/g64_dsk.h
r20300r20301
22
33    formats/g64_dsk.h
44
5    Commodore 1541 GCR disk image format
5    Commodore 1541/1571 GCR disk image format
66
77*********************************************************************/
88
trunk/src/lib/formats/d67_dsk.c
r0r20301
1/***************************************************************************
2
3    Copyright Olivier Galibert
4    All rights reserved.
5
6    Redistribution and use in source and binary forms, with or without
7    modification, are permitted provided that the following conditions are
8    met:
9
10        * Redistributions of source code must retain the above copyright
11          notice, this list of conditions and the following disclaimer.
12        * Redistributions in binary form must reproduce the above copyright
13          notice, this list of conditions and the following disclaimer in
14          the documentation and/or other materials provided with the
15          distribution.
16        * Neither the name 'MAME' nor the names of its contributors may be
17          used to endorse or promote products derived from this software
18          without specific prior written permission.
19
20    THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND ANY EXPRESS OR
21    IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23    DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT,
24    INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28    STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
29    IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30    POSSIBILITY OF SUCH DAMAGE.
31
32****************************************************************************/
33
34/*********************************************************************
35
36    formats/d67_dsk.c
37
38    Commodore 2040 sector disk image format
39
40*********************************************************************/
41
42#include "emu.h"
43#include "formats/d67_dsk.h"
44
45d67_format::d67_format() : d64_format(formats)
46{
47}
48
49const char *d67_format::name() const
50{
51   return "d67";
52}
53
54const char *d67_format::description() const
55{
56   return "Commodore 2040 disk image";
57}
58
59const char *d67_format::extensions() const
60{
61   return "d67";
62}
63
64const d67_format::format d67_format::formats[] = {
65   { // d67, dos 1, 35 tracks, head 48 tpi, stepper 96 tpi
66      floppy_image::FF_525, floppy_image::SSSD, 690, 35, 1, 256, 9, 8
67   },
68   {}
69};
70
71const int d67_format::sectors_per_track[] =
72{
73   21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, //  1-17
74   20, 20, 20, 20, 20, 20, 20,                                         // 18-24
75   18, 18, 18, 18, 18, 18,                                             // 25-30
76   17, 17, 17, 17, 17,                                                 // 31-35
77   17, 17, 17, 17, 17,                                                 // 36-40
78   17, 17                                                              // 41-42
79};
80
81int d67_format::get_sectors_per_track(const format &f, int track)
82{
83   return sectors_per_track[track];
84}
85
86const floppy_format_type FLOPPY_D67_FORMAT = &floppy_image_format_creator<d67_format>;
trunk/src/lib/formats/d67_dsk.h
r0r20301
1/*********************************************************************
2
3    formats/d67_dsk.h
4
5    Commodore 2040 sector disk image format
6
7*********************************************************************/
8
9#ifndef D67_DSK_H_
10#define D67_DSK_H_
11
12#include "d64_dsk.h"
13
14class d67_format : public d64_format {
15public:
16   d67_format();
17
18   virtual const char *name() const;
19   virtual const char *description() const;
20   virtual const char *extensions() const;
21
22protected:
23   virtual int get_sectors_per_track(const format &f, int track);
24
25   static const format formats[];
26
27   static const int sectors_per_track[];
28};
29
30extern const floppy_format_type FLOPPY_D67_FORMAT;
31
32
33
34#endif
trunk/src/lib/lib.mak
r20300r20301
118118   $(LIBOBJ)/formats/cqm_dsk.o     \
119119   $(LIBOBJ)/formats/csw_cas.o     \
120120   $(LIBOBJ)/formats/d64_dsk.o     \
121   $(LIBOBJ)/formats/d67_dsk.o     \
122   $(LIBOBJ)/formats/d80_dsk.o     \
121123   $(LIBOBJ)/formats/d81_dsk.o     \
122124   $(LIBOBJ)/formats/d88_dsk.o     \
123125   $(LIBOBJ)/formats/dfi_dsk.o     \

Previous 199869 Revisions Next


© 1997-2024 The MAME Team