mirror of
https://github.com/holub/mame
synced 2025-05-29 17:13:05 +03:00
EEPROM device now looks for a matching memory region to fetch the
default values from. Fixed bug in ROM loader that would change the memory region flags to match devices with no address bus. Updated groundfx to use the new default loading scheme.
This commit is contained in:
parent
656c6e1f2e
commit
7eace0d29e
@ -343,6 +343,13 @@ void eepromdev_set_data(const device_config *device, const UINT8 *data, int leng
|
||||
|
||||
assert(length <= ((1 << eestate->intf->address_bits) * eestate->intf->data_bits / 8));
|
||||
memcpy(eestate->data, data, length);
|
||||
/* temporary: write data to eeprom.bin when this happens so we capture it
|
||||
for adding to a region */
|
||||
{
|
||||
FILE *f = fopen("eeprom.bin", "wb");
|
||||
fwrite(eestate->data, 1, (1 << eestate->intf->address_bits) * eestate->intf->data_bits / 8, f);
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
|
||||
void *eepromdev_get_data_pointer(const device_config *device, UINT32 *length, UINT32 *size)
|
||||
@ -375,6 +382,7 @@ static DEVICE_START(eeprom)
|
||||
{
|
||||
eeprom_state *eestate = get_safe_token(device);
|
||||
const eeprom_config *config;
|
||||
UINT8 *region_base;
|
||||
|
||||
/* validate some basic stuff */
|
||||
assert(device != NULL);
|
||||
@ -394,6 +402,22 @@ static DEVICE_START(eeprom)
|
||||
memset(eestate->data, 0xff, (1 << eestate->intf->address_bits) * eestate->intf->data_bits / 8);
|
||||
if ((config->default_data != NULL) && (config->default_data_size != 0))
|
||||
eepromdev_set_data(device, config->default_data, config->default_data_size);
|
||||
|
||||
region_base = memory_region(device->machine, device->tag);
|
||||
if (region_base != NULL)
|
||||
{
|
||||
UINT32 region_length = memory_region_length(device->machine, device->tag);
|
||||
UINT32 region_flags = memory_region_flags(device->machine, device->tag);
|
||||
|
||||
if (region_length != (1 << eestate->intf->address_bits) * eestate->intf->data_bits / 8)
|
||||
fatalerror("eeprom region '%s' wrong size (expected size = 0x%X)", device->tag, (1 << eestate->intf->address_bits) * eestate->intf->data_bits / 8);
|
||||
if (eestate->intf->data_bits == 8 && (region_flags & ROMREGION_WIDTHMASK) != ROMREGION_8BIT)
|
||||
fatalerror("eeprom region '%s' needs to be an 8-bit region", device->tag);
|
||||
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, region_flags);
|
||||
memcpy(eestate->data, region_base, region_length);
|
||||
}
|
||||
|
||||
eestate->serial_count = 0;
|
||||
eestate->latch = 0;
|
||||
eestate->reset_line = ASSERT_LINE;
|
||||
|
@ -1242,7 +1242,7 @@ static void process_disk_entries(rom_load_data *romdata, const char *regiontag,
|
||||
static UINT32 normalize_flags_for_cpu(running_machine *machine, UINT32 startflags, const char *rgntag)
|
||||
{
|
||||
const device_config *device = cputag_get_cpu(machine, rgntag);
|
||||
if (device != NULL)
|
||||
if (device != NULL && cpu_get_databus_width(device, ADDRESS_SPACE_PROGRAM) != 0)
|
||||
{
|
||||
int buswidth;
|
||||
|
||||
|
@ -115,18 +115,6 @@ static TIMER_CALLBACK( groundfx_interrupt5 )
|
||||
EPROM
|
||||
**********************************************************/
|
||||
|
||||
static const UINT8 default_eeprom[128]=
|
||||
{
|
||||
0x62,0x11,0x00,0x00,0x00,0x00,0x01,0x00,0x80,0x80,0x30,0x05,0x00,0x00,0x96,0x14,
|
||||
0x17,0x70,0x35,0xcd,0x75,0x30,0x24,0xaa,0x75,0x30,0x51,0xd9,0x75,0x30,0x2d,0x2b,
|
||||
0x75,0x30,0x51,0xb9,0x00,0x00,0xe0,0xa0,0x17,0x70,0x35,0xcd,0x75,0x30,0x24,0xaa,
|
||||
0x75,0x30,0x51,0xd9,0x75,0x30,0x2d,0x2b,0x75,0x30,0x51,0xb9,0x00,0x00,0xff,0xff,
|
||||
0x17,0x70,0x35,0xcd,0x75,0x30,0x24,0xaa,0x75,0x30,0x51,0xd9,0x75,0x30,0x2d,0x2b,
|
||||
0x75,0x30,0x51,0xb9,0xff,0xff,0xff,0xff,0x17,0x70,0x35,0xcd,0x75,0x30,0x24,0xaa,
|
||||
0x75,0x30,0x51,0xd9,0x75,0x30,0x2d,0x2b,0x75,0x30,0x51,0xb9,0xff,0xff,0xff,0xff,
|
||||
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
|
||||
};
|
||||
|
||||
static const eeprom_interface groundfx_eeprom_interface =
|
||||
{
|
||||
6, /* address bits */
|
||||
@ -366,8 +354,7 @@ static MACHINE_DRIVER_START( groundfx )
|
||||
MDRV_CPU_PROGRAM_MAP(groundfx_map)
|
||||
MDRV_CPU_VBLANK_INT("screen", groundfx_interrupt)
|
||||
|
||||
// MDRV_NVRAM_HANDLER(groundfx)
|
||||
MDRV_EEPROM_ADD("eeprom", groundfx_eeprom_interface, 128, default_eeprom)
|
||||
MDRV_EEPROM_NODEFAULT_ADD("eeprom", groundfx_eeprom_interface)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
@ -425,6 +412,9 @@ ROM_START( groundfx )
|
||||
ROM_REGION16_BE( 0x1000000, "ensoniq.0", ROMREGION_ERASE00 )
|
||||
ROM_LOAD16_BYTE( "d51-01.73", 0x000000, 0x200000, CRC(92f09155) SHA1(8015e1997818bb480174394eb43840bf26679bcf) ) /* Ensoniq samples */
|
||||
ROM_LOAD16_BYTE( "d51-02.74", 0xc00000, 0x200000, CRC(20a9428f) SHA1(c9033d02a49c72f704808f5f899101617d5814e5) )
|
||||
|
||||
ROM_REGION16_BE( 0x80, "eeprom", 0 )
|
||||
ROM_LOAD( "eeprom.bin", 0x0000, 0x0080, CRC(6f58851d) SHA1(33bd4478f097dca6b5d222adb89699c6d35ed009) )
|
||||
ROM_END
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user