summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Nigel Barnes <Pernod70@users.noreply.github.com>2017-10-11 11:56:13 +0100
committer Nigel Barnes <Pernod70@users.noreply.github.com>2017-10-11 12:03:01 +0100
commit72ec5336d05546db318ac1c738963403f567b324 (patch)
tree631c634956d10938a6b09223a56cd9fd423fd6b2
parenta02ec54132ed002a58f6198053c99481e8004c90 (diff)
acorn_dsk: Removed CPN format, now handled with SSD/DSD.
-rw-r--r--src/devices/bus/bbc/fdc/acorn.cpp1
-rw-r--r--src/lib/formats/acorn_dsk.cpp84
-rw-r--r--src/lib/formats/acorn_dsk.h16
-rw-r--r--src/mame/drivers/bbc.cpp28
4 files changed, 36 insertions, 93 deletions
diff --git a/src/devices/bus/bbc/fdc/acorn.cpp b/src/devices/bus/bbc/fdc/acorn.cpp
index ebc5d2a40aa..20fcd44257b 100644
--- a/src/devices/bus/bbc/fdc/acorn.cpp
+++ b/src/devices/bus/bbc/fdc/acorn.cpp
@@ -26,7 +26,6 @@ DEFINE_DEVICE_TYPE(BBC_ACORN1770, bbc_acorn1770_device, "bbc_acorn1770", "Acorn
FLOPPY_FORMATS_MEMBER( bbc_acorn8271_device::floppy_formats )
FLOPPY_ACORN_SSD_FORMAT,
FLOPPY_ACORN_DSD_FORMAT,
- FLOPPY_TORCH_CPN_FORMAT,
FLOPPY_FSD_FORMAT
FLOPPY_FORMATS_END0
diff --git a/src/lib/formats/acorn_dsk.cpp b/src/lib/formats/acorn_dsk.cpp
index 93b9f400db0..59fb07d0a27 100644
--- a/src/lib/formats/acorn_dsk.cpp
+++ b/src/lib/formats/acorn_dsk.cpp
@@ -33,18 +33,23 @@ int acorn_ssd_format::find_size(io_generic *io, uint32_t form_factor)
{
uint8_t cat[8];
uint32_t sectors0, sectors2;
-
- // read sector count from side 0 catalogue
- io_generic_read(io, cat, 0x100, 8);
- sectors0 = ((cat[6] & 3) << 8) + cat[7];
- LOG_FORMATS("ssd: sector count 0: %d %s\n", sectors0, sectors0 % 10 != 0 ? "invalid" : "");
-
uint64_t size = io_generic_size(io);
+
for(int i=0; formats[i].form_factor; i++) {
const format &f = formats[i];
if(form_factor != floppy_image::FF_UNKNOWN && form_factor != f.form_factor)
continue;
+ // test for Torch CPN - test pattern at sector &0018
+ io_generic_read(io, cat, 0x32800, 8);
+ if (memcmp(cat, "\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd", 4) == 0 && size == (uint64_t)compute_track_size(f) * f.track_count * f.head_count)
+ return i;
+
+ // read sector count from side 0 catalogue
+ io_generic_read(io, cat, 0x100, 8);
+ sectors0 = ((cat[6] & 3) << 8) + cat[7];
+ LOG_FORMATS("ssd: sector count 0: %d %s\n", sectors0, sectors0 % 10 != 0 ? "invalid" : "");
+
if ((size <= (uint64_t)compute_track_size(f) * f.track_count * f.head_count) && (sectors0 <= f.track_count * f.sector_count)) {
if (f.head_count == 2)
{
@@ -133,18 +138,23 @@ int acorn_dsd_format::find_size(io_generic *io, uint32_t form_factor)
{
uint8_t cat[8];
uint32_t sectors0, sectors2;
-
- // read sector count from side 0 catalogue
- io_generic_read(io, cat, 0x100, 8);
- sectors0 = ((cat[6] & 3) << 8) + cat[7];
- LOG_FORMATS("dsd: sector count 0: %d %s\n", sectors0, sectors0 % 10 != 0 ? "invalid" : "");
-
uint64_t size = io_generic_size(io);
+
for (int i = 0; formats[i].form_factor; i++) {
const format &f = formats[i];
if (form_factor != floppy_image::FF_UNKNOWN && form_factor != f.form_factor)
continue;
+ // test for Torch CPN - test pattern at sector &0018
+ io_generic_read(io, cat, 0x1200, 8);
+ if (memcmp(cat, "\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd", 4) == 0 && size == (uint64_t)compute_track_size(f) * f.track_count * f.head_count)
+ return i;
+
+ // read sector count from side 0 catalogue
+ io_generic_read(io, cat, 0x100, 8);
+ sectors0 = ((cat[6] & 3) << 8) + cat[7];
+ LOG_FORMATS("dsd: sector count 0: %d %s\n", sectors0, sectors0 % 10 != 0 ? "invalid" : "");
+
if ((size <= (uint64_t)compute_track_size(f) * f.track_count * f.head_count) && (sectors0 <= f.track_count * f.sector_count)) {
// read sector count from side 2 catalogue
io_generic_read(io, cat, 0xb00, 8); // interleaved
@@ -593,7 +603,7 @@ bool opus_ddcpm_format::load(io_generic *io, uint32_t form_factor, floppy_image
spt = 10;
desc_pc_sector sects[10];
uint8_t sectdata[10*512];
-
+
io_generic_read(io, sectdata, head * 80 * spt * 512 + track * spt * 512, spt * 512);
for (int i = 0; i < spt; i++) {
@@ -623,53 +633,6 @@ bool opus_ddcpm_format::save(io_generic *io, floppy_image *image)
}
-torch_cpn_format::torch_cpn_format() : wd177x_format(formats)
-{
-}
-
-const char *torch_cpn_format::name() const
-{
- return "cpn";
-}
-
-const char *torch_cpn_format::description() const
-{
- return "Torch CPN disk image";
-}
-
-const char *torch_cpn_format::extensions() const
-{
- return "dsd";
-}
-
-int torch_cpn_format::identify(io_generic *io, uint32_t form_factor)
-{
- int type = find_size(io, form_factor);
-
- if (type != -1)
- return 50;
- LOG_FORMATS("cpn: no match\n");
- return 0;
-}
-
-int torch_cpn_format::get_image_offset(const format &f, int head, int track)
-{
- if (f.sector_base_id == -1)
- return (track * f.head_count + head) * compute_track_size(f);
- else
- return (f.track_count * head + track) * compute_track_size(f);
-}
-
-const torch_cpn_format::format torch_cpn_format::formats[] =
-{
- { // 400k 80 track double sided single density (interleaved) - gaps unverified
- floppy_image::FF_525, floppy_image::DSQD, floppy_image::FM,
- 4000, 10, 80, 2, 256, {}, -1, { 0,1,2,3,4,5,6,7,8,9 }, 40, 10, 10
- },
- {}
-};
-
-
const floppy_format_type FLOPPY_ACORN_SSD_FORMAT = &floppy_image_format_creator<acorn_ssd_format>;
const floppy_format_type FLOPPY_ACORN_DSD_FORMAT = &floppy_image_format_creator<acorn_dsd_format>;
const floppy_format_type FLOPPY_ACORN_DOS_FORMAT = &floppy_image_format_creator<acorn_dos_format>;
@@ -677,4 +640,3 @@ const floppy_format_type FLOPPY_ACORN_ADFS_OLD_FORMAT = &floppy_image_format_cre
const floppy_format_type FLOPPY_ACORN_ADFS_NEW_FORMAT = &floppy_image_format_creator<acorn_adfs_new_format>;
const floppy_format_type FLOPPY_OPUS_DDOS_FORMAT = &floppy_image_format_creator<opus_ddos_format>;
const floppy_format_type FLOPPY_OPUS_DDCPM_FORMAT = &floppy_image_format_creator<opus_ddcpm_format>;
-const floppy_format_type FLOPPY_TORCH_CPN_FORMAT = &floppy_image_format_creator<torch_cpn_format>;
diff --git a/src/lib/formats/acorn_dsk.h b/src/lib/formats/acorn_dsk.h
index ad4c67b79ee..2c71e4ee344 100644
--- a/src/lib/formats/acorn_dsk.h
+++ b/src/lib/formats/acorn_dsk.h
@@ -127,21 +127,6 @@ public:
virtual bool supports_save() const override;
};
-class torch_cpn_format : public wd177x_format
-{
-public:
- torch_cpn_format();
-
- virtual int identify(io_generic *io, uint32_t form_factor) override;
- virtual int get_image_offset(const format &f, int head, int track) override;
- virtual const char *name() const override;
- virtual const char *description() const override;
- virtual const char *extensions() const override;
-
-private:
- static const format formats[];
-};
-
extern const floppy_format_type FLOPPY_ACORN_SSD_FORMAT;
extern const floppy_format_type FLOPPY_ACORN_DSD_FORMAT;
@@ -150,6 +135,5 @@ extern const floppy_format_type FLOPPY_ACORN_ADFS_OLD_FORMAT;
extern const floppy_format_type FLOPPY_ACORN_ADFS_NEW_FORMAT;
extern const floppy_format_type FLOPPY_OPUS_DDOS_FORMAT;
extern const floppy_format_type FLOPPY_OPUS_DDCPM_FORMAT;
-extern const floppy_format_type FLOPPY_TORCH_CPN_FORMAT;
#endif // ACORN_DSK_H
diff --git a/src/mame/drivers/bbc.cpp b/src/mame/drivers/bbc.cpp
index 0fc573744b5..46967a08549 100644
--- a/src/mame/drivers/bbc.cpp
+++ b/src/mame/drivers/bbc.cpp
@@ -776,7 +776,6 @@ FLOPPY_FORMATS_MEMBER( bbc_state::floppy_formats_bbc )
FLOPPY_ACORN_DSD_FORMAT,
FLOPPY_OPUS_DDOS_FORMAT,
FLOPPY_OPUS_DDCPM_FORMAT,
- FLOPPY_TORCH_CPN_FORMAT,
FLOPPY_FSD_FORMAT,
FLOPPY_PC_FORMAT
FLOPPY_FORMATS_END0
@@ -786,7 +785,6 @@ FLOPPY_FORMATS_MEMBER( bbc_state::floppy_formats_bbcm )
FLOPPY_ACORN_DSD_FORMAT,
FLOPPY_ACORN_ADFS_OLD_FORMAT,
FLOPPY_OPUS_DDCPM_FORMAT,
- FLOPPY_TORCH_CPN_FORMAT,
FLOPPY_ACORN_DOS_FORMAT,
FLOPPY_FSD_FORMAT,
FLOPPY_PC_FORMAT
@@ -959,12 +957,12 @@ static MACHINE_CONFIG_DERIVED( bbcb, bbca )
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
/* user via */
- MCFG_DEVICE_ADD("via6522_1", VIA6522, XTAL_16MHz / 16)
- MCFG_VIA6522_READPB_HANDLER(READ8(bbc_state, bbcb_via_user_read_portb))
- MCFG_VIA6522_WRITEPA_HANDLER(DEVWRITE8("cent_data_out", output_latch_device, write))
- MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(bbc_state, bbcb_via_user_write_portb))
- MCFG_VIA6522_CA2_HANDLER(DEVWRITELINE("centronics", centronics_device, write_strobe))
- MCFG_VIA6522_IRQ_HANDLER(DEVWRITELINE("irqs", input_merger_device, in_w<2>))
+ MCFG_DEVICE_ADD("via6522_1", VIA6522, XTAL_16MHz / 16)
+ MCFG_VIA6522_READPB_HANDLER(READ8(bbc_state, bbcb_via_user_read_portb))
+ MCFG_VIA6522_WRITEPA_HANDLER(DEVWRITE8("cent_data_out", output_latch_device, write))
+ MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(bbc_state, bbcb_via_user_write_portb))
+ MCFG_VIA6522_CA2_HANDLER(DEVWRITELINE("centronics", centronics_device, write_strobe))
+ MCFG_VIA6522_IRQ_HANDLER(DEVWRITELINE("irqs", input_merger_device, in_w<2>))
/* adc */
MCFG_DEVICE_ADD("upd7002", UPD7002, 0)
@@ -1404,12 +1402,12 @@ static MACHINE_CONFIG_START( bbcm )
MCFG_VIA6522_IRQ_HANDLER(DEVWRITELINE("irqs", input_merger_device, in_w<1>))
/* user via */
- MCFG_DEVICE_ADD("via6522_1", VIA6522, XTAL_16MHz / 16)
- MCFG_VIA6522_READPB_HANDLER(READ8(bbc_state, bbcb_via_user_read_portb))
- MCFG_VIA6522_WRITEPA_HANDLER(DEVWRITE8("cent_data_out", output_latch_device, write))
- MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(bbc_state, bbcb_via_user_write_portb))
- MCFG_VIA6522_CA2_HANDLER(DEVWRITELINE("centronics", centronics_device, write_strobe))
- MCFG_VIA6522_IRQ_HANDLER(DEVWRITELINE("irqs", input_merger_device, in_w<2>))
+ MCFG_DEVICE_ADD("via6522_1", VIA6522, XTAL_16MHz / 16)
+ MCFG_VIA6522_READPB_HANDLER(READ8(bbc_state, bbcb_via_user_read_portb))
+ MCFG_VIA6522_WRITEPA_HANDLER(DEVWRITE8("cent_data_out", output_latch_device, write))
+ MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(bbc_state, bbcb_via_user_write_portb))
+ MCFG_VIA6522_CA2_HANDLER(DEVWRITELINE("centronics", centronics_device, write_strobe))
+ MCFG_VIA6522_IRQ_HANDLER(DEVWRITELINE("irqs", input_merger_device, in_w<2>))
/* fdc */
MCFG_WD1770_ADD("wd1770", XTAL_16MHz / 2)
@@ -1573,7 +1571,7 @@ static MACHINE_CONFIG_DERIVED( bbcmc, bbcm )
MCFG_MACHINE_START_OVERRIDE(bbc_state, bbcmc)
MCFG_MACHINE_RESET_OVERRIDE(bbc_state, bbcmc)
- // cartridge sockets
+ /* cartridge sockets */
MCFG_DEVICE_REMOVE("exp_rom1")
MCFG_DEVICE_REMOVE("exp_rom2")