diff options
author | 2017-04-13 02:38:28 +0200 | |
---|---|---|
committer | 2017-04-13 10:38:28 +1000 | |
commit | fee8cc71355a19792e5f9a9f691e49176cf80d91 (patch) | |
tree | a7cc3079bfe279c71af88a48f75b557d00beff33 | |
parent | 490d00afb7024a53e16511f98bfff82e4185bd3e (diff) |
[thomson] fix regressions to (legacy) floppy support (#2224)
* [thomson] fix legacy floppy support
* [thomson] more (legacy) floppy fixes
-rw-r--r-- | src/lib/formats/thom_dsk.cpp | 123 | ||||
-rw-r--r-- | src/mame/drivers/thomson.cpp | 10 |
2 files changed, 92 insertions, 41 deletions
diff --git a/src/lib/formats/thom_dsk.cpp b/src/lib/formats/thom_dsk.cpp index a7c5cc6d433..2b9f6a79d36 100644 --- a/src/lib/formats/thom_dsk.cpp +++ b/src/lib/formats/thom_dsk.cpp @@ -351,43 +351,94 @@ static FLOPPY_CONSTRUCT(qdd_dsk_construct) /* ----------------------------------------------------------------------- */ + +static floperr_t fd_identify(floppy_image_legacy *floppy, int *vote, int tracks, int sector_size) +{ + uint64_t expected_size; + expected_size = sector_size; + expected_size *= tracks; + expected_size *= 16; /* secetors */ + *vote = (floppy_image_size(floppy) == expected_size) ? 100 : 50; + return FLOPPY_ERROR_SUCCESS; +} + +static floperr_t fd_construct(floppy_image_legacy *floppy, int tracks, int sector_size) +{ + struct basicdsk_geometry geometry; + memset(&geometry, 0, sizeof(geometry)); + geometry.heads = 1; + geometry.first_sector_id = 1; + geometry.sector_length = sector_size; + geometry.tracks = tracks; + geometry.sectors = 16; + return basicdsk_construct(floppy, &geometry); +} + + +static FLOPPY_IDENTIFY(fd_80_256_identify) +{ + return fd_identify(floppy, vote, 80, 256); +} + +static FLOPPY_CONSTRUCT(fd_80_256_construct) +{ + return fd_construct(floppy, 80, 256); +} + +static FLOPPY_IDENTIFY(fd_40_256_identify) +{ + return fd_identify(floppy, vote, 40, 256); +} + +static FLOPPY_CONSTRUCT(fd_40_256_construct) +{ + return fd_construct(floppy, 40, 256); +} + +static FLOPPY_IDENTIFY(fd_80_128_identify) +{ + return fd_identify(floppy, vote, 80, 128); +} + +static FLOPPY_CONSTRUCT(fd_80_128_construct) +{ + return fd_construct(floppy, 80, 128); +} + +static FLOPPY_IDENTIFY(fd_40_128_identify) +{ + return fd_identify(floppy, vote, 40, 128); +} + +static FLOPPY_CONSTRUCT(fd_40_128_construct) +{ + return fd_construct(floppy, 40, 128); +} + + +/* ----------------------------------------------------------------------- */ + LEGACY_FLOPPY_OPTIONS_START(thomson) - LEGACY_FLOPPY_OPTION(fdmfm2, "fd", "Thomson FD (MFM) 80 tracks disk image (3\"1/2 DD)", basicdsk_identify_default, basicdsk_construct_default, nullptr, - HEADS([1]) - TRACKS([80]) - SECTORS([16]) - SECTOR_LENGTH([256]) - FIRST_SECTOR_ID([1])) - - LEGACY_FLOPPY_OPTION(fdmfm, "fd", "Thomson FD (MFM) 40 tracks disk image (5\"1/4 DD)", basicdsk_identify_default, basicdsk_construct_default, nullptr, - HEADS([1]) - TRACKS([40]) - SECTORS([16]) - SECTOR_LENGTH([256]) - FIRST_SECTOR_ID([1])) - - LEGACY_FLOPPY_OPTION(fd2, "fd", "Thomson FD (FM) 80 tracks disk image (3\"1/2 SD)", basicdsk_identify_default, basicdsk_construct_default, nullptr, - HEADS([1]) - TRACKS([80]) - SECTORS([16]) - SECTOR_LENGTH([128]) - FIRST_SECTOR_ID([1])) - - LEGACY_FLOPPY_OPTION(fd, "fd", "Thomson FD (FM) 40 tracks disk image (5\"1/4 SD)", basicdsk_identify_default, basicdsk_construct_default, nullptr, - HEADS([1]) - TRACKS([40]) - SECTORS([16]) - SECTOR_LENGTH([128]) - FIRST_SECTOR_ID([1])) - - LEGACY_FLOPPY_OPTION(sap,"sap", "Thomson SAP floppy disk image", sap_dsk_identify, sap_dsk_construct, nullptr, nullptr) - - LEGACY_FLOPPY_OPTION(qdd,"qd", "Thomson QDD floppy disk image (2\"8 SD)", qdd_dsk_identify, qdd_dsk_construct, nullptr, - HEADS([1]) - TRACKS([1]) - SECTORS([400]) - SECTOR_LENGTH([128]) - FIRST_SECTOR_ID([0])) +LEGACY_FLOPPY_OPTION(fdmfm2, "fd", "Thomson FD (MFM) 80 tracks disk image (3\"1/2 DD)", + fd_80_256_identify, fd_80_256_construct, nullptr, nullptr) + +// Note: no way to distinguish between FD files for 5"1/4 DD and 3"1/2 SD actually, as they have the same size +// however, we expect 3"1/2 SD to be rather rare, so, we simply put it after 5"1/4 DD + +LEGACY_FLOPPY_OPTION(fdmfm, "fd", "Thomson FD (MFM) 40 tracks disk image (5\"1/4 DD)", + fd_40_256_identify, fd_40_256_construct, nullptr, nullptr) + +LEGACY_FLOPPY_OPTION(fd2, "fd", "Thomson FD (FM) 80 tracks disk image (3\"1/2 SD)", + fd_80_128_identify, fd_80_128_construct, nullptr, nullptr) + +LEGACY_FLOPPY_OPTION(fd, "fd", "Thomson FD (FM) 40 tracks disk image (5\"1/4 SD)", + fd_40_128_identify, fd_40_128_construct, nullptr, nullptr) + +LEGACY_FLOPPY_OPTION(sap,"sap", "Thomson SAP floppy disk image", + sap_dsk_identify, sap_dsk_construct, nullptr, nullptr) + +LEGACY_FLOPPY_OPTION(qdd,"qd", "Thomson QDD floppy disk image (2\"8 SD)", + qdd_dsk_identify, qdd_dsk_construct, nullptr, nullptr) LEGACY_FLOPPY_OPTIONS_END diff --git a/src/mame/drivers/thomson.cpp b/src/mame/drivers/thomson.cpp index 543d0303d0b..9ad31195579 100644 --- a/src/mame/drivers/thomson.cpp +++ b/src/mame/drivers/thomson.cpp @@ -669,11 +669,6 @@ static MACHINE_CONFIG_START( to7, thomson_state ) /* floppy */ MCFG_DEVICE_ADD("mc6843", MC6843, 0) - MCFG_WD2793_ADD("wd2793", XTAL_1MHz) - - MCFG_FLOPPY_DRIVE_ADD("wd2793:0", cd90_640_floppies, "dd", thomson_state::cd90_640_formats) - MCFG_FLOPPY_DRIVE_ADD("wd2793:1", cd90_640_floppies, "dd", thomson_state::cd90_640_formats) - MCFG_DEVICE_ADD(FLOPPY_0, LEGACY_FLOPPY, 0) MCFG_LEGACY_FLOPPY_CONFIG(thomson_floppy_interface) MCFG_LEGACY_FLOPPY_IDX_CB(WRITELINE(thomson_state, fdc_index_0_w)) @@ -687,6 +682,11 @@ static MACHINE_CONFIG_START( to7, thomson_state ) MCFG_LEGACY_FLOPPY_CONFIG(thomson_floppy_interface) MCFG_LEGACY_FLOPPY_IDX_CB(WRITELINE(thomson_state, fdc_index_3_w)) + MCFG_WD2793_ADD("wd2793", XTAL_1MHz) + MCFG_FLOPPY_DRIVE_ADD("wd2793:0", cd90_640_floppies, "dd", thomson_state::cd90_640_formats) + MCFG_FLOPPY_DRIVE_ADD("wd2793:1", cd90_640_floppies, "dd", thomson_state::cd90_640_formats) + + /* network */ MCFG_DEVICE_ADD( "mc6854", MC6854, 0 ) MCFG_MC6854_OUT_FRAME_CB(thomson_state, to7_network_got_frame) |