Added new module devcb, which can generically handle conversions between device

read/write functions and various other types of functions. Introduced new
structures and macros to make this possible. 

To take advantage of this, a device must change its interface to replace and 
read/write callbacks with the new devcb_read/write structures. During device 
start time, the device then uses this new devcb module to resolve the information 
in the devcb_read/write structures into a more efficient form. When the device 
needs to call one of the callbacks, it uses the inline devcb_call_read/write 
functions.

Once a device has defined its callbacks as devcb_read/write structures, users
of the device must use the DEVCB_* macros to specify the type and information
about the handler to use:

   DEVCB_NULL = no handler
   DEVCB_HANDLER = a standard device read/write handler
   DEVCB_MEMORY_HANDLER = a memory address space read/write handler
   DEVCB_DEVICE_HANDLER = a device read/write handler for a different device
   DEVCB_INPUT_PORT = an input port

Converted the 8255PPI device to use this new structure, and updated all users
to use the DEVCB macros, removing some unnecessary trampoline functions along
the way.
This commit is contained in:
Aaron Giles 2009-01-26 16:25:48 +00:00
parent 6640f6d8da
commit 2fd8c5122b
47 changed files with 1187 additions and 707 deletions

2
.gitattributes vendored
View File

@ -505,6 +505,8 @@ src/emu/debug/textbuf.h svneol=native#text/plain
src/emu/debugger.c svneol=native#text/plain
src/emu/debugger.h svneol=native#text/plain
src/emu/deprecat.h svneol=native#text/plain
src/emu/devcb.c svneol=native#text/plain
src/emu/devcb.h svneol=native#text/plain
src/emu/devconv.h svneol=native#text/plain
src/emu/devintrf.c svneol=native#text/plain
src/emu/devintrf.h svneol=native#text/plain

262
src/emu/devcb.c Normal file
View File

@ -0,0 +1,262 @@
/***************************************************************************
devcb.c
Device callback interface helpers.
Copyright Nicola Salmoria and the MAME Team.
Visit http://mamedev.org for licensing and usage restrictions.
***************************************************************************/
#include "devcb.h"
#include "driver.h"
/***************************************************************************
STATIC-TO-LIVE CONVERSION
***************************************************************************/
/*-------------------------------------------------
devcb_resolve_read_line - convert a static
read line definition to a live definition
-------------------------------------------------*/
static READ_LINE_DEVICE_HANDLER( trampoline_read_port_to_read_line )
{
return (input_port_read_direct((const input_port_config *)device) & 1) ? ASSERT_LINE : CLEAR_LINE;
}
static READ_LINE_DEVICE_HANDLER( trampoline_read8_to_read_line )
{
const devcb_resolved_read_line *resolved = (const devcb_resolved_read_line *)device;
return ((*resolved->real.readdevice)(resolved->realtarget, 0) & 1) ? ASSERT_LINE : CLEAR_LINE;
}
void devcb_resolve_read_line(devcb_resolved_read_line *resolved, const devcb_read_line *config, const device_config *device)
{
/* reset the resolved structure */
memset(resolved, 0, sizeof(*resolved));
/* input port handlers */
if (config->type == DEVCB_TYPE_INPUT)
{
resolved->target = input_port_by_tag(device->machine->portconfig, config->tag);
if (resolved->target == NULL)
fatalerror("devcb_resolve_read_line: unable to find input port '%s' (requested by %s '%s')", config->tag, device_get_name(device), device->tag);
resolved->read = trampoline_read_port_to_read_line;
}
/* address space handlers */
else if (config->type >= DEVCB_TYPE_MEMORY(ADDRESS_SPACE_PROGRAM) && config->type < DEVCB_TYPE_MEMORY(ADDRESS_SPACES) && config->readspace != NULL)
{
FPTR space = (FPTR)config->type - (FPTR)DEVCB_TYPE_MEMORY(ADDRESS_SPACE_PROGRAM);
const device_config *cpu = cputag_get_cpu(device->machine, config->tag);
if (cpu == NULL)
fatalerror("devcb_resolve_read_line: unable to find CPU '%s' (requested by %s '%s')", config->tag, device_get_name(device), device->tag);
resolved->target = resolved;
resolved->read = trampoline_read8_to_read_line;
resolved->realtarget = memory_find_address_space(cpu, space);
if (resolved->realtarget == NULL)
fatalerror("devcb_resolve_read_line: unable to find CPU '%s' %s space (requested by %s '%s')", config->tag, address_space_names[space], device_get_name(device), device->tag);
resolved->real.readspace = config->readspace;
}
/* device handlers */
else if (config->type != NULL && (config->readline != NULL || config->readdevice != NULL))
{
resolved->target = (config->type == DEVCB_TYPE_SELF) ? device : devtag_get_device(device->machine, config->type, config->tag);
if (resolved->target == NULL)
fatalerror("devcb_resolve_read_line: unable to find %s '%s' (requested by %s '%s')", devtype_get_name(config->type), config->tag, device_get_name(device), device->tag);
/* read_line to read_line is direct */
if (config->readline != NULL)
resolved->read = config->readline;
/* read_line to handler goes through a trampoline */
else
{
resolved->realtarget = resolved->target;
resolved->real.readdevice = config->readdevice;
resolved->target = resolved;
resolved->read = trampoline_read8_to_read_line;
}
}
}
/*-------------------------------------------------
devcb_resolve_write_line - convert a static
write line definition to a live definition
-------------------------------------------------*/
static WRITE_LINE_DEVICE_HANDLER( trampoline_write8_to_write_line )
{
const devcb_resolved_write_line *resolved = (const devcb_resolved_write_line *)device;
(*resolved->real.writedevice)(resolved->realtarget, 0, state);
}
void devcb_resolve_write_line(devcb_resolved_write_line *resolved, const devcb_write_line *config, const device_config *device)
{
/* reset the resolved structure */
memset(resolved, 0, sizeof(*resolved));
/* address space handlers */
if (config->type >= DEVCB_TYPE_MEMORY(ADDRESS_SPACE_PROGRAM) && config->type < DEVCB_TYPE_MEMORY(ADDRESS_SPACES) && config->writespace != NULL)
{
FPTR space = (FPTR)config->type - (FPTR)DEVCB_TYPE_MEMORY(ADDRESS_SPACE_PROGRAM);
const device_config *cpu = cputag_get_cpu(device->machine, config->tag);
if (cpu == NULL)
fatalerror("devcb_resolve_write_line: unable to find CPU '%s' (requested by %s '%s')", config->tag, device_get_name(device), device->tag);
resolved->target = resolved;
resolved->write = trampoline_write8_to_write_line;
resolved->realtarget = memory_find_address_space(cpu, space);
if (resolved->realtarget == NULL)
fatalerror("devcb_resolve_write_line: unable to find CPU '%s' %s space (requested by %s '%s')", config->tag, address_space_names[space], device_get_name(device), device->tag);
resolved->real.writespace = config->writespace;
}
/* device handlers */
else if (config->type != NULL && (config->writeline != NULL || config->writedevice != NULL))
{
resolved->target = (config->type == DEVCB_TYPE_SELF) ? device : devtag_get_device(device->machine, config->type, config->tag);
if (resolved->target == NULL)
fatalerror("devcb_resolve_write_line: unable to find %s '%s' (requested by %s '%s')", devtype_get_name(config->type), config->tag, device_get_name(device), device->tag);
/* write_line to write_line is direct */
if (config->writeline != NULL)
resolved->write = config->writeline;
/* write_line to handler goes through a trampoline */
else
{
resolved->realtarget = resolved->target;
resolved->real.writedevice = config->writedevice;
resolved->target = resolved;
resolved->write = trampoline_write8_to_write_line;
}
}
}
/*-------------------------------------------------
devcb_resolve_read8 - convert a static
8-bit read definition to a live definition
-------------------------------------------------*/
static READ8_DEVICE_HANDLER( trampoline_read_port_to_read8 )
{
return input_port_read_direct((const input_port_config *)device);
}
static READ8_DEVICE_HANDLER( trampoline_read_line_to_read8 )
{
const devcb_resolved_read8 *resolved = (const devcb_resolved_read8 *)device;
return (*resolved->real.readline)(resolved->realtarget);
}
void devcb_resolve_read8(devcb_resolved_read8 *resolved, const devcb_read8 *config, const device_config *device)
{
/* reset the resolved structure */
memset(resolved, 0, sizeof(*resolved));
/* input port handlers */
if (config->type == DEVCB_TYPE_INPUT)
{
resolved->target = input_port_by_tag(device->machine->portconfig, config->tag);
if (resolved->target == NULL)
fatalerror("devcb_resolve_read8: unable to find input port '%s' (requested by %s '%s')", config->tag, device_get_name(device), device->tag);
resolved->read = trampoline_read_port_to_read8;
}
/* address space handlers */
else if (config->type >= DEVCB_TYPE_MEMORY(ADDRESS_SPACE_PROGRAM) && config->type < DEVCB_TYPE_MEMORY(ADDRESS_SPACES) && config->readspace != NULL)
{
FPTR space = (FPTR)config->type - (FPTR)DEVCB_TYPE_MEMORY(ADDRESS_SPACE_PROGRAM);
const device_config *cpu = cputag_get_cpu(device->machine, config->tag);
if (cpu == NULL)
fatalerror("devcb_resolve_read8: unable to find CPU '%s' (requested by %s '%s')", config->tag, device_get_name(device), device->tag);
resolved->target = memory_find_address_space(cpu, space);
if (resolved->target == NULL)
fatalerror("devcb_resolve_read8: unable to find CPU '%s' %s space (requested by %s '%s')", config->tag, address_space_names[space], device_get_name(device), device->tag);
resolved->read = (read8_device_func)config->readspace;
}
/* device handlers */
else if (config->type != NULL && (config->readline != NULL || config->readdevice != NULL))
{
resolved->target = (config->type == DEVCB_TYPE_SELF) ? device : devtag_get_device(device->machine, config->type, config->tag);
if (resolved->target == NULL)
fatalerror("devcb_resolve_read8: unable to find %s '%s' (requested by %s '%s')", devtype_get_name(config->type), config->tag, device_get_name(device), device->tag);
/* read8 to read8 is direct */
if (config->readdevice != NULL)
resolved->read = config->readdevice;
/* read8 to read_line goes through a trampoline */
else
{
resolved->realtarget = resolved->target;
resolved->real.readline = config->readline;
resolved->target = resolved;
resolved->read = trampoline_read_line_to_read8;
}
}
}
/*-------------------------------------------------
devcb_resolve_write8 - convert a static
8-bit write definition to a live definition
-------------------------------------------------*/
static WRITE8_DEVICE_HANDLER( trampoline_write_line_to_write8 )
{
const devcb_resolved_write8 *resolved = (const devcb_resolved_write8 *)device;
(*resolved->real.writeline)(resolved->realtarget, (data & 1) ? ASSERT_LINE : CLEAR_LINE);
}
void devcb_resolve_write8(devcb_resolved_write8 *resolved, const devcb_write8 *config, const device_config *device)
{
/* reset the resolved structure */
memset(resolved, 0, sizeof(*resolved));
/* address space handlers */
if (config->type >= DEVCB_TYPE_MEMORY(ADDRESS_SPACE_PROGRAM) && config->type < DEVCB_TYPE_MEMORY(ADDRESS_SPACES) && config->writespace != NULL)
{
FPTR space = (FPTR)config->type - (FPTR)DEVCB_TYPE_MEMORY(ADDRESS_SPACE_PROGRAM);
const device_config *cpu = cputag_get_cpu(device->machine, config->tag);
if (cpu == NULL)
fatalerror("devcb_resolve_write8: unable to find CPU '%s' (requested by %s '%s')", config->tag, device_get_name(device), device->tag);
resolved->target = memory_find_address_space(cpu, space);
if (resolved->target == NULL)
fatalerror("devcb_resolve_write8: unable to find CPU '%s' %s space (requested by %s '%s')", config->tag, address_space_names[space], device_get_name(device), device->tag);
resolved->write = (write8_device_func)config->writespace;
}
/* device handlers */
else if (config->type != NULL && (config->writeline != NULL || config->writedevice != NULL))
{
resolved->target = (config->type == DEVCB_TYPE_SELF) ? device : devtag_get_device(device->machine, config->type, config->tag);
if (resolved->target == NULL)
fatalerror("devcb_resolve_write8: unable to find %s '%s' (requested by %s '%s')", devtype_get_name(config->type), config->tag, device_get_name(device), device->tag);
/* write8 to write8 is direct */
if (config->writedevice != NULL)
resolved->write = config->writedevice;
/* write8 to write_line goes through a trampoline */
else
{
resolved->realtarget = resolved->target;
resolved->real.writeline = config->writeline;
resolved->target = resolved;
resolved->write = trampoline_write_line_to_write8;
}
}
}

