summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Olivier Galibert <galibert@pobox.com>2021-03-12 21:33:24 +0100
committer Olivier Galibert <galibert@pobox.com>2021-03-12 21:35:02 +0100
commitcdb06b7a99f8717bdfee89148b57eea098a0713c (patch)
treedbd518bc2e3e973cdf8779580e7278a8fc55ec6f
parent83b3a2e0e5d6ac8bf1bc76cd7b3c98273dff4259 (diff)
pmac6100: Move it to a new driver
-rw-r--r--scripts/src/machine.lua11
-rw-r--r--scripts/target/mame/arcade.lua1
-rw-r--r--scripts/target/mame/mess.lua2
-rw-r--r--src/devices/machine/mv_sonora.cpp251
-rw-r--r--src/devices/machine/mv_sonora.h69
-rw-r--r--src/devices/sound/awacs.cpp7
-rw-r--r--src/emu/emumem.cpp51
-rw-r--r--src/mame/drivers/mac.cpp79
-rw-r--r--src/mame/drivers/macpdm.cpp741
-rw-r--r--src/mame/includes/mac.h2
-rw-r--r--src/mame/machine/mac.cpp36
-rw-r--r--src/mame/mame.lst2
12 files changed, 1136 insertions, 116 deletions
diff --git a/scripts/src/machine.lua b/scripts/src/machine.lua
index 538b8ccbc22..599727b0980 100644
--- a/scripts/src/machine.lua
+++ b/scripts/src/machine.lua
@@ -4669,6 +4669,17 @@ end
---------------------------------------------------
--
+--@src/devices/machine/mv_sonora.h,MACHINES["MAC_VIDEO_SONORA"] = true
+---------------------------------------------------
+if (MACHINES["MAC_VIDEO_SONORA"]~=null) then
+ files {
+ MAME_DIR .. "src/devices/machine/mv_sonora.cpp",
+ MAME_DIR .. "src/devices/machine/mv_sonora.h",
+ }
+end
+
+---------------------------------------------------
+--
--@src/devices/machine/alpha_8921.h,MACHINES["ALPHA_8921"] = true
---------------------------------------------------
if (MACHINES["ALPHA_8921"]~=null) then
diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua
index 17b7caa4056..4e3ac6b2d58 100644
--- a/scripts/target/mame/arcade.lua
+++ b/scripts/target/mame/arcade.lua
@@ -709,6 +709,7 @@ MACHINES["STEPPERS"] = true
--MACHINES["SWIM1"] = true
--MACHINES["SWIM2"] = true
--MACHINES["SWIM3"] = true
+--MACHINES["MAC_VIDEO_SONORA"] = true
--MACHINES["DIABLO_HD"] = true
MACHINES["PCI9050"] = true
MACHINES["TMS1024"] = true
diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua
index 94e418afbdf..79d6c8a5da3 100644
--- a/scripts/target/mame/mess.lua
+++ b/scripts/target/mame/mess.lua
@@ -762,6 +762,7 @@ MACHINES["IWM"] = true
MACHINES["SWIM1"] = true
MACHINES["SWIM2"] = true
MACHINES["SWIM3"] = true
+MACHINES["MAC_VIDEO_SONORA"] = true
MACHINES["DIABLO_HD"] = true
MACHINES["TMS1024"] = true
MACHINES["NSC810"] = true
@@ -1792,6 +1793,7 @@ files {
MAME_DIR .. "src/mame/drivers/lwriter.cpp",
MAME_DIR .. "src/mame/drivers/mac128.cpp",
MAME_DIR .. "src/mame/drivers/macquadra700.cpp",
+ MAME_DIR .. "src/mame/drivers/macpdm.cpp",
MAME_DIR .. "src/mame/drivers/macprtb.cpp",
MAME_DIR .. "src/mame/drivers/macpwrbk030.cpp",
MAME_DIR .. "src/mame/drivers/mac.cpp",
diff --git a/src/devices/machine/mv_sonora.cpp b/src/devices/machine/mv_sonora.cpp
new file mode 100644
index 00000000000..21cdfd44005
--- /dev/null
+++ b/src/devices/machine/mv_sonora.cpp
@@ -0,0 +1,251 @@
+// license:BSD-3-Clause
+// copyright-holders:Olivier Galibert
+/*********************************************************************
+
+ Mac video support, "Sonora" edition
+ Supports 5 different modelines at up to 16bpp
+
+*********************************************************************/
+
+#include "emu.h"
+#include "mv_sonora.h"
+
+DEFINE_DEVICE_TYPE(MAC_VIDEO_SONORA, mac_video_sonora_device, "mv_sonora", "Mac Sonora video support")
+
+const mac_video_sonora_device::modeline mac_video_sonora_device::modelines[5] = {
+ { 0x02, "512x384 12\" RGB", 15667200, 640, 16, 32, 80, 407, 1, 3, 19, true },
+ { 0x06, "640x480 13\" RGB", 31334400, 896, 80, 64, 112, 525, 3, 3, 39, true },
+ { 0x01, "640x870 15\" Portrait", 57283200, 832, 32, 80, 80, 918, 3, 3, 42, false },
+ { 0x09, "832x624 16\" RGB", 57283200, 1152, 32, 64, 224, 667, 1, 3, 39, false },
+ { 0x0b, "640x480 VGA", 25175000, 800, 16, 96, 48, 525, 10, 2, 33, false },
+};
+
+mac_video_sonora_device::mac_video_sonora_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ device_t(mconfig, MAC_VIDEO_SONORA, tag, owner, clock),
+ m_screen(*this, "screen"),
+ m_palette(*this, "palette"),
+ m_monitor_config(*this, "monitor")
+{
+}
+
+void mac_video_sonora_device::device_start()
+{
+ m_vram = nullptr;
+
+ save_item(NAME(m_vram_offset));
+ save_item(NAME(m_mode));
+ save_item(NAME(m_depth));
+ save_item(NAME(m_monitor_id));
+ save_item(NAME(m_vtest));
+ save_item(NAME(m_modeline_id));
+}
+
+void mac_video_sonora_device::device_reset()
+{
+ m_modeline_id = -1;
+ m_mode = 0x9f;
+ m_depth = 0;
+ m_monitor_id = 0;
+ m_vtest = 0;
+ m_vram_offset = 0;
+}
+
+void mac_video_sonora_device::device_add_mconfig(machine_config &config)
+{
+ SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
+ // dot clock, htotal, hstart, hend, vtotal, vstart, vend
+ m_screen->set_raw(31334400, 896, 0, 640, 525, 0, 480);
+ m_screen->set_screen_update(FUNC(mac_video_sonora_device::screen_update));
+
+ PALETTE(config, m_palette).set_entries(256);
+}
+
+// The monitor detection goes through 3 sense lines which are
+// pulled-up but can be set to 0 or 1 by the system.
+
+// The monitor itself either connects some lines to ground (old
+// method) or connects some lines together, sometimes with a diode
+// (extended monitor sense).
+
+// The system starts by leaving everything undriven and reading the
+// result. If it's not 7, it's the monitor type. If it's 7, then it
+// needs the extended monitor sense. It tend drives a 0 on each of
+// the 3 pins in sequence and records the result on the other two, and
+// that gives the signature.
+
+static constexpr uint8_t ext(uint8_t bc, uint8_t ac, uint8_t ab)
+{
+ return 0x40 | (bc << 4) | (ac << 2) | ab;
+}
+
+static INPUT_PORTS_START(monitor_config)
+ PORT_START("monitor")
+ PORT_CONFNAME(0x7f, 6, "Monitor type")
+ PORT_CONFSETTING(2, "512x384 12\" RGB")
+ PORT_CONFSETTING(6, "640x480 13\" RGB") // Biggest resolution with 16bpp support, hence default
+ PORT_CONFSETTING(1, "620x870 15\" Portrait")
+ PORT_CONFSETTING(ext(2, 3, 1), "832x624 16\" RGB")
+ PORT_CONFSETTING(ext(1, 1, 3), "640x480 VGA")
+INPUT_PORTS_END
+
+
+ioport_constructor mac_video_sonora_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME(monitor_config);
+}
+
+uint32_t mac_video_sonora_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
+{
+ if((m_mode & 0x80) || m_modeline_id == -1 || m_depth > 4 || (m_depth == 4 && !modelines[m_modeline_id].supports_16bpp) || !m_vram) {
+ bitmap.fill(0);
+ return 0;
+ }
+
+ const auto &m = modelines[m_modeline_id];
+ uint32_t hres = m.htot - m.hfp - m.hs - m.hbp;
+ uint32_t vres = m.vtot - m.vfp - m.vs - m.vbp;
+
+ const uint64_t *vram = m_vram + (m_vram_offset / 8);
+ const pen_t *pens = m_palette->pens();
+ switch(m_depth) {
+ case 0: // 1bpp
+ for(uint32_t y = 0; y != vres; y++) {
+ uint32_t *scanline = &bitmap.pix(y);
+ for(uint32_t x = 0; x != hres; x += 64) {
+ uint64_t pixels = *vram ++;
+ for(uint32_t bit = 0; bit != 64; bit ++)
+ *scanline ++ = pens[(((pixels >> bit) & 1) << 7) | 0x7f];
+ }
+ }
+ break;
+
+ case 3: // 8bpp
+ for(uint32_t y = 0; y != vres; y++) {
+ uint32_t *scanline = &bitmap.pix(y);
+ for(uint32_t x = 0; x != hres; x += 8) {
+ uint64_t pixels = *vram ++;
+ for(uint32_t bit = 0; bit != 64; bit += 8)
+ *scanline ++ = pens[((pixels >> bit) & 0xff)];
+ }
+ }
+ break;
+
+ default:
+ bitmap.fill(0xff0000);
+ break;
+ }
+
+ return 0;
+}
+
+uint8_t mac_video_sonora_device::vctrl_r(offs_t offset)
+{
+ switch(offset) {
+ case 0: return m_mode;
+ case 1: return m_depth;
+
+ case 2: {
+ uint8_t mon = m_monitor_config->read();
+ uint8_t res;
+ if(mon & 0x40) {
+ res = 7;
+ if(!(m_monitor_id & 0xc))
+ res &= 4 | (BIT(mon, 5) << 1) | BIT(mon, 4);
+ if(!(m_monitor_id & 0xa))
+ res &= (BIT(mon, 3) << 2) | 2 | BIT(mon, 2);
+ if(!(m_monitor_id & 0x9))
+ res &= (BIT(mon, 1) << 2) | (BIT(mon, 0) << 1) | 1;
+
+ } else {
+ res = mon;
+ if(!(m_monitor_id & 8))
+ res &= m_monitor_id & 7;
+ }
+
+ return m_monitor_id | (res << 4);
+ }
+
+ case 3: return m_vtest;
+ case 4: return (m_screen->hpos() >> 8) & 7;
+ case 5: return m_screen->hpos() & 0xff;
+ case 6: return (m_screen->vpos() >> 8) & 3;
+ case 7: return m_screen->vpos() & 0xff;
+ }
+
+ return 0;
+}
+
+void mac_video_sonora_device::vctrl_w(offs_t offset, uint8_t data)
+{
+ switch(offset) {
+ case 0: {
+ int prev_modeline = m_modeline_id;
+ m_mode = data & 0x9f;
+ m_modeline_id = -1;
+ for(unsigned i=0; i != std::size(modelines) && m_modeline_id == -1; i++)
+ if((m_mode & 0x1f) == modelines[i].mode_id)
+ m_modeline_id = i;
+
+ logerror("Mode switch %02x %s%s\n", data,
+ m_mode & 0x80 ? "blanked " : "",
+ m_modeline_id == -1 ? "disabled" : modelines[m_modeline_id].name);
+
+ if(m_modeline_id != -1 && m_modeline_id != prev_modeline) {
+ const modeline &m = modelines[m_modeline_id];
+ rectangle visarea(0, m.htot - m.hfp - m.hs - m.hbp - 1, 0, m.vtot - m.vfp - m.vs - m.vbp - 1);
+ m_screen->configure(m.htot, m.vtot, visarea, attotime::from_ticks(m.htot*m.vtot, m.dotclock).as_attoseconds());
+ }
+ break;
+ }
+
+ case 1:
+ m_depth = data & 7;
+ if(m_depth <= 4)
+ logerror("Pixel depth %dbpp\n", 1 << m_depth);
+ else
+ logerror("Pixel depth invalid (%d)\n", m_depth);
+ break;
+
+ case 2:
+ m_monitor_id = data & 0xf;
+ break;
+
+ case 3:
+ m_vtest = data & 1;
+ break;
+
+ default:
+ logerror("vctrl_w %x, %02x\n", offset, data);
+ }
+}
+
+void mac_video_sonora_device::dac_w(offs_t offset, uint8_t data)
+{
+ switch(offset) {
+ case 0:
+ m_pal_address = data;
+ m_pal_idx = 0;
+ break;
+
+ case 1:
+ switch(m_pal_idx) {
+ case 0: m_palette->set_pen_red_level(m_pal_address, data); break;
+ case 1: m_palette->set_pen_green_level(m_pal_address, data); break;
+ case 2: m_palette->set_pen_blue_level(m_pal_address, data); break;
+ }
+ m_pal_idx ++;
+ if(m_pal_idx == 3) {
+ m_pal_idx = 0;
+ m_pal_address ++;
+ }
+ break;
+
+ case 2:
+ m_pal_control = data;
+ break;
+
+ case 3:
+ m_pal_colkey = data;
+ break;
+ }
+}
diff --git a/src/devices/machine/mv_sonora.h b/src/devices/machine/mv_sonora.h
new file mode 100644
index 00000000000..8037a461c08
--- /dev/null
+++ b/src/devices/machine/mv_sonora.h
@@ -0,0 +1,69 @@
+// license:BSD-3-Clause
+// copyright-holders:Olivier Galibert
+/*********************************************************************
+
+ Mac video support, "Sonora" edition
+ Supports 5 different modelines at up to 16bpp
+
+*********************************************************************/
+#ifndef MAME_MACHINE_MAC_VIDEO_SONORA_H
+#define MAME_MACHINE_MAC_VIDEO_SONORA_H
+
+#pragma once
+
+#include "emupal.h"
+#include "screen.h"
+
+class mac_video_sonora_device : public device_t
+{
+public:
+ mac_video_sonora_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ virtual ~mac_video_sonora_device() = default;
+
+ uint8_t vctrl_r(offs_t offset);
+ void vctrl_w(offs_t offset, uint8_t data);
+ void dac_w(offs_t offset, uint8_t data);
+
+ DECLARE_READ_LINE_MEMBER(vblank) const { return m_screen->vblank(); }
+ DECLARE_READ_LINE_MEMBER(hblank) const { return m_screen->hblank(); }
+
+ auto screen_vblank() { return m_screen->screen_vblank(); }
+ auto scanline() { return m_screen->scanline(); }
+
+ void set_vram_base(const uint64_t *vram) { m_vram = vram; }
+ void set_vram_offset(uint32_t offset) { m_vram_offset = offset; }
+
+protected:
+ virtual void device_start() override;
+ virtual void device_reset() override;
+ virtual void device_add_mconfig(machine_config &config) override;
+ virtual ioport_constructor device_input_ports() const override;
+
+private:
+ struct modeline {
+ uint8_t mode_id;
+ const char *name;
+ uint32_t dotclock;
+ uint32_t htot, hfp, hs, hbp;
+ uint32_t vtot, vfp, vs, vbp;
+ bool supports_16bpp;
+ };
+
+ static const modeline modelines[5];
+
+ required_device<screen_device> m_screen;
+ required_device<palette_device> m_palette;
+ required_ioport m_monitor_config;
+
+ const uint64_t *m_vram;
+ uint32_t m_vram_offset;
+ uint8_t m_mode, m_depth, m_monitor_id, m_vtest;
+ uint8_t m_pal_address, m_pal_idx, m_pal_control, m_pal_colkey;
+ int m_modeline_id;
+
+ uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
+};
+
+DECLARE_DEVICE_TYPE(MAC_VIDEO_SONORA, mac_video_sonora_device)
+
+#endif /* MAME_MACHINE_MAC_VIDEO_SONORA_H */
diff --git a/src/devices/sound/awacs.cpp b/src/devices/sound/awacs.cpp
index 72cf31d7589..69c93ad2d74 100644
--- a/src/devices/sound/awacs.cpp
+++ b/src/devices/sound/awacs.cpp
@@ -88,7 +88,7 @@ void awacs_device::device_timer(emu_timer &timer, device_timer_id tid, int param
void awacs_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- int offset = (m_buffer_num == 0) ? m_dma_offset_0 : m_dma_offset_1;
+ // int offset = (m_buffer_num == 0) ? m_dma_offset_0 : m_dma_offset_1;
auto &outL = outputs[0];
auto &outR = outputs[1];
@@ -97,8 +97,13 @@ void awacs_device::sound_stream_update(sound_stream &stream, std::vector<read_st
{
for (int i = 0; i < outL.samples(); i++)
{
+#if 0
outL.put_int(i, s16(m_dma_space->read_word(offset + m_play_ptr)), 32768);
outR.put_int(i, s16(m_dma_space->read_word(offset + m_play_ptr + 2)), 32768);
+#else
+ outL.put_int(i, 0, 32768);
+ outR.put_int(i, 0, 32768);
+#endif
m_play_ptr += 4;
}
diff --git a/src/emu/emumem.cpp b/src/emu/emumem.cpp
index 3f8dde789b1..21b6b39f6b6 100644
--- a/src/emu/emumem.cpp
+++ b/src/emu/emumem.cpp
@@ -524,7 +524,6 @@ void address_space_installer::check_optimize_all(const char *function, int width
if ((~addrend) & lowbits_mask)
fatalerror("%s: In range %x-%x mask %x mirror %x select %x, end address has low bits unset, did you mean %x ?\n", function, addrstart, addrend, addrmask, addrmirror, addrselect, addrend | lowbits_mask);
-
offs_t set_bits = addrstart | addrend;
offs_t changing_bits = addrstart ^ addrend;
// Round up to the nearest power-of-two-minus-one
@@ -581,6 +580,56 @@ void address_space_installer::check_optimize_all(const char *function, int width
nend = addrend;
nmask = (addrmask ? addrmask : changing_bits) | addrselect;
nmirror = (addrmirror & m_addrmask) | addrselect;
+
+ if(nmirror & default_lowbits_mask) {
+ // If the mirroring/select "reaches" within the bus
+ // granularity we have to adapt it and the unitmask.
+
+ // We're sure start/end are on the same data-width-sized
+ // entry, because otherwise the previous tests wouldn't have
+ // passed. So we need to clear the part of the unitmask that
+ // not in the range, then replicate it following the mirror.
+ // The start/end also need to be adjusted to the bus
+ // granularity.
+
+ // 1. Adjusting
+ nstart &= ~default_lowbits_mask;
+ nend |= default_lowbits_mask;
+
+ // 2. Clearing
+ u64 smask, emask;
+ if(m_config.endianness() == ENDIANNESS_BIG) {
+ smask = make_bitmask<u64>(m_config.data_width() - ((addrstart - nstart) << (3 - m_config.addr_shift())));
+ emask = ~make_bitmask<u64>(m_config.data_width() - ((addrend - nstart + 1) << (3 - m_config.addr_shift())));
+ } else {
+ smask = ~make_bitmask<u64>((addrstart - nstart) << (3 - m_config.addr_shift()));
+ emask = make_bitmask<u64>((addrend - nstart + 1) << (3 - m_config.addr_shift()));
+ }
+ nunitmask &= smask & emask;
+
+ // 3. Mirroring
+ offs_t to_mirror = nmirror & default_lowbits_mask;
+ if(m_config.endianness() == ENDIANNESS_BIG) {
+ for(int i=0; to_mirror; i++)
+ if((to_mirror >> i) & 1) {
+ to_mirror &= ~(1 << i);
+ nunitmask |= nunitmask >> (1 << (3 + i - m_config.addr_shift()));
+ }
+ } else {
+ for(int i=0; to_mirror; i++)
+ if((to_mirror >> i) & 1) {
+ to_mirror &= ~(1 << i);
+ nunitmask |= nunitmask << (1 << (3 + i - m_config.addr_shift()));
+ }
+ }
+
+ // 4. Ajusting the mirror
+ nmirror &= ~default_lowbits_mask;
+
+ // 5. Recompute changing_bits, it matters for the next optimization. No need to round up through
+ changing_bits = nstart ^ nend;
+ }
+
if(nmirror && !(nstart & changing_bits) && !((~nend) & changing_bits)) {
// If the range covers the a complete power-of-two zone, it is
// possible to remove 1 bits from the mirror, pushing the end
diff --git a/src/mame/drivers/mac.cpp b/src/mame/drivers/mac.cpp
index 837970d0c46..870a058898e 100644
--- a/src/mame/drivers/mac.cpp
+++ b/src/mame/drivers/mac.cpp
@@ -65,7 +65,6 @@
#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"
@@ -644,33 +643,6 @@ void mac_state::maciifx_map(address_map &map)
map(0x50040000, 0x50041fff).rw(FUNC(mac_state::mac_via_r), FUNC(mac_state::mac_via_w)).mirror(0x00f00000);
}
-void mac_state::pwrmac_map(address_map &map)
-{
- map(0x00000000, 0x007fffff).ram().share("vram64"); // 8 MB standard
-
- map(0x40000000, 0x403fffff).rom().region("bootrom", 0).mirror(0x0fc00000);
-
- map(0x50000000, 0x50001fff).rw(FUNC(mac_state::mac_via_r), FUNC(mac_state::mac_via_w)).mirror(0x00f00000);
- map(0x50004000, 0x50005fff).rw(FUNC(mac_state::mac_scc_r), FUNC(mac_state::mac_scc_2_w)).mirror(0x00f00000);
- // 50008000 = ethernet ID PROM
- // 5000a000 = MACE ethernet controller
- map(0x50010000, 0x50011fff).rw(FUNC(mac_state::macplus_scsi_r), FUNC(mac_state::macii_scsi_w)).mirror(0x00f00000);
- // 50014000 = sound registers (AWACS)
- map(0x50014000, 0x50015fff).rw(m_awacs, FUNC(awacs_device::read), FUNC(awacs_device::write)).mirror(0x01f00000);
- map(0x50016000, 0x50017fff).rw(FUNC(mac_state::mac_iwm_r), FUNC(mac_state::mac_iwm_w)).mirror(0x00f00000);
- map(0x50024000, 0x50025fff).w(FUNC(mac_state::ariel_ramdac_w)).mirror(0x00f00000);
- map(0x50026000, 0x50027fff).rw(FUNC(mac_state::mac_via2_r), FUNC(mac_state::mac_via2_w)).mirror(0x00f00000);
- map(0x50028000, 0x50028007).rw(FUNC(mac_state::mac_sonora_vctl_r), FUNC(mac_state::mac_sonora_vctl_w)).mirror(0x00f00000);
- // 5002a000 = interrupt controller
- // 5002c000 = diagnostic registers
- map(0x5002c000, 0x5002dfff).r(FUNC(mac_state::pmac_diag_r)).mirror(0x00f00000);
- map(0x50031000, 0x50032fff).rw(FUNC(mac_state::amic_dma_r), FUNC(mac_state::amic_dma_w)).mirror(0x00f00000);
- map(0x50040000, 0x5004000f).rw(FUNC(mac_state::hmc_r), FUNC(mac_state::hmc_w)).mirror(0x00f00000);
- map(0x5ffffff8, 0x5fffffff).r(FUNC(mac_state::mac_read_id));
-
- map(0xffc00000, 0xffffffff).rom().region("bootrom", 0);
-}
-
/***************************************************************************
DEVICE CONFIG
***************************************************************************/
@@ -750,11 +722,6 @@ void mac_state::add_base_devices(machine_config &config, bool rtc, int woz_versi
m_fdc->hdsel_cb().set(FUNC(mac_state::hdsel_w));
m_fdc->devsel_cb().set(FUNC(mac_state::devsel_w));
break;
- case 3:
- SWIM3(config, m_fdc, C15M);
- m_fdc->hdsel_cb().set(FUNC(mac_state::hdsel_s3_w));
- m_fdc->devsel_cb().set(FUNC(mac_state::devsel_s3_w));
- break;
}
m_fdc->phases_cb().set(FUNC(mac_state::phases_w));
@@ -1236,46 +1203,6 @@ void mac_state::maciisi(machine_config &config)
add_egret(config, EGRET_344S0100);
}
-void mac_state::pwrmac(machine_config &config)
-{
- PPC601(config, m_maincpu, 60000000);
- m_maincpu->set_addrmap(AS_PROGRAM, &mac_state::pwrmac_map);
-
- SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
- // dot clock, htotal, hstart, hend, vtotal, vstart, vend
- m_screen->set_raw(25175000, 800, 0, 640, 525, 0, 480);
- m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK);
- m_screen->set_size(1024, 768);
- m_screen->set_visarea(0, 640-1, 0, 480-1);
- m_screen->set_screen_update(FUNC(mac_state::screen_update_pwrmac));
-
- PALETTE(config, m_palette).set_entries(256);
-
- MCFG_VIDEO_START_OVERRIDE(mac_state,macsonora)
- MCFG_VIDEO_RESET_OVERRIDE(mac_state,macrbv)
-
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
- AWACS(config, m_awacs, 44100);
- m_awacs->add_route(0, "lspeaker", 1.0);
- m_awacs->add_route(1, "rspeaker", 1.0);
-
- add_scsi(config);
- add_base_devices(config, false, 3);
-
- add_via1_adb(config, false);
- m_via1->writepb_handler().set(FUNC(mac_state::mac_via_out_b_cdadb));
-
- add_via2(config);
-
- RAM(config, m_ram);
- m_ram->set_default_size("8M");
- m_ram->set_extra_options("16M,32M,64M,128M");
-
- MACADB(config, m_macadb, C15M);
- add_cuda(config, CUDA_341S0060);
-}
-
static INPUT_PORTS_START( macadb )
INPUT_PORTS_END
@@ -1392,11 +1319,6 @@ ROM_START( maclc3 )
ROM_LOAD( "ecbbc41c.rom", 0x000000, 0x100000, CRC(e578f5f3) SHA1(c77df3220c861f37a2c553b6ee9241b202dfdffc) )
ROM_END
-ROM_START( pmac6100 )
- ROM_REGION64_BE(0x400000, "bootrom", 0)
- ROM_LOAD( "9feb69b3.rom", 0x000000, 0x400000, CRC(a43fadbc) SHA1(6fac1c4e920a077c077b03902fef9199d5e8f2c3) )
-ROM_END
-
ROM_START( maccclas )
ROM_REGION32_BE(0x100000, "bootrom", 0)
ROM_LOAD( "ecd99dc0.rom", 0x000000, 0x100000, CRC(c84c3aa5) SHA1(fd9e852e2d77fe17287ba678709b9334d4d74f1e) )
@@ -1425,4 +1347,3 @@ COMP( 1993, maclc3, 0, 0, maclc3, maciici, mac_state, init_macl
COMP( 1993, maciivx, 0, 0, maciivx, maciici, mac_state, init_maciivx, "Apple Computer", "Macintosh IIvx", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_SOUND )
COMP( 1993, maciivi, maciivx, 0, maciivi, maciici, mac_state, init_maciivi, "Apple Computer", "Macintosh IIvi", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_SOUND )
COMP( 1993, maclc520, 0, 0, maclc520, maciici, mac_state, init_maclc520, "Apple Computer", "Macintosh LC 520", MACHINE_NOT_WORKING )
-COMP( 1994, pmac6100, 0, 0, pwrmac, macadb, mac_state, init_macpm6100, "Apple Computer", "Power Macintosh 6100/60", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND )
diff --git a/src/mame/drivers/macpdm.cpp b/src/mame/drivers/macpdm.cpp
new file mode 100644
index 00000000000..7a38a7ba327
--- /dev/null
+++ b/src/mame/drivers/macpdm.cpp
@@ -0,0 +1,741 @@
+// license:BSD-3-Clause
+// copyright-holders:R. Belmont, O. Galibert
+
+#include "emu.h"
+
+#include "bus/nubus/nubus.h"
+#include "bus/scsi/scsi.h"
+#include "bus/scsi/scsihd.h"
+#include "cpu/powerpc/ppc.h"
+#include "machine/6522via.h"
+#include "machine/8530scc.h"
+#include "machine/cuda.h"
+#include "machine/macadb.h"
+#include "machine/mv_sonora.h"
+#include "machine/ncr5380.h"
+#include "machine/ram.h"
+#include "machine/swim3.h"
+#include "softlist.h"
+#include "sound/awacs.h"
+#include "speaker.h"
+
+constexpr auto IO_CLOCK = 31.3344_MHz_XTAL;
+constexpr auto VGA_CLOCK = 25.1750_MHz_XTAL;
+constexpr auto DOT_CLOCK = 57.2832_MHz_XTAL;
+constexpr auto ENET_CLOCK = 20_MHz_XTAL;
+
+class macpdm_state : public driver_device
+{
+public:
+ macpdm_state(const machine_config &mconfig, device_type type, const char *tag);
+
+ void macpdm(machine_config &config);
+
+ virtual void driver_init() override;
+ virtual void driver_reset() override;
+
+private:
+ required_device<ppc_device> m_maincpu;
+ required_device<via6522_device> m_via1;
+ required_device<awacs_device> m_awacs;
+ required_device<cuda_device> m_cuda;
+ required_device<macadb_device> m_macadb;
+ required_device<ram_device> m_ram;
+ required_device<scc8530_legacy_device> m_scc;
+ required_device<ncr5380_device> m_ncr5380;
+ required_device<applefdintf_device> m_fdc;
+ required_device_array<floppy_connector, 2> m_floppy;
+ required_device<mac_video_sonora_device> m_video;
+
+ floppy_image_device *m_cur_floppy;
+
+ uint32_t m_model_id;
+ uint64_t m_hmc_reg, m_hmc_buffer;
+ uint8_t m_hmc_bit;
+
+ uint8_t m_irq_control;
+
+ uint32_t m_dma_badr, m_dma_floppy_adr;
+ uint16_t m_dma_berr_en, m_dma_berr_flag;
+
+ uint8_t m_dma_scsi_ctrl, m_dma_floppy_ctrl;
+ uint8_t m_dma_scc_txa_ctrl, m_dma_scc_rxa_ctrl, m_dma_scc_txb_ctrl, m_dma_scc_rxb_ctrl;
+ uint8_t m_dma_enet_rx_ctrl, m_dma_enet_tx_ctrl;
+
+ void pdm_map(address_map &map);
+
+ DECLARE_WRITE_LINE_MEMBER(nmi_irq);
+ DECLARE_WRITE_LINE_MEMBER(dma_irq);
+ DECLARE_WRITE_LINE_MEMBER(enet_irq);
+ DECLARE_WRITE_LINE_MEMBER(scc_irq);
+ DECLARE_WRITE_LINE_MEMBER(via2_irq);
+ DECLARE_WRITE_LINE_MEMBER(via1_irq);
+
+ DECLARE_WRITE_LINE_MEMBER(bus_err_irq);
+ DECLARE_WRITE_LINE_MEMBER(fdc_irq);
+ DECLARE_WRITE_LINE_MEMBER(etx_irq);
+ DECLARE_WRITE_LINE_MEMBER(erx_irq);
+ DECLARE_WRITE_LINE_MEMBER(txa_irq);
+ DECLARE_WRITE_LINE_MEMBER(rxa_irq);
+ DECLARE_WRITE_LINE_MEMBER(txb_irq);
+ DECLARE_WRITE_LINE_MEMBER(rxb_irq);
+
+ DECLARE_WRITE_LINE_MEMBER(sndo_irq);
+ DECLARE_WRITE_LINE_MEMBER(sndi_irq);
+
+ DECLARE_WRITE_LINE_MEMBER(fdc_err_irq);
+ DECLARE_WRITE_LINE_MEMBER(etx_err_irq);
+ DECLARE_WRITE_LINE_MEMBER(erx_err_irq);
+ DECLARE_WRITE_LINE_MEMBER(txa_err_irq);
+ DECLARE_WRITE_LINE_MEMBER(rxa_err_irq);
+ DECLARE_WRITE_LINE_MEMBER(txb_err_irq);
+ DECLARE_WRITE_LINE_MEMBER(rxb_err_irq);
+
+ DECLARE_WRITE_LINE_MEMBER(scsi_err_irq);
+ DECLARE_WRITE_LINE_MEMBER(sndo_err_irq);
+ DECLARE_WRITE_LINE_MEMBER(sndi_err_irq);
+
+ void phases_w(uint8_t phases);
+ void sel35_w(int sel35);
+ void devsel_w(uint8_t devsel);
+ void hdsel_w(int hdsel);
+
+ uint8_t via1_in_a();
+ uint8_t via1_in_b();
+ void via1_out_a(uint8_t data);
+ void via1_out_b(uint8_t data);
+ DECLARE_WRITE_LINE_MEMBER(via1_out_cb2);
+
+ DECLARE_WRITE_LINE_MEMBER(cuda_reset_w);
+
+ uint8_t via1_r(offs_t offset);
+ void via1_w(offs_t offset, uint8_t data);
+
+ uint8_t via2_r(offs_t offset);
+ void via2_w(offs_t offset, uint8_t data);
+
+ uint8_t fdc_r(offs_t offset);
+ void fdc_w(offs_t offset, uint8_t data);
+
+ uint8_t scc_r(offs_t offset);
+ void scc_w(offs_t offset, uint8_t data);
+
+ uint8_t scsi_r(offs_t offset);
+ void scsi_w(offs_t offset, uint8_t data);
+
+ uint8_t hmc_r(offs_t offset);
+ void hmc_w(offs_t offset, uint8_t data);
+
+ uint32_t id_r();
+
+ uint8_t diag_r(offs_t offset);
+
+ uint8_t irq_control_r();
+ void irq_control_w(uint8_t data);
+ void irq_main_set(uint8_t mask, int state);
+
+ uint32_t dma_badr_r();
+ void dma_badr_w(offs_t, uint32_t data, uint32_t mem_mask);
+ uint16_t dma_berr_en_r();
+ void dma_berr_en_w(offs_t, uint16_t data, uint16_t mem_mask);
+ uint16_t dma_berr_flag_r();
+ void dma_berr_flag_w(offs_t, uint16_t data, uint16_t mem_mask);
+
+ uint8_t dma_scsi_ctrl_r();
+ void dma_scsi_ctrl_w(uint8_t data);
+
+ uint8_t dma_floppy_ctrl_r();
+ void dma_floppy_ctrl_w(uint8_t data);
+ uint32_t dma_floppy_adr_r();
+ void dma_floppy_adr_w(offs_t, uint32_t data, uint32_t mem_mask);
+
+ uint8_t dma_scc_txa_ctrl_r();
+ void dma_scc_txa_ctrl_w(uint8_t data);
+ uint8_t dma_scc_rxa_ctrl_r();
+ void dma_scc_rxa_ctrl_w(uint8_t data);
+ uint8_t dma_scc_txb_ctrl_r();
+ void dma_scc_txb_ctrl_w(uint8_t data);
+ uint8_t dma_scc_rxb_ctrl_r();
+ void dma_scc_rxb_ctrl_w(uint8_t data);
+
+ uint8_t dma_enet_rx_ctrl_r();
+ void dma_enet_rx_ctrl_w(uint8_t data);
+ uint8_t dma_enet_tx_ctrl_r();
+ void dma_enet_tx_ctrl_w(uint8_t data);
+
+ uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
+};
+
+macpdm_state::macpdm_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
+ m_maincpu(*this, "maincpu"),
+ m_via1(*this, "via6522_1"),
+ m_awacs(*this, "awacs"),
+ m_cuda(*this, "cuda"),
+ m_macadb(*this, "macadb"),
+ m_ram(*this, RAM_TAG),
+ m_scc(*this, "scc"),
+ m_ncr5380(*this, "ncr5380"),
+ m_fdc(*this, "fdc"),
+ m_floppy(*this, "fdc:%d", 0U),
+ m_video(*this, "video")
+{
+ m_cur_floppy = nullptr;
+}
+
+void macpdm_state::driver_init()
+{
+ m_maincpu->space().install_ram(0, m_ram->mask(), 0x3000000,m_ram->pointer());
+ m_maincpu->space().nop_readwrite(m_ram->size(), 0xffffff, 0x3000000);
+ m_model_id = 0xa55a3011;
+ // 7100 = a55a3012
+ // 8100 = a55a3013
+
+ m_awacs->set_dma_base(m_maincpu->space(AS_PROGRAM), 0x10000, 0x12000);
+
+ save_item(NAME(m_hmc_reg));
+ save_item(NAME(m_hmc_buffer));
+ save_item(NAME(m_hmc_bit));
+
+ save_item(NAME(m_irq_control));
+
+ save_item(NAME(m_dma_badr));
+ save_item(NAME(m_dma_berr_en));
+ save_item(NAME(m_dma_berr_flag));
+ save_item(NAME(m_dma_scsi_ctrl));
+ save_item(NAME(m_dma_floppy_ctrl));
+ save_item(NAME(m_dma_scc_txa_ctrl));
+ save_item(NAME(m_dma_scc_rxa_ctrl));
+ save_item(NAME(m_dma_scc_txb_ctrl));
+ save_item(NAME(m_dma_scc_rxb_ctrl));
+ save_item(NAME(m_dma_enet_rx_ctrl));
+ save_item(NAME(m_dma_enet_tx_ctrl));
+
+ save_item(NAME(m_dma_floppy_adr));
+
+ m_maincpu->space().install_read_tap(0x4000c2e0, 0x4000c2e7, 0, "cuda", [this](offs_t offset, u64 &data, u64 mem_mask) {
+ if(mem_mask == 0xffff000000000000) {
+ offs_t badr = m_maincpu->state_int(PPC_R16);
+ m_maincpu->translate(AS_PROGRAM, TRANSLATE_READ_DEBUG, badr);
+ logerror("cuda packet %08x : type %02x cmd %02x - %02x %02x %02x %02x bytecnt %04x\n",
+ badr,
+ m_maincpu->space().read_byte(badr),
+ m_maincpu->space().read_byte(badr+1),
+ m_maincpu->space().read_byte(badr+2),
+ m_maincpu->space().read_byte(badr+3),
+ m_maincpu->space().read_byte(badr+4),
+ m_maincpu->space().read_byte(badr+5),
+ m_maincpu->space().read_word(badr+6));
+ }
+ });
+}
+
+void macpdm_state::driver_reset()
+{
+ m_hmc_reg = 0;
+ m_hmc_buffer = 0;
+ m_hmc_bit = 0;
+
+ m_irq_control = 0;
+
+ m_dma_badr = 0;
+ m_dma_berr_en = 0;
+ m_dma_berr_flag = 0;
+ m_dma_scsi_ctrl = 0;
+ m_dma_floppy_ctrl = 0;
+ m_dma_scc_txa_ctrl = 0;
+ m_dma_scc_rxa_ctrl = 0;
+ m_dma_scc_txb_ctrl = 0;
+ m_dma_scc_rxb_ctrl = 0;
+ m_dma_enet_rx_ctrl = 0;
+ m_dma_enet_tx_ctrl = 0;
+
+ m_dma_floppy_adr = 0x15000;
+
+ m_video->set_vram_base((const u64 *)m_ram->pointer());
+ m_video->set_vram_offset(0);
+}
+
+uint8_t macpdm_state::irq_control_r()
+{
+ return m_irq_control;
+}
+
+void macpdm_state::irq_control_w(uint8_t data)
+{
+ if((m_irq_control ^ data) & 0x40) {
+ m_irq_control = (m_irq_control & ~0xc0) | (data & 0x40);
+ m_maincpu->set_input_line(PPC_IRQ, CLEAR_LINE);
+ }
+ if((data & 0xc0) == 0xc0 && (m_irq_control & 0x80)) {
+ m_irq_control &= 0x7f;
+ m_maincpu->set_input_line(PPC_IRQ, CLEAR_LINE);
+ }
+
+ logerror("irq control %02x\n", m_irq_control);
+}
+
+void macpdm_state::irq_main_set(uint8_t mask, int state)
+{
+ if(((m_irq_control & mask) != 0) == state)
+ return;
+
+ m_irq_control ^= mask;
+
+ if(m_irq_control & 0x40) {
+ m_irq_control |= 0x80;
+ m_maincpu->set_input_line(PPC_IRQ, ASSERT_LINE);
+ } else {
+ if(m_irq_control & 0x3f) {
+ m_irq_control |= 0x80;
+ m_maincpu->set_input_line(PPC_IRQ, ASSERT_LINE);
+ } else {
+ m_irq_control &= 0x7f;
+ m_maincpu->set_input_line(PPC_IRQ, CLEAR_LINE);
+ }
+ }
+
+ logerror("irq control %02x\n", m_irq_control);
+}
+
+
+
+
+// bit 7 = out - scc wait/request
+// bit 5 = out - head select, unconnected
+// bit 3 = ? - sync modem (?)
+uint8_t macpdm_state::via1_in_a()
+{
+ return 0x00;
+}
+
+void macpdm_state::via1_out_a(uint8_t data)
+{
+}
+
+// bit 7 = ? - snd res (?)
+// bit 5 = out - sys sess/tip
+// bit 4 = out - via full/byte ack
+// bit 3 = in - xcvr sess/treq
+
+uint8_t macpdm_state::via1_in_b()
+{
+ uint8_t val = 0;
+
+ val |= m_cuda->get_treq() << 3;
+
+ return val;
+}
+
+void macpdm_state::via1_out_b(uint8_t data)
+{
+ m_cuda->set_byteack(BIT(data, 4));
+ m_cuda->set_tip(BIT(data, 5));
+}
+
+WRITE_LINE_MEMBER(macpdm_state::via1_out_cb2)
+{
+ m_cuda->set_via_data(state & 1);
+}
+
+
+WRITE_LINE_MEMBER(macpdm_state::cuda_reset_w)
+{
+ m_maincpu->set_input_line(INPUT_LINE_HALT, state);
+ m_maincpu->set_input_line(INPUT_LINE_RESET, state);
+}
+
+
+uint8_t macpdm_state::via1_r(offs_t offset)
+{
+ return m_via1->read(offset >> 9);
+}
+
+void macpdm_state::via1_w(offs_t offset, uint8_t data)
+{
+ m_via1->write(offset >> 9, data);
+}
+
+uint8_t macpdm_state::via2_r(offs_t offset)
+{
+ logerror("via2_r %x\n", offset);
+ return 0;
+}
+
+void macpdm_state::via2_w(offs_t offset, uint8_t data)
+{
+ logerror("via2_w %x, %02x\n", offset, data);
+}
+
+uint8_t macpdm_state::scc_r(offs_t offset)
+{
+ return m_scc->reg_r(offset >> 1);
+}
+
+void macpdm_state::scc_w(offs_t offset, uint8_t data)
+{
+ m_scc->reg_w(offset, data);
+}
+
+uint8_t macpdm_state::fdc_r(offs_t offset)
+{
+ return m_fdc->read(offset >> 9);
+}
+
+void macpdm_state::fdc_w(offs_t offset, uint8_t data)
+{
+ m_fdc->write(offset >> 9, data);
+}
+
+uint8_t macpdm_state::scsi_r(offs_t offset)
+{
+ return m_ncr5380->ncr5380_read_reg(offset >> 4);
+}
+
+void macpdm_state::scsi_w(offs_t offset, uint8_t data)
+{
+ return m_ncr5380->ncr5380_write_reg(offset >> 4, data);
+}
+
+uint8_t macpdm_state::hmc_r(offs_t offset)
+{
+ return (m_hmc_reg >> m_hmc_bit) & 1 ? 0x80 : 0x00;
+}
+
+void macpdm_state::hmc_w(offs_t offset, uint8_t data)
+{
+ if(offset & 8)
+ m_hmc_bit = 0;
+ else {
+ if(data & 0x80)
+ m_hmc_buffer |= u64(1) << m_hmc_bit;
+ else
+ m_hmc_buffer &= ~(u64(1) << m_hmc_bit);
+ m_hmc_bit ++;
+ if(m_hmc_bit == 35) {
+ m_hmc_reg = m_hmc_buffer & ~3; // csiz is readonly, we pretend there isn't a l2 cache
+ m_video->set_vram_offset(m_hmc_reg & 0x200000000 ? 0x100000 : 0);
+ logerror("HMC l2=%c%c%c%c%c vbase=%c%s mbram=%cM size=%x%s romd=%d refresh=%02x w=%c%c%c%c ras=%d%d%d%d\n",
+ m_hmc_reg & 0x008000000 ? '+' : '-', // l2_en
+ m_hmc_reg & 0x400000000 ? '3' : '2', // l2_init
+ m_hmc_reg & 0x004000000 ? '1' : '2', // l2_brst
+ m_hmc_reg & 0x010000000 ? 'I' : 'U', // l2_inst
+ m_hmc_reg & 0x002000000 ? 'w' : '.', // l2romw
+ m_hmc_reg & 0x200000000 ? '1' : '0', // vbase
+ m_hmc_reg & 0x100000000 ? " vtst" : "", // vtst
+ m_hmc_reg & 0x080000000 ? '8' : '4', // mb_ram
+ (m_hmc_reg >> 29) & 3, // size
+ m_hmc_reg & 0x001000000 ? " nblrom" : "", // nblrom
+ 12 - 2*((m_hmc_reg >> 22) & 3), // romd
+ (m_hmc_reg >> 16) & 0x3f, // rfsh
+ m_hmc_reg & 0x000000008 ? '3' : '2', // winit
+ m_hmc_reg & 0x000000004 ? '3' : '2', // wbrst
+ m_hmc_reg & 0x000008000 ? '1' : '2', // wcasp
+ m_hmc_reg & 0x000004000 ? '1' : '2', // wcasd
+ 3 - ((m_hmc_reg >> 12) & 3), // rdac
+ 6 - ((m_hmc_reg >> 8) & 3), // rasd
+ 5 - ((m_hmc_reg >> 6) & 3), // rasp
+ 4 - ((m_hmc_reg >> 4) & 3)); // rcasd
+ }
+ }
+}
+
+uint8_t macpdm_state::diag_r(offs_t offset)
+{
+ // returning 0 at address 0 gives the 'car crash' sound after the boot bong
+ logerror("diag_r %x\n", offset);
+ return offset ? 0 : 1;
+}
+
+void macpdm_state::phases_w(uint8_t phases)
+{
+ if(m_cur_floppy)
+ m_cur_floppy->seek_phase_w(phases);
+}
+
+void macpdm_state::sel35_w(int sel35)
+{
+ logerror("fdc mac sel35 %d\n", sel35);
+}
+
+void macpdm_state::devsel_w(uint8_t devsel)
+{
+ 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;
+ m_fdc->set_floppy(m_cur_floppy);
+}
+
+void macpdm_state::hdsel_w(int hdsel)
+{
+ if(m_cur_floppy)
+ m_cur_floppy->ss_w(hdsel);
+}
+
+uint32_t macpdm_state::id_r()
+{
+ return m_model_id;
+}
+
+WRITE_LINE_MEMBER(macpdm_state::scc_irq)
+{
+ logerror("scc irq %d\n", state);
+}
+
+WRITE_LINE_MEMBER(macpdm_state::via1_irq)
+{
+ irq_main_set(0x01, state);
+}
+
+uint32_t macpdm_state::dma_badr_r()
+{
+ return m_dma_badr;
+}
+
+void macpdm_state::dma_badr_w(offs_t, uint32_t data, uint32_t mem_mask)
+{
+ COMBINE_DATA(&m_dma_badr);
+ m_dma_badr &= 0xfffc0000;
+
+ logerror("dma base address %08x\n", m_dma_badr);
+
+ m_dma_floppy_adr = (m_dma_badr | 0x10000) + (m_dma_floppy_adr & 0xffff);
+}
+
+uint16_t macpdm_state::dma_berr_en_r()
+{
+ return m_dma_berr_en;
+}
+
+void macpdm_state::dma_berr_en_w(offs_t, uint16_t data, uint16_t mem_mask)
+{
+ COMBINE_DATA(&m_dma_berr_en);
+ logerror("dma bus error enable %08x\n", m_dma_berr_en);
+}
+
+uint16_t macpdm_state::dma_berr_flag_r()
+{
+ return m_dma_berr_flag;
+}
+
+void macpdm_state::dma_berr_flag_w(offs_t, uint16_t data, uint16_t mem_mask)
+{
+ COMBINE_DATA(&m_dma_berr_flag);
+ logerror("dma bus error flag %08x\n", m_dma_berr_flag);
+}
+
+
+uint8_t macpdm_state::dma_scsi_ctrl_r()
+{
+ return m_dma_scsi_ctrl;
+}
+
+void macpdm_state::dma_scsi_ctrl_w(uint8_t data)
+{
+ m_dma_scsi_ctrl = data;
+ logerror("dma_scsi_ctrl_w %02x\n", m_dma_scsi_ctrl);
+}
+
+
+uint8_t macpdm_state::dma_floppy_ctrl_r()
+{
+ return m_dma_floppy_ctrl;
+}
+
+void macpdm_state::dma_floppy_ctrl_w(uint8_t data)
+{
+ m_dma_floppy_ctrl = data;
+ logerror("dma_floppy_ctrl_w %02x\n", m_dma_floppy_ctrl);
+}
+
+uint32_t macpdm_state::dma_floppy_adr_r()
+{
+ return m_dma_floppy_adr;
+}
+
+void macpdm_state::dma_floppy_adr_w(offs_t, uint32_t data, uint32_t mem_mask)
+{
+ COMBINE_DATA(&m_dma_floppy_adr);
+ m_dma_floppy_adr = (m_dma_badr | 0x10000) + (m_dma_floppy_adr & 0xffff);
+ logerror("dma floppy adr %08x\n", m_dma_floppy_adr);
+}
+
+
+uint8_t macpdm_state::dma_scc_txa_ctrl_r()
+{
+ return m_dma_scc_txa_ctrl;
+}
+
+void macpdm_state::dma_scc_txa_ctrl_w(uint8_t data)
+{
+ m_dma_scc_txa_ctrl = data;
+ logerror("dma_scc_txa_ctrl_w %02x\n", m_dma_scc_txa_ctrl);
+}
+
+uint8_t macpdm_state::dma_scc_rxa_ctrl_r()
+{
+ return m_dma_scc_rxa_ctrl;
+}
+
+void macpdm_state::dma_scc_rxa_ctrl_w(uint8_t data)
+{
+ m_dma_scc_rxa_ctrl = data;
+ logerror("dma_scc_rxa_ctrl_w %02x\n", m_dma_scc_rxa_ctrl);
+}
+
+uint8_t macpdm_state::dma_scc_txb_ctrl_r()
+{
+ return m_dma_scc_txb_ctrl;
+}
+
+void macpdm_state::dma_scc_txb_ctrl_w(uint8_t data)
+{
+ m_dma_scc_txb_ctrl = data;
+ logerror("dma_scc_txb_ctrl_w %02x\n", m_dma_scc_txb_ctrl);
+}
+
+uint8_t macpdm_state::dma_scc_rxb_ctrl_r()
+{
+ return m_dma_scc_rxb_ctrl;
+}
+
+void macpdm_state::dma_scc_rxb_ctrl_w(uint8_t data)
+{
+ m_dma_scc_rxb_ctrl = data;
+ logerror("dma_scc_rxb_ctrl_w %02x\n", m_dma_scc_rxb_ctrl);
+}
+
+uint8_t macpdm_state::dma_enet_rx_ctrl_r()
+{
+ return m_dma_enet_rx_ctrl;
+}
+
+void macpdm_state::dma_enet_rx_ctrl_w(uint8_t data)
+{
+ m_dma_enet_rx_ctrl = data;
+ logerror("dma_enet_rx_ctrl_w %02x\n", m_dma_enet_rx_ctrl);
+}
+
+uint8_t macpdm_state::dma_enet_tx_ctrl_r()
+{
+ return m_dma_enet_tx_ctrl;
+}
+
+void macpdm_state::dma_enet_tx_ctrl_w(uint8_t data)
+{
+ m_dma_enet_tx_ctrl = data;
+ logerror("dma_enet_tx_ctrl_w %02x\n", m_dma_enet_tx_ctrl);
+}
+
+
+
+void macpdm_state::pdm_map(address_map &map)
+{
+ map(0x40000000, 0x403fffff).rom().region("bootrom", 0).mirror(0x0fc00000);
+
+ map(0x50f00000, 0x50f00000).rw(FUNC(macpdm_state::via1_r), FUNC(macpdm_state::via1_w)).select(0x1e00);
+ map(0x50f04000, 0x50f04000).rw(FUNC(macpdm_state::scc_r), FUNC(macpdm_state::scc_w)).select(0x000e);
+ // 50f08000 = ethernet ID PROM
+ // 50f0a000 = MACE ethernet controller
+ map(0x50f10000, 0x50f10000).rw(FUNC(macpdm_state::scsi_r), FUNC(macpdm_state::scsi_w)).select(0xf0);
+ // 50f14000 = sound registers (AWACS)
+ map(0x50f14000, 0x50f1401f).rw(m_awacs, FUNC(awacs_device::read), FUNC(awacs_device::write));
+ map(0x50f16000, 0x50f16000).rw(FUNC(macpdm_state::fdc_r), FUNC(macpdm_state::fdc_w)).select(0x1e00);
+ map(0x50f24000, 0x50f24003).w(m_video, FUNC(mac_video_sonora_device::dac_w));
+ map(0x50f26000, 0x50f2601f).rw(FUNC(macpdm_state::via2_r), FUNC(macpdm_state::via2_w));
+ map(0x50f28000, 0x50f28007).rw(m_video, FUNC(mac_video_sonora_device::vctrl_r), FUNC(mac_video_sonora_device::vctrl_w));
+
+ map(0x50f2a000, 0x50f2a000).rw(FUNC(macpdm_state::irq_control_r), FUNC(macpdm_state::irq_control_w));
+
+ map(0x50f2c000, 0x50f2dfff).r(FUNC(macpdm_state::diag_r));
+
+ map(0x50f31000, 0x50f31003).rw(FUNC(macpdm_state::dma_badr_r), FUNC(macpdm_state::dma_badr_w));
+ map(0x50f31c20, 0x50f31c20).rw(FUNC(macpdm_state::dma_enet_tx_ctrl_r), FUNC(macpdm_state::dma_enet_tx_ctrl_w));
+ map(0x50f32008, 0x50f32008).rw(FUNC(macpdm_state::dma_scsi_ctrl_r), FUNC(macpdm_state::dma_scsi_ctrl_w));
+ map(0x50f32028, 0x50f32028).rw(FUNC(macpdm_state::dma_enet_rx_ctrl_r), FUNC(macpdm_state::dma_enet_rx_ctrl_w));
+ map(0x50f32060, 0x50f32063).rw(FUNC(macpdm_state::dma_floppy_adr_r), FUNC(macpdm_state::dma_floppy_adr_w));
+ map(0x50f32068, 0x50f32068).rw(FUNC(macpdm_state::dma_floppy_ctrl_r), FUNC(macpdm_state::dma_floppy_ctrl_w));
+ map(0x50f32088, 0x50f32088).rw(FUNC(macpdm_state::dma_scc_txa_ctrl_r), FUNC(macpdm_state::dma_scc_txa_ctrl_w));
+ map(0x50f32098, 0x50f32098).rw(FUNC(macpdm_state::dma_scc_rxa_ctrl_r), FUNC(macpdm_state::dma_scc_rxa_ctrl_w));
+ map(0x50f320a8, 0x50f320a8).rw(FUNC(macpdm_state::dma_scc_txb_ctrl_r), FUNC(macpdm_state::dma_scc_txb_ctrl_w));
+ map(0x50f320b8, 0x50f320b8).rw(FUNC(macpdm_state::dma_scc_rxb_ctrl_r), FUNC(macpdm_state::dma_scc_rxb_ctrl_w));
+
+ map(0x50f32100, 0x50f32101).rw(FUNC(macpdm_state::dma_berr_en_r), FUNC(macpdm_state::dma_berr_en_w));
+ map(0x50f32102, 0x50f32103).rw(FUNC(macpdm_state::dma_berr_flag_r), FUNC(macpdm_state::dma_berr_flag_w));
+
+ map(0x50f40000, 0x50f4000f).rw(FUNC(macpdm_state::hmc_r), FUNC(macpdm_state::hmc_w));
+ map(0x5ffffff8, 0x5fffffff).r(FUNC(macpdm_state::id_r));
+
+ map(0xffc00000, 0xffffffff).rom().region("bootrom", 0);
+}
+
+void macpdm_state::macpdm(machine_config &config)
+{
+ PPC601(config, m_maincpu, 60000000);
+ m_maincpu->set_addrmap(AS_PROGRAM, &macpdm_state::pdm_map);
+
+ MAC_VIDEO_SONORA(config, m_video);
+
+ SPEAKER(config, "lspeaker").front_left();
+ SPEAKER(config, "rspeaker").front_right();
+ AWACS(config, m_awacs, 44100);
+ m_awacs->add_route(0, "lspeaker", 1.0);
+ m_awacs->add_route(1, "rspeaker", 1.0);
+
+ 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, ENET_CLOCK/2);
+ m_ncr5380->set_scsi_port("scsi");
+
+ SOFTWARE_LIST(config, "hdd_list").set_original("mac_hdd");
+
+ SWIM3(config, m_fdc, IO_CLOCK/2);
+ m_fdc->hdsel_cb().set(FUNC(macpdm_state::hdsel_w));
+ m_fdc->devsel_cb().set(FUNC(macpdm_state::devsel_w));
+ m_fdc->phases_cb().set(FUNC(macpdm_state::phases_w));
+ m_fdc->sel35_cb().set(FUNC(macpdm_state::sel35_w));
+ applefdintf_device::add_35_hd(config, m_floppy[0]);
+ applefdintf_device::add_35_nc(config, m_floppy[1]);
+
+ // pclk is maincpu:60MHz/4, RTxCA is IO_CLOCK*2/17 or GPI input, RTxCB is IO_CLOCK*2/17
+ SCC8530(config, m_scc, 60000000/4);
+ m_scc->intrq_callback().set(FUNC(macpdm_state::scc_irq));
+
+ R65NC22(config, m_via1, IO_CLOCK/2);
+ m_via1->readpa_handler().set(FUNC(macpdm_state::via1_in_a));
+ m_via1->readpb_handler().set(FUNC(macpdm_state::via1_in_b));
+ m_via1->writepa_handler().set(FUNC(macpdm_state::via1_out_a));
+ m_via1->writepb_handler().set(FUNC(macpdm_state::via1_out_b));
+ m_via1->cb2_handler().set(FUNC(macpdm_state::via1_out_cb2));
+ m_via1->irq_handler().set(FUNC(macpdm_state::via1_irq));
+
+ RAM(config, m_ram);
+ m_ram->set_default_size("8M");
+ m_ram->set_extra_options("16M,32M,64M,128M");
+
+ MACADB(config, m_macadb, IO_CLOCK/2);
+ CUDA(config, m_cuda, CUDA_341S0060);
+ m_cuda->reset_callback().set(FUNC(macpdm_state::cuda_reset_w));
+ m_cuda->linechange_callback().set(m_macadb, FUNC(macadb_device::adb_linechange_w));
+ m_cuda->via_clock_callback().set(m_via1, FUNC(via6522_device::write_cb1));
+ m_cuda->via_data_callback().set(m_via1, FUNC(via6522_device::write_cb2));
+ m_macadb->set_mcu_mode(true);
+ m_macadb->adb_data_callback().set(m_cuda, FUNC(cuda_device::set_adb_line));
+ config.set_perfect_quantum(m_maincpu);
+}
+
+static INPUT_PORTS_START( macpdm )
+INPUT_PORTS_END
+
+ROM_START( pmac6100 )
+ ROM_REGION64_BE(0x400000, "bootrom", 0)
+ ROM_LOAD( "9feb69b3.rom", 0x000000, 0x400000, CRC(a43fadbc) SHA1(6fac1c4e920a077c077b03902fef9199d5e8f2c3) )
+ROM_END
+
+
+COMP( 1994, pmac6100, 0, 0, macpdm, macpdm, macpdm_state, driver_init, "Apple Computer", "Power Macintosh 6100/60", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND )
diff --git a/src/mame/includes/mac.h b/src/mame/includes/mac.h
index 4a025ce30d1..cddb4f2aef9 100644
--- a/src/mame/includes/mac.h
+++ b/src/mame/includes/mac.h
@@ -406,8 +406,6 @@ private:
void sel35_w(int sel35);
void devsel_w(uint8_t devsel);
void hdsel_w(int hdsel);
- void devsel_s3_w(uint8_t devsel);
- void hdsel_s3_w(int hdsel);
DECLARE_VIDEO_START(mac);
DECLARE_VIDEO_START(macsonora);
diff --git a/src/mame/machine/mac.cpp b/src/mame/machine/mac.cpp
index 912c187350b..bcff8488343 100644
--- a/src/mame/machine/mac.cpp
+++ b/src/mame/machine/mac.cpp
@@ -820,6 +820,7 @@ uint8_t mac_state::mac_via_in_b()
}
else if (ADB_IS_CUDA)
{
+ logerror("%s cuda treq %d\n", machine().time().to_string(), m_cuda->get_treq());
val |= m_cuda->get_treq()<<3;
}
@@ -1241,15 +1242,6 @@ uint32_t mac_state::mac_read_id()
case MODEL_MAC_LC_575:
return 0xa55a222e;
- case MODEL_MAC_POWERMAC_6100:
- return 0xa55a3011;
-
- case MODEL_MAC_POWERMAC_7100:
- return 0xa55a3012;
-
- case MODEL_MAC_POWERMAC_8100:
- return 0xa55a3013;
-
case MODEL_MAC_PBDUO_210:
return 0xa55a1004;
@@ -1279,6 +1271,8 @@ uint32_t mac_state::mac_read_id()
}
}
+#include "cpu/powerpc/ppc.h"
+
void mac_state::mac_driver_init(model_t model)
{
m_overlay = 1;
@@ -2465,13 +2459,6 @@ void mac_state::hdsel_w(int)
{
}
-void mac_state::devsel_s3_w(u8)
-{
-}
-
-void mac_state::hdsel_s3_w(int)
-{
-}
#else
void mac_state::phases_w(uint8_t phases)
@@ -2502,21 +2489,4 @@ void mac_state::hdsel_w(int hdsel)
{
}
-void mac_state::devsel_s3_w(uint8_t devsel)
-{
- 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;
- m_fdc->set_floppy(m_cur_floppy);
-}
-
-void mac_state::hdsel_s3_w(int hdsel)
-{
- if(m_cur_floppy)
- m_cur_floppy->ss_w(hdsel);
-}
-
#endif
diff --git a/src/mame/mame.lst b/src/mame/mame.lst
index d59f09e2d07..dce5c659b4b 100644
--- a/src/mame/mame.lst
+++ b/src/mame/mame.lst
@@ -20127,6 +20127,8 @@ maclc2 // 1991 Apple Macintosh LC II
maclc3 // 1993 Apple Macintosh LC III
maclc520 // 1993 Apple Macintosh LC 520
macse30 // 1989 Apple Macintosh SE/30
+
+@source:macpdm.cpp
pmac6100 // 1993 Apple Power Macintosh 6100
@source:macquadra700.cpp