diff options
Diffstat (limited to 'src/emu/machine/eeprom.c')
-rw-r--r-- | src/emu/machine/eeprom.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/emu/machine/eeprom.c b/src/emu/machine/eeprom.c index 3626b19a267..d1418bd860d 100644 --- a/src/emu/machine/eeprom.c +++ b/src/emu/machine/eeprom.c @@ -293,17 +293,24 @@ void eeprom_base_device::nvram_default() { if (m_region->bytes() != eeprom_bytes) fatalerror("eeprom region '%s' wrong size (expected size = 0x%X)\n", tag(), eeprom_bytes); - if (m_data_bits == 8 && m_region->width() != 1) + if (m_data_bits == 8 && m_region->bytewidth() != 1) fatalerror("eeprom region '%s' needs to be an 8-bit region\n", tag()); - if (m_data_bits == 16 && (m_region->width() != 2 || m_region->endianness() != ENDIANNESS_BIG)) + if (m_data_bits == 16 && (m_region->bytewidth() != 2 || m_region->endianness() != ENDIANNESS_BIG)) fatalerror("eeprom region '%s' needs to be a 16-bit big-endian region\n", tag()); osd_printf_verbose("Loading data from EEPROM region '%s'\n", tag()); - for (offs_t offs = 0; offs < eeprom_length; offs++) - if (m_data_bits == 8) - m_addrspace[0]->write_byte(offs, m_region->u8(offs)); - else - m_addrspace[0]->write_word(offs * 2, m_region->u16(offs)); + if (m_data_bits == 8) + { + UINT8 *default_data = m_region->base(); + for (offs_t offs = 0; offs < eeprom_length; offs++) + m_addrspace[0]->write_byte(offs, default_data[offs]); + } + else + { + UINT16 *default_data = (UINT16 *)(m_region->base()); + for (offs_t offs = 0; offs < eeprom_length; offs++) + m_addrspace[0]->write_word(offs * 2, default_data[offs]); + } } } |