265
src/emu/devcb.h Normal file
View File

@ -0,0 +1,265 @@
/***************************************************************************
devcb.h
Device callback interface helpers.
Copyright Nicola Salmoria and the MAME Team.
Visit http://mamedev.org for licensing and usage restrictions.
****************************************************************************
These functions are used to adapt multiple read/write handler types
to be used with device I/O. In general, a device is expected to
declare its desired callback type, and these functions allow other
callback types to be adapted appropriately.
The desired callback types currently supported include:
read_line_device_func: (device)
write_line_device_func: (device, data)
read8_device_func: (device, offset)
write8_device_func: (device, offset, data)
The adapted callback types supported are:
input port (port)
read_line_device_func: (device)
write_line_device_func: (device, data)
read8_device_func: (device, offset)
write8_device_func: (device, offset, data)
read8_space_func: (space, offset)
write8_space_func: (space, offset, data)
***************************************************************************/
#pragma once
#ifndef __DEVCB_H__
#define __DEVCB_H__
#include "devintrf.h"
#include "memory.h"
/***************************************************************************
CONSTANTS
***************************************************************************/
#define DEVCB_TYPE_SELF ((device_type)1)
#define DEVCB_TYPE_INPUT ((device_type)2)
#define DEVCB_TYPE_MEMORY(space) ((device_type)(4 + (space)))
/***************************************************************************
MACROS
***************************************************************************/
#define DEVCB_NULL { 0 }
/* standard line or read/write handlers with the calling device passed */
#define DEVCB_LINE(func) { DEVCB_TYPE_SELF, NULL, (func), NULL, NULL }
#define DEVCB_HANDLER(func) { DEVCB_TYPE_SELF, NULL, NULL, (func), NULL }
/* line or read/write handlers for another device */
#define DEVCB_DEVICE_LINE(type,tag,func) { type, tag, (func), NULL, NULL }
#define DEVCB_DEVICE_HANDLER(type,tag,func) { type, tag, NULL, (func), NULL }
/* read/write handlers for a given CPU's address space */
#define DEVCB_MEMORY_HANDLER(cpu,space,func) { DEVCB_TYPE_MEMORY(ADDRESS_SPACE_##space), (cpu), NULL, NULL, (func) }
/* read handlers for an I/O port by tag */
#define DEVCB_INPUT_PORT(tag) { DEVCB_TYPE_INPUT, (tag), NULL, NULL, NULL }
/* macros for defining read_line/write_line functions */
#define READ_LINE_DEVICE_HANDLER(name) int name(ATTR_UNUSED const device_config *device)
#define WRITE_LINE_DEVICE_HANDLER(name) void name(ATTR_UNUSED const device_config *device, ATTR_UNUSED int state)
/***************************************************************************
TYPE DEFINITIONS
***************************************************************************/
/* read/write types for I/O lines (similar to read/write handlers but no offset) */
typedef int (*read_line_device_func)(const device_config *device);
typedef void (*write_line_device_func)(const device_config *device, int state);
/* static structure used for device configuration when the desired callback type is a read_line_device_func */
typedef struct _devcb_read_line devcb_read_line;
struct _devcb_read_line
{
device_type type; /* device type of target, or one of the special DEVCB_TYPE values */
const char * tag; /* tag of target, where appropriate */
read_line_device_func readline; /* read line function */
read8_device_func readdevice; /* read device function */
read8_space_func readspace; /* read space function */
};
typedef struct _devcb_resolved_read_line devcb_resolved_read_line;
struct _devcb_resolved_read_line
{
const void * target; /* target object */
read_line_device_func read; /* read line function */
const void * realtarget; /* real target object for stubs */
union
{
read8_device_func readdevice;
read8_space_func readspace;
} real; /* real read function for stubs */
};
/* static structure used for device configuration when the desired callback type is a write_line_device_func */
typedef struct _devcb_write_line devcb_write_line;
struct _devcb_write_line
{
device_type type; /* device type of target, or one of the special DEVCB_TYPE values */
const char * tag; /* tag of target, where appropriate */
write_line_device_func writeline; /* write line function */
write8_device_func writedevice; /* write device function */
write8_space_func writespace; /* write space function */
};
typedef struct _devcb_resolved_write_line devcb_resolved_write_line;
struct _devcb_resolved_write_line
{
const void * target; /* target object */
write_line_device_func write; /* write line function */
const void * realtarget; /* real target object for stubs */
union
{
write8_device_func writedevice;
write8_space_func writespace;
} real; /* real write function for stubs */
};
/* static structure used for device configuration when the desired callback type is a read8_device_func */
typedef struct _devcb_read8 devcb_read8;
struct _devcb_read8
{
device_type type; /* device type of target, or one of the special DEVCB_TYPE values */
const char * tag; /* tag of target, where appropriate */
read_line_device_func readline; /* read line function */
read8_device_func readdevice; /* read device function */
read8_space_func readspace; /* read space function */
};
typedef struct _devcb_resolved_read8 devcb_resolved_read8;
struct _devcb_resolved_read8
{
const void * target; /* target object */
read8_device_func read; /* read function */
const void * realtarget; /* real target object for stubs */
union
{
read8_device_func readdevice;
read8_space_func readspace;
read_line_device_func readline;
} real; /* real read function for stubs */
};
/* static structure used for device configuration when the desired callback type is a write8_device_func */
typedef struct _devcb_write8 devcb_write8;
struct _devcb_write8
{
device_type type; /* device type of target, or one of the special DEVCB_TYPE values */
const char * tag; /* tag of target, where appropriate */
write_line_device_func writeline; /* write line function */
write8_device_func writedevice; /* write device function */
write8_space_func writespace; /* write space function */
};
typedef struct _devcb_resolved_write8 devcb_resolved_write8;
struct _devcb_resolved_write8
{
const void * target; /* target object */
write8_device_func write; /* write function */
const void * realtarget; /* real target object for stubs */
union
{
write8_device_func writedevice;
write8_space_func writespace;
write_line_device_func writeline;
} real; /* real write function for stubs */
};
/***************************************************************************
FUNCTION PROTOTYPES
***************************************************************************/
/* ----- static-to-live conversion ----- */
/* convert a static read line definition to a live definition */
void devcb_resolve_read_line(devcb_resolved_read_line *resolved, const devcb_read_line *config, const device_config *device);
/* convert a static write line definition to a live definition */
void devcb_resolve_write_line(devcb_resolved_write_line *resolved, const devcb_write_line *config, const device_config *device);
/* convert a static 8-bit read definition to a live definition */
void devcb_resolve_read8(devcb_resolved_read8 *resolved, const devcb_read8 *config, const device_config *device);
/* convert a static 8-bit write definition to a live definition */
void devcb_resolve_write8(devcb_resolved_write8 *resolved, const devcb_write8 *config, const device_config *device);
/***************************************************************************
INLINE FUNCTIONS
***************************************************************************/
/*-------------------------------------------------
devcb_call_read_line - call through a
resolved read_line handler
-------------------------------------------------*/
INLINE int devcb_call_read_line(const devcb_resolved_read_line *resolved)
{
return (resolved->read != NULL) ? (*resolved->read)(resolved->target) : 0;
}
/*-------------------------------------------------
devcb_call_read8 - call through a
resolved read8 handler
-------------------------------------------------*/
INLINE int devcb_call_read8(const devcb_resolved_read8 *resolved, offs_t offset)
{
return (resolved->read != NULL) ? (*resolved->read)(resolved->target, offset) : 0;
}
/*-------------------------------------------------
devcb_call_write_line - call through a
resolved write_line handler
-------------------------------------------------*/
INLINE void devcb_call_write_line(const devcb_resolved_write_line *resolved, int state)
{
if (resolved->write != NULL)
(*resolved->write)(resolved->target, state);
}
/*-------------------------------------------------
devcb_call_write8 - call through a
resolved write8 handler
-------------------------------------------------*/
INLINE void devcb_call_write8(const devcb_resolved_write8 *resolved, offs_t offset, UINT8 data)
{
if (resolved->write != NULL)
(*resolved->write)(resolved->target, offset, data);
}
#endif /* __DEVCB_H__ */

View File

@ -44,6 +44,7 @@ EMUOBJS = \
$(EMUOBJ)/cpuexec.o \
$(EMUOBJ)/crsshair.o \
$(EMUOBJ)/debugger.o \
$(EMUOBJ)/devcb.o \
$(EMUOBJ)/devintrf.o \
$(EMUOBJ)/drawgfx.o \
$(EMUOBJ)/driver.o \

View File

