diff options
author | 2008-12-05 12:09:35 +0000 | |
---|---|---|
committer | 2008-12-05 12:09:35 +0000 | |
commit | b7da4d6684b6e6b606d8ce96fabbc9e3d6db09d1 (patch) | |
tree | f0a604da6b792570a3cc38de2e2ae9a9b649d9dc | |
parent | 3125b5e60ea9887cf619cd8cc4f7160f9dd40ec4 (diff) |
Added device paramter to 6526 callbacks
-rw-r--r-- | src/emu/machine/6526cia.c | 10 | ||||
-rw-r--r-- | src/emu/machine/6526cia.h | 5 | ||||
-rw-r--r-- | src/mame/drivers/alg.c | 29 | ||||
-rw-r--r-- | src/mame/drivers/arcadia.c | 19 | ||||
-rw-r--r-- | src/mame/drivers/cubocd32.c | 15 | ||||
-rw-r--r-- | src/mame/drivers/mquake.c | 21 | ||||
-rw-r--r-- | src/mame/drivers/upscope.c | 19 |
7 files changed, 57 insertions, 61 deletions
diff --git a/src/emu/machine/6526cia.c b/src/emu/machine/6526cia.c index 74e4664123d..1baa2d6d6eb 100644 --- a/src/emu/machine/6526cia.c +++ b/src/emu/machine/6526cia.c @@ -58,8 +58,8 @@ struct _cia_port UINT8 latch; UINT8 in; UINT8 out; - UINT8 (*read)(void); - void (*write)(UINT8); + UINT8 (*read)(const device_config *); + void (*write)(const device_config *, UINT8); UINT8 mask_value; /* in READ operation the value can be forced by a extern electric circuit */ }; @@ -612,7 +612,7 @@ READ8_DEVICE_HANDLER( cia_r ) case CIA_PRA: case CIA_PRB: port = &cia->port[offset & 1]; - data = port->read ? (*port->read)() : 0; + data = port->read ? (*port->read)(device) : 0; data = ((data & ~port->ddr) | (port->latch & port->ddr)) & port->mask_value; port->in = data; @@ -727,8 +727,8 @@ WRITE8_DEVICE_HANDLER( cia_w ) port = &cia->port[offset & 1]; port->latch = data; port->out = (data & port->ddr) | (port->in & ~port->ddr); - if (port->write) - (*port->write)(port->out); + if (port->write != NULL) + (*port->write)(device, port->out); break; /* port A/B direction */ diff --git a/src/emu/machine/6526cia.h b/src/emu/machine/6526cia.h index ef2bd0babb0..26bfe535462 100644 --- a/src/emu/machine/6526cia.h +++ b/src/emu/machine/6526cia.h @@ -32,8 +32,9 @@ struct _cia6526_interface struct { - UINT8 (*read)(void); - void (*write)(UINT8); + + UINT8 (*read)(const device_config *); + void (*write)(const device_config *, UINT8); } port[2]; }; diff --git a/src/mame/drivers/alg.c b/src/mame/drivers/alg.c index d0370c34e1f..c787dfb0295 100644 --- a/src/mame/drivers/alg.c +++ b/src/mame/drivers/alg.c @@ -22,7 +22,6 @@ #include "driver.h" #include "render.h" -#include "deprecat.h" #include "includes/amiga.h" #include "machine/laserdsc.h" #include "machine/6526cia.h" @@ -196,52 +195,52 @@ static CUSTOM_INPUT( lightgun_holster_r ) * *************************************/ -static void alg_cia_0_porta_w(UINT8 data) +static void alg_cia_0_porta_w(const device_config *device, UINT8 data) { /* switch banks as appropriate */ - memory_set_bank(Machine, 1, data & 1); + memory_set_bank(device->machine, 1, data & 1); /* swap the write handlers between ROM and bank 1 based on the bit */ if ((data & 1) == 0) /* overlay disabled, map RAM on 0x000000 */ - memory_install_write16_handler(cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, SMH_BANK1); + memory_install_write16_handler(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, SMH_BANK1); else /* overlay enabled, map Amiga system ROM on 0x000000 */ - memory_install_write16_handler(cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, SMH_UNMAP); + memory_install_write16_handler(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, SMH_UNMAP); } -static UINT8 alg_cia_0_porta_r(void) +static UINT8 alg_cia_0_porta_r(const device_config *device) { - return input_port_read(Machine, "FIRE") | 0x3f; + return input_port_read(device->machine, "FIRE") | 0x3f; } -static UINT8 alg_cia_0_portb_r(void) +static UINT8 alg_cia_0_portb_r(const device_config *device) { - logerror("%06x:alg_cia_0_portb_r\n", cpu_get_pc(Machine->activecpu)); + logerror("%06x:alg_cia_0_portb_r\n", cpu_get_pc(device->machine->activecpu)); return 0xff; } -static void alg_cia_0_portb_w(UINT8 data) +static void alg_cia_0_portb_w(const device_config *device, UINT8 data) { /* parallel port */ - logerror("%06x:alg_cia_0_portb_w(%02x)\n", cpu_get_pc(Machine->activecpu), data); + logerror("%06x:alg_cia_0_portb_w(%02x)\n", cpu_get_pc(device->machine->activecpu), data); } -static UINT8 alg_cia_1_porta_r(void) +static UINT8 alg_cia_1_porta_r(const device_config *device) { - logerror("%06x:alg_cia_1_porta_r\n", cpu_get_pc(Machine->activecpu)); + logerror("%06x:alg_cia_1_porta_r\n", cpu_get_pc(device->machine->activecpu)); return 0xff; } -static void alg_cia_1_porta_w(UINT8 data) +static void alg_cia_1_porta_w(const device_config *device, UINT8 data) { - logerror("%06x:alg_cia_1_porta_w(%02x)\n", cpu_get_pc(Machine->activecpu), data); + logerror("%06x:alg_cia_1_porta_w(%02x)\n", cpu_get_pc(device->machine->activecpu), data); } diff --git a/src/mame/drivers/arcadia.c b/src/mame/drivers/arcadia.c index e7849bfe27c..60e243c9faa 100644 --- a/src/mame/drivers/arcadia.c +++ b/src/mame/drivers/arcadia.c @@ -48,7 +48,6 @@ ***************************************************************************/ #include "driver.h" -#include "deprecat.h" #include "sound/custom.h" #include "includes/amiga.h" #include "machine/6526cia.h" @@ -93,24 +92,24 @@ static WRITE16_HANDLER( arcadia_multibios_change_game ) * *************************************/ -static UINT8 arcadia_cia_0_porta_r(void) +static UINT8 arcadia_cia_0_porta_r(const device_config *device) { - return input_port_read(Machine, "CIA0PORTA"); + return input_port_read(device->machine, "CIA0PORTA"); } -static void arcadia_cia_0_porta_w(UINT8 data) +static void arcadia_cia_0_porta_w(const device_config *device, UINT8 data) { /* switch banks as appropriate */ - memory_set_bank(Machine, 1, data & 1); + memory_set_bank(device->machine, 1, data & 1); /* swap the write handlers between ROM and bank 1 based on the bit */ if ((data & 1) == 0) /* overlay disabled, map RAM on 0x000000 */ - memory_install_write16_handler(cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, SMH_BANK1); + memory_install_write16_handler(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, SMH_BANK1); else /* overlay enabled, map Amiga system ROM on 0x000000 */ - memory_install_write16_handler(cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, SMH_UNMAP); + memory_install_write16_handler(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, SMH_UNMAP); /* bit 2 = Power Led on Amiga */ set_led_status(0, (data & 2) ? 0 : 1); @@ -133,12 +132,12 @@ static void arcadia_cia_0_porta_w(UINT8 data) * *************************************/ -static UINT8 arcadia_cia_0_portb_r(void) +static UINT8 arcadia_cia_0_portb_r(const device_config *device) { - return input_port_read(Machine, "CIA0PORTB"); + return input_port_read(device->machine, "CIA0PORTB"); } -static void arcadia_cia_0_portb_w(UINT8 data) +static void arcadia_cia_0_portb_w(const device_config *device, UINT8 data) { /* writing a 0 in the low bit clears one of the coins */ if ((data & 1) == 0) diff --git a/src/mame/drivers/cubocd32.c b/src/mame/drivers/cubocd32.c index d0278ceabc9..7698a713e5a 100644 --- a/src/mame/drivers/cubocd32.c +++ b/src/mame/drivers/cubocd32.c @@ -45,7 +45,6 @@ */ #include "driver.h" -#include "deprecat.h" #include "sound/custom.h" #include "includes/amiga.h" #include "includes/cubocd32.h" @@ -85,12 +84,12 @@ static WRITE32_HANDLER( aga_overlay_w ) * *************************************/ -static UINT8 cd32_cia_0_porta_r(void) +static UINT8 cd32_cia_0_porta_r(const device_config *device) { - return input_port_read(Machine, "CIA0PORTA"); + return input_port_read(device->machine, "CIA0PORTA"); } -static void cd32_cia_0_porta_w(UINT8 data) +static void cd32_cia_0_porta_w(const device_config *device, UINT8 data) { /* bit 1 = cd audio mute */ sndti_set_output_gain(SOUND_CDDA, 0, 0, ( data & 1 ) ? 0.0 : 1.0 ); @@ -114,17 +113,17 @@ static void cd32_cia_0_porta_w(UINT8 data) * *************************************/ -static UINT8 cd32_cia_0_portb_r(void) +static UINT8 cd32_cia_0_portb_r(const device_config *device) { /* parallel port */ - logerror("%06x:CIA0_portb_r\n", cpu_get_pc(Machine->activecpu)); + logerror("%06x:CIA0_portb_r\n", cpu_get_pc(device->machine->activecpu)); return 0xff; } -static void cd32_cia_0_portb_w(UINT8 data) +static void cd32_cia_0_portb_w(const device_config *device, UINT8 data) { /* parallel port */ - logerror("%06x:CIA0_portb_w(%02x)\n", cpu_get_pc(Machine->activecpu), data); + logerror("%06x:CIA0_portb_w(%02x)\n", cpu_get_pc(device->machine->activecpu), data); } static ADDRESS_MAP_START( cd32_map, ADDRESS_SPACE_PROGRAM, 32 ) diff --git a/src/mame/drivers/mquake.c b/src/mame/drivers/mquake.c index 2a6d6a40382..c01465d6152 100644 --- a/src/mame/drivers/mquake.c +++ b/src/mame/drivers/mquake.c @@ -8,7 +8,6 @@ #include "driver.h" -#include "deprecat.h" #include "includes/amiga.h" #include "sound/es5503.h" #include "machine/6526cia.h" @@ -30,24 +29,24 @@ * *************************************/ -static UINT8 mquake_cia_0_porta_r(void) +static UINT8 mquake_cia_0_porta_r(const device_config *device) { - return input_port_read(Machine, "CIA0PORTA"); + return input_port_read(device->machine, "CIA0PORTA"); } -static void mquake_cia_0_porta_w(UINT8 data) +static void mquake_cia_0_porta_w(const device_config *device, UINT8 data) { /* switch banks as appropriate */ - memory_set_bank(Machine, 1, data & 1); + memory_set_bank(device->machine, 1, data & 1); /* swap the write handlers between ROM and bank 1 based on the bit */ if ((data & 1) == 0) /* overlay disabled, map RAM on 0x000000 */ - memory_install_write16_handler(cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, SMH_BANK1); + memory_install_write16_handler(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, SMH_BANK1); else /* overlay enabled, map Amiga system ROM on 0x000000 */ - memory_install_write16_handler(cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, SMH_UNMAP); + memory_install_write16_handler(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, SMH_UNMAP); } @@ -67,17 +66,17 @@ static void mquake_cia_0_porta_w(UINT8 data) * *************************************/ -static UINT8 mquake_cia_0_portb_r(void) +static UINT8 mquake_cia_0_portb_r(const device_config *device) { /* parallel port */ - logerror("%06x:CIA0_portb_r\n", cpu_get_pc(Machine->activecpu)); + logerror("%06x:CIA0_portb_r\n", cpu_get_pc(device->machine->activecpu)); return 0xff; } -static void mquake_cia_0_portb_w(UINT8 data) +static void mquake_cia_0_portb_w(const device_config *device, UINT8 data) { /* parallel port */ - logerror("%06x:CIA0_portb_w(%02x)\n", cpu_get_pc(Machine->activecpu), data); + logerror("%06x:CIA0_portb_w(%02x)\n", cpu_get_pc(device->machine->activecpu), data); } diff --git a/src/mame/drivers/upscope.c b/src/mame/drivers/upscope.c index c41b8962486..ed1b6abd4fb 100644 --- a/src/mame/drivers/upscope.c +++ b/src/mame/drivers/upscope.c @@ -24,7 +24,6 @@ **********************************************************************************/ #include "driver.h" -#include "deprecat.h" #include "includes/amiga.h" #include "machine/6526cia.h" @@ -81,19 +80,19 @@ static void upscope_reset(void) * *************************************/ -static void upscope_cia_0_porta_w(UINT8 data) +static void upscope_cia_0_porta_w(const device_config *device, UINT8 data) { /* switch banks as appropriate */ - memory_set_bank(Machine, 1, data & 1); + memory_set_bank(device->machine, 1, data & 1); /* swap the write handlers between ROM and bank 1 based on the bit */ if ((data & 1) == 0) /* overlay disabled, map RAM on 0x000000 */ - memory_install_write16_handler(cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, SMH_BANK1); + memory_install_write16_handler(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, SMH_BANK1); else /* overlay enabled, map Amiga system ROM on 0x000000 */ - memory_install_write16_handler(cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, SMH_UNMAP); + memory_install_write16_handler(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, SMH_UNMAP); } @@ -113,12 +112,12 @@ static void upscope_cia_0_porta_w(UINT8 data) * *************************************/ -static void upscope_cia_0_portb_w(UINT8 data) +static void upscope_cia_0_portb_w(const device_config *device, UINT8 data) { parallel_data = data; } -static UINT8 upscope_cia_0_portb_r(void) +static UINT8 upscope_cia_0_portb_r(const device_config *device) { return nvram_data_latch; } @@ -140,12 +139,12 @@ static UINT8 upscope_cia_0_portb_r(void) * *************************************/ -static UINT8 upscope_cia_1_porta_r(void) +static UINT8 upscope_cia_1_porta_r(const device_config *device) { return 0xf8 | (prev_cia1_porta & 0x07); } -static void upscope_cia_1_porta_w(UINT8 data) +static void upscope_cia_1_porta_w(const device_config *device, UINT8 data) { /* on a low transition of POUT, we latch stuff for the NVRAM */ if ((prev_cia1_porta & 2) && !(data & 2)) @@ -211,7 +210,7 @@ static void upscope_cia_1_porta_w(UINT8 data) if (data & 4) { if (LOG_IO) logerror("Internal register (%d) read\n", nvram_address_latch); - nvram_data_latch = (nvram_address_latch == 0) ? input_port_read(Machine, "IO0") : 0xff; + nvram_data_latch = (nvram_address_latch == 0) ? input_port_read(device->machine, "IO0") : 0xff; } /* if SEL == 0, we read NVRAM */ |