summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/devices/bus/isa/3c503.cpp9
-rw-r--r--src/devices/bus/isa/ne1000.cpp7
-rw-r--r--src/devices/bus/isa/ne2000.cpp7
-rw-r--r--src/devices/bus/nubus/nubus_asntmc3b.cpp7
-rw-r--r--src/devices/bus/x68k/x68k_neptunex.cpp7
-rw-r--r--src/devices/machine/am79c90.cpp2
-rw-r--r--src/devices/machine/cs8900a.cpp2
-rw-r--r--src/devices/machine/dp8390.cpp2
-rw-r--r--src/devices/machine/i82586.cpp4
-rw-r--r--src/devices/machine/mb8795.cpp2
-rw-r--r--src/devices/machine/smc91c9x.cpp9
-rw-r--r--src/emu/dinetwork.cpp4
-rw-r--r--src/emu/dinetwork.h2
-rw-r--r--src/emu/network.cpp2
14 files changed, 45 insertions, 21 deletions
diff --git a/src/devices/bus/isa/3c503.cpp b/src/devices/bus/isa/3c503.cpp
index 041b403cabb..6c5e812177b 100644
--- a/src/devices/bus/isa/3c503.cpp
+++ b/src/devices/bus/isa/3c503.cpp
@@ -3,6 +3,8 @@
#include "emu.h"
#include "3c503.h"
+#include "multibyte.h"
+
#define SADDR 0xcc000
void el2_3c503_device::device_add_mconfig(machine_config &config)
@@ -24,10 +26,13 @@ el2_3c503_device::el2_3c503_device(const machine_config& mconfig, const char* ta
}
void el2_3c503_device::device_start() {
- char mac[7];
+ uint8_t mac[6];
uint32_t num = machine().rand();
memset(m_prom, 0x57, 16);
- snprintf(mac, std::size(mac), "\x02\x60\x8c%c%c%c", (num >> 16) & 0xff, (num >> 8) & 0xff, num & 0xff);
+ mac[0] = 0x02;
+ mac[1] = 0x60;
+ mac[2] = 0x8c;
+ put_u24be(mac+3, num);
memcpy(m_prom, mac, 6);
memset(m_rom, 0, 8*1024); // empty
m_dp8390->set_mac(mac);
diff --git a/src/devices/bus/isa/ne1000.cpp b/src/devices/bus/isa/ne1000.cpp
index a290b076628..62c7187e377 100644
--- a/src/devices/bus/isa/ne1000.cpp
+++ b/src/devices/bus/isa/ne1000.cpp
@@ -3,6 +3,8 @@
#include "emu.h"
#include "ne1000.h"
+#include "multibyte.h"
+
DEFINE_DEVICE_TYPE(NE1000, ne1000_device, "ne1000", "NE1000 Network Adapter")
@@ -23,10 +25,11 @@ ne1000_device::ne1000_device(const machine_config &mconfig, const char *tag, dev
}
void ne1000_device::device_start() {
- char mac[7];
+ uint8_t mac[6];
uint32_t num = machine().rand();
memset(m_prom, 0x57, 16);
- sprintf(mac+2, "\x1b%c%c%c", (num >> 16) & 0xff, (num >> 8) & 0xff, num & 0xff);
+ mac[2] = 0x1b;
+ put_u24be(mac+3, num);
mac[0] = 0; mac[1] = 0; // avoid gcc warning
memcpy(m_prom, mac, 6);
m_dp8390->set_mac(mac);
diff --git a/src/devices/bus/isa/ne2000.cpp b/src/devices/bus/isa/ne2000.cpp
index efd448fe3da..452aceb55c5 100644
--- a/src/devices/bus/isa/ne2000.cpp
+++ b/src/devices/bus/isa/ne2000.cpp
@@ -3,6 +3,8 @@
#include "emu.h"
#include "ne2000.h"
+#include "multibyte.h"
+
DEFINE_DEVICE_TYPE(NE2000, ne2000_device, "ne2000", "NE2000 Network Adapter")
@@ -23,10 +25,11 @@ ne2000_device::ne2000_device(const machine_config& mconfig, const char* tag, dev
}
void ne2000_device::device_start() {
- char mac[7];
+ uint8_t mac[6];
uint32_t num = machine().rand();
memset(m_prom, 0x57, 16);
- sprintf(mac+2, "\x1b%c%c%c", (num >> 16) & 0xff, (num >> 8) & 0xff, num & 0xff);
+ mac[2] = 0x1b;
+ put_u24be(mac+3, num);
mac[0] = 0; mac[1] = 0; // avoid gcc warning
memcpy(m_prom, mac, 6);
m_dp8390->set_mac(mac);
diff --git a/src/devices/bus/nubus/nubus_asntmc3b.cpp b/src/devices/bus/nubus/nubus_asntmc3b.cpp
index c7a846fe7b2..70c56dc40f7 100644
--- a/src/devices/bus/nubus/nubus_asntmc3b.cpp
+++ b/src/devices/bus/nubus/nubus_asntmc3b.cpp
@@ -15,6 +15,8 @@
#include "emu.h"
#include "nubus_asntmc3b.h"
+#include "multibyte.h"
+
#define MAC8390_ROM_REGION "asntm3b_rom"
#define MAC8390_839X "dp83902"
@@ -95,10 +97,11 @@ nubus_appleenet_device::nubus_appleenet_device(const machine_config &mconfig, co
void nubus_mac8390_device::device_start()
{
uint32_t slotspace;
- char mac[7];
+ uint8_t mac[6];
uint32_t num = machine().rand();
memset(m_prom, 0x57, 16);
- sprintf(mac+2, "\x1b%c%c%c", (num >> 16) & 0xff, (num >> 8) & 0xff, num & 0xff);
+ mac[2] = 0x1b;
+ put_u24be(mac+3, num);
mac[0] = mac[1] = 0; // avoid gcc warning
memcpy(m_prom, mac, 6);
m_dp83902->set_mac(mac);
diff --git a/src/devices/bus/x68k/x68k_neptunex.cpp b/src/devices/bus/x68k/x68k_neptunex.cpp
index 56ffe39951f..ab03f73741c 100644
--- a/src/devices/bus/x68k/x68k_neptunex.cpp
+++ b/src/devices/bus/x68k/x68k_neptunex.cpp
@@ -9,6 +9,8 @@
#include "machine/dp8390.h"
+#include "multibyte.h"
+
//**************************************************************************
// DEVICE DEFINITIONS
@@ -39,11 +41,12 @@ x68k_neptune_device::x68k_neptune_device(const machine_config &mconfig, const ch
void x68k_neptune_device::device_start()
{
- char mac[7];
+ uint8_t mac[6];
uint32_t num = machine().rand();
m_slot = dynamic_cast<x68k_expansion_slot_device *>(owner());
memset(m_prom, 0x57, 16);
- sprintf(mac+2, "\x1b%c%c%c", (num >> 16) & 0xff, (num >> 8) & 0xff, num & 0xff);
+ mac[2] = 0x1b;
+ put_u24be(mac+3, num);
mac[0] = 0; mac[1] = 0; // avoid gcc warning
memcpy(m_prom, mac, 6);
m_dp8390->set_mac(mac);
diff --git a/src/devices/machine/am79c90.cpp b/src/devices/machine/am79c90.cpp
index a48d2ad841c..8c6a36221f3 100644
--- a/src/devices/machine/am79c90.cpp
+++ b/src/devices/machine/am79c90.cpp
@@ -694,7 +694,7 @@ void am7990_device_base::initialize()
put_u16le(&m_physical_addr[0], init_block[1]);
put_u16le(&m_physical_addr[2], init_block[2]);
put_u16le(&m_physical_addr[4], init_block[3]);
- set_mac((char *)m_physical_addr);
+ set_mac(m_physical_addr);
m_logical_addr_filter = (u64(init_block[7]) << 48) | (u64(init_block[6]) << 32) | (u32(init_block[5]) << 16) | init_block[4];
diff --git a/src/devices/machine/cs8900a.cpp b/src/devices/machine/cs8900a.cpp
index 92df2892ddc..b91957c29b2 100644
--- a/src/devices/machine/cs8900a.cpp
+++ b/src/devices/machine/cs8900a.cpp
@@ -923,7 +923,7 @@ void cs8900a_device::cs8900_sideeffects_write_pp(u16 ppaddress, int odd_address)
/* the MAC address has been changed */
cs8900_ia_mac[ppaddress - CS8900_PP_ADDR_MAC_ADDR + odd_address] = GET_PP_8(ppaddress + odd_address);
- set_mac((char *)cs8900_ia_mac);
+ set_mac(cs8900_ia_mac);
if (odd_address && (ppaddress == CS8900_PP_ADDR_MAC_ADDR + 4))
LOGMASKED(CS8900_DEBUG, "set MAC address: %02x:%02x:%02x:%02x:%02x:%02x",
diff --git a/src/devices/machine/dp8390.cpp b/src/devices/machine/dp8390.cpp
index 493c21f0ca7..2ed12551e78 100644
--- a/src/devices/machine/dp8390.cpp
+++ b/src/devices/machine/dp8390.cpp
@@ -422,7 +422,7 @@ void dp8390_device::cs_write(offs_t offset, uint8_t data) {
case 0x45:
case 0x46:
m_regs.par[(offset & 0x7)-1] = data;
- set_mac((const char *)m_regs.par);
+ set_mac(m_regs.par);
break;
case 0x47:
m_regs.curr = data;
diff --git a/src/devices/machine/i82586.cpp b/src/devices/machine/i82586.cpp
index c017a3501d4..d92a0817e91 100644
--- a/src/devices/machine/i82586.cpp
+++ b/src/devices/machine/i82586.cpp
@@ -838,7 +838,7 @@ bool i82586_device::cu_iasetup()
put_u32le(&mac[2], data);
LOG("cu_iasetup individual address %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
- set_mac((char *)mac);
+ set_mac(mac);
return true;
}
@@ -1367,7 +1367,7 @@ bool i82596_device::cu_iasetup()
}
LOG("cu_iasetup individual address %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
- set_mac((char *)mac);
+ set_mac(mac);
return true;
}
diff --git a/src/devices/machine/mb8795.cpp b/src/devices/machine/mb8795.cpp
index 53e29c00e63..7d619a18d90 100644
--- a/src/devices/machine/mb8795.cpp
+++ b/src/devices/machine/mb8795.cpp
@@ -180,7 +180,7 @@ void mb8795_device::mac_w(offs_t offset, uint8_t data)
{
if(offset < 6) {
mac[offset] = data;
- set_mac((const char *)mac);
+ set_mac(mac);
}
}
diff --git a/src/devices/machine/smc91c9x.cpp b/src/devices/machine/smc91c9x.cpp
index 9c381ba64f9..a27c1f7d281 100644
--- a/src/devices/machine/smc91c9x.cpp
+++ b/src/devices/machine/smc91c9x.cpp
@@ -10,6 +10,8 @@
#include "emu.h"
#include "smc91c9x.h"
+
+#include "multibyte.h"
#include <sstream>
#include <iomanip>
@@ -972,7 +974,12 @@ void smc91c9x_device::write(offs_t offset, u16 data, u16 mem_mask)
if ( ACCESSING_BITS_8_15 )
{
set_promisc(m_reg[B0_RCR] & PRMS);
- set_mac((char *)&m_reg[B1_IA0_1]);
+
+ u8 mac[6];
+ put_u16le(&mac[0], m_reg[B1_IA0_1]);
+ put_u16le(&mac[2], m_reg[B1_IA2_3]);
+ put_u16le(&mac[4], m_reg[B1_IA4_5]);
+ set_mac(mac);
}
break;
diff --git a/src/emu/dinetwork.cpp b/src/emu/dinetwork.cpp
index 2091ac6a2c3..7333fd25de8 100644
--- a/src/emu/dinetwork.cpp
+++ b/src/emu/dinetwork.cpp
@@ -12,7 +12,7 @@ device_network_interface::device_network_interface(const machine_config &mconfig
// Convert to Mibps to Bps
m_bandwidth = bandwidth << (20 - 3);
m_mtu = mtu;
- set_mac("\0\0\0\0\0\0");
+ memset(m_mac, 0, 6);
m_intf = -1;
m_loopback_control = false;
}
@@ -107,7 +107,7 @@ void device_network_interface::set_promisc(bool promisc)
if(m_dev) m_dev->set_promisc(promisc);
}
-void device_network_interface::set_mac(const char *mac)
+void device_network_interface::set_mac(const u8 *mac)
{
memcpy(m_mac, mac, 6);
if(m_dev) m_dev->set_mac(m_mac);
diff --git a/src/emu/dinetwork.h b/src/emu/dinetwork.h
index c2629f665fc..6dd062c16aa 100644
--- a/src/emu/dinetwork.h
+++ b/src/emu/dinetwork.h
@@ -16,7 +16,7 @@ public:
void set_interface(int id);
void set_promisc(bool promisc);
- void set_mac(const char *mac);
+ void set_mac(const u8 *mac);
void set_loopback(bool loopback);
const char *get_mac() const { return m_mac; }
diff --git a/src/emu/network.cpp b/src/emu/network.cpp
index 0ffff1616cc..4566298a994 100644
--- a/src/emu/network.cpp
+++ b/src/emu/network.cpp
@@ -57,7 +57,7 @@ void network_manager::config_load(config_type cfg_type, config_level cfg_level,
network.set_interface(interface);
const char *mac_addr = node->get_attribute_string("mac", nullptr);
if (mac_addr != nullptr && strlen(mac_addr) == 17) {
- char mac[7];
+ uint8_t mac[6];
unsigned int mac_num[6];
sscanf(mac_addr, "%02x:%02x:%02x:%02x:%02x:%02x", &mac_num[0], &mac_num[1], &mac_num[2], &mac_num[3], &mac_num[4], &mac_num[5]);
for (int i = 0; i<6; i++) mac[i] = mac_num[i];