@ -99,8 +99,8 @@ struct _ppi8255
{
const ppi8255_interface *intf;
read8_device_func port_read[3];
write8_device_func port_write[3];
devcb_resolved_read8 port_read[3];
devcb_resolved_write8 port_write[3];
/* mode flags */
UINT8 group_a_mode;
@ -234,8 +234,8 @@ static UINT8 ppi8255_read_port(const device_config *device, int port)
if (ppi8255->in_mask[port])
{
if (ppi8255->port_read[port] != NULL)
ppi8255_input(device, port, CALL_DEVICE8_READ(ppi8255->port_read[port], device, 0));
if (ppi8255->port_read[port].read != NULL)
ppi8255_input(device, port, devcb_call_read8(&ppi8255->port_read[port], 0));
result |= ppi8255->read[port] & ppi8255->in_mask[port];
}
@ -287,8 +287,8 @@ static void ppi8255_write_port(const device_config *device, int port)
ppi8255_get_handshake_signals(ppi8255, 0, &write_data);
ppi8255->output[port] = write_data;
if (ppi8255->port_write[port] != NULL)
(*ppi8255->port_write[port])(device, 0, write_data);
if (ppi8255->port_write[port].write != NULL)
devcb_call_write8(&ppi8255->port_write[port], 0, write_data);
}
@ -351,47 +351,41 @@ WRITE8_DEVICE_HANDLER( ppi8255_w )
}
void ppi8255_set_port_a_read(const device_config *device, read8_device_func port_a_read)
void ppi8255_set_port_a_read(const device_config *device, const devcb_read8 *config)
{
ppi8255_t *ppi8255 = get_safe_token(device);
ppi8255->port_read[0] = port_a_read;
devcb_resolve_read8(&ppi8255->port_read[0], config, device);
}
void ppi8255_set_port_b_read(const device_config *device, read8_device_func port_b_read)
void ppi8255_set_port_b_read(const device_config *device, const devcb_read8 *config)
{
ppi8255_t *ppi8255 = get_safe_token(device);
ppi8255->port_read[1] = port_b_read;
devcb_resolve_read8(&ppi8255->port_read[1], config, device);
}
void ppi8255_set_port_c_read(const device_config *device, read8_device_func port_c_read)
void ppi8255_set_port_c_read(const device_config *device, const devcb_read8 *config)
{
ppi8255_t *ppi8255 = get_safe_token(device);
ppi8255->port_read[2] = port_c_read;
devcb_resolve_read8(&ppi8255->port_read[2], config, device);
}
void ppi8255_set_port_a_write(const device_config *device, write8_device_func port_a_write)
void ppi8255_set_port_a_write(const device_config *device, const devcb_write8 *config)
{
ppi8255_t *ppi8255 = get_safe_token(device);
ppi8255->port_write[0] = port_a_write;
devcb_resolve_write8(&ppi8255->port_write[0], config, device);
}
void ppi8255_set_port_b_write(const device_config *device, write8_device_func port_b_write)
void ppi8255_set_port_b_write(const device_config *device, const devcb_write8 *config)
{
ppi8255_t *ppi8255 = get_safe_token(device);
ppi8255->port_write[1] = port_b_write;
devcb_resolve_write8(&ppi8255->port_write[1], config, device);
}
void ppi8255_set_port_c_write(const device_config *device, write8_device_func port_c_write)
void ppi8255_set_port_c_write(const device_config *device, const devcb_write8 *config)
{
ppi8255_t *ppi8255 = get_safe_token(device);
ppi8255->port_write[2] = port_c_write;
devcb_resolve_write8(&ppi8255->port_write[2], config, device);
}
@ -509,13 +503,13 @@ static DEVICE_START( ppi8255 ) {
ppi8255->intf = device->static_config;
ppi8255->port_read[0] = ppi8255->intf->port_a_read;
ppi8255->port_read[1] = ppi8255->intf->port_b_read;
ppi8255->port_read[2] = ppi8255->intf->port_c_read;
devcb_resolve_read8(&ppi8255->port_read[0], &ppi8255->intf->port_a_read, device);
devcb_resolve_read8(&ppi8255->port_read[1], &ppi8255->intf->port_b_read, device);
devcb_resolve_read8(&ppi8255->port_read[2], &ppi8255->intf->port_c_read, device);
ppi8255->port_write[0] = ppi8255->intf->port_a_write;
ppi8255->port_write[1] = ppi8255->intf->port_b_write;
ppi8255->port_write[2] = ppi8255->intf->port_c_write;
devcb_resolve_write8(&ppi8255->port_write[0], &ppi8255->intf->port_a_write, device);
devcb_resolve_write8(&ppi8255->port_write[1], &ppi8255->intf->port_b_write, device);
devcb_resolve_write8(&ppi8255->port_write[2], &ppi8255->intf->port_c_write, device);
/* register for state saving */
state_save_register_device_item(device, 0, ppi8255->group_a_mode);

View File

@ -9,6 +9,9 @@
#ifndef __8255PPI_H_
#define __8255PPI_H_
#include "devcb.h"
#define PPI8255 DEVICE_GET_INFO_NAME(ppi8255)
@ -19,12 +22,12 @@
typedef struct _ppi8255_interface ppi8255_interface;
struct _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;
devcb_read8 port_a_read;
devcb_read8 port_b_read;
devcb_read8 port_c_read;
devcb_write8 port_a_write;
devcb_write8 port_b_write;
devcb_write8 port_c_write;
};
@ -52,13 +55,13 @@ READ8_DEVICE_HANDLER( ppi8255_r );
WRITE8_DEVICE_HANDLER( ppi8255_w );
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_port_a_read( const device_config *device, const devcb_read8 *config );
void ppi8255_set_port_b_read( const device_config *device, const devcb_read8 *config );
void ppi8255_set_port_c_read( const device_config *device, const devcb_read8 *config );
void ppi8255_set_port_a_write( const device_config *device, write8_device_func port_a_write );
void ppi8255_set_port_b_write( const device_config *device, write8_device_func port_b_write );
void ppi8255_set_port_c_write( const device_config *device, write8_device_func port_c_write );
void ppi8255_set_port_a_write( const device_config *device, const devcb_write8 *config );
void ppi8255_set_port_b_write( const device_config *device, const devcb_write8 *config );
void ppi8255_set_port_c_write( const device_config *device, const devcb_write8 *config );
void ppi8255_set_port_a( const device_config *device, UINT8 data );
void ppi8255_set_port_b( const device_config *device, UINT8 data );

View File

@ -136,15 +136,15 @@ ADDRESS_MAP_END
static const ppi8255_interface ppi0intf =
{
NULL, ppi0_portb_r, ppi0_portc_r,
ppi0_porta_w, NULL, ppi0_portc_w
DEVCB_NULL, DEVCB_HANDLER(ppi0_portb_r), DEVCB_HANDLER(ppi0_portc_r),
DEVCB_HANDLER(ppi0_porta_w), DEVCB_NULL, DEVCB_HANDLER(ppi0_portc_w)
};
static const ppi8255_interface ppi1intf =
{
ppi1_porta_r, NULL, NULL,
NULL, ppi1_portb_w, ppi1_portc_w
DEVCB_HANDLER(ppi1_porta_r), DEVCB_NULL, DEVCB_NULL,
DEVCB_NULL, DEVCB_HANDLER(ppi1_portb_w), DEVCB_HANDLER(ppi1_portc_w)
};

View File

@ -429,12 +429,12 @@ static const custom_sound_interface sega005_custom_interface =
static const ppi8255_interface ppi8255_005_intf =
{
NULL,
NULL,
NULL,
sega005_sound_a_w,
sega005_sound_b_w,
NULL
DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL,
DEVCB_HANDLER(sega005_sound_a_w),
DEVCB_HANDLER(sega005_sound_b_w),
DEVCB_NULL
};
@ -820,12 +820,12 @@ ADDRESS_MAP_END
static const ppi8255_interface monsterb_ppi_intf =
{
NULL,
NULL,
n7751_status_r,
monsterb_sound_a_w,
monsterb_sound_b_w,
n7751_command_w
DEVCB_NULL,
DEVCB_NULL,
DEVCB_HANDLER(n7751_status_r),
DEVCB_HANDLER(monsterb_sound_a_w),
DEVCB_HANDLER(monsterb_sound_b_w),
DEVCB_HANDLER(n7751_command_w)
};

View File

@ -69,20 +69,20 @@ static WRITE8_DEVICE_HANDLER( astinvad_sound2_w );
static const ppi8255_interface ppi8255_intf[2] =
{
{
DEVICE8_PORT("IN0"),
DEVICE8_PORT("IN1"),
DEVICE8_PORT("IN2"),
NULL,
NULL,
NULL
DEVCB_INPUT_PORT("IN0"),
DEVCB_INPUT_PORT("IN1"),
DEVCB_INPUT_PORT("IN2"),
DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL
},
{
NULL,
DEVICE8_PORT("CABINET"),
NULL,
astinvad_sound1_w,
astinvad_sound2_w,
NULL
DEVCB_NULL,
DEVCB_INPUT_PORT("CABINET"),
DEVCB_NULL,
DEVCB_HANDLER(astinvad_sound1_w),
DEVCB_HANDLER(astinvad_sound2_w),
DEVCB_NULL
}
};

View File

@ -136,20 +136,20 @@ static void create_analog_timers(running_machine *machine)
static const ppi8255_interface ppi8255_intf[2] =
{
{
NULL, /* Port A read */
NULL, /* Port B read */
NULL, /* Port C read */
NULL, /* Port A write */
NULL, /* Port B write */
NULL /* Port C write */
DEVCB_NULL, /* Port A read */
DEVCB_NULL, /* Port B read */
DEVCB_NULL, /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_NULL /* Port C write */
},
{
NULL, /* Port A read */
input_port_r, /* Port B read */
NULL, /* Port C read */
input_port_select_w, /* Port A write */
NULL, /* Port B write */
NULL /* sound effects, Port C write */
DEVCB_NULL, /* Port A read */
DEVCB_HANDLER(input_port_r),/* Port B read */
DEVCB_NULL, /* Port C read */
DEVCB_HANDLER(input_port_select_w), /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_NULL /* sound effects, Port C write */
}
};

View File

@ -190,20 +190,20 @@ static WRITE8_HANDLER( iowrite )
static const ppi8255_interface ppi8255_intf[2] =
{
{
dsr_r,
input_mux0_r,
NULL,
NULL,
NULL,
misc_w
DEVCB_HANDLER(dsr_r),
DEVCB_HANDLER(input_mux0_r),
DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL,
DEVCB_HANDLER(misc_w)
},
{
NULL,
NULL,
DEVICE8_PORT("IN0"),
sound_w,
pb_w,
shr_w
DEVCB_NULL,
DEVCB_NULL,
DEVCB_INPUT_PORT("IN0"),
DEVCB_HANDLER(sound_w),
DEVCB_HANDLER(pb_w),
DEVCB_HANDLER(shr_w)
}
};

View File

