summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Curt Coder <curtcoder@mail.com>2015-04-21 23:52:22 +0300
committer Curt Coder <curtcoder@mail.com>2015-04-21 23:52:22 +0300
commit67d09b16e9c3bfdbbbd5badebb34ce1dd2aba01a (patch)
tree80bf2f449bd8090fac2260e5cde1ab969c381fc6
parent2dc5e399ed3fc2a1622277195da5d8ec5bc8eef2 (diff)
(MESS) c3040: Disk format WIP. (nw)
-rw-r--r--scripts/src/lib.lua4
-rw-r--r--src/emu/bus/ieee488/c2040.c66
-rw-r--r--src/emu/bus/ieee488/c2040.h3
-rw-r--r--src/emu/bus/ieee488/c2040fdc.h2
-rw-r--r--src/lib/formats/c3040_dsk.c101
-rw-r--r--src/lib/formats/c3040_dsk.h40
-rw-r--r--src/lib/formats/c4040_dsk.c4
-rw-r--r--src/lib/formats/d64_dsk.c2
-rw-r--r--src/lib/formats/d67_dsk.c56
-rw-r--r--src/lib/formats/d67_dsk.h36
10 files changed, 215 insertions, 99 deletions
diff --git a/scripts/src/lib.lua b/scripts/src/lib.lua
index e3dc7c6064a..5f809256072 100644
--- a/scripts/src/lib.lua
+++ b/scripts/src/lib.lua
@@ -157,6 +157,8 @@ project "formats"
MAME_DIR .. "src/lib/formats/bw2_dsk.h",
MAME_DIR .. "src/lib/formats/bw12_dsk.c",
MAME_DIR .. "src/lib/formats/bw12_dsk.h",
+ MAME_DIR .. "src/lib/formats/c3040_dsk.c",
+ MAME_DIR .. "src/lib/formats/c3040_dsk.h",
MAME_DIR .. "src/lib/formats/c4040_dsk.c",
MAME_DIR .. "src/lib/formats/c4040_dsk.h",
MAME_DIR .. "src/lib/formats/c8280_dsk.c",
@@ -187,8 +189,6 @@ project "formats"
MAME_DIR .. "src/lib/formats/csw_cas.h",
MAME_DIR .. "src/lib/formats/d64_dsk.c",
MAME_DIR .. "src/lib/formats/d64_dsk.h",
- MAME_DIR .. "src/lib/formats/d67_dsk.c",
- MAME_DIR .. "src/lib/formats/d67_dsk.h",
MAME_DIR .. "src/lib/formats/d71_dsk.c",
MAME_DIR .. "src/lib/formats/d71_dsk.h",
MAME_DIR .. "src/lib/formats/d80_dsk.c",
diff --git a/src/emu/bus/ieee488/c2040.c b/src/emu/bus/ieee488/c2040.c
index bb012afa92a..4eb7c265660 100644
--- a/src/emu/bus/ieee488/c2040.c
+++ b/src/emu/bus/ieee488/c2040.c
@@ -484,7 +484,17 @@ SLOT_INTERFACE_END
//-------------------------------------------------
FLOPPY_FORMATS_MEMBER( c2040_device::floppy_formats )
- FLOPPY_D67_FORMAT,
+ FLOPPY_C3040_FORMAT,
+ FLOPPY_G64_FORMAT
+FLOPPY_FORMATS_END
+
+
+//-------------------------------------------------
+// FLOPPY_FORMATS( floppy_formats )
+//-------------------------------------------------
+
+FLOPPY_FORMATS_MEMBER( c3040_device::floppy_formats )
+ FLOPPY_C3040_FORMAT,
FLOPPY_G64_FORMAT
FLOPPY_FORMATS_END
@@ -554,6 +564,60 @@ machine_config_constructor c2040_device::device_mconfig_additions() const
//-------------------------------------------------
+// MACHINE_CONFIG_FRAGMENT( c3040 )
+//-------------------------------------------------
+
+static MACHINE_CONFIG_FRAGMENT( c3040 )
+ // DOS
+ MCFG_CPU_ADD(M6502_TAG, M6502, XTAL_16MHz/16)
+ MCFG_CPU_PROGRAM_MAP(c2040_main_mem)
+
+ MCFG_DEVICE_ADD(M6532_0_TAG, RIOT6532, XTAL_16MHz/16)
+ MCFG_RIOT6532_IN_PA_CB(READ8(c2040_device, dio_r))
+ MCFG_RIOT6532_OUT_PB_CB(WRITE8(c2040_device, dio_w))
+
+ MCFG_DEVICE_ADD(M6532_1_TAG, RIOT6532, XTAL_16MHz/16)
+ MCFG_RIOT6532_IN_PA_CB(READ8(c2040_device, riot1_pa_r))
+ MCFG_RIOT6532_OUT_PA_CB(WRITE8(c2040_device, riot1_pa_w))
+ MCFG_RIOT6532_IN_PB_CB(READ8(c2040_device, riot1_pb_r))
+ MCFG_RIOT6532_OUT_PB_CB(WRITE8(c2040_device, riot1_pb_w))
+ MCFG_RIOT6532_IRQ_CB(INPUTLINE(M6502_TAG, INPUT_LINE_IRQ0))
+
+ // controller
+ MCFG_CPU_ADD(M6504_TAG, M6504, XTAL_16MHz/16)
+ MCFG_CPU_PROGRAM_MAP(c2040_fdc_mem)
+
+ MCFG_DEVICE_ADD(M6522_TAG, VIA6522, XTAL_16MHz/16)
+ MCFG_VIA6522_READPA_HANDLER(DEVREAD8(FDC_TAG, c2040_fdc_t, read))
+ MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(c2040_device, via_pb_w))
+ MCFG_VIA6522_CA2_HANDLER(DEVWRITELINE(FDC_TAG, c2040_fdc_t, mode_sel_w))
+ MCFG_VIA6522_CB2_HANDLER(DEVWRITELINE(FDC_TAG, c2040_fdc_t, rw_sel_w))
+
+ MCFG_DEVICE_ADD(M6530_TAG, MOS6530, XTAL_16MHz/16)
+ MCFG_MOS6530_OUT_PA_CB(DEVWRITE8(FDC_TAG, c2040_fdc_t, write))
+ MCFG_MOS6530_IN_PB_CB(READ8(c2040_device, miot_pb_r))
+ MCFG_MOS6530_OUT_PB_CB(WRITE8(c2040_device, miot_pb_w))
+
+ MCFG_DEVICE_ADD(FDC_TAG, C2040_FDC, XTAL_16MHz)
+ MCFG_C2040_READY_CALLBACK(DEVWRITELINE(M6522_TAG, via6522_device, write_ca1))
+ MCFG_C2040_ERROR_CALLBACK(DEVWRITELINE(M6522_TAG, via6522_device, write_cb1))
+ MCFG_FLOPPY_DRIVE_ADD(FDC_TAG":0", c2040_floppies, "525ssqd", c3040_device::floppy_formats)
+ MCFG_FLOPPY_DRIVE_ADD(FDC_TAG":1", c2040_floppies, "525ssqd", c3040_device::floppy_formats)
+MACHINE_CONFIG_END
+
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor c3040_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( c3040 );
+}
+
+
+//-------------------------------------------------
// MACHINE_CONFIG_FRAGMENT( c4040 )
//-------------------------------------------------
diff --git a/src/emu/bus/ieee488/c2040.h b/src/emu/bus/ieee488/c2040.h
index 020a436a9ac..2664a2ffdd8 100644
--- a/src/emu/bus/ieee488/c2040.h
+++ b/src/emu/bus/ieee488/c2040.h
@@ -110,6 +110,9 @@ public:
// optional information overrides
virtual const rom_entry *device_rom_region() const;
+ virtual machine_config_constructor device_mconfig_additions() const;
+
+ DECLARE_FLOPPY_FORMATS( floppy_formats );
};
diff --git a/src/emu/bus/ieee488/c2040fdc.h b/src/emu/bus/ieee488/c2040fdc.h
index 31b3c38affa..382c540d4e4 100644
--- a/src/emu/bus/ieee488/c2040fdc.h
+++ b/src/emu/bus/ieee488/c2040fdc.h
@@ -15,9 +15,9 @@
#define __C2040_FLOPPY__
#include "emu.h"
+#include "formats/c3040_dsk.h"
#include "formats/c4040_dsk.h"
#include "formats/d64_dsk.h"
-#include "formats/d67_dsk.h"
#include "formats/g64_dsk.h"
#include "imagedev/floppy.h"
diff --git a/src/lib/formats/c3040_dsk.c b/src/lib/formats/c3040_dsk.c
new file mode 100644
index 00000000000..dd1d3ee5817
--- /dev/null
+++ b/src/lib/formats/c3040_dsk.c
@@ -0,0 +1,101 @@
+// license:BSD-3-Clause
+// copyright-holders:Curt Coder
+/*********************************************************************
+
+ formats/c3040_dsk.c
+
+ Commodore 3040 sector disk image format
+
+*********************************************************************/
+
+#include <assert.h>
+
+#include "formats/c3040_dsk.h"
+
+c3040_format::c3040_format() : d64_format(file_formats)
+{
+}
+
+const char *c3040_format::name() const
+{
+ return "c3040";
+}
+
+const char *c3040_format::description() const
+{
+ return "Commodore 3040 disk image";
+}
+
+const char *c3040_format::extensions() const
+{
+ return "d67";
+}
+
+const c3040_format::format c3040_format::file_formats[] = {
+ { // d67, dos 1, 35 tracks, head 48 tpi, stepper 96 tpi
+ floppy_image::FF_525, floppy_image::SSSD, 690, 35, 1, 256, 9, 8
+ },
+ {}
+};
+
+const int c3040_format::c3040_sectors_per_track[] =
+{
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, // 1-17
+ 20, 20, 20, 20, 20, 20, 20, // 18-24
+ 18, 18, 18, 18, 18, 18, // 25-30
+ 17, 17, 17, 17, 17, // 31-35
+ 17, 17, 17, 17, 17, // 36-40
+ 17, 17 // 41-42
+};
+
+const int c3040_format::c3040_gap2[] =
+{
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, // 1-17
+ 8, 8, 8, 8, 8, 8, 8, // 18-24
+ 15, 15, 15, 15, 15, 15, // 25-30
+ 12, 12, 12, 12, 12 // 31-35
+};
+
+floppy_image_format_t::desc_e* c3040_format::get_sector_desc(const format &f, int &current_size, int sector_count, UINT8 id1, UINT8 id2, int gap_2)
+{
+ static floppy_image_format_t::desc_e desc[] = {
+ /* 00 */ { SECTOR_LOOP_START, 0, -1 },
+ /* 01 */ { SYNC_GCR5, 2 },
+ /* 02 */ { GCR5, 0x08, 1 },
+ /* 03 */ { CRC, 1 },
+ /* 04 */ { CRC_CBM_START, 1 },
+ /* 05 */ { SECTOR_ID_GCR5 },
+ /* 06 */ { TRACK_ID_DOS2_GCR5 },
+ /* 07 */ { GCR5, id2, 1 },
+ /* 08 */ { GCR5, id1, 1 },
+ /* 09 */ { CRC_END, 1 },
+ /* 10 */ { GCR5, 0x00, f.gap_1 },
+ /* 11 */ { SYNC_GCR5, 2 },
+ /* 12 */ { GCR5, 0x07, 1 },
+ /* 13 */ { CRC_CBM_START, 2 },
+ /* 14 */ { SECTOR_DATA_GCR5, -1 },
+ /* 15 */ { CRC_END, 2 },
+ /* 16 */ { CRC, 2 },
+ /* 17 */ { GCR5, 0x00, gap_2 },
+ /* 18 */ { SECTOR_LOOP_END },
+ /* 19 */ { GCR5, 0x00, 0 },
+ /* 20 */ { RAWBITS, 0x14a, 0 },
+ /* 21 */ { END }
+ };
+
+ desc[17].p2 = gap_2; // TODO why?!?
+
+ current_size = 20 + (1+1+4)*10 + f.gap_1*10 + 20 + (1+f.sector_base_size+1)*10 + gap_2*10;
+
+ current_size *= sector_count;
+ return desc;
+}
+
+void c3040_format::fix_end_gap(floppy_image_format_t::desc_e* desc, int remaining_size)
+{
+ desc[19].p2 = remaining_size / 10;
+ desc[20].p2 = remaining_size % 10;
+ desc[20].p1 >>= remaining_size & 0x01;
+}
+
+const floppy_format_type FLOPPY_C3040_FORMAT = &floppy_image_format_creator<c3040_format>;
diff --git a/src/lib/formats/c3040_dsk.h b/src/lib/formats/c3040_dsk.h
new file mode 100644
index 00000000000..cbf320273a8
--- /dev/null
+++ b/src/lib/formats/c3040_dsk.h
@@ -0,0 +1,40 @@
+// license:BSD-3-Clause
+// copyright-holders:Curt Coder
+/*********************************************************************
+
+ formats/c3040_dsk.h
+
+ Commodore 3040 sector disk image format
+
+*********************************************************************/
+
+#ifndef C3040_DSK_H_
+#define C3040_DSK_H_
+
+#include "d64_dsk.h"
+
+class c3040_format : public d64_format {
+public:
+ c3040_format();
+
+ virtual const char *name() const;
+ virtual const char *description() const;
+ virtual const char *extensions() const;
+
+protected:
+ virtual int get_sectors_per_track(const format &f, int track) { return c3040_sectors_per_track[track]; }
+ virtual floppy_image_format_t::desc_e* get_sector_desc(const format &f, int &current_size, int sector_count, UINT8 id1, UINT8 id2, int gap_2);
+ virtual int get_gap2(const format &f, int head, int track) { return c3040_gap2[track]; }
+ virtual void fix_end_gap(floppy_image_format_t::desc_e* desc, int remaining_size);
+
+ static const format file_formats[];
+
+ static const int c3040_gap2[];
+ static const int c3040_sectors_per_track[];
+};
+
+extern const floppy_format_type FLOPPY_C3040_FORMAT;
+
+
+
+#endif
diff --git a/src/lib/formats/c4040_dsk.c b/src/lib/formats/c4040_dsk.c
index da3ac905693..4def7e0c581 100644
--- a/src/lib/formats/c4040_dsk.c
+++ b/src/lib/formats/c4040_dsk.c
@@ -50,7 +50,7 @@ floppy_image_format_t::desc_e* c4040_format::get_sector_desc(const format &f, in
{
static floppy_image_format_t::desc_e desc[] = {
/* 00 */ { SECTOR_LOOP_START, 0, -1 },
- /* 01 */ { RAWBYTE, 0xff, 5 },
+ /* 01 */ { SYNC_GCR5, 4 },
/* 02 */ { GCR5, 0x08, 1 },
/* 03 */ { CRC, 1 },
/* 04 */ { CRC_CBM_START, 1 },
@@ -60,7 +60,7 @@ floppy_image_format_t::desc_e* c4040_format::get_sector_desc(const format &f, in
/* 08 */ { GCR5, id1, 1 },
/* 09 */ { CRC_END, 1 },
/* 10 */ { GCR5, 0x00, f.gap_1 },
- /* 11 */ { RAWBYTE, 0xff, 5 },
+ /* 11 */ { SYNC_GCR5, 4 },
/* 12 */ { GCR5, 0x07, 1 },
/* 13 */ { CRC_CBM_START, 2 },
/* 14 */ { SECTOR_DATA_GCR5, -1 },
diff --git a/src/lib/formats/d64_dsk.c b/src/lib/formats/d64_dsk.c
index 4de63b34bc8..531ce441b99 100644
--- a/src/lib/formats/d64_dsk.c
+++ b/src/lib/formats/d64_dsk.c
@@ -272,7 +272,7 @@ bool d64_format::save(io_generic *io, floppy_image *image)
for(int track=0; track < f.track_count; track++) {
int sector_count = this->get_sectors_per_track(f, track);
int track_size = compute_track_size(f, track);
- UINT8 sectdata[40*256];
+ UINT8 sectdata[40*256] = { 0 };
desc_s sectors[40];
int offset = get_image_offset(f, head, track);
diff --git a/src/lib/formats/d67_dsk.c b/src/lib/formats/d67_dsk.c
deleted file mode 100644
index b512e55b694..00000000000
--- a/src/lib/formats/d67_dsk.c
+++ /dev/null
@@ -1,56 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Curt Coder
-/*********************************************************************
-
- formats/d67_dsk.c
-
- Commodore 2040 sector disk image format
-
-*********************************************************************/
-
-#include <assert.h>
-
-#include "formats/d67_dsk.h"
-
-d67_format::d67_format() : d64_format(file_formats)
-{
-}
-
-const char *d67_format::name() const
-{
- return "d67";
-}
-
-const char *d67_format::description() const
-{
- return "Commodore 2040 disk image";
-}
-
-const char *d67_format::extensions() const
-{
- return "d67";
-}
-
-const d67_format::format d67_format::file_formats[] = {
- { // d67, dos 1, 35 tracks, head 48 tpi, stepper 96 tpi
- floppy_image::FF_525, floppy_image::SSSD, 690, 35, 1, 256, 9, 8
- },
- {}
-};
-
-const int d67_format::d67_sectors_per_track[] =
-{
- 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, // 1-17
- 20, 20, 20, 20, 20, 20, 20, // 18-24
- 18, 18, 18, 18, 18, 18, // 25-30
- 17, 17, 17, 17, 17, // 31-35
- 17, 17, 17, 17, 17, // 36-40
- 17, 17 // 41-42
-};
-
-int d67_format::get_sectors_per_track(const format &f, int track)
-{
- return d67_sectors_per_track[track];
-}
-
-const floppy_format_type FLOPPY_D67_FORMAT = &floppy_image_format_creator<d67_format>;
diff --git a/src/lib/formats/d67_dsk.h b/src/lib/formats/d67_dsk.h
deleted file mode 100644
index c28c1a4d37f..00000000000
--- a/src/lib/formats/d67_dsk.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Curt Coder
-/*********************************************************************
-
- formats/d67_dsk.h
-
- Commodore 2040 sector disk image format
-
-*********************************************************************/
-
-#ifndef D67_DSK_H_
-#define D67_DSK_H_
-
-#include "d64_dsk.h"
-
-class d67_format : public d64_format {
-public:
- d67_format();
-
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
-
-protected:
- virtual int get_sectors_per_track(const format &f, int track);
-
- static const format file_formats[];
-
- static const int d67_sectors_per_track[];
-};
-
-extern const floppy_format_type FLOPPY_D67_FORMAT;
-
-
-
-#endif