summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author arbee <rb6502@users.noreply.github.com>2020-10-01 19:29:56 -0400
committer arbee <rb6502@users.noreply.github.com>2020-10-01 19:29:56 -0400
commit3ee3906d103e650eb92357a347b6fb40d577f11b (patch)
treee5cc8b6ce9bc9ddebf5d77db38c747f92f643bd6
parentfc1a37551039de5dfbac3f5436cae10105840024 (diff)
mac: move macqd700 to its own driver and clean up more cruft [R. Belmont]
-rw-r--r--scripts/target/mame/mess.lua1
-rw-r--r--src/mame/drivers/mac.cpp79
-rw-r--r--src/mame/drivers/macquadra700.cpp936
-rw-r--r--src/mame/includes/mac.h15
-rw-r--r--src/mame/machine/mac.cpp20
-rw-r--r--src/mame/mame.lst4
-rw-r--r--src/mame/video/mac.cpp309
7 files changed, 940 insertions, 424 deletions
diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua
index 97875978d48..dc3013584ff 100644
--- a/scripts/target/mame/mess.lua
+++ b/scripts/target/mame/mess.lua
@@ -1749,6 +1749,7 @@ files {
MAME_DIR .. "src/mame/machine/lisa.cpp",
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/mac.cpp",
MAME_DIR .. "src/mame/includes/mac.h",
MAME_DIR .. "src/mame/machine/egret.cpp",
diff --git a/src/mame/drivers/mac.cpp b/src/mame/drivers/mac.cpp
index af3922aedac..925d4cb9bce 100644
--- a/src/mame/drivers/mac.cpp
+++ b/src/mame/drivers/mac.cpp
@@ -779,26 +779,6 @@ void mac_state::macpd210_map(address_map &map)
map(0x60000000, 0x6001ffff).ram().share("vram").mirror(0x0ffe0000);
}
-void mac_state::quadra700_map(address_map &map)
-{
- map(0x40000000, 0x400fffff).r(FUNC(mac_state::rom_switch_r)).mirror(0x0ff00000);
-
- map(0x50000000, 0x50001fff).rw(FUNC(mac_state::mac_via_r), FUNC(mac_state::mac_via_w)).mirror(0x00fc0000);
- map(0x50002000, 0x50003fff).rw(FUNC(mac_state::mac_via2_r), FUNC(mac_state::mac_via2_w)).mirror(0x00fc0000);
-// 50008000 = Ethernet MAC ID PROM
-// 5000a000 = Sonic (DP83932) ethernet
-// 5000f000 = SCSI cf96, 5000f402 = SCSI #2 cf96
- map(0x5000f000, 0x5000f3ff).rw(FUNC(mac_state::mac_5396_r), FUNC(mac_state::mac_5396_w)).mirror(0x00fc0000);
- map(0x5000c000, 0x5000dfff).rw(FUNC(mac_state::mac_scc_r), FUNC(mac_state::mac_scc_2_w)).mirror(0x00fc0000);
- map(0x50014000, 0x50015fff).rw(m_asc, FUNC(asc_device::read), FUNC(asc_device::write)).mirror(0x00fc0000);
- map(0x5001e000, 0x5001ffff).rw(FUNC(mac_state::mac_iwm_r), FUNC(mac_state::mac_iwm_w)).mirror(0x00fc0000);
-
- // f9800000 = VDAC / DAFB
- map(0xf9000000, 0xf91fffff).ram().share("vram");
- map(0xf9800000, 0xf98001ff).rw(FUNC(mac_state::dafb_r), FUNC(mac_state::dafb_w));
- map(0xf9800200, 0xf980023f).rw(FUNC(mac_state::dafb_dac_r), FUNC(mac_state::dafb_dac_w));
-}
-
void mac_state::pwrmac_map(address_map &map)
{
map(0x00000000, 0x007fffff).ram(); // 8 MB standard
@@ -1537,59 +1517,6 @@ void mac_state::pwrmac(machine_config &config)
add_cuda(config, CUDA_341S0060);
}
-void mac_state::macqd700(machine_config &config)
-{
- /* basic machine hardware */
- M68040(config, m_maincpu, 25000000);
- m_maincpu->set_addrmap(AS_PROGRAM, &mac_state::quadra700_map);
- m_maincpu->set_dasm_override(FUNC(mac_state::mac_dasm_override));
-
- SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
- m_screen->set_refresh_hz(75.08);
- m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(1260));
- m_screen->set_size(1152, 870);
- m_screen->set_visarea(0, 1152-1, 0, 870-1);
- m_screen->set_screen_update(FUNC(mac_state::screen_update_macdafb));
-
- MCFG_VIDEO_START_OVERRIDE(mac_state,macdafb)
- MCFG_VIDEO_RESET_OVERRIDE(mac_state,macdafb)
-
- PALETTE(config, m_palette).set_entries(256);
-
- add_asc(config, asc_device::asc_type::EASC);
- add_base_devices(config, true, false);
-
- add_nubus(config, false, false);
- NUBUS_SLOT(config, "nbd", "nubus", mac_nubus_cards, nullptr);
- NUBUS_SLOT(config, "nbe", "nubus", mac_nubus_cards, nullptr);
-
- add_via1_adb(config, false);
- m_via1->readpb_handler().set(FUNC(mac_state::mac_via_in_b));
-
- add_via2(config);
-
- MACADB(config, m_macadb, C15M);
- m_macadb->via_clock_callback().set(m_via1, FUNC(via6522_device::write_cb1));
- m_macadb->via_data_callback().set(m_via1, FUNC(via6522_device::write_cb2));
- m_macadb->adb_irq_callback().set(FUNC(mac_state::adb_irq_w));
-
- 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));
-
- NCR539X(config, m_539x_1, C7M);
- m_539x_1->set_scsi_port("scsi");
- m_539x_1->irq_callback().set(FUNC(mac_state::irq_539x_1_w));
- m_539x_1->drq_callback().set(FUNC(mac_state::drq_539x_1_w));
-
- /* internal ram */
- RAM(config, m_ram);
- m_ram->set_default_size("4M");
- m_ram->set_extra_options("8M,16M,32M,64M,68M,72M,80M,96M,128M");
-
- SOFTWARE_LIST(config, "flop35_list").set_original("mac_flop");
-}
-
static INPUT_PORTS_START( macadb )
INPUT_PORTS_END
@@ -1759,11 +1686,6 @@ ROM_START( macpb170 )
ROM_LOAD( "pmuv2.bin", 0x000000, 0x001800, CRC(1a32b5e5) SHA1(7c096324763cfc8d2024893b3e8493b7729b3a92) )
ROM_END
-ROM_START( macqd700 )
- ROM_REGION32_BE(0x100000, "bootrom", 0)
- ROM_LOAD( "420dbff3.rom", 0x000000, 0x100000, CRC(88ea2081) SHA1(7a8ee468d16e64f2ad10cb8d1a45e6f07cc9e212) )
-ROM_END
-
ROM_START( macpb160 )
ROM_REGION32_BE(0x100000, "bootrom", 0)
ROM_LOAD( "e33b2724.rom", 0x000000, 0x100000, CRC(536c60f4) SHA1(c0510682ae6d973652d7e17f3c3b27629c47afac) )
@@ -1821,7 +1743,6 @@ COMP( 1990, maciisi, 0, 0, maciisi, maciici, mac_state, init_maci
COMP( 1991, macpb100, 0, 0, macprtb, macadb, mac_state, init_macprtb, "Apple Computer", "Macintosh PowerBook 100", MACHINE_NOT_WORKING )
COMP( 1991, macpb140, 0, 0, macpb140, macadb, mac_state, init_macpb140, "Apple Computer", "Macintosh PowerBook 140", MACHINE_NOT_WORKING )
COMP( 1991, macpb170, macpb140, 0, macpb170, macadb, mac_state, init_macpb140, "Apple Computer", "Macintosh PowerBook 170", MACHINE_NOT_WORKING )
-COMP( 1991, macqd700, macpb140, 0, macqd700, macadb, mac_state, init_macquadra700, "Apple Computer", "Macintosh Quadra 700", MACHINE_NOT_WORKING )
COMP( 1991, macclas2, 0, 0, macclas2, macadb, mac_state, init_macclassic2, "Apple Computer", "Macintosh Classic II", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_SOUND )
COMP( 1991, maclc2, 0, 0, maclc2, maciici, mac_state, init_maclc2, "Apple Computer", "Macintosh LC II", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_SOUND )
COMP( 1992, macpb145, macpb140, 0, macpb145, macadb, mac_state, init_macpb140, "Apple Computer", "Macintosh PowerBook 145", MACHINE_NOT_WORKING )
diff --git a/src/mame/drivers/macquadra700.cpp b/src/mame/drivers/macquadra700.cpp
new file mode 100644
index 00000000000..72a96568aed
--- /dev/null
+++ b/src/mame/drivers/macquadra700.cpp
@@ -0,0 +1,936 @@
+// license:BSD-3-Clause
+// copyright-holders:R. Belmont
+/****************************************************************************
+
+ drivers/macquadra700.cpp
+ Mac Quadra 700 emulation. (900/950 are IOP-based and closer to the IIfx)
+
+ By R. Belmont
+
+****************************************************************************/
+
+#include "emu.h"
+
+#include "machine/macrtc.h"
+#include "cpu/m68000/m68000.h"
+#include "machine/6522via.h"
+#include "machine/applefdc.h"
+#include "machine/ram.h"
+#include "machine/sonydriv.h"
+#include "machine/swim.h"
+#include "machine/timer.h"
+#include "machine/z80scc.h"
+#include "machine/macadb.h"
+#include "machine/dp83932c.h"
+#include "sound/asc.h"
+#include "formats/ap_dsk35.h"
+
+#include "bus/nubus/nubus.h"
+#include "bus/nubus/nubus_48gc.h"
+#include "bus/nubus/nubus_cb264.h"
+#include "bus/nubus/nubus_vikbw.h"
+#include "bus/nubus/nubus_specpdq.h"
+#include "bus/nubus/nubus_m2hires.h"
+#include "bus/nubus/nubus_spec8.h"
+#include "bus/nubus/nubus_radiustpd.h"
+#include "bus/nubus/nubus_wsportrait.h"
+#include "bus/nubus/nubus_asntmc3b.h"
+#include "bus/nubus/nubus_image.h"
+#include "bus/nubus/nubus_m2video.h"
+#include "bus/nubus/bootbug.h"
+#include "bus/nubus/quadralink.h"
+#include "bus/nubus/laserview.h"
+
+#include "emupal.h"
+#include "screen.h"
+#include "softlist.h"
+#include "speaker.h"
+
+#define C7M (7833600)
+#define C15M (C7M*2)
+#define C32M (C15M*2)
+
+class macquadra_state : public driver_device
+{
+public:
+ macquadra_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
+ m_maincpu(*this, "maincpu"),
+ m_via1(*this, "via1"),
+ m_via2(*this, "via2"),
+ m_macadb(*this, "macadb"),
+ m_ram(*this, RAM_TAG),
+ m_iwm(*this, "fdc"),
+ m_rtc(*this,"rtc"),
+ m_sonic(*this, "sonic"),
+ m_screen(*this, "screen"),
+ m_palette(*this, "palette"),
+ m_easc(*this, "easc"),
+ m_scc(*this, "scc"),
+ m_vram(*this, "vram")
+ {
+ }
+
+ void macqd700(machine_config &config);
+ void quadra700_map(address_map &map);
+
+ void init_macqd700();
+
+private:
+ required_device<m68040_device> m_maincpu;
+ required_device<via6522_device> m_via1, m_via2;
+ optional_device<macadb_device> m_macadb;
+ required_device<ram_device> m_ram;
+ required_device<applefdc_base_device> m_iwm;
+ required_device<rtc3430042_device> m_rtc;
+ required_device<dp83932c_device> m_sonic;
+ required_device<screen_device> m_screen;
+ required_device<palette_device> m_palette;
+ required_device<asc_device> m_easc;
+ required_device<z80scc_device> m_scc;
+ required_shared_ptr<uint32_t> m_vram;
+
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
+ uint32_t screen_update_dafb(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
+ uint32_t dafb_r(offs_t offset, uint32_t mem_mask = ~0);
+ void dafb_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
+ uint32_t dafb_dac_r(offs_t offset, uint32_t mem_mask = ~0);
+ void dafb_dac_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
+ void dafb_recalc_ints();
+
+ TIMER_CALLBACK_MEMBER(dafb_vbl_tick);
+ TIMER_CALLBACK_MEMBER(dafb_cursor_tick);
+ DECLARE_VIDEO_START(macdafb);
+ DECLARE_VIDEO_RESET(macdafb);
+
+ u32 *m_ram_ptr, *m_rom_ptr;
+ u32 m_ram_mask, m_ram_size, m_rom_size;
+
+ emu_timer *m_vbl_timer, *m_cursor_timer, *m_6015_timer;
+
+ uint16_t m_cursor_line;
+ uint16_t m_dafb_int_status;
+ int m_dafb_scsi1_drq, m_dafb_scsi2_drq;
+ uint8_t m_dafb_mode;
+ uint32_t m_dafb_base, m_dafb_stride;
+ uint32_t m_dafb_colors[3], m_dafb_count, m_dafb_clutoffs, m_dafb_montype, m_dafb_vbltime;
+ uint32_t m_dafb_palette[256];
+
+ DECLARE_WRITE_LINE_MEMBER(nubus_irq_9_w);
+ DECLARE_WRITE_LINE_MEMBER(nubus_irq_a_w);
+ DECLARE_WRITE_LINE_MEMBER(nubus_irq_b_w);
+ DECLARE_WRITE_LINE_MEMBER(nubus_irq_c_w);
+ DECLARE_WRITE_LINE_MEMBER(nubus_irq_d_w);
+ DECLARE_WRITE_LINE_MEMBER(nubus_irq_e_w);
+ void nubus_slot_interrupt(uint8_t slot, uint32_t state);
+ int m_via2_ca1_hack, m_nubus_irq_state;
+
+ WRITE_LINE_MEMBER(adb_irq_w) { m_adb_irq_pending = state; }
+ int m_adb_irq_pending;
+
+ DECLARE_WRITE_LINE_MEMBER(irq_539x_1_w);
+ DECLARE_WRITE_LINE_MEMBER(irq_539x_2_w);
+ DECLARE_WRITE_LINE_MEMBER(drq_539x_1_w);
+ DECLARE_WRITE_LINE_MEMBER(drq_539x_2_w);
+
+ uint16_t mac_via_r(offs_t offset);
+ void mac_via_w(offs_t offset, uint16_t data, uint16_t mem_mask);
+ uint16_t mac_via2_r(offs_t offset);
+ void mac_via2_w(offs_t offset, uint16_t data, uint16_t mem_mask);
+ uint8_t mac_via_in_a();
+ uint8_t mac_via_in_b();
+ void mac_via_out_a(uint8_t data);
+ void mac_via_out_b(uint8_t data);
+ uint8_t mac_via2_in_a();
+ uint8_t mac_via2_in_b();
+ void mac_via2_out_a(uint8_t data);
+ void mac_via2_out_b(uint8_t data);
+ void field_interrupts();
+ DECLARE_WRITE_LINE_MEMBER(mac_via_irq);
+ DECLARE_WRITE_LINE_MEMBER(mac_via2_irq);
+ TIMER_CALLBACK_MEMBER(mac_6015_tick);
+ WRITE_LINE_MEMBER(via_cb2_w) { m_macadb->adb_data_w(state); }
+ int m_via_cycles, m_via_interrupt, m_via2_interrupt, m_scc_interrupt, m_last_taken_interrupt;
+ int m_irq_count, m_ca1_data, m_ca2_data;
+
+ uint32_t rom_switch_r(offs_t offset);
+ bool m_overlay;
+
+ uint16_t mac_scc_r(offs_t offset)
+ {
+ uint16_t result = m_scc->dc_ab_r(offset);
+ return (result << 8) | result;
+ }
+ void mac_scc_2_w(offs_t offset, uint16_t data) { m_scc->dc_ab_w(offset, data >> 8); }
+
+ uint16_t mac_iwm_r(offs_t offset, uint16_t mem_mask)
+ {
+ uint16_t result = m_iwm->read(offset >> 8);
+ return (result << 8) | result;
+ }
+ void mac_iwm_w(offs_t offset, uint16_t data, uint16_t mem_mask)
+ {
+ if (ACCESSING_BITS_0_7)
+ m_iwm->write((offset >> 8), data & 0xff);
+ else
+ m_iwm->write((offset >> 8), data>>8);
+ }
+};
+
+void macquadra_state::field_interrupts()
+{
+ int take_interrupt = -1;
+
+ if (m_scc_interrupt)
+ {
+ take_interrupt = 4;
+ }
+ else if (m_via2_interrupt)
+ {
+ take_interrupt = 2;
+ }
+ else if (m_via_interrupt)
+ {
+ take_interrupt = 1;
+ }
+
+ if (m_last_taken_interrupt > -1)
+ {
+ m_maincpu->set_input_line(m_last_taken_interrupt, CLEAR_LINE);
+ m_last_taken_interrupt = -1;
+ }
+
+ if (take_interrupt > -1)
+ {
+ m_maincpu->set_input_line(take_interrupt, ASSERT_LINE);
+ m_last_taken_interrupt = take_interrupt;
+ }
+}
+
+void macquadra_state::machine_start()
+{
+ m_ram_ptr = (u32*)m_ram->pointer();
+ m_ram_size = m_ram->size()>>1;
+ m_ram_mask = m_ram_size - 1;
+ m_rom_ptr = (u32*)memregion("bootrom")->base();
+ m_rom_size = memregion("bootrom")->bytes();
+ m_via_cycles = -50;
+ m_via_interrupt = m_via2_interrupt = m_scc_interrupt = 0;
+ m_last_taken_interrupt = -1;
+ m_irq_count = m_ca1_data = m_ca2_data = 0;
+
+ m_6015_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(macquadra_state::mac_6015_tick),this));
+ m_6015_timer->adjust(attotime::never);
+}
+
+void macquadra_state::machine_reset()
+{
+ m_nubus_irq_state = 0xff;
+ m_via2_ca1_hack = 1;
+ m_via2->write_ca1(1);
+ m_via2->write_cb1(1);
+ m_overlay = true;
+ m_via_interrupt = m_via2_interrupt = m_scc_interrupt = 0;
+ m_last_taken_interrupt = -1;
+ m_irq_count = m_ca1_data = m_ca2_data = 0;
+
+ // put ROM mirror at 0
+ address_space& space = m_maincpu->space(AS_PROGRAM);
+ const u32 memory_size = std::min((u32)0x3fffff, m_rom_size);
+ const u32 memory_end = memory_size - 1;
+ offs_t memory_mirror = memory_end & ~(memory_size - 1);
+
+ space.unmap_write(0x00000000, memory_end);
+ space.install_read_bank(0x00000000, memory_end & ~memory_mirror, memory_mirror, "bank1");
+ membank("bank1")->set_base(m_rom_ptr);
+
+ // start 60.15 Hz timer
+ m_6015_timer->adjust(attotime::from_hz(60.15), 0, attotime::from_hz(60.15));
+}
+
+void macquadra_state::init_macqd700()
+{
+}
+
+void macquadra_state::nubus_slot_interrupt(uint8_t slot, uint32_t state)
+{
+ static const uint8_t masks[8] = { 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80 };
+ uint8_t mask = 0xff;
+
+ slot -= 9;
+
+ if (state)
+ {
+ m_nubus_irq_state &= ~masks[slot];
+ }
+ else
+ {
+ m_nubus_irq_state |= masks[slot];
+ }
+
+ if ((m_nubus_irq_state & mask) != mask)
+ {
+ // HACK: sometimes we miss an ack (possible misbehavior in the VIA?)
+ if (m_via2_ca1_hack == 0)
+ {
+ m_via2->write_ca1(1);
+ }
+ m_via2_ca1_hack = 0;
+ m_via2->write_ca1(0);
+ }
+ else
+ {
+ m_via2_ca1_hack = 1;
+ m_via2->write_ca1(1);
+ }
+}
+
+WRITE_LINE_MEMBER(macquadra_state::nubus_irq_9_w) { nubus_slot_interrupt(9, state); }
+WRITE_LINE_MEMBER(macquadra_state::nubus_irq_a_w) { nubus_slot_interrupt(0xa, state); }
+WRITE_LINE_MEMBER(macquadra_state::nubus_irq_b_w) { nubus_slot_interrupt(0xb, state); }
+WRITE_LINE_MEMBER(macquadra_state::nubus_irq_c_w) { nubus_slot_interrupt(0xc, state); }
+WRITE_LINE_MEMBER(macquadra_state::nubus_irq_d_w) { nubus_slot_interrupt(0xd, state); }
+WRITE_LINE_MEMBER(macquadra_state::nubus_irq_e_w) { nubus_slot_interrupt(0xe, state); }
+
+// DAFB: video for Quadra 700/900
+
+void macquadra_state::dafb_recalc_ints()
+{
+ if (m_dafb_int_status != 0)
+ {
+ nubus_slot_interrupt(0xf, ASSERT_LINE);
+ }
+ else
+ {
+ nubus_slot_interrupt(0xf, CLEAR_LINE);
+ }
+}
+
+TIMER_CALLBACK_MEMBER(macquadra_state::dafb_vbl_tick)
+{
+ m_dafb_int_status |= 1;
+ dafb_recalc_ints();
+
+ m_vbl_timer->adjust(m_screen->time_until_pos(480, 0), 0);
+}
+
+TIMER_CALLBACK_MEMBER(macquadra_state::dafb_cursor_tick)
+{
+ m_dafb_int_status |= 4;
+ dafb_recalc_ints();
+
+ m_cursor_timer->adjust(m_screen->time_until_pos(m_cursor_line, 0), 0);
+}
+
+VIDEO_START_MEMBER(macquadra_state,macdafb)
+{
+ m_vbl_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(macquadra_state::dafb_vbl_tick),this));
+ m_cursor_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(macquadra_state::dafb_cursor_tick),this));
+
+ m_vbl_timer->adjust(attotime::never);
+ m_cursor_timer->adjust(attotime::never);
+}
+
+VIDEO_RESET_MEMBER(macquadra_state,macdafb)
+{
+ m_dafb_count = 0;
+ m_dafb_clutoffs = 0;
+ m_dafb_montype = 6;
+ m_dafb_vbltime = 0;
+ m_dafb_int_status = 0;
+ m_dafb_mode = 0;
+ m_dafb_base = 0x1000;
+ m_dafb_stride = 256*4;
+
+ memset(m_dafb_palette, 0, sizeof(m_dafb_palette));
+}
+
+uint32_t macquadra_state::dafb_r(offs_t offset, uint32_t mem_mask)
+{
+// if (offset != 0x108/4) printf("DAFB: Read @ %x (mask %x PC=%x)\n", offset*4, mem_mask, m_maincpu->pc());
+
+ switch (offset<<2)
+ {
+ case 0x1c: // inverse of monitor sense
+ return 7; // 21" color 2-page
+
+ case 0x24: // SCSI 539x #1 status
+ return m_dafb_scsi1_drq<<9;
+
+ case 0x28: // SCSI 539x #2 status
+ return m_dafb_scsi2_drq<<9;
+
+ case 0x108: // IRQ/VBL status
+ return m_dafb_int_status;
+
+ case 0x10c: // clear cursor scanline int
+ m_dafb_int_status &= ~4;
+ dafb_recalc_ints();
+ break;
+
+ case 0x114: // clear VBL int
+ m_dafb_int_status &= ~1;
+ dafb_recalc_ints();
+ break;
+ }
+ return 0;
+}
+
+void macquadra_state::dafb_w(offs_t offset, uint32_t data, uint32_t mem_mask)
+{
+// if (offset != 0x10c/4) printf("DAFB: Write %08x @ %x (mask %x PC=%x)\n", data, offset*4, mem_mask, m_maincpu->pc());
+
+ switch (offset<<2)
+ {
+ case 0: // bits 20-9 of base
+ m_dafb_base &= 0x1ff;
+ m_dafb_base |= (data & 0xffff) << 9;
+// printf("DAFB baseH: %x\n", m_dafb_base);
+ break;
+
+ case 4: // bits 8-5 of base
+ m_dafb_base &= ~0x1ff;
+ m_dafb_base |= (data & 0xf) << 5;
+// printf("DAFB baseL: %x\n", m_dafb_base);
+ break;
+
+ case 8:
+ m_dafb_stride = data<<2; // stride in DWORDs
+// printf("DAFB stride: %x %x\n", m_dafb_stride, data);
+ break;
+
+ case 0x104:
+ if (data & 1) // VBL enable
+ {
+ m_vbl_timer->adjust(m_screen->time_until_pos(480, 0), 0);
+ }
+ else
+ {
+ m_vbl_timer->adjust(attotime::never);
+ m_dafb_int_status &= ~1;
+ dafb_recalc_ints();
+ }
+
+ if (data & 2) // aux scanline interrupt enable
+ {
+ fatalerror("DAFB: Aux scanline interrupt enable not supported!\n");
+ }
+
+ if (data & 4) // cursor scanline interrupt enable
+ {
+ m_cursor_timer->adjust(m_screen->time_until_pos(m_cursor_line, 0), 0);
+ }
+ else
+ {
+ m_cursor_timer->adjust(attotime::never);
+ m_dafb_int_status &= ~4;
+ dafb_recalc_ints();
+ }
+ break;
+
+ case 0x10c: // clear cursor scanline int
+ m_dafb_int_status &= ~4;
+ dafb_recalc_ints();
+ break;
+
+ case 0x114: // clear VBL int
+ m_dafb_int_status &= ~1;
+ dafb_recalc_ints();
+ break;
+ }
+}
+
+uint32_t macquadra_state::dafb_dac_r(offs_t offset, uint32_t mem_mask)
+{
+// printf("DAFB: Read DAC @ %x (mask %x PC=%x)\n", offset*4, mem_mask, m_maincpu->pc());
+ return 0;
+}
+
+void macquadra_state::dafb_dac_w(offs_t offset, uint32_t data, uint32_t mem_mask)
+{
+// if ((offset > 0) && (offset != 0x10/4)) printf("DAFB: Write %08x to DAC @ %x (mask %x PC=%x)\n", data, offset*4, mem_mask, m_maincpu->pc());
+
+ switch (offset<<2)
+ {
+ case 0:
+ m_dafb_clutoffs = data & 0xff;
+ m_dafb_count = 0;
+ break;
+
+ case 0x10:
+ m_dafb_colors[m_dafb_count++] = data&0xff;
+
+ if (m_dafb_count == 3)
+ {
+ m_palette->set_pen_color(m_dafb_clutoffs, rgb_t(m_dafb_colors[0], m_dafb_colors[1], m_dafb_colors[2]));
+ m_dafb_palette[m_dafb_clutoffs] = rgb_t(m_dafb_colors[0], m_dafb_colors[1], m_dafb_colors[2]);
+ m_dafb_clutoffs++;
+ m_dafb_count = 0;
+ }
+ break;
+
+ case 0x20:
+ printf("%x to DAFB mode\n", data);
+ switch (data & 0x9f)
+ {
+ case 0x80:
+ m_dafb_mode = 0; // 1bpp
+ break;
+
+ case 0x88:
+ m_dafb_mode = 1; // 2bpp
+ break;
+
+ case 0x90:
+ m_dafb_mode = 2; // 4bpp
+ break;
+
+ case 0x98:
+ m_dafb_mode = 3; // 8bpp
+ break;
+
+ case 0x9c:
+ m_dafb_mode = 4; // 24bpp
+ break;
+ }
+ break;
+ }
+}
+
+uint32_t macquadra_state::screen_update_dafb(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
+{
+ switch (m_dafb_mode)
+ {
+ case 0: // 1bpp
+ {
+ uint8_t const *vram8 = (uint8_t *)m_vram.target();
+ vram8 += m_dafb_base;
+
+ for (int y = 0; y < 870; y++)
+ {
+ uint32_t *scanline = &bitmap.pix(y);
+ for (int x = 0; x < 1152; x+=8)
+ {
+ uint8_t const pixels = vram8[(y * m_dafb_stride) + ((x/8)^3)];
+
+ *scanline++ = m_dafb_palette[(pixels>>7)&1];
+ *scanline++ = m_dafb_palette[(pixels>>6)&1];
+ *scanline++ = m_dafb_palette[(pixels>>5)&1];
+ *scanline++ = m_dafb_palette[(pixels>>4)&1];
+ *scanline++ = m_dafb_palette[(pixels>>3)&1];
+ *scanline++ = m_dafb_palette[(pixels>>2)&1];
+ *scanline++ = m_dafb_palette[(pixels>>1)&1];
+ *scanline++ = m_dafb_palette[(pixels&1)];
+ }
+ }
+ }
+ break;
+
+ case 1: // 2bpp
+ {
+ uint8_t const *vram8 = (uint8_t *)m_vram.target();
+ vram8 += m_dafb_base;
+
+ for (int y = 0; y < 870; y++)
+ {
+ uint32_t *scanline = &bitmap.pix(y);
+ for (int x = 0; x < 1152/4; x++)
+ {
+ uint8_t const pixels = vram8[(y * m_dafb_stride) + (BYTE4_XOR_BE(x))];
+
+ *scanline++ = m_dafb_palette[((pixels>>6)&3)];
+ *scanline++ = m_dafb_palette[((pixels>>4)&3)];
+ *scanline++ = m_dafb_palette[((pixels>>2)&3)];
+ *scanline++ = m_dafb_palette[(pixels&3)];
+ }
+ }
+ }
+ break;
+
+ case 2: // 4bpp
+ {
+ uint8_t const *vram8 = (uint8_t *)m_vram.target();
+ vram8 += m_dafb_base;
+
+ for (int y = 0; y < 870; y++)
+ {
+ uint32_t *scanline = &bitmap.pix(y);
+ for (int x = 0; x < 1152/2; x++)
+ {
+ uint8_t const pixels = vram8[(y * m_dafb_stride) + (BYTE4_XOR_BE(x))];
+
+ *scanline++ = m_dafb_palette[(pixels>>4)];
+ *scanline++ = m_dafb_palette[(pixels&0xf)];
+ }
+ }
+ }
+ break;
+
+ case 3: // 8bpp
+ {
+ uint8_t const *vram8 = (uint8_t *)m_vram.target();
+ vram8 += m_dafb_base;
+
+ for (int y = 0; y < 870; y++)
+ {
+ uint32_t *scanline = &bitmap.pix(y);
+ for (int x = 0; x < 1152; x++)
+ {
+ uint8_t const pixels = vram8[(y * m_dafb_stride) + (BYTE4_XOR_BE(x))];
+ *scanline++ = m_dafb_palette[pixels];
+ }
+ }
+ }
+ break;
+
+ case 4: // 24 bpp
+ for (int y = 0; y < 480; y++)
+ {
+ uint32_t *scanline = &bitmap.pix(y);
+ uint32_t const *base = (uint32_t *)&m_vram[(y * (m_dafb_stride/4)) + (m_dafb_base/4)];
+ for (int x = 0; x < 640; x++)
+ {
+ *scanline++ = *base++;
+ }
+ }
+ break;
+ }
+
+ return 0;
+}
+
+WRITE_LINE_MEMBER(macquadra_state::drq_539x_1_w)
+{
+}
+
+WRITE_LINE_MEMBER(macquadra_state::drq_539x_2_w)
+{
+}
+
+WRITE_LINE_MEMBER(macquadra_state::irq_539x_1_w)
+{
+ if (state) // make sure a CB1 transition occurs
+ {
+ m_via2->write_cb2(0);
+ m_via2->write_cb2(1);
+ }
+}
+
+WRITE_LINE_MEMBER(macquadra_state::irq_539x_2_w)
+{
+}
+
+uint16_t macquadra_state::mac_via_r(offs_t offset)
+{
+ uint16_t data;
+
+ offset >>= 8;
+ offset &= 0x0f;
+
+ data = m_via1->read(offset);
+
+ m_maincpu->adjust_icount(m_via_cycles);
+
+ return (data & 0xff) | (data << 8);
+}
+
+void macquadra_state::mac_via_w(offs_t offset, uint16_t data, uint16_t mem_mask)
+{
+ offset >>= 8;
+ offset &= 0x0f;
+
+ if (ACCESSING_BITS_0_7)
+ m_via1->write(offset, data & 0xff);
+ if (ACCESSING_BITS_8_15)
+ m_via1->write(offset, (data >> 8) & 0xff);
+
+ m_maincpu->adjust_icount(m_via_cycles);
+}
+
+WRITE_LINE_MEMBER(macquadra_state::mac_via_irq)
+{
+ m_via_interrupt = state;
+ field_interrupts();
+}
+
+WRITE_LINE_MEMBER(macquadra_state::mac_via2_irq)
+{
+ m_via2_interrupt = state;
+ field_interrupts();
+}
+
+uint16_t macquadra_state::mac_via2_r(offs_t offset)
+{
+ int data;
+
+ offset >>= 8;
+ offset &= 0x0f;
+
+ data = m_via2->read(offset);
+ return (data & 0xff) | (data << 8);
+}
+
+void macquadra_state::mac_via2_w(offs_t offset, uint16_t data, uint16_t mem_mask)
+{
+ offset >>= 8;
+ offset &= 0x0f;
+
+ if (ACCESSING_BITS_0_7)
+ m_via2->write(offset, data & 0xff);
+ if (ACCESSING_BITS_8_15)
+ m_via2->write(offset, (data >> 8) & 0xff);
+}
+
+uint32_t macquadra_state::rom_switch_r(offs_t offset)
+{
+ // disable the overlay
+ if (m_overlay)
+ {
+ address_space& space = m_maincpu->space(AS_PROGRAM);
+ const u32 memory_end = m_ram->size() - 1;
+ void *memory_data = m_ram->pointer();
+ offs_t memory_mirror = memory_end & ~memory_end;
+
+ space.install_readwrite_bank(0x00000000, memory_end & ~memory_mirror, memory_mirror, "bank1");
+ membank("bank1")->set_base(memory_data);
+ m_overlay = false;
+ }
+
+ //printf("rom_switch_r: offset %08x ROM_size -1 = %08x, masked = %08x\n", offset, m_rom_size-1, offset & ((m_rom_size - 1)>>2));
+
+ return m_rom_ptr[offset & ((m_rom_size - 1)>>2)];
+}
+
+TIMER_CALLBACK_MEMBER(macquadra_state::mac_6015_tick)
+{
+ m_via1->write_ca1(0);
+ m_via1->write_ca1(1);
+
+ /* handle ADB keyboard/mouse */
+ m_macadb->adb_vblank();
+
+ /* signal VBlank on CA1 input on the VIA */
+ m_ca1_data ^= 1;
+ m_via1->write_ca1(m_ca1_data);
+
+ if (++m_irq_count == 60)
+ {
+ m_irq_count = 0;
+
+ m_ca2_data ^= 1;
+ /* signal 1 Hz irq on CA2 input on the VIA */
+ m_via1->write_ca2(m_ca2_data);
+ }
+}
+
+/***************************************************************************
+ ADDRESS MAPS
+***************************************************************************/
+void macquadra_state::quadra700_map(address_map &map)
+{
+ map(0x40000000, 0x400fffff).r(FUNC(macquadra_state::rom_switch_r)).mirror(0x0ff00000);
+
+ map(0x50000000, 0x50001fff).rw(FUNC(macquadra_state::mac_via_r), FUNC(macquadra_state::mac_via_w)).mirror(0x00fc0000);
+ map(0x50002000, 0x50003fff).rw(FUNC(macquadra_state::mac_via2_r), FUNC(macquadra_state::mac_via2_w)).mirror(0x00fc0000);
+// 50008000 = Ethernet MAC ID PROM
+// 5000a000 = Sonic (DP83932) ethernet
+// 5000f000 = SCSI cf96, 5000f402 = SCSI #2 cf96
+// map(0x5000f000, 0x5000f3ff).rw(FUNC(macquadra_state::mac_5396_r), FUNC(macquadra_state::mac_5396_w)).mirror(0x00fc0000);
+ map(0x5000c000, 0x5000dfff).rw(FUNC(macquadra_state::mac_scc_r), FUNC(macquadra_state::mac_scc_2_w)).mirror(0x00fc0000);
+ map(0x50014000, 0x50015fff).rw(m_easc, FUNC(asc_device::read), FUNC(asc_device::write)).mirror(0x00fc0000);
+ map(0x5001e000, 0x5001ffff).rw(FUNC(macquadra_state::mac_iwm_r), FUNC(macquadra_state::mac_iwm_w)).mirror(0x00fc0000);
+
+ // f9800000 = VDAC / DAFB
+ map(0xf9000000, 0xf91fffff).ram().share("vram");
+ map(0xf9800000, 0xf98001ff).rw(FUNC(macquadra_state::dafb_r), FUNC(macquadra_state::dafb_w));
+ map(0xf9800200, 0xf980023f).rw(FUNC(macquadra_state::dafb_dac_r), FUNC(macquadra_state::dafb_dac_w));
+}
+
+uint8_t macquadra_state::mac_via_in_a()
+{
+ return 0xc1;
+}
+
+uint8_t macquadra_state::mac_via_in_b()
+{
+ int val = m_macadb->get_adb_state()<<4;
+ val |= m_rtc->data_r();
+
+ if (!m_adb_irq_pending)
+ {
+ val |= 0x08;
+ }
+
+// printf("%s VIA1 IN_B = %02x\n", machine().describe_context().c_str(), val);
+
+ return val;
+}
+
+void macquadra_state::mac_via_out_a(uint8_t data)
+{
+// printf("%s VIA1 OUT A: %02x\n", machine().describe_context().c_str(), data);
+ sony_set_sel_line(m_iwm.target(), (data & 0x20) >> 5);
+}
+
+void macquadra_state::mac_via_out_b(uint8_t data)
+{
+// printf("%s VIA1 OUT B: %02x\n", machine().describe_context().c_str(), data);
+ m_macadb->mac_adb_newaction((data & 0x30) >> 4);
+
+ m_rtc->ce_w((data & 0x04)>>2);
+ m_rtc->data_w(data & 0x01);
+ m_rtc->clk_w((data >> 1) & 0x01);
+}
+
+uint8_t macquadra_state::mac_via2_in_a()
+{
+ return 0x80 | m_nubus_irq_state;
+}
+
+uint8_t macquadra_state::mac_via2_in_b()
+{
+ return 0xcf; // indicate no NuBus transaction error
+}
+
+void macquadra_state::mac_via2_out_a(uint8_t data)
+{
+}
+
+void macquadra_state::mac_via2_out_b(uint8_t data)
+{
+ // chain 60.15 Hz to VIA1
+ m_via1->write_ca1(data>>7);
+}
+
+/***************************************************************************
+ DEVICE CONFIG
+***************************************************************************/
+
+static const applefdc_interface mac_iwm_interface =
+{
+ sony_set_lines,
+ sony_set_enable_lines,
+
+ sony_read_data,
+ sony_write_data,
+ sony_read_status
+};
+
+static const floppy_interface mac_floppy_interface =
+{
+ FLOPPY_STANDARD_3_5_DSHD,
+ LEGACY_FLOPPY_OPTIONS_NAME(apple35_mac),
+ "floppy_3_5"
+};
+
+static INPUT_PORTS_START( macadb )
+INPUT_PORTS_END
+
+/***************************************************************************
+ MACHINE DRIVERS
+***************************************************************************/
+
+static void mac_nubus_cards(device_slot_interface &device)
+{
+ device.option_add("m2video", NUBUS_M2VIDEO); /* Apple Macintosh II Video Card */
+ device.option_add("48gc", NUBUS_48GC); /* Apple 4*8 Graphics Card */
+ device.option_add("824gc", NUBUS_824GC); /* Apple 8*24 Graphics Card */
+ device.option_add("cb264", NUBUS_CB264); /* RasterOps ColorBoard 264 */
+ device.option_add("vikbw", NUBUS_VIKBW); /* Moniterm Viking board */
+ device.option_add("image", NUBUS_IMAGE); /* Disk Image Pseudo-Card */
+ device.option_add("specpdq", NUBUS_SPECPDQ); /* SuperMac Spectrum PDQ */
+ device.option_add("m2hires", NUBUS_M2HIRES); /* Apple Macintosh II Hi-Resolution Card */
+ device.option_add("spec8s3", NUBUS_SPEC8S3); /* SuperMac Spectrum/8 Series III */
+// device.option_add("thundergx", NUBUS_THUNDERGX); /* Radius Thunder GX (not yet) */
+ device.option_add("radiustpd", NUBUS_RADIUSTPD); /* Radius Two Page Display */
+ device.option_add("asmc3nb", NUBUS_ASNTMC3NB); /* Asante MC3NB Ethernet card */
+ device.option_add("portrait", NUBUS_WSPORTRAIT); /* Apple Macintosh II Portrait video card */
+ device.option_add("enetnb", NUBUS_APPLEENET); /* Apple NuBus Ethernet */
+ device.option_add("bootbug", NUBUS_BOOTBUG); /* Brigent BootBug debugger card */
+ device.option_add("quadralink", NUBUS_QUADRALINK); /* AE Quadralink serial card */
+ device.option_add("laserview", NUBUS_LASERVIEW); /* Sigma Designs LaserView monochrome video card */
+}
+
+void macquadra_state::macqd700(machine_config &config)
+{
+ /* basic machine hardware */
+ M68040(config, m_maincpu, 25000000);
+ m_maincpu->set_addrmap(AS_PROGRAM, &macquadra_state::quadra700_map);
+
+ SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
+ m_screen->set_refresh_hz(75.08);
+ m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(1260));
+ m_screen->set_size(1152, 870);
+ m_screen->set_visarea(0, 1152-1, 0, 870-1);
+ m_screen->set_screen_update(FUNC(macquadra_state::screen_update_dafb));
+
+ MCFG_VIDEO_START_OVERRIDE(macquadra_state,macdafb)
+ MCFG_VIDEO_RESET_OVERRIDE(macquadra_state,macdafb)
+
+ PALETTE(config, m_palette).set_entries(256);
+
+ RTC3430042(config, m_rtc, XTAL(32'768));
+
+ LEGACY_IWM(config, m_iwm, &mac_iwm_interface);
+ sonydriv_floppy_image_device::legacy_2_drives_add(config, &mac_floppy_interface);
+
+ SCC85C30(config, m_scc, C7M);
+// m_scc->intrq_callback().set(FUNC(macquadra_state::set_scc_interrupt));
+
+ DP83932C(config, m_sonic, 20_MHz_XTAL);
+ m_sonic->set_bus(m_maincpu, 0);
+
+ nubus_device &nubus(NUBUS(config, "nubus", 0));
+ nubus.set_space(m_maincpu, AS_PROGRAM);
+ nubus.out_irq9_callback().set(FUNC(macquadra_state::nubus_irq_9_w));
+ nubus.out_irqa_callback().set(FUNC(macquadra_state::nubus_irq_a_w));
+ nubus.out_irqb_callback().set(FUNC(macquadra_state::nubus_irq_b_w));
+ nubus.out_irqc_callback().set(FUNC(macquadra_state::nubus_irq_c_w));
+ nubus.out_irqd_callback().set(FUNC(macquadra_state::nubus_irq_d_w));
+ nubus.out_irqe_callback().set(FUNC(macquadra_state::nubus_irq_e_w));
+ NUBUS_SLOT(config, "nbd", "nubus", mac_nubus_cards, nullptr);
+ NUBUS_SLOT(config, "nbe", "nubus", mac_nubus_cards, nullptr);
+
+ VIA6522(config, m_via1, C7M/10);
+ m_via1->readpa_handler().set(FUNC(macquadra_state::mac_via_in_a));
+ m_via1->readpb_handler().set(FUNC(macquadra_state::mac_via_in_b));
+ m_via1->writepa_handler().set(FUNC(macquadra_state::mac_via_out_a));
+ m_via1->writepb_handler().set(FUNC(macquadra_state::mac_via_out_b));
+ m_via1->irq_handler().set(FUNC(macquadra_state::mac_via_irq));
+ m_via1->cb2_handler().set(FUNC(macquadra_state::via_cb2_w));
+
+ VIA6522(config, m_via2, C7M/10);
+ m_via2->readpa_handler().set(FUNC(macquadra_state::mac_via2_in_a));
+ m_via2->readpb_handler().set(FUNC(macquadra_state::mac_via2_in_b));
+ m_via2->writepa_handler().set(FUNC(macquadra_state::mac_via2_out_a));
+ m_via2->writepb_handler().set(FUNC(macquadra_state::mac_via2_out_b));
+ m_via2->irq_handler().set(FUNC(macquadra_state::mac_via2_irq));
+
+ MACADB(config, m_macadb, C15M);
+ m_macadb->via_clock_callback().set(m_via1, FUNC(via6522_device::write_cb1));
+ m_macadb->via_data_callback().set(m_via1, FUNC(via6522_device::write_cb2));
+ m_macadb->adb_irq_callback().set(FUNC(macquadra_state::adb_irq_w));
+
+ SPEAKER(config, "lspeaker").front_left();
+ SPEAKER(config, "rspeaker").front_right();
+ ASC(config, m_easc, C15M, asc_device::asc_type::EASC);
+// m_easc->irqf_callback().set(FUNC(macquadra_state::mac_asc_irq));
+ m_easc->add_route(0, "lspeaker", 1.0);
+ m_easc->add_route(1, "rspeaker", 1.0);
+
+ /* internal ram */
+ RAM(config, m_ram);
+ m_ram->set_default_size("4M");
+ m_ram->set_extra_options("8M,16M,32M,64M,68M,72M,80M,96M,128M");
+
+ SOFTWARE_LIST(config, "flop35_list").set_original("mac_flop");
+}
+
+ROM_START( macqd700 )
+ ROM_REGION32_BE(0x100000, "bootrom", 0)
+ ROM_LOAD( "420dbff3.rom", 0x000000, 0x100000, CRC(88ea2081) SHA1(7a8ee468d16e64f2ad10cb8d1a45e6f07cc9e212) )
+ROM_END
+
+COMP( 1991, macqd700, 0, 0, macqd700, macadb, macquadra_state, init_macqd700, "Apple Computer", "Macintosh Quadra 700", MACHINE_NOT_WORKING )
diff --git a/src/mame/includes/mac.h b/src/mame/includes/mac.h
index 5164532102a..0eeed203cff 100644
--- a/src/mame/includes/mac.h
+++ b/src/mame/includes/mac.h
@@ -292,10 +292,6 @@ private:
uint8_t m_sonora_vctl[8];
emu_timer *m_vbl_timer, *m_cursor_timer;
uint16_t m_cursor_line;
- uint16_t m_dafb_int_status;
- int m_dafb_scsi1_drq, m_dafb_scsi2_drq;
- uint8_t m_dafb_mode;
- uint32_t m_dafb_base, m_dafb_stride;
// this is shared among all video setups with vram
optional_shared_ptr<uint32_t> m_vram;
@@ -368,11 +364,6 @@ private:
uint8_t mac_5396_r(offs_t offset);
void mac_5396_w(offs_t offset, uint8_t data);
- uint32_t dafb_r(offs_t offset, uint32_t mem_mask = ~0);
- void dafb_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
- uint32_t dafb_dac_r(offs_t offset, uint32_t mem_mask = ~0);
- void dafb_dac_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
-
uint32_t macwd_r(offs_t offset, uint32_t mem_mask = ~0);
void macwd_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
@@ -438,8 +429,6 @@ private:
DECLARE_VIDEO_START(macprtb);
DECLARE_VIDEO_START(macsonora);
DECLARE_VIDEO_RESET(macrbv);
- DECLARE_VIDEO_START(macdafb);
- DECLARE_VIDEO_RESET(macdafb);
DECLARE_VIDEO_START(macv8);
DECLARE_VIDEO_RESET(macsonora);
DECLARE_VIDEO_RESET(maceagle);
@@ -450,7 +439,6 @@ private:
uint32_t screen_update_macpb140(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_macpb160(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_macrbv(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
- uint32_t screen_update_macdafb(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
uint32_t screen_update_macrbvvram(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
uint32_t screen_update_macv8(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
uint32_t screen_update_macsonora(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
@@ -459,8 +447,6 @@ private:
TIMER_CALLBACK_MEMBER(mac_6015_tick);
TIMER_CALLBACK_MEMBER(mac_adbrefresh_tick);
TIMER_CALLBACK_MEMBER(mac_scanline_tick);
- TIMER_CALLBACK_MEMBER(dafb_vbl_tick);
- TIMER_CALLBACK_MEMBER(dafb_cursor_tick);
DECLARE_WRITE_LINE_MEMBER(mac_adb_via_out_cb2);
uint8_t mac_via_in_a();
uint8_t mac_via_in_b();
@@ -487,7 +473,6 @@ private:
void mac_state_load();
DECLARE_WRITE_LINE_MEMBER(mac_via_irq);
DECLARE_WRITE_LINE_MEMBER(mac_via2_irq);
- void dafb_recalc_ints();
void set_scc_waitrequest(int waitrequest);
void mac_driver_init(model_t model);
void mac_install_memory(offs_t memory_begin, offs_t memory_end, offs_t memory_size, void *memory_data, int is_rom, const char *bank);
diff --git a/src/mame/machine/mac.cpp b/src/mame/machine/mac.cpp
index e5b8727e1e0..30eaec3893c 100644
--- a/src/mame/machine/mac.cpp
+++ b/src/mame/machine/mac.cpp
@@ -635,20 +635,6 @@ WRITE_LINE_MEMBER(mac_state::mac_scsi_irq)
}*/
}
-WRITE_LINE_MEMBER(mac_state::irq_539x_1_w)
-{
- if (state) // make sure a CB1 transition occurs
- {
- m_via2->write_cb2(0);
- m_via2->write_cb2(1);
- }
-}
-
-WRITE_LINE_MEMBER(mac_state::drq_539x_1_w)
-{
- m_dafb_scsi1_drq = state;
-}
-
/* *************************************************************************
* SCC
*
@@ -1494,12 +1480,6 @@ void mac_state::nubus_slot_interrupt(uint8_t slot, uint32_t state)
static const uint8_t masks[8] = { 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80 };
uint8_t mask = 0x3f;
- // quadra 700/900/950 use the top 2 bits of the interrupt register for ethernet and video
- if ((m_model == MODEL_MAC_QUADRA_700) || (m_model == MODEL_MAC_QUADRA_900) || (m_model == MODEL_MAC_QUADRA_950))
- {
- mask = 0xff;
- }
-
slot -= 9;
if (state)
diff --git a/src/mame/mame.lst b/src/mame/mame.lst
index cf6e091675e..cd3c9f8aad5 100644
--- a/src/mame/mame.lst
+++ b/src/mame/mame.lst
@@ -19896,10 +19896,12 @@ macpb180 // 1992 Apple Macintosh PowerBook 180
macpb180c // 1992 Apple Macintosh PowerBook 180c
macpd210 // 1992 Apple Macintosh PowerBook Duo 210
macprtb // 1989 Apple Macintosh Portable
-macqd700 // 1991 Apple Macintosh Quadra 700
macse30 // 1989 Apple Macintosh SE/30
pmac6100 // 1993 Apple Power Macintosh 6100
+@source:macquadra700.cpp
+macqd700 // 1991 Apple Macintosh Quadra 700
+
@source:mac128.cpp
mac128k // 1984 Apple Macintosh
mac512k // 1985 Apple Macintosh 512k
diff --git a/src/mame/video/mac.cpp b/src/mame/video/mac.cpp
index 33625b9359e..b167fa870e2 100644
--- a/src/mame/video/mac.cpp
+++ b/src/mame/video/mac.cpp
@@ -781,315 +781,6 @@ uint32_t mac_state::screen_update_macsonora(screen_device &screen, bitmap_rgb32
return 0;
}
-// DAFB: video for Quadra 700/900
-
-void mac_state::dafb_recalc_ints()
-{
- if (m_dafb_int_status != 0)
- {
- nubus_slot_interrupt(0xf, ASSERT_LINE);
- }
- else
- {
- nubus_slot_interrupt(0xf, CLEAR_LINE);
- }
-}
-
-TIMER_CALLBACK_MEMBER(mac_state::dafb_vbl_tick)
-{
- m_dafb_int_status |= 1;
- dafb_recalc_ints();
-
- m_vbl_timer->adjust(m_screen->time_until_pos(480, 0), 0);
-}
-
-TIMER_CALLBACK_MEMBER(mac_state::dafb_cursor_tick)
-{
- m_dafb_int_status |= 4;
- dafb_recalc_ints();
-
- m_cursor_timer->adjust(m_screen->time_until_pos(m_cursor_line, 0), 0);
-}
-
-VIDEO_START_MEMBER(mac_state,macdafb)
-{
- m_vbl_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mac_state::dafb_vbl_tick),this));
- m_cursor_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mac_state::dafb_cursor_tick),this));
-
- m_vbl_timer->adjust(attotime::never);
- m_cursor_timer->adjust(attotime::never);
-}
-
-VIDEO_RESET_MEMBER(mac_state,macdafb)
-{
- m_rbv_count = 0;
- m_rbv_clutoffs = 0;
- m_rbv_montype = 6;
- m_rbv_vbltime = 0;
- m_dafb_int_status = 0;
- m_rbv_type = RBV_TYPE_DAFB;
- m_dafb_mode = 0;
- m_dafb_base = 0x1000;
- m_dafb_stride = 256*4;
-
- memset(m_rbv_palette, 0, sizeof(m_rbv_palette));
-}
-
-uint32_t mac_state::dafb_r(offs_t offset, uint32_t mem_mask)
-{
-// if (offset != 0x108/4) printf("DAFB: Read @ %x (mask %x PC=%x)\n", offset*4, mem_mask, m_maincpu->pc());
-
- switch (offset<<2)
- {
- case 0x1c: // inverse of monitor sense
- return 7; // 21" color 2-page
-
- case 0x24: // SCSI 539x #1 status
- return m_dafb_scsi1_drq<<9;
-
- case 0x28: // SCSI 539x #2 status
- return m_dafb_scsi2_drq<<9;
-
- case 0x108: // IRQ/VBL status
- return m_dafb_int_status;
-
- case 0x10c: // clear cursor scanline int
- m_dafb_int_status &= ~4;
- dafb_recalc_ints();
- break;
-
- case 0x114: // clear VBL int
- m_dafb_int_status &= ~1;
- dafb_recalc_ints();
- break;
- }
- return 0;
-}
-
-void mac_state::dafb_w(offs_t offset, uint32_t data, uint32_t mem_mask)
-{
-// if (offset != 0x10c/4) printf("DAFB: Write %08x @ %x (mask %x PC=%x)\n", data, offset*4, mem_mask, m_maincpu->pc());
-
- switch (offset<<2)
- {
- case 0: // bits 20-9 of base
- m_dafb_base &= 0x1ff;
- m_dafb_base |= (data & 0xffff) << 9;
-// printf("DAFB baseH: %x\n", m_dafb_base);
- break;
-
- case 4: // bits 8-5 of base
- m_dafb_base &= ~0x1ff;
- m_dafb_base |= (data & 0xf) << 5;
-// printf("DAFB baseL: %x\n", m_dafb_base);
- break;
-
- case 8:
- m_dafb_stride = data<<2; // stride in DWORDs
-// printf("DAFB stride: %x %x\n", m_dafb_stride, data);
- break;
-
- case 0x104:
- if (data & 1) // VBL enable
- {
- m_vbl_timer->adjust(m_screen->time_until_pos(480, 0), 0);
- }
- else
- {
- m_vbl_timer->adjust(attotime::never);
- m_dafb_int_status &= ~1;
- dafb_recalc_ints();
- }
-
- if (data & 2) // aux scanline interrupt enable
- {
- fatalerror("DAFB: Aux scanline interrupt enable not supported!\n");
- }
-
- if (data & 4) // cursor scanline interrupt enable
- {
- m_cursor_timer->adjust(m_screen->time_until_pos(m_cursor_line, 0), 0);
- }
- else
- {
- m_cursor_timer->adjust(attotime::never);
- m_dafb_int_status &= ~4;
- dafb_recalc_ints();
- }
- break;
-
- case 0x10c: // clear cursor scanline int
- m_dafb_int_status &= ~4;
- dafb_recalc_ints();
- break;
-
- case 0x114: // clear VBL int
- m_dafb_int_status &= ~1;
- dafb_recalc_ints();
- break;
- }
-}
-
-uint32_t mac_state::dafb_dac_r(offs_t offset, uint32_t mem_mask)
-{
-// printf("DAFB: Read DAC @ %x (mask %x PC=%x)\n", offset*4, mem_mask, m_maincpu->pc());
-
- return 0;
-}
-
-void mac_state::dafb_dac_w(offs_t offset, uint32_t data, uint32_t mem_mask)
-{
-// if ((offset > 0) && (offset != 0x10/4)) printf("DAFB: Write %08x to DAC @ %x (mask %x PC=%x)\n", data, offset*4, mem_mask, m_maincpu->pc());
-
- switch (offset<<2)
- {
- case 0:
- m_rbv_clutoffs = data & 0xff;
- m_rbv_count = 0;
- break;
-
- case 0x10:
- m_rbv_colors[m_rbv_count++] = data&0xff;
-
- if (m_rbv_count == 3)
- {
- m_palette->set_pen_color(m_rbv_clutoffs, rgb_t(m_rbv_colors[0], m_rbv_colors[1], m_rbv_colors[2]));
- m_rbv_palette[m_rbv_clutoffs] = rgb_t(m_rbv_colors[0], m_rbv_colors[1], m_rbv_colors[2]);
- m_rbv_clutoffs++;
- m_rbv_count = 0;
- }
- break;
-
- case 0x20:
- printf("%x to DAFB mode\n", data);
- switch (data & 0x9f)
- {
- case 0x80:
- m_dafb_mode = 0; // 1bpp
- break;
-
- case 0x88:
- m_dafb_mode = 1; // 2bpp
- break;
-
- case 0x90:
- m_dafb_mode = 2; // 4bpp
- break;
-
- case 0x98:
- m_dafb_mode = 3; // 8bpp
- break;
-
- case 0x9c:
- m_dafb_mode = 4; // 24bpp
- break;
- }
- break;
- }
-}
-
-uint32_t mac_state::screen_update_macdafb(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
-{
- switch (m_dafb_mode)
- {
- case 0: // 1bpp
- {
- uint8_t const *vram8 = (uint8_t *)m_vram.target();
- vram8 += m_dafb_base;
-
- for (int y = 0; y < 870; y++)
- {
- uint32_t *scanline = &bitmap.pix(y);
- for (int x = 0; x < 1152; x+=8)
- {
- uint8_t const pixels = vram8[(y * m_dafb_stride) + ((x/8)^3)];
-
- *scanline++ = m_rbv_palette[(pixels>>7)&1];
- *scanline++ = m_rbv_palette[(pixels>>6)&1];
- *scanline++ = m_rbv_palette[(pixels>>5)&1];
- *scanline++ = m_rbv_palette[(pixels>>4)&1];
- *scanline++ = m_rbv_palette[(pixels>>3)&1];
- *scanline++ = m_rbv_palette[(pixels>>2)&1];
- *scanline++ = m_rbv_palette[(pixels>>1)&1];
- *scanline++ = m_rbv_palette[(pixels&1)];
- }
- }
- }
- break;
-
- case 1: // 2bpp
- {
- uint8_t const *vram8 = (uint8_t *)m_vram.target();
- vram8 += m_dafb_base;
-
- for (int y = 0; y < 870; y++)
- {
- uint32_t *scanline = &bitmap.pix(y);
- for (int x = 0; x < 1152/4; x++)
- {
- uint8_t const pixels = vram8[(y * m_dafb_stride) + (BYTE4_XOR_BE(x))];
-
- *scanline++ = m_rbv_palette[((pixels>>6)&3)];
- *scanline++ = m_rbv_palette[((pixels>>4)&3)];
- *scanline++ = m_rbv_palette[((pixels>>2)&3)];
- *scanline++ = m_rbv_palette[(pixels&3)];
- }
- }
- }
- break;
-
- case 2: // 4bpp
- {
- uint8_t const *vram8 = (uint8_t *)m_vram.target();
- vram8 += m_dafb_base;
-
- for (int y = 0; y < 870; y++)
- {
- uint32_t *scanline = &bitmap.pix(y);
- for (int x = 0; x < 1152/2; x++)
- {
- uint8_t const pixels = vram8[(y * m_dafb_stride) + (BYTE4_XOR_BE(x))];
-
- *scanline++ = m_rbv_palette[(pixels>>4)];
- *scanline++ = m_rbv_palette[(pixels&0xf)];
- }
- }
- }
- break;
-
- case 3: // 8bpp
- {
- uint8_t const *vram8 = (uint8_t *)m_vram.target();
- vram8 += m_dafb_base;
-
- for (int y = 0; y < 870; y++)
- {
- uint32_t *scanline = &bitmap.pix(y);
- for (int x = 0; x < 1152; x++)
- {
- uint8_t const pixels = vram8[(y * m_dafb_stride) + (BYTE4_XOR_BE(x))];
- *scanline++ = m_rbv_palette[pixels];
- }
- }
- }
- break;
-
- case 4: // 24 bpp
- for (int y = 0; y < 480; y++)
- {
- uint32_t *scanline = &bitmap.pix(y);
- uint32_t const *base = (uint32_t *)&m_vram[(y * (m_dafb_stride/4)) + (m_dafb_base/4)];
- for (int x = 0; x < 640; x++)
- {
- *scanline++ = *base++;
- }
- }
- break;
- }
-
- return 0;
-}
-
uint32_t mac_state::screen_update_macpbwd(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)/* Color PowerBooks using an off-the-shelf WD video chipset */
{
uint8_t const *vram8 = (uint8_t *)m_vram.target();