mirror of
https://github.com/holub/mame
synced 2025-07-05 09:57:47 +03:00
pf10.c: add some meat to the skeleton
This commit is contained in:
parent
9af17ac6e0
commit
f2d192bac1
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
Battery operated portable 3.5" floppy drive
|
Battery operated portable 3.5" floppy drive
|
||||||
|
|
||||||
Status: Skeleton driver, not doing much.
|
Status: Needs lots of work.
|
||||||
|
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
@ -29,12 +29,14 @@ static ADDRESS_MAP_START( cpu_mem, AS_PROGRAM, 8, epson_pf10_device )
|
|||||||
AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE("maincpu", hd6303y_cpu_device, m6801_io_r, m6801_io_w)
|
AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE("maincpu", hd6303y_cpu_device, m6801_io_r, m6801_io_w)
|
||||||
AM_RANGE(0x0040, 0x00ff) AM_RAM /* 192 bytes internal ram */
|
AM_RANGE(0x0040, 0x00ff) AM_RAM /* 192 bytes internal ram */
|
||||||
AM_RANGE(0x0800, 0x0fff) AM_RAM /* external 2k ram */
|
AM_RANGE(0x0800, 0x0fff) AM_RAM /* external 2k ram */
|
||||||
|
AM_RANGE(0x1000, 0x17ff) AM_READWRITE(fdc_r, fdc_w)
|
||||||
|
AM_RANGE(0x1800, 0x1fff) AM_WRITE(fdc_tc_w)
|
||||||
AM_RANGE(0xe000, 0xffff) AM_ROM AM_REGION("maincpu", 0)
|
AM_RANGE(0xe000, 0xffff) AM_ROM AM_REGION("maincpu", 0)
|
||||||
ADDRESS_MAP_END
|
ADDRESS_MAP_END
|
||||||
|
|
||||||
static ADDRESS_MAP_START( cpu_io, AS_IO, 8, epson_pf10_device )
|
static ADDRESS_MAP_START( cpu_io, AS_IO, 8, epson_pf10_device )
|
||||||
ADDRESS_MAP_UNMAP_HIGH
|
AM_RANGE(M6801_PORT1, M6801_PORT1) AM_READWRITE(port1_r, port1_w)
|
||||||
ADDRESS_MAP_GLOBAL_MASK(0xff)
|
AM_RANGE(M6801_PORT2, M6801_PORT2) AM_READWRITE(port2_r, port2_w)
|
||||||
ADDRESS_MAP_END
|
ADDRESS_MAP_END
|
||||||
|
|
||||||
|
|
||||||
@ -63,14 +65,17 @@ static SLOT_INTERFACE_START( pf10_floppies )
|
|||||||
SLOT_INTERFACE_END
|
SLOT_INTERFACE_END
|
||||||
|
|
||||||
static MACHINE_CONFIG_FRAGMENT( pf10 )
|
static MACHINE_CONFIG_FRAGMENT( pf10 )
|
||||||
MCFG_CPU_ADD("maincpu", HD6303Y, XTAL_2_4576MHz / 4 /* ??? */) // HD63A03XF
|
MCFG_CPU_ADD("maincpu", HD6303Y, XTAL_4_9152MHz) // HD63A03XF
|
||||||
MCFG_CPU_PROGRAM_MAP(cpu_mem)
|
MCFG_CPU_PROGRAM_MAP(cpu_mem)
|
||||||
MCFG_CPU_IO_MAP(cpu_io)
|
MCFG_CPU_IO_MAP(cpu_io)
|
||||||
|
MCFG_M6801_SER_TX(DEVWRITELINE(DEVICE_SELF, epson_pf10_device, hd6303_tx_w))
|
||||||
|
|
||||||
MCFG_UPD765A_ADD("upd765a", false, true)
|
MCFG_UPD765A_ADD("upd765a", false, true)
|
||||||
MCFG_FLOPPY_DRIVE_ADD("upd765a:0", pf10_floppies, "smd165", floppy_image_device::default_floppy_formats)
|
MCFG_FLOPPY_DRIVE_ADD("upd765a:0", pf10_floppies, "smd165", floppy_image_device::default_floppy_formats)
|
||||||
|
|
||||||
MCFG_EPSON_SIO_ADD("sio", NULL)
|
MCFG_EPSON_SIO_ADD("sio", NULL)
|
||||||
|
MCFG_EPSON_SIO_RX(DEVWRITELINE(DEVICE_SELF, epson_pf10_device, rxc_w))
|
||||||
|
MCFG_EPSON_SIO_PIN(DEVWRITELINE(DEVICE_SELF, epson_pf10_device, pinc_w))
|
||||||
MACHINE_CONFIG_END
|
MACHINE_CONFIG_END
|
||||||
|
|
||||||
machine_config_constructor epson_pf10_device::device_mconfig_additions() const
|
machine_config_constructor epson_pf10_device::device_mconfig_additions() const
|
||||||
@ -92,8 +97,12 @@ epson_pf10_device::epson_pf10_device(const machine_config &mconfig, const char *
|
|||||||
device_epson_sio_interface(mconfig, *this),
|
device_epson_sio_interface(mconfig, *this),
|
||||||
m_cpu(*this, "maincpu"),
|
m_cpu(*this, "maincpu"),
|
||||||
m_fdc(*this, "upd765a"),
|
m_fdc(*this, "upd765a"),
|
||||||
m_sio(*this, "sio")
|
m_sio_output(*this, "sio"),
|
||||||
|
m_port1(0xff),
|
||||||
|
m_port2(0xff),
|
||||||
|
m_rxc(1)
|
||||||
{
|
{
|
||||||
|
m_sio_input = dynamic_cast<epson_sio_device *>(owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -103,49 +112,131 @@ epson_pf10_device::epson_pf10_device(const machine_config &mconfig, const char *
|
|||||||
|
|
||||||
void epson_pf10_device::device_start()
|
void epson_pf10_device::device_start()
|
||||||
{
|
{
|
||||||
|
m_timer = timer_alloc(0, NULL);
|
||||||
m_floppy = subdevice<floppy_connector>("upd765a:0")->get_device();
|
m_floppy = subdevice<floppy_connector>("upd765a:0")->get_device();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// device_reset - device-specific reset
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
void epson_pf10_device::device_reset()
|
||||||
|
{
|
||||||
|
m_timer->adjust(attotime::zero, 0, attotime::from_hz(38400 * 8));
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
// tx_w
|
// device_timer - handler timer events
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
void epson_pf10_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
|
||||||
|
{
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
m_cpu->m6801_clock_serial();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//**************************************************************************
|
||||||
|
// CPU
|
||||||
|
//**************************************************************************
|
||||||
|
|
||||||
|
READ8_MEMBER( epson_pf10_device::port1_r )
|
||||||
|
{
|
||||||
|
logerror("%s: port1_r(%02x)\n", tag(), m_port1);
|
||||||
|
return m_port1;
|
||||||
|
}
|
||||||
|
|
||||||
|
WRITE8_MEMBER( epson_pf10_device::port1_w )
|
||||||
|
{
|
||||||
|
logerror("%s: port1_w(%02x)\n", tag(), data);
|
||||||
|
}
|
||||||
|
|
||||||
|
READ8_MEMBER( epson_pf10_device::port2_r )
|
||||||
|
{
|
||||||
|
logerror("%s: port2_r(%02x)\n", tag(), m_port2);
|
||||||
|
return m_port2;
|
||||||
|
}
|
||||||
|
|
||||||
|
WRITE8_MEMBER( epson_pf10_device::port2_w )
|
||||||
|
{
|
||||||
|
m_floppy->mon_w(data & PORT2_MON);
|
||||||
|
logerror("%s: port2_w(%02x)\n", tag(), data);
|
||||||
|
}
|
||||||
|
|
||||||
|
READ8_MEMBER( epson_pf10_device::fdc_r )
|
||||||
|
{
|
||||||
|
logerror("%s: fdc_r @ %04x\n", tag(), offset);
|
||||||
|
return 0xff;
|
||||||
|
}
|
||||||
|
|
||||||
|
WRITE8_MEMBER( epson_pf10_device::fdc_w )
|
||||||
|
{
|
||||||
|
logerror("%s: fdc_w @ %04x (%02x)\n", tag(), offset, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
WRITE8_MEMBER( epson_pf10_device::fdc_tc_w )
|
||||||
|
{
|
||||||
|
logerror("%s: fdc_tc_w(%02x)\n", tag(), data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//**************************************************************************
|
||||||
|
// SIO INTERFACE
|
||||||
|
//**************************************************************************
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// rxc_w - rx input
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
WRITE_LINE_MEMBER( epson_pf10_device::rxc_w )
|
||||||
|
{
|
||||||
|
m_rxc = state;
|
||||||
|
m_sio_input->rx_w(m_hd6303_tx & m_rxc);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// pinc_w - pin input
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
WRITE_LINE_MEMBER( epson_pf10_device::pinc_w )
|
||||||
|
{
|
||||||
|
m_pinc = state;
|
||||||
|
m_sio_input->pin_w(m_pinc);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// hd6303_tx_w - rx output
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
WRITE_LINE_MEMBER( epson_pf10_device::hd6303_tx_w )
|
||||||
|
{
|
||||||
|
m_hd6303_tx = state;
|
||||||
|
m_sio_input->rx_w(m_hd6303_tx & m_rxc);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// tx_w - tx input
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
|
|
||||||
void epson_pf10_device::tx_w(int level)
|
void epson_pf10_device::tx_w(int level)
|
||||||
{
|
{
|
||||||
logerror("%s: tx_w(%d)\n", tag(), level);
|
if (level)
|
||||||
|
m_port2 |= PORT2_RXD;
|
||||||
|
else
|
||||||
|
m_port2 &= ~PORT2_RXD;
|
||||||
|
|
||||||
|
m_sio_output->tx_w(level);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
// pout_w
|
// pout_w - pout input
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
|
|
||||||
void epson_pf10_device::pout_w(int level)
|
void epson_pf10_device::pout_w(int level)
|
||||||
{
|
{
|
||||||
logerror("%s: pout_w(%d)\n", tag(), level);
|
m_sio_output->pout_w(level);
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------
|
|
||||||
// rx_r
|
|
||||||
//-------------------------------------------------
|
|
||||||
|
|
||||||
int epson_pf10_device::rx_r()
|
|
||||||
{
|
|
||||||
logerror("%s: rx_r\n", tag());
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------
|
|
||||||
// pin_r
|
|
||||||
//-------------------------------------------------
|
|
||||||
|
|
||||||
int epson_pf10_device::pin_r()
|
|
||||||
{
|
|
||||||
logerror("%s: pin_r\n", tag());
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
@ -35,22 +35,63 @@ public:
|
|||||||
virtual const rom_entry *device_rom_region() const;
|
virtual const rom_entry *device_rom_region() const;
|
||||||
virtual machine_config_constructor device_mconfig_additions() const;
|
virtual machine_config_constructor device_mconfig_additions() const;
|
||||||
|
|
||||||
|
// floppy disk controller
|
||||||
|
DECLARE_READ8_HANDLER( fdc_r );
|
||||||
|
DECLARE_WRITE8_HANDLER( fdc_w );
|
||||||
|
DECLARE_WRITE8_HANDLER( fdc_tc_w );
|
||||||
|
|
||||||
|
// hd6303 i/o
|
||||||
|
DECLARE_READ8_MEMBER( port1_r );
|
||||||
|
DECLARE_WRITE8_MEMBER( port1_w );
|
||||||
|
DECLARE_READ8_MEMBER( port2_r );
|
||||||
|
DECLARE_WRITE8_MEMBER( port2_w );
|
||||||
|
|
||||||
|
// serial output from main cpu
|
||||||
|
DECLARE_WRITE_LINE_MEMBER( hd6303_tx_w );
|
||||||
|
|
||||||
|
// from sio output
|
||||||
|
DECLARE_WRITE_LINE_MEMBER( rxc_w );
|
||||||
|
DECLARE_WRITE_LINE_MEMBER( pinc_w );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// device-level overrides
|
// device-level overrides
|
||||||
virtual void device_start();
|
virtual void device_start();
|
||||||
|
virtual void device_reset();
|
||||||
|
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
|
||||||
|
|
||||||
// device_epson_sio_interface overrides
|
// device_epson_sio_interface overrides
|
||||||
virtual int rx_r();
|
|
||||||
virtual int pin_r();
|
|
||||||
virtual void tx_w(int level);
|
virtual void tx_w(int level);
|
||||||
virtual void pout_w(int level);
|
virtual void pout_w(int level);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
required_device<cpu_device> m_cpu;
|
required_device<hd6303y_cpu_device> m_cpu;
|
||||||
required_device<upd765a_device> m_fdc;
|
required_device<upd765a_device> m_fdc;
|
||||||
required_device<epson_sio_device> m_sio;
|
required_device<epson_sio_device> m_sio_output;
|
||||||
|
|
||||||
|
epson_sio_device *m_sio_input;
|
||||||
floppy_image_device *m_floppy;
|
floppy_image_device *m_floppy;
|
||||||
|
|
||||||
|
emu_timer *m_timer;
|
||||||
|
|
||||||
|
UINT8 m_port1;
|
||||||
|
UINT8 m_port2;
|
||||||
|
|
||||||
|
int m_rxc;
|
||||||
|
int m_hd6303_tx;
|
||||||
|
int m_pinc;
|
||||||
|
|
||||||
|
// port definitions
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
PORT2_SEEK = 0x01,
|
||||||
|
PORT2_SWCOM = 0x02, // ?
|
||||||
|
PORT2_RS232ON = 0x04, // to nmi?
|
||||||
|
PORT2_RXD = 0x08,
|
||||||
|
PORT2_TXD = 0x10,
|
||||||
|
PORT2_FDCRST = 0x20,
|
||||||
|
PORT2_MON = 0x40,
|
||||||
|
PORT2_BATCKEN = 0x80 // ?
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user