summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Dirk Best <mail@dirk-best.de>2014-01-04 18:13:18 +0000
committer Dirk Best <mail@dirk-best.de>2014-01-04 18:13:18 +0000
commitf2d192bac1d24bbf4b603dcba38af7cfbc8a1d4e (patch)
tree4723ab95779ac81a973d02cc4e59c20a851a0aa5 /src
parent9af17ac6e0c46243645cf1bed58b3a1ebca9e117 (diff)
pf10.c: add some meat to the skeleton
Diffstat (limited to 'src')
-rw-r--r--src/mess/machine/pf10.c133
-rw-r--r--src/mess/machine/pf10.h49
2 files changed, 157 insertions, 25 deletions
diff --git a/src/mess/machine/pf10.c b/src/mess/machine/pf10.c
index 2e35fbd4a69..1faf656637d 100644
--- a/src/mess/machine/pf10.c
+++ b/src/mess/machine/pf10.c
@@ -7,7 +7,7 @@
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(0x0040, 0x00ff) AM_RAM /* 192 bytes internal 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)
ADDRESS_MAP_END
static ADDRESS_MAP_START( cpu_io, AS_IO, 8, epson_pf10_device )
- ADDRESS_MAP_UNMAP_HIGH
- ADDRESS_MAP_GLOBAL_MASK(0xff)
+ AM_RANGE(M6801_PORT1, M6801_PORT1) AM_READWRITE(port1_r, port1_w)
+ AM_RANGE(M6801_PORT2, M6801_PORT2) AM_READWRITE(port2_r, port2_w)
ADDRESS_MAP_END
@@ -63,14 +65,17 @@ static SLOT_INTERFACE_START( pf10_floppies )
SLOT_INTERFACE_END
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_IO_MAP(cpu_io)
+ MCFG_M6801_SER_TX(DEVWRITELINE(DEVICE_SELF, epson_pf10_device, hd6303_tx_w))
MCFG_UPD765A_ADD("upd765a", false, true)
MCFG_FLOPPY_DRIVE_ADD("upd765a:0", pf10_floppies, "smd165", floppy_image_device::default_floppy_formats)
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_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),
m_cpu(*this, "maincpu"),
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()
{
+ m_timer = timer_alloc(0, NULL);
m_floppy = subdevice<floppy_connector>("upd765a:0")->get_device();
}
-
//-------------------------------------------------
-// tx_w
+// device_reset - device-specific reset
//-------------------------------------------------
-void epson_pf10_device::tx_w(int level)
+void epson_pf10_device::device_reset()
{
- logerror("%s: tx_w(%d)\n", tag(), level);
+ m_timer->adjust(attotime::zero, 0, attotime::from_hz(38400 * 8));
}
-
//-------------------------------------------------
-// pout_w
+// device_timer - handler timer events
//-------------------------------------------------
-void epson_pf10_device::pout_w(int level)
+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: pout_w(%d)\n", tag(), level);
+ logerror("%s: fdc_tc_w(%02x)\n", tag(), data);
}
+//**************************************************************************
+// SIO INTERFACE
+//**************************************************************************
+
//-------------------------------------------------
-// rx_r
+// rxc_w - rx input
//-------------------------------------------------
-int epson_pf10_device::rx_r()
+WRITE_LINE_MEMBER( epson_pf10_device::rxc_w )
{
- logerror("%s: rx_r\n", tag());
+ m_rxc = state;
+ m_sio_input->rx_w(m_hd6303_tx & m_rxc);
+}
+
+//-------------------------------------------------
+// pinc_w - pin input
+//-------------------------------------------------
- return 1;
+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);
+}
//-------------------------------------------------
-// pin_r
+// tx_w - tx input
//-------------------------------------------------
-int epson_pf10_device::pin_r()
+void epson_pf10_device::tx_w(int level)
{
- logerror("%s: pin_r\n", tag());
+ if (level)
+ m_port2 |= PORT2_RXD;
+ else
+ m_port2 &= ~PORT2_RXD;
+
+ m_sio_output->tx_w(level);
+}
+
+//-------------------------------------------------
+// pout_w - pout input
+//-------------------------------------------------
- return 1;
+void epson_pf10_device::pout_w(int level)
+{
+ m_sio_output->pout_w(level);
}
diff --git a/src/mess/machine/pf10.h b/src/mess/machine/pf10.h
index c2288599e1b..cd9fcfac3e3 100644
--- a/src/mess/machine/pf10.h
+++ b/src/mess/machine/pf10.h
@@ -35,22 +35,63 @@ public:
virtual const rom_entry *device_rom_region() 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:
// device-level overrides
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
- virtual int rx_r();
- virtual int pin_r();
virtual void tx_w(int level);
virtual void pout_w(int level);
private:
- required_device<cpu_device> m_cpu;
+ required_device<hd6303y_cpu_device> m_cpu;
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;
+
+ 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 // ?
+ };
};