mirror of
https://github.com/holub/mame
synced 2025-04-19 23:12:11 +03:00
fmtowns: converted to use wd_fdc and modern floppy drive implementation.
This commit is contained in:
parent
be9ff598cb
commit
6251ca5153
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -3361,6 +3361,8 @@ src/lib/formats/fm7_cas.c svneol=native#text/plain
|
||||
src/lib/formats/fm7_cas.h svneol=native#text/plain
|
||||
src/lib/formats/fmsx_cas.c svneol=native#text/plain
|
||||
src/lib/formats/fmsx_cas.h svneol=native#text/plain
|
||||
src/lib/formats/fmtowns_dsk.c svneol=native#text/plain
|
||||
src/lib/formats/fmtowns_dsk.h svneol=native#text/plain
|
||||
src/lib/formats/g64_dsk.c svneol=native#text/plain
|
||||
src/lib/formats/g64_dsk.h svneol=native#text/plain
|
||||
src/lib/formats/gtp_cas.c svneol=native#text/plain
|
||||
|
40
src/lib/formats/fmtowns_dsk.c
Normal file
40
src/lib/formats/fmtowns_dsk.c
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* fmtowns_dsk.c
|
||||
*
|
||||
* FM Towns floppy image format
|
||||
*
|
||||
* Created on: 23/03/2014
|
||||
*/
|
||||
|
||||
#include "emu.h"
|
||||
#include "formats/fmtowns_dsk.h"
|
||||
|
||||
fmtowns_format::fmtowns_format() : wd177x_format(formats)
|
||||
{
|
||||
}
|
||||
|
||||
const char *fmtowns_format::name() const
|
||||
{
|
||||
return "fmtowns";
|
||||
}
|
||||
|
||||
const char *fmtowns_format::description() const
|
||||
{
|
||||
return "FM Towns disk image";
|
||||
}
|
||||
|
||||
const char *fmtowns_format::extensions() const
|
||||
{
|
||||
return "bin";
|
||||
}
|
||||
|
||||
// Unverified gap sizes
|
||||
const fmtowns_format::format fmtowns_format::formats[] = {
|
||||
{ /* 1.2MB 3 1/2 inch high density */
|
||||
floppy_image::FF_35, floppy_image::DSHD, floppy_image::MFM,
|
||||
1200, 8, 77, 2, 1024, {}, 1, {}, 50, 22, 84
|
||||
},
|
||||
{}
|
||||
};
|
||||
|
||||
const floppy_format_type FLOPPY_FMTOWNS_FORMAT = &floppy_image_format_creator<fmtowns_format>;
|
27
src/lib/formats/fmtowns_dsk.h
Normal file
27
src/lib/formats/fmtowns_dsk.h
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* fmtowns_dsk.h
|
||||
*
|
||||
* Created on: 23/03/2014
|
||||
*/
|
||||
|
||||
#ifndef FMTOWNS_DSK_H_
|
||||
#define FMTOWNS_DSK_H_
|
||||
|
||||
#include "wd177x_dsk.h"
|
||||
|
||||
class fmtowns_format : public wd177x_format {
|
||||
public:
|
||||
fmtowns_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_FMTOWNS_FORMAT;
|
||||
|
||||
|
||||
#endif /* FMTOWNS_DSK_H_ */
|
@ -144,6 +144,7 @@ FORMATSOBJS = \
|
||||
$(LIBOBJ)/formats/fdi_dsk.o \
|
||||
$(LIBOBJ)/formats/fm7_cas.o \
|
||||
$(LIBOBJ)/formats/fmsx_cas.o \
|
||||
$(LIBOBJ)/formats/fmtowns_dsk.o \
|
||||
$(LIBOBJ)/formats/g64_dsk.o \
|
||||
$(LIBOBJ)/formats/gtp_cas.o \
|
||||
$(LIBOBJ)/formats/hect_dsk.o \
|
||||
|
@ -499,19 +499,18 @@ WRITE_LINE_MEMBER( towns_state::mb8877a_drq_w )
|
||||
|
||||
READ8_MEMBER(towns_state::towns_floppy_r)
|
||||
{
|
||||
device_image_interface* image;
|
||||
UINT8 ret;
|
||||
|
||||
switch(offset)
|
||||
{
|
||||
case 0x00:
|
||||
return m_fdc->status_r(space, offset/2);
|
||||
return m_fdc->status_r(space, 0);
|
||||
case 0x02:
|
||||
return m_fdc->track_r(space, offset/2);
|
||||
return m_fdc->track_r(space, 0);
|
||||
case 0x04:
|
||||
return m_fdc->sector_r(space, offset/2);
|
||||
return m_fdc->sector_r(space, 0);
|
||||
case 0x06:
|
||||
return m_fdc->data_r(space, offset/2);
|
||||
return m_fdc->data_r(space, 0);
|
||||
case 0x08: // selected drive status?
|
||||
//logerror("FDC: read from offset 0x08\n");
|
||||
ret = 0x80; // always set
|
||||
@ -519,14 +518,12 @@ READ8_MEMBER(towns_state::towns_floppy_r)
|
||||
{
|
||||
case 1:
|
||||
ret |= 0x0c;
|
||||
image = dynamic_cast<device_image_interface*>(space.machine().device("floppy0"));
|
||||
if(image->exists())
|
||||
if(m_flop0->get_device()->exists())
|
||||
ret |= 0x03;
|
||||
break;
|
||||
case 2:
|
||||
ret |= 0x0c;
|
||||
image = dynamic_cast<device_image_interface*>(space.machine().device("floppy1"));
|
||||
if(image->exists())
|
||||
if(m_flop1->get_device()->exists())
|
||||
ret |= 0x03;
|
||||
break;
|
||||
case 3:
|
||||
@ -538,6 +535,10 @@ READ8_MEMBER(towns_state::towns_floppy_r)
|
||||
return ret;
|
||||
case 0x0e: // DRVCHG
|
||||
logerror("FDC: read from offset 0x0e\n");
|
||||
if(m_towns_selected_drive == 1)
|
||||
return m_flop0->get_device()->dskchg_r();
|
||||
if(m_towns_selected_drive == 2)
|
||||
return m_flop1->get_device()->dskchg_r();
|
||||
return 0x00;
|
||||
default:
|
||||
logerror("FDC: read from invalid or unimplemented register %02x\n",offset);
|
||||
@ -547,6 +548,8 @@ READ8_MEMBER(towns_state::towns_floppy_r)
|
||||
|
||||
WRITE8_MEMBER(towns_state::towns_floppy_w)
|
||||
{
|
||||
floppy_image_device* sel[4] = { m_flop0->get_device(), m_flop1->get_device(), NULL, NULL };
|
||||
|
||||
switch(offset)
|
||||
{
|
||||
case 0x00:
|
||||
@ -555,29 +558,36 @@ WRITE8_MEMBER(towns_state::towns_floppy_w)
|
||||
return;
|
||||
if(data == 0xfe)
|
||||
return;
|
||||
m_fdc->command_w(space, offset/2,data);
|
||||
m_fdc->cmd_w(space, 0,data);
|
||||
logerror("FDC: Command %02x\n",data);
|
||||
break;
|
||||
case 0x02:
|
||||
m_fdc->track_w(space, offset/2,data);
|
||||
m_fdc->track_w(space, 0,data);
|
||||
logerror("FDC: Track %02x\n",data);
|
||||
break;
|
||||
case 0x04:
|
||||
m_fdc->sector_w(space, offset/2,data);
|
||||
m_fdc->sector_w(space, 0,data);
|
||||
logerror("FDC: Sector %02x\n",data);
|
||||
break;
|
||||
case 0x06:
|
||||
m_fdc->data_w(space, offset/2,data);
|
||||
m_fdc->data_w(space, 0,data);
|
||||
logerror("FDC: Data %02x\n",data);
|
||||
break;
|
||||
case 0x08:
|
||||
// bit 5 - CLKSEL
|
||||
if(m_towns_selected_drive != 0 && m_towns_selected_drive < 2)
|
||||
if(m_towns_selected_drive != 0)
|
||||
{
|
||||
floppy_mon_w(floppy_get_device(space.machine(), m_towns_selected_drive-1), !BIT(data, 4));
|
||||
floppy_drive_set_ready_state(floppy_get_device(space.machine(), m_towns_selected_drive-1), data & 0x10,0);
|
||||
if(sel[m_towns_selected_drive-1] != NULL)
|
||||
{
|
||||
sel[m_towns_selected_drive-1]->mon_w((~data & 0x10)>>4);
|
||||
sel[m_towns_selected_drive-1]->ss_w((data & 0x04)>>2);
|
||||
}
|
||||
}
|
||||
m_fdc->set_side((data & 0x04)>>2);
|
||||
m_fdc->dden_w(BIT(~data, 1));
|
||||
|
||||
m_towns_fdc_irq6mask = data & 0x01;
|
||||
logerror("FDC: write %02x to offset 0x08\n",data);
|
||||
logerror("FDC: Config drive%i %02x\n",m_towns_selected_drive-1,data);
|
||||
|
||||
break;
|
||||
case 0x0c: // drive select
|
||||
switch(data & 0x0f)
|
||||
@ -587,19 +597,23 @@ WRITE8_MEMBER(towns_state::towns_floppy_w)
|
||||
break;
|
||||
case 0x01:
|
||||
m_towns_selected_drive = 1;
|
||||
m_fdc->set_drive(0);
|
||||
if(sel[0] != NULL)
|
||||
m_fdc->set_floppy(sel[0]);
|
||||
break;
|
||||
case 0x02:
|
||||
m_towns_selected_drive = 2;
|
||||
m_fdc->set_drive(1);
|
||||
if(sel[1] != NULL)
|
||||
m_fdc->set_floppy(sel[1]);
|
||||
break;
|
||||
case 0x04:
|
||||
m_towns_selected_drive = 3;
|
||||
m_fdc->set_drive(2);
|
||||
if(sel[2] != NULL)
|
||||
m_fdc->set_floppy(sel[2]);
|
||||
break;
|
||||
case 0x08:
|
||||
m_towns_selected_drive = 4;
|
||||
m_fdc->set_drive(3);
|
||||
if(sel[3] != NULL)
|
||||
m_fdc->set_floppy(sel[3]);
|
||||
break;
|
||||
}
|
||||
logerror("FDC: drive select %02x\n",data);
|
||||
@ -610,8 +624,8 @@ WRITE8_MEMBER(towns_state::towns_floppy_w)
|
||||
}
|
||||
|
||||
READ16_MEMBER(towns_state::towns_fdc_dma_r)
|
||||
{
|
||||
return m_fdc->data_r(generic_space(), 0);
|
||||
{ UINT16 data = m_fdc->data_r(generic_space(), 0);
|
||||
return data;
|
||||
}
|
||||
|
||||
WRITE16_MEMBER(towns_state::towns_fdc_dma_w)
|
||||
@ -2582,7 +2596,6 @@ void towns_state::driver_start()
|
||||
|
||||
m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(towns_state::towns_irq_callback),this));
|
||||
m_maincpu->space(AS_PROGRAM).install_ram(0x100000,m_ram->size()-1,0xffffffff,0,NULL);
|
||||
|
||||
}
|
||||
|
||||
void marty_state::driver_start()
|
||||
@ -2592,10 +2605,15 @@ void marty_state::driver_start()
|
||||
m_towns_machine_id = 0x034a;
|
||||
}
|
||||
|
||||
void towns_state::machine_start()
|
||||
{
|
||||
m_flop0->get_device()->set_rpm(360);
|
||||
m_flop1->get_device()->set_rpm(360);
|
||||
}
|
||||
|
||||
void towns_state::machine_reset()
|
||||
{
|
||||
address_space &program = m_maincpu->space(AS_PROGRAM);
|
||||
m_fdc = machine().device<mb8877_device>("fdc");
|
||||
m_messram = m_ram;
|
||||
m_cdrom = machine().device<cdrom_image_device>("cdrom");
|
||||
m_cdda = machine().device<cdda_device>("cdda");
|
||||
@ -2633,35 +2651,13 @@ READ8_MEMBER(towns_state::get_slave_ack)
|
||||
return 0x00;
|
||||
}
|
||||
|
||||
static const wd17xx_interface towns_mb8877a_interface =
|
||||
{
|
||||
DEVCB_NULL,
|
||||
DEVCB_DRIVER_LINE_MEMBER( towns_state, mb8877a_irq_w),
|
||||
DEVCB_DRIVER_LINE_MEMBER( towns_state, mb8877a_drq_w),
|
||||
{FLOPPY_0,FLOPPY_1,0,0}
|
||||
};
|
||||
FLOPPY_FORMATS_MEMBER( towns_state::floppy_formats )
|
||||
FLOPPY_FMTOWNS_FORMAT
|
||||
FLOPPY_FORMATS_END
|
||||
|
||||
static LEGACY_FLOPPY_OPTIONS_START( towns )
|
||||
LEGACY_FLOPPY_OPTION( fmt_bin, "bin", "BIN disk image", basicdsk_identify_default, basicdsk_construct_default, NULL,
|
||||
HEADS([2])
|
||||
TRACKS([77])
|
||||
SECTORS([8])
|
||||
SECTOR_LENGTH([1024])
|
||||
FIRST_SECTOR_ID([1]))
|
||||
LEGACY_FLOPPY_OPTIONS_END
|
||||
|
||||
static const floppy_interface towns_floppy_interface =
|
||||
{
|
||||
DEVCB_NULL,
|
||||
DEVCB_NULL,
|
||||
DEVCB_NULL,
|
||||
DEVCB_NULL,
|
||||
DEVCB_NULL,
|
||||
FLOPPY_STANDARD_5_25_DSHD,
|
||||
LEGACY_FLOPPY_OPTIONS_NAME(towns),
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
static SLOT_INTERFACE_START( towns_floppies )
|
||||
SLOT_INTERFACE( "35hd", FLOPPY_35_HD )
|
||||
SLOT_INTERFACE_END
|
||||
|
||||
static const upd71071_intf towns_dma_config =
|
||||
{
|
||||
@ -2762,8 +2758,11 @@ static MACHINE_CONFIG_FRAGMENT( towns_base )
|
||||
|
||||
MCFG_PIC8259_ADD( "pic8259_slave", DEVWRITELINE("pic8259_master", pic8259_device, ir7_w), GND, NULL)
|
||||
|
||||
MCFG_MB8877_ADD("fdc",towns_mb8877a_interface)
|
||||
MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(towns_floppy_interface)
|
||||
MCFG_MB8877x_ADD("fdc",XTAL_8MHz/4) // clock unknown
|
||||
MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(towns_state,mb8877a_irq_w))
|
||||
MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(towns_state,mb8877a_drq_w))
|
||||
MCFG_FLOPPY_DRIVE_ADD("fdc:0", towns_floppies, "35hd", towns_state::floppy_formats)
|
||||
MCFG_FLOPPY_DRIVE_ADD("fdc:1", towns_floppies, "35hd", towns_state::floppy_formats)
|
||||
|
||||
MCFG_CDROM_ADD("cdrom",towns_cdrom)
|
||||
|
||||
|
@ -11,9 +11,9 @@
|
||||
#include "imagedev/chd_cd.h"
|
||||
#include "machine/pit8253.h"
|
||||
#include "machine/pic8259.h"
|
||||
#include "formats/basicdsk.h"
|
||||
#include "machine/wd17xx.h"
|
||||
#include "imagedev/flopdrv.h"
|
||||
#include "machine/wd_fdc.h"
|
||||
#include "imagedev/floppy.h"
|
||||
#include "formats/fmtowns_dsk.h"
|
||||
#include "machine/upd71071.h"
|
||||
#include "machine/ram.h"
|
||||
#include "machine/nvram.h"
|
||||
@ -87,6 +87,9 @@ class towns_state : public driver_device
|
||||
m_dma_2(*this, "dma_2"),
|
||||
m_palette(*this, "palette"),
|
||||
m_ram(*this, RAM_TAG),
|
||||
m_fdc(*this, "fdc"),
|
||||
m_flop0(*this, "fdc:0"),
|
||||
m_flop1(*this, "fdc:1"),
|
||||
m_nvram(*this, "nvram"),
|
||||
m_nvram16(*this, "nvram16"),
|
||||
m_ctrltype(*this, "ctrltype"),
|
||||
@ -119,7 +122,9 @@ class towns_state : public driver_device
|
||||
required_device<upd71071_device> m_dma_2;
|
||||
required_device<palette_device> m_palette;
|
||||
required_device<ram_device> m_ram;
|
||||
mb8877_device* m_fdc;
|
||||
required_device<mb8877_t> m_fdc;
|
||||
required_device<floppy_connector> m_flop0;
|
||||
required_device<floppy_connector> m_flop1;
|
||||
ram_device* m_messram;
|
||||
cdrom_image_device* m_cdrom;
|
||||
cdda_device* m_cdda;
|
||||
@ -194,6 +199,7 @@ class towns_state : public driver_device
|
||||
optional_shared_ptr<UINT16> m_nvram16;
|
||||
|
||||
virtual void driver_start();
|
||||
virtual void machine_start();
|
||||
virtual void machine_reset();
|
||||
virtual void video_start();
|
||||
UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||
@ -328,6 +334,7 @@ public:
|
||||
DECLARE_READ8_MEMBER(get_slave_ack);
|
||||
IRQ_CALLBACK_MEMBER(towns_irq_callback);
|
||||
DECLARE_WRITE_LINE_MEMBER(towns_fm_irq);
|
||||
DECLARE_FLOPPY_FORMATS(floppy_formats);
|
||||
void towns_crtc_refresh_mode();
|
||||
void towns_update_kanji_offset();
|
||||
void towns_update_palette();
|
||||
|
Loading…
Reference in New Issue
Block a user