diff options
author | 2008-10-01 16:36:04 +0000 | |
---|---|---|
committer | 2008-10-01 16:36:04 +0000 | |
commit | 34cd80a8e5da70c51124cd040b8137fa2b57c055 (patch) | |
tree | da0b6cc0fec5446d8f3ec7b8a075443ce84cf5fc /src/emu/machine/8255ppi.h | |
parent | 8515504a7b8ccb6399c5ef51bd671059595ccb95 (diff) |
Added mechanism to generically specify input port tags in place of
machine/device handlers. Unfortunately, the implementation relies on
sentinel values to distinguish a port tag versus a pointer to function
code. However, since this is a very common situation, it will hopefully
be worth the slight grossness. New macros are defined in inptport.h:
DEVICE8_PORT(name) - use this to specify the name of a port to read
wherever a read8_device_func would normally be used
MACHINE8_PORT(name) - same as DEVICE8_PORT except it can be used
wherever a read8_machine_func would normally be used
IS_HANDLER_PORT(ptr) - accepts a read8_device_func or read8_machine_func
and determines if it is an actual function or a reference to a port;
intended for use by devices that accept DEVICE8_PORT-style functions
CALL_DEVICE8_READ(ptr,device,offset) - either calls through the given
read8_device_func, or calls input_port_read with the appropriate
tag, depending on the result of IS_HANDLER_PORT; intended for use
by devices that accept DEVICE8_PORT-style functions
CALL_MACHINE8_READ(ptr,machine,offset) - same as CALL_DEVICE8_READ
except for read8_machine_func
Note that in order for these to be useful, the consumer of the function
pointer must be enhanced to use the CALL_* macros above instead of directly
calling through the function. So far, only the 8255 PPI is set up to do
this, as part of the cleanup below. Also note that the sentinel value is
currently 4 consecutive 0 bytes; this may need to change in the future, in
either length or value, so it is important to stick to the macros above.
8255 PPI interface cleanup:
- added MDRV_PPI8255_ADD, MDRV_PPI8255_RECONFIG and
MDRV_PPI8255_REMOVE macros; updated all drivers to use them
- changed callbacks to device read/write handlers intead of
machine read/write handlers; updated all drivers accordingly
- normalized function and variable names to be lower_under
- removed a number of redundant interfaces from the galaxian/
scamble line of games
LD-V1000: added some (compile-time removed) information about the
ROM and memory map
Diffstat (limited to 'src/emu/machine/8255ppi.h')
-rw-r--r-- | src/emu/machine/8255ppi.h | 56 |
1 files changed, 39 insertions, 17 deletions
diff --git a/src/emu/machine/8255ppi.h b/src/emu/machine/8255ppi.h index 5cd96f1bf4c..1d8097a506b 100644 --- a/src/emu/machine/8255ppi.h +++ b/src/emu/machine/8255ppi.h @@ -12,15 +12,37 @@ #define PPI8255 DEVICE_GET_INFO_NAME(ppi8255) -typedef struct +/*************************************************************************** + TYPE DEFINITIONS +***************************************************************************/ + +typedef struct _ppi8255_interface ppi8255_interface; +struct _ppi8255_interface { - read8_machine_func portAread; - read8_machine_func portBread; - read8_machine_func portCread; - write8_machine_func portAwrite; - write8_machine_func portBwrite; - write8_machine_func portCwrite; -} ppi8255_interface; + read8_device_func port_a_read; + read8_device_func port_b_read; + read8_device_func port_c_read; + write8_device_func port_a_write; + write8_device_func port_b_write; + write8_device_func port_c_write; +}; + + +/*************************************************************************** + DEVICE CONFIGURATION MACROS +***************************************************************************/ + +#define MDRV_PPI8255_ADD(_tag, _intrf) \ + MDRV_DEVICE_ADD(_tag, PPI8255) \ + MDRV_DEVICE_CONFIG(_intrf) + +#define MDRV_PPI8255_RECONFIG(_tag, _intrf) \ + MDRV_DEVICE_MODIFY(_tag, PPI8255) \ + MDRV_DEVICE_CONFIG(_intrf) + +#define MDRV_PPI8255_REMOVE(_tag) \ + MDRV_DEVICE_REMOVE(_tag, PPI8255) + /* device interface */ @@ -30,17 +52,17 @@ READ8_DEVICE_HANDLER( ppi8255_r ); WRITE8_DEVICE_HANDLER( ppi8255_w ); -void ppi8255_set_portAread( const device_config *device, read8_machine_func portAread ); -void ppi8255_set_portBread( const device_config *device, read8_machine_func portBread ); -void ppi8255_set_portCread( const device_config *device, read8_machine_func portCread ); +void ppi8255_set_port_a_read( const device_config *device, read8_device_func port_a_read ); +void ppi8255_set_port_b_read( const device_config *device, read8_device_func port_b_read ); +void ppi8255_set_port_c_read( const device_config *device, read8_device_func port_c_read ); -void ppi8255_set_portAwrite( const device_config *device, write8_machine_func portAwrite ); -void ppi8255_set_portBwrite( const device_config *device, write8_machine_func portBwrite ); -void ppi8255_set_portCwrite( const device_config *device, write8_machine_func portCwrite ); +void ppi8255_set_portAwrite( const device_config *device, write8_device_func port_a_write ); +void ppi8255_set_portBwrite( const device_config *device, write8_device_func port_b_write ); +void ppi8255_set_portCwrite( const device_config *device, write8_device_func port_c_write ); -void ppi8255_set_portA( const device_config *device, UINT8 data ); -void ppi8255_set_portB( const device_config *device, UINT8 data ); -void ppi8255_set_portC( const device_config *device, UINT8 data ); +void ppi8255_set_port_a( const device_config *device, UINT8 data ); +void ppi8255_set_port_b( const device_config *device, UINT8 data ); +void ppi8255_set_port_c( const device_config *device, UINT8 data ); UINT8 ppi8255_get_portA( const device_config *device ); UINT8 ppi8255_get_portB( const device_config *device ); |