diff options
author | 2010-01-16 00:53:57 +0000 | |
---|---|---|
committer | 2010-01-16 00:53:57 +0000 | |
commit | d35a800134bd09dfc8cf5df9d35e2fd3ba150f92 (patch) | |
tree | 0be7bd189caa22be05f114be7ccd4ffa0ac5d517 /src/emu/machine/eeprom.c | |
parent | 51fd1fa8226a19c2b012faafa88f89dd3cd462f2 (diff) |
Added casting operators to the region_info class so you can assign
a region to a generic type pointer and have it automatically convert.
Also added a bytes() method which is safe if the region is NULL
(useful for saying machine->region("foo")->bytes() and not crashing
if foo doesn't exist).
Changed the region field in the device_config to be a region_info *,
and removed the regionbytes field. Updated all users of these fields
to use the new casting operators and bytes() methods instead.
Added subdevice and subregion methods to the device_config class, so
you can easily query for devices and regions that are device-specific.
The device prefix ("devicename:") is automatically prepended.
Diffstat (limited to 'src/emu/machine/eeprom.c')
-rw-r--r-- | src/emu/machine/eeprom.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/emu/machine/eeprom.c b/src/emu/machine/eeprom.c index a223226b618..e39bb075997 100644 --- a/src/emu/machine/eeprom.c +++ b/src/emu/machine/eeprom.c @@ -360,20 +360,18 @@ static DEVICE_NVRAM( eeprom ) /* populate from a memory region if present */ if (device->region != NULL) { - UINT32 region_flags = memory_region_flags(device->machine, device->tag.cstr()); - - if (device->regionbytes != eeprom_bytes) + if (device->region->length != eeprom_bytes) fatalerror("eeprom region '%s' wrong size (expected size = 0x%X)", device->tag.cstr(), eeprom_bytes); - if (eestate->intf->data_bits == 8 && (region_flags & ROMREGION_WIDTHMASK) != ROMREGION_8BIT) + if (eestate->intf->data_bits == 8 && (device->region->flags & ROMREGION_WIDTHMASK) != ROMREGION_8BIT) fatalerror("eeprom region '%s' needs to be an 8-bit region", device->tag.cstr()); - if (eestate->intf->data_bits == 16 && ((region_flags & ROMREGION_WIDTHMASK) != ROMREGION_16BIT || (region_flags & ROMREGION_ENDIANMASK) != ROMREGION_BE)) - fatalerror("eeprom region '%s' needs to be a 16-bit big-endian region (flags=%08x)", device->tag.cstr(), region_flags); + if (eestate->intf->data_bits == 16 && ((device->region->flags & ROMREGION_WIDTHMASK) != ROMREGION_16BIT || (device->region->flags & ROMREGION_ENDIANMASK) != ROMREGION_BE)) + fatalerror("eeprom region '%s' needs to be a 16-bit big-endian region (flags=%08x)", device->tag.cstr(), device->region->flags); for (offs = 0; offs < eeprom_length; offs++) if (eestate->intf->data_bits == 8) - memory_write_byte(device->space(), offs, device->region[offs]); + memory_write_byte(device->space(), offs, device->region->base.u8[offs]); else - memory_write_word(device->space(), offs * 2, ((UINT16 *)device->region)[offs]); + memory_write_word(device->space(), offs * 2, device->region->base.u16[offs]); } } } |