trunk/src/emu/bus/msx_cart/disk.c
| r31590 | r31591 | |
| 4 | 4 | * |
| 5 | 5 | * Currently supported: |
| 6 | 6 | * - Philips VY-0010 (Interface cartridge + 1 3.5" SS floppy drive) |
| 7 | * - Panasonic FS-FD1 - WD2793? - DSDD 3.5" Floppy drive + interface |
| 8 | * - Panasonic FS-FD1A - TC8566F - DSDD 3.5" Floppy drive with builtin interface |
| 9 | * - Rom label reads: "FDC BIOS V1.0 / COPYRIGHT MEI / 1987 DASFD1AA1" |
| 7 | 10 | * |
| 8 | 11 | * Not supported yet: |
| 9 | 12 | * - Canon VF-100 - DSDD 3.5" Floppy drive + interface + 1 floppy disk containing MSX-DOS |
| 10 | | * - Panasonic FS-FD1 - TC8566AF? - DSDD 3.5" Floppy drive + interface |
| 11 | | * - Panasonic FS-FD1A - TC8566F - DSDD 3.5" Floppy drive with builtin interface |
| 12 | | * - Rom label reads: "FDC BIOS V1.0 / COPYRIGHT MEI / 1987 DASFD1AA1" |
| 13 | * - National FS-FD351 - MB8877A - DSDD 3.5" Floppy drive + interface |
| 13 | 14 | * - Talent DPF-550/5 - WD1772 - DSDD 5.25" Floppy drive (360KB) plus interface (manufactured by Daewoo) |
| 14 | 15 | * - Rom label markings: MSX DISK / DPF 555D |
| 15 | 16 | * |
| r31590 | r31591 | |
| 31 | 32 | * - JVC HC-F303 - Floppy drive |
| 32 | 33 | * - Mitsubishi ML-30FD - DSDD 3.5" Floppy drive |
| 33 | 34 | * - Mitsubishi ML-30DC - Floppy interface |
| 34 | | * - National FS-FD351 - MB8877A - 3.5" Floppy drive + interface? |
| 35 | 35 | * - Philips NMS-1200 - Floppy interface |
| 36 | 36 | * - Philips NMS-9111 - 3.5" Floppy drive |
| 37 | 37 | * - Philips NMS-9113 - 3.5" Floppy drive |
| r31590 | r31591 | |
| 104 | 104 | |
| 105 | 105 | |
| 106 | 106 | const device_type MSX_CART_VY0010 = &device_creator<msx_cart_vy0010>; |
| 107 | const device_type MSX_CART_FSFD1 = &device_creator<msx_cart_fsfd1>; |
| 108 | const device_type MSX_CART_FSFD1A = &device_creator<msx_cart_fsfd1a>; |
| 107 | 109 | |
| 108 | 110 | |
| 109 | | FLOPPY_FORMATS_MEMBER( msx_cart_vy0010::floppy_formats ) |
| 111 | FLOPPY_FORMATS_MEMBER( msx_cart_disk::floppy_formats ) |
| 110 | 112 | FLOPPY_MSX_FORMAT |
| 111 | 113 | FLOPPY_FORMATS_END |
| 112 | 114 | |
| r31590 | r31591 | |
| 117 | 119 | SLOT_INTERFACE_END |
| 118 | 120 | |
| 119 | 121 | |
| 120 | | msx_cart_vy0010::msx_cart_vy0010(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 121 | | : device_t(mconfig, MSX_CART_VY0010, "MSX Cartridge - VY0010", tag, owner, clock, "msx_cart_vy0010", __FILE__) |
| 122 | msx_cart_disk::msx_cart_disk(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname) |
| 123 | : device_t(mconfig, type, name, tag, owner, clock, shortname, __FILE__) |
| 122 | 124 | , msx_cart_interface(mconfig, *this) |
| 123 | | , m_fdc(*this, "fdc") |
| 124 | 125 | , m_floppy0(*this, "fdc:0") |
| 125 | 126 | , m_floppy1(*this, "fdc:1") |
| 126 | 127 | , m_floppy(NULL) |
| 128 | { |
| 129 | } |
| 130 | |
| 131 | |
| 132 | msx_cart_disk_wd::msx_cart_disk_wd(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname) |
| 133 | : msx_cart_disk(mconfig, type, name, tag, owner, clock, shortname) |
| 134 | , m_fdc(*this, "fdc") |
| 135 | { |
| 136 | } |
| 137 | |
| 138 | |
| 139 | msx_cart_disk_type1::msx_cart_disk_type1(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname) |
| 140 | : msx_cart_disk_wd(mconfig, type, name, tag, owner, clock, shortname) |
| 127 | 141 | , m_control(0) |
| 128 | 142 | { |
| 129 | 143 | } |
| 130 | 144 | |
| 145 | msx_cart_vy0010::msx_cart_vy0010(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 146 | : msx_cart_disk_type1(mconfig, MSX_CART_VY0010, "MSX Cartridge - VY0010", tag, owner, clock, "msx_cart_vy0010") |
| 147 | { |
| 148 | } |
| 131 | 149 | |
| 150 | |
| 151 | msx_cart_fsfd1::msx_cart_fsfd1(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 152 | : msx_cart_disk_type1(mconfig, MSX_CART_FSFD1, "MSX Cartridge - FS-FD1", tag, owner, clock, "msx_cart_fsfd1") |
| 153 | { |
| 154 | } |
| 155 | |
| 156 | |
| 157 | msx_cart_disk_tc8566::msx_cart_disk_tc8566(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname) |
| 158 | : msx_cart_disk(mconfig, type, name, tag, owner, clock, shortname) |
| 159 | , m_fdc(*this, "fdc") |
| 160 | { |
| 161 | } |
| 162 | |
| 163 | |
| 164 | msx_cart_fsfd1a::msx_cart_fsfd1a(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 165 | : msx_cart_disk_tc8566(mconfig, MSX_CART_FSFD1A, "MSX Cartridge - FS-FD1A", tag, owner, clock, "msx_cart_fsfd1a") |
| 166 | { |
| 167 | } |
| 168 | |
| 169 | |
| 170 | void msx_cart_disk::initialize_cartridge() |
| 171 | { |
| 172 | if ( get_rom_size() != 0x4000 ) |
| 173 | { |
| 174 | fatalerror("msx_cart_disk: Invalid ROM size\n"); |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | |
| 132 | 179 | static MACHINE_CONFIG_FRAGMENT( vy0010 ) |
| 133 | 180 | // From VY-0010 schematic: |
| 134 | 181 | // HLT pulled high |
| r31590 | r31591 | |
| 138 | 185 | MCFG_WD_FDC_FORCE_READY |
| 139 | 186 | |
| 140 | 187 | // Single sided 3.5" floppy drive |
| 141 | | MCFG_FLOPPY_DRIVE_ADD("fdc:0", msx_floppies, "35ssdd", msx_cart_vy0010::floppy_formats) |
| 188 | MCFG_FLOPPY_DRIVE_ADD("fdc:0", msx_floppies, "35ssdd", msx_cart_disk::floppy_formats) |
| 142 | 189 | |
| 143 | 190 | // Attach software lists |
| 144 | 191 | // We do not know in what kind of machine the user has inserted the floppy interface |
| r31590 | r31591 | |
| 155 | 202 | } |
| 156 | 203 | |
| 157 | 204 | |
| 158 | | void msx_cart_vy0010::device_start() |
| 205 | static MACHINE_CONFIG_FRAGMENT( fsfd1 ) |
| 206 | MCFG_WD2793x_ADD("fdc", XTAL_4MHz / 4) |
| 207 | |
| 208 | // Double sided 3.5" floppy drive |
| 209 | MCFG_FLOPPY_DRIVE_ADD("fdc:0", msx_floppies, "35dd", msx_cart_disk::floppy_formats) |
| 210 | |
| 211 | // Attach software lists |
| 212 | // We do not know in what kind of machine the user has inserted the floppy interface |
| 213 | // so we list all msx floppy software lists. |
| 214 | // |
| 215 | MCFG_SOFTWARE_LIST_ADD("flop_list","msx2_flop") |
| 216 | MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("msx1_flop_list","msx1_flop") |
| 217 | MACHINE_CONFIG_END |
| 218 | |
| 219 | |
| 220 | machine_config_constructor msx_cart_fsfd1::device_mconfig_additions() const |
| 159 | 221 | { |
| 222 | return MACHINE_CONFIG_NAME( fsfd1 ); |
| 223 | } |
| 224 | |
| 225 | |
| 226 | static MACHINE_CONFIG_FRAGMENT( fsfd1a ) |
| 227 | MCFG_TC8566AF_ADD("fdc") |
| 228 | |
| 229 | // Double sided 3.5" floppy drive |
| 230 | MCFG_FLOPPY_DRIVE_ADD("fdc:0", msx_floppies, "35dd", msx_cart_disk::floppy_formats) |
| 231 | |
| 232 | // Attach software lists |
| 233 | // We do not know in what kind of machine the user has inserted the floppy interface |
| 234 | // so we list all msx floppy software lists. |
| 235 | // |
| 236 | MCFG_SOFTWARE_LIST_ADD("flop_list","msx2_flop") |
| 237 | MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("msx1_flop_list","msx1_flop") |
| 238 | MACHINE_CONFIG_END |
| 239 | |
| 240 | |
| 241 | machine_config_constructor msx_cart_fsfd1a::device_mconfig_additions() const |
| 242 | { |
| 243 | return MACHINE_CONFIG_NAME( fsfd1a ); |
| 244 | } |
| 245 | |
| 246 | |
| 247 | void msx_cart_disk_type1::device_start() |
| 248 | { |
| 160 | 249 | save_item(NAME(m_side_control)); |
| 161 | 250 | save_item(NAME(m_control)); |
| 162 | 251 | |
| 163 | | machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_vy0010::post_load), this)); |
| 252 | machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_disk_type1::post_load), this)); |
| 164 | 253 | } |
| 165 | 254 | |
| 166 | 255 | |
| 167 | | void msx_cart_vy0010::post_load() |
| 256 | void msx_cart_disk_type1::post_load() |
| 168 | 257 | { |
| 169 | 258 | UINT8 data = m_control; |
| 170 | 259 | |
| r31590 | r31591 | |
| 175 | 264 | } |
| 176 | 265 | |
| 177 | 266 | |
| 178 | | void msx_cart_vy0010::set_control(UINT8 data) |
| 267 | void msx_cart_disk_type1::set_control(UINT8 data) |
| 179 | 268 | { |
| 180 | 269 | UINT8 old_m_control = m_control; |
| 181 | 270 | |
| r31590 | r31591 | |
| 212 | 301 | } |
| 213 | 302 | |
| 214 | 303 | |
| 215 | | void msx_cart_vy0010::set_side_control(UINT8 data) |
| 304 | void msx_cart_disk_type1::set_side_control(UINT8 data) |
| 216 | 305 | { |
| 217 | 306 | m_side_control = data; |
| 218 | 307 | |
| r31590 | r31591 | |
| 223 | 312 | } |
| 224 | 313 | |
| 225 | 314 | |
| 226 | | void msx_cart_vy0010::device_reset() |
| 315 | void msx_cart_disk_type1::device_reset() |
| 227 | 316 | { |
| 228 | 317 | m_fdc->dden_w(false); |
| 229 | 318 | } |
| 230 | 319 | |
| 231 | 320 | |
| 232 | | void msx_cart_vy0010::initialize_cartridge() |
| 321 | READ8_MEMBER(msx_cart_disk_type1::read_cart) |
| 233 | 322 | { |
| 234 | | if ( get_rom_size() != 0x4000 ) |
| 235 | | { |
| 236 | | fatalerror("vy0010: Invalid ROM size\n"); |
| 237 | | } |
| 238 | | } |
| 239 | | |
| 240 | | |
| 241 | | READ8_MEMBER(msx_cart_vy0010::read_cart) |
| 242 | | { |
| 243 | 323 | switch (offset) |
| 244 | 324 | { |
| 245 | 325 | case 0x7ff8: |
| r31590 | r31591 | |
| 279 | 359 | } |
| 280 | 360 | |
| 281 | 361 | |
| 282 | | WRITE8_MEMBER(msx_cart_vy0010::write_cart) |
| 362 | WRITE8_MEMBER(msx_cart_disk_type1::write_cart) |
| 283 | 363 | { |
| 284 | 364 | switch (offset) |
| 285 | 365 | { |
| r31590 | r31591 | |
| 314 | 394 | break; |
| 315 | 395 | |
| 316 | 396 | default: |
| 317 | | logerror("msx_cart_vy0010::write_cart: Unmapped write writing %02x to %04x\n", data, offset); |
| 397 | logerror("msx_cart_disk_type1::write_cart: Unmapped write writing %02x to %04x\n", data, offset); |
| 318 | 398 | break; |
| 319 | 399 | } |
| 320 | 400 | } |
| 321 | 401 | |
| 322 | 402 | |
| 403 | void msx_cart_fsfd1a::device_start() |
| 404 | { |
| 405 | } |
| 406 | |
| 407 | |
| 408 | void msx_cart_fsfd1a::device_reset() |
| 409 | { |
| 410 | } |
| 411 | |
| 412 | |
| 413 | READ8_MEMBER(msx_cart_fsfd1a::read_cart) |
| 414 | { |
| 415 | switch (offset) |
| 416 | { |
| 417 | case 0x7ffa: |
| 418 | case 0xbffa: |
| 419 | return m_fdc->msr_r(space, 4); |
| 420 | |
| 421 | case 0x7ffb: |
| 422 | case 0xbffb: |
| 423 | return m_fdc->fifo_r(space, 5); |
| 424 | } |
| 425 | |
| 426 | if (offset >= 0x4000 && offset < 0x8000) |
| 427 | { |
| 428 | return get_rom_base()[offset & 0x3fff]; |
| 429 | } |
| 430 | return 0xff; |
| 431 | } |
| 432 | |
| 433 | |
| 434 | WRITE8_MEMBER(msx_cart_fsfd1a::write_cart) |
| 435 | { |
| 436 | switch (offset) |
| 437 | { |
| 438 | case 0x7ff8: |
| 439 | case 0xbff8: |
| 440 | m_fdc->dor_w(space, 2, data); |
| 441 | break; |
| 442 | |
| 443 | case 0x7ff9: |
| 444 | case 0xbff9: |
| 445 | m_fdc->cr1_w(space, 3, data); |
| 446 | break; |
| 447 | |
| 448 | case 0x7ffb: |
| 449 | case 0xbffb: |
| 450 | m_fdc->fifo_w(space, 5, data); |
| 451 | break; |
| 452 | |
| 453 | default: |
| 454 | logerror("msx_cart_fsfd1a::write_cart: Unmapped write writing %02x to %04x\n", data, offset); |
| 455 | break; |
| 456 | } |
| 457 | } |
| 458 | |
trunk/src/emu/bus/msx_cart/disk.h
| r31590 | r31591 | |
| 3 | 3 | |
| 4 | 4 | #include "bus/msx_cart/cartridge.h" |
| 5 | 5 | #include "machine/wd_fdc.h" |
| 6 | #include "machine/upd765.h" |
| 6 | 7 | #include "imagedev/flopdrv.h" |
| 7 | 8 | #include "imagedev/floppy.h" |
| 8 | 9 | |
| 9 | 10 | |
| 10 | 11 | extern const device_type MSX_CART_VY0010; |
| 12 | extern const device_type MSX_CART_FSFD1; |
| 13 | extern const device_type MSX_CART_FSFD1A; |
| 11 | 14 | |
| 12 | 15 | |
| 13 | | class msx_cart_vy0010 : public device_t |
| 16 | class msx_cart_disk : public device_t |
| 14 | 17 | , public msx_cart_interface |
| 15 | 18 | { |
| 16 | 19 | public: |
| 17 | | msx_cart_vy0010(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 20 | msx_cart_disk(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname); |
| 18 | 21 | |
| 22 | virtual void initialize_cartridge(); |
| 23 | |
| 24 | DECLARE_FLOPPY_FORMATS(floppy_formats); |
| 25 | |
| 26 | protected: |
| 27 | required_device<floppy_connector> m_floppy0; |
| 28 | optional_device<floppy_connector> m_floppy1; |
| 29 | floppy_image_device *m_floppy; |
| 30 | }; |
| 31 | |
| 32 | |
| 33 | class msx_cart_disk_wd : public msx_cart_disk |
| 34 | { |
| 35 | public: |
| 36 | msx_cart_disk_wd(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname); |
| 37 | |
| 38 | protected: |
| 39 | required_device<wd_fdc_analog_t> m_fdc; |
| 40 | }; |
| 41 | |
| 42 | |
| 43 | class msx_cart_disk_type1 : public msx_cart_disk_wd |
| 44 | { |
| 45 | public: |
| 46 | msx_cart_disk_type1(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname); |
| 47 | |
| 19 | 48 | // device-level overrides |
| 20 | 49 | virtual void device_start(); |
| 21 | 50 | virtual void device_reset(); |
| 22 | | virtual machine_config_constructor device_mconfig_additions() const; |
| 23 | 51 | |
| 24 | | virtual void initialize_cartridge(); |
| 25 | | |
| 26 | 52 | virtual DECLARE_READ8_MEMBER(read_cart); |
| 27 | 53 | virtual DECLARE_WRITE8_MEMBER(write_cart); |
| 28 | 54 | |
| 29 | 55 | void post_load(); |
| 30 | 56 | |
| 31 | | DECLARE_FLOPPY_FORMATS(floppy_formats); |
| 32 | | |
| 33 | | private: |
| 34 | | required_device<wd_fdc_analog_t> m_fdc; |
| 35 | | required_device<floppy_connector> m_floppy0; |
| 36 | | optional_device<floppy_connector> m_floppy1; |
| 37 | | floppy_image_device *m_floppy; |
| 38 | | |
| 57 | protected: |
| 39 | 58 | UINT8 m_side_control; |
| 40 | 59 | UINT8 m_control; |
| 41 | 60 | |
| r31590 | r31591 | |
| 44 | 63 | }; |
| 45 | 64 | |
| 46 | 65 | |
| 66 | class msx_cart_vy0010 : public msx_cart_disk_type1 |
| 67 | { |
| 68 | public: |
| 69 | msx_cart_vy0010(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 70 | |
| 71 | virtual machine_config_constructor device_mconfig_additions() const; |
| 72 | }; |
| 73 | |
| 74 | |
| 75 | class msx_cart_fsfd1 : public msx_cart_disk_type1 |
| 76 | { |
| 77 | public: |
| 78 | msx_cart_fsfd1(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 79 | |
| 80 | virtual machine_config_constructor device_mconfig_additions() const; |
| 81 | }; |
| 82 | |
| 83 | |
| 84 | class msx_cart_disk_tc8566 : public msx_cart_disk |
| 85 | { |
| 86 | public: |
| 87 | msx_cart_disk_tc8566(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname); |
| 88 | |
| 89 | protected: |
| 90 | required_device<tc8566af_device> m_fdc; |
| 91 | }; |
| 92 | |
| 93 | |
| 94 | class msx_cart_fsfd1a : public msx_cart_disk_tc8566 |
| 95 | { |
| 96 | public: |
| 97 | msx_cart_fsfd1a(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 98 | |
| 99 | // device-level overrides |
| 100 | virtual void device_start(); |
| 101 | virtual void device_reset(); |
| 102 | virtual machine_config_constructor device_mconfig_additions() const; |
| 103 | |
| 104 | virtual DECLARE_READ8_MEMBER(read_cart); |
| 105 | virtual DECLARE_WRITE8_MEMBER(write_cart); |
| 106 | |
| 107 | private: |
| 108 | |
| 109 | }; |
| 110 | |
| 111 | |
| 47 | 112 | #endif |