@ -122,12 +122,12 @@ static WRITE8_DEVICE_HANDLER( write_prtc )
static const ppi8255_interface ppi8255_intf =
{
DEVICE8_PORT("INPUTS"), /* Port A read */
NULL, /* Port B read */
NULL, /* Port C read */
NULL, /* Port A write */
NULL, /* Port B write */
write_prtc, /* Port C write */
DEVCB_INPUT_PORT("INPUTS"), /* Port A read */
DEVCB_NULL, /* Port B read */
DEVCB_NULL, /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_HANDLER(write_prtc), /* Port C write */
};
/*************************************

View File

@ -110,20 +110,20 @@ static WRITE8_DEVICE_HANDLER( sound_w )
static const ppi8255_interface ppi8255_intf[2] =
{
{
DEVICE8_PORT("DSWA"), /* Port A read */
port1_r, /* Port B read */
NULL, /* Port C read */
NULL, /* Port A write */
NULL, /* Port B write */
sound_w, /* Port C write */
DEVCB_INPUT_PORT("DSWA"), /* Port A read */
DEVCB_HANDLER(port1_r), /* Port B read */
DEVCB_NULL, /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_HANDLER(sound_w), /* Port C write */
},
{
DEVICE8_PORT("IN1"), /* Port A read */
NULL, /* Port B read */
portC_r, /* Port C read */
NULL, /* Port A write */
lamps_w, /* Port B write */
NULL /* Port C write */
DEVCB_INPUT_PORT("IN1"), /* Port A read */
DEVCB_NULL, /* Port B read */
DEVCB_HANDLER(portC_r), /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_HANDLER(lamps_w), /* Port B write */
DEVCB_NULL /* Port C write */
}
};

View File

@ -61,20 +61,10 @@ static READ8_DEVICE_HANDLER( ppi0_portc_r )
return (~(eeprom_read_bit()<<1) & 2);
}
static READ8_DEVICE_HANDLER( ppi0_porta_r )
{
return input_port_read(device->machine, "DSW1");
}
static READ8_DEVICE_HANDLER( ppi0_portb_r )
{
return input_port_read(device->machine, "IN2");
}
static const ppi8255_interface ppi0intf =
{
ppi0_porta_r, ppi0_portb_r, ppi0_portc_r,
NULL, NULL, ppi0_portc_w
DEVCB_INPUT_PORT("DSW1"), DEVCB_INPUT_PORT("IN2"), DEVCB_HANDLER(ppi0_portc_r),
DEVCB_NULL, DEVCB_NULL, DEVCB_HANDLER(ppi0_portc_w)
};
static WRITE8_HANDLER( rom_bank_w )

View File

@ -569,20 +569,20 @@ static READ8_DEVICE_HANDLER( snd_rom_r )
static const ppi8255_interface ppi8255_intf[2] =
{
{
NULL, /* Port A read */
NULL, /* Port B read */
snd_rom_r, /* Port C read */
snd_rom_addr_l_w, /* Port A write */
snd_rom_addr_h_w, /* Port B write */
NULL /* Port C write */
DEVCB_NULL, /* Port A read */
DEVCB_NULL, /* Port B read */
DEVCB_HANDLER(snd_rom_r), /* Port C read */
DEVCB_HANDLER(snd_rom_addr_l_w), /* Port A write */
DEVCB_HANDLER(snd_rom_addr_h_w), /* Port B write */
DEVCB_NULL /* Port C write */
},
{
DEVICE8_PORT("DSW1"), /* Port A read */
DEVICE8_PORT("DSW2"), /* Port B read */
DEVICE8_PORT("DSW3"), /* Port C read */
NULL, /* Port A write */
NULL, /* Port B write */
NULL /* Port C write */
DEVCB_INPUT_PORT("DSW1"), /* Port A read */
DEVCB_INPUT_PORT("DSW2"), /* Port B read */
DEVCB_INPUT_PORT("DSW3"), /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_NULL /* Port C write */
}
};

View File

@ -438,33 +438,25 @@ static WRITE8_DEVICE_HANDLER( konami_portc_1_w )
}
static WRITE8_DEVICE_HANDLER( sound_latch_w )
{
const address_space *space = cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
soundlatch_w(space, offset, data);
}
static const ppi8255_interface konami_ppi8255_0_intf =
{
DEVICE8_PORT("IN0"), /* Port A read */
DEVICE8_PORT("IN1"), /* Port B read */
DEVICE8_PORT("IN2"), /* Port C read */
NULL, /* Port A write */
NULL, /* Port B write */
konami_portc_0_w /* Port C write */
DEVCB_INPUT_PORT("IN0"), /* Port A read */
DEVCB_INPUT_PORT("IN1"), /* Port B read */
DEVCB_INPUT_PORT("IN2"), /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_HANDLER(konami_portc_0_w) /* Port C write */
};
static const ppi8255_interface konami_ppi8255_1_intf =
{
NULL, /* Port A read */
NULL, /* Port B read */
DEVICE8_PORT("IN3"), /* Port C read */
sound_latch_w, /* Port A write */
konami_sound_control_w, /* Port B write */
konami_portc_1_w /* Port C write */
DEVCB_NULL, /* Port A read */
DEVCB_NULL, /* Port B read */
DEVCB_INPUT_PORT("IN3"), /* Port C read */
DEVCB_MEMORY_HANDLER("main", PROGRAM, soundlatch_w), /* Port A write */
DEVCB_HANDLER(konami_sound_control_w), /* Port B write */
DEVCB_HANDLER(konami_portc_1_w) /* Port C write */
};
@ -501,12 +493,12 @@ static WRITE8_DEVICE_HANDLER( theend_coin_counter_w )
static const ppi8255_interface theend_ppi8255_0_intf =
{
DEVICE8_PORT("IN0"), /* Port A read */
DEVICE8_PORT("IN1"), /* Port B read */
DEVICE8_PORT("IN2"), /* Port C read */
NULL, /* Port A write */
NULL, /* Port B write */
theend_coin_counter_w /* Port C write */
DEVCB_INPUT_PORT("IN0"), /* Port A read */
DEVCB_INPUT_PORT("IN1"), /* Port B read */
DEVCB_INPUT_PORT("IN2"), /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_HANDLER(theend_coin_counter_w)/* Port C write */
};
@ -560,12 +552,12 @@ static CUSTOM_INPUT( scramble_protection_alt_r )
static const ppi8255_interface scramble_ppi8255_1_intf =
{
NULL, /* Port A read */
NULL, /* Port B read */
scramble_protection_r, /* Port C read */
sound_latch_w, /* Port A write */
konami_sound_control_w, /* Port B write */
scramble_protection_w /* Port C write */
DEVCB_NULL, /* Port A read */
DEVCB_NULL, /* Port B read */
DEVCB_HANDLER(scramble_protection_r), /* Port C read */
DEVCB_MEMORY_HANDLER("main", PROGRAM, soundlatch_w), /* Port A write */
DEVCB_HANDLER(konami_sound_control_w), /* Port B write */
DEVCB_HANDLER(scramble_protection_w) /* Port C write */
};
@ -625,22 +617,14 @@ static WRITE8_HANDLER( sfx_sample_control_w )
}
static READ8_DEVICE_HANDLER( sound_data2_r )
{
const address_space *space = cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
return soundlatch2_r(space, offset);
}
static const ppi8255_interface sfx_ppi8255_2_intf =
{
sound_data2_r, /* Port A read */
NULL, /* Port B read */
NULL, /* Port C read */
NULL, /* Port A write */
NULL, /* Port B write */
NULL /* Port C write */
DEVCB_MEMORY_HANDLER("main", PROGRAM, soundlatch2_r), /* Port A read */
DEVCB_NULL, /* Port B read */
DEVCB_NULL, /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_NULL /* Port C write */
};
@ -813,12 +797,12 @@ static WRITE8_HANDLER( scorpion_digitalker_control_w )
static const ppi8255_interface scorpion_ppi8255_1_intf =
{
NULL, /* Port A read */
NULL, /* Port B read */
scorpion_protection_r, /* Port C read */
sound_latch_w, /* Port A write */
konami_sound_control_w, /* Port B write */
scorpion_protection_w /* Port C write */
DEVCB_NULL, /* Port A read */
DEVCB_NULL, /* Port B read */
DEVCB_HANDLER(scorpion_protection_r), /* Port C read */
DEVCB_MEMORY_HANDLER("main", PROGRAM, soundlatch_w), /* Port A write */
DEVCB_HANDLER(konami_sound_control_w), /* Port B write */
DEVCB_HANDLER(scorpion_protection_w) /* Port C write */
};
@ -1109,12 +1093,12 @@ static READ8_DEVICE_HANDLER( moonwar_input_port_0_r )
static const ppi8255_interface moonwar_ppi8255_0_intf =
{
moonwar_input_port_0_r, /* Port A read */
DEVICE8_PORT("IN1"), /* Port B read */
DEVICE8_PORT("IN2"), /* Port C read */
NULL, /* Port A write */
NULL, /* Port B write */
moonwar_port_select_w /* Port C write */
DEVCB_HANDLER(moonwar_input_port_0_r), /* Port A read */
DEVCB_INPUT_PORT("IN1"), /* Port B read */
DEVCB_INPUT_PORT("IN2"), /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_HANDLER(moonwar_port_select_w) /* Port C write */
};

View File

@ -329,12 +329,12 @@ static WRITE8_DEVICE_HANDLER( output_port_1_w )
static const ppi8255_interface ppi8255_intf =
{
DEVICE8_PORT("IN0"),/* Port A read */
DEVICE8_PORT("IN1"),/* Port B read */
NULL, /* Port C read */
NULL, /* Port A write */
NULL, /* Port B write */
output_port_1_w, /* Port C write */
DEVCB_INPUT_PORT("IN0"), /* Port A read */
DEVCB_INPUT_PORT("IN1"), /* Port B read */
DEVCB_NULL, /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_HANDLER(output_port_1_w), /* Port C write */
};

View File

@ -420,40 +420,40 @@ INPUT_PORTS_END
static const ppi8255_interface getrivia_ppi8255_intf[2] =
{
{
DEVICE8_PORT("DSWA"), /* Port A read */
DEVICE8_PORT("IN0"), /* Port B read */
NULL, /* Port C read */
NULL, /* Port A write */
NULL, /* Port B write */
sound_w /* Port C write */
DEVCB_INPUT_PORT("DSWA"), /* Port A read */
DEVCB_INPUT_PORT("IN0"), /* Port B read */
DEVCB_NULL, /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_HANDLER(sound_w) /* Port C write */
},
{
DEVICE8_PORT("IN1"), /* Port A read */
NULL, /* Port B read */
NULL, /* Port C read */
NULL, /* Port A write */
lamps_w, /* Port B write */
lamps2_w /* Port C write */
DEVCB_INPUT_PORT("IN1"), /* Port A read */
DEVCB_NULL, /* Port B read */
DEVCB_NULL, /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_HANDLER(lamps_w), /* Port B write */
DEVCB_HANDLER(lamps2_w) /* Port C write */
}
};
static const ppi8255_interface gselect_ppi8255_intf[2] =
{
{
DEVICE8_PORT("DSWA"), /* Port A read */
DEVICE8_PORT("IN0"), /* Port B read */
NULL, /* Port C read */
NULL, /* Port A write */
NULL, /* Port B write */
sound2_w /* Port C write */
DEVCB_INPUT_PORT("DSWA"), /* Port A read */
DEVCB_INPUT_PORT("IN0"), /* Port B read */
DEVCB_NULL, /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_HANDLER(sound2_w) /* Port C write */
},
{
DEVICE8_PORT("IN1"), /* Port A read */
NULL, /* Port B read */
DEVICE8_PORT("IN2"), /* Port C read */
NULL, /* Port A write */
lamps_w, /* Port B write */
nmi_w /* Port C write */
DEVCB_INPUT_PORT("IN1"), /* Port A read */
DEVCB_NULL, /* Port B read */
DEVCB_INPUT_PORT("IN2"), /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_HANDLER(lamps_w), /* Port B write */
DEVCB_HANDLER(nmi_w) /* Port C write */
}
};

