summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/machine/applefdintf.cpp
diff options
context:
space:
mode:
author arbee <rb6502@users.noreply.github.com>2020-05-23 19:30:21 -0400
committer arbee <rb6502@users.noreply.github.com>2020-05-23 19:30:21 -0400
commitf6cea0ce99b5424835d28c80f1d759a7c2a78e5d (patch)
tree03fb0cca148244019b13dbcfc1366106fb46ff1b /src/devices/machine/applefdintf.cpp
parent1c684902e29cea17232ad763956a9865fa651e69 (diff)
new files (nw)
Diffstat (limited to 'src/devices/machine/applefdintf.cpp')
-rwxr-xr-xsrc/devices/machine/applefdintf.cpp73
1 files changed, 73 insertions, 0 deletions
diff --git a/src/devices/machine/applefdintf.cpp b/src/devices/machine/applefdintf.cpp
new file mode 100755
index 00000000000..3b1590720c1
--- /dev/null
+++ b/src/devices/machine/applefdintf.cpp
@@ -0,0 +1,73 @@
+// license:BSD-3-Clause
+// copyright-holders:Nathan Woods, Raphael Nabet, R. Belmont
+
+#include "emu.h"
+#include "applefdintf.h"
+#include "formats/ap2_dsk.h"
+#include "formats/ap_dsk35.h"
+#include "formats/pc_dsk.h"
+
+FLOPPY_FORMATS_MEMBER(applefdintf_device::formats_525_13)
+ FLOPPY_EDD_FORMAT,
+ FLOPPY_WOZ_FORMAT
+FLOPPY_FORMATS_END
+
+FLOPPY_FORMATS_MEMBER(applefdintf_device::formats_525)
+ FLOPPY_A216S_FORMAT,
+ FLOPPY_RWTS18_FORMAT,
+ FLOPPY_EDD_FORMAT,
+ FLOPPY_WOZ_FORMAT
+FLOPPY_FORMATS_END
+
+FLOPPY_FORMATS_MEMBER(applefdintf_device::formats_35)
+ FLOPPY_DC42_FORMAT,
+ FLOPPY_PC_FORMAT
+FLOPPY_FORMATS_END
+
+void applefdintf_device::floppies_525(device_slot_interface &device)
+{
+ device.option_add("525", FLOPPY_525_SD);
+}
+
+void applefdintf_device::floppies_35(device_slot_interface &device)
+{
+ device.option_add("35", FLOPPY_35_HD);
+}
+
+applefdintf_device::applefdintf_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
+ device_t(mconfig, type, tag, owner, clock),
+ m_phases_cb(*this),
+ m_devsel_cb(*this),
+ m_sel35_cb(*this),
+ m_hdsel_cb(*this)
+{
+}
+
+void applefdintf_device::device_start()
+{
+ m_phases_cb.resolve_safe();
+ m_devsel_cb.resolve_safe();
+ m_sel35_cb.resolve_safe();
+ m_hdsel_cb.resolve_safe();
+ save_item(NAME(m_phases));
+ save_item(NAME(m_phases_input));
+}
+
+void applefdintf_device::device_reset()
+{
+ m_phases = 0xf0;
+ m_phases_input = 0x00;
+ update_phases();
+}
+
+void applefdintf_device::phases_w(u8 phases)
+{
+ m_phases_input = phases;
+ update_phases();
+}
+
+void applefdintf_device::update_phases()
+{
+ u8 mask = m_phases >> 4;
+ m_phases_cb((m_phases & mask) | (m_phases_input & (mask ^ 0xf)));
+}