summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--scripts/src/lib.lua2
-rw-r--r--src/lib/formats/hect_dsk.c32
-rw-r--r--src/lib/formats/hector_minidisc.c41
-rw-r--r--src/lib/formats/hector_minidisc.h33
-rw-r--r--src/mess/drivers/hec2hrp.c24
-rw-r--r--src/mess/includes/hec2hrp.h20
-rw-r--r--src/mess/machine/hec2hrp.c82
7 files changed, 113 insertions, 121 deletions
diff --git a/scripts/src/lib.lua b/scripts/src/lib.lua
index dcf4c44268e..611ed2ae9d9 100644
--- a/scripts/src/lib.lua
+++ b/scripts/src/lib.lua
@@ -257,6 +257,8 @@ project "formats"
MAME_DIR .. "src/lib/formats/hect_dsk.h",
MAME_DIR .. "src/lib/formats/hect_tap.c",
MAME_DIR .. "src/lib/formats/hect_tap.h",
+ MAME_DIR .. "src/lib/formats/hector_minidisc.c",
+ MAME_DIR .. "src/lib/formats/hector_minidisc.h",
MAME_DIR .. "src/lib/formats/iq151_dsk.c",
MAME_DIR .. "src/lib/formats/iq151_dsk.h",
MAME_DIR .. "src/lib/formats/imd_dsk.c",
diff --git a/src/lib/formats/hect_dsk.c b/src/lib/formats/hect_dsk.c
index 4e8794131f8..8dfe445e6e4 100644
--- a/src/lib/formats/hect_dsk.c
+++ b/src/lib/formats/hect_dsk.c
@@ -93,38 +93,6 @@ static FLOPPY_CONSTRUCT(hector_disc2_dsk800_construct)
return basicdsk_construct(floppy, &geometry);
}
-/* For the 720Ko disk 3 1/2 inch disk for the mini disc unit !!:
- 512 bytes per sectors,
- 9 sector per track,
- From sector =1 to sector 9,
- 80 tracks,
- 2 Head
- This format can be extract from a real disc with anadisk (*.IMG format rename in *.HE7).
-*/
-
-static FLOPPY_IDENTIFY(hector_minidisc_dsk_identify)
-{
- *vote = (floppy_image_size(floppy) == (2*70*9*512)) ? 100 : 0;
- return FLOPPY_ERROR_SUCCESS;
-}
-
-static FLOPPY_CONSTRUCT(hector_minidisc_dsk_construct)
-{
- struct basicdsk_geometry geometry;
- memset(&geometry, 0, sizeof(geometry)); // 635904 octets
- geometry.heads = 2;//2
- geometry.first_sector_id = 1;
- geometry.sector_length = 512;
- geometry.tracks = 70;//69
- geometry.sectors = 9;
- return basicdsk_construct(floppy, &geometry);
-}
-
-/* Specific for the mini disc unit */
-LEGACY_FLOPPY_OPTIONS_START( hector_minidisc )
- LEGACY_FLOPPY_OPTION( hector_dsk, "HMD", "hector mini disc floppy disk image 360Ko", hector_minidisc_dsk_identify, hector_minidisc_dsk_construct, NULL, NULL)
-LEGACY_FLOPPY_OPTIONS_END
-
LEGACY_FLOPPY_OPTIONS_START( hector_disc2 )
LEGACY_FLOPPY_OPTION( hector_dsk, "HE2", "hector disc2 floppy disk image 200K", hector_disc2_dsk200_identify, hector_disc2_dsk200_construct, NULL, NULL)
LEGACY_FLOPPY_OPTION( hector_dsk, "HE7", "hector disc2 floppy disk image 720K", hector_disc2_dsk720_identify, hector_disc2_dsk720_construct, NULL, NULL)
diff --git a/src/lib/formats/hector_minidisc.c b/src/lib/formats/hector_minidisc.c
new file mode 100644
index 00000000000..fe4a7ee44b1
--- /dev/null
+++ b/src/lib/formats/hector_minidisc.c
@@ -0,0 +1,41 @@
+// license:GPL-2.0+
+// copyright-holders:Dirk Best
+/***************************************************************************
+
+ Hector Minidisc
+
+ Disk image format
+
+***************************************************************************/
+
+#include "hector_minidisc.h"
+
+hmd_format::hmd_format() : upd765_format(formats)
+{
+}
+
+const char *hmd_format::name() const
+{
+ return "hector_minidisc";
+}
+
+const char *hmd_format::description() const
+{
+ return "Hector Minidisc disk image";
+}
+
+const char *hmd_format::extensions() const
+{
+ return "hmd";
+}
+
+const hmd_format::format hmd_format::formats[] =
+{
+ {
+ floppy_image::FF_35, floppy_image::DSDD, floppy_image::MFM,
+ 2000, 9, 70, 2, 512, {}, 1, {}, 80, 50, 22, 54
+ },
+ {}
+};
+
+const floppy_format_type FLOPPY_HMD_FORMAT = &floppy_image_format_creator<hmd_format>;
diff --git a/src/lib/formats/hector_minidisc.h b/src/lib/formats/hector_minidisc.h
new file mode 100644
index 00000000000..d850573f2b6
--- /dev/null
+++ b/src/lib/formats/hector_minidisc.h
@@ -0,0 +1,33 @@
+// license:GPL-2.0+
+// copyright-holders:Dirk Best
+/***************************************************************************
+
+ Hector Minidisc
+
+ Disk image format
+
+***************************************************************************/
+
+#pragma once
+
+#ifndef __HMD_DSK_H__
+#define __HMD_DSK_H__
+
+#include "upd765_dsk.h"
+
+class hmd_format : public upd765_format
+{
+public:
+ hmd_format();
+
+ virtual const char *name() const;
+ virtual const char *description() const;
+ virtual const char *extensions() const;
+
+private:
+ static const format formats[];
+};
+
+extern const floppy_format_type FLOPPY_HMD_FORMAT;
+
+#endif // __HMD_DSK_H__
diff --git a/src/mess/drivers/hec2hrp.c b/src/mess/drivers/hec2hrp.c
index 0dc0547ad13..e1381d33a63 100644
--- a/src/mess/drivers/hec2hrp.c
+++ b/src/mess/drivers/hec2hrp.c
@@ -81,6 +81,7 @@
#include "machine/upd765.h" /* for floppy disc controller */
#include "cpu/z80/z80.h"
#include "formats/hect_dsk.h"
+#include "formats/hector_minidisc.h"
#include "includes/hec2hrp.h"
/*****************************************************************************/
@@ -176,7 +177,8 @@ static ADDRESS_MAP_START( hec2mdhrx_io , AS_IO, 8, hec2hrp_state )
ADDRESS_MAP_GLOBAL_MASK(0xff)
// Minidisc commands and changing the rom page !*/
- AM_RANGE(0x000,0x0EF) AM_READWRITE(hector_179x_register_r,hector_179x_register_w)/* 179x registers*/
+ AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("wd179x", fd1793_t, read, write)
+ AM_RANGE(0x08, 0x08) AM_WRITE(minidisc_control_w)
AM_RANGE(0x0f0,0x0ff) AM_READWRITE(hector_io_8255_r, hector_io_8255_w )
ADDRESS_MAP_END
@@ -356,7 +358,6 @@ MACHINE_START_MEMBER(hec2hrp_state,hec2mdhrx)
m_hector_videoram.set_target(m_hector_videoram_hrx,m_hector_videoram.bytes());
hector_init();
- hector_minidisc_init();
}
MACHINE_RESET_MEMBER(hec2hrp_state,hec2hrx)
{
@@ -385,12 +386,14 @@ MACHINE_RESET_MEMBER(hec2hrp_state,hec2mdhrx)
/********* mini disque interface ***************************/
/***********************************************************/
-const floppy_interface minidisc_floppy_interface =
-{
- FLOPPY_STANDARD_3_5_DSDD,
- LEGACY_FLOPPY_OPTIONS_NAME(hector_minidisc),
- NULL
-};
+FLOPPY_FORMATS_MEMBER( hec2hrp_state::minidisc_formats )
+ FLOPPY_HMD_FORMAT
+FLOPPY_FORMATS_END
+
+static SLOT_INTERFACE_START( minidisc_floppies )
+ SLOT_INTERFACE("dd", FLOPPY_35_DD)
+SLOT_INTERFACE_END
+
/******************************************************************************/
static MACHINE_CONFIG_START( hec2hr, hec2hrp_state )
@@ -567,10 +570,9 @@ static MACHINE_CONFIG_START( hec2mdhrx, hec2hrp_state )
MCFG_MACHINE_START_OVERRIDE(hec2hrp_state,hec2mdhrx)
/* Mini Disc */
- MCFG_DEVICE_ADD("wd179x", FD1793, 0)
- MCFG_WD17XX_DEFAULT_DRIVE1_TAGS
+ MCFG_FD1793x_ADD("wd179x", XTAL_1MHz)
- MCFG_LEGACY_FLOPPY_DRIVE_ADD(FLOPPY_0, minidisc_floppy_interface)
+ MCFG_FLOPPY_DRIVE_ADD("wd179x:0", minidisc_floppies, "dd", hec2hrp_state::minidisc_formats)
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
diff --git a/src/mess/includes/hec2hrp.h b/src/mess/includes/hec2hrp.h
index 36b3d93530e..c30b7bfccd3 100644
--- a/src/mess/includes/hec2hrp.h
+++ b/src/mess/includes/hec2hrp.h
@@ -40,7 +40,7 @@
*/
#include "machine/upd765.h"
-#include "machine/wd17xx.h"
+#include "machine/wd_fdc.h"
#include "imagedev/flopdrv.h"
#include "imagedev/cassette.h"
#include "sound/sn76477.h" /* for sn sound*/
@@ -83,7 +83,12 @@ public:
m_palette(*this, "palette"),
m_videoram(*this,"videoram"),
m_hector_videoram(*this,"hector_videoram") ,
- m_keyboard(*this, "KEY") { }
+ m_keyboard(*this, "KEY"),
+ m_minidisc_fdc(*this, "wd179x"),
+ m_floppy0(*this, "wd179x:0")
+ {}
+
+ DECLARE_FLOPPY_FORMATS(minidisc_formats);
required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_disc2cpu;
@@ -94,6 +99,9 @@ public:
optional_shared_ptr<UINT8> m_hector_videoram;
required_ioport_array<9> m_keyboard;
+ optional_device<fd1793_t> m_minidisc_fdc;
+ optional_device<floppy_connector> m_floppy0;
+
UINT8 m_hector_flag_hr;
UINT8 m_hector_flag_80c;
UINT8 m_hector_color[4];
@@ -131,8 +139,9 @@ public:
int m_hector_flag_result;
int m_print;
UINT8 m_hector_videoram_hrx[0x04000];
- DECLARE_READ8_MEMBER(hector_179x_register_r);
- DECLARE_WRITE8_MEMBER(hector_179x_register_w);
+
+ DECLARE_WRITE8_MEMBER(minidisc_control_w);
+
DECLARE_WRITE8_MEMBER(hector_switch_bank_w);
DECLARE_WRITE8_MEMBER(hector_keyboard_w);
DECLARE_READ8_MEMBER(hector_keyboard_r);
@@ -162,7 +171,6 @@ public:
int isHectorWithMiniDisc();
int isHectorHR();
int isHectoreXtend();
- void hector_minidisc_init();
void Mise_A_Jour_Etat(int Adresse, int Value );
void Init_Value_SN76477_Hector();
void Update_Sound(address_space &space, UINT8 data);
@@ -188,6 +196,4 @@ public:
void hector_disc2_reset();
};
-extern const floppy_interface minidisc_floppy_interface;
-
MACHINE_CONFIG_EXTERN( hector_audio );
diff --git a/src/mess/machine/hec2hrp.c b/src/mess/machine/hec2hrp.c
index a6ebb75c64c..55db5bdfe5f 100644
--- a/src/mess/machine/hec2hrp.c
+++ b/src/mess/machine/hec2hrp.c
@@ -102,85 +102,25 @@ TIMER_CALLBACK_MEMBER(hec2hrp_state::Callback_CK)
m_CK_signal++;
}
-void hec2hrp_state::hector_minidisc_init()
+WRITE8_MEMBER( hec2hrp_state::minidisc_control_w )
{
- fd1793_device *fdc = machine().device<fd1793_device>("wd179x");
- //set density
- fdc->dden_w(1);// density select => always 1 (0 ?a plante !)
+ floppy_image_device *floppy = NULL;
- /* FDC Motor Control - Bit 0/1 defines the state of the FDD 0/1 motor */
- floppy_get_device(machine(), 0)->floppy_mon_w( 0); // Moteur floppy A:
- //floppy_get_device(machine(), 1)->floppy_mon_w(BIT(data, 7)); // Moteur floppy B:, not implanted on the real machine
+ if (BIT(data, 6)) floppy = m_floppy0->get_device();
+ // bit 7 = drive 2?
- //Set the drive ready !
- floppy_get_device(machine(), 0)->floppy_drive_set_ready_state(FLOPPY_DRIVE_READY, 0);// Disc 0 ready !
+ m_minidisc_fdc->set_floppy(floppy);
-}
-
-READ8_MEMBER(hec2hrp_state::hector_179x_register_r)
-{
-int data=0;
-fd1793_device *fdc = machine().device<fd1793_device>("wd179x");
-
- switch (offset & 0x0ff)
+ if (floppy)
{
- /* minidisc floppy disc interface */
- case 0x04:
- data = fdc->status_r(space, 0);
- break;
- case 0x05:
- data = fdc->track_r(space, 0);
- break;
- case 0x06:
- data = fdc->sector_r(space, 0);
- break;
- case 0x07:
- data = fdc->data_r(space, 0);
- break;
- default:
- break;
+ // don't know where the motor on signal is
+ floppy->mon_w(0);
+ floppy->ss_w(BIT(data, 4));
}
- return data;
+ membank("bank2")->set_entry(BIT(data, 5) ? HECTOR_BANK_BASE : HECTOR_BANK_DISC);
}
-WRITE8_MEMBER(hec2hrp_state::hector_179x_register_w)
-{
-fd1793_device *fdc = machine().device<fd1793_device>("wd179x");
-switch (offset)
- {
- /* minidisc floppy disc interface */
- case 0x04:
- fdc->command_w(space, 0, data);
- break;
- case 0x05:
- fdc->track_w(space, 0, data);
- break;
- case 0x06:
- fdc->sector_w(space, 0, data);
- break;
- case 0x07:
- /*write into command register*/
- fdc->data_w(space, 0, data);
- break;
- case 0x08:
- /*General purpose port (0x08) for the minidisk I/O */
- {
- // Rom page bank switching
- membank("bank2")->set_entry(BIT(data, 5) ? HECTOR_BANK_BASE : HECTOR_BANK_DISC );
-
- // Set drive number
- if (BIT(data, 6)) fdc->set_drive(0); // Set the correct drive number 0
- //if (BIT(data, 7)) fdc->set_drive(1);// Set the correct drive number 1,never here
- // Set side
- fdc->set_side(BIT(data, 4) ? 1 : 0);// side select
- }
- break;
-
- default:
- break;
- }
-}
WRITE8_MEMBER(hec2hrp_state::hector_switch_bank_w)
{
if (offset==0x00) { /* 0x800 et 0x000=> video page, HR*/
@@ -255,7 +195,7 @@ READ8_MEMBER(hec2hrp_state::hector_keyboard_r)
/* floppy md master reset */
if (isHectorWithMiniDisc())
- machine().device<fd1793_device>("wd179x")->mr_w(1);
+ m_minidisc_fdc->reset();
}
else /* aviable for BR machines */