View File

@ -2850,124 +2850,124 @@ GFXDECODE_END
static const ppi8255_interface ncb3_ppi8255_intf[3] =
{
{ /* A, B & C set as input */
DEVICE8_PORT("IN0"), /* Port A read */
DEVICE8_PORT("IN3"), /* Port B read */ //Player2 controls, confirmed.
NULL, /* Port C read */
NULL, /* Port A write */
NULL, /* Port B write */
NULL /* Port C write */
DEVCB_INPUT_PORT("IN0"), /* Port A read */
DEVCB_INPUT_PORT("IN3"), /* Port B read */ //Player2 controls, confirmed.
DEVCB_NULL, /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_NULL /* Port C write */
},
{ /* A, B & C set as input */
DEVICE8_PORT("IN1"), /* Port A read */
DEVICE8_PORT("IN2"), /* Port B read */
DEVICE8_PORT("DSW1"), /* Port C read */
NULL, /* Port A write */
NULL, /* Port B write */
NULL /* Port C write */
DEVCB_INPUT_PORT("IN1"), /* Port A read */
DEVCB_INPUT_PORT("IN2"), /* Port B read */
DEVCB_INPUT_PORT("DSW1"), /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_NULL /* Port C write */
},
{ /* A set as input */
DEVICE8_PORT("DSW2"), /* Port A read */
NULL, /* Port B read */
NULL, /* Port C read */
NULL, /* Port A write */
NULL, /* Port B write */
NULL /* Port C write */
DEVCB_INPUT_PORT("DSW2"), /* Port A read */
DEVCB_NULL, /* Port B read */
DEVCB_NULL, /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_NULL /* Port C write */
}
};
static const ppi8255_interface cm_ppi8255_intf[2] =
{
{ /* A, B & C set as input */
DEVICE8_PORT("IN0"), /* Port A read */
DEVICE8_PORT("IN1"), /* Port B read */
DEVICE8_PORT("IN2"), /* Port C read */
NULL, /* Port A write */
NULL, /* Port B write */
NULL /* Port C write */
DEVCB_INPUT_PORT("IN0"), /* Port A read */
DEVCB_INPUT_PORT("IN1"), /* Port B read */
DEVCB_INPUT_PORT("IN2"), /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_NULL /* Port C write */
},
{ /* A, B & C set as input */
DEVICE8_PORT("DSW1"), /* Port A read */
DEVICE8_PORT("DSW2"), /* Port B read */
DEVICE8_PORT("DSW3"), /* Port C read */
NULL, /* Port A write */
NULL, /* Port B write */
NULL /* Port C write */
DEVCB_INPUT_PORT("DSW1"), /* Port A read */
DEVCB_INPUT_PORT("DSW2"), /* Port B read */
DEVCB_INPUT_PORT("DSW3"), /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_NULL /* Port C write */
}
};
static const ppi8255_interface lucky8_ppi8255_intf[3] =
{
{ /* A, B & C set as input */
DEVICE8_PORT("IN0"), /* Port A read */
DEVICE8_PORT("IN1"), /* Port B read */
DEVICE8_PORT("IN2"), /* Port C read */
NULL, /* Port A write */
NULL, /* Port B write */
NULL /* Port C write */
DEVCB_INPUT_PORT("IN0"), /* Port A read */
DEVCB_INPUT_PORT("IN1"), /* Port B read */
DEVCB_INPUT_PORT("IN2"), /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_NULL /* Port C write */
},
{ /* A, B & C set as input */
DEVICE8_PORT("IN3"), /* Port A read */
DEVICE8_PORT("IN4"), /* Port B read */
DEVICE8_PORT("DSW1"), /* Port C read */
NULL, /* Port A write */
NULL, /* Port B write */
NULL /* Port C write */
DEVCB_INPUT_PORT("IN3"), /* Port A read */
DEVCB_INPUT_PORT("IN4"), /* Port B read */
DEVCB_INPUT_PORT("DSW1"), /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_NULL /* Port C write */
},
{ /* A set as input */
DEVICE8_PORT("DSW2"), /* Port A read */
NULL, /* Port B read */
NULL, /* Port C read */
NULL, /* Port A write */
NULL, /* Port B write */
NULL /* Port C write */
DEVCB_INPUT_PORT("DSW2"), /* Port A read */
DEVCB_NULL, /* Port B read */
DEVCB_NULL, /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_NULL /* Port C write */
}
};
static const ppi8255_interface kkojnoli_ppi8255_intf[3] =
{
{ /* A, B & C set as input */
DEVICE8_PORT("IN0"), /* Port A read */
DEVICE8_PORT("IN1"), /* Port B read */
DEVICE8_PORT("IN2"), /* Port C read */
NULL, /* Port A write */
NULL, /* Port B write */
NULL /* Port C write */
DEVCB_INPUT_PORT("IN0"), /* Port A read */
DEVCB_INPUT_PORT("IN1"), /* Port B read */
DEVCB_INPUT_PORT("IN2"), /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_NULL /* Port C write */
},
{ /* A, B & C set as input */
DEVICE8_PORT("IN3"), /* Port A read */
DEVICE8_PORT("IN4"), /* Port B read */
NULL, /* Port C read */
NULL, /* Port A write */
NULL, /* Port B write */
NULL /* Port C write */
DEVCB_INPUT_PORT("IN3"), /* Port A read */
DEVCB_INPUT_PORT("IN4"), /* Port B read */
DEVCB_NULL, /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_NULL /* Port C write */
},
{ /* A set as input */
DEVICE8_PORT("DSW1"), /* Port A read */
NULL, /* Port B read */
NULL, /* Port C read */
NULL, /* Port A write */
NULL, /* Port B write */
NULL /* Port C write */
DEVCB_INPUT_PORT("DSW1"), /* Port A read */
DEVCB_NULL, /* Port B read */
DEVCB_NULL, /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_NULL /* Port C write */
}
};
static const ppi8255_interface ladylinr_ppi8255_intf[2] =
{
{ /* A, B & C set as input */
DEVICE8_PORT("IN0"), /* Port A read */
DEVICE8_PORT("IN1"), /* Port B read */
DEVICE8_PORT("IN2"), /* Port C read */
NULL, /* Port A write */
NULL, /* Port B write */
NULL /* Port C write */
DEVCB_INPUT_PORT("IN0"), /* Port A read */
DEVCB_INPUT_PORT("IN1"), /* Port B read */
DEVCB_INPUT_PORT("IN2"), /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_NULL /* Port C write */
},
{ /* A set as input */
DEVICE8_PORT("DSW1"), /* Port A read */
NULL, /* Port B read */
NULL, /* Port C read */
NULL, /* Port A write */
NULL, /* Port B write */
NULL /* Port C write */
DEVCB_INPUT_PORT("DSW1"), /* Port A read */
DEVCB_NULL, /* Port B read */
DEVCB_NULL, /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_NULL /* Port C write */
}
};

View File

@ -37,12 +37,12 @@ static WRITE8_DEVICE_HANDLER(pc_w){homerun_xpc=data;}
static const ppi8255_interface ppi8255_intf =
{
NULL,
NULL,
NULL,
pa_w,
pb_w,
pc_w
DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL,
DEVCB_HANDLER(pa_w),
DEVCB_HANDLER(pb_w),
DEVCB_HANDLER(pc_w)
};

View File

@ -1066,13 +1066,13 @@ static INTERRUPT_GEN( iqblocka_interrupt )
// Dips are read through the 8255
static const ppi8255_interface iqblocka_ppi8255_intf =
{
DEVICE8_PORT("DSW0"), // Port A read
DEVICE8_PORT("DSW1"), // Port B read
DEVICE8_PORT("DSW2"), // Port C read
DEVCB_INPUT_PORT("DSW0"), // Port A read
DEVCB_INPUT_PORT("DSW1"), // Port B read
DEVCB_INPUT_PORT("DSW2"), // Port C read
0, // Port A write
0, // Port B write
0, // Port C write
DEVCB_NULL, // Port A write
DEVCB_NULL, // Port B write
DEVCB_NULL, // Port C write
};
static MACHINE_RESET( iqblocka )
@ -1143,13 +1143,13 @@ static MACHINE_RESET( mgcs )
static const ppi8255_interface mgcs_ppi8255_intf =
{
DEVICE8_PORT("COINS"), // Port A read
mgcs_keys_r, // Port B read
0, // Port C read (see code at 1C83A)
DEVCB_INPUT_PORT("COINS"), // Port A read
DEVCB_HANDLER(mgcs_keys_r), // Port B read
DEVCB_NULL, // Port C read (see code at 1C83A)
0, // Port A write
0, // Port B write
0, // Port C write (with 0/1)
DEVCB_NULL, // Port A write
DEVCB_NULL, // Port B write
DEVCB_NULL, // Port C write (with 0/1)
};
static MACHINE_DRIVER_START( mgcs )

View File

@ -395,12 +395,12 @@ static INTERRUPT_GEN( master_interrupt )
static const ppi8255_interface ppi8255_intf =
{
NULL, /* Port A read */
NULL, /* Port B read */
NULL, /* Port C read */
NULL, /* Port A write */
NULL, /* Port B write */
NULL /* Port C write */
DEVCB_NULL, /* Port A read */
DEVCB_NULL, /* Port B read */
DEVCB_NULL, /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_NULL /* Port C write */
};

View File

@ -109,12 +109,12 @@ static WRITE8_DEVICE_HANDLER( port_C_w )
static const ppi8255_interface ppi8255_intf =
{
DEVICE8_PORT("P1"), /* Port A read */
DEVICE8_PORT("P2"), /* Port B read */
DEVICE8_PORT("EXTRA"), /* Port C read */
NULL, /* Port A write */
NULL, /* Port B write */
port_C_w /* Port C write */
DEVCB_INPUT_PORT("P1"), /* Port A read */
DEVCB_INPUT_PORT("P2"), /* Port B read */
DEVCB_INPUT_PORT("EXTRA"), /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_HANDLER(port_C_w) /* Port C write */
};

View File

@ -406,20 +406,20 @@ INPUT_PORTS_END
static const ppi8255_interface ppi8255_intf[2] =
{
{
DEVICE8_PORT("IN0"), // Port A read
NULL, // Port B read
DEVICE8_PORT("IN3"), // Port C read
fake_w, // Port A write
lordgun_eeprom_w, // Port B write
fake2_w // Port C write
DEVCB_INPUT_PORT("IN0"), // Port A read
DEVCB_NULL, // Port B read
DEVCB_INPUT_PORT("IN3"), // Port C read
DEVCB_HANDLER(fake_w), // Port A write
DEVCB_HANDLER(lordgun_eeprom_w),// Port B write
DEVCB_HANDLER(fake2_w) // Port C write
},
{
DEVICE8_PORT("IN1"), // Port A read
DEVICE8_PORT("IN2"), // Port B read
DEVICE8_PORT("IN4"), // Port C read
fake_w, // Port A write
fake_w, // Port B write
fake_w // Port C write
DEVCB_INPUT_PORT("IN1"), // Port A read
DEVCB_INPUT_PORT("IN2"), // Port B read
DEVCB_INPUT_PORT("IN4"), // Port C read
DEVCB_HANDLER(fake_w), // Port A write
DEVCB_HANDLER(fake_w), // Port B write
DEVCB_HANDLER(fake_w) // Port C write
}
};

