summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/mac128.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/drivers/mac128.cpp')
-rw-r--r--src/mame/drivers/mac128.cpp489
1 files changed, 227 insertions, 262 deletions
diff --git a/src/mame/drivers/mac128.cpp b/src/mame/drivers/mac128.cpp
index c82a41e7448..6a981cb3ae0 100644
--- a/src/mame/drivers/mac128.cpp
+++ b/src/mame/drivers/mac128.cpp
@@ -1,33 +1,48 @@
// license:BSD-3-Clause
-// copyright-holders:Nathan Woods, Raphael Nabet, R. Belmont
+// copyright-holders: R. Belmont, O. Galibert
/****************************************************************************
drivers/mac128.cpp
- Original-style Macintosh family emulation
-
- The cutoff here is Macs with 128k-style video and audio.
- We also include the SE and Classic, which are basically cost-reduced Mac Pluses with ADB
- instead of the original keyboard/mouse hardware.
-
- Nate Woods, Raphael Nabet, R. Belmont
-
- 0x000000 - 0x3fffff RAM/ROM (switches based on overlay)
- 0x400000 - 0x4fffff ROM
- 0x580000 - 0x5fffff 5380 NCR/Symbios SCSI peripherals chip (Mac Plus only)
- 0x600000 - 0x6fffff RAM
- 0x800000 - 0x9fffff Zilog 8530 SCC (Serial Communications Controller) Read
- 0xa00000 - 0xbfffff Zilog 8530 SCC (Serial Communications Controller) Write
- 0xc00000 - 0xdfffff IWM (Integrated Woz Machine; floppy)
- 0xe80000 - 0xefffff Rockwell 6522 VIA
- 0xf00000 - 0xffffef Open bus??? (the ROM appears to be accessing here)
- 0xfffff0 - 0xffffff Auto Vector
+ Original-style Macintosh emulation
+
+ These are all 68000 machines in the original Mac form factor with the
+ original Mac audio and video.
+
+ Unitron Mac 512: Brazilian Mac 512K(E?) clone.
+ Unitron 1024: Brazilian Mac Plus clone.
+
+ Driver by R. Belmont and O. Galibert, with thanks to the original Mac
+ driver authors Nathan Woods and Raphel Nabet.
+ Thanks also to SCSI guru Patrick Mackinlay and keyboard/mouse wrangler
+ Vas Crabb.
+
+ Mac 128K/512K: the original machines with 128K or 512K of RAM.
+ Mac Plus: floppy now double-sided 800K, SIMM slots for memory expansion,
+ SCSI interface added.
+ Mac 512KE: a Mac 512K with the 800K floppy drive and the newer Mac Plus ROMs.
+ Mac SE: Mac Plus with ADB for the keyboard and mouse interface, and an
+ expansion slot.
+ Mac SE FDHD: Mac SE with the IWM and 800K drive upgraded to SWIM and
+ the 1.44MB "SuperDrive".
+ Mac Classic: Cost-reduced Mac SE FDHD.
+
+ Memory Map:
+ 0x000000 - 0x3fffff RAM/ROM (switches based on overlay)
+ 0x400000 - 0x4fffff ROM
+ 0x580000 - 0x5fffff 5380 NCR/Symbios SCSI peripherals chip (Mac Plus only)
+ 0x600000 - 0x6fffff RAM
+ 0x800000 - 0x9fffff Zilog 8530 SCC (Serial Communications Controller) Read
+ 0xa00000 - 0xbfffff Zilog 8530 SCC (Serial Communications Controller) Write
+ 0xc00000 - 0xdfffff IWM (Integrated Woz Machine) floppy controller
+ 0xe80000 - 0xefffff Rockwell 6522 VIA
+ 0xf00000 - 0xffffef Open bus??? (the ROM appears to be accessing here)
+ 0xfffff0 - 0xffffff Auto Vector
Interrupts:
M68K:
Level 1 from VIA
Level 2 from SCC
- Level 4 : Interrupt switch (not implemented)
-
+ Level 4 from "programmer switch" (not implemented)
VIA:
CA1 from VBLANK
CA2 from 1 Hz clock (RTC)
@@ -42,44 +57,6 @@
The MC68000's FC outputs are not used even for autovectoring. The
VIA's address range is overdecoded to generate VPA for both.
-SCC Init:
-
-Control B:
-09 select reg 9
-40 reset channel B
-04 select WR4
-4c 2 stop bits, x16 clock
-02 select WR2
-00 int vector = 0
-03 select WR3
-oc0 8 data bits, Rx disabled
-0f select WR15, external interrupt status/control
-08 enable 08
-00 select WR0
-10 reset external status/control interrupt
-00 select wR0
-10 reset external again
-01 select WR1
-01 enable external interrupts
-
-Control A:
-09 select reg 9
-80 reset channel A
-04 select WR4
-4c 2 stop bits, x16 clock
-03 select WR3
-c0 8 data bits, Rx disabled
-0f select WR15, external interrupt status/control
-08 enable 08
-00 select WR0
-10 reset external status/control interrupt
-00 select WR0
-10 reset again
-01 select WR1
-01 enable external interrupts
-09 select WR9
-0a enable MIE / NV
-
VIA notes:
Original 128K Macs use Synertek SYP6522 VIAs. Synertek's AN5 (March 1982)
@@ -101,8 +78,6 @@ part number 338-6523 (later Macs use a PLCC version which Apple numbered
#include "emu.h"
-#define NEW_IWM 0
-
#include "machine/macrtc.h"
#include "bus/mackbd/mackbd.h"
@@ -114,14 +89,14 @@ part number 338-6523 (later Macs use a PLCC version which Apple numbered
#include "machine/6522via.h"
#include "machine/applefdc.h"
#include "machine/iwm.h"
+#include "machine/swim1.h"
+#include "machine/ncr5380n.h"
+#include "machine/nscsi_bus.h"
+#include "bus/nscsi/hd.h"
+#include "bus/nscsi/cd.h"
#include "machine/ncr5380.h"
#include "machine/ram.h"
-#if NEW_IWM
#include "machine/applefdintf.h"
-#else
-#include "machine/sonydriv.h"
-#endif
-#include "machine/swim.h"
#include "machine/timer.h"
#include "machine/z80scc.h"
#include "machine/macadb.h"
@@ -135,41 +110,18 @@ part number 338-6523 (later Macs use a PLCC version which Apple numbered
#include "softlist.h"
#include "speaker.h"
-
-#define MAC_SCREEN_NAME "screen"
-#define MAC_539X_1_TAG "539x_1"
-#define MAC_539X_2_TAG "539x_2"
-#define DAC_TAG "macdac"
-#define SCC_TAG "scc"
-
#define C7M (15.6672_MHz_XTAL / 2)
#define C3_7M (15.6672_MHz_XTAL / 4).value()
-/* tells which model is being emulated (set by macxxx_init) */
-enum mac128model_t
-{
- MODEL_MAC_128K512K,
- MODEL_MAC_512KE,
- MODEL_MAC_PLUS,
- MODEL_MAC_SE,
- MODEL_MAC_CLASSIC
-};
-
// video parameters
-#define MAC_H_VIS (512)
-#define MAC_V_VIS (342)
-#define MAC_H_TOTAL (704) // (512+192)
-#define MAC_V_TOTAL (370) // (342+28)
+static constexpr int MAC_H_VIS = 512;
+static constexpr int MAC_V_VIS = 342;
+static constexpr int MAC_H_TOTAL = 704; // (512+192)
+static constexpr int MAC_V_TOTAL = 370; // (342+28)
// sound buffer locations
-#define MAC_MAIN_SND_BUF_OFFSET (0x0300>>1)
-#define MAC_ALT_SND_BUF_OFFSET (0x5F00>>1)
-
-#define LOG_KEYBOARD 0
-#define LOG_GENERAL 0
-#define LOG_MAC_IWM 0
-#define LOG_VIA 0
-#define LOG_MEMORY 0
+static constexpr int MAC_MAIN_SND_BUF_OFFSET = (0x0300>>1);
+static constexpr int MAC_ALT_SND_BUF_OFFSET = (0x5F00>>1);
class mac128_state : public driver_device
{
@@ -181,34 +133,33 @@ public:
m_macadb(*this, "macadb"),
m_ram(*this, RAM_TAG),
m_ncr5380(*this, "ncr5380"),
+ m_scsibus(*this, "scsibus"),
+ m_ncr5380n(*this, "scsibus:7:ncr5380n"),
m_iwm(*this, "fdc"),
-#if NEW_IWM
m_floppy(*this, "fdc:%d", 0U),
-#endif
m_mackbd(*this, "kbd"),
m_rtc(*this,"rtc"),
+ m_screen(*this, "screen"),
+ m_dac(*this, "macdac"),
+ m_scc(*this, "scc"),
m_mouse0(*this, "MOUSE0"),
m_mouse1(*this, "MOUSE1"),
m_mouse2(*this, "MOUSE2"),
- m_screen(*this, "screen"),
- m_dac(*this, DAC_TAG),
- m_scc(*this, SCC_TAG)
+ m_cur_floppy(nullptr),
+ m_hdsel(0),
+ m_devsel(0)
{
- m_cur_floppy = nullptr;
- m_hdsel = 0;
}
void mac512ke(machine_config &config);
void mac128k(machine_config &config);
+ void mac512k(machine_config &config);
void macplus(machine_config &config);
void macse(machine_config &config);
+ void macsefd(machine_config &config);
void macclasc(machine_config &config);
- void init_mac128k512k();
- void init_mac512ke();
- void init_macplus();
- void init_macse();
- void init_macclassic();
+ void mac_driver_init();
private:
required_device<m68000_device> m_maincpu;
@@ -216,14 +167,15 @@ private:
optional_device<macadb_device> m_macadb;
required_device<ram_device> m_ram;
optional_device<ncr5380_device> m_ncr5380;
- #if NEW_IWM
+ optional_device<nscsi_bus_device> m_scsibus;
+ optional_device<ncr5380n_device> m_ncr5380n;
required_device<applefdintf_device> m_iwm;
required_device_array<floppy_connector, 2> m_floppy;
- #else
- required_device<applefdc_base_device> m_iwm;
- #endif
optional_device<mac_keyboard_port_device> m_mackbd;
optional_device<rtc3430042_device> m_rtc;
+ required_device<screen_device> m_screen;
+ required_device<dac_8bit_pwm_device> m_dac;
+ required_device<z80scc_device> m_scc;
optional_ioport m_mouse0, m_mouse1, m_mouse2;
@@ -249,7 +201,10 @@ private:
void mac_iwm_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
uint16_t macplus_scsi_r(offs_t offset, uint16_t mem_mask = ~0);
void macplus_scsi_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
- DECLARE_WRITE_LINE_MEMBER(mac_scsi_irq);
+ uint16_t macse_scsi_r(offs_t offset, uint16_t mem_mask = ~0);
+ void macse_scsi_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
+ DECLARE_WRITE_LINE_MEMBER(scsi_irq_w);
+ DECLARE_WRITE_LINE_MEMBER(scsi_drq_w);
DECLARE_WRITE_LINE_MEMBER(set_scc_interrupt);
WRITE_LINE_MEMBER(adb_irq_w) { m_adb_irq_pending = state; }
@@ -266,7 +221,6 @@ private:
void mac_via_out_a_se(uint8_t data);
void mac_via_out_b_se(uint8_t data);
DECLARE_WRITE_LINE_MEMBER(mac_via_irq);
- void mac_driver_init(mac128model_t model);
void update_volume();
void mac512ke_map(address_map &map);
@@ -274,18 +228,15 @@ private:
void macse_map(address_map &map);
floppy_image_device *m_cur_floppy;
- int m_hdsel;
+ int m_hdsel, m_devsel;
int m_pwm_count_total, m_pwm_count_1;
float m_pwm_current_rpm[2];
void phases_w(uint8_t phases);
- void sel35_w(int sel35);
void devsel_w(uint8_t devsel);
- void hdsel_w(int hdsel);
+ void devsel_se_w(uint8_t devsel);
void pwm_push(uint8_t data);
- mac128model_t m_model;
-
uint32_t m_overlay;
int m_irq_count, m_ca1_data, m_ca2_data;
@@ -298,6 +249,9 @@ private:
// interrupts
int m_scc_interrupt, m_via_interrupt, m_scsi_interrupt, m_last_taken_interrupt;
+ // DRQ
+ int m_scsi_drq;
+
// wait states for accessing the VIA
int m_via_cycles;
bool m_snd_enable;
@@ -308,10 +262,6 @@ private:
int m_scsiirq_enable;
u16 *m_ram_ptr, *m_rom_ptr;
u32 m_ram_mask, m_ram_size;
-
- required_device<screen_device> m_screen;
- required_device<dac_8bit_pwm_device> m_dac;
- required_device<z80scc_device> m_scc;
};
void mac128_state::machine_start()
@@ -336,6 +286,7 @@ void mac128_state::machine_start()
save_item(NAME(m_scc_interrupt));
save_item(NAME(m_via_interrupt));
save_item(NAME(m_scsi_interrupt));
+ save_item(NAME(m_scsi_drq));
save_item(NAME(m_last_taken_interrupt));
save_item(NAME(m_snd_enable));
save_item(NAME(m_main_buffer));
@@ -371,6 +322,7 @@ void mac128_state::machine_reset()
m_pwm_count_1 = 0;
m_pwm_current_rpm[0] = 302.5; // Speed for 0% duty cycle
m_pwm_current_rpm[1] = 302.5;
+ m_scsi_drq = 0;
const int next_vpos = m_screen->vpos() + 1;
m_scan_timer->adjust(m_screen->time_until_pos(next_vpos), next_vpos);
@@ -507,7 +459,7 @@ TIMER_CALLBACK_MEMBER(mac128_state::mac_scanline)
m_hblank_timer->adjust(m_screen->time_until_pos(scanline, MAC_H_VIS));
}
- if ((!(scanline % 10)) && (m_model < MODEL_MAC_SE))
+ if ((!(scanline % 10)) && (!m_macadb))
{
mouse_callback();
}
@@ -587,13 +539,11 @@ void mac128_state::pwm_push(uint8_t data)
{
logerror("PWM index %3d duty cycle %5.1f%% rpm %f\n", internal_index, 100*duty_cycle, rpm);
-#if NEW_IWM
if (m_cur_floppy && m_cur_floppy->type() == OAD34V)
{
m_iwm->sync();
m_cur_floppy->set_rpm(rpm);
}
-#endif
}
m_pwm_current_rpm[0] = m_pwm_current_rpm[1];
@@ -603,12 +553,56 @@ void mac128_state::pwm_push(uint8_t data)
}
}
-WRITE_LINE_MEMBER(mac128_state::mac_scsi_irq)
+WRITE_LINE_MEMBER(mac128_state::scsi_irq_w)
+{
+}
+
+WRITE_LINE_MEMBER(mac128_state::scsi_drq_w)
{
+ m_scsi_drq = state;
}
uint16_t mac128_state::macplus_scsi_r(offs_t offset, uint16_t mem_mask)
{
+ int reg = (offset >> 3) & 0xf;
+
+ // logerror("macplus_scsi_r: offset %x mask %x\n", offset, mem_mask);
+
+ if (ACCESSING_BITS_0_7)
+ {
+ if ((offset >= 0x100) && (m_scsi_drq))
+ {
+ return m_ncr5380n->dma_r();
+ }
+
+ return m_ncr5380n->read(reg);
+ }
+
+ if ((offset >= 0x100) && (m_scsi_drq))
+ {
+ return u16(m_ncr5380n->dma_r()) << 8;
+ }
+
+ return u16(m_ncr5380n->read(reg)) << 8;
+}
+
+void mac128_state::macplus_scsi_w(offs_t offset, uint16_t data, uint16_t mem_mask)
+{
+ int reg = (offset >> 3) & 0xf;
+
+ // logerror("macplus_scsi_w: data %x offset %x mask %x\n", data, offset, mem_mask);
+
+ // here we can take advantage of 68000 byte smearing
+ if ((offset >= 0x100) && (m_scsi_drq))
+ {
+ m_ncr5380n->dma_w(data & 0xff);
+ }
+
+ m_ncr5380n->write(reg, data & 0xff);
+}
+
+uint16_t mac128_state::macse_scsi_r(offs_t offset, uint16_t mem_mask)
+{
int reg = (offset>>3) & 0xf;
// logerror("macplus_scsi_r: offset %x mask %x\n", offset, mem_mask);
@@ -621,7 +615,7 @@ uint16_t mac128_state::macplus_scsi_r(offs_t offset, uint16_t mem_mask)
return m_ncr5380->ncr5380_read_reg(reg)<<8;
}
-void mac128_state::macplus_scsi_w(offs_t offset, uint16_t data, uint16_t mem_mask)
+void mac128_state::macse_scsi_w(offs_t offset, uint16_t data, uint16_t mem_mask)
{
int reg = (offset>>3) & 0xf;
@@ -668,21 +662,12 @@ void mac128_state::scc_mouse_irq(int x, int y)
uint16_t mac128_state::mac_iwm_r(offs_t offset, uint16_t mem_mask)
{
- uint16_t result = 0;
-
- result = m_iwm->read((offset >> 8) & 0xf);
-
- if (LOG_MAC_IWM)
- printf("mac_iwm_r: offset=0x%08x mem_mask %04x = %02x (PC %x)\n", offset, mem_mask, result, m_maincpu->pc());
-
+ uint16_t result = m_iwm->read((offset >> 8) & 0xf);
return (result << 8) | result;
}
void mac128_state::mac_iwm_w(offs_t offset, uint16_t data, uint16_t mem_mask)
{
- if (LOG_MAC_IWM)
- printf("mac_iwm_w: offset=0x%08x data=0x%04x mask %04x (PC=%x)\n", offset, data, mem_mask, m_maincpu->pc());
-
if (ACCESSING_BITS_0_7)
m_iwm->write((offset >> 8) & 0xf, data & 0xff);
else
@@ -702,8 +687,6 @@ uint16_t mac128_state::mac_via_r(offs_t offset)
offset >>= 8;
offset &= 0x0f;
- if (LOG_VIA)
- logerror("mac_via_r: offset=0x%02x\n", offset);
data = m_via->read(offset);
m_maincpu->adjust_icount(m_via_cycles);
@@ -716,9 +699,6 @@ void mac128_state::mac_via_w(offs_t offset, uint16_t data)
offset >>= 8;
offset &= 0x0f;
- if (LOG_VIA)
- logerror("mac_via_w: offset=0x%02x data=0x%08x\n", offset, data);
-
m_via->write(offset, (data >> 8) & 0xff);
m_maincpu->adjust_icount(m_via_cycles);
@@ -726,21 +706,13 @@ void mac128_state::mac_via_w(offs_t offset, uint16_t data)
void mac128_state::mac_autovector_w(offs_t offset, uint16_t data)
{
- if (LOG_GENERAL)
- logerror("mac_autovector_w: offset=0x%08x data=0x%04x\n", offset, data);
-
/* This should throw an exception */
-
/* Not yet implemented */
}
uint16_t mac128_state::mac_autovector_r(offs_t offset)
{
- if (LOG_GENERAL)
- logerror("mac_autovector_r: offset=0x%08x\n", offset);
-
/* This should throw an exception */
-
/* Not yet implemented */
return 0;
}
@@ -787,9 +759,7 @@ void mac128_state::mac_via_out_a(uint8_t data)
//set_scc_waitrequest((data & 0x80) >> 7);
m_screen_buffer = (data & 0x40) >> 6;
- #if !NEW_IWM
- sony_set_sel_line(m_iwm, (data & 0x20) >> 5);
- #else
+
int hdsel = BIT(data, 5);
if (hdsel != m_hdsel)
{
@@ -799,7 +769,6 @@ void mac128_state::mac_via_out_a(uint8_t data)
}
m_hdsel = hdsel;
}
- #endif
m_main_buffer = ((data & 0x08) == 0x08) ? true : false;
m_snd_vol = data & 0x07;
@@ -820,9 +789,7 @@ void mac128_state::mac_via_out_a_se(uint8_t data)
//set_scc_waitrequest((data & 0x80) >> 7);
m_screen_buffer = (data & 0x40) >> 6;
- #if !NEW_IWM
- sony_set_sel_line(m_iwm, (data & 0x20) >> 5);
- #else
+
int hdsel = BIT(data, 5);
if (hdsel != m_hdsel)
{
@@ -832,14 +799,15 @@ void mac128_state::mac_via_out_a_se(uint8_t data)
}
m_hdsel = hdsel;
}
- #endif
m_snd_vol = data & 0x07;
update_volume();
- if (m_model == MODEL_MAC_SE) // on SE only this selects which floppy drive (0 = upper, 1 = lower)
+ // on SE only this selects which floppy drive (0 = upper, 1 = lower)
+ if (m_drive_select != BIT(data, 4))
{
- m_drive_select = ((data & 0x10) >> 4);
+ m_drive_select = BIT(data, 4);
+ devsel_se_w(m_devsel);
}
}
@@ -939,10 +907,9 @@ void mac128_state::mouse_callback()
}
}
-void mac128_state::mac_driver_init(mac128model_t model)
+void mac128_state::mac_driver_init()
{
m_scsi_interrupt = 0;
- m_model = model;
memset(m_ram->pointer(), 0, m_ram->size());
}
@@ -971,17 +938,13 @@ uint32_t mac128_state::screen_update_mac(screen_device &screen, bitmap_ind16 &bi
return 0;
}
-#if NEW_IWM
+
void mac128_state::phases_w(uint8_t phases)
{
if (m_cur_floppy)
m_cur_floppy->seek_phase_w(phases);
}
-void mac128_state::sel35_w(int sel35)
-{
-}
-
void mac128_state::devsel_w(uint8_t devsel)
{
if (devsel == 1)
@@ -1000,22 +963,33 @@ void mac128_state::devsel_w(uint8_t devsel)
}
}
-void mac128_state::hdsel_w(int hdsel)
+void mac128_state::devsel_se_w(uint8_t devsel)
{
-}
-#endif
+ // m_drive_select = 0 for the SE's two internal drives, 1 for the single external
+ if (!m_drive_select)
+ {
+ if (devsel == 1)
+ m_cur_floppy = m_floppy[0]->get_device();
+ else if (devsel == 2)
+ m_cur_floppy = m_floppy[1]->get_device();
+ else
+ m_cur_floppy = nullptr;
+ }
+ else
+ {
+ m_cur_floppy = nullptr;
+ }
-#define MAC_DRIVER_INIT(label, model) \
-void mac128_state::init_##label() \
-{ \
- mac_driver_init(model); \
-}
+ m_iwm->set_floppy(m_cur_floppy);
+ if (m_cur_floppy)
+ {
+ m_cur_floppy->ss_w(m_hdsel);
+ if (m_cur_floppy->type() == OAD34V)
+ m_cur_floppy->set_rpm(m_pwm_current_rpm[1]);
+ }
-MAC_DRIVER_INIT(mac128k512k, MODEL_MAC_128K512K)
-MAC_DRIVER_INIT(mac512ke, MODEL_MAC_512KE)
-MAC_DRIVER_INIT(macplus, MODEL_MAC_PLUS)
-MAC_DRIVER_INIT(macse, MODEL_MAC_SE)
-MAC_DRIVER_INIT(macclassic, MODEL_MAC_CLASSIC)
+ m_devsel = devsel;
+}
/***************************************************************************
ADDRESS MAPS
@@ -1049,7 +1023,7 @@ void mac128_state::macse_map(address_map &map)
{
map(0x000000, 0x3fffff).rw(FUNC(mac128_state::ram_r), FUNC(mac128_state::ram_w_se));
map(0x400000, 0x4fffff).rom().region("bootrom", 0);
- map(0x580000, 0x5fffff).rw(FUNC(mac128_state::macplus_scsi_r), FUNC(mac128_state::macplus_scsi_w));
+ map(0x580000, 0x5fffff).rw(FUNC(mac128_state::macse_scsi_r), FUNC(mac128_state::macse_scsi_w));
map(0x900000, 0x9fffff).r(m_scc, FUNC(z80scc_device::dc_ab_r)).umask16(0xff00);
map(0xb00000, 0xbfffff).w(m_scc, FUNC(z80scc_device::dc_ab_w)).umask16(0x00ff);
map(0xd00000, 0xdfffff).rw(FUNC(mac128_state::mac_iwm_r), FUNC(mac128_state::mac_iwm_w));
@@ -1058,31 +1032,14 @@ void mac128_state::macse_map(address_map &map)
}
/***************************************************************************
- DEVICE CONFIG
-***************************************************************************/
-#if !NEW_IWM
-static const applefdc_interface mac_iwm_interface =
-{
- sony_set_lines,
- sony_set_enable_lines,
-
- sony_read_data,
- sony_write_data,
- sony_read_status
-};
-#endif
-
-/***************************************************************************
MACHINE DRIVERS
***************************************************************************/
-#if !NEW_IWM
-static const floppy_interface mac_floppy_interface =
+
+static void mac_scsi_devices(device_slot_interface &device)
{
- FLOPPY_STANDARD_3_5_DSHD,
- LEGACY_FLOPPY_OPTIONS_NAME(apple35_mac),
- "floppy_3_5"
-};
-#endif
+ device.option_add("harddisk", NSCSI_HARDDISK);
+ device.option_add("cdrom", NSCSI_CDROM);
+}
static void mac_pds_cards(device_slot_interface &device)
{
@@ -1110,18 +1067,13 @@ void mac128_state::mac512ke(machine_config &config)
/* devices */
RTC3430042(config, m_rtc, 32.768_kHz_XTAL);
- #if NEW_IWM
+
IWM(config, m_iwm, C7M);
m_iwm->phases_cb().set(FUNC(mac128_state::phases_w));
- m_iwm->sel35_cb().set(FUNC(mac128_state::sel35_w));
m_iwm->devsel_cb().set(FUNC(mac128_state::devsel_w));
applefdintf_device::add_35(config, m_floppy[0]);
applefdintf_device::add_35(config, m_floppy[1]);
- #else
- LEGACY_IWM(config, m_iwm, 0).set_config(&mac_iwm_interface);
- sonydriv_floppy_image_device::legacy_2_drives_add(config, &mac_floppy_interface);
- #endif
SCC85C30(config, m_scc, C7M);
m_scc->configure_channels(C3_7M, 0, C3_7M, 0);
@@ -1155,6 +1107,19 @@ void mac128_state::mac128k(machine_config &config)
{
mac512ke(config);
m_ram->set_default_size("128K");
+
+ IWM(config.replace(), m_iwm, C7M);
+ m_iwm->phases_cb().set(FUNC(mac128_state::phases_w));
+ m_iwm->devsel_cb().set(FUNC(mac128_state::devsel_w));
+
+ applefdintf_device::add_35_sd(config, m_floppy[0]);
+ applefdintf_device::add_35_sd(config, m_floppy[1]);
+}
+
+void mac128_state::mac512k(machine_config &config)
+{
+ mac128k(config);
+ m_ram->set_default_size("512K");
}
void mac128_state::macplus(machine_config &config)
@@ -1164,13 +1129,20 @@ void mac128_state::macplus(machine_config &config)
m_mackbd->set_default_option("usp");
- scsi_port_device &scsibus(SCSI_PORT(config, "scsi"));
- scsibus.set_slot_device(1, "harddisk", SCSIHD, DEVICE_INPUT_DEFAULTS_NAME(SCSI_ID_6));
- scsibus.set_slot_device(2, "harddisk", SCSIHD, DEVICE_INPUT_DEFAULTS_NAME(SCSI_ID_5));
-
- NCR5380(config, m_ncr5380, C7M);
- m_ncr5380->set_scsi_port("scsi");
- m_ncr5380->irq_callback().set(FUNC(mac128_state::mac_scsi_irq));
+ // SCSI bus and devices
+ NSCSI_BUS(config, m_scsibus);
+ NSCSI_CONNECTOR(config, "scsibus:0", mac_scsi_devices, nullptr);
+ NSCSI_CONNECTOR(config, "scsibus:1", mac_scsi_devices, nullptr);
+ NSCSI_CONNECTOR(config, "scsibus:2", mac_scsi_devices, nullptr);
+ NSCSI_CONNECTOR(config, "scsibus:3", mac_scsi_devices, nullptr);
+ NSCSI_CONNECTOR(config, "scsibus:4", mac_scsi_devices, nullptr);
+ NSCSI_CONNECTOR(config, "scsibus:5", mac_scsi_devices, nullptr);
+ NSCSI_CONNECTOR(config, "scsibus:6", mac_scsi_devices, "harddisk");
+ NSCSI_CONNECTOR(config, "scsibus:7").option_set("ncr5380n", NCR5380N).clock(24_MHz_XTAL).machine_config([this](device_t *device) {
+ ncr5380n_device &adapter = downcast<ncr5380n_device &>(*device);
+ adapter.irq_handler().set(*this, FUNC(mac128_state::scsi_irq_w));
+ adapter.drq_handler().set(*this, FUNC(mac128_state::scsi_drq_w));
+ });
/* internal ram */
m_ram->set_default_size("4M");
@@ -1189,6 +1161,22 @@ void mac128_state::macse(machine_config &config)
config.device_remove("kbd");
config.device_remove("pds");
+ config.device_remove("scsibus");
+
+ IWM(config.replace(), m_iwm, C7M);
+ m_iwm->phases_cb().set(FUNC(mac128_state::phases_w));
+ m_iwm->devsel_cb().set(FUNC(mac128_state::devsel_se_w));
+
+ applefdintf_device::add_35(config, m_floppy[0]);
+ applefdintf_device::add_35(config, m_floppy[1]);
+
+ scsi_port_device &scsibus(SCSI_PORT(config, "scsi"));
+ scsibus.set_slot_device(1, "harddisk", SCSIHD, DEVICE_INPUT_DEFAULTS_NAME(SCSI_ID_6));
+ scsibus.set_slot_device(2, "harddisk", SCSIHD, DEVICE_INPUT_DEFAULTS_NAME(SCSI_ID_5));
+
+ NCR5380(config, m_ncr5380, C7M);
+ m_ncr5380->set_scsi_port("scsi");
+ m_ncr5380->irq_callback().set(FUNC(mac128_state::scsi_irq_w));
MACADB(config, m_macadb, C7M);
m_macadb->via_clock_callback().set(m_via, FUNC(via6522_device::write_cb1));
@@ -1211,10 +1199,22 @@ void mac128_state::macse(machine_config &config)
MACPDS_SLOT(config, "pds", "sepds", mac_sepds_cards, nullptr);
}
-void mac128_state::macclasc(machine_config &config)
+void mac128_state::macsefd(machine_config &config)
{
macse(config);
+ SWIM1(config.replace(), m_iwm, C7M*2);
+ m_iwm->phases_cb().set(FUNC(mac128_state::phases_w));
+ m_iwm->devsel_cb().set(FUNC(mac128_state::devsel_se_w));
+
+ applefdintf_device::add_35_hd(config, m_floppy[0]);
+ applefdintf_device::add_35_hd(config, m_floppy[1]);
+}
+
+void mac128_state::macclasc(machine_config &config)
+{
+ macsefd(config);
+
config.device_remove("pds");
config.device_remove("sepds");
}
@@ -1290,41 +1290,6 @@ ROM_START( utrn1024 )
ROMX_LOAD( "342-0342-a.u8d", 0x000001, 0x010000, CRC(fb766270) SHA1(679f529fbfc05f9cc98924c53457d2996dfcb1a7), ROM_SKIP(1) ) // not correct label
ROM_END
-/*
- SCC init macplus.rom
- * Channel B and A init - reset command and vector differs
- * 09 <- 40/80 Master Interrup Control: channel B/A reset
- * 04 <- 4c Clocks: x16 mode, 2 stop bits, no parity
- * 02 <- 00 Interrupt vector (just for chan B)
- * 03 <- c0 Receiver: 8 bit data, auto enables, Rx disabled
- * 0f <- 08 External/Status Control: DCD ints enabled
- * 00 <- 10 Reset External/status interrupts
- * 00 <- 10 Reset External/status interrupts
- * 01 <- 01 Enable External Interrupts
- * Above init first for channel B and then for channel A
- * 09 <- 0a Master Interrupt Control: No vector and Interrupts enabled!
- *
- SCC re-init of Channel B booting MacOS 7.0.0 (on Mac plus)
- * 09 <- 40 Master Interrup Control: channel B reset
- * 04 <- 20 x1 clock, Sync Modes Enable, SDLC Mode (01111110 Flag)
- * 0a <- e0 CRC preset to '1's, FM0 encoding scheme
- * 06 <- 00 Receiver SDLC ADR0-ADR7 bits
- * 07 <- 7e Receiver SDLC Flag character (0x7e as expected)
- * 0c <- 06 Low baudrate divider
- * 0d <- 00 Hi baudrate divider
- * 0e <- c0 Set FM Mode Command
- * 03 <- dd Rx 8 bit, Enter Hunt Mode, Rx CRC Enable, Enter SDLC Address Search Mode, Rx enable
- * 02 <- 00 Interrupt vector
- * 0f <- 08 External/Status Control: DCD interrupts enabled
- * 01 <- 09 Enable External Interrupts + Rx Int On First Character or Special Condition
- * 09 <- 0a Master Interrupt Control: No vector and Interrupts enabled!
- * 0b <- 70 Rx Clock is DPLL Output, Tx Clock is BRG output + TTL Clock on RTxC
- * 0e <- 21 Enter Search Mode Command + BRG enable + RTxC as BRG clock
- * 05 <- 60 Tx 8 bit, Tx disable, SDLC CRC Polynomial selected, Tx CRC disabled
- * 06 <- 01 Receiver SDLC ADR0-ADR7 bits updated
- * 0f <- 88 External/Status Control: Abort/Break and DCD interrupts enabled
-*/
-
ROM_START( mac512ke ) // 512ke has been observed with any of the v3, v2 or v1 macplus romsets installed, and v1 romsets are more common here than in the plus, since the 512ke lacks scsi, which is the cause of the major bug fixed between v1 and v2, hence 512ke is unaffected and was a good way for apple to use up the buggy roms rather than destroying them.
ROM_REGION16_BE(0x100000, "bootrom", 0)
ROM_SYSTEM_BIOS(0, "v3", "Loud Harmonicas")
@@ -1416,13 +1381,13 @@ ROM_START( macclasc )
ROM_END
/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */
-//COMP( 1983, mactw, 0, 0, mac128k, macplus, mac128_state, init_mac128k512k, "Apple Computer", "Macintosh (4.3T Prototype)", MACHINE_NOT_WORKING )
-COMP( 1984, mac128k, 0, 0, mac128k, macplus, mac128_state, init_mac128k512k, "Apple Computer", "Macintosh 128k", MACHINE_NOT_WORKING )
-COMP( 1984, mac512k, mac128k, 0, mac512ke, macplus, mac128_state, init_mac128k512k, "Apple Computer", "Macintosh 512k", MACHINE_NOT_WORKING )
-COMP( 1986, mac512ke, macplus, 0, mac512ke, macplus, mac128_state, init_mac512ke, "Apple Computer", "Macintosh 512ke", MACHINE_NOT_WORKING )
-COMP( 1985, unitron, macplus, 0, mac512ke, macplus, mac128_state, init_mac512ke, "bootleg (Unitron)", "Mac 512", MACHINE_NOT_WORKING )
-COMP( 1986, macplus, 0, 0, macplus, macplus, mac128_state, init_macplus, "Apple Computer", "Macintosh Plus", MACHINE_NOT_WORKING )
-COMP( 1985, utrn1024, macplus, 0, macplus, macplus, mac128_state, init_macplus, "bootleg (Unitron)", "Unitron 1024", MACHINE_NOT_WORKING )
-COMP( 1987, macse, 0, 0, macse, macadb, mac128_state, init_macse, "Apple Computer", "Macintosh SE", MACHINE_NOT_WORKING )
-COMP( 1987, macsefd, 0, 0, macse, macadb, mac128_state, init_macse, "Apple Computer", "Macintosh SE (FDHD)", MACHINE_NOT_WORKING )
-COMP( 1990, macclasc, 0, 0, macclasc, macadb, mac128_state, init_macclassic, "Apple Computer", "Macintosh Classic", MACHINE_NOT_WORKING )
+//COMP( 1983, mactw, 0, 0, mac128k, macplus, mac128_state, mac_driver_init, "Apple Computer", "Macintosh (4.3T Prototype)", MACHINE_NOT_WORKING )
+COMP( 1984, mac128k, 0, 0, mac128k, macplus, mac128_state, mac_driver_init, "Apple Computer", "Macintosh 128k", MACHINE_SUPPORTS_SAVE )
+COMP( 1984, mac512k, mac128k, 0, mac512k, macplus, mac128_state, mac_driver_init, "Apple Computer", "Macintosh 512k", MACHINE_SUPPORTS_SAVE )
+COMP( 1986, mac512ke, macplus, 0, mac512ke, macplus, mac128_state, mac_driver_init, "Apple Computer", "Macintosh 512ke", MACHINE_SUPPORTS_SAVE )
+COMP( 1985, unitron, macplus, 0, mac512ke, macplus, mac128_state, mac_driver_init, "bootleg (Unitron)", "Mac 512", MACHINE_SUPPORTS_SAVE )
+COMP( 1986, macplus, 0, 0, macplus, macplus, mac128_state, mac_driver_init, "Apple Computer", "Macintosh Plus", MACHINE_SUPPORTS_SAVE )
+COMP( 1985, utrn1024, macplus, 0, macplus, macplus, mac128_state, mac_driver_init, "bootleg (Unitron)", "Unitron 1024", MACHINE_SUPPORTS_SAVE )
+COMP( 1987, macse, 0, 0, macse, macadb, mac128_state, mac_driver_init, "Apple Computer", "Macintosh SE", MACHINE_NOT_WORKING )
+COMP( 1987, macsefd, 0, 0, macsefd, macadb, mac128_state, mac_driver_init, "Apple Computer", "Macintosh SE (FDHD)", MACHINE_SUPPORTS_SAVE )
+COMP( 1990, macclasc, 0, 0, macclasc, macadb, mac128_state, mac_driver_init, "Apple Computer", "Macintosh Classic", MACHINE_SUPPORTS_SAVE )