src/lib/formats/esq8_dsk.c
| r0 | r15474 | |
| 1 | /********************************************************************* |
| 2 | |
| 3 | formats/esq8_dsk.c |
| 4 | |
| 5 | Formats for 8-bit Ensoniq synthesizers and samplers |
| 6 | |
| 7 | Disk is PC MFM, 40 tracks, single (Mirage) or double (SQ-80) sided, |
| 8 | with 6 sectors per track. |
| 9 | Sectors 0-4 are 1024 bytes, sector 5 is 512 bytes |
| 10 | |
| 11 | *********************************************************************/ |
| 12 | |
| 13 | #include "emu.h" |
| 14 | #include "flopimg.h" |
| 15 | #include "formats/esq8_dsk.h" |
| 16 | |
| 17 | const floppy_image_format_t::desc_e esq8img_format::esq_6_desc[] = { |
| 18 | { MFM, 0x4e, 80 }, |
| 19 | { MFM, 0x00, 12 }, |
| 20 | { RAW, 0x5224, 3 }, |
| 21 | { MFM, 0xfc, 1 }, |
| 22 | { MFM, 0x4e, 50 }, |
| 23 | { MFM, 0x00, 12 }, |
| 24 | { SECTOR_LOOP_START, 0, 5 }, |
| 25 | { CRC_CCITT_START, 1 }, |
| 26 | { RAW, 0x4489, 3 }, |
| 27 | { MFM, 0xfe, 1 }, |
| 28 | { TRACK_ID }, |
| 29 | { HEAD_ID }, |
| 30 | { SECTOR_ID }, |
| 31 | { SIZE_ID }, |
| 32 | { CRC_END, 1 }, |
| 33 | { CRC, 1 }, |
| 34 | { MFM, 0x4e, 22 }, |
| 35 | { MFM, 0x00, 12 }, |
| 36 | { CRC_CCITT_START, 2 }, |
| 37 | { RAW, 0x4489, 3 }, |
| 38 | { MFM, 0xfb, 1 }, |
| 39 | { SECTOR_DATA, -1 }, |
| 40 | { CRC_END, 2 }, |
| 41 | { CRC, 2 }, |
| 42 | { MFM, 0x4e, 84 }, |
| 43 | { MFM, 0x00, 12 }, |
| 44 | { SECTOR_LOOP_END }, |
| 45 | { MFM, 0x4e, 170 }, |
| 46 | { END } |
| 47 | }; |
| 48 | |
| 49 | esq8img_format::esq8img_format() |
| 50 | { |
| 51 | } |
| 52 | |
| 53 | const char *esq8img_format::name() const |
| 54 | { |
| 55 | return "img"; |
| 56 | } |
| 57 | |
| 58 | const char *esq8img_format::description() const |
| 59 | { |
| 60 | return "Ensoniq Mirage/SQ-80 floppy disk image"; |
| 61 | } |
| 62 | |
| 63 | const char *esq8img_format::extensions() const |
| 64 | { |
| 65 | return "img"; |
| 66 | } |
| 67 | |
| 68 | bool esq8img_format::supports_save() const |
| 69 | { |
| 70 | return true; |
| 71 | } |
| 72 | |
| 73 | void esq8img_format::find_size(io_generic *io, int &track_count, int &head_count, int §or_count) |
| 74 | { |
| 75 | int size = io_generic_size(io); |
| 76 | track_count = 80; |
| 77 | head_count = 1; |
| 78 | sector_count = 6; |
| 79 | |
| 80 | if (size == 5632 * 80) |
| 81 | { |
| 82 | return; |
| 83 | } |
| 84 | |
| 85 | track_count = head_count = sector_count = 0; |
| 86 | } |
| 87 | |
| 88 | int esq8img_format::identify(io_generic *io, UINT32 form_factor) |
| 89 | { |
| 90 | int track_count, head_count, sector_count; |
| 91 | find_size(io, track_count, head_count, sector_count); |
| 92 | |
| 93 | if(track_count) |
| 94 | return 50; |
| 95 | return 0; |
| 96 | } |
| 97 | |
| 98 | bool esq8img_format::load(io_generic *io, UINT32 form_factor, floppy_image *image) |
| 99 | { |
| 100 | int track_count, head_count, sector_count; |
| 101 | find_size(io, track_count, head_count, sector_count); |
| 102 | |
| 103 | UINT8 sectdata[(5*1024) + 512]; |
| 104 | desc_s sectors[6]; |
| 105 | for(int i=0; i<sector_count; i++) { |
| 106 | if (i < 5) |
| 107 | { |
| 108 | sectors[i].data = sectdata + (1024*i); // 5 1024 byte sectors |
| 109 | sectors[i].size = 1024; |
| 110 | sectors[i].sector_id = i; |
| 111 | } |
| 112 | else |
| 113 | { |
| 114 | sectors[i].data = sectdata + (5*1024); // 1 512 byte sector |
| 115 | sectors[i].size = 512; |
| 116 | sectors[i].sector_id = i; |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | int track_size = (5*1024) + 512; |
| 121 | |
| 122 | for(int track=0; track < track_count; track++) |
| 123 | { |
| 124 | for(int head=0; head < head_count; head++) |
| 125 | { |
| 126 | io_generic_read(io, sectdata, (track*head_count + head)*track_size, track_size); |
| 127 | generate_track(esq_6_desc, track, head, sectors, sector_count, 109376, image); |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | image->set_variant(floppy_image::DSDD); |
| 132 | |
| 133 | return true; |
| 134 | } |
| 135 | |
| 136 | bool esq8img_format::save(io_generic *io, floppy_image *image) |
| 137 | { |
| 138 | int track_count, head_count, sector_count; |
| 139 | get_geometry_mfm_pc(image, 2000, track_count, head_count, sector_count); |
| 140 | |
| 141 | if(track_count != 80) |
| 142 | track_count = 80; |
| 143 | |
| 144 | // Happens for a fully unformatted floppy |
| 145 | if(!head_count) |
| 146 | head_count = 1; |
| 147 | |
| 148 | if(sector_count != 6) |
| 149 | sector_count = 6; |
| 150 | |
| 151 | UINT8 sectdata[10*512]; |
| 152 | int track_size = (5*1024) + 512; |
| 153 | |
| 154 | for(int track=0; track < track_count; track++) { |
| 155 | for(int head=0; head < head_count; head++) { |
| 156 | get_track_data_mfm_pc(track, head, image, 2000, 512, sector_count, sectdata); |
| 157 | io_generic_write(io, sectdata, (track*head_count + head)*track_size, track_size); |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | return true; |
| 162 | } |
| 163 | |
| 164 | const floppy_format_type FLOPPY_ESQ8IMG_FORMAT = &floppy_image_format_creator<esq8img_format>; |
src/mess/drivers/mirage.c
| r15473 | r15474 | |
| 29 | 29 | 08 | | |
| 30 | 30 | _____ |
| 31 | 31 | 10 |
| 32 | | |
| 32 | 76543210 |
| 33 | 33 | PORT A: 111xyzzz |
| 34 | |
| 35 | PA4/PA5 are the "enable" for the two LEDs |
| 36 | |
| 37 | 7seg Display Bits |
| 38 | '0' %11111100 $FC |
| 39 | '1' %01100000 $60 |
| 40 | '2' %11011010 $DA |
| 41 | '3' %11110010 $F2 |
| 42 | '4' %01100110 $66 |
| 43 | '5' %10110110 $B6 |
| 44 | '6' %10111110 $BE |
| 45 | '7' %11100000 $E0 |
| 46 | '8' %11111110 $FE |
| 47 | '9' %11100110 $E6 |
| 48 | 'A' %11101110 $EE |
| 49 | 'b' %00111110 $3E |
| 50 | 'C' %10011100 $9C |
| 51 | 'd' %01111010 $7A |
| 52 | 'E' %10011110 $9E |
| 53 | 'F' %10001110 $8E |
| 54 | 'L' %00011100 $1C |
| 55 | 'n' %00101010 $2A |
| 56 | 'o' %00111010 $3A |
| 57 | 'P' %11001110 $CE |
| 58 | 'r' %00001010 $0A |
| 59 | 'U' %01111100 $7C |
| 60 | 'c' %00011010 $1A |
| 61 | 'u' %01111000 $38 |
| 34 | 62 | |
| 35 | | |
| 36 | 63 | ***************************************************************************/ |
| 37 | 64 | |
| 38 | 65 | |
| r15473 | r15474 | |
| 40 | 67 | #include "cpu/m6809/m6809.h" |
| 41 | 68 | #include "machine/6850acia.h" |
| 42 | 69 | #include "machine/6522via.h" |
| 43 | | #include "machine/wd17xx.h" |
| 44 | | #include "imagedev/flopdrv.h" |
| 45 | | #include "formats/basicdsk.h" |
| 70 | #include "machine/wd1772.h" |
| 71 | #include "formats/esq8_dsk.h" |
| 72 | #include "formats/mfi_dsk.h" |
| 73 | #include "formats/dfi_dsk.h" |
| 74 | #include "formats/ipf_dsk.h" |
| 46 | 75 | #include "sound/es5503.h" |
| 47 | 76 | |
| 48 | 77 | class mirage_state : public driver_device |
| 49 | 78 | { |
| 50 | 79 | public: |
| 51 | 80 | mirage_state(const machine_config &mconfig, device_type type, const char *tag) |
| 52 | | : driver_device(mconfig, type, tag) { } |
| 81 | : driver_device(mconfig, type, tag), |
| 82 | m_maincpu(*this, "maincpu"), |
| 83 | m_fdc(*this, "wd1772") |
| 84 | { } |
| 53 | 85 | |
| 86 | required_device<device_t> m_maincpu; |
| 87 | required_device<wd1772_t> m_fdc; |
| 88 | |
| 54 | 89 | virtual void machine_reset(); |
| 55 | 90 | |
| 56 | 91 | int last_sndram_bank; |
| 92 | |
| 93 | static const floppy_format_type floppy_formats[]; |
| 94 | |
| 95 | void fdc_intrq_w(bool state); |
| 57 | 96 | }; |
| 58 | 97 | |
| 98 | const floppy_format_type mirage_state::floppy_formats[] = { |
| 99 | FLOPPY_ESQ8IMG_FORMAT, FLOPPY_IPF_FORMAT, FLOPPY_MFI_FORMAT, FLOPPY_DFI_FORMAT, |
| 100 | NULL |
| 101 | }; |
| 59 | 102 | |
| 103 | static SLOT_INTERFACE_START( ensoniq_floppies ) |
| 104 | SLOT_INTERFACE( "35dd", FLOPPY_35_DD ) |
| 105 | SLOT_INTERFACE_END |
| 106 | |
| 107 | void mirage_state::fdc_intrq_w(bool state) |
| 108 | { |
| 109 | device_set_input_line(m_maincpu, INPUT_LINE_NMI, state); |
| 110 | } |
| 111 | |
| 60 | 112 | static void mirage_doc_irq(device_t *device, int state) |
| 61 | 113 | { |
| 62 | 114 | } |
| r15473 | r15474 | |
| 84 | 136 | static ADDRESS_MAP_START( mirage_map, AS_PROGRAM, 8, mirage_state ) |
| 85 | 137 | AM_RANGE(0x0000, 0x7fff) AM_ROMBANK("sndbank") // 32k window on 128k of wave RAM |
| 86 | 138 | AM_RANGE(0x8000, 0xbfff) AM_RAM // main RAM |
| 139 | AM_RANGE(0xc000, 0xdfff) AM_RAM // expansion RAM |
| 87 | 140 | AM_RANGE(0xe100, 0xe100) AM_DEVREADWRITE("acia6850", acia6850_device, status_read, control_write) |
| 88 | 141 | AM_RANGE(0xe101, 0xe101) AM_DEVREADWRITE("acia6850", acia6850_device, data_read, data_write) |
| 89 | 142 | AM_RANGE(0xe200, 0xe2ff) AM_DEVREADWRITE("via6522", via6522_device, read, write) |
| 90 | | AM_RANGE(0xe800, 0xe800) AM_DEVREADWRITE_LEGACY("wd177x", wd17xx_status_r,wd17xx_command_w) |
| 91 | | AM_RANGE(0xe801, 0xe801) AM_DEVREADWRITE_LEGACY("wd177x", wd17xx_track_r,wd17xx_track_w) |
| 92 | | AM_RANGE(0xe802, 0xe802) AM_DEVREADWRITE_LEGACY("wd177x", wd17xx_sector_r,wd17xx_sector_w) |
| 93 | | AM_RANGE(0xe803, 0xe803) AM_DEVREADWRITE_LEGACY("wd177x", wd17xx_data_r,wd17xx_data_w) |
| 94 | | // AM_RANGE(0xec00, 0xecef) AM_DEVREADWRITE("es5503", es5503_device, read, write) |
| 143 | AM_RANGE(0xe800, 0xe803) AM_DEVREADWRITE("wd1772", wd1772_t, read, write) |
| 144 | AM_RANGE(0xec00, 0xecef) AM_DEVREADWRITE("es5503", es5503_device, read, write) |
| 95 | 145 | AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION("osrom", 0) |
| 96 | 146 | ADDRESS_MAP_END |
| 97 | 147 | |
| r15473 | r15474 | |
| 192 | 242 | DEVCB_CPU_INPUT_LINE("maincpu", M6809_FIRQ_LINE) |
| 193 | 243 | }; |
| 194 | 244 | |
| 195 | | static LEGACY_FLOPPY_OPTIONS_START(mirage) |
| 196 | | LEGACY_FLOPPY_OPTION(mirage, "img", "Mirage disk image", basicdsk_identify_default, basicdsk_construct_default, NULL, |
| 197 | | HEADS([1]) |
| 198 | | TRACKS([80]) |
| 199 | | SECTORS([5]) |
| 200 | | SECTOR_LENGTH([512]) |
| 201 | | FIRST_SECTOR_ID([0])) |
| 202 | | LEGACY_FLOPPY_OPTIONS_END |
| 203 | | |
| 204 | | static const floppy_interface mirage_floppy_interface = |
| 205 | | { |
| 206 | | DEVCB_NULL, |
| 207 | | DEVCB_NULL, |
| 208 | | DEVCB_NULL, |
| 209 | | DEVCB_NULL, |
| 210 | | DEVCB_NULL, |
| 211 | | FLOPPY_STANDARD_3_5_DSDD, |
| 212 | | LEGACY_FLOPPY_OPTIONS_NAME(mirage), |
| 213 | | NULL, |
| 214 | | NULL |
| 215 | | }; |
| 216 | | |
| 217 | | const wd17xx_interface mirage_wd17xx_interface = |
| 218 | | { |
| 219 | | DEVCB_NULL, // dden |
| 220 | | DEVCB_CPU_INPUT_LINE("maincpu", INPUT_LINE_NMI), // intrq |
| 221 | | DEVCB_NULL, // drq |
| 222 | | {FLOPPY_0, NULL, NULL, NULL} |
| 223 | | }; |
| 224 | | |
| 225 | 245 | static MACHINE_CONFIG_START( mirage, mirage_state ) |
| 226 | 246 | MCFG_CPU_ADD("maincpu", M6809E, 4000000) |
| 227 | 247 | MCFG_CPU_PROGRAM_MAP(mirage_map) |
| r15473 | r15474 | |
| 242 | 262 | |
| 243 | 263 | MCFG_ACIA6850_ADD("acia6850", mirage_acia6850_interface) |
| 244 | 264 | |
| 245 | | MCFG_WD1770_ADD("wd177x", mirage_wd17xx_interface ) |
| 246 | | MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(mirage_floppy_interface) |
| 265 | MCFG_WD1772x_ADD("wd1772", 8000000) |
| 266 | MCFG_FLOPPY_DRIVE_ADD("fd0", ensoniq_floppies, "35dd", 0, mirage_state::floppy_formats) |
| 247 | 267 | MACHINE_CONFIG_END |
| 248 | 268 | |
| 249 | 269 | static INPUT_PORTS_START( mirage ) |
| r15473 | r15474 | |
| 256 | 276 | ROM_REGION(0x20000, "es5503", ROMREGION_ERASE) |
| 257 | 277 | ROM_END |
| 258 | 278 | |
| 259 | | CONS( 1984, enmirage, 0, 0, mirage, mirage, 0, "Ensoniq", "Ensoniq Mirage", GAME_NOT_WORKING ) |
| 279 | static DRIVER_INIT(mirage) |
| 280 | { |
| 281 | mirage_state *state = machine.driver_data<mirage_state>(); |
| 260 | 282 | |
| 283 | floppy_connector *con = machine.device<floppy_connector>("fd0"); |
| 284 | floppy_image_device *floppy = con ? con->get_device() : 0; |
| 285 | if (floppy) |
| 286 | { |
| 287 | state->m_fdc->set_floppy(floppy); |
| 288 | state->m_fdc->setup_intrq_cb(wd1772_t::line_cb(FUNC(mirage_state::fdc_intrq_w), state)); |
| 289 | |
| 290 | floppy->ss_w(0); |
| 291 | } |
| 292 | } |
| 293 | |
| 294 | CONS( 1984, enmirage, 0, 0, mirage, mirage, mirage, "Ensoniq", "Ensoniq Mirage", GAME_NOT_WORKING ) |
| 295 | |