diff options
author | Aaron Giles <aaron@aarongiles.com> | 2008-06-26 15:34:42 +0000 |
---|---|---|
committer | Aaron Giles <aaron@aarongiles.com> | 2008-06-26 15:34:42 +0000 |
commit | 652fc279ae6e7ae2c113ad0cb48d9e71fce0e05a (patch) | |
tree | 3c606fe9d0598299461bb4e1b92b32c2d10bfc3e | |
parent | ba2fb8554b740f9f976501647d0b6c1307c17971 (diff) |
From: Oliver Stoeneberg [mailto:oliverst@online.de]
Subject: another Machine -> machine cleanup
This cleans up most of the Machine stuff in src/emu/machine. There is
a bit left to clean up, but it's mostly stuck at some interfaces now.
68 files changed, 478 insertions, 499 deletions
diff --git a/src/emu/cpu/m6502/m6502.c b/src/emu/cpu/m6502/m6502.c index 8317e785f2e..a1a341a3fd3 100644 --- a/src/emu/cpu/m6502/m6502.c +++ b/src/emu/cpu/m6502/m6502.c @@ -29,7 +29,6 @@ #define HAS_M65C02 1 #endif -#include "deprecat.h" #include "debugger.h" #include "m6502.h" #include "ops02.h" diff --git a/src/emu/cpu/m6502/m6509.c b/src/emu/cpu/m6502/m6509.c index 39493549326..fac40436cce 100644 --- a/src/emu/cpu/m6502/m6509.c +++ b/src/emu/cpu/m6502/m6509.c @@ -37,7 +37,6 @@ addresses take place. */ -#include "deprecat.h" #include "debugger.h" #include "m6509.h" diff --git a/src/emu/cpu/saturn/saturn.c b/src/emu/cpu/saturn/saturn.c index 820cd010c2d..39c3d7babd8 100644 --- a/src/emu/cpu/saturn/saturn.c +++ b/src/emu/cpu/saturn/saturn.c @@ -24,7 +24,6 @@ #include "debugger.h" #include "saturn.h" -#include "deprecat.h" /* for Machine */ #define R0 0 #define R1 1 diff --git a/src/emu/inptport.c b/src/emu/inptport.c index f778dcece20..dfa3d7a441f 100644 --- a/src/emu/inptport.c +++ b/src/emu/inptport.c @@ -98,7 +98,6 @@ #include "profiler.h" #include "inputseq.h" #include "ui.h" -#include "deprecat.h" #include <ctype.h> #include <time.h> #include <stdarg.h> diff --git a/src/emu/machine/53c810.c b/src/emu/machine/53c810.c index 47128431a31..09dddd28c92 100644 --- a/src/emu/machine/53c810.c +++ b/src/emu/machine/53c810.c @@ -481,7 +481,7 @@ READ8_HANDLER( lsi53c810_reg_r ) // clear the interrupt on service if(intf->irq_callback != NULL) { - intf->irq_callback(Machine, 0); + intf->irq_callback(machine, 0); } return lsi810.istat; diff --git a/src/emu/machine/6522via.c b/src/emu/machine/6522via.c index 2db058b6286..b8ec3aba945 100644 --- a/src/emu/machine/6522via.c +++ b/src/emu/machine/6522via.c @@ -23,7 +23,6 @@ */ #include "driver.h" -#include "deprecat.h" #include "6522via.h" //#define TRACE_VIA @@ -135,8 +134,8 @@ struct via6522 #define INT_T1 0x40 #define INT_ANY 0x80 -#define CLR_PA_INT(v, which) via_clear_int (which, INT_CA1 | ((!CA2_IND_IRQ(v->pcr)) ? INT_CA2: 0)) -#define CLR_PB_INT(v, which) via_clear_int (which, INT_CB1 | ((!CB2_IND_IRQ(v->pcr)) ? INT_CB2: 0)) +#define CLR_PA_INT(v, which) via_clear_int (machine, which, INT_CA1 | ((!CA2_IND_IRQ(v->pcr)) ? INT_CA2: 0)) +#define CLR_PB_INT(v, which) via_clear_int (machine, which, INT_CB1 | ((!CB2_IND_IRQ(v->pcr)) ? INT_CB2: 0)) #define IFR_DELAY 3 @@ -171,7 +170,7 @@ void via_config(int which, const struct via6522_interface *intf) /******************* external interrupt check *******************/ -static void via_set_int (int which, int data) +static void via_set_int (running_machine *machine, int which, int data) { struct via6522 *v = via + which; @@ -185,13 +184,13 @@ logerror("6522VIA chip %d: IFR = %02X. PC: %08X\n", which, v->ifr, safe_activec { v->ifr |= INT_ANY; if (v->intf->irq_func) - (*v->intf->irq_func)(Machine, ASSERT_LINE); + (*v->intf->irq_func)(machine, ASSERT_LINE); else logerror("6522VIA chip %d: Interrupt is asserted but there is no callback function. PC: %08X\n", which, safe_activecpu_get_pc()); } } -static void via_clear_int (int which, int data) +static void via_clear_int (running_machine *machine, int which, int data) { struct via6522 *v = via + which; @@ -206,7 +205,7 @@ logerror("6522VIA chip %d: IFR = %02X. PC: %08X\n", which, v->ifr, safe_activec else { if (v->intf->irq_func) - (*v->intf->irq_func)(Machine, CLEAR_LINE); + (*v->intf->irq_func)(machine, CLEAR_LINE); // else // logerror("6522VIA chip %d: Interrupt is cleared but there is no callback function. PC: %08X\n", which, safe_activecpu_get_pc()); } @@ -241,7 +240,7 @@ INLINE UINT16 v_get_counter1_value(struct via6522 *v) { static TIMER_CALLBACK( via_shift_callback ); -static void via_shift(int which) +static void via_shift(running_machine *machine, int which) { struct via6522 *v = via + which; @@ -251,14 +250,14 @@ static void via_shift(int which) v->sr = (v->sr << 1) | v->out_cb2; if (v->intf->out_cb2_func) - v->intf->out_cb2_func(Machine, 0, v->out_cb2); + v->intf->out_cb2_func(machine, 0, v->out_cb2); v->in_cb1=1; if (v->intf->out_cb1_func) { /* this should be one cycle wide */ - v->intf->out_cb1_func(Machine, 0, 0); - v->intf->out_cb1_func(Machine, 0, 1); + v->intf->out_cb1_func(machine, 0, 0); + v->intf->out_cb1_func(machine, 0, 1); } v->shift_counter = (v->shift_counter + 1) % 8; @@ -268,7 +267,7 @@ static void via_shift(int which) else { if (!(v->ifr & INT_SR)) - via_set_int(which, INT_SR); + via_set_int(machine, which, INT_SR); } } if (SO_EXT_CONTROL(v->acr)) @@ -277,20 +276,20 @@ static void via_shift(int which) v->sr = (v->sr << 1) | v->out_cb2; if (v->intf->out_cb2_func) - v->intf->out_cb2_func(Machine, 0, v->out_cb2); + v->intf->out_cb2_func(machine, 0, v->out_cb2); v->shift_counter = (v->shift_counter + 1) % 8; if (v->shift_counter == 0) { if (!(v->ifr & INT_SR)) - via_set_int(which, INT_SR); + via_set_int(machine, which, INT_SR); } } if (SI_EXT_CONTROL(v->acr)) { if (v->intf->in_cb2_func) - v->in_cb2 = v->intf->in_cb2_func(Machine, 0); + v->in_cb2 = v->intf->in_cb2_func(machine, 0); v->sr = (v->sr << 1) | (v->in_cb2 & 1); @@ -300,7 +299,7 @@ static void via_shift(int which) { if (!(v->ifr & INT_SR)) { - via_set_int(which, INT_SR); + via_set_int(machine, which, INT_SR); } } } @@ -308,7 +307,7 @@ static void via_shift(int which) static TIMER_CALLBACK( via_shift_callback ) { - via_shift(param); + via_shift(machine, param); } /******************* Timer timeouts *************************/ @@ -343,7 +342,7 @@ static TIMER_CALLBACK( via_t1_timeout ) } if (!(v->ifr & INT_T1)) - via_set_int (which, INT_T1); + via_set_int (machine, which, INT_T1); } static TIMER_CALLBACK( via_t2_timeout ) @@ -355,7 +354,7 @@ static TIMER_CALLBACK( via_t2_timeout ) v->time2 = timer_get_time(); if (!(v->ifr & INT_T2)) - via_set_int (which, INT_T2); + via_set_int (machine, which, INT_T2); } /******************* reset *******************/ @@ -389,7 +388,7 @@ void via_reset(void) /******************* CPU interface for VIA read *******************/ -int via_read(int which, int offset) +int via_read(running_machine *machine, int which, int offset) { struct via6522 *v = via + which; int val = 0; @@ -403,7 +402,7 @@ int via_read(int which, int offset) if (PB_LATCH_ENABLE(v->acr) == 0) { if (v->intf->in_b_func) - v->in_b = v->intf->in_b_func(Machine, 0); + v->in_b = v->intf->in_b_func(machine, 0); else logerror("6522VIA chip %d: Port B is being read but has no handler. PC: %08X\n", which, safe_activecpu_get_pc()); } @@ -422,7 +421,7 @@ int via_read(int which, int offset) if (PA_LATCH_ENABLE(v->acr) == 0) { if (v->intf->in_a_func) - v->in_a = v->intf->in_a_func(Machine, 0); + v->in_a = v->intf->in_a_func(machine, 0); else logerror("6522VIA chip %d: Port A is being read but has no handler. PC: %08X\n", which, safe_activecpu_get_pc()); } @@ -443,7 +442,7 @@ int via_read(int which, int offset) /* call the CA2 output function */ if (v->intf->out_ca2_func) - v->intf->out_ca2_func(Machine, 0, 0); + v->intf->out_ca2_func(machine, 0, 0); else logerror("6522VIA chip %d: Port CA2 is being written to but has no handler. PC: %08X - %02X\n", which, safe_activecpu_get_pc(), 0); } @@ -456,7 +455,7 @@ int via_read(int which, int offset) if (PA_LATCH_ENABLE(v->acr) == 0) { if (v->intf->in_a_func) - v->in_a = v->intf->in_a_func(Machine, 0); + v->in_a = v->intf->in_a_func(machine, 0); else logerror("6522VIA chip %d: Port A is being read but has no handler. PC: %08X\n", which, safe_activecpu_get_pc()); } @@ -474,7 +473,7 @@ int via_read(int which, int offset) break; case VIA_T1CL: - via_clear_int (which, INT_T1); + via_clear_int (machine, which, INT_T1); val = v_get_counter1_value(v) & 0xFF; break; @@ -491,7 +490,7 @@ int via_read(int which, int offset) break; case VIA_T2CL: - via_clear_int (which, INT_T2); + via_clear_int (machine, which, INT_T2); if (v->t2_active) val = v_time_to_cycles(v, timer_timeleft(v->t2)) & 0xff; else @@ -517,7 +516,7 @@ int via_read(int which, int offset) case VIA_SR: val = v->sr; - via_clear_int(which, INT_SR); + via_clear_int(machine, which, INT_SR); if (SO_O2_CONTROL(v->acr)) { v->shift_counter=0; @@ -547,7 +546,7 @@ int via_read(int which, int offset) /******************* CPU interface for VIA write *******************/ -void via_write(int which, int offset, int data) +void via_write(running_machine *machine, int which, int offset, int data) { struct via6522 *v = via + which; @@ -566,7 +565,7 @@ void via_write(int which, int offset, int data) UINT8 write_data = (v->out_b & v->ddr_b) | (v->ddr_b ^ 0xff); if (v->intf->out_b_func) - v->intf->out_b_func(Machine, 0, write_data); + v->intf->out_b_func(machine, 0, write_data); else logerror("6522VIA chip %d: Port B is being written to but has no handler. PC: %08X - %02X\n", which, safe_activecpu_get_pc(), write_data); } @@ -584,7 +583,7 @@ void via_write(int which, int offset, int data) /* call the CB2 output function */ if (v->intf->out_cb2_func) - v->intf->out_cb2_func(Machine, 0, 0); + v->intf->out_cb2_func(machine, 0, 0); else logerror("6522VIA chip %d: Port CB2 is being written to but has no handler. PC: %08X - %02X\n", which, safe_activecpu_get_pc(), 0); } @@ -599,7 +598,7 @@ void via_write(int which, int offset, int data) UINT8 write_data = (v->out_a & v->ddr_a) | (v->ddr_a ^ 0xff); if (v->intf->out_a_func) - v->intf->out_a_func(Machine, 0, write_data); + v->intf->out_a_func(machine, 0, write_data); else logerror("6522VIA chip %d: Port A is being written to but has no handler. PC: %08X - %02X\n", which, safe_activecpu_get_pc(), write_data); } @@ -613,8 +612,8 @@ void via_write(int which, int offset, int data) /* call the CA2 output function */ if (v->intf->out_ca2_func) { - v->intf->out_ca2_func(Machine, 0, 0); - v->intf->out_ca2_func(Machine, 0, 1); + v->intf->out_ca2_func(machine, 0, 0); + v->intf->out_ca2_func(machine, 0, 1); } else logerror("6522VIA chip %d: Port CA2 is being pulsed but has no handler. PC: %08X\n", which, safe_activecpu_get_pc()); @@ -631,7 +630,7 @@ void via_write(int which, int offset, int data) /* call the CA2 output function */ if (v->intf->out_ca2_func) - v->intf->out_ca2_func(Machine, 0, 0); + v->intf->out_ca2_func(machine, 0, 0); else logerror("6522VIA chip %d: Port CA2 is being written to but has no handler. PC: %08X - %02X\n", which, safe_activecpu_get_pc(), 0); } @@ -647,7 +646,7 @@ void via_write(int which, int offset, int data) UINT8 write_data = (v->out_a & v->ddr_a) | (v->ddr_a ^ 0xff); if (v->intf->out_a_func) - v->intf->out_a_func(Machine, 0, write_data); + v->intf->out_a_func(machine, 0, write_data); else logerror("6522VIA chip %d: Port A is being written to but has no handler. PC: %08X - %02X\n", which, safe_activecpu_get_pc(), write_data); } @@ -665,7 +664,7 @@ void via_write(int which, int offset, int data) UINT8 write_data = (v->out_b & v->ddr_b) | (v->ddr_b ^ 0xff); if (v->intf->out_b_func) - v->intf->out_b_func(Machine, 0, write_data); + v->intf->out_b_func(machine, 0, write_data); else logerror("6522VIA chip %d: Port B is being written to but has no handler. PC: %08X - %02X\n", which, safe_activecpu_get_pc(), write_data); } @@ -683,7 +682,7 @@ void via_write(int which, int offset, int data) UINT8 write_data = (v->out_a & v->ddr_a) | (v->ddr_a ^ 0xff); if (v->intf->out_a_func) - v->intf->out_a_func(Machine, 0, write_data); + v->intf->out_a_func(machine, 0, write_data); else logerror("6522VIA chip %d: Port A is being written to but has no handler. PC: %08X - %02X\n", which, safe_activecpu_get_pc(), write_data); } @@ -697,14 +696,14 @@ void via_write(int which, int offset, int data) case VIA_T1LH: v->t1lh = data; - via_clear_int (which, INT_T1); + via_clear_int (machine, which, INT_T1); break; case VIA_T1CH: v->t1ch = v->t1lh = data; v->t1cl = v->t1ll; - via_clear_int (which, INT_T1); + via_clear_int (machine, which, INT_T1); if (T1_SET_PB7(v->acr)) { @@ -715,7 +714,7 @@ void via_write(int which, int offset, int data) UINT8 write_data = (v->out_b & v->ddr_b) | (v->ddr_b ^ 0xff); if (v->intf->out_b_func) - v->intf->out_b_func(Machine, 0, write_data); + v->intf->out_b_func(machine, 0, write_data); else logerror("6522VIA chip %d: Port B is being written to but has no handler. PC: %08X - %02X\n", which, safe_activecpu_get_pc(), write_data); } @@ -732,7 +731,7 @@ void via_write(int which, int offset, int data) v->t2ch = v->t2lh = data; v->t2cl = v->t2ll; - via_clear_int (which, INT_T2); + via_clear_int (machine, which, INT_T2); if (!T2_COUNT_PB6(v->acr)) { @@ -748,7 +747,7 @@ void via_write(int which, int offset, int data) case VIA_SR: v->sr = data; v->shift_counter=0; - via_clear_int(which, INT_SR); + via_clear_int(machine, which, INT_SR); if (SO_O2_CONTROL(v->acr)) { timer_set(v_cycles_to_time(v, 2), NULL, which, via_shift_callback); @@ -765,7 +764,7 @@ logerror("6522VIA chip %d: PCR = %02X. PC: %08X\n", which, data, safe_activecpu { v->out_ca2 = CA2_OUTPUT_LEVEL(data); if (v->intf->out_ca2_func) - v->intf->out_ca2_func(Machine, 0, v->out_ca2); + v->intf->out_ca2_func(machine, 0, v->out_ca2); else logerror("6522VIA chip %d: Port CA2 is being written to but has no handler. PC: %08X - %02X\n", which, safe_activecpu_get_pc(), v->out_ca2); } @@ -774,7 +773,7 @@ logerror("6522VIA chip %d: PCR = %02X. PC: %08X\n", which, data, safe_activecpu { v->out_cb2 = CB2_OUTPUT_LEVEL(data); if (v->intf->out_cb2_func) - v->intf->out_cb2_func(Machine, 0, v->out_cb2); + v->intf->out_cb2_func(machine, 0, v->out_cb2); else logerror("6522VIA chip %d: Port CB2 is being written to but has no handler. PC: %08X - %02X\n", which, safe_activecpu_get_pc(), v->out_cb2); } @@ -796,7 +795,7 @@ logerror("6522VIA chip %d: PCR = %02X. PC: %08X\n", which, data, safe_activecpu UINT8 write_data = (v->out_b & v->ddr_b) | (v->ddr_b ^ 0xff); if (v->intf->out_b_func) - v->intf->out_b_func(Machine, 0, write_data); + v->intf->out_b_func(machine, 0, write_data); else logerror("6522VIA chip %d: Port B is being written to but has no handler. PC: %08X - %02X\n", which, safe_activecpu_get_pc(), write_data); } @@ -821,7 +820,7 @@ logerror("6522VIA chip %d: PCR = %02X. PC: %08X\n", which, data, safe_activecpu { v->ifr &= ~INT_ANY; if (v->intf->irq_func) - (*v->intf->irq_func)(Machine, CLEAR_LINE); + (*v->intf->irq_func)(machine, CLEAR_LINE); // else // logerror("6522VIA chip %d: Interrupt is cleared but there is no callback function. PC: %08X\n", which, safe_activecpu_get_pc()); } @@ -832,7 +831,7 @@ logerror("6522VIA chip %d: PCR = %02X. PC: %08X\n", which, data, safe_activecpu { v->ifr |= INT_ANY; if (v->intf->irq_func) - (*v->intf->irq_func)(Machine, ASSERT_LINE); + (*v->intf->irq_func)(machine, ASSERT_LINE); else logerror("6522VIA chip %d: Interrupt is asserted but there is no callback function. PC: %08X\n", which, safe_activecpu_get_pc()); } @@ -842,7 +841,7 @@ logerror("6522VIA chip %d: PCR = %02X. PC: %08X\n", which, data, safe_activecpu case VIA_IFR: if (data & INT_ANY) data = 0x7f; - via_clear_int (which, data); + via_clear_int (machine, which, data); break; } } @@ -859,7 +858,7 @@ void via_set_input_a(int which, int data) /******************* interface setting VIA port CA1 input *******************/ -void via_set_input_ca1(int which, int data) +void via_set_input_ca1(running_machine *machine, int which, int data) { struct via6522 *v = via + which; @@ -877,12 +876,12 @@ logerror("6522VIA chip %d: CA1 = %02X. PC: %08X\n", which, data, safe_activecpu if (PA_LATCH_ENABLE(v->acr)) { if (v->intf->in_a_func) - v->in_a = v->intf->in_a_func(Machine, 0); + v->in_a = v->intf->in_a_func(machine, 0); else logerror("6522VIA chip %d: Port A is being read but has no handler. PC: %08X\n", which, safe_activecpu_get_pc()); } - via_set_int (which, INT_CA1); + via_set_int (machine, which, INT_CA1); /* CA2 is configured as output and in pulse or handshake mode, CA2 is cleared now */ @@ -895,7 +894,7 @@ logerror("6522VIA chip %d: CA1 = %02X. PC: %08X\n", which, data, safe_activecpu /* call the CA2 output function */ if (v->intf->out_ca2_func) - v->intf->out_ca2_func(Machine, 0, 1); + v->intf->out_ca2_func(machine, 0, 1); else logerror("6522VIA chip %d: Port CA2 is being written to but has no handler. PC: %08X - %02X\n", which, safe_activecpu_get_pc(), 1); } @@ -908,7 +907,7 @@ logerror("6522VIA chip %d: CA1 = %02X. PC: %08X\n", which, data, safe_activecpu /******************* interface setting VIA port CA2 input *******************/ -void via_set_input_ca2(int which, int data) +void via_set_input_ca2(running_machine *machine, int which, int data) { struct via6522 *v = via + which; @@ -925,7 +924,7 @@ void via_set_input_ca2(int which, int data) if ((data && CA2_LOW_TO_HIGH(v->pcr)) || (!data && CA2_HIGH_TO_LOW(v->pcr))) { /* mark the IRQ */ - via_set_int (which, INT_CA2); + via_set_int (machine, which, INT_CA2); } /* set the new value for CA2 */ v->in_ca2 = data; @@ -949,7 +948,7 @@ void via_set_input_b(int which, int data) /******************* interface setting VIA port CB1 input *******************/ -void via_set_input_cb1(int which, int data) +void via_set_input_cb1(running_machine *machine, int which, int data) { struct via6522 *v = via + which; @@ -964,14 +963,14 @@ void via_set_input_cb1(int which, int data) if (PB_LATCH_ENABLE(v->acr)) { if (v->intf->in_b_func) - v->in_b = v->intf->in_b_func(Machine, 0); + v->in_b = v->intf->in_b_func(machine, 0); else logerror("6522VIA chip %d: Port B is being read but has no handler. PC: %08X\n", which, safe_activecpu_get_pc()); } if (SO_EXT_CONTROL(v->acr) || SI_EXT_CONTROL(v->acr)) - via_shift (which); + via_shift (machine, which); - via_set_int (which, INT_CB1); + via_set_int (machine, which, INT_CB1); /* CB2 is configured as output and in pulse or handshake mode, CB2 is cleared now */ @@ -984,7 +983,7 @@ void via_set_input_cb1(int which, int data) /* call the CB2 output function */ if (v->intf->out_cb2_func) - v->intf->out_cb2_func(Machine, 0, 1); + v->intf->out_cb2_func(machine, 0, 1); else logerror("6522VIA chip %d: Port CB2 is being written to but has no handler. PC: %08X - %02X\n", which, safe_activecpu_get_pc(), 1); } @@ -996,7 +995,7 @@ void via_set_input_cb1(int which, int data) /******************* interface setting VIA port CB2 input *******************/ -void via_set_input_cb2(int which, int data) +void via_set_input_cb2(running_machine *machine, int which, int data) { struct via6522 *v = via + which; @@ -1013,7 +1012,7 @@ void via_set_input_cb2(int which, int data) if ((data && CB2_LOW_TO_HIGH(v->pcr)) || (!data && CB2_HIGH_TO_LOW(v->pcr))) { /* mark the IRQ */ - via_set_int (which, INT_CB2); + via_set_int (machine, which, INT_CB2); } /* set the new value for CB2 */ v->in_cb2 = data; @@ -1023,23 +1022,23 @@ void via_set_input_cb2(int which, int data) /******************* Standard 8-bit CPU interfaces, D0-D7 *******************/ -READ8_HANDLER( via_0_r) { return via_read(0, offset); } -READ8_HANDLER( via_1_r) { return via_read(1, offset); } -READ8_HANDLER( via_2_r) { return via_read(2, offset); } -READ8_HANDLER( via_3_r) { return via_read(3, offset); } -READ8_HANDLER( via_4_r) { return via_read(4, offset); } -READ8_HANDLER( via_5_r) { return via_read(5, offset); } -READ8_HANDLER( via_6_r) { return via_read(6, offset); } -READ8_HANDLER( via_7_r) { return via_read(7, offset); } - -WRITE8_HANDLER( via_0_w) { via_write(0, offset, data); } -WRITE8_HANDLER( via_1_w) { via_write(1, offset, data); } -WRITE8_HANDLER( via_2_w) { via_write(2, offset, data); } -WRITE8_HANDLER( via_3_w) { via_write(3, offset, data); } -WRITE8_HANDLER( via_4_w) { via_write(4, offset, data); } -WRITE8_HANDLER( via_5_w) { via_write(5, offset, data); } -WRITE8_HANDLER( via_6_w) { via_write(6, offset, data); } -WRITE8_HANDLER( via_7_w) { via_write(7, offset, data); } +READ8_HANDLER( via_0_r) { return via_read(machine, 0, offset); } +READ8_HANDLER( via_1_r) { return via_read(machine, 1, offset); } +READ8_HANDLER( via_2_r) { return via_read(machine, 2, offset); } +READ8_HANDLER( via_3_r) { return via_read(machine, 3, offset); } +READ8_HANDLER( via_4_r) { return via_read(machine, 4, offset); } +READ8_HANDLER( via_5_r) { return via_read(machine, 5, offset); } +READ8_HANDLER( via_6_r) { return via_read(machine, 6, offset); } +READ8_HANDLER( via_7_r) { return via_read(machine, 7, offset); } + +WRITE8_HANDLER( via_0_w) { via_write(machine, 0, offset, data); } +WRITE8_HANDLER( via_1_w) { via_write(machine, 1, offset, data); } +WRITE8_HANDLER( via_2_w) { via_write(machine, 2, offset, data); } +WRITE8_HANDLER( via_3_w) { via_write(machine, 3, offset, data); } +WRITE8_HANDLER( via_4_w) { via_write(machine, 4, offset, data); } +WRITE8_HANDLER( via_5_w) { via_write(machine, 5, offset, data); } +WRITE8_HANDLER( via_6_w) { via_write(machine, 6, offset, data); } +WRITE8_HANDLER( via_7_w) { via_write(machine, 7, offset, data); } /******************* 8-bit A/B port interfaces *******************/ @@ -1081,39 +1080,39 @@ READ8_HANDLER( via_7_portb_r) { return via[7].in_b; } /******************* 1-bit CA1/CA2/CB1/CB2 port interfaces *******************/ -WRITE8_HANDLER( via_0_ca1_w) { via_set_input_ca1(0, data); } -WRITE8_HANDLER( via_1_ca1_w) { via_set_input_ca1(1, data); } -WRITE8_HANDLER( via_2_ca1_w) { via_set_input_ca1(2, data); } -WRITE8_HANDLER( via_3_ca1_w) { via_set_input_ca1(3, data); } -WRITE8_HANDLER( via_4_ca1_w) { via_set_input_ca1(4, data); } -WRITE8_HANDLER( via_5_ca1_w) { via_set_input_ca1(5, data); } -WRITE8_HANDLER( via_6_ca1_w) { via_set_input_ca1(6, data); } -WRITE8_HANDLER( via_7_ca1_w) { via_set_input_ca1(7, data); } -WRITE8_HANDLER( via_0_ca2_w) { via_set_input_ca2(0, data); } -WRITE8_HANDLER( via_1_ca2_w) { via_set_input_ca2(1, data); } -WRITE8_HANDLER( via_2_ca2_w) { via_set_input_ca2(2, data); } -WRITE8_HANDLER( via_3_ca2_w) { via_set_input_ca2(3, data); } -WRITE8_HANDLER( via_4_ca2_w) { via_set_input_ca2(4, data); } -WRITE8_HANDLER( via_5_ca2_w) { via_set_input_ca2(5, data); } -WRITE8_HANDLER( via_6_ca2_w) { via_set_input_ca2(6, data); } -WRITE8_HANDLER( via_7_ca2_w) { via_set_input_ca2(7, data); } - -WRITE8_HANDLER( via_0_cb1_w) { via_set_input_cb1(0, data); } -WRITE8_HANDLER( via_1_cb1_w) { via_set_input_cb1(1, data); } -WRITE8_HANDLER( via_2_cb1_w) { via_set_input_cb1(2, data); } -WRITE8_HANDLER( via_3_cb1_w) { via_set_input_cb1(3, data); } -WRITE8_HANDLER( via_4_cb1_w) { via_set_input_cb1(4, data); } -WRITE8_HANDLER( via_5_cb1_w) { via_set_input_cb1(5, data); } -WRITE8_HANDLER( via_6_cb1_w) { via_set_input_cb1(6, data); } -WRITE8_HANDLER( via_7_cb1_w) { via_set_input_cb1(7, data); } -WRITE8_HANDLER( via_0_cb2_w) { via_set_input_cb2(0, data); } -WRITE8_HANDLER( via_1_cb2_w) { via_set_input_cb2(1, data); } -WRITE8_HANDLER( via_2_cb2_w) { via_set_input_cb2(2, data); } -WRITE8_HANDLER( via_3_cb2_w) { via_set_input_cb2(3, data); } -WRITE8_HANDLER( via_4_cb2_w) { via_set_input_cb2(4, data); } -WRITE8_HANDLER( via_5_cb2_w) { via_set_input_cb2(5, data); } -WRITE8_HANDLER( via_6_cb2_w) { via_set_input_cb2(6, data); } -WRITE8_HANDLER( via_7_cb2_w) { via_set_input_cb2(7, data); } +WRITE8_HANDLER( via_0_ca1_w) { via_set_input_ca1(machine, 0, data); } +WRITE8_HANDLER( via_1_ca1_w) { via_set_input_ca1(machine, 1, data); } +WRITE8_HANDLER( via_2_ca1_w) { via_set_input_ca1(machine, 2, data); } +WRITE8_HANDLER( via_3_ca1_w) { via_set_input_ca1(machine, 3, data); } +WRITE8_HANDLER( via_4_ca1_w) { via_set_input_ca1(machine, 4, data); } +WRITE8_HANDLER( via_5_ca1_w) { via_set_input_ca1(machine, 5, data); } +WRITE8_HANDLER( via_6_ca1_w) { via_set_input_ca1(machine, 6, data); } +WRITE8_HANDLER( via_7_ca1_w) { via_set_input_ca1(machine, 7, data); } +WRITE8_HANDLER( via_0_ca2_w) { via_set_input_ca2(machine, 0, data); } +WRITE8_HANDLER( via_1_ca2_w) { via_set_input_ca2(machine, 1, data); } +WRITE8_HANDLER( via_2_ca2_w) { via_set_input_ca2(machine, 2, data); } +WRITE8_HANDLER( via_3_ca2_w) { via_set_input_ca2(machine, 3, data); } +WRITE8_HANDLER( via_4_ca2_w) { via_set_input_ca2(machine, 4, data); } +WRITE8_HANDLER( via_5_ca2_w) { via_set_input_ca2(machine, 5, data); } +WRITE8_HANDLER( via_6_ca2_w) { via_set_input_ca2(machine, 6, data); } +WRITE8_HANDLER( via_7_ca2_w) { via_set_input_ca2(machine, 7, data); } + +WRITE8_HANDLER( via_0_cb1_w) { via_set_input_cb1(machine, 0, data); } +WRITE8_HANDLER( via_1_cb1_w) { via_set_input_cb1(machine, 1, data); } +WRITE8_HANDLER( via_2_cb1_w) { via_set_input_cb1(machine, 2, data); } +WRITE8_HANDLER( via_3_cb1_w) { via_set_input_cb1(machine, 3, data); } +WRITE8_HANDLER( via_4_cb1_w) { via_set_input_cb1(machine, 4, data); } +WRITE8_HANDLER( via_5_cb1_w) { via_set_input_cb1(machine, 5, data); } +WRITE8_HANDLER( via_6_cb1_w) { via_set_input_cb1(machine, 6, data); } +WRITE8_HANDLER( via_7_cb1_w) { via_set_input_cb1(machine, 7, data); } +WRITE8_HANDLER( via_0_cb2_w) { via_set_input_cb2(machine, 0, data); } +WRITE8_HANDLER( via_1_cb2_w) { via_set_input_cb2(machine, 1, data); } +WRITE8_HANDLER( via_2_cb2_w) { via_set_input_cb2(machine, 2, data); } +WRITE8_HANDLER( via_3_cb2_w) { via_set_input_cb2(machine, 3, data); } +WRITE8_HANDLER( via_4_cb2_w) { via_set_input_cb2(machine, 4, data); } +WRITE8_HANDLER( via_5_cb2_w) { via_set_input_cb2(machine, 5, data); } +WRITE8_HANDLER( via_6_cb2_w) { via_set_input_cb2(machine, 6, data); } +WRITE8_HANDLER( via_7_cb2_w) { via_set_input_cb2(machine, 7, data); } READ8_HANDLER( via_0_ca1_r) { return via[0].in_ca1; } READ8_HANDLER( via_1_ca1_r) { return via[1].in_ca1; } diff --git a/src/emu/machine/6522via.h b/src/emu/machine/6522via.h index f5ef1ef2ad6..8733320956b 100644 --- a/src/emu/machine/6522via.h +++ b/src/emu/machine/6522via.h @@ -54,14 +54,14 @@ struct via6522_interface void via_set_clock(int which,int clck); void via_config(int which, const struct via6522_interface *intf); void via_reset(void); -int via_read(int which, int offset); -void via_write(int which, int offset, int data); +int via_read(running_machine *machine, int which, int offset); +void via_write(running_machine *machine, int which, int offset, int data); void via_set_input_a(int which, int data); -void via_set_input_ca1(int which, int data); -void via_set_input_ca2(int which, int data); +void via_set_input_ca1(running_machine *machine, int which, int data); +void via_set_input_ca2(running_machine *machine, int which, int data); void via_set_input_b(int which, int data); -void via_set_input_cb1(int which, int data); -void via_set_input_cb2(int which, int data); +void via_set_input_cb1(running_machine *machine, int which, int data); +void via_set_input_cb2(running_machine *machine, int which, int data); /******************* Standard 8-bit CPU interfaces, D0-D7 *******************/ diff --git a/src/emu/machine/6526cia.c b/src/emu/machine/6526cia.c index 550d2f94e19..2ac3a3d5a1b 100644 --- a/src/emu/machine/6526cia.c +++ b/src/emu/machine/6526cia.c @@ -9,7 +9,6 @@ #include "driver.h" #include "6526cia.h" -#include "deprecat.h" @@ -120,7 +119,7 @@ static cia_state cia_array[2]; *************************************/ static TIMER_CALLBACK( cia_timer_proc ); -static void cia_timer_underflow(cia_state *cia, int timer); +static void cia_timer_underflow(running_machine *machine, cia_state *cia, int timer); static TIMER_CALLBACK( cia_clock_tod_callback ); @@ -145,13 +144,13 @@ static void cia_exit(running_machine *machine) -void cia_config(int which, const cia6526_interface *intf) +void cia_config(running_machine *machine, int which, const cia6526_interface *intf) { int t, p; cia_state *cia = &cia_array[which]; /* sanity checks */ - assert_always(mame_get_phase(Machine) == MAME_PHASE_INIT, "Can only call cia_config at init time!"); + assert_always(mame_get_phase(machine) == MAME_PHASE_INIT, "Can only call cia_config at init time!"); assert_always((which >= 0) && (which < (sizeof(cia_array) / sizeof(cia_array[0]))), "cia_config called on an invalid CIA!"); @@ -185,7 +184,7 @@ void cia_config(int which, const cia6526_interface *intf) /* special case; for the first CIA, set up an exit handler to clear things out */ if (which == 0) - add_exit_callback(Machine, cia_exit); + add_exit_callback(machine, cia_exit); /* state save support */ state_save_register_item("6526cia", which, cia->port[0].ddr); @@ -282,7 +281,7 @@ void cia_reset(void) ***************************************************************************/ -static void cia_update_interrupts(cia_state *cia) +static void cia_update_interrupts(running_machine *machine, cia_state *cia) { UINT8 new_irq; @@ -298,7 +297,7 @@ static void cia_update_interrupts(cia_state *cia) { cia->irq = new_irq; if (cia->irq_func) - cia->irq_func(Machine, cia->irq); + cia->irq_func(machine, cia->irq); } } @@ -344,24 +343,24 @@ static void cia_timer_update(cia_timer *timer, INT32 new_count) } -static void cia_timer_bump(cia_state *cia, int timer) +static void cia_timer_bump(running_machine *machine, cia_state *cia, int timer) { cia_timer_update(&cia->timer[timer], -1); if (cia->timer[timer].count == 0x00) - cia_timer_underflow(cia, timer); + cia_timer_underflow(machine, cia, timer); else cia_timer_update(&cia->timer[timer], cia->timer[timer].count - 1); } -static void cia_timer_underflow(cia_state *cia, int timer) +static void cia_timer_underflow(running_machine *machine, cia_state *cia, int timer) { assert((timer == 0) || (timer == 1)); /* set the status and update interrupts */ cia->ics |= cia->timer[timer].irq; - cia_update_interrupts(cia); + cia_update_interrupts(machine, cia); /* if one-shot mode, turn it off */ if (cia->timer[timer].mode & 0x08) @@ -377,7 +376,7 @@ static void cia_timer_underflow(cia_state *cia, int timer) if ((cia->timer[1].mode & 0x41) == 0x41) { if (cia->cnt || !(cia->timer[1].mode & 0x20)) - cia_timer_bump(cia, 1); + cia_timer_bump(machine, cia, 1); } /* also the serial line */ @@ -403,7 +402,7 @@ static void cia_timer_underflow(cia_state *cia, int timer) if (cia->shift == 8) { cia->ics |= 0x08; - cia_update_interrupts(cia); + cia_update_interrupts(machine, cia); } } } @@ -417,7 +416,7 @@ static TIMER_CALLBACK( cia_timer_proc ) cia_timer *timer = ptr; cia_state *cia = timer->cia; - cia_timer_underflow(cia, timer - cia->timer); + cia_timer_underflow(machine, cia, timer - cia->timer); } @@ -473,7 +472,7 @@ static void cia6526_increment(cia_state *cia) /* Update TOD on CIA A */ -void cia_clock_tod(int which) +void cia_clock_tod(running_machine *machine, int which) { cia_state *cia; @@ -499,7 +498,7 @@ void cia_clock_tod(int which) if (cia->tod == cia->alarm) { cia->ics |= 0x04; - cia_update_interrupts(cia); + cia_update_interrupts(machine, cia); } } } @@ -507,15 +506,15 @@ void cia_clock_tod(int which) static TIMER_CALLBACK( cia_clock_tod_callback ) { - cia_clock_tod(param); + cia_clock_tod(machine, param); } -void cia_issue_index(int which) +void cia_issue_index(running_machine *machine, int which) { cia_state *cia = &cia_array[which]; cia->ics |= 0x10; - cia_update_interrupts(cia); + cia_update_interrupts(machine, cia); } @@ -526,7 +525,7 @@ void cia_set_input_sp(int which, int data) } -void cia_set_input_cnt(int which, int data) +void cia_set_input_cnt(running_machine *machine, int which, int data) { cia_state *cia = &cia_array[which]; @@ -535,11 +534,11 @@ void cia_set_input_cnt(int which, int data) { /* does timer #0 bump on CNT? */ if ((cia->timer[0].mode & 0x21) == 0x21) - cia_timer_bump(cia, 0); + cia_timer_bump(machine, cia, 0); /* does timer #1 bump on CNT? */ if ((cia->timer[1].mode & 0x61) == 0x21) - cia_timer_bump(cia, 1); + cia_timer_bump(machine, cia, 1); /* if the serial port is set to output, the CNT will shift the port */ if (!(cia->timer[0].mode & 0x40)) @@ -554,7 +553,7 @@ void cia_set_input_cnt(int which, int data) cia->serial = 0; cia->shift = 0; cia->ics |= 0x08; - cia_update_interrupts(cia); + cia_update_interrupts(machine, cia); } } } @@ -562,7 +561,7 @@ void cia_set_input_cnt(int which, int data) } -UINT8 cia_read(int which, offs_t offset) +UINT8 cia_read(running_machine *machine, int which, offs_t offset) { cia_timer *timer; cia_state *cia; @@ -657,7 +656,7 @@ UINT8 cia_read(int which, offs_t offset) case CIA_ICR: data = cia->ics; cia->ics = 0; /* clear on read */ - cia_update_interrupts(cia); + cia_update_interrupts(machine, cia); break; /* timer A/B mode */ @@ -672,7 +671,7 @@ UINT8 cia_read(int which, offs_t offset) -void cia_write(int which, offs_t offset, UINT8 data) +void cia_write(running_machine *machine, int which, offs_t offset, UINT8 data) { cia_timer *timer; cia_state *cia; @@ -761,7 +760,7 @@ void cia_write(int which, offs_t offset, UINT8 data) cia->icr |= data & 0x7f; else cia->icr &= ~(data & 0x7f); - cia_update_interrupts(cia); + cia_update_interrupts(machine, cia); break; /* timer A/B modes */ @@ -785,8 +784,8 @@ UINT8 cia_get_output_a(int which) { return cia_array[which].port[0].out; } UINT8 cia_get_output_b(int which) { return cia_array[which].port[1].out; } int cia_get_irq(int which) { return cia_array[which].irq; } -READ8_HANDLER( cia_0_r ) { return cia_read(0, offset); } -READ8_HANDLER( cia_1_r ) { return cia_read(1, offset); } +READ8_HANDLER( cia_0_r ) { return cia_read(machine, 0, offset); } +READ8_HANDLER( cia_1_r ) { return cia_read(machine, 1, offset); } -WRITE8_HANDLER( cia_0_w ) { cia_write(0, offset, data); } -WRITE8_HANDLER( cia_1_w ) { cia_write(1, offset, data); } +WRITE8_HANDLER( cia_0_w ) { cia_write(machine, 0, offset, data); } +WRITE8_HANDLER( cia_1_w ) { cia_write(machine, 1, offset, data); } diff --git a/src/emu/machine/6526cia.h b/src/emu/machine/6526cia.h index b0d118cb16f..1f4da8dc873 100644 --- a/src/emu/machine/6526cia.h +++ b/src/emu/machine/6526cia.h @@ -32,16 +32,16 @@ struct _cia6526_interface }; /* configuration and reset */ -void cia_config(int which, const cia6526_interface *intf); +void cia_config(running_machine *machine, int which, const cia6526_interface *intf); void cia_reset(void); void cia_set_port_mask_value(int which, int port, int data); /* reading and writing */ -UINT8 cia_read(int which, offs_t offset); -void cia_write(int which, offs_t offset, UINT8 data); -void cia_clock_tod(int which); -void cia_issue_index(int which); -void cia_set_input_cnt(int which, int data); +UINT8 cia_read(running_machine *machine, int which, offs_t offset); +void cia_write(running_machine *machine, int which, offs_t offset, UINT8 data); +void cia_clock_tod(running_machine *machine, int which); +void cia_issue_index(running_machine *machine, int which); +void cia_set_input_cnt(running_machine *machine, int which, int data); void cia_set_input_sp(int which, int data); /* accessors */ diff --git a/src/emu/machine/6532riot.c b/src/emu/machine/6532riot.c index 9a9472a7002..24a193486e2 100644 --- a/src/emu/machine/6532riot.c +++ b/src/emu/machine/6532riot.c @@ -12,7 +12,6 @@ The timer seems to follow these rules: ***************************************************************************/ #include "driver.h" -#include "deprecat.h" #include "machine/6532riot.h" struct riot6532 @@ -65,7 +64,7 @@ static TIMER_CALLBACK( r6532_irq_timer_callback ) } -static void r6532_pa7_check(int which){ +static void r6532_pa7_check(running_machine *machine, int which){ UINT8 data = ( ( r6532[which].ddr_a & r6532[which].out_a ) | ( ~r6532[which].ddr_a & r6532[which].in_a ) ) & 0x80; if ((r6532[which].pa7 ^ data) && (r6532[which].pa7_direction ^ data)) { @@ -73,7 +72,7 @@ static void r6532_pa7_check(int which){ if (r6532[which].pa7_enable) { if (r6532[which].intf->irq_func) - (*r6532[which].intf->irq_func)(Machine, ASSERT_LINE); + (*r6532[which].intf->irq_func)(machine, ASSERT_LINE); else logerror("6532RIOT chip #%d: Interrupt is asserted but there is no callback function. PC: %08X\n", which, safe_activecpu_get_pc()); } @@ -82,7 +81,7 @@ static void r6532_pa7_check(int which){ } -void r6532_write(int which, offs_t offset, UINT8 data) +void r6532_write(running_machine *machine, int which, offs_t offset, UINT8 data) { if (offset & 4) { @@ -124,16 +123,16 @@ void r6532_write(int which, offs_t offset, UINT8 data) { UINT8 write_data = ( r6532[which].ddr_a & r6532[which].out_a ) | ( ~r6532[which].ddr_a & 0xFF ); if (r6532[which].intf->out_a_func) - r6532[which].intf->out_a_func(Machine, 0, write_data); + r6532[which].intf->out_a_func(machine, 0, write_data); else logerror("6532RIOT chip #%d: Port A is being written to but has no handler. PC: %08X - %02X\n", which, safe_activecpu_get_pc(), write_data); /* Check for PA7 change */ - r6532_pa7_check(which); + r6532_pa7_check(machine, which); } break; case 1: r6532[which].ddr_a = data; - r6532_pa7_check(which); + r6532_pa7_check(machine, which); break; case 2: r6532[which].out_b = data; @@ -141,7 +140,7 @@ void r6532_write(int which, offs_t offset, UINT8 data) { UINT8 write_data = ( r6532[which].ddr_b & r6532[which].out_b ) | ( ~r6532[which].ddr_b & 0xFF ); if (r6532[which].intf->out_b_func) - r6532[which].intf->out_b_func(Machine, 0, write_data); + r6532[which].intf->out_b_func(machine, 0, write_data); else logerror("6532RIOT chip #%d: Port B is being written to but has no handler. PC: %08X - %02X\n", which, safe_activecpu_get_pc(), write_data); } @@ -154,7 +153,7 @@ void r6532_write(int which, offs_t offset, UINT8 data) } -INLINE UINT8 r6532_read_timer(int which) +INLINE UINT8 r6532_read_timer(running_machine *machine, int which) { int timer_cycles_left = ( attotime_to_double(timer_timeleft( r6532[which].counter_timer )) * r6532[which].clock ) - 1; if ( timer_cycles_left >= 0) @@ -166,7 +165,7 @@ INLINE UINT8 r6532_read_timer(int which) if (timer_cycles_left != -1) { if (r6532[which].intf->irq_func && r6532[which].timer_irq) - (*r6532[which].intf->irq_func)(Machine, CLEAR_LINE); + (*r6532[which].intf->irq_func)(machine, CLEAR_LINE); else logerror("6532RIOT chip #%d: Interrupt is cleared but there is no callback function. PC: %08X\n", which, safe_activecpu_get_pc()); @@ -179,11 +178,11 @@ INLINE UINT8 r6532_read_timer(int which) } -void r6532_set_input_a(int which, UINT8 data) +void r6532_set_input_a(running_machine *machine, int which, UINT8 data) { r6532[which].in_a = data; /* Check for PA7 change */ - r6532_pa7_check(which); + r6532_pa7_check(machine, which); } @@ -193,7 +192,7 @@ void r6532_set_input_b(int which, UINT8 data) } -INLINE UINT8 r6532_read_irq_flags(int which) +INLINE UINT8 r6532_read_irq_flags(running_machine *machine, int which) { int timer_cycles_left = ( attotime_to_double(timer_timeleft( r6532[which].counter_timer )) * r6532[which].clock ) - 1; int res = 0; @@ -204,7 +203,7 @@ INLINE UINT8 r6532_read_irq_flags(int which) if ( timer_cycles_left < -1 ) { if ( r6532[which].intf->irq_func) - (*r6532[which].intf->irq_func)(Machine, CLEAR_LINE); + (*r6532[which].intf->irq_func)(machine, CLEAR_LINE); else logerror("6532RIOT chip #%d: Interrupt is cleared but there is no callback function. PC: %08X\n", which, safe_activecpu_get_pc()); @@ -219,7 +218,7 @@ INLINE UINT8 r6532_read_irq_flags(int which) r6532[which].pa7_flag = 0; if (r6532[which].intf->irq_func && timer_cycles_left != -1) - (*r6532[which].intf->irq_func)(Machine, CLEAR_LINE); + (*r6532[which].intf->irq_func)(machine, CLEAR_LINE); else logerror("6532RIOT chip #%d: Interrupt is cleared but there is no callback function. PC: %08X\n", which, safe_activecpu_get_pc()); } @@ -228,7 +227,7 @@ INLINE UINT8 r6532_read_irq_flags(int which) } -UINT8 r6532_read(int which, offs_t offset) +UINT8 r6532_read(running_machine *machine, int which, offs_t offset) { UINT8 val = 0; @@ -236,19 +235,19 @@ UINT8 r6532_read(int which, offs_t offset) { case 0: if (r6532[which].intf->in_a_func) - r6532[which].in_a = r6532[which].intf->in_a_func(Machine, 0); + r6532[which].in_a = r6532[which].intf->in_a_func(machine, 0); else logerror("6532RIOT chip #%d: Port A is being read but has no handler. PC: %08X\n", which, safe_activecpu_get_pc()); val = ( r6532[which].ddr_a & r6532[which].out_a ) | ( ~r6532[which].ddr_a & r6532[which].in_a ); /* Check for PA7 change */ - r6532_pa7_check(which); + r6532_pa7_check(machine, which); break; case 1: val = r6532[which].ddr_a; break; case 2: if (r6532[which].intf->in_b_func) - r6532[which].in_b = r6532[which].intf->in_b_func(Machine, 0); + r6532[which].in_b = r6532[which].intf->in_b_func(machine, 0); else logerror("6532RIOT chip #%d: Port B is being read but has no handler. PC: %08X\n", which, safe_activecpu_get_pc()); @@ -260,11 +259,11 @@ UINT8 r6532_read(int which, offs_t offset) case 4: case 6: r6532[which].timer_irq_enable = offset & 8; - val = r6532_read_timer(which); + val = r6532_read_timer(machine, which); break; case 5: case 7: - val = r6532_read_irq_flags(which); + val = r6532_read_irq_flags(machine, which); break; } @@ -278,7 +277,7 @@ void r6532_set_clock(int which, int clock) } -void r6532_reset(int which) +void r6532_reset(running_machine *machine, int which) { r6532[which].out_a = 0; r6532[which].out_b = 0; @@ -300,15 +299,15 @@ void r6532_reset(int which) r6532[which].timer_irq = 0; if (r6532[which].intf->irq_func) - (*r6532[which].intf->irq_func)(Machine, CLEAR_LINE); + (*r6532[which].intf->irq_func)(machine, CLEAR_LINE); else logerror("6532RIOT chip #%d: Interrupt is cleared but there is no callback function. PC: %08X\n", which, safe_activecpu_get_pc()); } -void r6532_config(int which, const struct riot6532_interface* intf) +void r6532_config(running_machine *machine, int which, const struct riot6532_interface* intf) { - assert_always(mame_get_phase(Machine) == MAME_PHASE_INIT, "Can only call r6532_init at init time!"); + assert_always(mame_get_phase(machine) == MAME_PHASE_INIT, "Can only call r6532_init at init time!"); assert_always( which < MAX_R6532, "which exceeds maximum number of configured r6532s!" ); r6532[which].intf = intf; @@ -318,32 +317,32 @@ void r6532_config(int which, const struct riot6532_interface* intf) } -WRITE8_HANDLER( r6532_0_w ) { r6532_write(0, offset, data); } -WRITE8_HANDLER( r6532_1_w ) { r6532_write(1, offset, data); } -WRITE8_HANDLER( r6532_2_w ) { r6532_write(2, offset, data); } -WRITE8_HANDLER( r6532_3_w ) { r6532_write(3, offset, data); } -WRITE8_HANDLER( r6532_4_w ) { r6532_write(4, offset, data); } -WRITE8_HANDLER( r6532_5_w ) { r6532_write(5, offset, data); } -WRITE8_HANDLER( r6532_6_w ) { r6532_write(6, offset, data); } -WRITE8_HANDLER( r6532_7_w ) { r6532_write(7, offset, data); } - -READ8_HANDLER( r6532_0_r ) { return r6532_read(0, offset); } -READ8_HANDLER( r6532_1_r ) { return r6532_read(1, offset); } -READ8_HANDLER( r6532_2_r ) { return r6532_read(2, offset); } -READ8_HANDLER( r6532_3_r ) { return r6532_read(3, offset); } -READ8_HANDLER( r6532_4_r ) { return r6532_read(4, offset); } -READ8_HANDLER( r6532_5_r ) { return r6532_read(5, offset); } -READ8_HANDLER( r6532_6_r ) { return r6532_read(6, offset); } -READ8_HANDLER( r6532_7_r ) { return r6532_read(7, offset); } - -WRITE8_HANDLER( r6532_0_porta_w) { r6532_set_input_a(0, data); } -WRITE8_HANDLER( r6532_1_porta_w) { r6532_set_input_a(1, data); } -WRITE8_HANDLER( r6532_2_porta_w) { r6532_set_input_a(2, data); } -WRITE8_HANDLER( r6532_3_porta_w) { r6532_set_input_a(3, data); } -WRITE8_HANDLER( r6532_4_porta_w) { r6532_set_input_a(4, data); } -WRITE8_HANDLER( r6532_5_porta_w) { r6532_set_input_a(5, data); } -WRITE8_HANDLER( r6532_6_porta_w) { r6532_set_input_a(6, data); } -WRITE8_HANDLER( r6532_7_porta_w) { r6532_set_input_a(7, data); } +WRITE8_HANDLER( r6532_0_w ) { r6532_write(machine, 0, offset, data); } +WRITE8_HANDLER( r6532_1_w ) { r6532_write(machine, 1, offset, data); } +WRITE8_HANDLER( r6532_2_w ) { r6532_write(machine, 2, offset, data); } +WRITE8_HANDLER( r6532_3_w ) { r6532_write(machine, 3, offset, data); } +WRITE8_HANDLER( r6532_4_w ) { r6532_write(machine, 4, offset, data); } +WRITE8_HANDLER( r6532_5_w ) { r6532_write(machine, 5, offset, data); } +WRITE8_HANDLER( r6532_6_w ) { r6532_write(machine, 6, offset, data); } +WRITE8_HANDLER( r6532_7_w ) { r6532_write(machine, 7, offset, data); } + +READ8_HANDLER( r6532_0_r ) { return r6532_read(machine, 0, offset); } +READ8_HANDLER( r6532_1_r ) { return r6532_read(machine, 1, offset); } +READ8_HANDLER( r6532_2_r ) { return r6532_read(machine, 2, offset); } +READ8_HANDLER( r6532_3_r ) { return r6532_read(machine, 3, offset); } +READ8_HANDLER( r6532_4_r ) { return r6532_read(machine, 4, offset); } +READ8_HANDLER( r6532_5_r ) { return r6532_read(machine, 5, offset); } +READ8_HANDLER( r6532_6_r ) { return r6532_read(machine, 6, offset); } +READ8_HANDLER( r6532_7_r ) { return r6532_read(machine, 7, offset); } + +WRITE8_HANDLER( r6532_0_porta_w) { r6532_set_input_a(machine, 0, data); } +WRITE8_HANDLER( r6532_1_porta_w) { r6532_set_input_a(machine, 1, data); } +WRITE8_HANDLER( r6532_2_porta_w) { r6532_set_input_a(machine, 2, data); } +WRITE8_HANDLER( r6532_3_porta_w) { r6532_set_input_a(machine, 3, data); } +WRITE8_HANDLER( r6532_4_porta_w) { r6532_set_input_a(machine, 4, data); } +WRITE8_HANDLER( r6532_5_porta_w) { r6532_set_input_a(machine, 5, data); } +WRITE8_HANDLER( r6532_6_porta_w) { r6532_set_input_a(machine, 6, data); } +WRITE8_HANDLER( r6532_7_porta_w) { r6532_set_input_a(machine, 7, data); } WRITE8_HANDLER( r6532_0_portb_w) { r6532_set_input_b(0, data); } WRITE8_HANDLER( r6532_1_portb_w) { r6532_set_input_b(1, data); } diff --git a/src/emu/machine/6532riot.h b/src/emu/machine/6532riot.h index e2eba80fdcf..e757e97c141 100644 --- a/src/emu/machine/6532riot.h +++ b/src/emu/machine/6532riot.h @@ -19,11 +19,11 @@ struct riot6532_interface }; void r6532_set_clock(int which, int clock); -void r6532_reset(int which); -void r6532_config(int which, const struct riot6532_interface* intf); -UINT8 r6532_read(int which, offs_t offset); -void r6532_write(int which, offs_t offset, UINT8 data); -void r6532_set_input_a(int which, UINT8 data); +void r6532_reset(running_machine *machine, int which); +void r6532_config(running_machine *machine, int which, const struct riot6532_interface* intf); +UINT8 r6532_read(running_machine *machine, int which, offs_t offset); +void r6532_write(running_machine *machine, int which, offs_t offset, UINT8 data); +void r6532_set_input_a(running_machine *machine, int which, UINT8 data); void r6532_set_input_b(int which, UINT8 data); /******************* Standard 8-bit CPU interfaces, D0-D7 *******************/ diff --git a/src/emu/machine/6821pia.c b/src/emu/machine/6821pia.c index 4e751c5dd81..e151fdf71f7 100644 --- a/src/emu/machine/6821pia.c +++ b/src/emu/machine/6821pia.c @@ -208,7 +208,7 @@ void pia_reset(void) * *************************************/ -static void update_interrupts(pia6821 *p) +static void update_interrupts(running_machine *machine, pia6821 *p) { int new_state; @@ -219,7 +219,7 @@ static void update_interrupts(pia6821 *p) { p->irq_a_state = new_state; - if (p->intf->irq_a_func) (p->intf->irq_a_func)(Machine, p->irq_a_state); + if (p->intf->irq_a_func) (p->intf->irq_a_func)(machine, p->irq_a_state); } /* then do IRQ B */ @@ -229,7 +229,7 @@ static void update_interrupts(pia6821 *p) { p->irq_b_state = new_state; - if (p->intf->irq_b_func) (p->intf->irq_b_func)(Machine, p->irq_b_state); + if (p->intf->irq_b_func) (p->intf->irq_b_func)(machine, p->irq_b_state); } } @@ -241,7 +241,7 @@ static void update_interrupts(pia6821 *p) * *************************************/ -static UINT8 get_in_a_value(int which) +static UINT8 get_in_a_value(running_machine *machine, int which) { pia6821 *p = &pias[which]; UINT8 port_a_data = 0; @@ -249,7 +249,7 @@ static UINT8 get_in_a_value(int which) /* update the input */ if (p->intf->in_a_func) - port_a_data = p->intf->in_a_func(Machine, 0); + port_a_data = p->intf->in_a_func(machine, 0); else { if (p->in_a_pushed) @@ -278,7 +278,7 @@ static UINT8 get_in_a_value(int which) } -static UINT8 get_in_b_value(int which) +static UINT8 get_in_b_value(running_machine *machine, int which) { pia6821 *p = &pias[which]; UINT8 ret; @@ -292,7 +292,7 @@ static UINT8 get_in_b_value(int which) /* update the input */ if (p->intf->in_b_func) - port_b_data = p->intf->in_b_func(Machine, 0); + port_b_data = p->intf->in_b_func(machine, 0); else { if (p->in_b_pushed) @@ -325,7 +325,7 @@ static UINT8 get_in_b_value(int which) * *************************************/ -static UINT8 get_out_a_value(int which) +static UINT8 get_out_a_value(running_machine *machine, int which) { UINT8 ret; pia6821 *p = &pias[which]; @@ -335,7 +335,7 @@ static UINT8 get_out_a_value(int which) ret = p->out_a; else /* input pins don't change */ - ret = (p->out_a & p->ddr_a) | (get_in_a_value(which) & ~p->ddr_a); + ret = (p->out_a & p->ddr_a) | (get_in_a_value(machine, which) & ~p->ddr_a); return ret; } @@ -358,7 +358,7 @@ static UINT8 get_out_b_value(int which) * *************************************/ -static void set_out_ca2(int which, int data) +static void set_out_ca2(running_machine *machine, int which, int data) { pia6821 *p = &pias[which]; @@ -368,7 +368,7 @@ static void set_out_ca2(int which, int data) /* send to output function */ if (p->intf->out_ca2_func) - p->intf->out_ca2_func(Machine, 0, p->out_ca2); + p->intf->out_ca2_func(machine, 0, p->out_ca2); else { if (p->out_ca2_needs_pulled) @@ -380,7 +380,7 @@ static void set_out_ca2(int which, int data) } -static void set_out_cb2(int which, int data) +static void set_out_cb2(running_machine *machine, int which, int data) { pia6821 *p = &pias[which]; @@ -393,7 +393,7 @@ static void set_out_cb2(int which, int data) /* send to output function */ if (p->intf->out_cb2_func) - p->intf->out_cb2_func(Machine, 0, p->out_cb2); + p->intf->out_cb2_func(machine, 0, p->out_cb2); else { if (p->out_cb2_needs_pulled) @@ -412,26 +412,26 @@ static void set_out_cb2(int which, int data) * *************************************/ -static UINT8 port_a_r(int which) +static UINT8 port_a_r(running_machine *machine, int which) { pia6821 *p = &pias[which]; - UINT8 ret = get_in_a_value(which); + UINT8 ret = get_in_a_value(machine, which); /* IRQ flags implicitly cleared by a read */ p->irq_a1 = FALSE; p->irq_a2 = FALSE; - update_interrupts(p); + update_interrupts(machine, p); /* CA2 is configured as output and in read strobe mode */ if (C2_OUTPUT(p->ctl_a) && C2_STROBE_MODE(p->ctl_a)) { /* this will cause a transition low */ - set_out_ca2(which, FALSE); + set_out_ca2(machine, which, FALSE); /* if the CA2 strobe is cleared by the E, reset it right away */ if (STROBE_E_RESET(p->ctl_a)) - set_out_ca2(which, TRUE); + set_out_ca2(machine, which, TRUE); } LOG(("cpu #%d (PC=%08X): PIA #%d: port A read = %02X\n", cpu_getactivecpu(), safe_activecpu_get_pc(), which, ret)); @@ -452,23 +452,23 @@ static UINT8 ddr_a_r(int which) } -static UINT8 port_b_r(int which) +static UINT8 port_b_r(running_machine *machine, int which) { pia6821 *p = &pias[which]; - UINT8 ret = get_in_b_value(which); + UINT8 ret = get_in_b_value(machine, which); /* This read will implicitly clear the IRQ B1 flag. If CB2 is in write-strobe mode with CB1 restore, and a CB1 active transition set the flag, clearing it will cause CB2 to go high again. Note that this is different from what happens with port A. */ if (p->irq_b1 && C2_STROBE_MODE(p->ctl_b) && STROBE_C1_RESET(p->ctl_b)) - set_out_cb2(which, TRUE); + set_out_cb2(machine, which, TRUE); /* IRQ flags implicitly cleared by a read */ p->irq_b1 = FALSE; p->irq_b2 = FALSE; - update_interrupts(p); + update_interrupts(machine, p); LOG(("cpu #%d (PC=%08X): PIA #%d: port B read = %02X\n", cpu_getactivecpu(), safe_activecpu_get_pc(), which, ret)); @@ -488,14 +488,14 @@ static UINT8 ddr_b_r(int which) } -static UINT8 control_a_r(int which) +static UINT8 control_a_r(running_machine *machine, int which) { pia6821 *p = &pias[which]; UINT8 ret; /* update CA1 & CA2 if callback exists, these in turn may update IRQ's */ if (p->intf->in_ca1_func) - pia_set_input_ca1(which, p->intf->in_ca1_func(Machine, 0)); + pia_set_input_ca1(which, p->intf->in_ca1_func(machine, 0)); else if (!p->logged_ca1_not_connected && (!p->in_ca1_pushed)) { logerror("cpu #%d (PC=%08X): PIA #%d: Warning! No CA1 read handler. Assuming pin not connected\n", cpu_getactivecpu(), safe_activecpu_get_pc(), which); @@ -503,7 +503,7 @@ static UINT8 control_a_r(int which) } if (p->intf->in_ca2_func) - pia_set_input_ca2(which, p->intf->in_ca2_func(Machine, 0)); + pia_set_input_ca2(which, p->intf->in_ca2_func(machine, 0)); else if ( !p->logged_ca2_not_connected && C2_INPUT(p->ctl_a) && !p->in_ca2_pushed) { logerror("cpu #%d (PC=%08X): PIA #%d: Warning! No CA2 read handler. Assuming pin not connected\n", cpu_getactivecpu(), safe_activecpu_get_pc(), which); @@ -526,14 +526,14 @@ static UINT8 control_a_r(int which) } -static UINT8 control_b_r(int which) +static UINT8 control_b_r(running_machine *machine, int which) { pia6821 *p = &pias[which]; UINT8 ret; /* update CB1 & CB2 if callback exists, these in turn may update IRQ's */ if (p->intf->in_cb1_func) - pia_set_input_cb1(which, p->intf->in_cb1_func(Machine, 0)); + pia_set_input_cb1(which, p->intf->in_cb1_func(machine, 0)); else if (!p->logged_cb1_not_connected && !p->in_cb1_pushed) { logerror("cpu #%d (PC=%08X): PIA #%d: Error! no CB1 read handler. Three-state pin is undefined\n", cpu_getactivecpu(), safe_activecpu_get_pc(), which); @@ -541,7 +541,7 @@ static UINT8 control_b_r(int which) } if (p->intf->in_cb2_func) - pia_set_input_cb2(which, p->intf->in_cb2_func(Machine, 0)); + pia_set_input_cb2(which, p->intf->in_cb2_func(machine, 0)); else if (!p->logged_cb2_not_connected && C2_INPUT(p->ctl_b) && !p->in_cb2_pushed) { logerror("cpu #%d (PC=%08X): PIA #%d: Error! No CB2 read handler. Three-state pin is undefined\n", cpu_getactivecpu(), safe_activecpu_get_pc(), which); @@ -574,24 +574,24 @@ UINT8 pia_read(int which, offs_t offset) default: /* impossible */ case 0x00: if (OUTPUT_SELECTED(p->ctl_a)) - ret = port_a_r(which); + ret = port_a_r(Machine, which); else ret = ddr_a_r(which); break; case 0x01: - ret = control_a_r(which); + ret = control_a_r(Machine, which); break; case 0x02: if (OUTPUT_SELECTED(p->ctl_b)) - ret = port_b_r(which); + ret = port_b_r(Machine, which); else ret = ddr_b_r(which); break; case 0x03: - ret = control_b_r(which); + ret = control_b_r(Machine, which); break; } @@ -620,17 +620,17 @@ UINT8 pia_get_port_b_z_mask(int which) * *************************************/ -static void send_to_out_a_func(int which, const char* message) +static void send_to_out_a_func(running_machine *machine, int which, const char* message) { pia6821 *p = &pias[which]; /* input pins are pulled high */ - UINT8 data = get_out_a_value(which); + UINT8 data = get_out_a_value(machine, which); LOG(("cpu #%d (PC=%08X): PIA #%d: %s = %02X\n", cpu_getactivecpu(), safe_activecpu_get_pc(), which, message, data)); if (p->intf->out_a_func) - p->intf->out_a_func(Machine, 0, data); + p->intf->out_a_func(machine, 0, data); else { if (p->out_a_needs_pulled) @@ -641,7 +641,7 @@ static void send_to_out_a_func(int which, const char* message) } -static void send_to_out_b_func(int which, const char* message) +static void send_to_out_b_func(running_machine *machine, int which, const char* message) { pia6821 *p = &pias[which]; @@ -651,7 +651,7 @@ static void send_to_out_b_func(int which, const char* message) LOG(("cpu #%d (PC=%08X): PIA #%d: %s = %02X\n", cpu_getactivecpu(), safe_activecpu_get_pc(), which, message, data)); if (p->intf->out_b_func) - p->intf->out_b_func(Machine, 0, data); + p->intf->out_b_func(machine, 0, data); else { if (p->out_b_needs_pulled) @@ -662,18 +662,18 @@ static void send_to_out_b_func(int which, const char* message) } -static void port_a_w(int which, UINT8 data) +static void port_a_w(running_machine *machine, int which, UINT8 data) { pia6821 *p = &pias[which]; /* buffer the output value */ p->out_a = data; - send_to_out_a_func(which, "port A write"); + send_to_out_a_func(machine, which, "port A write"); } -static void ddr_a_w(int which, UINT8 data) +static void ddr_a_w(running_machine *machine, int which, UINT8 data) { pia6821 *p = &pias[which]; @@ -689,34 +689,34 @@ static void ddr_a_w(int which, UINT8 data) /* DDR changed, call the callback again */ p->ddr_a = data; p->logged_port_a_not_connected = FALSE; - send_to_out_a_func(which, "port A write due to DDR change"); + send_to_out_a_func(machine, which, "port A write due to DDR change"); } } -static void port_b_w(int which, UINT8 data) +static void port_b_w(running_machine *machine, int which, UINT8 data) { pia6821 *p = &pias[which]; /* buffer the output value */ p->out_b = data; - send_to_out_b_func(which, "port B write"); + send_to_out_b_func(machine, which, "port B write"); /* CB2 in write strobe mode */ if (C2_STROBE_MODE(p->ctl_b)) { /* this will cause a transition low */ - set_out_cb2(which, FALSE); + set_out_cb2(machine, which, FALSE); /* if the CB2 strobe is cleared by the E, reset it right away */ if (STROBE_E_RESET(p->ctl_b)) - set_out_cb2(which, TRUE); + set_out_cb2(machine, which, TRUE); } } -static void ddr_b_w(int which, UINT8 data) +static void ddr_b_w(running_machine *machine, int which, UINT8 data) { pia6821 *p = &pias[which]; @@ -732,12 +732,12 @@ static void ddr_b_w(int which, UINT8 data) /* DDR changed, call the callback again */ p->ddr_b = data; p->logged_port_b_not_connected = FALSE; - send_to_out_b_func(which, "port B write due to DDR change"); + send_to_out_b_func(machine, which, "port B write due to DDR change"); } } -static void control_a_w(int which, UINT8 data) +static void control_a_w(running_machine *machine, int which, UINT8 data) { pia6821 *p = &pias[which]; @@ -761,15 +761,15 @@ static void control_a_w(int which, UINT8 data) /* strobe mode - output is always high unless strobed */ temp = TRUE; - set_out_ca2(which, temp); + set_out_ca2(machine, which, temp); } /* update externals */ - update_interrupts(p); + update_interrupts(machine, p); } -static void control_b_w(int which, UINT8 data) +static void control_b_w(running_machine *machine, int which, UINT8 data) { pia6821 *p = &pias[which]; int temp; @@ -789,10 +789,10 @@ static void control_b_w(int which, UINT8 data) /* strobe mode - output is always high unless strobed */ temp = TRUE; - set_out_cb2(which, temp); + set_out_cb2(machine, which, temp); /* update externals */ - update_interrupts(p); + update_interrupts(machine, p); } @@ -805,24 +805,24 @@ void pia_write(int which, offs_t offset, UINT8 data) default: /* impossible */ case 0x00: if (OUTPUT_SELECTED(p->ctl_a)) - port_a_w(which, data); + port_a_w(Machine, which, data); else - ddr_a_w(which, data); + ddr_a_w(Machine, which, data); break; case 0x01: - control_a_w(which, data); + control_a_w(Machine, which, data); break; case 0x02: if (OUTPUT_SELECTED(p->ctl_b)) - port_b_w(which, data); + port_b_w(Machine, which, data); else - ddr_b_w(which, data); + ddr_b_w(Machine, which, data); break; case 0x03: - control_b_w(which, data); + control_b_w(Machine, which, data); break; } } @@ -877,7 +877,7 @@ UINT8 pia_get_output_a(int which) p->out_a_needs_pulled = FALSE; - return get_out_a_value(which); + return get_out_a_value(Machine, which); } @@ -915,11 +915,11 @@ void pia_set_input_ca1(int which, int data) p->irq_a1 = TRUE; /* update externals */ - update_interrupts(p); + update_interrupts(Machine, p); /* CA2 is configured as output and in read strobe mode and cleared by a CA1 transition */ if (C2_OUTPUT(p->ctl_a) && C2_STROBE_MODE(p->ctl_a) && STROBE_C1_RESET(p->ctl_a)) - set_out_ca2(which, TRUE); + set_out_ca2(Machine, which, TRUE); } /* set the new value for CA1 */ @@ -963,7 +963,7 @@ void pia_set_input_ca2(int which, int data) p->irq_a2 = TRUE; /* update externals */ - update_interrupts(p); + update_interrupts(Machine, p); } /* set the new value for CA2 */ @@ -1055,7 +1055,7 @@ void pia_set_input_cb1(int which, int data) p->irq_b1 = 1; /* update externals */ - update_interrupts(p); + update_interrupts(Machine, p); /* If CB2 is configured as a write-strobe output which is reset by a CB1 transition, this reset will only happen when a read from port B implicitly @@ -1104,7 +1104,7 @@ void pia_set_input_cb2(int which, int data) p->irq_b2 = 1; /* update externals */ - update_interrupts(p); + update_interrupts(Machine, p); } /* set the new value for CA2 */ diff --git a/src/emu/machine/6840ptm.c b/src/emu/machine/6840ptm.c index 27899084f61..cef706edfb8 100644 --- a/src/emu/machine/6840ptm.c +++ b/src/emu/machine/6840ptm.c @@ -91,7 +91,7 @@ typedef struct _ptm6840 // Local prototypes /////////////////////////////////////////////////////// -static void ptm6840_timeout(int which, int idx); +static void ptm6840_timeout(running_machine *machine, int which, int idx); static TIMER_CALLBACK( ptm6840_t1_timeout ); static TIMER_CALLBACK( ptm6840_t2_timeout ); static TIMER_CALLBACK( ptm6840_t3_timeout ); @@ -142,7 +142,7 @@ int ptm6840_get_irq(int which) // // /////////////////////////////////////////////////////////////////////////// -static void subtract_from_counter(int which, int counter, int count) +static void subtract_from_counter(running_machine *machine, int which, int counter, int count) { int clock; attotime duration; @@ -174,7 +174,7 @@ static void subtract_from_counter(int which, int counter, int count) /* If MSB goes less than zero, we've expired */ if (msb < 0) { - ptm6840_timeout(which, counter); + ptm6840_timeout(machine, which, counter); msb = (currptr->latch[counter] >> 8) + 1; } } @@ -198,7 +198,7 @@ static void subtract_from_counter(int which, int counter, int count) word += currptr->latch[counter] + 1; /* We've expired */ - ptm6840_timeout(which, counter); + ptm6840_timeout(machine, which, counter); } /* Store the result */ @@ -216,7 +216,7 @@ static void subtract_from_counter(int which, int counter, int count) } } -static void ptm_tick(int which, int counter, int count) +static void ptm_tick(running_machine *machine, int which, int counter, int count) { ptm6840 *currptr = ptm + which; @@ -226,13 +226,13 @@ static void ptm_tick(int which, int counter, int count) if ( currptr->t3_scaler > currptr->t3_divisor - 1) { - subtract_from_counter(which, counter, 1); + subtract_from_counter(machine, which, counter, 1); currptr->t3_scaler = 0; } } else { - subtract_from_counter(which, counter, count); + subtract_from_counter(machine, which, counter, count); } } @@ -242,7 +242,7 @@ static void ptm_tick(int which, int counter, int count) // // /////////////////////////////////////////////////////////////////////////// -INLINE void update_interrupts(int which) +INLINE void update_interrupts(running_machine *machine, int which) { int new_state; ptm6840 *currptr = ptm + which; @@ -261,7 +261,7 @@ INLINE void update_interrupts(int which) currptr->status_reg &= ~0x80; if (currptr->intf->irq_func) - (currptr->intf->irq_func)(Machine, currptr->IRQ); + (currptr->intf->irq_func)(machine, currptr->IRQ); } } @@ -317,7 +317,7 @@ static UINT16 compute_counter(int which, int counter) // // /////////////////////////////////////////////////////////////////////////// -static void reload_count(int which, int idx) +static void reload_count(running_machine *machine, int which, int idx) { int clock; int count; @@ -351,7 +351,7 @@ static void reload_count(int which, int idx) if ((currptr->mode[idx] == 4)||(currptr->mode[idx] == 6)) { currptr->output[idx] = 1; - if ( currptr->intf->out_func[idx] ) currptr->intf->out_func[idx](Machine, 0, currptr->output[idx]); + if ( currptr->intf->out_func[idx] ) currptr->intf->out_func[idx](machine, 0, currptr->output[idx]); } /* Set the timer */ @@ -497,7 +497,7 @@ int ptm6840_read(int which, int offset) if (currptr->status_read_since_int & (1 << idx)) { currptr->status_reg &= ~(1 << idx); - update_interrupts(which); + update_interrupts(Machine, which); } currptr->lsb_buffer = result & 0xff; @@ -581,15 +581,15 @@ void ptm6840_write (int which, int offset, int data) else { for (i = 0; i < 3; i++) - reload_count(which, i); + reload_count(Machine, which, i); } currptr->status_reg = 0; - update_interrupts(which); + update_interrupts(Machine, which); /* Changing the clock source? (e.g. Zwackery) */ if (diffs & 0x02) - reload_count(which, idx); + reload_count(Machine, which, idx); } break; } @@ -612,11 +612,11 @@ void ptm6840_write (int which, int offset, int data) /* Clear the interrupt */ currptr->status_reg &= ~(1 << idx); - update_interrupts(which); + update_interrupts(Machine, which); /* Reload the count if in an appropriate mode */ if (!(currptr->control_reg[idx] & 0x10)) - reload_count(which,idx); + reload_count(Machine, which,idx); PLOG(("%06X:MC6840 #%d: Counter %d latch = %04X\n", activecpu_get_previouspc(), which, idx, currptr->latch[idx])); break; @@ -630,7 +630,7 @@ void ptm6840_write (int which, int offset, int data) // // /////////////////////////////////////////////////////////////////////////// -static void ptm6840_timeout(int which, int idx) +static void ptm6840_timeout(running_machine *machine, int which, int idx) { ptm6840 *p = ptm + which; @@ -641,7 +641,7 @@ static void ptm6840_timeout(int which, int idx) /* Interrupt enabled */ p->status_reg |= (1 << idx); p->status_read_since_int &= ~(1 << idx); - update_interrupts(which); + update_interrupts(machine, which); } if ( p->control_reg[idx] & 0x80 ) @@ -655,7 +655,7 @@ static void ptm6840_timeout(int which, int idx) PLOG(("**ptm6840 %d t%d output %d **\n", which, idx + 1, p->output[idx])); if ( p->intf->out_func[idx] ) - p->intf->out_func[idx](Machine, 0, p->output[idx]); + p->intf->out_func[idx](machine, 0, p->output[idx]); } if ((p->mode[idx] == 4)||(p->mode[idx] == 6)) { @@ -665,7 +665,7 @@ static void ptm6840_timeout(int which, int idx) PLOG(("**ptm6840 %d t%d output %d **\n", which, idx + 1, p->output[idx])); if ( p->intf->out_func[idx] ) - p->intf->out_func[idx](Machine, 0, p->output[idx]); + p->intf->out_func[idx](machine, 0, p->output[idx]); /* No changes in output until reinit */ p->fired[idx] = 1; @@ -674,12 +674,12 @@ static void ptm6840_timeout(int which, int idx) } } p->enabled[idx]= 0; - reload_count(which, idx); + reload_count(machine, which, idx); } -static TIMER_CALLBACK( ptm6840_t1_timeout ) { ptm6840_timeout(param, 0); } -static TIMER_CALLBACK( ptm6840_t2_timeout ) { ptm6840_timeout(param, 1); } -static TIMER_CALLBACK( ptm6840_t3_timeout ) { ptm6840_timeout(param, 2); } +static TIMER_CALLBACK( ptm6840_t1_timeout ) { ptm6840_timeout(machine, param, 0); } +static TIMER_CALLBACK( ptm6840_t2_timeout ) { ptm6840_timeout(machine, param, 1); } +static TIMER_CALLBACK( ptm6840_t3_timeout ) { ptm6840_timeout(machine, param, 2); } /////////////////////////////////////////////////////////////////////////// // // @@ -687,21 +687,21 @@ static TIMER_CALLBACK( ptm6840_t3_timeout ) { ptm6840_timeout(param, 2); } // // /////////////////////////////////////////////////////////////////////////// -INLINE void ptm6840_set_gate(int which, int state, int idx) +INLINE void ptm6840_set_gate(running_machine *machine, int which, int state, int idx) { ptm6840 *p = ptm + which; if ( (p->mode[idx] == 0) || (p->mode[idx] == 2) || (p->mode[0] == 4) || (p->mode[idx] == 6) ) { if (state == 0 && p->gate[idx]) - reload_count(which,idx); + reload_count(machine, which,idx); } p->gate[idx] = state; } -void ptm6840_set_g1(int which, int state) { ptm6840_set_gate(which, state, 0); } -void ptm6840_set_g2(int which, int state) { ptm6840_set_gate(which, state, 1); } -void ptm6840_set_g3(int which, int state) { ptm6840_set_gate(which, state, 2); } +void ptm6840_set_g1(int which, int state) { ptm6840_set_gate(Machine, which, state, 0); } +void ptm6840_set_g2(int which, int state) { ptm6840_set_gate(Machine, which, state, 1); } +void ptm6840_set_g3(int which, int state) { ptm6840_set_gate(Machine, which, state, 2); } /////////////////////////////////////////////////////////////////////////// // // @@ -709,7 +709,7 @@ void ptm6840_set_g3(int which, int state) { ptm6840_set_gate(which, state, 2); } // // /////////////////////////////////////////////////////////////////////////// -INLINE void ptm6840_set_clock(int which, int state, int idx) +INLINE void ptm6840_set_clock(running_machine *machine, int which, int state, int idx) { ptm6840 *p = ptm + which; @@ -718,7 +718,7 @@ INLINE void ptm6840_set_clock(int which, int state, int idx) if (!(p->control_reg[idx] & 0x02)) { if (state) - ptm_tick(which, idx, 1); + ptm_tick(machine, which, idx, 1); } } @@ -788,9 +788,9 @@ int ptm6840_get_ext_clock(int which, int counter) return currptr->external_clock[counter]; } -void ptm6840_set_c1(int which, int state) { ptm6840_set_clock(which, state, 0); } -void ptm6840_set_c2(int which, int state) { ptm6840_set_clock(which, state, 1); } -void ptm6840_set_c3(int which, int state) { ptm6840_set_clock(which, state, 2); } +void ptm6840_set_c1(int which, int state) { ptm6840_set_clock(Machine, which, state, 0); } +void ptm6840_set_c2(int which, int state) { ptm6840_set_clock(Machine, which, state, 1); } +void ptm6840_set_c3(int which, int state) { ptm6840_set_clock(Machine, which, state, 2); } ///////////////////////////////////////////////////////////////////////////////// diff --git a/src/emu/machine/74181.c b/src/emu/machine/74181.c index 703bdb679f1..7f55b258028 100644 --- a/src/emu/machine/74181.c +++ b/src/emu/machine/74181.c @@ -6,7 +6,6 @@ */ #include "driver.h" -#include "deprecat.h" #include "74181.h" @@ -28,11 +27,11 @@ struct _TTL74181_state static TTL74181_state chips[TTL74181_MAX_CHIPS]; -void TTL74181_config(int which, void *intf) +void TTL74181_config(running_machine *machine, int which, void *intf) { TTL74181_state *c; - assert_always(mame_get_phase(Machine) == MAME_PHASE_INIT, "Can only call at init time!"); + assert_always(mame_get_phase(machine) == MAME_PHASE_INIT, "Can only call at init time!"); assert_always(intf == 0, "Interface must be NULL"); assert_always((which >= 0) && (which < TTL74181_MAX_CHIPS), "Exceeded maximum number of 74181 chips"); diff --git a/src/emu/machine/74181.h b/src/emu/machine/74181.h index 21a5e59719d..e4f23dcd16e 100644 --- a/src/emu/machine/74181.h +++ b/src/emu/machine/74181.h @@ -33,7 +33,7 @@ #define TTL74181_OUTPUT_CN4 (7) -void TTL74181_config(int chip, void *interface); +void TTL74181_config(running_machine *machine, int chip, void *interface); void TTL74181_reset(int chip); void TTL74181_write(int chip, int startline, int lines, UINT8 data); diff --git a/src/emu/machine/8237dma.c b/src/emu/machine/8237dma.c index c0e736ad46d..05c3d315697 100644 --- a/src/emu/machine/8237dma.c +++ b/src/emu/machine/8237dma.c @@ -19,7 +19,6 @@ **********************************************************************/ #include "driver.h" -#include "deprecat.h" #include "memconv.h" #include "8237dma.h" @@ -177,7 +176,7 @@ static void dma8237_update_status(const device_config *device) /* set the halt line */ if (dma8237->intf && dma8237->intf->cpunum >= 0) { - cpunum_set_input_line(Machine, dma8237->intf->cpunum, INPUT_LINE_HALT, + cpunum_set_input_line(device->machine, dma8237->intf->cpunum, INPUT_LINE_HALT, pending_transfer ? ASSERT_LINE : CLEAR_LINE); } diff --git a/src/emu/machine/8257dma.c b/src/emu/machine/8257dma.c index 0f9735539ba..f8a322cad1c 100644 --- a/src/emu/machine/8257dma.c +++ b/src/emu/machine/8257dma.c @@ -30,7 +30,6 @@ **********************************************************************/ #include "driver.h" -#include "deprecat.h" #include "memconv.h" #include "8257dma.h" @@ -196,7 +195,7 @@ static void dma8257_update_status(running_machine *machine, dma8257_t *dma8257) /* set the halt line */ if (dma8257->intf && dma8257->intf->cpunum >= 0) { - cpunum_set_input_line(Machine, dma8257->intf->cpunum, INPUT_LINE_HALT, + cpunum_set_input_line(machine, dma8257->intf->cpunum, INPUT_LINE_HALT, pending_transfer ? ASSERT_LINE : CLEAR_LINE); } diff --git a/src/emu/machine/ds1302.c b/src/emu/machine/ds1302.c index 1fcef19faab..07e1c9754e3 100644 --- a/src/emu/machine/ds1302.c +++ b/src/emu/machine/ds1302.c @@ -1,5 +1,4 @@ #include "driver.h" -#include "deprecat.h" #include "ds1302.h" /******************** @@ -49,7 +48,7 @@ static UINT8 bcd(UINT8 v) return ((v/10)<<4)|(v%10); } -void DS1302_CLK(UINT8 val) +void DS1302_CLK(running_machine *machine, UINT8 val) { if(val!=LastClk) { @@ -59,7 +58,7 @@ void DS1302_CLK(UINT8 val) if(ICount==8) //Command start { mame_system_time systime; - mame_get_base_datetime(Machine, &systime); + mame_get_base_datetime(machine, &systime); switch(ShiftIn) { diff --git a/src/emu/machine/ds1302.h b/src/emu/machine/ds1302.h index 7e77c6588d7..68602958a18 100644 --- a/src/emu/machine/ds1302.h +++ b/src/emu/machine/ds1302.h @@ -1,5 +1,5 @@ extern void DS1302_RST(UINT8 val); extern void DS1302_DAT(UINT8 val); -extern void DS1302_CLK(UINT8 val); +extern void DS1302_CLK(running_machine *machine, UINT8 val); extern UINT8 DS1302_RD(void); diff --git a/src/emu/machine/generic.c b/src/emu/machine/generic.c index 2034cd98314..7dc82f938b7 100644 --- a/src/emu/machine/generic.c +++ b/src/emu/machine/generic.c @@ -12,7 +12,6 @@ #include "driver.h" #include "config.h" #include "generic.h" -#include "deprecat.h" @@ -269,12 +268,12 @@ mame_file *nvram_fopen(running_machine *machine, UINT32 openflags) nvram_load - load a system's NVRAM -------------------------------------------------*/ -void nvram_load(void) +void nvram_load(running_machine *machine) { - if (Machine->config->nvram_handler != NULL) + if (machine->config->nvram_handler != NULL) { - mame_file *nvram_file = nvram_fopen(Machine, OPEN_FLAG_READ); - (*Machine->config->nvram_handler)(Machine, nvram_file, 0); + mame_file *nvram_file = nvram_fopen(machine, OPEN_FLAG_READ); + (*machine->config->nvram_handler)(machine, nvram_file, 0); if (nvram_file != NULL) mame_fclose(nvram_file); } @@ -285,14 +284,14 @@ void nvram_load(void) nvram_save - save a system's NVRAM -------------------------------------------------*/ -void nvram_save(void) +void nvram_save(running_machine *machine) { - if (Machine->config->nvram_handler != NULL) + if (machine->config->nvram_handler != NULL) { - mame_file *nvram_file = nvram_fopen(Machine, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + mame_file *nvram_file = nvram_fopen(machine, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); if (nvram_file != NULL) { - (*Machine->config->nvram_handler)(Machine, nvram_file, 1); + (*machine->config->nvram_handler)(machine, nvram_file, 1); mame_fclose(nvram_file); } } @@ -374,7 +373,7 @@ INLINE void memcard_name(int index, char *buffer) the given index -------------------------------------------------*/ -int memcard_create(int index, int overwrite) +int memcard_create(running_machine *machine, int index, int overwrite) { file_error filerr; mame_file *file; @@ -385,7 +384,7 @@ int memcard_create(int index, int overwrite) memcard_name(index, name); /* if we can't overwrite, fail if the file already exists */ - fname = astring_assemble_3(astring_alloc(), Machine->basename, PATH_SEPARATOR, name); + fname = astring_assemble_3(astring_alloc(), machine->basename, PATH_SEPARATOR, name); if (!overwrite) { filerr = mame_fopen(SEARCHPATH_MEMCARD, astring_c(fname), OPEN_FLAG_READ, &file); @@ -404,8 +403,8 @@ int memcard_create(int index, int overwrite) return 1; /* initialize and then save the card */ - if (Machine->config->memcard_handler) - (*Machine->config->memcard_handler)(Machine, file, MEMCARD_CREATE); + if (machine->config->memcard_handler) + (*machine->config->memcard_handler)(machine, file, MEMCARD_CREATE); /* close the file */ mame_fclose(file); @@ -418,7 +417,7 @@ int memcard_create(int index, int overwrite) with the given index -------------------------------------------------*/ -int memcard_insert(int index) +int memcard_insert(running_machine *machine, int index) { file_error filerr; mame_file *file; @@ -427,12 +426,12 @@ int memcard_insert(int index) /* if a card is already inserted, eject it first */ if (memcard_inserted != -1) - memcard_eject(Machine); + memcard_eject(machine); assert(memcard_inserted == -1); /* create a name */ memcard_name(index, name); - fname = astring_assemble_3(astring_alloc(), Machine->basename, PATH_SEPARATOR, name); + fname = astring_assemble_3(astring_alloc(), machine->basename, PATH_SEPARATOR, name); /* open the file; if we can't, it's an error */ filerr = mame_fopen(SEARCHPATH_MEMCARD, astring_c(fname), OPEN_FLAG_READ, &file); @@ -441,8 +440,8 @@ int memcard_insert(int index) return 1; /* initialize and then load the card */ - if (Machine->config->memcard_handler) - (*Machine->config->memcard_handler)(Machine, file, MEMCARD_INSERT); + if (machine->config->memcard_handler) + (*machine->config->memcard_handler)(machine, file, MEMCARD_INSERT); /* close the file */ mame_fclose(file); diff --git a/src/emu/machine/generic.h b/src/emu/machine/generic.h index 96d39ac33c7..48b6460d87d 100644 --- a/src/emu/machine/generic.h +++ b/src/emu/machine/generic.h @@ -78,10 +78,10 @@ void coin_lockout_global_w(int on); mame_file *nvram_fopen(running_machine *machine, UINT32 openflags); /* load NVRAM from a file */ -void nvram_load(void); +void nvram_load(running_machine *machine); /* save NVRAM to a file */ -void nvram_save(void); +void nvram_save(running_machine *machine); /* generic NVRAM handler that defaults to a 0 fill */ NVRAM_HANDLER( generic_0fill ); @@ -97,10 +97,10 @@ NVRAM_HANDLER( generic_randfill ); /* ----- memory card management ----- */ /* create a new memory card with the given index */ -int memcard_create(int index, int overwrite); +int memcard_create(running_machine *machine, int index, int overwrite); /* "insert" a memory card with the given index and load its data */ -int memcard_insert(int index); +int memcard_insert(running_machine *machine, int index); /* "eject" a memory card and save its data */ void memcard_eject(running_machine *machine); diff --git a/src/emu/machine/laserdsc.c b/src/emu/machine/laserdsc.c index ea7a5c71af3..07e2cc28883 100644 --- a/src/emu/machine/laserdsc.c +++ b/src/emu/machine/laserdsc.c @@ -14,7 +14,6 @@ #include "avcomp.h" #include "profiler.h" #include "streams.h" -#include "deprecat.h" #include "sound/custom.h" @@ -671,7 +670,7 @@ INLINE void fillbitmap_yuy16(bitmap_t *bitmap, UINT8 yval, UINT8 cr, UINT8 cb) laserdisc playback -------------------------------------------------*/ -laserdisc_info *laserdisc_init(int type, chd_file *chd, int custom_index) +laserdisc_info *laserdisc_init(running_machine *machine, int type, chd_file *chd, int custom_index) { int fps = 30, fpsfrac = 0, width = 720, height = 240, interlaced = 1, channels = 2, rate = 44100, metabytes = 0; UINT32 fps_times_1million, max_samples_per_track; @@ -679,7 +678,7 @@ laserdisc_info *laserdisc_init(int type, chd_file *chd, int custom_index) char metadata[256]; chd_error err; - assert_always(mame_get_phase(Machine) == MAME_PHASE_INIT, "Can only call laserdisc_init at init time!"); + assert_always(mame_get_phase(machine) == MAME_PHASE_INIT, "Can only call laserdisc_init at init time!"); /* initialize the info */ info = auto_malloc(sizeof(*info)); diff --git a/src/emu/machine/laserdsc.h b/src/emu/machine/laserdsc.h index 078a62dd532..3e0733994fe 100644 --- a/src/emu/machine/laserdsc.h +++ b/src/emu/machine/laserdsc.h @@ -68,7 +68,7 @@ extern const struct CustomSound_interface laserdisc_custom_interface; FUNCTION PROTOTYPES ***************************************************************************/ -laserdisc_info *laserdisc_init(int type, chd_file *chd, int custom_index); +laserdisc_info *laserdisc_init(running_machine *machine, int type, chd_file *chd, int custom_index); void laserdisc_reset(laserdisc_info *info, int type); void laserdisc_exit(laserdisc_info *info); void laserdisc_vsync(laserdisc_info *info); diff --git a/src/emu/machine/mc146818.c b/src/emu/machine/mc146818.c index ce3b0996c25..b5682e9323d 100644 --- a/src/emu/machine/mc146818.c +++ b/src/emu/machine/mc146818.c @@ -73,7 +73,6 @@ #include "driver.h" #include "memconv.h" -#include "deprecat.h" #include "machine/mc146818.h" @@ -108,7 +107,7 @@ static struct mc146818_chip *mc146818; -static void mc146818_set_base_datetime(void); +static void mc146818_set_base_datetime(running_machine *machine); static TIMER_CALLBACK( mc146818_timer ) { @@ -196,23 +195,23 @@ static TIMER_CALLBACK( mc146818_timer ) -void mc146818_init(MC146818_TYPE type) +void mc146818_init(running_machine *machine, MC146818_TYPE type) { mc146818 = auto_malloc(sizeof(*mc146818)); memset(mc146818, 0, sizeof(*mc146818)); mc146818->type = type; mc146818->last_refresh = timer_get_time(); timer_pulse(ATTOTIME_IN_HZ(1), NULL, 0, mc146818_timer); - mc146818_set_base_datetime(); + mc146818_set_base_datetime(machine); } -void mc146818_load(void) +void mc146818_load(running_machine *machine) { mame_file *file; - file = nvram_fopen(Machine, OPEN_FLAG_READ); + file = nvram_fopen(machine, OPEN_FLAG_READ); if (file) { mc146818_load_stream(file); @@ -236,11 +235,11 @@ static int dec_2_local(int a) -static void mc146818_set_base_datetime(void) +static void mc146818_set_base_datetime(running_machine *machine) { mame_system_time systime; - mame_get_base_datetime(Machine, &systime); + mame_get_base_datetime(machine, &systime); if (HOURS_24 || (systime.local_time.hour < 12)) mc146818->data[4] = dec_2_local(systime.local_time.hour); @@ -265,11 +264,11 @@ static void mc146818_set_base_datetime(void) -void mc146818_save(void) +void mc146818_save(running_machine *machine) { mame_file *file; - file = nvram_fopen(Machine, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + file = nvram_fopen(machine, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); if (file) { mame_fwrite(file, mc146818->data, sizeof(mc146818->data)); @@ -290,7 +289,7 @@ NVRAM_HANDLER( mc146818 ) { if (file == NULL) { - mc146818_set_base_datetime(); + mc146818_set_base_datetime(machine); // init only } else if (read_or_write) diff --git a/src/emu/machine/mc146818.h b/src/emu/machine/mc146818.h index 0f83135571b..7739a982ffd 100644 --- a/src/emu/machine/mc146818.h +++ b/src/emu/machine/mc146818.h @@ -24,16 +24,16 @@ typedef enum /* initialize mc146818 emulation, call only once at beginning */ -void mc146818_init(MC146818_TYPE type); +void mc146818_init(running_machine *machine, MC146818_TYPE type); /* loads data from standard nvram file */ -void mc146818_load(void); +void mc146818_load(running_machine *machine); /* loads data from file stream */ void mc146818_load_stream(mame_file *file); /* saves data into standard nvram file */ -void mc146818_save(void); +void mc146818_save(running_machine *machine); /* saves data into file stream */ void mc146818_save_stream(mame_file *file); diff --git a/src/emu/machine/rtc65271.c b/src/emu/machine/rtc65271.c index 9911f4fc7b4..a12d13b73d0 100644 --- a/src/emu/machine/rtc65271.c +++ b/src/emu/machine/rtc65271.c @@ -16,7 +16,6 @@ */ #include "driver.h" -#include "deprecat.h" #include "rtc65271.h" static void field_interrupts(void); @@ -184,7 +183,7 @@ static UINT8 BCD_to_binary(UINT8 data) /* load the SRAM and register contents from file */ -int rtc65271_file_load(mame_file *file) +int rtc65271_file_load(running_machine *machine, mame_file *file) { UINT8 buf; @@ -226,7 +225,7 @@ int rtc65271_file_load(mame_file *file) mame_system_time systime; /* get the current date/time from the core */ - mame_get_current_datetime(Machine, &systime); + mame_get_current_datetime(machine, &systime); /* set clock registers */ rtc.regs[reg_second] = systime.local_time.second; diff --git a/src/emu/machine/rtc65271.h b/src/emu/machine/rtc65271.h index 34aedbbd410..67fdccaa1b9 100644 --- a/src/emu/machine/rtc65271.h +++ b/src/emu/machine/rtc65271.h @@ -2,7 +2,7 @@ rtc65271.h: include file for rtc65271.c */ -extern int rtc65271_file_load(mame_file *file); +extern int rtc65271_file_load(running_machine *machine, mame_file *file); extern int rtc65271_file_save(mame_file *file); extern void rtc65271_init(UINT8 *xram, void (*interrupt_callback)(int state)); extern UINT8 rtc65271_r(int xramsel, offs_t offset); diff --git a/src/emu/machine/timekpr.c b/src/emu/machine/timekpr.c index 1fa3a3685a8..6758dedf53f 100644 --- a/src/emu/machine/timekpr.c +++ b/src/emu/machine/timekpr.c @@ -6,7 +6,6 @@ */ #include "driver.h" -#include "deprecat.h" #include "machine/timekpr.h" struct timekeeper_chip @@ -212,7 +211,7 @@ static TIMER_CALLBACK( timekeeper_tick ) } } -void timekeeper_init( int chip, int type, UINT8 *data ) +void timekeeper_init( running_machine *machine, int chip, int type, UINT8 *data ) { emu_timer *timer; attotime duration; @@ -291,7 +290,7 @@ void timekeeper_init( int chip, int type, UINT8 *data ) } c->data = data; - mame_get_base_datetime(Machine, &systime); + mame_get_base_datetime(machine, &systime); c->control = 0; c->seconds = make_bcd( systime.local_time.second ); diff --git a/src/emu/machine/timekpr.h b/src/emu/machine/timekpr.h index b8d3bbd57ef..91832d46ace 100644 --- a/src/emu/machine/timekpr.h +++ b/src/emu/machine/timekpr.h @@ -8,7 +8,7 @@ #if !defined( TIMEKPR_H ) #define TIMEKPR_H ( 1 ) -extern void timekeeper_init( int chip, int type, UINT8 *data ); +extern void timekeeper_init( running_machine *machine, int chip, int type, UINT8 *data ); #define MAX_TIMEKEEPER_CHIPS ( 1 ) diff --git a/src/emu/machine/z80ctc.c b/src/emu/machine/z80ctc.c index 78f4e38fe13..459c98355bd 100644 --- a/src/emu/machine/z80ctc.c +++ b/src/emu/machine/z80ctc.c @@ -105,13 +105,13 @@ static z80ctc ctcs[MAX_CTC]; INTERNAL STATE MANAGEMENT ***************************************************************************/ -static void interrupt_check(int which) +static void interrupt_check(running_machine *machine, int which) { z80ctc *ctc = ctcs + which; /* if we have a callback, update it with the current state */ if (ctc->intr) - (*ctc->intr)(Machine, (z80ctc_irq_state(which) & Z80_DAISY_INT) ? ASSERT_LINE : CLEAR_LINE); + (*ctc->intr)(machine, (z80ctc_irq_state(which) & Z80_DAISY_INT) ? ASSERT_LINE : CLEAR_LINE); } @@ -126,7 +126,7 @@ static TIMER_CALLBACK( timercallback ) { ctc->int_state[ch] |= Z80_DAISY_INT; VPRINTF(("CTC timer ch%d\n", ch)); - interrupt_check(which); + interrupt_check(machine, which); } /* generate the clock pulse */ @@ -191,7 +191,7 @@ void z80ctc_reset(int which) timer_adjust_oneshot(ctc->timer[i], attotime_never, 0); ctc->int_state[i] = 0; } - interrupt_check(which); + interrupt_check(Machine, which); VPRINTF(("CTC Reset\n")); } @@ -347,7 +347,7 @@ READ8_HANDLER( z80ctc_1_r ) { return z80ctc_r(1, offset); } EXTERNAL TRIGGERS ***************************************************************************/ -void z80ctc_trg_w(int which, int ch, UINT8 data) +void z80ctc_trg_w(running_machine *machine, int which, int ch, UINT8 data) { z80ctc *ctc = ctcs + which; @@ -391,20 +391,20 @@ void z80ctc_trg_w(int which, int ch, UINT8 data) /* if we hit zero, do the same thing as for a timer interrupt */ if (!ctc->down[ch]) - timercallback(Machine, NULL, (which << 2) + ch); + timercallback(machine, NULL, (which << 2) + ch); } } } } -WRITE8_HANDLER( z80ctc_0_trg0_w ) { z80ctc_trg_w(0, 0, data); } -WRITE8_HANDLER( z80ctc_0_trg1_w ) { z80ctc_trg_w(0, 1, data); } -WRITE8_HANDLER( z80ctc_0_trg2_w ) { z80ctc_trg_w(0, 2, data); } -WRITE8_HANDLER( z80ctc_0_trg3_w ) { z80ctc_trg_w(0, 3, data); } -WRITE8_HANDLER( z80ctc_1_trg0_w ) { z80ctc_trg_w(1, 0, data); } -WRITE8_HANDLER( z80ctc_1_trg1_w ) { z80ctc_trg_w(1, 1, data); } -WRITE8_HANDLER( z80ctc_1_trg2_w ) { z80ctc_trg_w(1, 2, data); } -WRITE8_HANDLER( z80ctc_1_trg3_w ) { z80ctc_trg_w(1, 3, data); } +WRITE8_HANDLER( z80ctc_0_trg0_w ) { z80ctc_trg_w(machine, 0, 0, data); } +WRITE8_HANDLER( z80ctc_0_trg1_w ) { z80ctc_trg_w(machine, 0, 1, data); } +WRITE8_HANDLER( z80ctc_0_trg2_w ) { z80ctc_trg_w(machine, 0, 2, data); } +WRITE8_HANDLER( z80ctc_0_trg3_w ) { z80ctc_trg_w(machine, 0, 3, data); } +WRITE8_HANDLER( z80ctc_1_trg0_w ) { z80ctc_trg_w(machine, 1, 0, data); } +WRITE8_HANDLER( z80ctc_1_trg1_w ) { z80ctc_trg_w(machine, 1, 1, data); } +WRITE8_HANDLER( z80ctc_1_trg2_w ) { z80ctc_trg_w(machine, 1, 2, data); } +WRITE8_HANDLER( z80ctc_1_trg3_w ) { z80ctc_trg_w(machine, 1, 3, data); } @@ -451,7 +451,7 @@ int z80ctc_irq_ack(int which) /* clear interrupt, switch to the IEO state, and update the IRQs */ ctc->int_state[ch] = Z80_DAISY_IEO; - interrupt_check(which); + interrupt_check(Machine, which); return ctc->vector + ch * 2; } @@ -475,7 +475,7 @@ void z80ctc_irq_reti(int which) /* clear the IEO state and update the IRQs */ ctc->int_state[ch] &= ~Z80_DAISY_IEO; - interrupt_check(which); + interrupt_check(Machine, which); return; } diff --git a/src/emu/machine/z80ctc.h b/src/emu/machine/z80ctc.h index b094a3d9238..ffe94e81a98 100644 --- a/src/emu/machine/z80ctc.h +++ b/src/emu/machine/z80ctc.h @@ -70,7 +70,7 @@ READ8_HANDLER( z80ctc_1_r ); EXTERNAL TRIGGERS ***************************************************************************/ -void z80ctc_trg_w(int which, int trg, UINT8 data); +void z80ctc_trg_w(running_machine *machine, int which, int trg, UINT8 data); WRITE8_HANDLER( z80ctc_0_trg0_w ); WRITE8_HANDLER( z80ctc_0_trg1_w ); WRITE8_HANDLER( z80ctc_0_trg2_w ); diff --git a/src/emu/machine/z80pio.c b/src/emu/machine/z80pio.c index 73baecb2295..835484e057c 100644 --- a/src/emu/machine/z80pio.c +++ b/src/emu/machine/z80pio.c @@ -97,17 +97,17 @@ static void set_rdy(z80pio *pio, int ch, int state) } -static void interrupt_check(int which) +static void interrupt_check(running_machine *machine, int which) { z80pio *pio = pios + which; /* if we have a callback, update it with the current state */ if (pio->intr) - (*pio->intr)(Machine, (z80pio_irq_state(which) & Z80_DAISY_INT) ? ASSERT_LINE : CLEAR_LINE); + (*pio->intr)(machine, (z80pio_irq_state(which) & Z80_DAISY_INT) ? ASSERT_LINE : CLEAR_LINE); } -static void update_irq_state(z80pio *pio, int ch) +static void update_irq_state(running_machine *machine, z80pio *pio, int ch) { int old_state = pio->int_state[ch]; int irq = 0; @@ -157,7 +157,7 @@ static void update_irq_state(z80pio *pio, int ch) pio->int_state[ch] &= ~Z80_DAISY_INT; if (old_state != pio->int_state[ch]) - interrupt_check(pio - pios); + interrupt_check(machine, pio - pios); } @@ -212,7 +212,7 @@ void z80pio_reset(int which) pio->int_state[i] = 0; pio->strobe[i] = 0; } - interrupt_check(which); + interrupt_check(Machine, which); } @@ -278,7 +278,7 @@ void z80pio_c_w(int which, int ch, UINT8 data) } /* interrupt check */ - update_irq_state(pio, ch); + update_irq_state(Machine, pio, ch); } @@ -307,7 +307,7 @@ void z80pio_d_w(int which, int ch, UINT8 data) case PIO_MODE0: /* mode 0 output */ case PIO_MODE2: /* mode 2 i/o */ set_rdy(pio, ch, 1); /* ready = H */ - update_irq_state(pio, ch); + update_irq_state(Machine, pio, ch); return; case PIO_MODE1: /* mode 1 input */ @@ -333,7 +333,7 @@ UINT8 z80pio_d_r(int which, int ch) set_rdy(pio, ch, 1); /* ready = H */ if(pio->port_read[ch]) pio->in[ch] = pio->port_read[ch](Machine, 0); - update_irq_state(pio, ch); + update_irq_state(Machine, pio, ch); return pio->in[ch]; case PIO_MODE2: /* mode 2 i/o */ @@ -341,7 +341,7 @@ UINT8 z80pio_d_r(int which, int ch) set_rdy(pio, 1, 1); /* brdy = H */ if(pio->port_read[ch]) pio->in[ch] = pio->port_read[ch](Machine, 0); - update_irq_state(pio, ch); + update_irq_state(Machine, pio, ch); return pio->in[ch]; case PIO_MODE3: /* mode 3 bit */ @@ -375,12 +375,12 @@ void z80pio_p_w(int which, UINT8 ch, UINT8 data) case PIO_MODE1: set_rdy(pio, ch, 0); - update_irq_state(pio, ch); + update_irq_state(Machine, pio, ch); break; case PIO_MODE3: /* irq check */ - update_irq_state(pio, ch); + update_irq_state(Machine, pio, ch); break; } } @@ -395,7 +395,7 @@ int z80pio_p_r(int which, UINT8 ch) case PIO_MODE2: /* port A only */ case PIO_MODE0: set_rdy(pio, ch, 0); - update_irq_state(pio, ch); + update_irq_state(Machine, pio, ch); break; case PIO_MODE1: @@ -463,7 +463,7 @@ static void z80pio_update_strobe(int which, int ch, int state) pio->strobe[ch] = state; /* check interrupt */ - interrupt_check(which); + interrupt_check(Machine, which); } break; @@ -519,7 +519,7 @@ int z80pio_irq_ack(int which) { /* clear interrupt, switch to the IEO state, and update the IRQs */ pio->int_state[ch] = Z80_DAISY_IEO; - interrupt_check(which); + interrupt_check(Machine, which); return pio->vector[ch]; } @@ -541,7 +541,7 @@ void z80pio_irq_reti(int which) { /* clear the IEO state and update the IRQs */ pio->int_state[ch] &= ~Z80_DAISY_IEO; - interrupt_check(which); + interrupt_check(Machine, which); return; } diff --git a/src/emu/machine/z80sio.c b/src/emu/machine/z80sio.c index 45a7c720658..45fee492c48 100644 --- a/src/emu/machine/z80sio.c +++ b/src/emu/machine/z80sio.c @@ -261,11 +261,11 @@ static z80sio sios[MAX_SIO]; INLINE FUNCTIONS ***************************************************************************/ -INLINE void interrupt_check(z80sio *sio) +INLINE void interrupt_check(running_machine *machine, z80sio *sio) { /* if we have a callback, update it with the current state */ if (sio->irq_cb != NULL) - (*sio->irq_cb)(Machine, (z80sio_irq_state(sio - sios) & Z80_DAISY_INT) ? ASSERT_LINE : CLEAR_LINE); + (*sio->irq_cb)(machine, (z80sio_irq_state(sio - sios) & Z80_DAISY_INT) ? ASSERT_LINE : CLEAR_LINE); } @@ -311,7 +311,7 @@ void z80sio_init(int which, z80sio_interface *intf) reset_channel - reset a single SIO channel -------------------------------------------------*/ -static void reset_channel(z80sio *sio, int ch) +static void reset_channel(running_machine *machine, z80sio *sio, int ch) { attotime tpc = compute_time_per_character(sio, ch); sio_channel *chan = &sio->chan[ch]; @@ -327,7 +327,7 @@ static void reset_channel(z80sio *sio, int ch) sio->int_state[2 + 4*ch] = 0; sio->int_state[3 + 4*ch] = 0; - interrupt_check(sio); + interrupt_check(machine, sio); /* start the receive timer running */ timer_adjust_periodic(chan->receive_timer, tpc, ((sio - sios) << 1) | ch, tpc); @@ -347,7 +347,7 @@ void z80sio_reset(int which) /* loop over channels */ for (ch = 0; ch < 2; ch++) - reset_channel(sio, ch); + reset_channel(Machine, sio, ch); } @@ -386,34 +386,34 @@ void z80sio_c_w(int which, int ch, UINT8 data) { case SIO_WR0_COMMAND_CH_RESET: VPRINTF(("%04X:SIO reset channel %c\n", activecpu_get_pc(), 'A' + ch)); - reset_channel(sio, ch); + reset_channel(Machine, sio, ch); break; case SIO_WR0_COMMAND_RES_STATUS_INT: sio->int_state[INT_CHA_STATUS - 4*ch] &= ~Z80_DAISY_INT; - interrupt_check(sio); + interrupt_check(Machine, sio); break; case SIO_WR0_COMMAND_ENA_RX_INT: chan->int_on_next_rx = TRUE; - interrupt_check(sio); + interrupt_check(Machine, sio); break; case SIO_WR0_COMMAND_RES_TX_INT: sio->int_state[INT_CHA_TRANSMIT - 4*ch] &= ~Z80_DAISY_INT; - interrupt_check(sio); + interrupt_check(Machine, sio); break; case SIO_WR0_COMMAND_RES_ERROR: sio->int_state[INT_CHA_ERROR - 4*ch] &= ~Z80_DAISY_INT; - interrupt_check(sio); + interrupt_check(Machine, sio); break; } break; /* SIO write register 1 */ case 1: - interrupt_check(sio); + interrupt_check(Machine, sio); break; /* SIO write register 5 */ @@ -483,7 +483,7 @@ void z80sio_d_w(int which, int ch, UINT8 data) /* reset the transmit interrupt */ sio->int_state[INT_CHA_TRANSMIT - 4*ch] &= ~Z80_DAISY_INT; - interrupt_check(sio); + interrupt_check(Machine, sio); /* stash the character */ chan->outbuf = data; @@ -504,7 +504,7 @@ UINT8 z80sio_d_r(int which, int ch) /* reset the receive interrupt */ sio->int_state[INT_CHA_RECEIVE - 4*ch] &= ~Z80_DAISY_INT; - interrupt_check(sio); + interrupt_check(Machine, sio); VPRINTF(("%04X:sio_data_r(%c) = %02X\n", activecpu_get_pc(), 'A' + ch, chan->inbuf)); @@ -571,7 +571,7 @@ static TIMER_CALLBACK( change_input_line ) if (((old ^ chan->status[0]) & line) && (chan->regs[1] & SIO_WR1_STATUSINT_ENABLE)) { sio->int_state[INT_CHA_STATUS - 4*ch] |= Z80_DAISY_INT; - interrupt_check(sio); + interrupt_check(machine, sio); } } @@ -651,7 +651,7 @@ static TIMER_CALLBACK( serial_callback ) if (chan->regs[1] & SIO_WR1_TXINT_ENABLE) { sio->int_state[INT_CHA_TRANSMIT - 4*ch] |= Z80_DAISY_INT; - interrupt_check(sio); + interrupt_check(machine, sio); } /* reset the output buffer */ @@ -695,7 +695,7 @@ static TIMER_CALLBACK( serial_callback ) case SIO_WR1_RXINT_ALL_NOPARITY: case SIO_WR1_RXINT_ALL_PARITY: sio->int_state[INT_CHA_RECEIVE - 4*ch] |= Z80_DAISY_INT; - interrupt_check(sio); + interrupt_check(machine, sio); break; } chan->int_on_next_rx = FALSE; @@ -766,7 +766,7 @@ int z80sio_irq_ack(int which) /* clear interrupt, switch to the IEO state, and update the IRQs */ sio->int_state[inum] = Z80_DAISY_IEO; - interrupt_check(sio); + interrupt_check(Machine, sio); return sio->chan[1].regs[2] + inum * 2; } } @@ -793,7 +793,7 @@ void z80sio_irq_reti(int which) /* clear the IEO state and update the IRQs */ sio->int_state[inum] &= ~Z80_DAISY_IEO; - interrupt_check(sio); + interrupt_check(Machine, sio); return; } } diff --git a/src/emu/mame.c b/src/emu/mame.c index 063ac872c1a..de74d396274 100644 --- a/src/emu/mame.c +++ b/src/emu/mame.c @@ -369,7 +369,7 @@ int mame_execute(core_options *options) /* load the configuration settings and NVRAM */ settingsloaded = config_load_settings(machine); - nvram_load(); + nvram_load(machine); /* display the startup screens */ ui_display_startup_screens(machine, firstrun, !settingsloaded); @@ -411,7 +411,7 @@ int mame_execute(core_options *options) end_resource_tracking(); /* save the NVRAM and configuration */ - nvram_save(); + nvram_save(machine); config_save_settings(machine); } mame->fatal_error_jmpbuf_valid = FALSE; diff --git a/src/emu/uimenu.c b/src/emu/uimenu.c index d631f81d991..d6f92519745 100644 --- a/src/emu/uimenu.c +++ b/src/emu/uimenu.c @@ -1368,7 +1368,7 @@ static UINT32 menu_memory_card(running_machine *machine, UINT32 state) /* handle load */ if (selected == insertindex) { - if (memcard_insert(cardnum) == 0) + if (memcard_insert(machine, cardnum) == 0) { popmessage("Memory card loaded"); ui_menu_stack_reset(); @@ -1388,7 +1388,7 @@ static UINT32 menu_memory_card(running_machine *machine, UINT32 state) /* handle create */ else if (selected == createindex) { - if (memcard_create(cardnum, FALSE) == 0) + if (memcard_create(machine, cardnum, FALSE) == 0) popmessage("Memory card created"); else popmessage("Error creating memory card\n(Card may already exist)"); diff --git a/src/mame/drivers/alg.c b/src/mame/drivers/alg.c index 60abc321d73..76ed5dfbcef 100644 --- a/src/mame/drivers/alg.c +++ b/src/mame/drivers/alg.c @@ -157,7 +157,7 @@ static VIDEO_UPDATE( alg ) static MACHINE_START( alg ) { - discinfo = laserdisc_init(LASERDISC_TYPE_LDP1450, get_disk_handle(0), 1); + discinfo = laserdisc_init(machine, LASERDISC_TYPE_LDP1450, get_disk_handle(0), 1); serial_timer = timer_alloc(response_timer, NULL); serial_timer_active = FALSE; } @@ -714,7 +714,7 @@ ROM_END * *************************************/ -static void alg_init(void) +static void alg_init(running_machine *machine) { static const amiga_machine_interface alg_intf = { @@ -731,7 +731,7 @@ static void alg_init(void) NULL, 0 }; - amiga_machine_config(&alg_intf); + amiga_machine_config(machine, &alg_intf); /* set up memory */ memory_configure_bank(1, 0, 1, amiga_chip_ram, 0); @@ -763,7 +763,7 @@ static DRIVER_INIT( palr1 ) } free(original); - alg_init(); + alg_init(machine); } static DRIVER_INIT( palr3 ) @@ -782,7 +782,7 @@ static DRIVER_INIT( palr3 ) } free(original); - alg_init(); + alg_init(machine); } static DRIVER_INIT( palr6 ) @@ -803,7 +803,7 @@ static DRIVER_INIT( palr6 ) } free(original); - alg_init(); + alg_init(machine); } static DRIVER_INIT( aplatoon ) @@ -823,12 +823,12 @@ static DRIVER_INIT( aplatoon ) memcpy(decrypted + i * 0x1000, rom + shuffle[i] * 0x1000, 0x1000); memcpy(rom, decrypted, 0x40000); logerror("decrypt done\n "); - alg_init(); + alg_init(machine); } static DRIVER_INIT( none ) { - alg_init(); + alg_init(machine); } diff --git a/src/mame/drivers/arcadia.c b/src/mame/drivers/arcadia.c index ebd7e8626eb..bea4cac1d80 100644 --- a/src/mame/drivers/arcadia.c +++ b/src/mame/drivers/arcadia.c @@ -649,7 +649,7 @@ INLINE void generic_decode(int region, int bit7, int bit6, int bit5, int bit4, i * *************************************/ -static void arcadia_init(void) +static void arcadia_init(running_machine *machine) { static const amiga_machine_interface arcadia_intf = { @@ -667,7 +667,7 @@ static void arcadia_init(void) UINT16 *biosrom; /* configure our Amiga setup */ - amiga_machine_config(&arcadia_intf); + amiga_machine_config(machine, &arcadia_intf); /* set up memory */ memory_configure_bank(1, 0, 1, amiga_chip_ram, 0); @@ -687,17 +687,17 @@ static void arcadia_init(void) * *************************************/ -static DRIVER_INIT( none ) { arcadia_init(); } -static DRIVER_INIT( airh ) { generic_decode(REGION_USER3, 5, 0, 2, 4, 7, 6, 1, 3); arcadia_init(); } -static DRIVER_INIT( bowl ) { generic_decode(REGION_USER3, 7, 6, 0, 1, 2, 3, 4, 5); arcadia_init(); } -static DRIVER_INIT( dart ) { generic_decode(REGION_USER3, 4, 0, 7, 6, 3, 1, 2, 5); arcadia_init(); } -static DRIVER_INIT( ldrba ) { generic_decode(REGION_USER3, 2, 3, 4, 1, 0, 7, 5, 6); arcadia_init(); } -static DRIVER_INIT( ninj ) { generic_decode(REGION_USER3, 1, 6, 5, 7, 4, 2, 0, 3); arcadia_init(); } -static DRIVER_INIT( rdwr ) { generic_decode(REGION_USER3, 3, 1, 6, 4, 0, 5, 2, 7); arcadia_init(); } -static DRIVER_INIT( sdwr ) { generic_decode(REGION_USER3, 6, 3, 4, 5, 2, 1, 0, 7); arcadia_init(); } -static DRIVER_INIT( socc ) { generic_decode(REGION_USER3, 0, 7, 1, 6, 5, 4, 3, 2); arcadia_init(); } -static DRIVER_INIT( sprg ) { generic_decode(REGION_USER3, 4, 7, 3, 0, 6, 5, 2, 1); arcadia_init(); } -static DRIVER_INIT( xeon ) { generic_decode(REGION_USER3, 3, 1, 2, 4, 0, 5, 6, 7); arcadia_init(); } +static DRIVER_INIT( none ) { arcadia_init(machine); } +static DRIVER_INIT( airh ) { generic_decode(REGION_USER3, 5, 0, 2, 4, 7, 6, 1, 3); arcadia_init(machine); } +static DRIVER_INIT( bowl ) { generic_decode(REGION_USER3, 7, 6, 0, 1, 2, 3, 4, 5); arcadia_init(machine); } +static DRIVER_INIT( dart ) { generic_decode(REGION_USER3, 4, 0, 7, 6, 3, 1, 2, 5); arcadia_init(machine); } +static DRIVER_INIT( ldrba ) { generic_decode(REGION_USER3, 2, 3, 4, 1, 0, 7, 5, 6); arcadia_init(machine); } +static DRIVER_INIT( ninj ) { generic_decode(REGION_USER3, 1, 6, 5, 7, 4, 2, 0, 3); arcadia_init(machine); } +static DRIVER_INIT( rdwr ) { generic_decode(REGION_USER3, 3, 1, 6, 4, 0, 5, 2, 7); arcadia_init(machine); } +static DRIVER_INIT( sdwr ) { generic_decode(REGION_USER3, 6, 3, 4, 5, 2, 1, 0, 7); arcadia_init(machine); } +static DRIVER_INIT( socc ) { generic_decode(REGION_USER3, 0, 7, 1, 6, 5, 4, 3, 2); arcadia_init(machine); } +static DRIVER_INIT( sprg ) { generic_decode(REGION_USER3, 4, 7, 3, 0, 6, 5, 2, 1); arcadia_init(machine); } +static DRIVER_INIT( xeon ) { generic_decode(REGION_USER3, 3, 1, 2, 4, 0, 5, 6, 7); arcadia_init(machine); } diff --git a/src/mame/drivers/berzerk.c b/src/mame/drivers/berzerk.c index 15b565580cc..8b2345494e1 100644 --- a/src/mame/drivers/berzerk.c +++ b/src/mame/drivers/berzerk.c @@ -316,10 +316,10 @@ static MACHINE_RESET( berzerk ) static VIDEO_START( berzerk ) { - TTL74181_config(LS181_12C, 0); + TTL74181_config(machine, LS181_12C, 0); TTL74181_write(LS181_12C, TTL74181_INPUT_M, 1, 1); - TTL74181_config(LS181_10C, 0); + TTL74181_config(machine, LS181_10C, 0); TTL74181_write(LS181_10C, TTL74181_INPUT_M, 1, 1); } diff --git a/src/mame/drivers/cliffhgr.c b/src/mame/drivers/cliffhgr.c index e5d7b8244e6..508624eb73a 100644 --- a/src/mame/drivers/cliffhgr.c +++ b/src/mame/drivers/cliffhgr.c @@ -265,7 +265,7 @@ static void vdp_interrupt (running_machine *machine, int state) static MACHINE_START( cliffhgr ) { - discinfo = laserdisc_init(LASERDISC_TYPE_PR8210, get_disk_handle(0), 0); + discinfo = laserdisc_init(machine, LASERDISC_TYPE_PR8210, get_disk_handle(0), 0); irq_timer = timer_alloc(cliff_irq_callback, NULL); } diff --git a/src/mame/drivers/crystal.c b/src/mame/drivers/crystal.c index d26987b7b9b..e9131558d3e 100644 --- a/src/mame/drivers/crystal.c +++ b/src/mame/drivers/crystal.c @@ -387,7 +387,7 @@ static WRITE32_HANDLER(PIO_w) DS1302_RST(RST?1:0); DS1302_DAT(DAT?1:0); - DS1302_CLK(CLK?1:0); + DS1302_CLK(machine, CLK?1:0); if(DS1302_RD()) program_write_dword_32le(0x01802008,program_read_dword_32le(0x01802008)|0x10000000); diff --git a/src/mame/drivers/cubocd32.c b/src/mame/drivers/cubocd32.c index a26ef785a4e..1cd33a3db68 100644 --- a/src/mame/drivers/cubocd32.c +++ b/src/mame/drivers/cubocd32.c @@ -339,7 +339,7 @@ static DRIVER_INIT( cd32 ) }; /* configure our Amiga setup */ - amiga_machine_config(&cubocd32_intf); + amiga_machine_config(machine, &cubocd32_intf); /* set up memory */ memory_configure_bank(1, 0, 1, amiga_chip_ram32, 0); diff --git a/src/mame/drivers/dlair.c b/src/mame/drivers/dlair.c index d8b87f0d444..8755c00616c 100644 --- a/src/mame/drivers/dlair.c +++ b/src/mame/drivers/dlair.c @@ -272,7 +272,7 @@ static VIDEO_UPDATE( dleuro ) static MACHINE_START( dlair ) { - discinfo = laserdisc_init(laserdisc_type & LASERDISC_TYPE_MASK, get_disk_handle(0), 0); + discinfo = laserdisc_init(machine, laserdisc_type & LASERDISC_TYPE_MASK, get_disk_handle(0), 0); } @@ -284,7 +284,7 @@ static MACHINE_START( dleuro ) z80ctc_init(0, &ctc_intf); z80sio_init(0, &sio_intf); - discinfo = laserdisc_init(laserdisc_type & LASERDISC_TYPE_MASK, get_disk_handle(0), 0); + discinfo = laserdisc_init(machine, laserdisc_type & LASERDISC_TYPE_MASK, get_disk_handle(0), 0); } diff --git a/src/mame/drivers/esh.c b/src/mame/drivers/esh.c index f16e39ef50e..383e27f5720 100644 --- a/src/mame/drivers/esh.c +++ b/src/mame/drivers/esh.c @@ -260,7 +260,7 @@ GFXDECODE_END static MACHINE_START( esh ) { - discinfo = laserdisc_init(LASERDISC_TYPE_LDV1000, get_disk_handle(0), 0); + discinfo = laserdisc_init(machine, LASERDISC_TYPE_LDV1000, get_disk_handle(0), 0); return; } diff --git a/src/mame/drivers/firebeat.c b/src/mame/drivers/firebeat.c index 422cca16817..d24a9d60505 100644 --- a/src/mame/drivers/firebeat.c +++ b/src/mame/drivers/firebeat.c @@ -1848,7 +1848,7 @@ static NVRAM_HANDLER(firebeat) if (file != NULL) { - rtc65271_file_load(file); + rtc65271_file_load(machine, file); } } } diff --git a/src/mame/drivers/gamecstl.c b/src/mame/drivers/gamecstl.c index ed16d069b82..492a55d3cd2 100644 --- a/src/mame/drivers/gamecstl.c +++ b/src/mame/drivers/gamecstl.c @@ -727,7 +727,7 @@ static DRIVER_INIT( gamecstl ) bios_ram = auto_malloc(0x10000); init_pc_common(machine, PCCOMMON_KEYBOARD_AT, gamecstl_set_keyb_int); - mc146818_init(MC146818_STANDARD); + mc146818_init(machine, MC146818_STANDARD); intel82439tx_init(); diff --git a/src/mame/drivers/gameplan.c b/src/mame/drivers/gameplan.c index 31d2a1ba723..305ed65014e 100644 --- a/src/mame/drivers/gameplan.c +++ b/src/mame/drivers/gameplan.c @@ -197,9 +197,9 @@ static MACHINE_START( gameplan ) via_config(1, &via_1_interface); via_config(2, &via_2_interface); - r6532_config(0, &r6532_interface); + r6532_config(machine, 0, &r6532_interface); r6532_set_clock(0, GAMEPLAN_AUDIO_CPU_CLOCK); - r6532_reset(0); + r6532_reset(machine, 0); /* register for save states */ state_save_register_global(state->current_port); diff --git a/src/mame/drivers/gpworld.c b/src/mame/drivers/gpworld.c index ec6fb2dd9b5..fc15aedac01 100644 --- a/src/mame/drivers/gpworld.c +++ b/src/mame/drivers/gpworld.c @@ -386,7 +386,7 @@ INPUT_PORTS_END static MACHINE_START( gpworld ) { - discinfo = laserdisc_init(LASERDISC_TYPE_LDV1000, get_disk_handle(0), 0); + discinfo = laserdisc_init(machine, LASERDISC_TYPE_LDV1000, get_disk_handle(0), 0); return; } diff --git a/src/mame/drivers/hornet.c b/src/mame/drivers/hornet.c index c5e66c11824..73e4cf50256 100644 --- a/src/mame/drivers/hornet.c +++ b/src/mame/drivers/hornet.c @@ -1316,7 +1316,7 @@ static void init_hornet(running_machine *machine, const UINT8 *backupdef) backup_ram = auto_malloc(0x2000); memcpy(backup_ram, backupdef, 0x2000); - timekeeper_init(0, TIMEKEEPER_M48T58, backup_ram); + timekeeper_init(machine, 0, TIMEKEEPER_M48T58, backup_ram); ppc4xx_spu_set_tx_handler(0, jamma_jvs_w); } @@ -1332,7 +1332,7 @@ static void init_hornet_2board(running_machine *machine, const UINT8 *backupdef) backup_ram = auto_malloc(0x2000); memcpy(backup_ram, backupdef, 0x2000); - timekeeper_init(0, TIMEKEEPER_M48T58, backup_ram); + timekeeper_init(machine, 0, TIMEKEEPER_M48T58, backup_ram); ppc4xx_spu_set_tx_handler(0, jamma_jvs_w); } diff --git a/src/mame/drivers/istellar.c b/src/mame/drivers/istellar.c index b4d6815c9e4..fac6a1afd64 100644 --- a/src/mame/drivers/istellar.c +++ b/src/mame/drivers/istellar.c @@ -308,8 +308,7 @@ GFXDECODE_END static MACHINE_START( istellar ) { - discinfo = laserdisc_init(LASERDISC_TYPE_LDV1000, get_disk_handle(0), 0); - return; + discinfo = laserdisc_init(machine, LASERDISC_TYPE_LDV1000, get_disk_handle(0), 0); } static INTERRUPT_GEN( vblank_callback_istellar ) diff --git a/src/mame/drivers/itech32.c b/src/mame/drivers/itech32.c index d3ac38c8a8f..4075b6a61e4 100644 --- a/src/mame/drivers/itech32.c +++ b/src/mame/drivers/itech32.c @@ -211,7 +211,6 @@ Notes: ****************************************************************************/ #include "driver.h" -#include "deprecat.h" #include "cpu/m6809/m6809.h" #include "cpu/m68000/m68000.h" #include "machine/6522via.h" @@ -3786,7 +3785,7 @@ static DRIVER_INIT( wcbowlt ) /* PIC 16C54 labeled as ITBWL-3 */ /* Tournament Version, Same protection memory address as WCB Deluxe, but uses the standard WCB pic ITBWL-3 */ init_shuffle_bowl_common(machine, 0x111a); - timekeeper_init( 0, TIMEKEEPER_M48T02, NULL ); + timekeeper_init( machine, 0, TIMEKEEPER_M48T02, NULL ); memory_install_readwrite32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x681000, 0x6817ff, 0, 0, timekeeper_0_32be_r, timekeeper_0_32be_w); } @@ -3835,7 +3834,7 @@ static DRIVER_INIT( aamat ) Tournament Version - So install needed handler for the TimeKeeper ram */ DRIVER_INIT_CALL(aama); - timekeeper_init( 0, TIMEKEEPER_M48T02, NULL ); + timekeeper_init( machine, 0, TIMEKEEPER_M48T02, NULL ); memory_install_readwrite32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x681000, 0x6817ff, 0, 0, timekeeper_0_32be_r, timekeeper_0_32be_w); } diff --git a/src/mame/drivers/ksys573.c b/src/mame/drivers/ksys573.c index 342d11f1c02..084ccd53bd9 100644 --- a/src/mame/drivers/ksys573.c +++ b/src/mame/drivers/ksys573.c @@ -1501,7 +1501,7 @@ static DRIVER_INIT( konami573 ) m_p_timer_root[i] = timer_alloc(root_finished, NULL); } - timekeeper_init( 0, TIMEKEEPER_M48T58, memory_region( machine, REGION_USER11 ) ); + timekeeper_init( machine, 0, TIMEKEEPER_M48T58, memory_region( machine, REGION_USER11 ) ); state_save_register_global( m_n_security_control ); diff --git a/src/mame/drivers/lgp.c b/src/mame/drivers/lgp.c index 5406879fab9..9f4e260e282 100644 --- a/src/mame/drivers/lgp.c +++ b/src/mame/drivers/lgp.c @@ -317,8 +317,7 @@ GFXDECODE_END static MACHINE_START( lgp ) { - discinfo = laserdisc_init(LASERDISC_TYPE_LDV1000, get_disk_handle(0), 0); - return; + discinfo = laserdisc_init(machine, LASERDISC_TYPE_LDV1000, get_disk_handle(0), 0); } static TIMER_CALLBACK( irq_stop ) diff --git a/src/mame/drivers/mediagx.c b/src/mame/drivers/mediagx.c index 37e5e50adb6..df659a3d2ad 100644 --- a/src/mame/drivers/mediagx.c +++ b/src/mame/drivers/mediagx.c @@ -1121,7 +1121,7 @@ static void mediagx_set_keyb_int(int state) { static void init_mediagx(running_machine *machine) { init_pc_common(machine, PCCOMMON_KEYBOARD_AT,mediagx_set_keyb_int); - mc146818_init(MC146818_STANDARD); + mc146818_init(machine, MC146818_STANDARD); pci_init(); pci_add_device(0, 18, &cx5510); diff --git a/src/mame/drivers/midzeus.c b/src/mame/drivers/midzeus.c index d7d1eef9215..038ab1776ce 100644 --- a/src/mame/drivers/midzeus.c +++ b/src/mame/drivers/midzeus.c @@ -91,7 +91,7 @@ static MACHINE_START( midzeus ) static MACHINE_START( midzeus2 ) { - timekeeper_init(0, TIMEKEEPER_MIDZEUS2, NULL); + timekeeper_init(machine, 0, TIMEKEEPER_MIDZEUS2, NULL); MACHINE_START_CALL(midzeus); } diff --git a/src/mame/drivers/model1.c b/src/mame/drivers/model1.c index 196c8e7ded1..d10afa4a06a 100644 --- a/src/mame/drivers/model1.c +++ b/src/mame/drivers/model1.c @@ -625,7 +625,6 @@ Notes: */ #include "driver.h" -#include "deprecat.h" #include "machine/eeprom.h" #include "system16.h" #include "video/segaic24.h" diff --git a/src/mame/drivers/model2.c b/src/mame/drivers/model2.c index bc0beecd6e0..aa80ed46a1c 100644 --- a/src/mame/drivers/model2.c +++ b/src/mame/drivers/model2.c @@ -49,7 +49,7 @@ */ #include "driver.h" -#include "deprecat.h" +//#include "deprecat.h" #include "machine/eeprom.h" #include "video/segaic24.h" #include "cpu/i960/i960.h" diff --git a/src/mame/drivers/mquake.c b/src/mame/drivers/mquake.c index 3c3492cd470..649806872b3 100644 --- a/src/mame/drivers/mquake.c +++ b/src/mame/drivers/mquake.c @@ -448,7 +448,7 @@ static DRIVER_INIT(mquake) NULL, 0 }; - amiga_machine_config(&mquake_intf); + amiga_machine_config(machine, &mquake_intf); /* set up memory */ memory_configure_bank(1, 0, 1, amiga_chip_ram, 0); diff --git a/src/mame/drivers/nwk-tr.c b/src/mame/drivers/nwk-tr.c index 9b62b8486e5..87bef42403b 100644 --- a/src/mame/drivers/nwk-tr.c +++ b/src/mame/drivers/nwk-tr.c @@ -1147,7 +1147,7 @@ static DRIVER_INIT( nwktr ) set_cgboard_texture_bank(0, 5, memory_region(machine, REGION_USER5)); sharc_dataram = auto_malloc(0x100000); - timekeeper_init(0, TIMEKEEPER_M48T58, backup_ram); + timekeeper_init(machine, 0, TIMEKEEPER_M48T58, backup_ram); K056800_init(sound_irq_callback); K033906_init(); diff --git a/src/mame/drivers/segald.c b/src/mame/drivers/segald.c index 0d85cf99a03..7de4fb270f6 100644 --- a/src/mame/drivers/segald.c +++ b/src/mame/drivers/segald.c @@ -325,8 +325,7 @@ INPUT_PORTS_END static MACHINE_START( astron ) { - discinfo = laserdisc_init(LASERDISC_TYPE_LDV1000, get_disk_handle(0), 0); - return; + discinfo = laserdisc_init(machine, LASERDISC_TYPE_LDV1000, get_disk_handle(0), 0); } static INTERRUPT_GEN( vblank_callback_astron ) diff --git a/src/mame/drivers/slapshot.c b/src/mame/drivers/slapshot.c index 45931fbc185..70f1af654cf 100644 --- a/src/mame/drivers/slapshot.c +++ b/src/mame/drivers/slapshot.c @@ -731,7 +731,7 @@ static DRIVER_INIT( slapshot ) int size=memory_region_length(machine, REGION_GFX2); int data; - timekeeper_init( 0, TIMEKEEPER_MK48T08, NULL ); + timekeeper_init( machine, 0, TIMEKEEPER_MK48T08, NULL ); offset = size/2; for (i = size/2+size/4; i<size; i++) diff --git a/src/mame/drivers/superdq.c b/src/mame/drivers/superdq.c index 900853b62a6..3ce1e387845 100644 --- a/src/mame/drivers/superdq.c +++ b/src/mame/drivers/superdq.c @@ -147,7 +147,7 @@ static PALETTE_INIT( superdq ) static MACHINE_START( superdq ) { - discinfo = laserdisc_init(LASERDISC_TYPE_LDV1000, get_disk_handle(0), 0); + discinfo = laserdisc_init(machine, LASERDISC_TYPE_LDV1000, get_disk_handle(0), 0); } static INTERRUPT_GEN( superdq_vblank ) diff --git a/src/mame/drivers/taitowlf.c b/src/mame/drivers/taitowlf.c index b7b7e45f4b8..fe93e624637 100644 --- a/src/mame/drivers/taitowlf.c +++ b/src/mame/drivers/taitowlf.c @@ -693,7 +693,7 @@ static DRIVER_INIT( taitowlf ) bios_ram = auto_malloc(0x10000); init_pc_common(machine, PCCOMMON_KEYBOARD_AT, taitowlf_set_keyb_int); - mc146818_init(MC146818_STANDARD); + mc146818_init(machine, MC146818_STANDARD); intel82439tx_init(); diff --git a/src/mame/drivers/thayers.c b/src/mame/drivers/thayers.c index b50e61f6ea6..ff218df0bad 100644 --- a/src/mame/drivers/thayers.c +++ b/src/mame/drivers/thayers.c @@ -738,7 +738,7 @@ static MACHINE_START( thayers ) { laserdisc_type = LASERDISC_TYPE_LDV1000; - discinfo = laserdisc_init(laserdisc_type, get_disk_handle(0), 0); + discinfo = laserdisc_init(machine, laserdisc_type, get_disk_handle(0), 0); memset(&ssi263, 0, sizeof(ssi263)); } diff --git a/src/mame/drivers/tourtabl.c b/src/mame/drivers/tourtabl.c index 6a067decb17..1eeb9027473 100644 --- a/src/mame/drivers/tourtabl.c +++ b/src/mame/drivers/tourtabl.c @@ -119,10 +119,10 @@ static const struct tia_interface tourtabl_tia_interface = static MACHINE_START( tourtabl ) { - r6532_config(0, &r6532_interface_0); - r6532_config(1, &r6532_interface_1); - r6532_reset(0); - r6532_reset(1); + r6532_config(machine, 0, &r6532_interface_0); + r6532_config(machine, 1, &r6532_interface_1); + r6532_reset(machine, 0); + r6532_reset(machine, 1); tia_init( machine, &tourtabl_tia_interface ); } diff --git a/src/mame/drivers/upscope.c b/src/mame/drivers/upscope.c index ec217611f68..5bcd62375ef 100644 --- a/src/mame/drivers/upscope.c +++ b/src/mame/drivers/upscope.c @@ -375,7 +375,7 @@ static DRIVER_INIT( upscope ) NULL, 0 }; - amiga_machine_config(&upscope_intf); + amiga_machine_config(machine, &upscope_intf); /* allocate NVRAM */ generic_nvram_size = 0x100; diff --git a/src/mame/drivers/viper.c b/src/mame/drivers/viper.c index 8678304f1c1..c21a81ec2d8 100644 --- a/src/mame/drivers/viper.c +++ b/src/mame/drivers/viper.c @@ -673,7 +673,7 @@ static DRIVER_INIT(viper) pci_add_device(0, 0, &mpc8240); pci_add_device(0, 12, &voodoo3); - timekeeper_init(0, TIMEKEEPER_M48T58, backup_ram); + timekeeper_init(machine, 0, TIMEKEEPER_M48T58, backup_ram); nvram = memory_region(machine, REGION_USER2); memcpy(backup_ram, nvram, 0x2000); diff --git a/src/mame/includes/amiga.h b/src/mame/includes/amiga.h index 1a6a4e3811f..02817402eb9 100644 --- a/src/mame/includes/amiga.h +++ b/src/mame/includes/amiga.h @@ -374,7 +374,7 @@ extern const char *const amiga_custom_names[0x100]; extern UINT16 (*amiga_chip_ram_r)(offs_t offset); extern void (*amiga_chip_ram_w)(offs_t offset, UINT16 data); -void amiga_machine_config(const amiga_machine_interface *intf); +void amiga_machine_config(running_machine *machine, const amiga_machine_interface *intf); MACHINE_RESET( amiga ); diff --git a/src/mame/machine/amiga.c b/src/mame/machine/amiga.c index 50f7b1f0746..fa9d060384f 100644 --- a/src/mame/machine/amiga.c +++ b/src/mame/machine/amiga.c @@ -258,7 +258,7 @@ static void amiga_chip_ram32_w(offs_t offset, UINT16 data) * *************************************/ -void amiga_machine_config(const amiga_machine_interface *intf) +void amiga_machine_config(running_machine *machine, const amiga_machine_interface *intf) { cia6526_interface cia_intf[2]; @@ -286,7 +286,7 @@ void amiga_machine_config(const amiga_machine_interface *intf) cia_intf[0].port[0].write = intf->cia_0_portA_w; cia_intf[0].port[1].read = intf->cia_0_portB_r; cia_intf[0].port[1].write = intf->cia_0_portB_w; - cia_config(0, &cia_intf[0]); + cia_config(machine, 0, &cia_intf[0]); cia_intf[1].type = CIA8520; cia_intf[1].clock = O2_CLOCK; @@ -296,7 +296,7 @@ void amiga_machine_config(const amiga_machine_interface *intf) cia_intf[1].port[0].write = intf->cia_1_portA_w; cia_intf[1].port[1].read = intf->cia_1_portB_r; cia_intf[1].port[1].write = intf->cia_1_portB_w; - cia_config(1, &cia_intf[1]); + cia_config(machine, 1, &cia_intf[1]); /* setup the timers */ amiga_irq_timer = timer_alloc(amiga_irq_proc, NULL); @@ -375,7 +375,7 @@ static TIMER_CALLBACK( scanline_callback ) amiga_custom_w(machine, REG_INTREQ, 0x8000 | INTENA_VERTB, 0xffff); /* clock the first CIA TOD */ - cia_clock_tod(0); + cia_clock_tod(machine, 0); /* call the system-specific callback */ if (amiga_intf->scanline0_callback != NULL) @@ -383,7 +383,7 @@ static TIMER_CALLBACK( scanline_callback ) } /* on every scanline, clock the second CIA TOD */ - cia_clock_tod(1); + cia_clock_tod(machine, 1); /* render up to this scanline */ if (!video_screen_update_partial(machine->primary_screen, scanline)) @@ -1080,7 +1080,7 @@ READ16_HANDLER( amiga_cia_r ) } /* handle the reads */ - data = cia_read(which, offset >> 7); + data = cia_read(machine, which, offset >> 7); if (LOG_CIA) logerror("%06x:cia_%c_read(%03x) = %04x & %04x\n", safe_activecpu_get_pc(), 'A' + ((~offset & 0x0800) >> 11), offset * 2, data << shift, mem_mask); @@ -1122,7 +1122,7 @@ WRITE16_HANDLER( amiga_cia_w ) } /* handle the writes */ - cia_write(which, offset >> 7, (UINT8) data); + cia_write(machine, which, offset >> 7, (UINT8) data); } |