From ea72b5770dd11276b3c35d87bf322ea9cd9ceb04 Mon Sep 17 00:00:00 2001 From: Fabio Priuli Date: Wed, 18 Nov 2009 13:26:30 +0000 Subject: [PATCH] Added tentative PORT_CUSTOM(eepromdev_bit_r) for EEPROM devices. Not 100% sure this is the better way to implement this (we pass the eeprom tag as parameter of the PORT_CUSTOM), but I haven't been able to find a better solution. No driver uses this yet, so I'm open to any suggestion before to use it extensively ;) --- src/emu/machine/eepromdev.c | 10 +++++++--- src/emu/machine/eepromdev.h | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/emu/machine/eepromdev.c b/src/emu/machine/eepromdev.c index a98a0fade10..1ea81effaea 100644 --- a/src/emu/machine/eepromdev.c +++ b/src/emu/machine/eepromdev.c @@ -279,10 +279,14 @@ int eepromdev_read_bit(const device_config *device) return res; } -/*CUSTOM_INPUT( eeprom_bit_r ) +CUSTOM_INPUT( eepromdev_bit_r ) { - return eeprom_read_bit(); -}*/ + const char *devtag = (const char *)param; + const device_config *eeprom = devtag_get_device(field->port->machine, devtag); + + /* we test if the device is indeed an eeprom when calling this device handler */ + return eepromdev_read_bit(eeprom); +} void eepromdev_set_cs_line(const device_config *device, int state) { diff --git a/src/emu/machine/eepromdev.h b/src/emu/machine/eepromdev.h index beb383d565c..56ba586cb80 100644 --- a/src/emu/machine/eepromdev.h +++ b/src/emu/machine/eepromdev.h @@ -61,7 +61,7 @@ extern UINT8 *eeprom_empty_default_data; void eepromdev_write_bit( const device_config *device, int bit ); int eepromdev_read_bit( const device_config *device ); -//CUSTOM_INPUT( eeprom_bit_r ); +CUSTOM_INPUT( eepromdev_bit_r ); void eepromdev_set_cs_line( const device_config *device, int state ); void eepromdev_set_clock_line( const device_config *device, int state );