View File

@ -1179,36 +1179,36 @@ static void lucky74_adpcm_int(const device_config *device)
static const ppi8255_interface ppi8255_intf[4] =
{
{ /* A & B set as input */
DEVICE8_PORT("IN0"), /* Port A read, IN0 */
DEVICE8_PORT("IN1"), /* Port B read, IN1 */
NULL, /* Port C read */
NULL, /* Port A write */
NULL, /* Port B write */
NULL /* Port C writes: 0x00 after reset, 0xff during game, and 0xfd when tap F2 for percentage and run count */
DEVCB_INPUT_PORT("IN0"), /* Port A read, IN0 */
DEVCB_INPUT_PORT("IN1"), /* Port B read, IN1 */
DEVCB_NULL, /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_NULL /* Port C writes: 0x00 after reset, 0xff during game, and 0xfd when tap F2 for percentage and run count */
},
{ /* A & C set as input */
DEVICE8_PORT("IN2"), /* Port A read, IN2 */
NULL, /* Port B read */
DEVICE8_PORT("IN4"), /* Port C read, IN4 */
NULL, /* Port A write */
NULL, /* Port B write */
NULL /* Port C write */
DEVCB_INPUT_PORT("IN2"), /* Port A read, IN2 */
DEVCB_NULL, /* Port B read */
DEVCB_INPUT_PORT("IN4"), /* Port C read, IN4 */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_NULL /* Port C write */
},
{ /* A, B & C set as input */
DEVICE8_PORT("DSW1"), /* Port A read, DSW1 */
DEVICE8_PORT("DSW2"), /* Port B read, DSW2 */
DEVICE8_PORT("DSW3"), /* Port C read, DSW3 */
NULL, /* Port A write */
NULL, /* Port B write */
NULL /* Port C write */
DEVCB_INPUT_PORT("DSW1"), /* Port A read, DSW1 */
DEVCB_INPUT_PORT("DSW2"), /* Port B read, DSW2 */
DEVCB_INPUT_PORT("DSW3"), /* Port C read, DSW3 */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_NULL /* Port C write */
},
{ /* A set as input */
DEVICE8_PORT("DSW4"), /* Port A read, DSW4 */
NULL, /* Port B read */
NULL, /* Port C read */
NULL, /* Port A write */
lamps_a_w, /* Port B write, LAMPSA */
lamps_b_w /* Port C write, LAMPSB */
DEVCB_INPUT_PORT("DSW4"), /* Port A read, DSW4 */
DEVCB_NULL, /* Port B read */
DEVCB_NULL, /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_HANDLER(lamps_a_w), /* Port B write, LAMPSA */
DEVCB_HANDLER(lamps_b_w) /* Port C write, LAMPSB */
}
};

View File

@ -988,40 +988,40 @@ static VIDEO_UPDATE( merit )
static const ppi8255_interface ppi8255_intf[2] =
{
{
DEVICE8_PORT("IN0"), /* Port A read */
DEVICE8_PORT("IN1"), /* Port B read */
DEVICE8_PORT("IN2"), /* Port C read */
NULL, /* Port A write */
NULL, /* Port B write */
NULL /* Port C write */
DEVCB_INPUT_PORT("IN0"), /* Port A read */
DEVCB_INPUT_PORT("IN1"), /* Port B read */
DEVCB_INPUT_PORT("IN2"), /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_NULL /* Port C write */
},
{
DEVICE8_PORT("DSW"), /* Port A read */
NULL, /* Port B read */
NULL, /* Port C read */
NULL, /* Port A write */
led1_w, /* Port B write */
misc_w /* Port C write */
DEVCB_INPUT_PORT("DSW"), /* Port A read */
DEVCB_NULL, /* Port B read */
DEVCB_NULL, /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_HANDLER(led1_w), /* Port B write */
DEVCB_HANDLER(misc_w) /* Port C write */
}
};
static const ppi8255_interface ppi8255_couple_intf[2] =
{
{
DEVICE8_PORT("IN0"), /* Port A read */
DEVICE8_PORT("IN1"), /* Port B read */
DEVICE8_PORT("IN2"), /* Port C read */
NULL, /* Port A write */
NULL, /* Port B write */
NULL /* Port C write */
DEVCB_INPUT_PORT("IN0"), /* Port A read */
DEVCB_INPUT_PORT("IN1"), /* Port B read */
DEVCB_INPUT_PORT("IN2"), /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_NULL /* Port C write */
},
{
DEVICE8_PORT("DSW"), /* Port A read */
NULL, /* Port B read */
NULL, /* Port C read */
NULL, /* Port A write */
led1_w, /* Port B write */
misc_couple_w /* Port C write */
DEVCB_INPUT_PORT("DSW"), /* Port A read */
DEVCB_NULL, /* Port B read */
DEVCB_NULL, /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_HANDLER(led1_w), /* Port B write */
DEVCB_HANDLER(misc_couple_w) /* Port C write */
}
};

View File

@ -694,22 +694,22 @@ static WRITE8_DEVICE_HANDLER(meritm_crt250_port_b_w)
static const ppi8255_interface crt260_ppi8255_intf =
{
NULL, /* Port A read */
NULL, /* Port B read */
meritm_8255_port_c_r, /* Port C read */
NULL, /* Port A write (used) */
NULL, /* Port B write (used LMP x DRIVE) */
NULL /* Port C write */
DEVCB_NULL, /* Port A read */
DEVCB_NULL, /* Port B read */
DEVCB_HANDLER(meritm_8255_port_c_r), /* Port C read */
DEVCB_NULL, /* Port A write (used) */
DEVCB_NULL, /* Port B write (used LMP x DRIVE) */
DEVCB_NULL /* Port C write */
};
static const ppi8255_interface crt250_ppi8255_intf =
{
NULL, /* Port A read */
NULL, /* Port B read */
meritm_8255_port_c_r, /* Port C read */
NULL, /* Port A write (used) */
meritm_crt250_port_b_w, /* Port B write (used LMP x DRIVE) */
NULL /* Port C write */
DEVCB_NULL, /* Port A read */
DEVCB_NULL, /* Port B read */
DEVCB_HANDLER(meritm_8255_port_c_r), /* Port C read */
DEVCB_NULL, /* Port A write (used) */
DEVCB_HANDLER(meritm_crt250_port_b_w), /* Port B write (used LMP x DRIVE) */
DEVCB_NULL /* Port C write */
};
/*************************************

View File

@ -481,20 +481,20 @@ static WRITE8_DEVICE_HANDLER( sys_reset_w )
static const ppi8255_interface filetto_ppi8255_intf[2] =
{
{
port_a_r, /* Port A read */
port_b_r, /* Port B read */
port_c_r, /* Port C read */
NULL, /* Port A write */
port_b_w, /* Port B write */
NULL /* Port C write */
DEVCB_HANDLER(port_a_r), /* Port A read */
DEVCB_HANDLER(port_b_r), /* Port B read */
DEVCB_HANDLER(port_c_r), /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_HANDLER(port_b_w), /* Port B write */
DEVCB_NULL /* Port C write */
},
{
NULL, /* Port A read */
NULL, /* Port B read */
NULL, /* Port C read */
wss_1_w, /* Port A write */
wss_2_w, /* Port B write */
sys_reset_w /* Port C write */
DEVCB_NULL, /* Port A read */
DEVCB_NULL, /* Port B read */
DEVCB_NULL, /* Port C read */
DEVCB_HANDLER(wss_1_w), /* Port A write */
DEVCB_HANDLER(wss_2_w), /* Port B write */
DEVCB_HANDLER(sys_reset_w) /* Port C write */
}
};

View File

@ -309,28 +309,28 @@ static const z80_daisy_chain daisy_chain_sound[] =
static const ppi8255_interface ppi8255_intf[3] =
{
{
DEVICE8_PORT("P1"), /* Port A read */
NULL, /* Port B read */
NULL, /* Port C read */
NULL, /* Port A write */
NULL, /* Port B write */
vidctrl_w /* Port C write */
DEVCB_INPUT_PORT("P1"), /* Port A read */
DEVCB_NULL, /* Port B read */
DEVCB_NULL, /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_HANDLER(vidctrl_w) /* Port C write */
},
{
DEVICE8_PORT("DSW1"), /* Port A read */
DEVICE8_PORT("DSW2"), /* Port B read */
protection_r, /* Port C read */
NULL, /* Port A write */
NULL, /* Port B write */
protection_w /* Port C write */
DEVCB_INPUT_PORT("DSW1"), /* Port A read */
DEVCB_INPUT_PORT("DSW2"), /* Port B read */
DEVCB_HANDLER(protection_r), /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_HANDLER(protection_w) /* Port C write */
},
{
NULL, /* Port A read */
NULL, /* Port B read */
NULL, /* Port C read */
NULL, /* Port A write */
NULL, /* Port B write */
NULL /* Port C write */
DEVCB_NULL, /* Port A read */
DEVCB_NULL, /* Port B read */
DEVCB_NULL, /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_NULL /* Port C write */
}
};

View File

@ -332,12 +332,12 @@ static WRITE8_HANDLER( sindbadm_SN76496_1_w )
static const ppi8255_interface sindbadm_ppi_intf =
{
NULL,
DEVICE8_PORT("FC"),
NULL,
sindbadm_soundport_w,
NULL,
sindbadm_misc_w
DEVCB_NULL,
DEVCB_INPUT_PORT("FC"),
DEVCB_NULL,
DEVCB_HANDLER(sindbadm_soundport_w),
DEVCB_NULL,
DEVCB_HANDLER(sindbadm_misc_w)
};

View File

@ -70,20 +70,20 @@ static READ8_DEVICE_HANDLER( adc_status_r );
static const ppi8255_interface hangon_ppi_intf[2] =
{
{
NULL,
NULL,
NULL,
sound_latch_w,
video_lamps_w,
tilemap_sound_w
DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL,
DEVCB_HANDLER(sound_latch_w),
DEVCB_HANDLER(video_lamps_w),
DEVCB_HANDLER(tilemap_sound_w)
},
{
NULL,
NULL,
adc_status_r,
sub_control_adc_w,
NULL,
NULL
DEVCB_NULL,
DEVCB_NULL,
DEVCB_HANDLER(adc_status_r),
DEVCB_HANDLER(sub_control_adc_w),
DEVCB_NULL,
DEVCB_NULL
}
};

View File

