summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author arbee <rb6502@users.noreply.github.com>2023-09-22 22:53:33 -0400
committer arbee <rb6502@users.noreply.github.com>2023-09-22 22:53:33 -0400
commit37fbd9091a16411cf573593fe717297ffaed828b (patch)
tree95e8c4f104b146e94769141a3de4d50d05a5c6f6
parentb79c06713cc4ab2e06f9ebafe20a048f32183209 (diff)
apple/macquadra700.cpp,apple/macquadra800.cpp: Finish hooking up built-in SONIC ethernet. [R. Belmont]
-rw-r--r--src/mame/apple/macquadra700.cpp39
-rw-r--r--src/mame/apple/macquadra800.cpp38
2 files changed, 75 insertions, 2 deletions
diff --git a/src/mame/apple/macquadra700.cpp b/src/mame/apple/macquadra700.cpp
index c38b61e1b02..e15c1a97bd0 100644
--- a/src/mame/apple/macquadra700.cpp
+++ b/src/mame/apple/macquadra700.cpp
@@ -96,6 +96,7 @@ private:
u32 *m_ram_ptr = nullptr, *m_rom_ptr = nullptr;
u32 m_ram_mask = 0, m_ram_size = 0, m_rom_size = 0;
+ u8 m_mac[6];
emu_timer *m_6015_timer = nullptr;
@@ -168,6 +169,8 @@ private:
else
m_swim->write((offset >> 8) & 0xf, data>>8);
}
+
+ u8 ethernet_mac_r(offs_t offset);
};
void macquadra_state::field_interrupts()
@@ -202,9 +205,21 @@ void macquadra_state::field_interrupts()
void macquadra_state::machine_start()
{
+ const u8 *MAC = (u8 *)m_sonic->get_mac();
+
m_dafb->set_turboscsi1_device(m_ncr1);
m_dafb->set_turboscsi2_device(nullptr);
+ // MAC PROM is stored with a bit swizzle and must match one of 2
+ // Apple-assigned OUI blocks 00:05:02 or 08:00:07
+ m_mac[0] = bitswap<8>(0x00, 0, 1, 2, 3, 7, 6, 5, 4);
+ m_mac[1] = bitswap<8>(0x05, 0, 1, 2, 3, 7, 6, 5, 4);
+ m_mac[2] = bitswap<8>(0x02, 0, 1, 2, 3, 7, 6, 5, 4);
+ m_mac[3] = bitswap<8>(MAC[3], 0, 1, 2, 3, 7, 6, 5, 4);
+ m_mac[4] = bitswap<8>(MAC[4], 0, 1, 2, 3, 7, 6, 5, 4);
+ m_mac[5] = bitswap<8>(MAC[5], 0, 1, 2, 3, 7, 6, 5, 4);
+ m_sonic->set_mac(&m_mac[0]);
+
m_ram_ptr = (u32*)m_ram->pointer();
m_ram_size = m_ram->size()>>1;
m_ram_mask = m_ram_size - 1;
@@ -412,6 +427,27 @@ u32 macquadra_state::rom_switch_r(offs_t offset)
return m_rom_ptr[offset & ((m_rom_size - 1)>>2)];
}
+u8 macquadra_state::ethernet_mac_r(offs_t offset)
+{
+ if (offset < 6)
+ {
+ return m_mac[offset];
+ }
+ else if (offset == 7)
+ {
+ u8 xor_total = 0;
+
+ for (int i = 0; i < 6; i++)
+ {
+ xor_total ^= (u8)m_mac[i];
+ }
+
+ return xor_total ^ 0xff;
+ }
+
+ return 0;
+}
+
TIMER_CALLBACK_MEMBER(macquadra_state::mac_6015_tick)
{
/* handle ADB keyboard/mouse */
@@ -427,7 +463,7 @@ void macquadra_state::quadra700_map(address_map &map)
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
+ map(0x50008000, 0x50008007).r(FUNC(macquadra_state::ethernet_mac_r)).mirror(0x00fc0000);
map(0x5000a000, 0x5000b0ff).m(m_sonic, FUNC(dp83932c_device::map)).umask32(0x0000ffff).mirror(0x00fc0000);
// 5000e000 = Orwell controls
map(0x5000f000, 0x5000f0ff).rw(m_dafb, FUNC(dafb_device::turboscsi_r<0>), FUNC(dafb_device::turboscsi_w<0>)).mirror(0x00fc0000);
@@ -595,6 +631,7 @@ void macquadra_state::macqd700(machine_config &config)
DP83932C(config, m_sonic, 40_MHz_XTAL / 2); // clock is C20M on the schematics
m_sonic->set_bus(m_maincpu, 0);
+ m_sonic->out_int_cb().set(m_via2, FUNC(via6522_device::write_pa0)).invert(); // IRQ is active low
nubus_device &nubus(NUBUS(config, "nubus", 40_MHz_XTAL / 4));
nubus.set_space(m_maincpu, AS_PROGRAM);
diff --git a/src/mame/apple/macquadra800.cpp b/src/mame/apple/macquadra800.cpp
index f98fe7aa6ca..7d6d1c79530 100644
--- a/src/mame/apple/macquadra800.cpp
+++ b/src/mame/apple/macquadra800.cpp
@@ -86,6 +86,8 @@ private:
required_device<ncr53c96_device> m_ncr1;
required_device<dp83932c_device> m_sonic;
+ u8 m_mac[6];
+
virtual void machine_start() override;
virtual void machine_reset() override;
@@ -96,11 +98,24 @@ private:
return (result << 8) | result;
}
void mac_scc_2_w(offs_t offset, u16 data) { m_iosb->via_sync(); m_scc->dc_ab_w(offset, data >> 8); }
+
+ u8 ethernet_mac_r(offs_t offset);
};
void quadra800_state::machine_start()
{
m_djmemc->set_ram_info((u32 *) m_ram->pointer(), m_ram->size());
+
+ const u8 *MAC = (u8 *)m_sonic->get_mac();
+ // MAC PROM is stored with a bit swizzle and must match one of 2
+ // Apple-assigned OUI blocks 00:05:02 or 08:00:07
+ m_mac[0] = bitswap<8>(0x08, 0, 1, 2, 3, 7, 6, 5, 4);
+ m_mac[1] = bitswap<8>(0x00, 0, 1, 2, 3, 7, 6, 5, 4);
+ m_mac[2] = bitswap<8>(0x07, 0, 1, 2, 3, 7, 6, 5, 4);
+ m_mac[3] = bitswap<8>(MAC[3], 0, 1, 2, 3, 7, 6, 5, 4);
+ m_mac[4] = bitswap<8>(MAC[4], 0, 1, 2, 3, 7, 6, 5, 4);
+ m_mac[5] = bitswap<8>(MAC[5], 0, 1, 2, 3, 7, 6, 5, 4);
+ m_sonic->set_mac(&m_mac[0]);
}
void quadra800_state::machine_reset()
@@ -111,6 +126,27 @@ void quadra800_state::init_macqd800()
{
}
+u8 quadra800_state::ethernet_mac_r(offs_t offset)
+{
+ if (offset < 6)
+ {
+ return m_mac[offset];
+ }
+ else if (offset == 7)
+ {
+ u8 xor_total = 0;
+
+ for (int i = 0; i < 6; i++)
+ {
+ xor_total ^= (u8)m_mac[i];
+ }
+
+ return xor_total ^ 0xff;
+ }
+
+ return 0;
+}
+
/***************************************************************************
ADDRESS MAPS
***************************************************************************/
@@ -119,7 +155,7 @@ void quadra800_state::quadra800_map(address_map &map)
map(0x00000000, 0xffffffff).m(m_djmemc, FUNC(djmemc_device::map));
map(0x50000000, 0x5fffffff).m(m_iosb, FUNC(iosb_device::map));
- // 50008000 = Ethernet MAC ID PROM
+ map(0x50008000, 0x50008007).r(FUNC(quadra800_state::ethernet_mac_r)).mirror(0x00fc0000);
map(0x5000a000, 0x5000b0ff).m(m_sonic, FUNC(dp83932c_device::map)).umask32(0x0000ffff).mirror(0x00fc0000);
map(0x5000c000, 0x5000dfff).rw(FUNC(quadra800_state::mac_scc_r), FUNC(quadra800_state::mac_scc_2_w)).mirror(0x00fc0000);
}