summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/c64/bn1541.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/bus/c64/bn1541.cpp')
-rw-r--r--src/devices/bus/c64/bn1541.cpp154
1 files changed, 154 insertions, 0 deletions
diff --git a/src/devices/bus/c64/bn1541.cpp b/src/devices/bus/c64/bn1541.cpp
new file mode 100644
index 00000000000..41e37f17fdd
--- /dev/null
+++ b/src/devices/bus/c64/bn1541.cpp
@@ -0,0 +1,154 @@
+// license:BSD-3-Clause
+// copyright-holders:Curt Coder, smf
+/**********************************************************************
+
+ SpeedDOS / Burst Nibbler 1541/1571 Parallel Cable emulation
+
+ http://sta.c64.org/cbmparc2.html
+
+**********************************************************************/
+
+#include "bn1541.h"
+
+
+
+//**************************************************************************
+// MACROS / CONSTANTS
+//**************************************************************************
+
+#define LOG 0
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_BN1541 = &device_creator<c64_bn1541_device>;
+
+
+
+//**************************************************************************
+// FLOPPY DRIVE INTERFACE
+//**************************************************************************
+
+//-------------------------------------------------
+// device_c64_floppy_parallel_interface - constructor
+//-------------------------------------------------
+
+device_c64_floppy_parallel_interface::device_c64_floppy_parallel_interface(const machine_config &mconfig, device_t &device) :
+ m_other(NULL)
+{
+}
+
+
+//-------------------------------------------------
+// ~device_c64_floppy_parallel_interface - destructor
+//-------------------------------------------------
+
+device_c64_floppy_parallel_interface::~device_c64_floppy_parallel_interface()
+{
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_bn1541_device - constructor
+//-------------------------------------------------
+
+c64_bn1541_device::c64_bn1541_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_BN1541, "C64 Burst Nibbler 1541/1571 Parallel Cable", tag, owner, clock, "c64_bn1541", __FILE__),
+ device_pet_user_port_interface(mconfig, *this),
+ device_c64_floppy_parallel_interface(mconfig, *this)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_bn1541_device::device_start()
+{
+ device_iterator iter(machine().root_device());
+
+ for (device_t *device = iter.first(); device != NULL; device = iter.next())
+ {
+ device_iterator subiter(*device);
+
+ for (device_t *subdevice = subiter.first(); subdevice != NULL; subdevice = iter.next())
+ {
+ if (subdevice->interface(m_other) && subdevice != this)
+ {
+ if (LOG) logerror("Parallel device %s\n", subdevice->tag());
+
+ // grab the first 1541/1571 and run to the hills
+ m_other->m_other = this;
+ return;
+ }
+ }
+ }
+}
+
+
+//-------------------------------------------------
+// parallel_data_w -
+//-------------------------------------------------
+
+void c64_bn1541_device::parallel_data_w(UINT8 data)
+{
+ if (LOG) logerror("1541 parallel data %02x\n", data);
+
+ output_c((data>>0)&1);
+ output_d((data>>1)&1);
+ output_e((data>>2)&1);
+ output_f((data>>3)&1);
+ output_h((data>>4)&1);
+ output_j((data>>5)&1);
+ output_k((data>>6)&1);
+ output_l((data>>7)&1);
+}
+
+
+//-------------------------------------------------
+// parallel_strobe_w -
+//-------------------------------------------------
+
+void c64_bn1541_device::parallel_strobe_w(int state)
+{
+ if (LOG) logerror("1541 parallel strobe %u\n", state);
+
+ output_b(state);
+}
+
+
+//-------------------------------------------------
+// update_output
+//-------------------------------------------------
+
+void c64_bn1541_device::update_output()
+{
+ if (m_other != NULL)
+ {
+ m_other->parallel_data_w(m_parallel_output);
+ }
+}
+
+
+//-------------------------------------------------
+// input_8 - CIA2 PC write
+//-------------------------------------------------
+
+WRITE_LINE_MEMBER(c64_bn1541_device::input_8)
+{
+ if (LOG) logerror("C64 parallel strobe %u\n", state);
+
+ if (m_other != NULL)
+ {
+ m_other->parallel_strobe_w(state);
+ }
+}