From 542cf128ba89e8554c6d595264b2b7b68b7fb25a Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Wed, 6 Jan 2021 08:56:04 +0100 Subject: mac: Optionally hook up the new skeleton SWIMs --- src/devices/machine/swim2.cpp | 17 -------------- src/mame/drivers/mac.cpp | 53 ++++++++++++++++++++++++++++++++----------- src/mame/includes/mac.h | 18 +++++++++++---- 3 files changed, 54 insertions(+), 34 deletions(-) diff --git a/src/devices/machine/swim2.cpp b/src/devices/machine/swim2.cpp index 79e6bc4f8fa..a875917f345 100644 --- a/src/devices/machine/swim2.cpp +++ b/src/devices/machine/swim2.cpp @@ -111,12 +111,6 @@ void swim2_device::write(offs_t offset, u8 data) }; switch(offset) { case 0x3: case 0xb: { -#if 0 - static const char *const pname[16] = { - "minct", "mult", "ssl", "sss", "sll", "sls", "rpt", "csls", - "lsl", "lss", "lll", "lls", "late", "time0", "early", "time1" - }; -#endif static const char *const pname[4] = { "late", "time0", "early", "time1" }; @@ -133,17 +127,6 @@ void swim2_device::write(offs_t offset, u8 data) case 0x5: case 0xd: m_setup = data; -#if 0 - logerror("setup timer=%s tsm=%s %s ecm=%s %s %s 3.5=%s %s\n", - m_setup & 0x80 ? "on" : "off", - m_setup & 0x40 ? "off" : "on", - m_setup & 0x20 ? "ibm" : "apple", - m_setup & 0x10 ? "on" : "off", - m_setup & 0x08 ? "fclk/2" : "fclk", - m_setup & 0x04 ? "gcr" : "mfm", - m_setup & 0x02 ? "off" : "on", - m_setup & 0x01 ? "hdsel" : "q3"); -#endif logerror("setup timer=%s tsm=%s %s ecm=%s %s %s 3.5=%s %s\n", m_setup & 0x80 ? "on" : "off", m_setup & 0x40 ? "off" : "on", diff --git a/src/mame/drivers/mac.cpp b/src/mame/drivers/mac.cpp index b9b19e71059..9137200bce1 100644 --- a/src/mame/drivers/mac.cpp +++ b/src/mame/drivers/mac.cpp @@ -62,6 +62,10 @@ #include "machine/swim.h" #include "machine/sonydriv.h" #include "formats/ap_dsk35.h" +#include "machine/iwm.h" +#include "machine/swim1.h" +#include "machine/swim2.h" +#include "machine/swim3.h" #include "bus/scsi/scsi.h" #include "bus/scsi/scsihd.h" #include "bus/scsi/scsicd.h" @@ -726,16 +730,39 @@ static const floppy_interface mac_floppy_interface = "floppy_3_5" }; -void mac_state::add_base_devices(machine_config &config, bool rtc, bool super_woz) +void mac_state::add_base_devices(machine_config &config, bool rtc, int woz_version) { if (rtc) RTC3430042(config, m_rtc, XTAL(32'768)); - if (super_woz) +#if NEW_SWIM + switch (woz_version) { + case 0: + IWM(config, m_fdc, C7M, 1021800*2); + break; + case 1: + SWIM1(config, m_fdc, C15M); + break; + case 2: + SWIM2(config, m_fdc, C15M); + break; + case 3: + SWIM3(config, m_fdc, C15M); + break; + } + + m_fdc->phases_cb().set([this](u8 data) { logerror("fdc phases = %x\n", data);}); + m_fdc->sel35_cb().set([this](int data) { logerror("fdc sel35 = %d\n", data);}); + + applefdintf_device::add_35(config, m_floppy[0]); + applefdintf_device::add_35_nc(config, m_floppy[1]); +#else + if (woz_version) LEGACY_SWIM(config, m_fdc, &mac_iwm_interface); else LEGACY_IWM(config, m_fdc, &mac_iwm_interface); sonydriv_floppy_image_device::legacy_2_drives_add(config, &mac_floppy_interface); +#endif SCC8530(config, m_scc, C7M); m_scc->intrq_callback().set(FUNC(mac_state::set_scc_interrupt)); @@ -851,7 +878,7 @@ template void mac_state::add_nubus_pds(machine_config &config, cons NUBUS_SLOT(config, slot_tag, "pds", std::forward(opts), nullptr); } -void mac_state::macii(machine_config &config, bool cpu, asc_device::asc_type asc_type, bool nubus, bool nubus_bank1, bool nubus_bank2) +void mac_state::macii(machine_config &config, bool cpu, asc_device::asc_type asc_type, bool nubus, bool nubus_bank1, bool nubus_bank2, int woz_version) { if (cpu) { @@ -863,7 +890,7 @@ void mac_state::macii(machine_config &config, bool cpu, asc_device::asc_type asc PALETTE(config, m_palette).set_entries(256); add_asc(config, asc_type); - add_base_devices(config); + add_base_devices(config, true, woz_version); add_scsi(config, true); if (nubus) add_nubus(config, nubus_bank1, nubus_bank2); @@ -900,7 +927,7 @@ void mac_state::maciifx(machine_config &config) m_maincpu->set_dasm_override(FUNC(mac_state::mac_dasm_override)); add_asc(config, asc_device::asc_type::ASC); - add_base_devices(config); + add_base_devices(config, true, 1); add_scsi(config); VIA6522(config, m_via1, C7M/10); @@ -920,9 +947,9 @@ void mac_state::maciifx(machine_config &config) add_nubus(config); } -void mac_state::maclc(machine_config &config, bool cpu, bool egret, asc_device::asc_type asc_type) +void mac_state::maclc(machine_config &config, bool cpu, bool egret, asc_device::asc_type asc_type, int woz_version) { - macii(config, false, asc_type, false); + macii(config, false, asc_type, false, true, true, woz_version); if (cpu) { @@ -955,9 +982,9 @@ void mac_state::maclc(machine_config &config, bool cpu, bool egret, asc_device:: } } -void mac_state::maclc2(machine_config &config, bool egret) +void mac_state::maclc2(machine_config &config, bool egret, int woz_version) { - maclc(config, false, egret); + maclc(config, false, egret, asc_device::asc_type::V8, woz_version); M68030(config, m_maincpu, C15M); m_maincpu->set_addrmap(AS_PROGRAM, &mac_state::maclc_map); @@ -969,7 +996,7 @@ void mac_state::maclc2(machine_config &config, bool egret) void mac_state::maccclas(machine_config &config) { - maclc(config, false, false, asc_device::asc_type::VASP); + maclc(config, false, false, asc_device::asc_type::VASP, 2); M68030(config, m_maincpu, C15M); m_maincpu->set_addrmap(AS_PROGRAM, &mac_state::maclc_map); @@ -984,7 +1011,7 @@ void mac_state::maccclas(machine_config &config) void mac_state::maclc3(machine_config &config, bool egret) { - maclc(config, false, false, asc_device::asc_type::SONORA); + maclc(config, false, false, asc_device::asc_type::SONORA, 2); M68030(config, m_maincpu, 25000000); m_maincpu->set_addrmap(AS_PROGRAM, &mac_state::maclc3_map); @@ -1075,7 +1102,7 @@ void mac_state::macse30(machine_config &config) MCFG_VIDEO_START_OVERRIDE(mac_state,mac) - add_base_devices(config, true, true); + add_base_devices(config, true, 1); add_asc(config, asc_device::asc_type::ASC); add_scsi(config); @@ -1195,7 +1222,7 @@ void mac_state::pwrmac(machine_config &config) m_awacs->add_route(1, "rspeaker", 1.0); add_scsi(config); - add_base_devices(config, false, false); + add_base_devices(config, false, 3); add_via1_adb(config, false); m_via1->writepb_handler().set(FUNC(mac_state::mac_via_out_b_cdadb)); diff --git a/src/mame/includes/mac.h b/src/mame/includes/mac.h index 20d7ce44333..fcb4fa2af0c 100644 --- a/src/mame/includes/mac.h +++ b/src/mame/includes/mac.h @@ -22,6 +22,7 @@ #include "bus/nubus/nubus.h" #include "bus/macpds/macpds.h" #include "machine/applefdc.h" +#include "machine/applefdintf.h" #include "machine/ncr539x.h" #include "machine/ncr5380.h" #include "machine/macrtc.h" @@ -32,6 +33,8 @@ #include "emupal.h" #include "screen.h" +#define NEW_SWIM 0 + #define MAC_SCREEN_NAME "screen" #define MAC_539X_1_TAG "539x_1" #define MAC_539X_2_TAG "539x_2" @@ -72,6 +75,7 @@ public: m_539x_2(*this, MAC_539X_2_TAG), m_ncr5380(*this, "ncr5380"), m_fdc(*this, "fdc"), + m_floppy(*this, "fdc:%d", 0U), m_rtc(*this, "rtc"), m_montype(*this, "MONTYPE"), m_main_buffer(true), @@ -86,7 +90,7 @@ public: } void add_scsi(machine_config &config, bool cdrom = false); - void add_base_devices(machine_config &config, bool rtc = true, bool super_woz = false); + void add_base_devices(machine_config &config, bool rtc = true, int woz_version = 0); void add_asc(machine_config &config, asc_device::asc_type type = asc_device::asc_type::ASC); void add_nubus(machine_config &config, bool bank1 = true, bool bank2 = true); template void add_nubus_pds(machine_config &config, const char *slot_tag, T &&opts); @@ -95,9 +99,9 @@ public: void add_egret(machine_config &config, int type); void add_cuda(machine_config &config, int type); - void maclc(machine_config &config, bool cpu = true, bool egret = true, asc_device::asc_type asc_type = asc_device::asc_type::V8); + void maclc(machine_config &config, bool cpu = true, bool egret = true, asc_device::asc_type asc_type = asc_device::asc_type::V8, int woz_version = 1); void maciisi(machine_config &config); - void maclc2(machine_config &config, bool egret = true); + void maclc2(machine_config &config, bool egret = true, int woz_version = 1); void maclc3(machine_config &config, bool egret = true); void macpd210(machine_config &config); void maciici(machine_config &config); @@ -112,7 +116,7 @@ public: void maciifx(machine_config &config); void macclas2(machine_config &config); void macii(machine_config &config, bool cpu = true, asc_device::asc_type asc_type = asc_device::asc_type::ASC, - bool nubus = true, bool nubus_bank1 = true, bool nubus_bank2 = true); + bool nubus = true, bool nubus_bank1 = true, bool nubus_bank2 = true, int woz_version = 1); void maciihmu(machine_config &config); void init_maclc2(); @@ -226,7 +230,13 @@ private: optional_device m_539x_1; optional_device m_539x_2; optional_device m_ncr5380; +#if NEW_SWIM + required_device m_fdc; + required_device_array m_floppy; +#else required_device m_fdc; + optional_device_array m_floppy; +#endif optional_device m_rtc; //required_ioport m_mouse0, m_mouse1, m_mouse2; -- cgit v1.2.3