diff options
author | 2017-10-27 16:34:57 +0200 | |
---|---|---|
committer | 2017-10-27 16:35:12 +0200 | |
commit | 67a9f030a199bb8c8adf996c9616d7335236261d (patch) | |
tree | 0db1f1430c7d82c69e452beb7ef2c2fdffc96936 | |
parent | 4ac355689eb72027fce7d1b3c3133e9c459a337a (diff) |
eeprom: this should make internal read/write endian-safe (untested) (nw)
-rw-r--r-- | src/devices/machine/eeprom.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/devices/machine/eeprom.cpp b/src/devices/machine/eeprom.cpp index b5866d3fd4c..38244596f05 100644 --- a/src/devices/machine/eeprom.cpp +++ b/src/devices/machine/eeprom.cpp @@ -302,7 +302,7 @@ void eeprom_base_device::nvram_write(emu_file &file) uint32_t eeprom_base_device::internal_read(offs_t address) { if (m_data_bits == 16) - return m_data[address * 2] | (m_data[address * 2 + 1] << 8); + return m_data[address * 2 + NATIVE_ENDIAN_VALUE_LE_BE(0,1)] | (m_data[address * 2 + NATIVE_ENDIAN_VALUE_LE_BE(1,0)] << 8); else return m_data[address]; } @@ -317,8 +317,8 @@ void eeprom_base_device::internal_write(offs_t address, uint32_t data) { if (m_data_bits == 16) { - m_data[address*2] = data; - m_data[address*2+1] = data >> 8; + m_data[address * 2 + NATIVE_ENDIAN_VALUE_LE_BE(0,1)] = data; + m_data[address * 2 + NATIVE_ENDIAN_VALUE_LE_BE(1,0)] = data >> 8; } else m_data[address] = data; } |