trunk/src/lib/formats/d80_dsk.c
| r0 | r20301 | |
| 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 | |
| 45 | d80_format::d80_format() : d64_format(formats) |
| 46 | { |
| 47 | } |
| 48 | |
| 49 | const char *d80_format::name() const |
| 50 | { |
| 51 | return "d80"; |
| 52 | } |
| 53 | |
| 54 | const char *d80_format::description() const |
| 55 | { |
| 56 | return "Commodore 8050/8250/SFD-1001 disk image"; |
| 57 | } |
| 58 | |
| 59 | const char *d80_format::extensions() const |
| 60 | { |
| 61 | return "d80,d82"; |
| 62 | } |
| 63 | |
| 64 | const 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 | |
| 74 | const 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 | |
| 82 | const 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 | |
| 92 | const 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 | |
| 102 | int d80_format::get_physical_track(const format &f, int track) |
| 103 | { |
| 104 | return track; |
| 105 | } |
| 106 | |
| 107 | UINT32 d80_format::get_cell_size(const format &f, int track) |
| 108 | { |
| 109 | return cell_size[speed_zone[track]]; |
| 110 | } |
| 111 | |
| 112 | int d80_format::get_sectors_per_track(const format &f, int track) |
| 113 | { |
| 114 | return sectors_per_track[track]; |
| 115 | } |
| 116 | |
| 117 | int d80_format::get_disk_id_offset(const format &f) |
| 118 | { |
| 119 | return 282136; |
| 120 | } |
| 121 | |
| 122 | const floppy_format_type FLOPPY_D80_FORMAT = &floppy_image_format_creator<d80_format>; |
trunk/src/lib/formats/d64_dsk.c
| r20300 | r20301 | |
| 35 | 35 | |
| 36 | 36 | formats/d64_dsk.c |
| 37 | 37 | |
| 38 | | Commodore 2040/8050/1541 sector disk image format |
| 38 | Commodore 2040/1541/1571 sector disk image format |
| 39 | 39 | |
| 40 | 40 | *********************************************************************/ |
| 41 | 41 | |
| r20300 | r20301 | |
| 44 | 44 | |
| 45 | 45 | d64_format::d64_format() |
| 46 | 46 | { |
| 47 | formats = file_formats; |
| 47 | 48 | } |
| 48 | 49 | |
| 50 | d64_format::d64_format(const format *_formats) |
| 51 | { |
| 52 | formats = _formats; |
| 53 | } |
| 54 | |
| 49 | 55 | const char *d64_format::name() const |
| 50 | 56 | { |
| 51 | 57 | return "d64"; |
| r20300 | r20301 | |
| 53 | 59 | |
| 54 | 60 | const char *d64_format::description() const |
| 55 | 61 | { |
| 56 | | return "Commodore 2040/8050/1541 disk image"; |
| 62 | return "Commodore 4040/1541/1571 disk image"; |
| 57 | 63 | } |
| 58 | 64 | |
| 59 | 65 | const char *d64_format::extensions() const |
| 60 | 66 | { |
| 61 | | return "d64,d67,d71,d80,d82"; |
| 67 | return "d64,d71"; |
| 62 | 68 | } |
| 63 | 69 | |
| 64 | | const 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 |
| 70 | const 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 |
| 67 | 73 | }, |
| 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 |
| 70 | 76 | }, |
| 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 |
| 73 | 79 | }, |
| 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 |
| 76 | 82 | }, |
| 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 | | }, |
| 86 | 83 | {} |
| 87 | 84 | }; |
| 88 | 85 | |
| 89 | | const UINT32 d64_format::dos1_cell_size[] = |
| 86 | const UINT32 d64_format::cell_size[] = |
| 90 | 87 | { |
| 91 | 88 | 4000, // 16MHz/16/4 |
| 92 | 89 | 3750, // 16MHz/15/4 |
| r20300 | r20301 | |
| 94 | 91 | 3250 // 16MHz/13/4 |
| 95 | 92 | }; |
| 96 | 93 | |
| 97 | | const UINT32 d64_format::dos25_cell_size[] = |
| 94 | const int d64_format::sectors_per_track[] = |
| 98 | 95 | { |
| 99 | | 2667, // 12MHz/16/2 |
| 100 | | 2500, // 12MHz/15/2 |
| 101 | | 2333, // 12MHz/14/2 |
| 102 | | 2167 // 12MHz/13/2 |
| 103 | | }; |
| 104 | | |
| 105 | | const int d64_format::dos1_sectors_per_track[] = |
| 106 | | { |
| 107 | 96 | 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 | | |
| 115 | | const 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 |
| 118 | 97 | 19, 19, 19, 19, 19, 19, 19, // 18-24 |
| 119 | 98 | 18, 18, 18, 18, 18, 18, // 25-30 |
| 120 | 99 | 17, 17, 17, 17, 17, // 31-35 |
| r20300 | r20301 | |
| 122 | 101 | 17, 17 // 41-42 |
| 123 | 102 | }; |
| 124 | 103 | |
| 125 | | const int d64_format::dos25_sectors_per_track[] = |
| 104 | const int d64_format::speed_zone[] = |
| 126 | 105 | { |
| 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 | | |
| 135 | | const int d64_format::dos1_speed_zone[] = |
| 136 | | { |
| 137 | 106 | 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 1-17 |
| 138 | 107 | 2, 2, 2, 2, 2, 2, 2, // 18-24 |
| 139 | 108 | 1, 1, 1, 1, 1, 1, // 25-30 |
| r20300 | r20301 | |
| 142 | 111 | 0, 0 // 41-42 |
| 143 | 112 | }; |
| 144 | 113 | |
| 145 | | const 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 | | |
| 155 | 114 | int d64_format::find_size(io_generic *io, UINT32 form_factor) |
| 156 | 115 | { |
| 157 | 116 | int size = io_generic_size(io); |
| 158 | 117 | for(int i=0; formats[i].sector_count; i++) { |
| 159 | 118 | const format &f = formats[i]; |
| 160 | | if(size == f.sector_count*SECTOR_SIZE) |
| 119 | if(size == f.sector_count*f.sector_base_size) |
| 161 | 120 | 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) |
| 163 | 122 | return i; |
| 164 | 123 | } |
| 165 | 124 | return -1; |
| r20300 | r20301 | |
| 176 | 135 | |
| 177 | 136 | int d64_format::get_physical_track(const format &f, int track) |
| 178 | 137 | { |
| 179 | | int physical_track = 0; |
| 138 | // skip halftracks |
| 139 | return track * 2; |
| 140 | } |
| 180 | 141 | |
| 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; |
| 142 | int d64_format::get_disk_id_offset(const format &f) |
| 143 | { |
| 144 | return 101144; |
| 188 | 145 | } |
| 189 | 146 | |
| 190 | 147 | void d64_format::get_disk_id(const format &f, io_generic *io, UINT8 &id1, UINT8 &id2) |
| 191 | 148 | { |
| 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 | | |
| 200 | 149 | UINT8 id[2]; |
| 201 | | io_generic_read(io, id, offset, 2); |
| 150 | io_generic_read(io, id, get_disk_id_offset(f), 2); |
| 202 | 151 | id1 = id[0]; |
| 203 | 152 | id2 = id[1]; |
| 204 | 153 | } |
| 205 | 154 | |
| 206 | 155 | UINT32 d64_format::get_cell_size(const format &f, int track) |
| 207 | 156 | { |
| 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]]; |
| 217 | 158 | } |
| 218 | 159 | |
| 219 | 160 | int d64_format::get_sectors_per_track(const format &f, int track) |
| 220 | 161 | { |
| 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]; |
| 230 | 163 | } |
| 231 | 164 | |
| 232 | 165 | floppy_image_format_t::desc_e* d64_format::get_sector_desc(const format &f, int ¤t_size, int track, int sector_count, UINT8 id1, UINT8 id2, int gap_2) |
| 233 | 166 | { |
| 234 | 167 | static floppy_image_format_t::desc_e desc[] = { |
| 235 | | /* 00 */ { SECTOR_LOOP_START, 0, sector_count-1 }, |
| 168 | /* 00 */ { SECTOR_LOOP_START, 0, -1 }, |
| 236 | 169 | /* 01 */ { RAWBYTE, 0xff, 5 }, |
| 237 | 170 | /* 02 */ { GCR5, 0x08, 1 }, |
| 238 | 171 | /* 03 */ { CRC, 1 }, |
| r20300 | r20301 | |
| 254 | 187 | /* 19 */ { RAWBYTE, 0x55, gap_2 }, |
| 255 | 188 | /* 20 */ { SECTOR_LOOP_END }, |
| 256 | 189 | /* 21 */ { RAWBYTE, 0x55, 0 }, |
| 257 | | /* 22 */ { RAWBITS, 0xffff, 0 }, |
| 190 | /* 22 */ { RAWBITS, 0x5555, 0 }, |
| 258 | 191 | /* 23 */ { END } |
| 259 | 192 | }; |
| 260 | 193 | |
| 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; |
| 263 | 195 | |
| 196 | current_size *= sector_count; |
| 264 | 197 | return desc; |
| 265 | 198 | } |
| 266 | 199 | |
| r20300 | r20301 | |
| 268 | 201 | { |
| 269 | 202 | int cur_offset = 0; |
| 270 | 203 | |
| 271 | | for(int i=0; i<f.sector_count; i++) { |
| 204 | for(int i=0; i<sector_count; i++) { |
| 272 | 205 | sectors[i].data = sectdata + cur_offset; |
| 273 | | sectors[i].size = SECTOR_SIZE; |
| 206 | sectors[i].size = f.sector_base_size; |
| 274 | 207 | sectors[i].sector_id = i; |
| 275 | 208 | sectors[i].sector_info = errordata[i]; |
| 276 | 209 | |
| r20300 | r20301 | |
| 288 | 221 | int size = io_generic_size(io); |
| 289 | 222 | UINT8 *img; |
| 290 | 223 | |
| 291 | | if(size == f.sector_count*SECTOR_SIZE) { |
| 224 | if(size == f.sector_count*f.sector_base_size) { |
| 292 | 225 | 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); |
| 294 | 227 | } |
| 295 | 228 | else { |
| 296 | 229 | img = global_alloc_array(UINT8, size); |
| r20300 | r20301 | |
| 308 | 241 | for(int head=0; head < f.head_count; head++) { |
| 309 | 242 | for(int track=0; track < f.track_count; track++) { |
| 310 | 243 | 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; |
| 312 | 248 | |
| 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 | | |
| 317 | 249 | desc = get_sector_desc(f, current_size, track+1, sector_count, id1, id2, f.gap_2); |
| 318 | 250 | |
| 319 | 251 | int remaining_size = total_size - current_size; |
| r20300 | r20301 | |
| 325 | 257 | desc[22].p2 = remaining_size & 7; |
| 326 | 258 | desc[22].p1 >>= 8-(remaining_size & 7); |
| 327 | 259 | |
| 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]); |
| 331 | 261 | generate_track(desc, physical_track, head, sectors, sector_count, total_size, image); |
| 332 | 262 | |
| 333 | 263 | track_offset += track_size; |
| r20300 | r20301 | |
| 340 | 270 | return true; |
| 341 | 271 | } |
| 342 | 272 | |
| 273 | void d64_format::extract_sectors(floppy_image *image, const format &f, desc_s *sdesc, int track, int head) |
| 274 | { |
| 275 | |
| 276 | } |
| 277 | |
| 343 | 278 | bool d64_format::save(io_generic *io, floppy_image *image) |
| 344 | 279 | { |
| 345 | 280 | return false; |
trunk/src/lib/formats/d67_dsk.c
| r0 | r20301 | |
| 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 | |
| 45 | d67_format::d67_format() : d64_format(formats) |
| 46 | { |
| 47 | } |
| 48 | |
| 49 | const char *d67_format::name() const |
| 50 | { |
| 51 | return "d67"; |
| 52 | } |
| 53 | |
| 54 | const char *d67_format::description() const |
| 55 | { |
| 56 | return "Commodore 2040 disk image"; |
| 57 | } |
| 58 | |
| 59 | const char *d67_format::extensions() const |
| 60 | { |
| 61 | return "d67"; |
| 62 | } |
| 63 | |
| 64 | const 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 | |
| 71 | const 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 | |
| 81 | int d67_format::get_sectors_per_track(const format &f, int track) |
| 82 | { |
| 83 | return sectors_per_track[track]; |
| 84 | } |
| 85 | |
| 86 | const floppy_format_type FLOPPY_D67_FORMAT = &floppy_image_format_creator<d67_format>; |