diff options
author | 2008-12-12 06:11:15 +0000 | |
---|---|---|
committer | 2008-12-12 06:11:15 +0000 | |
commit | b400e7978bb626a14196fae7b45bb89dfeeae249 (patch) | |
tree | 454f1b103d0f8e80e719dbf37251b2304c07a91e /src | |
parent | 9dc496610928a3adee6c2d46f954634fcb83063a (diff) |
From: Atari Ace [mailto:atari_ace@verizon.net]
Sent: Thursday, December 11, 2008 6:52 PM
To: submit@mamedev.org
Cc: atariace@hotmail.com
Subject: [patch] deprecat.h cpu cleanup
Hi mamedev,
This patch purges the last few uses of deprecat.h from the cpu cores,
plus a handful of other Machine cases elsewhere that were found by
script inspection.
~aa
--
Hi mamedev,
This patch eliminates most uses of deprecat.h in the sound cores by
attaching the device to the state object and using it where
appropriate. Given that all the cpu objects use this convention, and
three sound cores already do this, this seemed an appropriate
approach.
~aa
Diffstat (limited to 'src')
42 files changed, 232 insertions, 215 deletions
diff --git a/src/emu/cpu/alph8201/alph8201.c b/src/emu/cpu/alph8201/alph8201.c index 75b7323fdf9..44816844294 100644 --- a/src/emu/cpu/alph8201/alph8201.c +++ b/src/emu/cpu/alph8201/alph8201.c @@ -148,7 +148,6 @@ Timming ****************************************************************************/ #include "debugger.h" -#include "deprecat.h" #include "alph8201.h" /* instruction cycle count */ @@ -289,7 +288,7 @@ INLINE void M_UNDEFINED(alpha8201_state *cpustate) mame_printf_debug("alpha8201: cpustate->PC = %03x, Unimplemented opcode = %02x\n", cpustate->PC-1, M_RDMEM(cpustate->PC-1)); #endif #if BREAK_ON_UNKNOWN_OPCODE - debugger_break(Machine); + debugger_break(cpustate->device->machine); #endif } @@ -302,7 +301,7 @@ INLINE void M_UNDEFINED2(alpha8201_state *cpustate) mame_printf_debug("alpha8201: cpustate->PC = %03x, Unimplemented opcode = %02x,%02x\n", cpustate->PC-2, op,imm); #endif #if BREAK_ON_UNKNOWN_OPCODE - debugger_break(Machine); + debugger_break(cpustate->device->machine); #endif } diff --git a/src/emu/cpu/drcbex64.c b/src/emu/cpu/drcbex64.c index c4a424c28fd..4ebbbe907c1 100644 --- a/src/emu/cpu/drcbex64.c +++ b/src/emu/cpu/drcbex64.c @@ -173,7 +173,6 @@ #include "drcuml.h" #include "drcbeut.h" #include "debugger.h" -#include "deprecat.h" #include "x86emit.h" #include "eminline.h" #undef REG_SP @@ -3093,7 +3092,7 @@ static x86code *op_debug(drcbe_state *drcbe, x86code *dst, const drcuml_instruct assert_no_condition(inst); assert_no_flags(inst); - if ((Machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) + if ((drcbe->device->machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) { drcuml_parameter pcp; diff --git a/src/emu/cpu/drcbex86.c b/src/emu/cpu/drcbex86.c index 2dfa9f7ce4b..3f4dd2e5790 100644 --- a/src/emu/cpu/drcbex86.c +++ b/src/emu/cpu/drcbex86.c @@ -89,7 +89,6 @@ #include "drcuml.h" #include "drcbeut.h" #include "debugger.h" -#include "deprecat.h" #include "x86emit.h" #include "eminline.h" #undef REG_SP @@ -3221,7 +3220,7 @@ static x86code *op_debug(drcbe_state *drcbe, x86code *dst, const drcuml_instruct assert_no_condition(inst); assert_no_flags(inst); - if ((Machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) + if ((drcbe->device->machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) { drcuml_parameter pcp; @@ -3229,7 +3228,7 @@ static x86code *op_debug(drcbe_state *drcbe, x86code *dst, const drcuml_instruct param_normalize_1(drcbe, inst, &pcp, PTYPE_MRI); /* test and branch */ - emit_test_m32_imm(&dst, MABS(&Machine->debug_flags), DEBUG_FLAG_CALL_HOOK); // test [Machine->debug_flags],DEBUG_FLAG_CALL_HOOK + emit_test_m32_imm(&dst, MABS(&drcbe->device->machine->debug_flags), DEBUG_FLAG_CALL_HOOK); // test [debug_flags],DEBUG_FLAG_CALL_HOOK emit_jcc_short_link(&dst, COND_Z, &skip); // jz skip /* push the parameter */ diff --git a/src/emu/cpu/drcuml.c b/src/emu/cpu/drcuml.c index 272d58de4b5..e114103c097 100644 --- a/src/emu/cpu/drcuml.c +++ b/src/emu/cpu/drcuml.c @@ -38,7 +38,6 @@ #include "drcuml.h" #include "drcumlsh.h" -#include "deprecat.h" #include "eminline.h" #include "mame.h" #include <stdarg.h> @@ -323,7 +322,7 @@ static void validate_backend(drcuml_state *drcuml); static void bevalidate_iterate_over_params(drcuml_state *drcuml, drcuml_codehandle **handles, const bevalidate_test *test, drcuml_parameter *paramlist, int pnum); static void bevalidate_iterate_over_flags(drcuml_state *drcuml, drcuml_codehandle **handles, const bevalidate_test *test, drcuml_parameter *paramlist); static void bevalidate_execute(drcuml_state *drcuml, drcuml_codehandle **handles, const bevalidate_test *test, const drcuml_parameter *paramlist, UINT8 flagmask); -static void bevalidate_initialize_random_state(drcuml_block *block, drcuml_machine_state *state); +static void bevalidate_initialize_random_state(drcuml_state *drcuml, drcuml_block *block, drcuml_machine_state *state); static int bevalidate_populate_state(drcuml_block *block, drcuml_machine_state *state, const bevalidate_test *test, const drcuml_parameter *paramlist, drcuml_parameter *params, UINT64 *parammem); static int bevalidate_verify_state(drcuml_state *drcuml, const drcuml_machine_state *istate, drcuml_machine_state *state, const bevalidate_test *test, UINT32 flags, const drcuml_parameter *params, const drcuml_instruction *testinst, drccodeptr codestart, drccodeptr codeend, UINT8 flagmask); @@ -2188,7 +2187,7 @@ static void bevalidate_execute(drcuml_state *drcuml, drcuml_codehandle **handles UML_HANDLE(block, handles[0]); /* set up a random initial state */ - bevalidate_initialize_random_state(block, &istate); + bevalidate_initialize_random_state(drcuml, block, &istate); /* then populate the state with the parameters */ numparams = bevalidate_populate_state(block, &istate, test, paramlist, params, parammem); @@ -2243,32 +2242,33 @@ static void bevalidate_execute(drcuml_state *drcuml, drcuml_codehandle **handles initialize the machine state to randomness -------------------------------------------------*/ -static void bevalidate_initialize_random_state(drcuml_block *block, drcuml_machine_state *state) +static void bevalidate_initialize_random_state(drcuml_state *drcuml, drcuml_block *block, drcuml_machine_state *state) { + running_machine *machine = drcuml->device->machine; int regnum; /* initialize core state to random values */ - state->fmod = mame_rand(Machine) & 0x03; - state->flags = mame_rand(Machine) & 0x1f; - state->exp = mame_rand(Machine); + state->fmod = mame_rand(machine) & 0x03; + state->flags = mame_rand(machine) & 0x1f; + state->exp = mame_rand(machine); /* initialize integer registers to random values */ for (regnum = 0; regnum < ARRAY_LENGTH(state->r); regnum++) { - state->r[regnum].w.h = mame_rand(Machine); - state->r[regnum].w.l = mame_rand(Machine); + state->r[regnum].w.h = mame_rand(machine); + state->r[regnum].w.l = mame_rand(machine); } /* initialize float registers to random values */ for (regnum = 0; regnum < ARRAY_LENGTH(state->f); regnum++) { - *(UINT32 *)&state->f[regnum].s.h = mame_rand(Machine); - *(UINT32 *)&state->f[regnum].s.l = mame_rand(Machine); + *(UINT32 *)&state->f[regnum].s.h = mame_rand(machine); + *(UINT32 *)&state->f[regnum].s.l = mame_rand(machine); } /* initialize map variables to random values */ for (regnum = 0; regnum < DRCUML_MAPVAR_END - DRCUML_MAPVAR_M0; regnum++) - UML_MAPVAR(block, MVAR(regnum), mame_rand(Machine)); + UML_MAPVAR(block, MVAR(regnum), mame_rand(machine)); } diff --git a/src/emu/cpu/mips/mips3drc.c b/src/emu/cpu/mips/mips3drc.c index b14f0b4b0a8..dda84cb6c39 100644 --- a/src/emu/cpu/mips/mips3drc.c +++ b/src/emu/cpu/mips/mips3drc.c @@ -31,7 +31,6 @@ #include "cpuexec.h" #include "mips3com.h" #include "mips3fe.h" -#include "deprecat.h" #include "cpu/drcfe.h" #include "cpu/drcuml.h" #include "cpu/drcumlsh.h" @@ -1220,7 +1219,7 @@ static void static_generate_memory_accessor(mips3_state *mips3, int mode, int si UML_JMPc(block, IF_Z, tlbmiss = label++); // jmp tlbmiss,z UML_ROLINS(block, IREG(0), IREG(3), IMM(0), IMM(0xfffff000)); // rolins i0,i3,0,0xfffff000 - if ((Machine->debug_flags & DEBUG_FLAG_ENABLED) == 0) + if ((mips3->device->machine->debug_flags & DEBUG_FLAG_ENABLED) == 0) for (ramnum = 0; ramnum < MIPS3_MAX_FASTRAM; ramnum++) if (mips3->impstate->fastram[ramnum].base != NULL && (!iswrite || !mips3->impstate->fastram[ramnum].readonly)) { @@ -1551,7 +1550,7 @@ static void generate_sequence_instruction(mips3_state *mips3, drcuml_block *bloc } /* if we are debugging, call the debugger */ - if ((Machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) + if ((mips3->device->machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) { UML_MOV(block, MEM(&mips3->pc), IMM(desc->pc)); // mov [pc],desc->pc save_fast_iregs(mips3, block); diff --git a/src/emu/cpu/pdp1/pdp1.c b/src/emu/cpu/pdp1/pdp1.c index 18d8f9f5ab9..8db3ae211ed 100644 --- a/src/emu/cpu/pdp1/pdp1.c +++ b/src/emu/cpu/pdp1/pdp1.c @@ -336,7 +336,6 @@ #include "debugger.h" -#include "deprecat.h" #include "pdp1.h" #define LOG 0 @@ -1703,7 +1702,7 @@ static void null_iot(const device_config *device, int op2, int nac, int mb, int if (LOG_IOT_EXTRA) { if (op2 == 000) - logerror("IOT sync instruction: mb=0%06o, pc=0%06o\n", (unsigned) mb, (unsigned) cpu_get_reg(Machine->cpu[0], PDP1_PC)); + logerror("IOT sync instruction: mb=0%06o, pc=0%06o\n", (unsigned) mb, (unsigned) cpu_get_reg(device->machine->cpu[0], PDP1_PC)); } if (LOG) { diff --git a/src/emu/cpu/powerpc/ppccom.c b/src/emu/cpu/powerpc/ppccom.c index d70f55fbb4b..db624ca042c 100644 --- a/src/emu/cpu/powerpc/ppccom.c +++ b/src/emu/cpu/powerpc/ppccom.c @@ -9,7 +9,6 @@ #include "ppccom.h" #include "cpuexec.h" #include "mame.h" -#include "deprecat.h" /*************************************************************************** @@ -280,7 +279,7 @@ void ppccom_reset(powerpc_state *ppc) /* reset the decrementer */ ppc->dec_zero_cycles = cpu_get_total_cycles(ppc->device); - decrementer_int_callback(Machine, ppc, 0); + decrementer_int_callback(ppc->device->machine, ppc, 0); } /* initialize the 4XX state */ @@ -546,7 +545,7 @@ void ppccom_execute_tlbl(powerpc_state *ppc) int entrynum; /* determine entry number; we use rand() for associativity */ - entrynum = ((address >> 12) & 0x1f) | (mame_rand(Machine) & 0x20) | (isitlb ? 0x40 : 0); + entrynum = ((address >> 12) & 0x1f) | (mame_rand(ppc->device->machine) & 0x20) | (isitlb ? 0x40 : 0); /* determine the flags */ flags = VTLB_FLAG_VALID | VTLB_READ_ALLOWED | VTLB_FETCH_ALLOWED; @@ -816,9 +815,9 @@ void ppccom_execute_mtspr(powerpc_state *ppc) case SPR4XX_TCR: ppc->spr[SPR4XX_TCR] = ppc->param1 | (oldval & PPC4XX_TCR_WRC_MASK); if ((oldval ^ ppc->spr[SPR4XX_TCR]) & PPC4XX_TCR_FIE) - ppc4xx_fit_callback(Machine, ppc, FALSE); + ppc4xx_fit_callback(ppc->device->machine, ppc, FALSE); if ((oldval ^ ppc->spr[SPR4XX_TCR]) & PPC4XX_TCR_PIE) - ppc4xx_pit_callback(Machine, ppc, FALSE); + ppc4xx_pit_callback(ppc->device->machine, ppc, FALSE); return; /* timer status register */ @@ -831,7 +830,7 @@ void ppccom_execute_mtspr(powerpc_state *ppc) case SPR4XX_PIT: ppc->spr[SPR4XX_PIT] = ppc->param1; ppc->pit_reload = ppc->param1; - ppc4xx_pit_callback(Machine, ppc, FALSE); + ppc4xx_pit_callback(ppc->device->machine, ppc, FALSE); return; /* timebase */ diff --git a/src/emu/cpu/powerpc/ppcdrc.c b/src/emu/cpu/powerpc/ppcdrc.c index f963e8eda83..a7fe35c72c9 100644 --- a/src/emu/cpu/powerpc/ppcdrc.c +++ b/src/emu/cpu/powerpc/ppcdrc.c @@ -21,7 +21,6 @@ #include "debugger.h" #include "ppccom.h" #include "ppcfe.h" -#include "deprecat.h" #include "cpu/drcfe.h" #include "cpu/drcuml.h" #include "cpu/drcumlsh.h" @@ -1499,7 +1498,7 @@ static void static_generate_memory_accessor(powerpc_state *ppc, int mode, int si UML_AND(block, IREG(0), IREG(0), IMM(0x7fffffff)); // and i0,i0,0x7fffffff UML_XOR(block, IREG(0), IREG(0), IMM((mode & MODE_LITTLE_ENDIAN) ? (8 - size) : 0)); // xor i0,i0,8-size - if ((Machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) + if ((ppc->device->machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) for (ramnum = 0; ramnum < PPC_MAX_FASTRAM; ramnum++) if (ppc->impstate->fastram[ramnum].base != NULL && (!iswrite || !ppc->impstate->fastram[ramnum].readonly)) { @@ -2132,7 +2131,7 @@ static void generate_sequence_instruction(powerpc_state *ppc, drcuml_block *bloc } /* if we are debugging, call the debugger */ - if ((Machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) + if ((ppc->device->machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) { UML_MOV(block, MEM(&ppc->pc), IMM(desc->pc)); // mov [pc],desc->pc save_fast_iregs(ppc, block); // <save fastregs> diff --git a/src/emu/cpu/rsp/rsp.c b/src/emu/cpu/rsp/rsp.c index 88405e1147d..086abdced0e 100644 --- a/src/emu/cpu/rsp/rsp.c +++ b/src/emu/cpu/rsp/rsp.c @@ -6,7 +6,6 @@ #include "cpuintrf.h" #include "debugger.h" -#include "deprecat.h" #include "rsp.h" #define LOG_INSTRUCTION_EXECUTION 0 diff --git a/src/emu/cpu/saturn/saturn.c b/src/emu/cpu/saturn/saturn.c index d385d47e210..cbad90404e7 100644 --- a/src/emu/cpu/saturn/saturn.c +++ b/src/emu/cpu/saturn/saturn.c @@ -23,7 +23,6 @@ *****************************************************************************/ #include "debugger.h" -#include "deprecat.h" #include "saturn.h" diff --git a/src/emu/cpu/sh2/sh2drc.c b/src/emu/cpu/sh2/sh2drc.c index c80519fc122..769fd2e531a 100644 --- a/src/emu/cpu/sh2/sh2drc.c +++ b/src/emu/cpu/sh2/sh2drc.c @@ -16,7 +16,6 @@ ***************************************************************************/ #include "debugger.h" -#include "deprecat.h" #include "sh2.h" #include "sh2comn.h" #include "eminline.h" @@ -1572,7 +1571,7 @@ static void generate_sequence_instruction(SH2 *sh2, drcuml_block *block, compile } /* if we are debugging, call the debugger */ - if ((Machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) + if ((sh2->device->machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) { UML_MOV(block, MEM(&sh2->pc), IMM(desc->pc)); // mov [pc],desc->pc save_fast_iregs(sh2, block); diff --git a/src/emu/cpu/sh4/sh4.c b/src/emu/cpu/sh4/sh4.c index f669cb08a9c..f41fa311868 100644 --- a/src/emu/cpu/sh4/sh4.c +++ b/src/emu/cpu/sh4/sh4.c @@ -26,7 +26,6 @@ #include "sh4.h" #include "sh4regs.h" #include "sh4comn.h" -#include "deprecat.h" /* Called for unimplemented opcodes */ static void TODO(SH4 *sh4) @@ -834,7 +833,7 @@ INLINE void LDCSR(SH4 *sh4, UINT32 m) UINT32 reg; reg = sh4->r[m]; - if ((Machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) + if ((sh4->device->machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) sh4_syncronize_register_bank(sh4, (sh4->sr & sRB) >> 29); if ((sh4->r[m] & sRB) != (sh4->sr & sRB)) sh4_change_register_bank(sh4, sh4->r[m] & sRB ? 1 : 0); @@ -862,7 +861,7 @@ UINT32 old; old = sh4->sr; sh4->ea = sh4->r[m]; sh4->sr = RL(sh4, sh4->ea ) & FLAGS; - if ((Machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) + if ((sh4->device->machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) sh4_syncronize_register_bank(sh4, (old & sRB) >> 29); if ((old & sRB) != (sh4->sr & sRB)) sh4_change_register_bank(sh4, sh4->sr & sRB ? 1 : 0); @@ -1448,7 +1447,7 @@ INLINE void RTE(SH4 *sh4) { sh4->delay = sh4->pc; sh4->pc = sh4->ea = sh4->spc; - if ((Machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) + if ((sh4->device->machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) sh4_syncronize_register_bank(sh4, (sh4->sr & sRB) >> 29); if ((sh4->ssr & sRB) != (sh4->sr & sRB)) sh4_change_register_bank(sh4, sh4->ssr & sRB ? 1 : 0); @@ -1731,7 +1730,7 @@ INLINE void TRAPA(SH4 *sh4, UINT32 i) sh4->sgr = sh4->r[15]; sh4->sr |= MD; - if ((Machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) + if ((sh4->device->machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) sh4_syncronize_register_bank(sh4, (sh4->sr & sRB) >> 29); if (!(sh4->sr & sRB)) sh4_change_register_bank(sh4, 1); @@ -3206,7 +3205,7 @@ INLINE void op1111(SH4 *sh4, UINT16 opcode) FRCHG(sh4); break; default: - debugger_break(Machine); + debugger_break(sh4->device->machine); break; } } else { @@ -3217,7 +3216,7 @@ INLINE void op1111(SH4 *sh4, UINT16 opcode) } break; default: - debugger_break(Machine); + debugger_break(sh4->device->machine); break; } break; @@ -3225,7 +3224,7 @@ INLINE void op1111(SH4 *sh4, UINT16 opcode) FMAC(sh4, Rm,Rn); break; default: - debugger_break(Machine); + debugger_break(sh4->device->machine); break; } } diff --git a/src/emu/cpu/sh4/sh4comn.c b/src/emu/cpu/sh4/sh4comn.c index 3cb5f110cac..91ce7acf4a0 100644 --- a/src/emu/cpu/sh4/sh4comn.c +++ b/src/emu/cpu/sh4/sh4comn.c @@ -7,7 +7,6 @@ *****************************************************************************/ #include "debugger.h" -#include "deprecat.h" #include "cpuexec.h" #include "sh4.h" #include "sh4regs.h" @@ -194,7 +193,7 @@ void sh4_exception(SH4 *sh4, const char *message, int exception) // handle excep sh4->sgr = sh4->r[15]; sh4->sr |= MD; - if ((Machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) + if ((sh4->device->machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) sh4_syncronize_register_bank(sh4, (sh4->sr & sRB) >> 29); if (!(sh4->sr & sRB)) sh4_change_register_bank(sh4, 1); diff --git a/src/emu/debug/debugcmt.c b/src/emu/debug/debugcmt.c index e60d3580e5e..8b7912dc5d8 100644 --- a/src/emu/debug/debugcmt.c +++ b/src/emu/debug/debugcmt.c @@ -21,7 +21,6 @@ ***************************************************************************/ #include "driver.h" -#include "deprecat.h" #include "xmlfile.h" #include "debugcmt.h" #include "debugcpu.h" @@ -86,7 +85,7 @@ static comment_group *debug_comments; static int debug_comment_load_xml(running_machine *machine, mame_file *file); static void debug_comment_exit(running_machine *machine); -static void debug_comment_free(void); +static void debug_comment_free(running_machine *machine); @@ -556,7 +555,7 @@ error: static void debug_comment_exit(running_machine *machine) { debug_comment_save(machine); - debug_comment_free(); + debug_comment_free(machine); } @@ -564,12 +563,12 @@ static void debug_comment_exit(running_machine *machine) debug_comment_free - cleans up memory -------------------------------------------------------------------------*/ -static void debug_comment_free(void) +static void debug_comment_free(running_machine *machine) { int i, j; - for (i = 0; i < ARRAY_LENGTH(Machine->cpu); i++) - if (Machine->cpu[i] != NULL) + for (i = 0; i < ARRAY_LENGTH(machine->cpu); i++) + if (machine->cpu[i] != NULL) { for (j = 0; j < debug_comments[i].comment_count; j++) { diff --git a/src/emu/sound/2203intf.c b/src/emu/sound/2203intf.c index 1f887b5a913..8b37cd5d173 100644 --- a/src/emu/sound/2203intf.c +++ b/src/emu/sound/2203intf.c @@ -1,6 +1,5 @@ #include <math.h> #include "sndintrf.h" -#include "deprecat.h" #include "streams.h" #include "2203intf.h" #include "fm.h" @@ -13,6 +12,7 @@ struct ym2203_info void * chip; void * psg; const ym2203_interface *intf; + const device_config *device; }; @@ -52,7 +52,7 @@ static const ssg_callbacks psgintf = static void IRQHandler(void *param,int irq) { struct ym2203_info *info = param; - if(info->intf->handler) info->intf->handler(Machine, irq); + if(info->intf->handler) info->intf->handler(info->device->machine, irq); } /* Timer overflow callback from timer.c */ @@ -124,6 +124,7 @@ static SND_START( ym2203 ) memset(info, 0, sizeof(*info)); info->intf = intf; + info->device = device; info->psg = ay8910_start_ym(SOUND_YM2203, device, clock, &intf->ay8910_intf); if (!info->psg) return NULL; diff --git a/src/emu/sound/2608intf.c b/src/emu/sound/2608intf.c index 743a55a2237..17df778c71e 100644 --- a/src/emu/sound/2608intf.c +++ b/src/emu/sound/2608intf.c @@ -12,7 +12,6 @@ ***************************************************************************/ #include "sndintrf.h" -#include "deprecat.h" #include "streams.h" #include "ay8910.h" #include "2608intf.h" @@ -25,6 +24,7 @@ struct ym2608_info void * chip; void * psg; const ym2608_interface *intf; + const device_config *device; }; @@ -66,7 +66,7 @@ static const ssg_callbacks psgintf = static void IRQHandler(void *param,int irq) { struct ym2608_info *info = param; - if(info->intf->handler) info->intf->handler(Machine, irq); + if(info->intf->handler) info->intf->handler(info->device->machine, irq); } /* Timer overflow callback from timer.c */ @@ -140,6 +140,8 @@ static SND_START( ym2608 ) memset(info, 0, sizeof(*info)); info->intf = intf; + info->device = device; + /* FIXME: Force to use simgle output */ info->psg = ay8910_start_ym(SOUND_YM2608, device, clock, &intf->ay8910_intf); if (!info->psg) return NULL; diff --git a/src/emu/sound/2610intf.c b/src/emu/sound/2610intf.c index bae38911a10..e512c3eef04 100644 --- a/src/emu/sound/2610intf.c +++ b/src/emu/sound/2610intf.c @@ -12,7 +12,6 @@ ***************************************************************************/ #include "sndintrf.h" -#include "deprecat.h" #include "streams.h" #include "ay8910.h" #include "2610intf.h" @@ -26,6 +25,7 @@ struct ym2610_info void * chip; void * psg; const ym2610_interface *intf; + const device_config *device; }; @@ -66,7 +66,7 @@ static const ssg_callbacks psgintf = static void IRQHandler(void *param,int irq) { struct ym2610_info *info = param; - if(info->intf->handler) info->intf->handler(Machine, irq); + if(info->intf->handler) info->intf->handler(info->device->machine, irq); } /* Timer overflow callback from timer.c */ @@ -142,6 +142,7 @@ static SND_START( ym2610 ) memset(info, 0, sizeof(*info)); info->intf = intf; + info->device = device; info->psg = ay8910_start_ym(SOUND_YM2610, device, clock, &generic_ay8910); if (!info->psg) return NULL; @@ -208,6 +209,7 @@ static SND_START( ym2610b ) memset(info, 0, sizeof(*info)); info->intf = intf; + info->device = device; info->psg = ay8910_start_ym(SOUND_YM2610B, device, clock, &generic_ay8910); if (!info->psg) return NULL; diff --git a/src/emu/sound/2612intf.c b/src/emu/sound/2612intf.c index f11a395aa90..68d3e7ccdb7 100644 --- a/src/emu/sound/2612intf.c +++ b/src/emu/sound/2612intf.c @@ -12,7 +12,6 @@ ***************************************************************************/ #include "sndintrf.h" -#include "deprecat.h" #include "streams.h" #include "sound/fm.h" #include "sound/2612intf.h" @@ -24,6 +23,7 @@ struct ym2612_info emu_timer * timer[2]; void * chip; const ym2612_interface *intf; + const device_config *device; }; /*------------------------- TM2612 -------------------------------*/ @@ -31,7 +31,7 @@ struct ym2612_info static void IRQHandler(void *param,int irq) { struct ym2612_info *info = param; - if(info->intf->handler) info->intf->handler(Machine, irq); + if(info->intf->handler) info->intf->handler(info->device->machine, irq); } /* Timer overflow callback from timer.c */ @@ -97,6 +97,7 @@ static SND_START( ym2612 ) memset(info, 0, sizeof(*info)); info->intf = config ? config : &dummy; + info->device = device; /* FM init */ /* Timer Handler set */ diff --git a/src/emu/sound/262intf.c b/src/emu/sound/262intf.c index 0bdbea0afeb..ecfe3945d35 100644 --- a/src/emu/sound/262intf.c +++ b/src/emu/sound/262intf.c @@ -6,7 +6,6 @@ ***************************************************************************/ #include "sndintrf.h" -#include "deprecat.h" #include "streams.h" #include "262intf.h" #include "ymf262.h" @@ -18,6 +17,7 @@ struct ymf262_info emu_timer * timer[2]; void * chip; const ymf262_interface *intf; + const device_config *device; }; @@ -26,7 +26,7 @@ struct ymf262_info static void IRQHandler_262(void *param,int irq) { struct ymf262_info *info = param; - if (info->intf->handler) (info->intf->handler)(Machine, irq); + if (info->intf->handler) (info->intf->handler)(info->device->machine, irq); } static TIMER_CALLBACK( timer_callback_262_0 ) @@ -77,6 +77,7 @@ static SND_START( ymf262 ) memset(info, 0, sizeof(*info)); info->intf = config ? config : &dummy; + info->device = device; /* stream system initialize */ info->chip = ymf262_init(clock,rate); diff --git a/src/emu/sound/3812intf.c b/src/emu/sound/3812intf.c index be1888837c4..e91b9d467f4 100644 --- a/src/emu/sound/3812intf.c +++ b/src/emu/sound/3812intf.c @@ -17,7 +17,6 @@ * ******************************************************************************/ #include "sndintrf.h" -#include "deprecat.h" #include "streams.h" #include "cpuintrf.h" #include "3812intf.h" @@ -33,12 +32,13 @@ struct ym3812_info emu_timer * timer[2]; void * chip; const ym3812_interface *intf; + const device_config *device; }; static void IRQHandler_3812(void *param,int irq) { struct ym3812_info *info = param; - if (info->intf->handler) (info->intf->handler)(Machine, irq ? ASSERT_LINE : CLEAR_LINE); + if (info->intf->handler) (info->intf->handler)(info->device->machine, irq ? ASSERT_LINE : CLEAR_LINE); } static TIMER_CALLBACK( timer_callback_3812_0 ) { @@ -89,6 +89,7 @@ static SND_START( ym3812 ) memset(info, 0, sizeof(*info)); info->intf = config ? config : &dummy; + info->device = device; /* stream system initialize */ info->chip = ym3812_init(device,clock,rate); @@ -200,6 +201,7 @@ struct ym3526_info emu_timer * timer[2]; void * chip; const ym3526_interface *intf; + const device_config *device; }; @@ -207,7 +209,7 @@ struct ym3526_info static void IRQHandler_3526(void *param,int irq) { struct ym3526_info *info = param; - if (info->intf->handler) (info->intf->handler)(Machine, irq ? ASSERT_LINE : CLEAR_LINE); + if (info->intf->handler) (info->intf->handler)(info->device->machine, irq ? ASSERT_LINE : CLEAR_LINE); } /* Timer overflow callback from timer.c */ static TIMER_CALLBACK( timer_callback_3526_0 ) @@ -258,6 +260,7 @@ static SND_START( ym3526 ) memset(info, 0, sizeof(*info)); info->intf = config ? config : &dummy; + info->device = device; /* stream system initialize */ info->chip = ym3526_init(device,clock,rate); @@ -368,13 +371,14 @@ struct y8950_info emu_timer * timer[2]; void * chip; const y8950_interface *intf; + const device_config *device; int index; }; static void IRQHandler_8950(void *param,int irq) { struct y8950_info *info = param; - if (info->intf->handler) (info->intf->handler)(Machine, irq ? ASSERT_LINE : CLEAR_LINE); + if (info->intf->handler) (info->intf->handler)(info->device->machine, irq ? ASSERT_LINE : CLEAR_LINE); } static TIMER_CALLBACK( timer_callback_8950_0 ) { @@ -402,9 +406,9 @@ static void TimerHandler_8950(void *param,int c,attotime period) static unsigned char Y8950PortHandler_r(void *param) { - /* temporary hack until this is converted to a device */ - const address_space *space = cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM); struct y8950_info *info = param; + /* temporary hack until this is converted to a device */ + const address_space *space = cpu_get_address_space(info->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); if (info->intf->portread) return info->intf->portread(space,info->index); return 0; @@ -412,18 +416,18 @@ static unsigned char Y8950PortHandler_r(void *param) static void Y8950PortHandler_w(void *param,unsigned char data) { - /* temporary hack until this is converted to a device */ - const address_space *space = cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM); struct y8950_info *info = param; + /* temporary hack until this is converted to a device */ + const address_space *space = cpu_get_address_space(info->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); if (info->intf->portwrite) info->intf->portwrite(space,info->index,data); } static unsigned char Y8950KeyboardHandler_r(void *param) { - /* temporary hack until this is converted to a device */ - const address_space *space = cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM); struct y8950_info *info = param; + /* temporary hack until this is converted to a device */ + const address_space *space = cpu_get_address_space(info->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); if (info->intf->keyboardread) return info->intf->keyboardread(space,info->index); return 0; @@ -431,9 +435,9 @@ static unsigned char Y8950KeyboardHandler_r(void *param) static void Y8950KeyboardHandler_w(void *param,unsigned char data) { - /* temporary hack until this is converted to a device */ - const address_space *space = cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM); struct y8950_info *info = param; + /* temporary hack until this is converted to a device */ + const address_space *space = cpu_get_address_space(info->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); if (info->intf->keyboardwrite) info->intf->keyboardwrite(space,info->index,data); } @@ -461,6 +465,7 @@ static SND_START( y8950 ) memset(info, 0, sizeof(*info)); info->intf = config ? config : &dummy; + info->device = device; info->index = sndindex; /* stream system initialize */ diff --git a/src/emu/sound/aica.c b/src/emu/sound/aica.c index 324353b38a5..a451b5124e4 100644 --- a/src/emu/sound/aica.c +++ b/src/emu/sound/aica.c @@ -14,7 +14,6 @@ #include "sndintrf.h" #include "streams.h" #include "cpuintrf.h" -#include "deprecat.h" #include "aica.h" #include "aicadsp.h" @@ -203,6 +202,7 @@ struct _AICA int ARTABLE[64], DRTABLE[64]; struct _AICADSP DSP; + const device_config *device; }; static const float SDLT[16]={-1000000.0,-42.0,-39.0,-36.0,-33.0,-30.0,-27.0,-24.0,-21.0,-18.0,-15.0,-12.0,-9.0,-6.0,-3.0,0.0}; @@ -231,7 +231,7 @@ static void ResetInterrupts(struct _AICA *AICA) { #if 0 UINT32 reset = AICA->udata.data[0xa4/2]; - running_machine *machine = Machine; + running_machine *machine = AICA->device->machine; if (reset & 0x40) AICA->IntARMCB(machine, -AICA->IrqTimA); @@ -244,7 +244,7 @@ static void CheckPendingIRQ(struct _AICA *AICA) { UINT32 pend=AICA->udata.data[0xa0/2]; UINT32 en=AICA->udata.data[0x9c/2]; - running_machine *machine = Machine; + running_machine *machine = AICA->device->machine; if(AICA->MidiW!=AICA->MidiR) { @@ -517,6 +517,7 @@ static void AICA_Init(const device_config *device, struct _AICA *AICA, const aic { int i; + AICA->device = device; AICA->IrqTimA = AICA->IrqTimBC = AICA->IrqMidi = 0; AICA->MidiR=AICA->MidiW=0; AICA->MidiOutR=AICA->MidiOutW=0; @@ -719,7 +720,7 @@ static void AICA_UpdateSlotReg(struct _AICA *AICA,int s,int r) static void AICA_UpdateReg(struct _AICA *AICA, int reg) { /* temporary hack until this is converted to a device */ - const address_space *space = cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM); + const address_space *space = cpu_get_address_space(AICA->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); switch(reg&0xff) { case 0x4: @@ -860,7 +861,7 @@ static void AICA_UpdateRegR(struct _AICA *AICA, int reg) unsigned short v=AICA->udata.data[0x8/2]; v&=0xff00; v|=AICA->MidiStack[AICA->MidiR]; - AICA->IntARMCB(Machine, 0); // cancel the IRQ + AICA->IntARMCB(AICA->device->machine, 0); // cancel the IRQ if(AICA->MidiR!=AICA->MidiW) { ++AICA->MidiR; @@ -926,7 +927,7 @@ static void AICA_w16(struct _AICA *AICA,unsigned int addr,unsigned short val) if (val) { - AICA->IntARMCB(Machine, 0); + AICA->IntARMCB(AICA->device->machine, 0); } } } diff --git a/src/emu/sound/ay8910.c b/src/emu/sound/ay8910.c index e63b81ec0a5..26133022e0c 100644 --- a/src/emu/sound/ay8910.c +++ b/src/emu/sound/ay8910.c @@ -101,7 +101,6 @@ has twice the steps, happening twice as fast. ***************************************************************************/ #include "sndintrf.h" -#include "deprecat.h" #include "streams.h" #include "cpuintrf.h" #include "cpuexec.h" @@ -388,7 +387,7 @@ INLINE UINT16 mix_3D(ay8910_context *psg) static void ay8910_write_reg(ay8910_context *psg, int r, int v) { /* temporary hack until this is converted to a device */ - const address_space *space = cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM); + const address_space *space = cpu_get_address_space(psg->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); //if (r >= 11 && r <= 13 ) printf("%d %x %02x\n", PSG->index, r, v); psg->regs[r] = v; @@ -782,9 +781,9 @@ void ay8910_write_ym(void *chip, int addr, int data) int ay8910_read_ym(void *chip) { - /* temporary hack until this is converted to a device */ - const address_space *space = cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM); ay8910_context *psg = chip; + /* temporary hack until this is converted to a device */ + const address_space *space = cpu_get_address_space(psg->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); int r = psg->register_latch; if (r > 15) return 0; @@ -801,7 +800,7 @@ int ay8910_read_ym(void *chip) if (psg->intf->portAread) psg->regs[AY_PORTA] = (*psg->intf->portAread)(space, 0); else - logerror("%s: warning - read 8910 '%s' Port A\n",cpuexec_describe_context(Machine),psg->device->tag); + logerror("%s: warning - read 8910 '%s' Port A\n",cpuexec_describe_context(psg->device->machine),psg->device->tag); break; case AY_PORTB: if ((psg->regs[AY_ENABLE] & 0x80) != 0) @@ -809,7 +808,7 @@ int ay8910_read_ym(void *chip) if (psg->intf->portBread) psg->regs[AY_PORTB] = (*psg->intf->portBread)(space, 0); else - logerror("%s: warning - read 8910 '%s' Port B\n",cpuexec_describe_context(Machine),psg->device->tag); + logerror("%s: warning - read 8910 '%s' Port B\n",cpuexec_describe_context(psg->device->machine),psg->device->tag); break; } return psg->regs[r]; diff --git a/src/emu/sound/c6280.c b/src/emu/sound/c6280.c index f9cac74350a..3bd394b3964 100644 --- a/src/emu/sound/c6280.c +++ b/src/emu/sound/c6280.c @@ -55,7 +55,6 @@ #include "sndintrf.h" #include "streams.h" -#include "deprecat.h" #include "c6280.h" typedef struct { @@ -72,6 +71,7 @@ typedef struct { typedef struct { sound_stream *stream; + const device_config *device; UINT8 select; UINT8 balance; UINT8 lfo_frequency; @@ -85,13 +85,8 @@ typedef struct { /* only needed for io_buffer */ #include "cpu/h6280/h6280.h" -/* Local function prototypes */ -static void c6280_init(c6280_t *p, double clk, double rate); -static void c6280_write(c6280_t *p, int offset, int data); -static void c6280_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length); - -static void c6280_init(c6280_t *p, double clk, double rate) +static void c6280_init(const device_config *device, c6280_t *p, double clk, double rate) { int i; double step; @@ -102,6 +97,8 @@ static void c6280_init(c6280_t *p, double clk, double rate) /* Clear context */ memset(p, 0, sizeof(c6280_t)); + p->device = device; + /* Make waveform frequency table */ for(i = 0; i < 4096; i += 1) { @@ -268,7 +265,7 @@ static void c6280_update(void *param, stream_sample_t **inputs, stream_sample_t p->channel[ch].noise_counter += step; if(p->channel[ch].noise_counter >= 0x800) { - data = (mame_rand(Machine) & 1) ? 0x1F : 0; + data = (mame_rand(p->device->machine) & 1) ? 0x1F : 0; } p->channel[ch].noise_counter &= 0x7FF; buffer[0][i] += (INT16)(vll * (data - 16)); @@ -318,11 +315,11 @@ static SND_START( c6280 ) info = auto_malloc(sizeof(*info)); memset(info, 0, sizeof(*info)); - /* Initialize PSG emulator */ - c6280_init(info, clock, rate); + /* Initialize PSG emulator */ + c6280_init(device, info, clock, rate); - /* Create stereo stream */ - info->stream = stream_create(device, 0, 2, rate, info, c6280_update); + /* Create stereo stream */ + info->stream = stream_create(device, 0, 2, rate, info, c6280_update); return info; } diff --git a/src/emu/sound/cdp1869.c b/src/emu/sound/cdp1869.c index 87c783f2f6c..4c24c9db19d 100644 --- a/src/emu/sound/cdp1869.c +++ b/src/emu/sound/cdp1869.c @@ -12,11 +12,11 @@ #include "sndintrf.h" #include "streams.h" -#include "deprecat.h" #include "sound/cdp1869.h" struct CDP1869 { + const device_config *device; sound_stream *stream; /* returned by stream_create() */ int clock; /* chip's base frequency */ @@ -42,7 +42,7 @@ struct CDP1869 static void cdp1869_update(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length) { - struct CDP1869 *info = (struct CDP1869 *) param; + struct CDP1869 *info = param; INT16 signal = info->signal; stream_sample_t *buffer = _buffer[0]; @@ -53,7 +53,7 @@ static void cdp1869_update(void *param, stream_sample_t **inputs, stream_sample_ double frequency = (info->clock / 2) / (512 >> info->tonefreq) / (info->tonediv + 1); // double amplitude = info->toneamp * ((0.78*5) / 15); - int rate = Machine->sample_rate / 2; + int rate = info->device->machine->sample_rate / 2; /* get progress through wave */ int incr = info->incr; @@ -110,6 +110,7 @@ static SND_START( cdp1869 ) info = auto_malloc(sizeof(*info)); memset(info, 0, sizeof(*info)); + info->device = device; info->stream = stream_create(device, 0, 1, device->machine->sample_rate, info, cdp1869_update ); info->incr = 0; info->signal = 0x07fff; diff --git a/src/emu/sound/es5503.c b/src/emu/sound/es5503.c index 379442364e5..4b984b27c2c 100644 --- a/src/emu/sound/es5503.c +++ b/src/emu/sound/es5503.c @@ -36,7 +36,6 @@ #include <math.h> #include "sndintrf.h" #include "cpuintrf.h" -#include "deprecat.h" #include "es5503.h" #include "streams.h" #include "state.h" @@ -78,6 +77,7 @@ typedef struct UINT32 clock; UINT32 output_rate; + const device_config *device; } ES5503Chip; static const UINT16 wavesizes[8] = { 256, 512, 1024, 2048, 4096, 8192, 16384, 32768 }; @@ -128,7 +128,7 @@ static void es5503_halt_osc(ES5503Chip *chip, int onum, int type, UINT32 *accumu if (chip->irq_callback) { - chip->irq_callback(Machine, 1); + chip->irq_callback(chip->device->machine, 1); } } } @@ -240,6 +240,7 @@ static SND_START( es5503 ) chip->adc_read = intf->adc_read; chip->docram = intf->wave_memory; chip->clock = clock; + chip->device = device; chip->rege0 = 0x80; diff --git a/src/emu/sound/es5506.c b/src/emu/sound/es5506.c index a21e9e32140..0412119f4c0 100644 --- a/src/emu/sound/es5506.c +++ b/src/emu/sound/es5506.c @@ -9,7 +9,6 @@ #include <math.h> #include "sndintrf.h" -#include "deprecat.h" #include "streams.h" #include "cpuintrf.h" #include "cpuexec.h" @@ -123,6 +122,7 @@ struct ES5506Chip INT16 * ulaw_lookup; UINT16 * volume_lookup; + const device_config *device; #if MAKE_WAVS void * wavraw; /* raw waveform */ @@ -151,7 +151,7 @@ static void update_irq_state(struct ES5506Chip *chip) { /* ES5505/6 irq line has been set high - inform the host */ if (chip->irq_callback) - (*chip->irq_callback)(Machine, 1); /* IRQB set high */ + (*chip->irq_callback)(chip->device->machine, 1); /* IRQB set high */ } static void update_internal_irq_state(struct ES5506Chip *chip) @@ -168,7 +168,7 @@ static void update_internal_irq_state(struct ES5506Chip *chip) chip->irqv=0x80; if (chip->irq_callback) - (*chip->irq_callback)(Machine, 0); /* IRQB set low */ + (*chip->irq_callback)(chip->device->machine, 0); /* IRQB set low */ } /********************************************************************************************** @@ -849,6 +849,7 @@ static void *es5506_start_common(const device_config *device, int sndindex, int chip->region_base[3] = intf->region3 ? (UINT16 *)memory_region(device->machine, intf->region3) : NULL; /* initialize the rest of the structure */ + chip->device = device; chip->master_clock = clock; chip->irq_callback = intf->irq_callback; chip->irqv = 0x80; @@ -1544,6 +1545,8 @@ static SND_RESET( es5505 ) INLINE void es5505_reg_write_low(struct ES5506Chip *chip, struct ES5506Voice *voice, offs_t offset, UINT16 data, UINT16 mem_mask) { + running_machine *machine = chip->device->machine; + switch (offset) { case 0x00: /* CR */ @@ -1565,7 +1568,7 @@ INLINE void es5505_reg_write_low(struct ES5506Chip *chip, struct ES5506Voice *vo } if (LOG_COMMANDS && eslog) - fprintf(eslog, "%s:voice %d, control=%04x (raw=%04x & %04x)\n", cpuexec_describe_context(Machine), chip->current_page & 0x1f, voice->control, data, mem_mask ^ 0xffff); + fprintf(eslog, "%s:voice %d, control=%04x (raw=%04x & %04x)\n", cpuexec_describe_context(machine), chip->current_page & 0x1f, voice->control, data, mem_mask ^ 0xffff); break; case 0x01: /* FC */ @@ -1574,7 +1577,7 @@ INLINE void es5505_reg_write_low(struct ES5506Chip *chip, struct ES5506Voice *vo if (ACCESSING_BITS_8_15) voice->freqcount = (voice->freqcount & ~0x1fe00) | ((data & 0xff00) << 1); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%s:voice %d, freq count=%08x\n", cpuexec_describe_context(Machine), chip->current_page & 0x1f, voice->freqcount); + fprintf(eslog, "%s:voice %d, freq count=%08x\n", cpuexec_describe_context(machine), chip->current_page & 0x1f, voice->freqcount); break; case 0x02: /* STRT (hi) */ @@ -1583,7 +1586,7 @@ INLINE void es5505_reg_write_low(struct ES5506Chip *chip, struct ES5506Voice *vo if (ACCESSING_BITS_8_15) voice->start = (voice->start & ~0x7c000000) | ((data & 0x1f00) << 18); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%s:voice %d, loop start=%08x\n", cpuexec_describe_context(Machine), chip->current_page & 0x1f, voice->start); + fprintf(eslog, "%s:voice %d, loop start=%08x\n", cpuexec_describe_context(machine), chip->current_page & 0x1f, voice->start); break; case 0x03: /* STRT (lo) */ @@ -1592,7 +1595,7 @@ INLINE void es5505_reg_write_low(struct ES5506Chip *chip, struct ES5506Voice *vo if (ACCESSING_BITS_8_15) voice->start = (voice->start & ~0x0003fc00) | ((data & 0xff00) << 2); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%s:voice %d, loop start=%08x\n", cpuexec_describe_context(Machine), chip->current_page & 0x1f, voice->start); + fprintf(eslog, "%s:voice %d, loop start=%08x\n", cpuexec_describe_context(machine), chip->current_page & 0x1f, voice->start); break; case 0x04: /* END (hi) */ @@ -1604,7 +1607,7 @@ INLINE void es5505_reg_write_low(struct ES5506Chip *chip, struct ES5506Voice *vo voice->control |= CONTROL_STOP0; #endif if (LOG_COMMANDS && eslog) - fprintf(eslog, "%s:voice %d, loop end=%08x\n", cpuexec_describe_context(Machine), chip->current_page & 0x1f, voice->end); + fprintf(eslog, "%s:voice %d, loop end=%08x\n", cpuexec_describe_context(machine), chip->current_page & 0x1f, voice->end); break; case 0x05: /* END (lo) */ @@ -1616,7 +1619,7 @@ INLINE void es5505_reg_write_low(struct ES5506Chip *chip, struct ES5506Voice *vo voice->control |= CONTROL_STOP0; #endif if (LOG_COMMANDS && eslog) - fprintf(eslog, "%s:voice %d, loop end=%08x\n", cpuexec_describe_context(Machine), chip->current_page & 0x1f, voice->end); + fprintf(eslog, "%s:voice %d, loop end=%08x\n", cpuexec_describe_context(machine), chip->current_page & 0x1f, voice->end); break; case 0x06: /* K2 */ @@ -1625,7 +1628,7 @@ INLINE void es5505_reg_write_low(struct ES5506Chip *chip, struct ES5506Voice *vo if (ACCESSING_BITS_8_15) voice->k2 = (voice->k2 & ~0xff00) | (data & 0xff00); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%s:voice %d, K2=%04x\n", cpuexec_describe_context(Machine), chip->current_page & 0x1f, voice->k2); + fprintf(eslog, "%s:voice %d, K2=%04x\n", cpuexec_describe_context(machine), chip->current_page & 0x1f, voice->k2); break; case 0x07: /* K1 */ @@ -1634,21 +1637,21 @@ INLINE void es5505_reg_write_low(struct ES5506Chip *chip, struct ES5506Voice *vo if (ACCESSING_BITS_8_15) voice->k1 = (voice->k1 & ~0xff00) | (data & 0xff00); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%s:voice %d, K1=%04x\n", cpuexec_describe_context(Machine), chip->current_page & 0x1f, voice->k1); + fprintf(eslog, "%s:voice %d, K1=%04x\n", cpuexec_describe_context(machine), chip->current_page & 0x1f, voice->k1); break; case 0x08: /* LVOL */ if (ACCESSING_BITS_8_15) voice->lvol = (voice->lvol & ~0xff00) | (data & 0xff00); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%s:voice %d, left vol=%04x\n", cpuexec_describe_context(Machine), chip->current_page & 0x1f, voice->lvol); + fprintf(eslog, "%s:voice %d, left vol=%04x\n", cpuexec_describe_context(machine), chip->current_page & 0x1f, voice->lvol); break; case 0x09: /* RVOL */ if (ACCESSING_BITS_8_15) voice->rvol = (voice->rvol & ~0xff00) | (data & 0xff00); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%s:voice %d, right vol=%04x\n", cpuexec_describe_context(Machine), chip->current_page & 0x1f, voice->rvol); + fprintf(eslog, "%s:voice %d, right vol=%04x\n", cpuexec_describe_context(machine), chip->current_page & 0x1f, voice->rvol); break; case 0x0a: /* ACC (hi) */ @@ -1657,7 +1660,7 @@ INLINE void es5505_reg_write_low(struct ES5506Chip *chip, struct ES5506Voice *vo if (ACCESSING_BITS_8_15) voice->accum = (voice->accum & ~0x7c000000) | ((data & 0x1f00) << 18); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%s:voice %d, accum=%08x\n", cpuexec_describe_context(Machine), chip->current_page & 0x1f, voice->accum); + fprintf(eslog, "%s:voice %d, accum=%08x\n", cpuexec_describe_context(machine), chip->current_page & 0x1f, voice->accum); break; case 0x0b: /* ACC (lo) */ @@ -1666,7 +1669,7 @@ INLINE void es5505_reg_write_low(struct ES5506Chip *chip, struct ES5506Voice *vo if (ACCESSING_BITS_8_15) voice->accum = (voice->accum & ~0x0003fc00) | ((data & 0xff00) << 2); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%s:voice %d, accum=%08x\n", cpuexec_describe_context(Machine), chip->current_page & 0x1f, voice->accum); + fprintf(eslog, "%s:voice %d, accum=%08x\n", cpuexec_describe_context(machine), chip->current_page & 0x1f, voice->accum); break; case 0x0c: /* unused */ @@ -1697,6 +1700,8 @@ INLINE void es5505_reg_write_low(struct ES5506Chip *chip, struct ES5506Voice *vo INLINE void es5505_reg_write_high(struct ES5506Chip *chip, struct ES5506Voice *voice, offs_t offset, UINT16 data, UINT16 mem_mask) { + running_machine *machine = chip->device->machine; + switch (offset) { case 0x00: /* CR */ @@ -1713,7 +1718,7 @@ INLINE void es5505_reg_write_high(struct ES5506Chip *chip, struct ES5506Voice *v ((data << 2) & (CONTROL_CA0 | CONTROL_CA1)); } if (LOG_COMMANDS && eslog) - fprintf(eslog, "%s:voice %d, control=%04x (raw=%04x & %04x)\n", cpuexec_describe_context(Machine), chip->current_page & 0x1f, voice->control, data, mem_mask); + fprintf(eslog, "%s:voice %d, control=%04x (raw=%04x & %04x)\n", cpuexec_describe_context(machine), chip->current_page & 0x1f, voice->control, data, mem_mask); break; case 0x01: /* O4(n-1) */ @@ -1722,7 +1727,7 @@ INLINE void es5505_reg_write_high(struct ES5506Chip *chip, struct ES5506Voice *v if (ACCESSING_BITS_8_15) voice->o4n1 = (INT16)((voice->o4n1 & ~0xff00) | (data & 0xff00)); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%s:voice %d, O4(n-1)=%05x\n", cpuexec_describe_context(Machine), chip->current_page & 0x1f, voice->o4n1 & 0x3ffff); + fprintf(eslog, "%s:voice %d, O4(n-1)=%05x\n", cpuexec_describe_context(machine), chip->current_page & 0x1f, voice->o4n1 & 0x3ffff); break; case 0x02: /* O3(n-1) */ @@ -1731,7 +1736,7 @@ INLINE void es5505_reg_write_high(struct ES5506Chip *chip, struct ES5506Voice *v if (ACCESSING_BITS_8_15) voice->o3n1 = (INT16)((voice->o3n1 & ~0xff00) | (data & 0xff00)); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%s:voice %d, O3(n-1)=%05x\n", cpuexec_describe_context(Machine), chip->current_page & 0x1f, voice->o3n1 & 0x3ffff); + fprintf(eslog, "%s:voice %d, O3(n-1)=%05x\n", cpuexec_describe_context(machine), chip->current_page & 0x1f, voice->o3n1 & 0x3ffff); break; case 0x03: /* O3(n-2) */ @@ -1740,7 +1745,7 @@ INLINE void es5505_reg_write_high(struct ES5506Chip *chip, struct ES5506Voice *v if (ACCESSING_BITS_8_15) voice->o3n2 = (INT16)((voice->o3n2 & ~0xff00) | (data & 0xff00)); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%s:voice %d, O3(n-2)=%05x\n", cpuexec_describe_context(Machine), chip->current_page & 0x1f, voice->o3n2 & 0x3ffff); + fprintf(eslog, "%s:voice %d, O3(n-2)=%05x\n", cpuexec_describe_context(machine), chip->current_page & 0x1f, voice->o3n2 & 0x3ffff); break; case 0x04: /* O2(n-1) */ @@ -1749,7 +1754,7 @@ INLINE void es5505_reg_write_high(struct ES5506Chip *chip, struct ES5506Voice *v if (ACCESSING_BITS_8_15) voice->o2n1 = (INT16)((voice->o2n1 & ~0xff00) | (data & 0xff00)); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%s:voice %d, O2(n-1)=%05x\n", cpuexec_describe_context(Machine), chip->current_page & 0x1f, voice->o2n1 & 0x3ffff); + fprintf(eslog, "%s:voice %d, O2(n-1)=%05x\n", cpuexec_describe_context(machine), chip->current_page & 0x1f, voice->o2n1 & 0x3ffff); break; case 0x05: /* O2(n-2) */ @@ -1758,7 +1763,7 @@ INLINE void es5505_reg_write_high(struct ES5506Chip *chip, struct ES5506Voice *v if (ACCESSING_BITS_8_15) voice->o2n2 = (INT16)((voice->o2n2 & ~0xff00) | (data & 0xff00)); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%s:voice %d, O2(n-2)=%05x\n", cpuexec_describe_context(Machine), chip->current_page & 0x1f, voice->o2n2 & 0x3ffff); + fprintf(eslog, "%s:voice %d, O2(n-2)=%05x\n", cpuexec_describe_context(machine), chip->current_page & 0x1f, voice->o2n2 & 0x3ffff); break; case 0x06: /* O1(n-1) */ @@ -1767,7 +1772,7 @@ INLINE void es5505_reg_write_high(struct ES5506Chip *chip, struct ES5506Voice *v if (ACCESSING_BITS_8_15) voice->o1n1 = (INT16)((voice->o1n1 & ~0xff00) | (data & 0xff00)); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%s:voice %d, O1(n-1)=%05x (accum=%08x)\n", cpuexec_describe_context(Machine), chip->current_page & 0x1f, voice->o2n1 & 0x3ffff, voice->accum); + fprintf(eslog, "%s:voice %d, O1(n-1)=%05x (accum=%08x)\n", cpuexec_describe_context(machine), chip->current_page & 0x1f, voice->o2n1 & 0x3ffff, voice->accum); break; case 0x07: @@ -1849,7 +1854,7 @@ static void es5505_reg_write(struct ES5506Chip *chip, offs_t offset, UINT16 data { struct ES5506Voice *voice = &chip->voice[chip->current_page & 0x1f]; -// logerror("%s:ES5505 write %02x/%02x = %04x & %04x\n", cpuexec_describe_context(Machine), chip->current_page, offset, data, mem_mask); +// logerror("%s:ES5505 write %02x/%02x = %04x & %04x\n", cpuexec_describe_context(machine), chip->current_page, offset, data, mem_mask); /* force an update */ stream_update(chip->stream); diff --git a/src/emu/sound/flt_rc.c b/src/emu/sound/flt_rc.c index ea576abbb62..58088e4c06f 100644 --- a/src/emu/sound/flt_rc.c +++ b/src/emu/sound/flt_rc.c @@ -1,10 +1,10 @@ #include "sndintrf.h" #include "streams.h" -#include "deprecat.h" #include "flt_rc.h" struct filter_rc_info { + const device_config *device; sound_stream * stream; int k; int memory; @@ -76,7 +76,7 @@ static void set_RC_info(struct filter_rc_info *info, int type, double R1, double /* Cut Frequency = 1/(2*Pi*Req*C) */ /* k = (1-(EXP(-TIMEDELTA/RC))) */ - info->k = 0x10000 - 0x10000 * (exp(-1 / (Req * C) / Machine->sample_rate)); + info->k = 0x10000 - 0x10000 * (exp(-1 / (Req * C) / info->device->machine->sample_rate)); } @@ -88,6 +88,7 @@ static SND_START( filter_rc ) info = auto_malloc(sizeof(*info)); memset(info, 0, sizeof(*info)); + info->device = device; info->stream = stream_create(device, 1, 1, device->machine->sample_rate, info, filter_rc_update); if (conf) set_RC_info(info, conf->type, conf->R1, conf->R2, conf->R3, conf->C); diff --git a/src/emu/sound/ics2115.c b/src/emu/sound/ics2115.c index abfee0ce406..89debf2ea9f 100644 --- a/src/emu/sound/ics2115.c +++ b/src/emu/sound/ics2115.c @@ -7,7 +7,6 @@ #include <math.h> #include "sndintrf.h" -#include "deprecat.h" #include "streams.h" #include "cpuintrf.h" #include "cpuexec.h" @@ -42,8 +41,10 @@ enum { V_ON = 1, V_DONE = 2 }; -struct ics2115{ +struct ics2115 +{ const ics2115_interface *intf; + const device_config *device; int index; UINT8 *rom; INT16 *ulaw; @@ -79,7 +80,7 @@ static void recalc_irq(struct ics2115 *chip) if(irq != chip->irq_on) { chip->irq_on = irq; if(chip->intf->irq_cb) - chip->intf->irq_cb(Machine, irq ? ASSERT_LINE : CLEAR_LINE); + chip->intf->irq_cb(chip->device->machine, irq ? ASSERT_LINE : CLEAR_LINE); } } @@ -192,11 +193,13 @@ static void recalc_timer(struct ics2115 *chip, int timer) static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb) { + running_machine *machine = chip->device->machine; + switch(reg) { case 0x00: // [osc] Oscillator Configuration if(msb) { chip->voice[chip->osc].conf = data; - if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: conf = %02x\n", cpuexec_describe_context(Machine), chip->osc, + if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: conf = %02x\n", cpuexec_describe_context(machine), chip->osc, chip->voice[chip->osc].conf); } break; @@ -207,7 +210,7 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb) chip->voice[chip->osc].fc = (chip->voice[chip->osc].fc & 0xff)|(data << 8); else chip->voice[chip->osc].fc = (chip->voice[chip->osc].fc & 0xff00)|data; - if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: fc = %04x (%dHz)\n", cpuexec_describe_context(Machine), chip->osc, + if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: fc = %04x (%dHz)\n", cpuexec_describe_context(machine), chip->osc, chip->voice[chip->osc].fc, chip->voice[chip->osc].fc*33075/1024); break; @@ -216,14 +219,14 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb) chip->voice[chip->osc].strth = (chip->voice[chip->osc].strth & 0xff)|(data << 8); else chip->voice[chip->osc].strth = (chip->voice[chip->osc].strth & 0xff00)|data; - if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: strth = %04x\n", cpuexec_describe_context(Machine), chip->osc, + if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: strth = %04x\n", cpuexec_describe_context(machine), chip->osc, chip->voice[chip->osc].strth); break; case 0x03: // [osc] Wavesample loop start address 3-0.3-0 if(msb) { chip->voice[chip->osc].strtl = data; - if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: strtl = %02x\n", cpuexec_describe_context(Machine), chip->osc, + if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: strtl = %02x\n", cpuexec_describe_context(machine), chip->osc, chip->voice[chip->osc].strtl); } break; @@ -233,14 +236,14 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb) chip->voice[chip->osc].endh = (chip->voice[chip->osc].endh & 0xff)|(data << 8); else chip->voice[chip->osc].endh = (chip->voice[chip->osc].endh & 0xff00)|data; - if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: endh = %04x\n", cpuexec_describe_context(Machine), chip->osc, + if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: endh = %04x\n", cpuexec_describe_context(machine), chip->osc, chip->voice[chip->osc].endh); break; case 0x05: // [osc] Wavesample loop end address 3-0.3-0 if(msb) { chip->voice[chip->osc].endl = data; - if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: endl = %02x\n", cpuexec_describe_context(Machine), chip->osc, + if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: endl = %02x\n", cpuexec_describe_context(machine), chip->osc, chip->voice[chip->osc].endl); } break; @@ -248,7 +251,7 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb) case 0x07: // [osc] Volume Start if(msb) { chip->voice[chip->osc].vstart = data; - if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: vstart = %02x\n", cpuexec_describe_context(Machine), chip->osc, + if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: vstart = %02x\n", cpuexec_describe_context(machine), chip->osc, chip->voice[chip->osc].vstart); } break; @@ -256,7 +259,7 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb) case 0x08: // [osc] Volume End if(msb) { chip->voice[chip->osc].vend = data; - if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: vend = %02x\n", cpuexec_describe_context(Machine), chip->osc, + if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: vend = %02x\n", cpuexec_describe_context(machine), chip->osc, chip->voice[chip->osc].vend); } break; @@ -266,7 +269,7 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb) chip->voice[chip->osc].volacc = (chip->voice[chip->osc].volacc & 0xff)|(data << 8); else chip->voice[chip->osc].volacc = (chip->voice[chip->osc].volacc & 0xff00)|data; - if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: volacc = %04x\n", cpuexec_describe_context(Machine), chip->osc, + if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: volacc = %04x\n", cpuexec_describe_context(machine), chip->osc, chip->voice[chip->osc].volacc); break; @@ -275,7 +278,7 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb) chip->voice[chip->osc].addrh = (chip->voice[chip->osc].addrh & 0xff)|(data << 8); else chip->voice[chip->osc].addrh = (chip->voice[chip->osc].addrh & 0xff00)|data; - if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: addrh = %04x\n", cpuexec_describe_context(Machine), chip->osc, + if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: addrh = %04x\n", cpuexec_describe_context(machine), chip->osc, chip->voice[chip->osc].addrh); break; @@ -284,7 +287,7 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb) chip->voice[chip->osc].addrl = (chip->voice[chip->osc].addrl & 0xff)|(data << 8); else chip->voice[chip->osc].addrl = (chip->voice[chip->osc].addrl & 0xff00)|data; - if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: addrl = %04x\n", cpuexec_describe_context(Machine), chip->osc, + if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: addrl = %04x\n", cpuexec_describe_context(machine), chip->osc, chip->voice[chip->osc].addrl); break; @@ -292,7 +295,7 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb) case 0x0c: // [osc] Pan if(msb) { chip->voice[chip->osc].pan = data; - if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: pan = %02x\n", cpuexec_describe_context(Machine), chip->osc, + if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: pan = %02x\n", cpuexec_describe_context(machine), chip->osc, chip->voice[chip->osc].pan); } break; @@ -300,7 +303,7 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb) case 0x0d: // [osc] Volume Enveloppe Control if(msb) { chip->voice[chip->osc].vctl = data; - if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: vctl = %02x\n", cpuexec_describe_context(Machine), chip->osc, + if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: vctl = %02x\n", cpuexec_describe_context(machine), chip->osc, chip->voice[chip->osc].vctl); } break; @@ -308,7 +311,7 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb) case 0x10: // [osc] Oscillator Control if(msb) { chip->voice[chip->osc].ctl = data; - if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: ctl = %02x\n", cpuexec_describe_context(Machine), chip->osc, + if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: ctl = %02x\n", cpuexec_describe_context(machine), chip->osc, chip->voice[chip->osc].ctl); if(data == 0) keyon(chip, chip->osc); @@ -318,7 +321,7 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb) case 0x11: // [osc] Wavesample static address 27-20 if(msb) { chip->voice[chip->osc].saddr = data; - if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: saddr = %02x\n", cpuexec_describe_context(Machine), chip->osc, + if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: saddr = %02x\n", cpuexec_describe_context(machine), chip->osc, chip->voice[chip->osc].saddr); } break; @@ -326,7 +329,7 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb) case 0x40: // Timer 1 Preset if(!msb) { chip->timer[0].preset = data; - if (ICS2115LOGERROR) logerror("%s:ICS2115: t1preset = %d\n", cpuexec_describe_context(Machine), chip->timer[0].preset); + if (ICS2115LOGERROR) logerror("%s:ICS2115: t1preset = %d\n", cpuexec_describe_context(machine), chip->timer[0].preset); recalc_timer(chip, 0); } break; @@ -334,7 +337,7 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb) case 0x41: // Timer 2 Preset if(!msb) { chip->timer[1].preset = data; - if (ICS2115LOGERROR) logerror("%s:ICS2115: t2preset = %d\n", cpuexec_describe_context(Machine), chip->timer[1].preset); + if (ICS2115LOGERROR) logerror("%s:ICS2115: t2preset = %d\n", cpuexec_describe_context(machine), chip->timer[1].preset); recalc_timer(chip, 1); } break; @@ -342,7 +345,7 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb) case 0x42: // Timer 1 Prescaler if(!msb) { chip->timer[0].scale = data; - if (ICS2115LOGERROR) logerror("%s:ICS2115: t1scale = %d\n", cpuexec_describe_context(Machine), chip->timer[0].scale); + if (ICS2115LOGERROR) logerror("%s:ICS2115: t1scale = %d\n", cpuexec_describe_context(machine), chip->timer[0].scale); recalc_timer(chip, 0); } break; @@ -350,7 +353,7 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb) case 0x43: // Timer 2 Prescaler if(!msb) { chip->timer[1].scale = data; - if (ICS2115LOGERROR) logerror("%s:ICS2115: t2scale = %d\n", cpuexec_describe_context(Machine), chip->timer[1].scale); + if (ICS2115LOGERROR) logerror("%s:ICS2115: t2scale = %d\n", cpuexec_describe_context(machine), chip->timer[1].scale); recalc_timer(chip, 1); } break; @@ -358,7 +361,7 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb) case 0x4a: // IRQ Enable if(!msb) { chip->irq_en = data; - if (ICS2115LOGERROR) logerror("%s:ICS2115: irq_en = %02x\n", cpuexec_describe_context(Machine), chip->irq_en); + if (ICS2115LOGERROR) logerror("%s:ICS2115: irq_en = %02x\n", cpuexec_describe_context(machine), chip->irq_en); recalc_irq(chip); } break; @@ -366,20 +369,22 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb) case 0x4f: // Oscillator Address being Programmed if(!msb) { chip->osc = data & 31; - if (ICS2115LOGERROR) logerror("%s:ICS2115: oscnumber = %d\n", cpuexec_describe_context(Machine), chip->osc); + if (ICS2115LOGERROR) logerror("%s:ICS2115: oscnumber = %d\n", cpuexec_describe_context(machine), chip->osc); } break; default: - if (ICS2115LOGERROR) logerror("%s:ICS2115: write %02x, %02x:%d\n", cpuexec_describe_context(Machine), reg, data, msb); + if (ICS2115LOGERROR) logerror("%s:ICS2115: write %02x, %02x:%d\n", cpuexec_describe_context(machine), reg, data, msb); } } static UINT16 ics2115_reg_r(struct ics2115 *chip, UINT8 reg) { + running_machine *machine = chip->device->machine; + switch(reg) { case 0x0d: // [osc] Volume Enveloppe Control - if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: read vctl\n", cpuexec_describe_context(Machine), chip->osc); + if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: read vctl\n", cpuexec_describe_context(machine), chip->osc); // res = chip->voice[chip->osc].vctl << 8; // may expect |8 on voice irq with &40 == 0 // may expect |8 on reg 0 on voice irq with &80 == 0 @@ -396,40 +401,40 @@ static UINT16 ics2115_reg_r(struct ics2115 *chip, UINT8 reg) res = 0x40 | osc; // 0x40 ? 0x80 ? break; } - if (ICS2115LOGERROR) logerror("%s:ICS2115: read irqv %02x\n", cpuexec_describe_context(Machine), res); + if (ICS2115LOGERROR) logerror("%s:ICS2115: read irqv %02x\n", cpuexec_describe_context(machine), res); return res << 8; } case 0x40: // Timer 0 clear irq - // if (ICS2115LOGERROR) logerror("%s:ICS2115: clear timer 0\n", cpuexec_describe_context(Machine)); + // if (ICS2115LOGERROR) logerror("%s:ICS2115: clear timer 0\n", cpuexec_describe_context(machine)); chip->irq_pend &= ~(1<<0); recalc_irq(chip); return chip->timer[0].preset; case 0x41: // Timer 1 clear irq - if (ICS2115LOGERROR) logerror("%s:ICS2115: clear timer 1\n", cpuexec_describe_context(Machine)); + if (ICS2115LOGERROR) logerror("%s:ICS2115: clear timer 1\n", cpuexec_describe_context(machine)); chip->irq_pend &= ~(1<<1); recalc_irq(chip); return chip->timer[1].preset; case 0x43: // Timer status - // if (ICS2115LOGERROR) logerror("%s:ICS2115: read timer status %02x\n", cpuexec_describe_context(Machine), chip->irq_pend & 3); + // if (ICS2115LOGERROR) logerror("%s:ICS2115: read timer status %02x\n", cpuexec_describe_context(machine), chip->irq_pend & 3); return chip->irq_pend & 3; case 0x4a: // IRQ Pending - if (ICS2115LOGERROR) logerror("%s:ICS2115: read irq_pend %02x\n", cpuexec_describe_context(Machine), chip->irq_pend); + if (ICS2115LOGERROR) logerror("%s:ICS2115: read irq_pend %02x\n", cpuexec_describe_context(machine), chip->irq_pend); return chip->irq_pend; case 0x4b: // Address of Interrupting Oscillator - if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: read intoscaddr\n", cpuexec_describe_context(Machine), chip->osc); + if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: read intoscaddr\n", cpuexec_describe_context(machine), chip->osc); return 0x80; case 0x4c: // Chip revision - if (ICS2115LOGERROR) logerror("%s:ICS2115: read revision\n", cpuexec_describe_context(Machine)); + if (ICS2115LOGERROR) logerror("%s:ICS2115: read revision\n", cpuexec_describe_context(machine)); return 0x01; default: - if (ICS2115LOGERROR) logerror("%s:ICS2115: read %02x unmapped\n", cpuexec_describe_context(Machine), reg); + if (ICS2115LOGERROR) logerror("%s:ICS2115: read %02x unmapped\n", cpuexec_describe_context(machine), reg); return 0; } } @@ -443,6 +448,7 @@ static SND_START( ics2115 ) chip = auto_malloc(sizeof(*chip)); memset(chip, 0, sizeof(*chip)); + chip->device = device; chip->intf = config; chip->index = sndindex; chip->rom = device->region; @@ -483,7 +489,7 @@ READ8_HANDLER( ics2115_r ) break; } } - // if (ICS2115LOGERROR) logerror("%s:ICS2115: read status %02x\n", cpuexec_describe_context(Machine), res); + // if (ICS2115LOGERROR) logerror("%s:ICS2115: read status %02x\n", cpuexec_describe_context(space->machine), res); return res; } @@ -511,7 +517,7 @@ WRITE8_HANDLER( ics2115_w ) ics2115_reg_w(chip, chip->reg, data, 1); break; } - // if (ICS2115LOGERROR) logerror("ICS2115: wi %d, %02x\n", cpuexec_describe_context(Machine), offset, data); + // if (ICS2115LOGERROR) logerror("ICS2115: wi %d, %02x\n", cpuexec_describe_context(space->machine), offset, data); } static SND_RESET( ics2115 ) diff --git a/src/emu/sound/k053260.c b/src/emu/sound/k053260.c index e53bd2be625..a3d7c073f3f 100644 --- a/src/emu/sound/k053260.c +++ b/src/emu/sound/k053260.c @@ -5,7 +5,6 @@ *********************************************************/ #include "sndintrf.h" -#include "deprecat.h" #include "streams.h" #include "cpuintrf.h" #include "cpuexec.h" @@ -39,6 +38,7 @@ struct k053260_chip_def { unsigned long *delta_table; struct k053260_channel_def channels[4]; const k053260_interface *intf; + const device_config *device; }; @@ -210,6 +210,7 @@ static SND_START( k053260 ) memset(ic, 0, sizeof(*ic)); /* Initialize our chip structure */ + ic->device = device; ic->intf = (config != NULL) ? config : &defintrf; ic->mode = 0; @@ -260,7 +261,7 @@ INLINE void check_bounds( struct k053260_chip_def *ic, int channel ) { if (LOG) logerror("K053260: Sample Start = %06x, Sample End = %06x, Sample rate = %04lx, PPCM = %s\n", channel_start, channel_end, ic->channels[channel].rate, ic->channels[channel].ppcm ? "yes" : "no" ); } -static void k053260_write( int chip, offs_t offset, UINT8 data ) +static void k053260_write( const address_space *space, offs_t offset, UINT8 data, int chip ) { int i, t; int r = offset; @@ -377,7 +378,7 @@ static void k053260_write( int chip, offs_t offset, UINT8 data ) } } -static UINT8 k053260_read( int chip, offs_t offset ) +static UINT8 k053260_read( const address_space *space, offs_t offset, int chip ) { struct k053260_chip_def *ic = sndti_token(SOUND_K053260, chip); @@ -400,7 +401,7 @@ static UINT8 k053260_read( int chip, offs_t offset ) ic->channels[0].pos += ( 1 << 16 ); if ( offs > ic->rom_size ) { - logerror("%s: K53260: Attempting to read past rom size in rom Read Mode (offs = %06x, size = %06x).\n", cpuexec_describe_context(Machine),offs,ic->rom_size ); + logerror("%s: K53260: Attempting to read past rom size in rom Read Mode (offs = %06x, size = %06x).\n", cpuexec_describe_context(space->machine),offs,ic->rom_size ); return 0; } @@ -418,22 +419,22 @@ static UINT8 k053260_read( int chip, offs_t offset ) READ8_HANDLER( k053260_0_r ) { - return k053260_read( 0, offset ); + return k053260_read( space, offset, 0 ); } WRITE8_HANDLER( k053260_0_w ) { - k053260_write( 0, offset, data ); + k053260_write( space, offset, data, 0 ); } READ8_HANDLER( k053260_1_r ) { - return k053260_read( 1, offset ); + return k053260_read( space, offset, 1 ); } WRITE8_HANDLER( k053260_1_w ) { - k053260_write( 1, offset, data ); + k053260_write( space, offset, data, 1 ); } WRITE16_HANDLER( k053260_0_lsb_w ) diff --git a/src/emu/sound/msm5205.c b/src/emu/sound/msm5205.c index a5c25913a5b..e7da4462402 100644 --- a/src/emu/sound/msm5205.c +++ b/src/emu/sound/msm5205.c @@ -16,7 +16,6 @@ #include "sndintrf.h" #include "streams.h" -#include "deprecat.h" #include "msm5205.h" /* @@ -225,7 +224,7 @@ void msm5205_vclk_w (int num, int vclk) if( voice->vclk != vclk) { voice->vclk = vclk; - if( !vclk ) MSM5205_vclk_callback(Machine, voice, 0); + if( !vclk ) MSM5205_vclk_callback(voice->device->machine, voice, 0); } } } diff --git a/src/emu/sound/saa1099.c b/src/emu/sound/saa1099.c index 62f5b5533fd..fa91d00b132 100644 --- a/src/emu/sound/saa1099.c +++ b/src/emu/sound/saa1099.c @@ -68,7 +68,6 @@ #include "cpuintrf.h" #include "cpuexec.h" #include "saa1099.h" -#include "deprecat.h" #include <math.h> @@ -103,6 +102,7 @@ struct saa1099_noise /* this structure defines a SAA1099 chip */ struct SAA1099 { + const device_config *device; sound_stream * stream; /* our stream */ int noise_params[2]; /* noise generators parameters */ int env_enable[2]; /* envelope generators enable */ @@ -110,7 +110,7 @@ struct SAA1099 int env_mode[2]; /* envelope generators mode */ int env_bits[2]; /* non zero = 3 bits resolution */ int env_clock[2]; /* envelope clock mode (non-zero external) */ - int env_step[2]; /* current envelope step */ + int env_step[2]; /* current envelope step */ int all_ch_enable; /* all channels enable */ int sync_state; /* sync all channels */ int selected_reg; /* selected register */ @@ -320,6 +320,7 @@ static SND_START( saa1099 ) memset(saa, 0, sizeof(*saa)); /* copy global parameters */ + saa->device = device; saa->sample_rate = clock / 256; /* for each chip allocate one stream */ @@ -332,13 +333,13 @@ static void saa1099_control_port_w( int chip, int reg, int data ) { struct SAA1099 *saa = sndti_token(SOUND_SAA1099, chip); - if ((data & 0xff) > 0x1c) + if ((data & 0xff) > 0x1c) { /* Error! */ - logerror("%s: (SAA1099 #%d) Unknown register selected\n",cpuexec_describe_context(Machine), chip); + logerror("%s: (SAA1099 #%d) Unknown register selected\n",cpuexec_describe_context(saa->device->machine), chip); } - saa->selected_reg = data & 0x1f; + saa->selected_reg = data & 0x1f; if (saa->selected_reg == 0x18 || saa->selected_reg == 0x19) { /* clock the envelope channels */ @@ -421,7 +422,7 @@ static void saa1099_write_port_w( int chip, int offset, int data ) int i; /* Synch & Reset generators */ - logerror("%s: (SAA1099 #%d) -reg 0x1c- Chip reset\n",cpuexec_describe_context(Machine), chip); + logerror("%s: (SAA1099 #%d) -reg 0x1c- Chip reset\n",cpuexec_describe_context(saa->device->machine), chip); for (i = 0; i < 6; i++) { saa->channels[i].level = 0; @@ -430,7 +431,7 @@ static void saa1099_write_port_w( int chip, int offset, int data ) } break; default: /* Error! */ - logerror("%s: (SAA1099 #%d) Unknown operation (reg:%02x, data:%02x)\n",cpuexec_describe_context(Machine), chip, reg, data); + logerror("%s: (SAA1099 #%d) Unknown operation (reg:%02x, data:%02x)\n",cpuexec_describe_context(saa->device->machine), chip, reg, data); } } diff --git a/src/emu/sound/samples.c b/src/emu/sound/samples.c index b45190a767b..ca497e6bfb8 100644 --- a/src/emu/sound/samples.c +++ b/src/emu/sound/samples.c @@ -1,6 +1,5 @@ #include "driver.h" #include "streams.h" -#include "deprecat.h" #include "samples.h" @@ -20,6 +19,7 @@ struct sample_channel struct samples_info { + const device_config *device; int numchannels; /* how many channels */ struct sample_channel *channel;/* array of channels */ struct loaded_samples *samples;/* array of samples */ @@ -261,7 +261,7 @@ void sample_start_n(int num,int channel,int samplenum,int loop) chan->pos = 0; chan->frac = 0; chan->basefreq = sample->frequency; - chan->step = ((INT64)chan->basefreq << FRAC_BITS) / Machine->sample_rate; + chan->step = ((INT64)chan->basefreq << FRAC_BITS) / info->device->machine->sample_rate; chan->loop = loop; } @@ -290,7 +290,7 @@ void sample_start_raw_n(int num,int channel,const INT16 *sampledata,int samples, chan->pos = 0; chan->frac = 0; chan->basefreq = frequency; - chan->step = ((INT64)chan->basefreq << FRAC_BITS) / Machine->sample_rate; + chan->step = ((INT64)chan->basefreq << FRAC_BITS) / info->device->machine->sample_rate; chan->loop = loop; } @@ -312,7 +312,7 @@ void sample_set_freq_n(int num,int channel,int freq) /* force an update before we start */ stream_update(chan->stream); - chan->step = ((INT64)freq << FRAC_BITS) / Machine->sample_rate; + chan->step = ((INT64)freq << FRAC_BITS) / info->device->machine->sample_rate; } void sample_set_freq(int channel,int freq) @@ -537,6 +537,7 @@ static SND_START( samples ) info = auto_malloc(sizeof(*info)); memset(info, 0, sizeof(*info)); + info->device = device; sndintrf_register_token(info); /* read audio samples */ diff --git a/src/emu/sound/scsp.c b/src/emu/sound/scsp.c index d301bfb6090..39fb10900f1 100644 --- a/src/emu/sound/scsp.c +++ b/src/emu/sound/scsp.c @@ -29,7 +29,6 @@ #include "streams.h" #include "cpuintrf.h" #include "cpuexec.h" -#include "deprecat.h" #include "scsp.h" #include "scspdsp.h" @@ -225,6 +224,8 @@ struct _SCSP int ARTABLE[64], DRTABLE[64]; struct _SCSPDSP DSP; + + const device_config *device; }; static void dma_scsp(const address_space *space, struct _SCSP *SCSP); /*SCSP DMA transfer function*/ @@ -260,7 +261,7 @@ static void CheckPendingIRQ(struct _SCSP *SCSP) { UINT32 pend=SCSP->udata.data[0x20/2]; UINT32 en=SCSP->udata.data[0x1e/2]; - running_machine *machine = Machine; + running_machine *machine = SCSP->device->machine; if(SCSP->MidiW!=SCSP->MidiR) { @@ -301,7 +302,7 @@ static void CheckPendingIRQ(struct _SCSP *SCSP) static void ResetInterrupts(struct _SCSP *SCSP) { UINT32 reset = SCSP->udata.data[0x22/2]; - running_machine *machine = Machine; + running_machine *machine = SCSP->device->machine; if (reset & 0x40) { @@ -512,6 +513,7 @@ static void SCSP_Init(const device_config *device, struct _SCSP *SCSP, const scs { int i; + SCSP->device = device; SCSP->IrqTimA = SCSP->IrqTimBC = SCSP->IrqMidi = 0; SCSP->MidiR=SCSP->MidiW=0; SCSP->MidiOutR=SCSP->MidiOutW=0; @@ -698,7 +700,7 @@ static void SCSP_UpdateSlotReg(struct _SCSP *SCSP,int s,int r) static void SCSP_UpdateReg(struct _SCSP *SCSP, int reg) { /* temporary hack until this is converted to a device */ - const address_space *space = cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM); + const address_space *space = cpu_get_address_space(SCSP->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); switch(reg&0x3f) { case 0x2: @@ -839,7 +841,7 @@ static void SCSP_UpdateRegR(struct _SCSP *SCSP, int reg) unsigned short v=SCSP->udata.data[0x5/2]; v&=0xff00; v|=SCSP->MidiStack[SCSP->MidiR]; - SCSP[0].Int68kCB(Machine, -SCSP->IrqMidi); // cancel the IRQ + SCSP[0].Int68kCB(SCSP->device->machine, -SCSP->IrqMidi); // cancel the IRQ if(SCSP->MidiR!=SCSP->MidiW) { ++SCSP->MidiR; diff --git a/src/emu/sound/tms5220.c b/src/emu/sound/tms5220.c index cd56d513138..20274fb3802 100644 --- a/src/emu/sound/tms5220.c +++ b/src/emu/sound/tms5220.c @@ -41,7 +41,6 @@ TI's naming has D7 as LSB and D0 as MSB and is in uppercase ***********************************************************************************************/ #include "sndintrf.h" -#include "deprecat.h" #include "tms5220.h" @@ -158,7 +157,8 @@ struct tms5220 funny clipping/clamping logic, while the digital pin gives full 12? bit resolution of the output data. */ - UINT8 digital_select; + UINT8 digital_select; + const device_config *device; }; @@ -182,6 +182,7 @@ void *tms5220_create(const device_config *device) tms = malloc_or_die(sizeof(*tms)); memset(tms, 0, sizeof(*tms)); + tms->device = device; state_save_register_device_item_array(device, 0, tms->fifo); state_save_register_device_item(device, 0, tms->fifo_head); state_save_register_device_item(device, 0, tms->fifo_tail); @@ -256,7 +257,7 @@ void tms5220_reset_chip(void *chip) /* initialize the chip state */ /* Note that we do not actually clear IRQ on start-up : IRQ is even raised if tms->buffer_empty or tms->buffer_low are 0 */ tms->tms5220_speaking = tms->speak_external = tms->talk_status = tms->first_frame = tms->last_frame = tms->irq_pin = 0; - if (tms->irq_func) tms->irq_func(Machine, 0); + if (tms->irq_func) tms->irq_func(tms->device->machine, 0); tms->buffer_empty = tms->buffer_low = 1; tms->RDB_flag = FALSE; @@ -1193,6 +1194,6 @@ static void check_buffer_low(struct tms5220 *tms) static void set_interrupt_state(struct tms5220 *tms, int state) { if (tms->irq_func && state != tms->irq_pin) - tms->irq_func(Machine, state); + tms->irq_func(tms->device->machine, state); tms->irq_pin = state; } diff --git a/src/emu/sound/vlm5030.c b/src/emu/sound/vlm5030.c index 30d35bb14d1..7852f52d0cd 100644 --- a/src/emu/sound/vlm5030.c +++ b/src/emu/sound/vlm5030.c @@ -75,7 +75,6 @@ chirp 12-..: vokume 0 : silent */ #include "sndintrf.h" #include "streams.h" -#include "deprecat.h" #include "vlm5030.h" /* interpolator per frame */ @@ -89,6 +88,7 @@ chirp 12-..: vokume 0 : silent struct vlm5030_info { + const device_config *device; const vlm5030_interface *intf; sound_stream * channel; @@ -369,7 +369,7 @@ static void vlm5030_update_callback(void *param,stream_sample_t **inputs, stream } else if (chip->old_pitch <= 1) { /* generate unvoiced samples here */ - current_val = (mame_rand(Machine)&1) ? chip->current_energy : -chip->current_energy; + current_val = (mame_rand(chip->device->machine)&1) ? chip->current_energy : -chip->current_energy; } else { @@ -646,6 +646,7 @@ static SND_START( vlm5030 ) chip = auto_malloc(sizeof(*chip)); memset(chip, 0, sizeof(*chip)); + chip->device = device; chip->intf = (config != NULL) ? config : &defintrf; emulation_rate = clock / 440; diff --git a/src/emu/sound/votrax.c b/src/emu/sound/votrax.c index 8a6312457e8..fd49704ebaf 100644 --- a/src/emu/sound/votrax.c +++ b/src/emu/sound/votrax.c @@ -17,12 +17,12 @@ the variable VotraxBaseFrequency, this is defaulted to 8000 #include "sndintrf.h" #include "streams.h" -#include "deprecat.h" #include "samples.h" struct votrax_info { + const device_config *device; int stream; int frequency; /* Some games (Qbert) change this */ int volume; @@ -107,6 +107,7 @@ static SND_START( votrax ) votrax = auto_malloc(sizeof(*votrax)); memset(votrax, 0, sizeof(*votrax)); + votrax->device = device; votrax->samples = readsamples(VotraxTable,"votrax"); votrax->frequency = 8000; votrax->volume = 230; @@ -140,7 +141,7 @@ void votrax_w(int data) info->sample = &info->samples->sample[Phoneme]; info->pos = 0; info->frac = 0; - info->step = ((INT64)(info->sample->frequency + (256*Intonation)) << FRAC_BITS) / Machine->sample_rate; + info->step = ((INT64)(info->sample->frequency + (256*Intonation)) << FRAC_BITS) / info->device->machine->sample_rate; stream_set_output_gain(info->channel, 0, (info->volume + (8*Intonation)*100/255) / 100.0); } } diff --git a/src/emu/sound/ymf271.c b/src/emu/sound/ymf271.c index 5a926d20480..899a0a14741 100644 --- a/src/emu/sound/ymf271.c +++ b/src/emu/sound/ymf271.c @@ -14,7 +14,6 @@ #include <math.h> #include "sndintrf.h" -#include "deprecat.h" #include "streams.h" #include "ymf271.h" @@ -114,6 +113,7 @@ typedef struct UINT32 clock; sound_stream * stream; + const device_config *device; } YMF271Chip; // slot mapping assists @@ -1375,7 +1375,7 @@ static TIMER_CALLBACK( ymf271_timer_b_tick ) static UINT8 ymf271_read_ext_memory(YMF271Chip *chip, UINT32 address) { /* temporary hack until this is converted to a device */ - const address_space *space = cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM); + const address_space *space = cpu_get_address_space(chip->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); if( chip->ext_mem_read ) { return chip->ext_mem_read(space,address); } else { @@ -1388,7 +1388,7 @@ static UINT8 ymf271_read_ext_memory(YMF271Chip *chip, UINT32 address) static void ymf271_write_ext_memory(YMF271Chip *chip, UINT32 address, UINT8 data) { /* temporary hack until this is converted to a device */ - const address_space *space = cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM); + const address_space *space = cpu_get_address_space(chip->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); if( chip->ext_mem_write ) { chip->ext_mem_write(space, address, data); } @@ -1399,7 +1399,7 @@ static void ymf271_write_timer(YMF271Chip *chip, int data) int slotnum; YMF271Group *group; attotime period; - running_machine *machine = Machine; + running_machine *machine = chip->device->machine; slotnum = fm_tab[chip->timerreg & 0xf]; group = &chip->groups[slotnum]; @@ -1751,6 +1751,7 @@ static SND_START( ymf271 ) chip = auto_malloc(sizeof(*chip)); memset(chip, 0, sizeof(*chip)); + chip->device = device; chip->clock = clock; intf = (config != NULL) ? config : &defintrf; diff --git a/src/emu/sound/ymz280b.c b/src/emu/sound/ymz280b.c index 19ce83ae373..53ae851c49d 100644 --- a/src/emu/sound/ymz280b.c +++ b/src/emu/sound/ymz280b.c @@ -24,7 +24,6 @@ #include <math.h> #include "sndintrf.h" -#include "deprecat.h" #include "streams.h" #include "ymz280b.h" @@ -100,6 +99,7 @@ struct YMZ280BChip #endif INT16 *scratch; + const device_config *device; }; /* step size index shift table */ @@ -145,14 +145,14 @@ INLINE void update_irq_state(struct YMZ280BChip *chip) { chip->irq_state = 1; if (chip->irq_callback) - (*chip->irq_callback)(Machine, 1); + (*chip->irq_callback)(chip->device->machine, 1); else logerror("YMZ280B: IRQ generated, but no callback specified!"); } else if (!irq_bits && chip->irq_state) { chip->irq_state = 0; if (chip->irq_callback) - (*chip->irq_callback)(Machine, 0); + (*chip->irq_callback)(chip->device->machine, 0); else logerror("YMZ280B: IRQ generated, but no callback specified!"); } } @@ -576,7 +576,7 @@ static void ymz280b_update(void *param, stream_sample_t **inputs, stream_sample_ voice->playing = 0; /* set update_irq_state_timer. IRQ is signaled on next CPU execution. */ - timer_set(Machine, attotime_zero, chip, 0, update_irq_state_cb[v]); + timer_set(chip->device->machine, attotime_zero, chip, 0, update_irq_state_cb[v]); voice->irq_schedule = 1; } } @@ -636,6 +636,7 @@ static SND_START( ymz280b ) chip = auto_malloc(sizeof(*chip)); memset(chip, 0, sizeof(*chip)); + chip->device = device; chip->ext_ram_read = intf->ext_read; chip->ext_ram_write = intf->ext_write; @@ -868,7 +869,7 @@ static void write_to_register(struct YMZ280BChip *chip, int data) if (chip->ext_ram_write) { /* temporary hack until this is converted to a device */ - const address_space *space = cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM); + const address_space *space = cpu_get_address_space(chip->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); chip->ext_ram_write(space, chip->rom_readback_addr, data); } else diff --git a/src/mame/audio/dcs.c b/src/mame/audio/dcs.c index eac01fed9dc..eb0b1c99ee3 100644 --- a/src/mame/audio/dcs.c +++ b/src/mame/audio/dcs.c @@ -2018,7 +2018,7 @@ static void sound_tx_callback(const device_config *device, int port, INT32 data) dcs.ireg_base = source; /* recompute the sample rate and timer */ - recompute_sample_rate(Machine); + recompute_sample_rate(device->machine); return; } else diff --git a/src/mame/drivers/megadriv.c b/src/mame/drivers/megadriv.c index 37453cf891a..d9081c5aed5 100644 --- a/src/mame/drivers/megadriv.c +++ b/src/mame/drivers/megadriv.c @@ -2105,7 +2105,7 @@ static void megadrive_io_write_data_port_6button(running_machine *machine, int p if (((megadrive_io_data_regs[portnum]&0x40)==0x00) && ((data&0x40) == 0x40)) { io_stage[portnum]++; - timer_adjust_oneshot(io_timeout[portnum], cpu_clocks_to_attotime(Machine->cpu[0],8192), 0); + timer_adjust_oneshot(io_timeout[portnum], cpu_clocks_to_attotime(machine->cpu[0],8192), 0); } } @@ -3916,7 +3916,7 @@ static UINT16 vdp_get_word_from_68k_mem_svp(UINT32 source) /* emulate testmode plug */ static UINT8 megadrive_io_read_data_port_svp(running_machine *machine, int portnum) { - if (portnum == 0 && input_port_read_safe(Machine, "MEMORY_TEST", 0x00)) + if (portnum == 0 && input_port_read_safe(machine, "MEMORY_TEST", 0x00)) { return (megadrive_io_data_regs[0] & 0xc0); } diff --git a/src/mame/drivers/viper.c b/src/mame/drivers/viper.c index 93c6ddd1358..833dfb41c30 100644 --- a/src/mame/drivers/viper.c +++ b/src/mame/drivers/viper.c @@ -28,7 +28,6 @@ */ #include "driver.h" -#include "deprecat.h" #include "cpu/powerpc/ppc.h" #include "machine/pci.h" #include "memconv.h" diff --git a/src/mame/machine/n64.c b/src/mame/machine/n64.c index e40e0a5b868..502ea2d6887 100644 --- a/src/mame/machine/n64.c +++ b/src/mame/machine/n64.c @@ -1,7 +1,6 @@ /* machine/n64.c - contains N64 hardware emulation shared between MAME and MESS */ #include "driver.h" -#include "deprecat.h" #include "cpu/mips/mips3.h" #include "sound/custom.h" #include "streams.h" @@ -209,7 +208,7 @@ static void sp_set_status(const device_config *device, UINT32 status) { if (status & 0x1) { - //cpuexec_trigger(Machine, 6789); + //cpuexec_trigger(device->machine, 6789); cpu_set_input_line(device, INPUT_LINE_HALT, ASSERT_LINE); cpu_set_reg(device, RSP_SR, cpu_get_reg(device, RSP_SR) | RSP_STATUS_HALT); |