@ -77,12 +77,12 @@ static WRITE8_DEVICE_HANDLER( video_control_w );
static const ppi8255_interface single_ppi_intf =
{
unknown_porta_r,
unknown_portb_r,
unknown_portc_r,
unknown_porta_w,
unknown_portb_w,
video_control_w
DEVCB_HANDLER(unknown_porta_r),
DEVCB_HANDLER(unknown_portb_r),
DEVCB_HANDLER(unknown_portc_r),
DEVCB_HANDLER(unknown_porta_w),
DEVCB_HANDLER(unknown_portb_w),
DEVCB_HANDLER(video_control_w)
};

View File

@ -186,7 +186,6 @@ static UINT32 n7751_rom_address;
static READ16_HANDLER( misc_io_r );
static WRITE16_HANDLER( misc_io_w );
static WRITE8_DEVICE_HANDLER( sound_latch_w );
static WRITE8_DEVICE_HANDLER( video_control_w );
static WRITE8_DEVICE_HANDLER( tilemap_sound_w );
@ -200,12 +199,12 @@ static WRITE8_DEVICE_HANDLER( tilemap_sound_w );
static const ppi8255_interface single_ppi_intf =
{
NULL,
NULL,
NULL,
sound_latch_w,
video_control_w,
tilemap_sound_w
DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL,
DEVCB_MEMORY_HANDLER("main", PROGRAM, soundlatch_w),
DEVCB_HANDLER(video_control_w),
DEVCB_HANDLER(tilemap_sound_w)
};
@ -365,13 +364,6 @@ static WRITE8_DEVICE_HANDLER( video_control_w )
*
*************************************/
static WRITE8_DEVICE_HANDLER( sound_latch_w )
{
const address_space *space = cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
soundlatch_w(space, offset, data);
}
static WRITE8_DEVICE_HANDLER( tilemap_sound_w )
{
/*

View File

@ -341,12 +341,12 @@ static WRITE8_DEVICE_HANDLER ( ppi_port_c_w )
static const ppi8255_interface ppi8255_intf =
{
NULL,
ppi_port_b_r,
NULL,
ppi_port_a_w,
NULL,
ppi_port_c_w
DEVCB_NULL,
DEVCB_HANDLER(ppi_port_b_r),
DEVCB_NULL,
DEVCB_HANDLER(ppi_port_a_w),
DEVCB_NULL,
DEVCB_HANDLER(ppi_port_c_w)
};

View File

@ -249,12 +249,12 @@ static WRITE8_DEVICE_HANDLER( sg1000a_coin_counter_w )
static const ppi8255_interface ppi8255_intf =
{
DEVICE8_PORT("P1"),
DEVICE8_PORT("P2"),
DEVICE8_PORT("DSW"),
NULL,
NULL,
sg1000a_coin_counter_w
DEVCB_INPUT_PORT("P1"),
DEVCB_INPUT_PORT("P2"),
DEVCB_INPUT_PORT("DSW"),
DEVCB_NULL,
DEVCB_NULL,
DEVCB_HANDLER(sg1000a_coin_counter_w)
};
/*************************************

View File

@ -612,20 +612,20 @@ INPUT_PORTS_END
static const ppi8255_interface ppi8255_intf[2] =
{
{ /* A, B & C set as input */
DEVICE8_PORT("IN1"), /* Port A read */
DEVICE8_PORT("IN2"), /* Port B read */
DEVICE8_PORT("DSW1"), /* Port C read */
NULL, /* Port A write */
NULL, /* Port B write */
NULL /* Port C write */
DEVCB_INPUT_PORT("IN1"), /* Port A read */
DEVCB_INPUT_PORT("IN2"), /* Port B read */
DEVCB_INPUT_PORT("DSW1"), /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_NULL /* Port C write */
},
{ /* A, B & C set as input */
DEVICE8_PORT("DSW2"), /* Port A read */
DEVICE8_PORT("IN3"), /* Port B read */
DEVICE8_PORT("IN4"), /* Port C read */
NULL, /* Port A write */
NULL, /* Port B write */
NULL /* Port C write */
DEVCB_INPUT_PORT("DSW2"), /* Port A read */
DEVCB_INPUT_PORT("IN3"), /* Port B read */
DEVCB_INPUT_PORT("IN4"), /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_NULL /* Port C write */
}
};

View File

@ -544,28 +544,28 @@ static MACHINE_START(merit)
static const ppi8255_interface scarn_ppi8255_intf[3] =
{
{ /* A, B & C set as input */
DEVICE8_PORT("IN0"), /* Port A read */
DEVICE8_PORT("IN1"), /* Port B read */
DEVICE8_PORT("IN2"), /* Port C read */
NULL, /* Port A write */
NULL, /* Port B write */
NULL /* Port C write */
DEVCB_INPUT_PORT("IN0"), /* Port A read */
DEVCB_INPUT_PORT("IN1"), /* Port B read */
DEVCB_INPUT_PORT("IN2"), /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_NULL /* Port C write */
},
{ /* A set as input */
DEVICE8_PORT("DSW1"), /* Port A read */
NULL, /* Port B read */
NULL, /* Port C read */
NULL, /* Port A write */
NULL, /* Port B write */
NULL /* Port C write */
DEVCB_INPUT_PORT("DSW1"), /* Port A read */
DEVCB_NULL, /* Port B read */
DEVCB_NULL, /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_NULL /* Port C write */
},
{ /* A & B set as input */
DEVICE8_PORT("IN3"), /* Port A read */
DEVICE8_PORT("IN4"), /* Port B read */
NULL, /* Port C read */
NULL, /* Port A write */
NULL, /* Port B write */
NULL /* Port C write */
DEVCB_INPUT_PORT("IN3"), /* Port A read */
DEVCB_INPUT_PORT("IN4"), /* Port B read */
DEVCB_NULL, /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_NULL /* Port C write */
}
};

View File

@ -392,20 +392,20 @@ static WRITE8_DEVICE_HANDLER(ppi0_b_w)
static const ppi8255_interface ppi8255_intf[2] =
{
{
0, /* Port A read */
0, /* Port B read */
ppi0_c_r, /* Port C read */
ppi0_a_w, /* Port A write */
ppi0_b_w, /* Port B write */
0 /* Port C write */
DEVCB_NULL, /* Port A read */
DEVCB_NULL, /* Port B read */
DEVCB_HANDLER(ppi0_c_r), /* Port C read */
DEVCB_HANDLER(ppi0_a_w), /* Port A write */
DEVCB_HANDLER(ppi0_b_w), /* Port B write */
DEVCB_NULL /* Port C write */
},
{
DEVICE8_PORT("IN0"), /* Port A read */
DEVICE8_PORT("IN1"), /* Port B read */
DEVICE8_PORT("IN2"), /* Port C read */
0, /* Port A write */
0, /* Port B write */
0 /* Port C write */
DEVCB_INPUT_PORT("IN0"), /* Port A read */
DEVCB_INPUT_PORT("IN1"), /* Port B read */
DEVCB_INPUT_PORT("IN2"), /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_NULL /* Port C write */
}
};

View File

@ -457,12 +457,12 @@ static const ppi8255_interface ppi8255_intf[1] =
High 4 bits of C set as Output
*/
{
DEVICE8_PORT("IN0"), /* Port A read */
prot_r, /* Port B read */
DEVICE8_PORT("IN2"), /* Port C read (Lower Nibble as Input) */
NULL, /* Port A write */
NULL, /* Port B write */
NULL //ppi_portc_hi_w /* Port C write (High nibble as Output) */
DEVCB_INPUT_PORT("IN0"), /* Port A read */
DEVCB_HANDLER(prot_r), /* Port B read */
DEVCB_INPUT_PORT("IN2"), /* Port C read (Lower Nibble as Input) */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_NULL //ppi_portc_hi_w /* Port C write (High nibble as Output) */
}
};

View File

@ -97,44 +97,44 @@ static WRITE8_HANDLER( p8910_0b_w )
static const ppi8255_interface ppi8255_intf[5] =
{
{
p0a_r, /* Port A read */
NULL, /* Port B read */
p0c_r, /* Port C read */
NULL, /* Port A write */
p0b_w, /* Port B write */
p0c_w /* Port C write */
DEVCB_HANDLER(p0a_r), /* Port A read */
DEVCB_NULL, /* Port B read */
DEVCB_HANDLER(p0c_r), /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_HANDLER(p0b_w), /* Port B write */
DEVCB_HANDLER(p0c_w) /* Port C write */
},
{
NULL, /* Port A read */
p1b_r, /* Port B read */
p1c_r, /* Port C read */
p1a_w, /* Port A write */
NULL, /* Port B write */
p1c_w /* Port C write */
DEVCB_NULL, /* Port A read */
DEVCB_HANDLER(p1b_r), /* Port B read */
DEVCB_HANDLER(p1c_r), /* Port C read */
DEVCB_HANDLER(p1a_w), /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_HANDLER(p1c_w) /* Port C write */
},
{
NULL, /* Port A read */
NULL, /* Port B read */
NULL, /* Port C read */
p2a_w, /* Port A write */
p2b_w, /* Port B write */
p2c_w /* Port C write */
DEVCB_NULL, /* Port A read */
DEVCB_NULL, /* Port B read */
DEVCB_NULL, /* Port C read */
DEVCB_HANDLER(p2a_w), /* Port A write */
DEVCB_HANDLER(p2b_w), /* Port B write */
DEVCB_HANDLER(p2c_w) /* Port C write */
},
{
NULL, /* Port A read */
NULL, /* Port B read */
NULL, /* Port C read */
p3a_w, /* Port A write */
p3b_w, /* Port B write */
p3c_w /* Port C write */
DEVCB_NULL, /* Port A read */
DEVCB_NULL, /* Port B read */
DEVCB_NULL, /* Port C read */
DEVCB_HANDLER(p3a_w), /* Port A write */
DEVCB_HANDLER(p3b_w), /* Port B write */
DEVCB_HANDLER(p3c_w) /* Port C write */
},
{
NULL, /* Port A read */
NULL, /* Port B read */
NULL, /* Port C read */
p4a_w, /* Port A write */
p4b_w, /* Port B write */
p4c_w /* Port C write */
DEVCB_NULL, /* Port A read */
DEVCB_NULL, /* Port B read */
DEVCB_NULL, /* Port C read */
DEVCB_HANDLER(p4a_w), /* Port A write */
DEVCB_HANDLER(p4b_w), /* Port B write */
DEVCB_HANDLER(p4c_w) /* Port C write */
}
};

View File

@ -94,20 +94,20 @@ GFXDECODE_END
static const ppi8255_interface ppi8255_intf[2] =
{
{
NULL,
NULL,
NULL,
NULL,
NULL,
NULL
DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL
},
{
NULL,
NULL,
NULL,
NULL,
NULL,
NULL
DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL
}
};

View File

