mirror of
https://github.com/holub/mame
synced 2025-04-24 17:30:55 +03:00
(MESS) Beta Disk interface convert to wd_fdc
This commit is contained in:
parent
4746a62fd2
commit
e5a9d0bdf3
@ -6,44 +6,35 @@
|
||||
|
||||
*********************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
#include "emu.h"
|
||||
#include "formats/trd_dsk.h"
|
||||
|
||||
#include "trd_dsk.h"
|
||||
#include "basicdsk.h"
|
||||
|
||||
|
||||
static FLOPPY_IDENTIFY(trd_dsk_identify)
|
||||
trd_format::trd_format() : wd177x_format(formats)
|
||||
{
|
||||
*vote = 100;
|
||||
return FLOPPY_ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static FLOPPY_CONSTRUCT(trd_dsk_construct)
|
||||
const char *trd_format::name() const
|
||||
{
|
||||
struct basicdsk_geometry geometry;
|
||||
UINT8 data[1];
|
||||
int heads;
|
||||
int cylinders;
|
||||
|
||||
floppy_image_read( floppy, data, 0x8e3 , 1 );
|
||||
|
||||
/* guess geometry of disk */
|
||||
heads = data[0] & 0x08 ? 1 : 2;
|
||||
cylinders = data[0] & 0x01 ? 40 : 80;
|
||||
|
||||
memset(&geometry, 0, sizeof(geometry));
|
||||
geometry.heads = heads;
|
||||
geometry.first_sector_id = 1;
|
||||
geometry.sector_length = 256;
|
||||
geometry.tracks = cylinders;
|
||||
geometry.sectors = 16;
|
||||
return basicdsk_construct(floppy, &geometry);
|
||||
return "trd";
|
||||
}
|
||||
|
||||
const char *trd_format::description() const
|
||||
{
|
||||
return "TRD floppy disk image";
|
||||
}
|
||||
|
||||
const char *trd_format::extensions() const
|
||||
{
|
||||
return "trd";
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
const trd_format::format trd_format::formats[] = {
|
||||
{ // 5"25 640K double density
|
||||
floppy_image::FF_525, floppy_image::DSQD, floppy_image::MFM,
|
||||
// GAP4A - 0(!) bytes, GAP1 - 10 bytes, GAP2 - 22 bytes, GAP3 - 60 bytes, GAP4B - upto track end
|
||||
2000, 16, 80, 2, 256, {}, 1, {}, 10, 22, 60
|
||||
},
|
||||
{}
|
||||
};
|
||||
|
||||
LEGACY_FLOPPY_OPTIONS_START( trd )
|
||||
LEGACY_FLOPPY_OPTION( trd_dsk, "trd", "TRD floppy disk image", trd_dsk_identify, trd_dsk_construct, NULL, NULL)
|
||||
LEGACY_FLOPPY_OPTIONS_END
|
||||
const floppy_format_type FLOPPY_TRD_FORMAT = &floppy_image_format_creator<trd_format>;
|
||||
|
@ -9,10 +9,20 @@
|
||||
#ifndef TRD_DSK_H
|
||||
#define TRD_DSK_H
|
||||
|
||||
#include "flopimg.h"
|
||||
#include "wd177x_dsk.h"
|
||||
|
||||
/**************************************************************************/
|
||||
class trd_format : public wd177x_format {
|
||||
public:
|
||||
trd_format();
|
||||
|
||||
LEGACY_FLOPPY_OPTIONS_EXTERN(trd);
|
||||
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_TRD_FORMAT;
|
||||
|
||||
#endif /* TRD_DSK_H */
|
||||
|
@ -141,7 +141,6 @@ MACHINE_RESET_MEMBER(atm_state,atm)
|
||||
if (m_beta->started())
|
||||
{
|
||||
m_beta->enable();
|
||||
m_beta->clear_status();
|
||||
}
|
||||
space.set_direct_update_handler(direct_update_delegate(FUNC(atm_state::atm_direct), this));
|
||||
|
||||
|
@ -186,7 +186,6 @@ MACHINE_RESET_MEMBER(pentagon_state,pentagon)
|
||||
{
|
||||
if (strcmp(machine().system().name, "pent1024")==0)
|
||||
m_beta->enable();
|
||||
m_beta->clear_status();
|
||||
}
|
||||
space.set_direct_update_handler(direct_update_delegate(FUNC(pentagon_state::pentagon_direct), this));
|
||||
|
||||
|
@ -336,7 +336,6 @@ MACHINE_RESET_MEMBER(scorpion_state,scorpion)
|
||||
space.install_write_handler(0x0000, 0x3fff, write8_delegate(FUNC(scorpion_state::scorpion_0000_w),this));
|
||||
|
||||
m_beta->disable();
|
||||
m_beta->clear_status();
|
||||
space.set_direct_update_handler(direct_update_delegate(FUNC(scorpion_state::scorpion_direct), this));
|
||||
|
||||
memset(messram,0,256*1024);
|
||||
|
@ -14,7 +14,6 @@ goto TR-DOS, CAT -> files will be shown, CAT again -> NO DISK mesage as result o
|
||||
|
||||
*/
|
||||
#include "emu.h"
|
||||
#include "imagedev/flopdrv.h"
|
||||
#include "formats/trd_dsk.h"
|
||||
#include "machine/beta.h"
|
||||
|
||||
@ -27,9 +26,13 @@ goto TR-DOS, CAT -> files will be shown, CAT again -> NO DISK mesage as result o
|
||||
const device_type BETA_DISK = &device_creator<beta_disk_device>;
|
||||
|
||||
beta_disk_device::beta_disk_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: device_t(mconfig, BETA_DISK, "Beta Disk Interface", tag, owner, clock, "betadisk", __FILE__),
|
||||
m_betadisk_status(0),
|
||||
m_betadisk_active(0)
|
||||
: device_t(mconfig, BETA_DISK, "Beta Disk Interface", tag, owner, clock, "betadisk", __FILE__)
|
||||
, m_betadisk_active(0)
|
||||
, m_wd179x(*this, "wd179x")
|
||||
, m_floppy0(*this, "wd179x:0")
|
||||
, m_floppy1(*this, "wd179x:1")
|
||||
, m_floppy2(*this, "wd179x:2")
|
||||
, m_floppy3(*this, "wd179x:3")
|
||||
{
|
||||
}
|
||||
|
||||
@ -39,14 +42,6 @@ beta_disk_device::beta_disk_device(const machine_config &mconfig, const char *ta
|
||||
|
||||
void beta_disk_device::device_start()
|
||||
{
|
||||
astring tempstring;
|
||||
|
||||
/* validate arguments */
|
||||
assert(tag() != NULL);
|
||||
|
||||
/* find our WD179x */
|
||||
tempstring.printf("%s:%s", tag(), "wd179x");
|
||||
m_wd179x = machine().device<wd2793_device>(tempstring);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -72,31 +67,10 @@ void beta_disk_device::disable()
|
||||
m_betadisk_active = 0;
|
||||
}
|
||||
|
||||
void beta_disk_device::clear_status()
|
||||
{
|
||||
m_betadisk_status = 0;
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER(beta_disk_device::wd179x_intrq_w)
|
||||
{
|
||||
if (state)
|
||||
m_betadisk_status |= (1<<7);
|
||||
else
|
||||
m_betadisk_status &=~(1<<7);
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER(beta_disk_device::wd179x_drq_w)
|
||||
{
|
||||
if (state)
|
||||
m_betadisk_status |= (1<<6);
|
||||
else
|
||||
m_betadisk_status &=~(1<<6);
|
||||
}
|
||||
|
||||
READ8_MEMBER(beta_disk_device::status_r)
|
||||
{
|
||||
if (m_betadisk_active==1) {
|
||||
return m_wd179x->status_r(space, offset);
|
||||
return m_wd179x->status_r(space, 0);
|
||||
} else {
|
||||
return 0xff;
|
||||
}
|
||||
@ -105,7 +79,7 @@ READ8_MEMBER(beta_disk_device::status_r)
|
||||
READ8_MEMBER(beta_disk_device::track_r)
|
||||
{
|
||||
if (m_betadisk_active==1) {
|
||||
return m_wd179x->track_r(space, offset);
|
||||
return m_wd179x->track_r(space, 0);
|
||||
} else {
|
||||
return 0xff;
|
||||
}
|
||||
@ -114,7 +88,7 @@ READ8_MEMBER(beta_disk_device::track_r)
|
||||
READ8_MEMBER(beta_disk_device::sector_r)
|
||||
{
|
||||
if (m_betadisk_active==1) {
|
||||
return m_wd179x->sector_r(space, offset);
|
||||
return m_wd179x->sector_r(space, 0);
|
||||
} else {
|
||||
return 0xff;
|
||||
}
|
||||
@ -123,7 +97,7 @@ READ8_MEMBER(beta_disk_device::sector_r)
|
||||
READ8_MEMBER(beta_disk_device::data_r)
|
||||
{
|
||||
if (m_betadisk_active==1) {
|
||||
return m_wd179x->data_r(space, offset);
|
||||
return m_wd179x->data_r(space, 0);
|
||||
} else {
|
||||
return 0xff;
|
||||
}
|
||||
@ -132,7 +106,10 @@ READ8_MEMBER(beta_disk_device::data_r)
|
||||
READ8_MEMBER(beta_disk_device::state_r)
|
||||
{
|
||||
if (m_betadisk_active==1) {
|
||||
return m_betadisk_status;
|
||||
UINT8 result = 0x3F; // actually open bus
|
||||
result |= m_wd179x->drq_r() ? 0x40 : 0;
|
||||
result |= m_wd179x->intrq_r() ? 0x80 : 0;
|
||||
return result;
|
||||
} else {
|
||||
return 0xff;
|
||||
}
|
||||
@ -140,66 +117,75 @@ READ8_MEMBER(beta_disk_device::state_r)
|
||||
|
||||
WRITE8_MEMBER(beta_disk_device::param_w)
|
||||
{
|
||||
const char *floppy_tags[4] = { FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3 };
|
||||
|
||||
if (m_betadisk_active == 1)
|
||||
{
|
||||
m_wd179x->set_drive(data & 3);
|
||||
m_wd179x->set_side ((data & 0x10) ? 0 : 1 );
|
||||
m_wd179x->dden_w(!BIT(data, 6));
|
||||
if ((data & 0x04) == 0) // reset
|
||||
m_wd179x->reset();
|
||||
floppy_connector* connectors[] = { m_floppy0, m_floppy1, m_floppy2, m_floppy3 };
|
||||
|
||||
// bit 3 connected to pin 23 "HRDY" of FDC
|
||||
// TEMP HACK, FDD motor and RDY FDC pin controlled by HLD pin of FDC
|
||||
legacy_floppy_image_device *flop = subdevice<legacy_floppy_image_device>(floppy_tags[data & 3]);
|
||||
flop->floppy_mon_w(CLEAR_LINE);
|
||||
flop->floppy_drive_set_ready_state(1, 0);
|
||||
floppy_image_device* floppy = connectors[data & 3]->get_device();
|
||||
|
||||
m_wd179x->set_floppy(floppy);
|
||||
floppy->ss_w(BIT(data, 4) ? 0 : 1);
|
||||
m_wd179x->dden_w(BIT(data, 6));
|
||||
|
||||
// bit 3 connected to pin 23 "HLT" of FDC and via diode to INDEX
|
||||
//m_wd179x->hlt_w(BIT(data, 3)); // not handled in current wd_fdc
|
||||
|
||||
if (BIT(data, 2) == 0) // reset
|
||||
{
|
||||
m_wd179x->reset();
|
||||
floppy->mon_w(ASSERT_LINE);
|
||||
} else {
|
||||
// HACK, FDD motor and RDY FDC pin controlled by HLD pin of FDC
|
||||
floppy->mon_w(CLEAR_LINE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(beta_disk_device::command_w)
|
||||
{
|
||||
if (m_betadisk_active==1) {
|
||||
m_wd179x->command_w(space, offset, data);
|
||||
m_wd179x->cmd_w(space, 0, data);
|
||||
}
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(beta_disk_device::track_w)
|
||||
{
|
||||
if (m_betadisk_active==1) {
|
||||
m_wd179x->track_w(space, offset, data);
|
||||
m_wd179x->track_w(space, 0, data);
|
||||
}
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(beta_disk_device::sector_w)
|
||||
{
|
||||
if (m_betadisk_active==1) {
|
||||
m_wd179x->sector_w(space, offset, data);
|
||||
m_wd179x->sector_w(space, 0, data);
|
||||
}
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(beta_disk_device::data_w)
|
||||
{
|
||||
if (m_betadisk_active==1) {
|
||||
m_wd179x->data_w(space, offset, data);
|
||||
m_wd179x->data_w(space, 0, data);
|
||||
}
|
||||
}
|
||||
|
||||
static const floppy_interface beta_floppy_interface =
|
||||
{
|
||||
FLOPPY_STANDARD_5_25_DSDD,
|
||||
LEGACY_FLOPPY_OPTIONS_NAME(trd),
|
||||
NULL
|
||||
};
|
||||
FLOPPY_FORMATS_MEMBER(beta_disk_device::floppy_formats)
|
||||
FLOPPY_TRD_FORMAT
|
||||
FLOPPY_FORMATS_END
|
||||
|
||||
static SLOT_INTERFACE_START( beta_disk_floppies )
|
||||
SLOT_INTERFACE( "drive0", FLOPPY_525_QD )
|
||||
SLOT_INTERFACE( "drive1", FLOPPY_525_QD )
|
||||
SLOT_INTERFACE( "drive2", FLOPPY_525_QD )
|
||||
SLOT_INTERFACE( "drive3", FLOPPY_525_QD )
|
||||
SLOT_INTERFACE_END
|
||||
|
||||
static MACHINE_CONFIG_FRAGMENT( beta_disk )
|
||||
MCFG_DEVICE_ADD("wd179x", WD2793, 0) // KR1818VG93 clone of WD1793
|
||||
MCFG_WD17XX_DEFAULT_DRIVE4_TAGS
|
||||
MCFG_WD17XX_INTRQ_CALLBACK(WRITELINE(beta_disk_device, wd179x_intrq_w))
|
||||
MCFG_WD17XX_DRQ_CALLBACK(WRITELINE(beta_disk_device, wd179x_drq_w))
|
||||
|
||||
MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(beta_floppy_interface)
|
||||
MCFG_WD2793x_ADD("wd179x", XTAL_8MHz / 8) // KR1818VG93 clone of WD1793
|
||||
MCFG_FLOPPY_DRIVE_ADD("wd179x:0", beta_disk_floppies, "drive0", beta_disk_device::floppy_formats)
|
||||
MCFG_FLOPPY_DRIVE_ADD("wd179x:1", beta_disk_floppies, "drive1", beta_disk_device::floppy_formats)
|
||||
MCFG_FLOPPY_DRIVE_ADD("wd179x:2", beta_disk_floppies, "drive2", beta_disk_device::floppy_formats)
|
||||
MCFG_FLOPPY_DRIVE_ADD("wd179x:3", beta_disk_floppies, "drive3", beta_disk_device::floppy_formats)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
ROM_START( beta_disk )
|
||||
|
@ -10,7 +10,7 @@
|
||||
#ifndef __BETA_H__
|
||||
#define __BETA_H__
|
||||
|
||||
#include "machine/wd17xx.h"
|
||||
#include "machine/wd_fdc.h"
|
||||
|
||||
|
||||
#define BETA_DISK_TAG "beta"
|
||||
@ -32,16 +32,12 @@ public:
|
||||
DECLARE_WRITE8_MEMBER(track_w);
|
||||
DECLARE_WRITE8_MEMBER(sector_w);
|
||||
DECLARE_WRITE8_MEMBER(data_w);
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER(wd179x_intrq_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(wd179x_drq_w);
|
||||
DECLARE_FLOPPY_FORMATS(floppy_formats);
|
||||
|
||||
int is_active();
|
||||
void enable();
|
||||
void disable();
|
||||
void clear_status();
|
||||
|
||||
UINT8 m_betadisk_status;
|
||||
UINT8 m_betadisk_active;
|
||||
|
||||
protected:
|
||||
@ -52,8 +48,11 @@ protected:
|
||||
virtual machine_config_constructor device_mconfig_additions() const;
|
||||
|
||||
private:
|
||||
// internal state
|
||||
wd2793_device *m_wd179x;
|
||||
required_device<wd2793_t> m_wd179x;
|
||||
required_device<floppy_connector> m_floppy0;
|
||||
required_device<floppy_connector> m_floppy1;
|
||||
required_device<floppy_connector> m_floppy2;
|
||||
required_device<floppy_connector> m_floppy3;
|
||||
};
|
||||
|
||||
extern const device_type BETA_DISK;
|
||||
|
Loading…
Reference in New Issue
Block a user