summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/apple2e.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/drivers/apple2e.cpp')
-rw-r--r--src/mame/drivers/apple2e.cpp146
1 files changed, 143 insertions, 3 deletions
diff --git a/src/mame/drivers/apple2e.cpp b/src/mame/drivers/apple2e.cpp
index c41e02dd501..d63d880b12d 100644
--- a/src/mame/drivers/apple2e.cpp
+++ b/src/mame/drivers/apple2e.cpp
@@ -115,6 +115,8 @@ MIG RAM page 2 $CE02 is the speaker/slot bitfield and $CE03 is the paddle/accele
#include "emu.h"
#include "video/apple2.h"
+#define IICP_NEW_IWM (0)
+
#include "cpu/m6502/m6502.h"
#include "cpu/m6502/m65c02.h"
#include "cpu/mcs48/mcs48.h"
@@ -130,6 +132,8 @@ MIG RAM page 2 $CE02 is the speaker/slot bitfield and $CE03 is the paddle/accele
#include "machine/timer.h"
#include "machine/ds1315.h"
#include "machine/apple2common.h"
+#include "machine/applefdintf.h"
+#include "machine/iwm.h"
#include "bus/a2bus/4play.h"
#include "bus/a2bus/a2alfam2.h"
@@ -200,7 +204,6 @@ MIG RAM page 2 $CE02 is the speaker/slot bitfield and $CE03 is the paddle/accele
#define A2_UPPERBANK_TAG "inhbank"
#define IIC_ACIA1_TAG "acia1"
#define IIC_ACIA2_TAG "acia2"
-#define IICP_IWM_TAG "fdc"
#define LASER128_UDC_TAG "l128udc"
#define PRINTER_PORT_TAG "printer"
#define MODEM_PORT_TAG "modem"
@@ -271,7 +274,12 @@ public:
m_acia1(*this, IIC_ACIA1_TAG),
m_acia2(*this, IIC_ACIA2_TAG),
m_laserudc(*this, LASER128_UDC_TAG),
- m_iicpiwm(*this, IICP_IWM_TAG),
+#if IICP_NEW_IWM
+ m_iicpiwm(*this, "fdc"),
+ m_floppy(*this, "fdc:%d", 0U),
+#else
+ m_iicpiwm(*this, "fdc"),
+#endif
m_ds1315(*this, "nsc")
{
m_accel_laser = false;
@@ -282,6 +290,10 @@ public:
m_iscec2000 = false;
m_spectrum_text = false;
m_pal = false;
+#if IICP_NEW_IWM
+ m_cur_floppy = nullptr;
+ m_devsel = 0;
+#endif
}
required_device<cpu_device> m_maincpu;
@@ -316,7 +328,12 @@ public:
required_device<address_map_bank_device> m_lcbank;
optional_device<mos6551_device> m_acia1, m_acia2;
optional_device<applefdc_base_device> m_laserudc;
+#if IICP_NEW_IWM
+ optional_device<applefdintf_device> m_iicpiwm;
+ optional_device_array<floppy_connector, 4> m_floppy;
+#else
optional_device<legacy_iwm_device> m_iicpiwm;
+#endif
required_device<ds1315_device> m_ds1315;
TIMER_DEVICE_CALLBACK_MEMBER(apple2_interrupt);
@@ -530,6 +547,16 @@ private:
u8 mig_r(u16 offset);
void mig_w(u16 offset, u8 data);
+#if IICP_NEW_IWM
+ void phases_w(uint8_t phases);
+ void sel35_w(int sel35);
+ void devsel_w(uint8_t devsel);
+ void hdsel_w(int hdsel);
+ void recalc_active_device();
+
+ floppy_image_device *m_cur_floppy;
+ int m_devsel;
+#endif
offs_t dasm_trampoline(std::ostream &stream, offs_t pc, const util::disasm_interface::data_buffer &opcodes, const util::disasm_interface::data_buffer &params);
};
@@ -561,13 +588,27 @@ u8 apple2e_state::mig_r(u16 offset)
if ((offset >= 0x240) && (offset < 0x260))
{
m_hdsel = false;
+#if IICP_NEW_IWM
+ if (m_cur_floppy)
+ {
+ m_cur_floppy->ss_w(0);
+ }
+#else
sony_set_sel_line(m_iicpiwm, 0);
+#endif
}
if ((offset >= 0x260) && (offset < 0x280))
{
m_hdsel = true;
+#if IICP_NEW_IWM
+ if (m_cur_floppy)
+ {
+ m_cur_floppy->ss_w(1);
+ }
+#else
sony_set_sel_line(m_iicpiwm, 0x80);
+#endif
}
// reset MIG RAM window
@@ -585,7 +626,11 @@ void apple2e_state::mig_w(u16 offset, u8 data)
if (offset == 0x40)
{
+#if IICP_NEW_IWM
+ m_iicpiwm->reset();
+#else
m_iicpiwm->device_reset();
+#endif
return;
}
@@ -593,6 +638,9 @@ void apple2e_state::mig_w(u16 offset, u8 data)
{
//printf("MIG: enable internal drive on d2\n");
m_intdrive = true;
+#if IICP_NEW_IWM
+ recalc_active_device();
+#endif
return;
}
@@ -600,6 +648,9 @@ void apple2e_state::mig_w(u16 offset, u8 data)
{
//printf("MIG: disable internal drive\n");
m_intdrive = false;
+#if IICP_NEW_IWM
+ recalc_active_device();
+#endif
return;
}
@@ -622,12 +673,18 @@ void apple2e_state::mig_w(u16 offset, u8 data)
if ((offset >= 0x240) && (offset < 0x260))
{
m_35sel = false;
+#if IICP_NEW_IWM
+ recalc_active_device();
+#endif
return;
}
if ((offset >= 0x260) && (offset < 0x280))
{
m_35sel = true;
+#if IICP_NEW_IWM
+ recalc_active_device();
+#endif
return;
}
@@ -637,6 +694,75 @@ void apple2e_state::mig_w(u16 offset, u8 data)
m_migpage = 0;
}
}
+#if IICP_NEW_IWM
+void apple2e_state::phases_w(uint8_t phases)
+{
+ if (m_cur_floppy)
+ {
+ m_cur_floppy->seek_phase_w(phases);
+ }
+}
+
+void apple2e_state::devsel_w(uint8_t devsel)
+{
+ m_devsel = devsel;
+ recalc_active_device();
+}
+
+void apple2e_state::sel35_w(int sel35)
+{
+}
+
+void apple2e_state::recalc_active_device()
+{
+// printf("recalc_active_device: devsel %d 35sel %d intdrive %d\n", m_devsel, m_35sel, m_intdrive);
+ if (m_devsel == 1)
+ {
+ if (!m_35sel)
+ {
+// printf("5.25 1\n");
+ m_cur_floppy = m_floppy[0]->get_device();
+ }
+ else
+ {
+// printf("3.5 1\n");
+ m_cur_floppy = m_floppy[2]->get_device();
+ }
+ }
+ else if (m_devsel == 2)
+ {
+ if (!m_35sel)
+ {
+// printf("5.25 2\n");
+ m_cur_floppy = m_floppy[1]->get_device();
+ }
+ else
+ {
+ // hookup is a little weird here
+ if (m_intdrive)
+ {
+// printf("3.5 1\n");
+ m_cur_floppy = m_floppy[2]->get_device();
+ }
+ else
+ {
+// printf("3.5 2\n");
+ m_cur_floppy = m_floppy[3]->get_device();
+ }
+ }
+ }
+ else
+ {
+ m_cur_floppy = nullptr;
+ }
+ m_iicpiwm->set_floppy(m_cur_floppy);
+
+ if (m_cur_floppy)
+ {
+ m_cur_floppy->ss_w(m_hdsel ? 1 : 0);
+ }
+}
+#endif
WRITE_LINE_MEMBER(apple2e_state::a2bus_irq_w)
{
@@ -4800,7 +4926,8 @@ void apple2e_state::apple2c(machine_config &config)
m_ram->set_default_size("128K").set_extra_options("128K");
}
-
+#if IICP_NEW_IWM
+#else
static void apple2cp_set_lines(device_t *device, u8 lines)
{
apple2e_state *state = device->machine().driver_data<apple2e_state>();
@@ -4895,6 +5022,7 @@ static const floppy_interface apple2cp_floppy35_floppy_interface =
LEGACY_FLOPPY_OPTIONS_NAME(apple35_iigs),
"floppy_3_5"
};
+#endif
static const floppy_interface floppy_interface =
{
@@ -4912,11 +5040,23 @@ void apple2e_state::apple2cp(machine_config &config)
config.device_remove("sl4");
config.device_remove("sl6");
+ #if IICP_NEW_IWM
+ IWM(config, m_iicpiwm, A2BUS_7M_CLOCK, 1021800*2);
+ m_iicpiwm->phases_cb().set(FUNC(apple2e_state::phases_w));
+ m_iicpiwm->sel35_cb().set(FUNC(apple2e_state::sel35_w));
+ m_iicpiwm->devsel_cb().set(FUNC(apple2e_state::devsel_w));
+
+ applefdintf_device::add_525(config, m_floppy[0]);
+ applefdintf_device::add_525(config, m_floppy[1]);
+ applefdintf_device::add_35(config, m_floppy[2]);
+ applefdintf_device::add_35(config, m_floppy[3]);
+ #else
LEGACY_IWM(config, m_iicpiwm, &a2cp_interface);
FLOPPY_APPLE(config, FLOPPY_0, &floppy_interface, 15, 16);
FLOPPY_APPLE(config, FLOPPY_1, &floppy_interface, 15, 16);
FLOPPY_SONY(config, FLOPPY_2, &apple2cp_floppy35_floppy_interface);
FLOPPY_SONY(config, FLOPPY_3, &apple2cp_floppy35_floppy_interface);
+ #endif
m_ram->set_default_size("128K").set_extra_options("128K, 384K, 640K, 896K, 1152K");
}