@ -271,36 +271,36 @@ static WRITE8_DEVICE_HANDLER( turbo_ppi3c_w )
static const ppi8255_interface turbo_8255_intf[4] =
{
{
NULL,
NULL,
NULL,
turbo_ppi0a_w,
turbo_ppi0b_w,
turbo_ppi0c_w
DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL,
DEVCB_HANDLER(turbo_ppi0a_w),
DEVCB_HANDLER(turbo_ppi0b_w),
DEVCB_HANDLER(turbo_ppi0c_w)
},
{
NULL,
NULL,
NULL,
turbo_ppi1a_w,
turbo_ppi1b_w,
turbo_ppi1c_w
DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL,
DEVCB_HANDLER(turbo_ppi1a_w),
DEVCB_HANDLER(turbo_ppi1b_w),
DEVCB_HANDLER(turbo_ppi1c_w)
},
{
NULL,
NULL,
NULL,
turbo_sound_a_w,
turbo_sound_b_w,
turbo_sound_c_w
DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL,
DEVCB_HANDLER(turbo_sound_a_w),
DEVCB_HANDLER(turbo_sound_b_w),
DEVCB_HANDLER(turbo_sound_c_w)
},
{
turbo_analog_r,
DEVICE8_PORT("DSW2"),
NULL,
NULL,
NULL,
turbo_ppi3c_w
DEVCB_HANDLER(turbo_analog_r),
DEVCB_INPUT_PORT("DSW2"),
DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL,
DEVCB_HANDLER(turbo_ppi3c_w)
}
};
@ -353,20 +353,20 @@ static WRITE8_DEVICE_HANDLER( subroc3d_ppi0b_w )
static const ppi8255_interface subroc3d_8255_intf[2] =
{
{
NULL,
NULL,
NULL,
subroc3d_ppi0a_w,
subroc3d_ppi0b_w,
subroc3d_ppi0c_w
DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL,
DEVCB_HANDLER(subroc3d_ppi0a_w),
DEVCB_HANDLER(subroc3d_ppi0b_w),
DEVCB_HANDLER(subroc3d_ppi0c_w)
},
{
NULL,
NULL,
NULL,
subroc3d_sound_a_w,
subroc3d_sound_b_w,
subroc3d_sound_c_w
DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL,
DEVCB_HANDLER(subroc3d_sound_a_w),
DEVCB_HANDLER(subroc3d_sound_b_w),
DEVCB_HANDLER(subroc3d_sound_c_w)
}
};
@ -426,20 +426,20 @@ static WRITE8_DEVICE_HANDLER( buckrog_ppi1c_w )
static const ppi8255_interface buckrog_8255_intf[2] =
{
{
NULL,
NULL,
NULL,
buckrog_ppi0a_w,
buckrog_ppi0b_w,
buckrog_ppi0c_w
DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL,
DEVCB_HANDLER(buckrog_ppi0a_w),
DEVCB_HANDLER(buckrog_ppi0b_w),
DEVCB_HANDLER(buckrog_ppi0c_w)
},
{
NULL,
NULL,
NULL,
buckrog_sound_a_w,
buckrog_sound_b_w,
buckrog_ppi1c_w
DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL,
DEVCB_HANDLER(buckrog_sound_a_w),
DEVCB_HANDLER(buckrog_sound_b_w),
DEVCB_HANDLER(buckrog_ppi1c_w)
}
};

View File

@ -477,23 +477,23 @@ static READ8_HANDLER( bbjr_analog_r )
/* Buggy Boy uses an 8255 PPI instead of YM2149 ports for inputs! */
static const ppi8255_interface buggyboy_ppi8255_intf =
{
DEVICE8_PORT("PPI_PORTA"),
NULL,
DEVICE8_PORT("PPI_PORTC"),
NULL,
bb_coin_cnt_w,
NULL,
DEVCB_INPUT_PORT("PPI_PORTA"),
DEVCB_NULL,
DEVCB_INPUT_PORT("PPI_PORTC"),
DEVCB_NULL,
DEVCB_HANDLER(bb_coin_cnt_w),
DEVCB_NULL,
};
static const ppi8255_interface tx1_ppi8255_intf =
{
tx1_ppi_porta_r,
tx1_ppi_portb_r,
DEVICE8_PORT("PPI_PORTC"),
NULL,
NULL,
tx1_coin_cnt_w
DEVCB_HANDLER(tx1_ppi_porta_r),
DEVCB_HANDLER(tx1_ppi_portb_r),
DEVCB_INPUT_PORT("PPI_PORTC"),
DEVCB_NULL,
DEVCB_NULL,
DEVCB_HANDLER(tx1_coin_cnt_w)
};

View File

@ -238,20 +238,20 @@ static WRITE8_DEVICE_HANDLER( ppi8255_c_w ){}
static const ppi8255_interface ppi8255_intf[2] =
{
{
DEVICE8_PORT("IN0"), // Port A read
DEVICE8_PORT("IN1"), // Port B read
DEVICE8_PORT("IN2"), // Port C read
NULL, // Port A write
NULL, // Port B write
NULL // Port C write
DEVCB_INPUT_PORT("IN0"), // Port A read
DEVCB_INPUT_PORT("IN1"), // Port B read
DEVCB_INPUT_PORT("IN2"), // Port C read
DEVCB_NULL, // Port A write
DEVCB_NULL, // Port B write
DEVCB_NULL // Port C write
},
{
NULL, // Port A read
NULL, // Port B read
NULL, // Port C read
ppi8255_a_w, // Port A write
ppi8255_b_w, // Port B write
ppi8255_c_w // Port C write
DEVCB_NULL, // Port A read
DEVCB_NULL, // Port B read
DEVCB_NULL, // Port C read
DEVCB_HANDLER(ppi8255_a_w), // Port A write
DEVCB_HANDLER(ppi8255_b_w), // Port B write
DEVCB_HANDLER(ppi8255_c_w) // Port C write
}
};

View File

@ -237,12 +237,12 @@ static const pia6821_interface pia_1_intf =
static const ppi8255_interface ppi8255_intf =
{
DEVICE8_PORT("P1"), /* Port A read */
DEVICE8_PORT("P2"), /* Port B read */
DEVICE8_PORT("SYSTEM"), /* Port C read */
NULL, /* Port A write */
NULL, /* Port B write */
zaccaria_dsw_sel_w, /* Port C write */
DEVCB_INPUT_PORT("P1"), /* Port A read */
DEVCB_INPUT_PORT("P2"), /* Port B read */
DEVCB_INPUT_PORT("SYSTEM"), /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_HANDLER(zaccaria_dsw_sel_w) /* Port C write */
};

View File

@ -925,30 +925,23 @@ INPUT_PORTS_END
static const ppi8255_interface zaxxon_ppi_intf =
{
NULL,
NULL,
NULL,
zaxxon_sound_a_w,
zaxxon_sound_b_w,
zaxxon_sound_c_w
DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL,
DEVCB_HANDLER(zaxxon_sound_a_w),
DEVCB_HANDLER(zaxxon_sound_b_w),
DEVCB_HANDLER(zaxxon_sound_c_w)
};
static READ8_DEVICE_HANDLER( sound_latch_r )
{
const address_space *space = cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
return soundlatch_r(space, offset);
}
static const ppi8255_interface congo_ppi_intf =
{
sound_latch_r,
NULL,
NULL,
NULL,
congo_sound_b_w,
congo_sound_c_w
DEVCB_MEMORY_HANDLER("main", PROGRAM, soundlatch_r),
DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL,
DEVCB_HANDLER(congo_sound_b_w),
DEVCB_HANDLER(congo_sound_c_w)
};

View File

@ -174,63 +174,57 @@ WRITE8_HANDLER( hunchbks_mirror_w )
memory_write_byte(space, 0x1000+offset,data);
}
static WRITE8_DEVICE_HANDLER( sound_latch_w )
{
const address_space *space = cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
soundlatch_w(space, offset, data);
}
const ppi8255_interface scramble_ppi_0_intf =
{
DEVICE8_PORT("IN0"), /* Port A read */
DEVICE8_PORT("IN1"), /* Port B read */
DEVICE8_PORT("IN2"), /* Port C read */
NULL, /* Port A write */
NULL, /* Port B write */
NULL /* Port C write */
DEVCB_INPUT_PORT("IN0"), /* Port A read */
DEVCB_INPUT_PORT("IN1"), /* Port B read */
DEVCB_INPUT_PORT("IN2"), /* Port C read */
DEVCB_NULL, /* Port A write */
DEVCB_NULL, /* Port B write */
DEVCB_NULL /* Port C write */
};
const ppi8255_interface scramble_ppi_1_intf =
{
NULL, /* Port A read */
NULL, /* Port B read */
NULL, /* Port C read */
sound_latch_w, /* Port A write */
scramble_sh_irqtrigger_w, /* Port B write */
NULL /* Port C write */
DEVCB_NULL, /* Port A read */
DEVCB_NULL, /* Port B read */
DEVCB_NULL, /* Port C read */
DEVCB_MEMORY_HANDLER("main", PROGRAM, soundlatch_w), /* Port A write */
DEVCB_HANDLER(scramble_sh_irqtrigger_w), /* Port B write */
DEVCB_NULL /* Port C write */
};
const ppi8255_interface stratgyx_ppi_1_intf =
{
NULL, /* Port A read */
NULL, /* Port B read */
DEVICE8_PORT("IN3"), /* Port C read */
sound_latch_w, /* Port A write */
scramble_sh_irqtrigger_w, /* Port B write */
NULL /* Port C write */
DEVCB_NULL, /* Port A read */
DEVCB_NULL, /* Port B read */
DEVCB_INPUT_PORT("IN3"), /* Port C read */
DEVCB_MEMORY_HANDLER("main", PROGRAM, soundlatch_w), /* Port A write */
DEVCB_HANDLER(scramble_sh_irqtrigger_w), /* Port B write */
DEVCB_NULL /* Port C write */
};
const ppi8255_interface scramble_protection_ppi_1_intf =
{
NULL, /* Port A read */
NULL, /* Port B read */
scramble_protection_r, /* Port C read */
sound_latch_w, /* Port A write */
scramble_sh_irqtrigger_w, /* Port B write */
scramble_protection_w /* Port C write */
DEVCB_NULL, /* Port A read */
DEVCB_NULL, /* Port B read */
DEVCB_HANDLER(scramble_protection_r), /* Port C read */
DEVCB_MEMORY_HANDLER("main", PROGRAM, soundlatch_w), /* Port A write */
DEVCB_HANDLER(scramble_sh_irqtrigger_w), /* Port B write */
DEVCB_HANDLER(scramble_protection_w) /* Port C write */
};
const ppi8255_interface mrkougar_ppi_1_intf =
{
NULL, /* Port A read */
NULL, /* Port B read */
NULL, /* Port C read */
sound_latch_w, /* Port A write */
mrkougar_sh_irqtrigger_w, /* Port B write */
NULL /* Port C write */
DEVCB_NULL, /* Port A read */
DEVCB_NULL, /* Port B read */
DEVCB_NULL, /* Port C read */
DEVCB_MEMORY_HANDLER("main", PROGRAM, soundlatch_w), /* Port A write */
DEVCB_HANDLER(mrkougar_sh_irqtrigger_w), /* Port B write */
DEVCB_NULL /* Port C write */
};