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
This commit is contained in:
Aaron Giles 2008-12-12 06:11:15 +00:00
parent 9dc4966109
commit b400e7978b
42 changed files with 232 additions and 215 deletions

View File

@ -148,7 +148,6 @@ Timming
****************************************************************************/ ****************************************************************************/
#include "debugger.h" #include "debugger.h"
#include "deprecat.h"
#include "alph8201.h" #include "alph8201.h"
/* instruction cycle count */ /* 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)); mame_printf_debug("alpha8201: cpustate->PC = %03x, Unimplemented opcode = %02x\n", cpustate->PC-1, M_RDMEM(cpustate->PC-1));
#endif #endif
#if BREAK_ON_UNKNOWN_OPCODE #if BREAK_ON_UNKNOWN_OPCODE
debugger_break(Machine); debugger_break(cpustate->device->machine);
#endif #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); mame_printf_debug("alpha8201: cpustate->PC = %03x, Unimplemented opcode = %02x,%02x\n", cpustate->PC-2, op,imm);
#endif #endif
#if BREAK_ON_UNKNOWN_OPCODE #if BREAK_ON_UNKNOWN_OPCODE
debugger_break(Machine); debugger_break(cpustate->device->machine);
#endif #endif
} }

View File

@ -173,7 +173,6 @@
#include "drcuml.h" #include "drcuml.h"
#include "drcbeut.h" #include "drcbeut.h"
#include "debugger.h" #include "debugger.h"
#include "deprecat.h"
#include "x86emit.h" #include "x86emit.h"
#include "eminline.h" #include "eminline.h"
#undef REG_SP #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_condition(inst);
assert_no_flags(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; drcuml_parameter pcp;

View File

@ -89,7 +89,6 @@
#include "drcuml.h" #include "drcuml.h"
#include "drcbeut.h" #include "drcbeut.h"
#include "debugger.h" #include "debugger.h"
#include "deprecat.h"
#include "x86emit.h" #include "x86emit.h"
#include "eminline.h" #include "eminline.h"
#undef REG_SP #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_condition(inst);
assert_no_flags(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; 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); param_normalize_1(drcbe, inst, &pcp, PTYPE_MRI);
/* test and branch */ /* 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 emit_jcc_short_link(&dst, COND_Z, &skip); // jz skip
/* push the parameter */ /* push the parameter */

View File

@ -38,7 +38,6 @@
#include "drcuml.h" #include "drcuml.h"
#include "drcumlsh.h" #include "drcumlsh.h"
#include "deprecat.h"
#include "eminline.h" #include "eminline.h"
#include "mame.h" #include "mame.h"
#include <stdarg.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_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_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_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_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); 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]); UML_HANDLE(block, handles[0]);
/* set up a random initial state */ /* 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 */ /* then populate the state with the parameters */
numparams = bevalidate_populate_state(block, &istate, test, paramlist, params, parammem); 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 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; int regnum;
/* initialize core state to random values */ /* initialize core state to random values */
state->fmod = mame_rand(Machine) & 0x03; state->fmod = mame_rand(machine) & 0x03;
state->flags = mame_rand(Machine) & 0x1f; state->flags = mame_rand(machine) & 0x1f;
state->exp = mame_rand(Machine); state->exp = mame_rand(machine);
/* initialize integer registers to random values */ /* initialize integer registers to random values */
for (regnum = 0; regnum < ARRAY_LENGTH(state->r); regnum++) for (regnum = 0; regnum < ARRAY_LENGTH(state->r); regnum++)
{ {
state->r[regnum].w.h = mame_rand(Machine); state->r[regnum].w.h = mame_rand(machine);
state->r[regnum].w.l = mame_rand(Machine); state->r[regnum].w.l = mame_rand(machine);
} }
/* initialize float registers to random values */ /* initialize float registers to random values */
for (regnum = 0; regnum < ARRAY_LENGTH(state->f); regnum++) for (regnum = 0; regnum < ARRAY_LENGTH(state->f); regnum++)
{ {
*(UINT32 *)&state->f[regnum].s.h = mame_rand(Machine); *(UINT32 *)&state->f[regnum].s.h = mame_rand(machine);
*(UINT32 *)&state->f[regnum].s.l = mame_rand(Machine); *(UINT32 *)&state->f[regnum].s.l = mame_rand(machine);
} }
/* initialize map variables to random values */ /* initialize map variables to random values */
for (regnum = 0; regnum < DRCUML_MAPVAR_END - DRCUML_MAPVAR_M0; regnum++) 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));
} }

View File

@ -31,7 +31,6 @@
#include "cpuexec.h" #include "cpuexec.h"
#include "mips3com.h" #include "mips3com.h"
#include "mips3fe.h" #include "mips3fe.h"
#include "deprecat.h"
#include "cpu/drcfe.h" #include "cpu/drcfe.h"
#include "cpu/drcuml.h" #include "cpu/drcuml.h"
#include "cpu/drcumlsh.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_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 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++) for (ramnum = 0; ramnum < MIPS3_MAX_FASTRAM; ramnum++)
if (mips3->impstate->fastram[ramnum].base != NULL && (!iswrite || !mips3->impstate->fastram[ramnum].readonly)) 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 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 UML_MOV(block, MEM(&mips3->pc), IMM(desc->pc)); // mov [pc],desc->pc
save_fast_iregs(mips3, block); save_fast_iregs(mips3, block);

View File

@ -336,7 +336,6 @@
#include "debugger.h" #include "debugger.h"
#include "deprecat.h"
#include "pdp1.h" #include "pdp1.h"
#define LOG 0 #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 (LOG_IOT_EXTRA)
{ {
if (op2 == 000) 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) if (LOG)
{ {

View File

@ -9,7 +9,6 @@
#include "ppccom.h" #include "ppccom.h"
#include "cpuexec.h" #include "cpuexec.h"
#include "mame.h" #include "mame.h"
#include "deprecat.h"
/*************************************************************************** /***************************************************************************
@ -280,7 +279,7 @@ void ppccom_reset(powerpc_state *ppc)
/* reset the decrementer */ /* reset the decrementer */
ppc->dec_zero_cycles = cpu_get_total_cycles(ppc->device); 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 */ /* initialize the 4XX state */
@ -546,7 +545,7 @@ void ppccom_execute_tlbl(powerpc_state *ppc)
int entrynum; int entrynum;
/* determine entry number; we use rand() for associativity */ /* 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 */ /* determine the flags */
flags = VTLB_FLAG_VALID | VTLB_READ_ALLOWED | VTLB_FETCH_ALLOWED; flags = VTLB_FLAG_VALID | VTLB_READ_ALLOWED | VTLB_FETCH_ALLOWED;
@ -816,9 +815,9 @@ void ppccom_execute_mtspr(powerpc_state *ppc)
case SPR4XX_TCR: case SPR4XX_TCR:
ppc->spr[SPR4XX_TCR] = ppc->param1 | (oldval & PPC4XX_TCR_WRC_MASK); ppc->spr[SPR4XX_TCR] = ppc->param1 | (oldval & PPC4XX_TCR_WRC_MASK);
if ((oldval ^ ppc->spr[SPR4XX_TCR]) & PPC4XX_TCR_FIE) 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) if ((oldval ^ ppc->spr[SPR4XX_TCR]) & PPC4XX_TCR_PIE)
ppc4xx_pit_callback(Machine, ppc, FALSE); ppc4xx_pit_callback(ppc->device->machine, ppc, FALSE);
return; return;
/* timer status register */ /* timer status register */
@ -831,7 +830,7 @@ void ppccom_execute_mtspr(powerpc_state *ppc)
case SPR4XX_PIT: case SPR4XX_PIT:
ppc->spr[SPR4XX_PIT] = ppc->param1; ppc->spr[SPR4XX_PIT] = ppc->param1;
ppc->pit_reload = ppc->param1; ppc->pit_reload = ppc->param1;
ppc4xx_pit_callback(Machine, ppc, FALSE); ppc4xx_pit_callback(ppc->device->machine, ppc, FALSE);
return; return;
/* timebase */ /* timebase */

View File

@ -21,7 +21,6 @@
#include "debugger.h" #include "debugger.h"
#include "ppccom.h" #include "ppccom.h"
#include "ppcfe.h" #include "ppcfe.h"
#include "deprecat.h"
#include "cpu/drcfe.h" #include "cpu/drcfe.h"
#include "cpu/drcuml.h" #include "cpu/drcuml.h"
#include "cpu/drcumlsh.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_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 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++) for (ramnum = 0; ramnum < PPC_MAX_FASTRAM; ramnum++)
if (ppc->impstate->fastram[ramnum].base != NULL && (!iswrite || !ppc->impstate->fastram[ramnum].readonly)) 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 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 UML_MOV(block, MEM(&ppc->pc), IMM(desc->pc)); // mov [pc],desc->pc
save_fast_iregs(ppc, block); // <save fastregs> save_fast_iregs(ppc, block); // <save fastregs>

View File

@ -6,7 +6,6 @@
#include "cpuintrf.h" #include "cpuintrf.h"
#include "debugger.h" #include "debugger.h"
#include "deprecat.h"
#include "rsp.h" #include "rsp.h"
#define LOG_INSTRUCTION_EXECUTION 0 #define LOG_INSTRUCTION_EXECUTION 0

View File

@ -23,7 +23,6 @@
*****************************************************************************/ *****************************************************************************/
#include "debugger.h" #include "debugger.h"
#include "deprecat.h"
#include "saturn.h" #include "saturn.h"

View File

@ -16,7 +16,6 @@
***************************************************************************/ ***************************************************************************/
#include "debugger.h" #include "debugger.h"
#include "deprecat.h"
#include "sh2.h" #include "sh2.h"
#include "sh2comn.h" #include "sh2comn.h"
#include "eminline.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 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 UML_MOV(block, MEM(&sh2->pc), IMM(desc->pc)); // mov [pc],desc->pc
save_fast_iregs(sh2, block); save_fast_iregs(sh2, block);

View File

@ -26,7 +26,6 @@
#include "sh4.h" #include "sh4.h"
#include "sh4regs.h" #include "sh4regs.h"
#include "sh4comn.h" #include "sh4comn.h"
#include "deprecat.h"
/* Called for unimplemented opcodes */ /* Called for unimplemented opcodes */
static void TODO(SH4 *sh4) static void TODO(SH4 *sh4)
@ -834,7 +833,7 @@ INLINE void LDCSR(SH4 *sh4, UINT32 m)
UINT32 reg; UINT32 reg;
reg = sh4->r[m]; 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); sh4_syncronize_register_bank(sh4, (sh4->sr & sRB) >> 29);
if ((sh4->r[m] & sRB) != (sh4->sr & sRB)) if ((sh4->r[m] & sRB) != (sh4->sr & sRB))
sh4_change_register_bank(sh4, sh4->r[m] & sRB ? 1 : 0); sh4_change_register_bank(sh4, sh4->r[m] & sRB ? 1 : 0);
@ -862,7 +861,7 @@ UINT32 old;
old = sh4->sr; old = sh4->sr;
sh4->ea = sh4->r[m]; sh4->ea = sh4->r[m];
sh4->sr = RL(sh4, sh4->ea ) & FLAGS; 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); sh4_syncronize_register_bank(sh4, (old & sRB) >> 29);
if ((old & sRB) != (sh4->sr & sRB)) if ((old & sRB) != (sh4->sr & sRB))
sh4_change_register_bank(sh4, sh4->sr & sRB ? 1 : 0); sh4_change_register_bank(sh4, sh4->sr & sRB ? 1 : 0);
@ -1448,7 +1447,7 @@ INLINE void RTE(SH4 *sh4)
{ {
sh4->delay = sh4->pc; sh4->delay = sh4->pc;
sh4->pc = sh4->ea = sh4->spc; 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); sh4_syncronize_register_bank(sh4, (sh4->sr & sRB) >> 29);
if ((sh4->ssr & sRB) != (sh4->sr & sRB)) if ((sh4->ssr & sRB) != (sh4->sr & sRB))
sh4_change_register_bank(sh4, sh4->ssr & sRB ? 1 : 0); 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->sgr = sh4->r[15];
sh4->sr |= MD; 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); sh4_syncronize_register_bank(sh4, (sh4->sr & sRB) >> 29);
if (!(sh4->sr & sRB)) if (!(sh4->sr & sRB))
sh4_change_register_bank(sh4, 1); sh4_change_register_bank(sh4, 1);
@ -3206,7 +3205,7 @@ INLINE void op1111(SH4 *sh4, UINT16 opcode)
FRCHG(sh4); FRCHG(sh4);
break; break;
default: default:
debugger_break(Machine); debugger_break(sh4->device->machine);
break; break;
} }
} else { } else {
@ -3217,7 +3216,7 @@ INLINE void op1111(SH4 *sh4, UINT16 opcode)
} }
break; break;
default: default:
debugger_break(Machine); debugger_break(sh4->device->machine);
break; break;
} }
break; break;
@ -3225,7 +3224,7 @@ INLINE void op1111(SH4 *sh4, UINT16 opcode)
FMAC(sh4, Rm,Rn); FMAC(sh4, Rm,Rn);
break; break;
default: default:
debugger_break(Machine); debugger_break(sh4->device->machine);
break; break;
} }
} }

View File

@ -7,7 +7,6 @@
*****************************************************************************/ *****************************************************************************/
#include "debugger.h" #include "debugger.h"
#include "deprecat.h"
#include "cpuexec.h" #include "cpuexec.h"
#include "sh4.h" #include "sh4.h"
#include "sh4regs.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->sgr = sh4->r[15];
sh4->sr |= MD; 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); sh4_syncronize_register_bank(sh4, (sh4->sr & sRB) >> 29);
if (!(sh4->sr & sRB)) if (!(sh4->sr & sRB))
sh4_change_register_bank(sh4, 1); sh4_change_register_bank(sh4, 1);

View File

@ -21,7 +21,6 @@
***************************************************************************/ ***************************************************************************/
#include "driver.h" #include "driver.h"
#include "deprecat.h"
#include "xmlfile.h" #include "xmlfile.h"
#include "debugcmt.h" #include "debugcmt.h"
#include "debugcpu.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 int debug_comment_load_xml(running_machine *machine, mame_file *file);
static void debug_comment_exit(running_machine *machine); 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) static void debug_comment_exit(running_machine *machine)
{ {
debug_comment_save(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 debug_comment_free - cleans up memory
-------------------------------------------------------------------------*/ -------------------------------------------------------------------------*/
static void debug_comment_free(void) static void debug_comment_free(running_machine *machine)
{ {
int i, j; int i, j;
for (i = 0; i < ARRAY_LENGTH(Machine->cpu); i++) for (i = 0; i < ARRAY_LENGTH(machine->cpu); i++)
if (Machine->cpu[i] != NULL) if (machine->cpu[i] != NULL)
{ {
for (j = 0; j < debug_comments[i].comment_count; j++) for (j = 0; j < debug_comments[i].comment_count; j++)
{ {

View File

@ -1,6 +1,5 @@
#include <math.h> #include <math.h>
#include "sndintrf.h" #include "sndintrf.h"
#include "deprecat.h"
#include "streams.h" #include "streams.h"
#include "2203intf.h" #include "2203intf.h"
#include "fm.h" #include "fm.h"
@ -13,6 +12,7 @@ struct ym2203_info
void * chip; void * chip;
void * psg; void * psg;
const ym2203_interface *intf; const ym2203_interface *intf;
const device_config *device;
}; };
@ -52,7 +52,7 @@ static const ssg_callbacks psgintf =
static void IRQHandler(void *param,int irq) static void IRQHandler(void *param,int irq)
{ {
struct ym2203_info *info = param; 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 */ /* Timer overflow callback from timer.c */
@ -124,6 +124,7 @@ static SND_START( ym2203 )
memset(info, 0, sizeof(*info)); memset(info, 0, sizeof(*info));
info->intf = intf; info->intf = intf;
info->device = device;
info->psg = ay8910_start_ym(SOUND_YM2203, device, clock, &intf->ay8910_intf); info->psg = ay8910_start_ym(SOUND_YM2203, device, clock, &intf->ay8910_intf);
if (!info->psg) return NULL; if (!info->psg) return NULL;

View File

@ -12,7 +12,6 @@
***************************************************************************/ ***************************************************************************/
#include "sndintrf.h" #include "sndintrf.h"
#include "deprecat.h"
#include "streams.h" #include "streams.h"
#include "ay8910.h" #include "ay8910.h"
#include "2608intf.h" #include "2608intf.h"
@ -25,6 +24,7 @@ struct ym2608_info
void * chip; void * chip;
void * psg; void * psg;
const ym2608_interface *intf; const ym2608_interface *intf;
const device_config *device;
}; };
@ -66,7 +66,7 @@ static const ssg_callbacks psgintf =
static void IRQHandler(void *param,int irq) static void IRQHandler(void *param,int irq)
{ {
struct ym2608_info *info = param; 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 */ /* Timer overflow callback from timer.c */
@ -140,6 +140,8 @@ static SND_START( ym2608 )
memset(info, 0, sizeof(*info)); memset(info, 0, sizeof(*info));
info->intf = intf; info->intf = intf;
info->device = device;
/* FIXME: Force to use simgle output */ /* FIXME: Force to use simgle output */
info->psg = ay8910_start_ym(SOUND_YM2608, device, clock, &intf->ay8910_intf); info->psg = ay8910_start_ym(SOUND_YM2608, device, clock, &intf->ay8910_intf);
if (!info->psg) return NULL; if (!info->psg) return NULL;

View File

@ -12,7 +12,6 @@
***************************************************************************/ ***************************************************************************/
#include "sndintrf.h" #include "sndintrf.h"
#include "deprecat.h"
#include "streams.h" #include "streams.h"
#include "ay8910.h" #include "ay8910.h"
#include "2610intf.h" #include "2610intf.h"
@ -26,6 +25,7 @@ struct ym2610_info
void * chip; void * chip;
void * psg; void * psg;
const ym2610_interface *intf; const ym2610_interface *intf;
const device_config *device;
}; };
@ -66,7 +66,7 @@ static const ssg_callbacks psgintf =
static void IRQHandler(void *param,int irq) static void IRQHandler(void *param,int irq)
{ {
struct ym2610_info *info = param; 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 */ /* Timer overflow callback from timer.c */
@ -142,6 +142,7 @@ static SND_START( ym2610 )
memset(info, 0, sizeof(*info)); memset(info, 0, sizeof(*info));
info->intf = intf; info->intf = intf;
info->device = device;
info->psg = ay8910_start_ym(SOUND_YM2610, device, clock, &generic_ay8910); info->psg = ay8910_start_ym(SOUND_YM2610, device, clock, &generic_ay8910);
if (!info->psg) return NULL; if (!info->psg) return NULL;
@ -208,6 +209,7 @@ static SND_START( ym2610b )
memset(info, 0, sizeof(*info)); memset(info, 0, sizeof(*info));
info->intf = intf; info->intf = intf;
info->device = device;
info->psg = ay8910_start_ym(SOUND_YM2610B, device, clock, &generic_ay8910); info->psg = ay8910_start_ym(SOUND_YM2610B, device, clock, &generic_ay8910);
if (!info->psg) return NULL; if (!info->psg) return NULL;

View File

@ -12,7 +12,6 @@
***************************************************************************/ ***************************************************************************/
#include "sndintrf.h" #include "sndintrf.h"
#include "deprecat.h"
#include "streams.h" #include "streams.h"
#include "sound/fm.h" #include "sound/fm.h"
#include "sound/2612intf.h" #include "sound/2612intf.h"
@ -24,6 +23,7 @@ struct ym2612_info
emu_timer * timer[2]; emu_timer * timer[2];
void * chip; void * chip;
const ym2612_interface *intf; const ym2612_interface *intf;
const device_config *device;
}; };
/*------------------------- TM2612 -------------------------------*/ /*------------------------- TM2612 -------------------------------*/
@ -31,7 +31,7 @@ struct ym2612_info
static void IRQHandler(void *param,int irq) static void IRQHandler(void *param,int irq)
{ {
struct ym2612_info *info = param; 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 */ /* Timer overflow callback from timer.c */
@ -97,6 +97,7 @@ static SND_START( ym2612 )
memset(info, 0, sizeof(*info)); memset(info, 0, sizeof(*info));
info->intf = config ? config : &dummy; info->intf = config ? config : &dummy;
info->device = device;
/* FM init */ /* FM init */
/* Timer Handler set */ /* Timer Handler set */

View File

@ -6,7 +6,6 @@
***************************************************************************/ ***************************************************************************/
#include "sndintrf.h" #include "sndintrf.h"
#include "deprecat.h"
#include "streams.h" #include "streams.h"
#include "262intf.h" #include "262intf.h"
#include "ymf262.h" #include "ymf262.h"
@ -18,6 +17,7 @@ struct ymf262_info
emu_timer * timer[2]; emu_timer * timer[2];
void * chip; void * chip;
const ymf262_interface *intf; const ymf262_interface *intf;
const device_config *device;
}; };
@ -26,7 +26,7 @@ struct ymf262_info
static void IRQHandler_262(void *param,int irq) static void IRQHandler_262(void *param,int irq)
{ {
struct ymf262_info *info = param; 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 ) static TIMER_CALLBACK( timer_callback_262_0 )
@ -77,6 +77,7 @@ static SND_START( ymf262 )
memset(info, 0, sizeof(*info)); memset(info, 0, sizeof(*info));
info->intf = config ? config : &dummy; info->intf = config ? config : &dummy;
info->device = device;
/* stream system initialize */ /* stream system initialize */
info->chip = ymf262_init(clock,rate); info->chip = ymf262_init(clock,rate);

View File

@ -17,7 +17,6 @@
* *
******************************************************************************/ ******************************************************************************/
#include "sndintrf.h" #include "sndintrf.h"
#include "deprecat.h"
#include "streams.h" #include "streams.h"
#include "cpuintrf.h" #include "cpuintrf.h"
#include "3812intf.h" #include "3812intf.h"
@ -33,12 +32,13 @@ struct ym3812_info
emu_timer * timer[2]; emu_timer * timer[2];
void * chip; void * chip;
const ym3812_interface *intf; const ym3812_interface *intf;
const device_config *device;
}; };
static void IRQHandler_3812(void *param,int irq) static void IRQHandler_3812(void *param,int irq)
{ {
struct ym3812_info *info = param; 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 ) static TIMER_CALLBACK( timer_callback_3812_0 )
{ {
@ -89,6 +89,7 @@ static SND_START( ym3812 )
memset(info, 0, sizeof(*info)); memset(info, 0, sizeof(*info));
info->intf = config ? config : &dummy; info->intf = config ? config : &dummy;
info->device = device;
/* stream system initialize */ /* stream system initialize */
info->chip = ym3812_init(device,clock,rate); info->chip = ym3812_init(device,clock,rate);
@ -200,6 +201,7 @@ struct ym3526_info
emu_timer * timer[2]; emu_timer * timer[2];
void * chip; void * chip;
const ym3526_interface *intf; const ym3526_interface *intf;
const device_config *device;
}; };
@ -207,7 +209,7 @@ struct ym3526_info
static void IRQHandler_3526(void *param,int irq) static void IRQHandler_3526(void *param,int irq)
{ {
struct ym3526_info *info = param; 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 */ /* Timer overflow callback from timer.c */
static TIMER_CALLBACK( timer_callback_3526_0 ) static TIMER_CALLBACK( timer_callback_3526_0 )
@ -258,6 +260,7 @@ static SND_START( ym3526 )
memset(info, 0, sizeof(*info)); memset(info, 0, sizeof(*info));
info->intf = config ? config : &dummy; info->intf = config ? config : &dummy;
info->device = device;
/* stream system initialize */ /* stream system initialize */
info->chip = ym3526_init(device,clock,rate); info->chip = ym3526_init(device,clock,rate);
@ -368,13 +371,14 @@ struct y8950_info
emu_timer * timer[2]; emu_timer * timer[2];
void * chip; void * chip;
const y8950_interface *intf; const y8950_interface *intf;
const device_config *device;
int index; int index;
}; };
static void IRQHandler_8950(void *param,int irq) static void IRQHandler_8950(void *param,int irq)
{ {
struct y8950_info *info = param; 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 ) 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) 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; 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) if (info->intf->portread)
return info->intf->portread(space,info->index); return info->intf->portread(space,info->index);
return 0; return 0;
@ -412,18 +416,18 @@ static unsigned char Y8950PortHandler_r(void *param)
static void Y8950PortHandler_w(void *param,unsigned char data) 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; 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) if (info->intf->portwrite)
info->intf->portwrite(space,info->index,data); info->intf->portwrite(space,info->index,data);
} }
static unsigned char Y8950KeyboardHandler_r(void *param) 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; 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) if (info->intf->keyboardread)
return info->intf->keyboardread(space,info->index); return info->intf->keyboardread(space,info->index);
return 0; return 0;
@ -431,9 +435,9 @@ static unsigned char Y8950KeyboardHandler_r(void *param)
static void Y8950KeyboardHandler_w(void *param,unsigned char data) 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; 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) if (info->intf->keyboardwrite)
info->intf->keyboardwrite(space,info->index,data); info->intf->keyboardwrite(space,info->index,data);
} }
@ -461,6 +465,7 @@ static SND_START( y8950 )
memset(info, 0, sizeof(*info)); memset(info, 0, sizeof(*info));
info->intf = config ? config : &dummy; info->intf = config ? config : &dummy;
info->device = device;
info->index = sndindex; info->index = sndindex;
/* stream system initialize */ /* stream system initialize */

View File

@ -14,7 +14,6 @@
#include "sndintrf.h" #include "sndintrf.h"
#include "streams.h" #include "streams.h"
#include "cpuintrf.h" #include "cpuintrf.h"
#include "deprecat.h"
#include "aica.h" #include "aica.h"
#include "aicadsp.h" #include "aicadsp.h"
@ -203,6 +202,7 @@ struct _AICA
int ARTABLE[64], DRTABLE[64]; int ARTABLE[64], DRTABLE[64];
struct _AICADSP DSP; 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}; 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 #if 0
UINT32 reset = AICA->udata.data[0xa4/2]; UINT32 reset = AICA->udata.data[0xa4/2];
running_machine *machine = Machine; running_machine *machine = AICA->device->machine;
if (reset & 0x40) if (reset & 0x40)
AICA->IntARMCB(machine, -AICA->IrqTimA); AICA->IntARMCB(machine, -AICA->IrqTimA);
@ -244,7 +244,7 @@ static void CheckPendingIRQ(struct _AICA *AICA)
{ {
UINT32 pend=AICA->udata.data[0xa0/2]; UINT32 pend=AICA->udata.data[0xa0/2];
UINT32 en=AICA->udata.data[0x9c/2]; UINT32 en=AICA->udata.data[0x9c/2];
running_machine *machine = Machine; running_machine *machine = AICA->device->machine;
if(AICA->MidiW!=AICA->MidiR) if(AICA->MidiW!=AICA->MidiR)
{ {
@ -517,6 +517,7 @@ static void AICA_Init(const device_config *device, struct _AICA *AICA, const aic
{ {
int i; int i;
AICA->device = device;
AICA->IrqTimA = AICA->IrqTimBC = AICA->IrqMidi = 0; AICA->IrqTimA = AICA->IrqTimBC = AICA->IrqMidi = 0;
AICA->MidiR=AICA->MidiW=0; AICA->MidiR=AICA->MidiW=0;
AICA->MidiOutR=AICA->MidiOutW=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) static void AICA_UpdateReg(struct _AICA *AICA, int reg)
{ {
/* temporary hack until this is converted to a device */ /* 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) switch(reg&0xff)
{ {
case 0x4: case 0x4:
@ -860,7 +861,7 @@ static void AICA_UpdateRegR(struct _AICA *AICA, int reg)
unsigned short v=AICA->udata.data[0x8/2]; unsigned short v=AICA->udata.data[0x8/2];
v&=0xff00; v&=0xff00;
v|=AICA->MidiStack[AICA->MidiR]; 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) if(AICA->MidiR!=AICA->MidiW)
{ {
++AICA->MidiR; ++AICA->MidiR;
@ -926,7 +927,7 @@ static void AICA_w16(struct _AICA *AICA,unsigned int addr,unsigned short val)
if (val) if (val)
{ {
AICA->IntARMCB(Machine, 0); AICA->IntARMCB(AICA->device->machine, 0);
} }
} }
} }

View File

@ -101,7 +101,6 @@ has twice the steps, happening twice as fast.
***************************************************************************/ ***************************************************************************/
#include "sndintrf.h" #include "sndintrf.h"
#include "deprecat.h"
#include "streams.h" #include "streams.h"
#include "cpuintrf.h" #include "cpuintrf.h"
#include "cpuexec.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) static void ay8910_write_reg(ay8910_context *psg, int r, int v)
{ {
/* temporary hack until this is converted to a device */ /* 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); //if (r >= 11 && r <= 13 ) printf("%d %x %02x\n", PSG->index, r, v);
psg->regs[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) 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; 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; int r = psg->register_latch;
if (r > 15) return 0; if (r > 15) return 0;
@ -801,7 +800,7 @@ int ay8910_read_ym(void *chip)
if (psg->intf->portAread) if (psg->intf->portAread)
psg->regs[AY_PORTA] = (*psg->intf->portAread)(space, 0); psg->regs[AY_PORTA] = (*psg->intf->portAread)(space, 0);
else 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; break;
case AY_PORTB: case AY_PORTB:
if ((psg->regs[AY_ENABLE] & 0x80) != 0) if ((psg->regs[AY_ENABLE] & 0x80) != 0)
@ -809,7 +808,7 @@ int ay8910_read_ym(void *chip)
if (psg->intf->portBread) if (psg->intf->portBread)
psg->regs[AY_PORTB] = (*psg->intf->portBread)(space, 0); psg->regs[AY_PORTB] = (*psg->intf->portBread)(space, 0);
else 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; break;
} }
return psg->regs[r]; return psg->regs[r];

View File

@ -55,7 +55,6 @@
#include "sndintrf.h" #include "sndintrf.h"
#include "streams.h" #include "streams.h"
#include "deprecat.h"
#include "c6280.h" #include "c6280.h"
typedef struct { typedef struct {
@ -72,6 +71,7 @@ typedef struct {
typedef struct { typedef struct {
sound_stream *stream; sound_stream *stream;
const device_config *device;
UINT8 select; UINT8 select;
UINT8 balance; UINT8 balance;
UINT8 lfo_frequency; UINT8 lfo_frequency;
@ -85,13 +85,8 @@ typedef struct {
/* only needed for io_buffer */ /* only needed for io_buffer */
#include "cpu/h6280/h6280.h" #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(const device_config *device, c6280_t *p, double clk, double rate)
static void c6280_init(c6280_t *p, double clk, double rate)
{ {
int i; int i;
double step; double step;
@ -102,6 +97,8 @@ static void c6280_init(c6280_t *p, double clk, double rate)
/* Clear context */ /* Clear context */
memset(p, 0, sizeof(c6280_t)); memset(p, 0, sizeof(c6280_t));
p->device = device;
/* Make waveform frequency table */ /* Make waveform frequency table */
for(i = 0; i < 4096; i += 1) 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; p->channel[ch].noise_counter += step;
if(p->channel[ch].noise_counter >= 0x800) 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; p->channel[ch].noise_counter &= 0x7FF;
buffer[0][i] += (INT16)(vll * (data - 16)); buffer[0][i] += (INT16)(vll * (data - 16));
@ -318,11 +315,11 @@ static SND_START( c6280 )
info = auto_malloc(sizeof(*info)); info = auto_malloc(sizeof(*info));
memset(info, 0, sizeof(*info)); memset(info, 0, sizeof(*info));
/* Initialize PSG emulator */ /* Initialize PSG emulator */
c6280_init(info, clock, rate); c6280_init(device, info, clock, rate);
/* Create stereo stream */ /* Create stereo stream */
info->stream = stream_create(device, 0, 2, rate, info, c6280_update); info->stream = stream_create(device, 0, 2, rate, info, c6280_update);
return info; return info;
} }

View File

@ -12,11 +12,11 @@
#include "sndintrf.h" #include "sndintrf.h"
#include "streams.h" #include "streams.h"
#include "deprecat.h"
#include "sound/cdp1869.h" #include "sound/cdp1869.h"
struct CDP1869 struct CDP1869
{ {
const device_config *device;
sound_stream *stream; /* returned by stream_create() */ sound_stream *stream; /* returned by stream_create() */
int clock; /* chip's base frequency */ 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) 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; INT16 signal = info->signal;
stream_sample_t *buffer = _buffer[0]; 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 frequency = (info->clock / 2) / (512 >> info->tonefreq) / (info->tonediv + 1);
// double amplitude = info->toneamp * ((0.78*5) / 15); // 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 */ /* get progress through wave */
int incr = info->incr; int incr = info->incr;
@ -110,6 +110,7 @@ static SND_START( cdp1869 )
info = auto_malloc(sizeof(*info)); info = auto_malloc(sizeof(*info));
memset(info, 0, 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->stream = stream_create(device, 0, 1, device->machine->sample_rate, info, cdp1869_update );
info->incr = 0; info->incr = 0;
info->signal = 0x07fff; info->signal = 0x07fff;

View File

@ -36,7 +36,6 @@
#include <math.h> #include <math.h>
#include "sndintrf.h" #include "sndintrf.h"
#include "cpuintrf.h" #include "cpuintrf.h"
#include "deprecat.h"
#include "es5503.h" #include "es5503.h"
#include "streams.h" #include "streams.h"
#include "state.h" #include "state.h"
@ -78,6 +77,7 @@ typedef struct
UINT32 clock; UINT32 clock;
UINT32 output_rate; UINT32 output_rate;
const device_config *device;
} ES5503Chip; } ES5503Chip;
static const UINT16 wavesizes[8] = { 256, 512, 1024, 2048, 4096, 8192, 16384, 32768 }; 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) 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->adc_read = intf->adc_read;
chip->docram = intf->wave_memory; chip->docram = intf->wave_memory;
chip->clock = clock; chip->clock = clock;
chip->device = device;
chip->rege0 = 0x80; chip->rege0 = 0x80;

View File

@ -9,7 +9,6 @@
#include <math.h> #include <math.h>
#include "sndintrf.h" #include "sndintrf.h"
#include "deprecat.h"
#include "streams.h" #include "streams.h"
#include "cpuintrf.h" #include "cpuintrf.h"
#include "cpuexec.h" #include "cpuexec.h"
@ -123,6 +122,7 @@ struct ES5506Chip
INT16 * ulaw_lookup; INT16 * ulaw_lookup;
UINT16 * volume_lookup; UINT16 * volume_lookup;
const device_config *device;
#if MAKE_WAVS #if MAKE_WAVS
void * wavraw; /* raw waveform */ 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 */ /* ES5505/6 irq line has been set high - inform the host */
if (chip->irq_callback) 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) 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; chip->irqv=0x80;
if (chip->irq_callback) 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; chip->region_base[3] = intf->region3 ? (UINT16 *)memory_region(device->machine, intf->region3) : NULL;
/* initialize the rest of the structure */ /* initialize the rest of the structure */
chip->device = device;
chip->master_clock = clock; chip->master_clock = clock;
chip->irq_callback = intf->irq_callback; chip->irq_callback = intf->irq_callback;
chip->irqv = 0x80; 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) 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) switch (offset)
{ {
case 0x00: /* CR */ case 0x00: /* CR */
@ -1565,7 +1568,7 @@ INLINE void es5505_reg_write_low(struct ES5506Chip *chip, struct ES5506Voice *vo
} }
if (LOG_COMMANDS && eslog) 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; break;
case 0x01: /* FC */ case 0x01: /* FC */
@ -1574,7 +1577,7 @@ INLINE void es5505_reg_write_low(struct ES5506Chip *chip, struct ES5506Voice *vo
if (ACCESSING_BITS_8_15) if (ACCESSING_BITS_8_15)
voice->freqcount = (voice->freqcount & ~0x1fe00) | ((data & 0xff00) << 1); voice->freqcount = (voice->freqcount & ~0x1fe00) | ((data & 0xff00) << 1);
if (LOG_COMMANDS && eslog) 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; break;
case 0x02: /* STRT (hi) */ 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) if (ACCESSING_BITS_8_15)
voice->start = (voice->start & ~0x7c000000) | ((data & 0x1f00) << 18); voice->start = (voice->start & ~0x7c000000) | ((data & 0x1f00) << 18);
if (LOG_COMMANDS && eslog) 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; break;
case 0x03: /* STRT (lo) */ 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) if (ACCESSING_BITS_8_15)
voice->start = (voice->start & ~0x0003fc00) | ((data & 0xff00) << 2); voice->start = (voice->start & ~0x0003fc00) | ((data & 0xff00) << 2);
if (LOG_COMMANDS && eslog) 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; break;
case 0x04: /* END (hi) */ case 0x04: /* END (hi) */
@ -1604,7 +1607,7 @@ INLINE void es5505_reg_write_low(struct ES5506Chip *chip, struct ES5506Voice *vo
voice->control |= CONTROL_STOP0; voice->control |= CONTROL_STOP0;
#endif #endif
if (LOG_COMMANDS && eslog) 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; break;
case 0x05: /* END (lo) */ case 0x05: /* END (lo) */
@ -1616,7 +1619,7 @@ INLINE void es5505_reg_write_low(struct ES5506Chip *chip, struct ES5506Voice *vo
voice->control |= CONTROL_STOP0; voice->control |= CONTROL_STOP0;
#endif #endif
if (LOG_COMMANDS && eslog) 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; break;
case 0x06: /* K2 */ case 0x06: /* K2 */
@ -1625,7 +1628,7 @@ INLINE void es5505_reg_write_low(struct ES5506Chip *chip, struct ES5506Voice *vo
if (ACCESSING_BITS_8_15) if (ACCESSING_BITS_8_15)
voice->k2 = (voice->k2 & ~0xff00) | (data & 0xff00); voice->k2 = (voice->k2 & ~0xff00) | (data & 0xff00);
if (LOG_COMMANDS && eslog) 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; break;
case 0x07: /* K1 */ case 0x07: /* K1 */
@ -1634,21 +1637,21 @@ INLINE void es5505_reg_write_low(struct ES5506Chip *chip, struct ES5506Voice *vo
if (ACCESSING_BITS_8_15) if (ACCESSING_BITS_8_15)
voice->k1 = (voice->k1 & ~0xff00) | (data & 0xff00); voice->k1 = (voice->k1 & ~0xff00) | (data & 0xff00);
if (LOG_COMMANDS && eslog) 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; break;
case 0x08: /* LVOL */ case 0x08: /* LVOL */
if (ACCESSING_BITS_8_15) if (ACCESSING_BITS_8_15)
voice->lvol = (voice->lvol & ~0xff00) | (data & 0xff00); voice->lvol = (voice->lvol & ~0xff00) | (data & 0xff00);
if (LOG_COMMANDS && eslog) 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; break;
case 0x09: /* RVOL */ case 0x09: /* RVOL */
if (ACCESSING_BITS_8_15) if (ACCESSING_BITS_8_15)
voice->rvol = (voice->rvol & ~0xff00) | (data & 0xff00); voice->rvol = (voice->rvol & ~0xff00) | (data & 0xff00);
if (LOG_COMMANDS && eslog) 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; break;
case 0x0a: /* ACC (hi) */ 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) if (ACCESSING_BITS_8_15)
voice->accum = (voice->accum & ~0x7c000000) | ((data & 0x1f00) << 18); voice->accum = (voice->accum & ~0x7c000000) | ((data & 0x1f00) << 18);
if (LOG_COMMANDS && eslog) 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; break;
case 0x0b: /* ACC (lo) */ 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) if (ACCESSING_BITS_8_15)
voice->accum = (voice->accum & ~0x0003fc00) | ((data & 0xff00) << 2); voice->accum = (voice->accum & ~0x0003fc00) | ((data & 0xff00) << 2);
if (LOG_COMMANDS && eslog) 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; break;
case 0x0c: /* unused */ 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) 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) switch (offset)
{ {
case 0x00: /* CR */ 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)); ((data << 2) & (CONTROL_CA0 | CONTROL_CA1));
} }
if (LOG_COMMANDS && eslog) 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; break;
case 0x01: /* O4(n-1) */ 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) if (ACCESSING_BITS_8_15)
voice->o4n1 = (INT16)((voice->o4n1 & ~0xff00) | (data & 0xff00)); voice->o4n1 = (INT16)((voice->o4n1 & ~0xff00) | (data & 0xff00));
if (LOG_COMMANDS && eslog) 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; break;
case 0x02: /* O3(n-1) */ 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) if (ACCESSING_BITS_8_15)
voice->o3n1 = (INT16)((voice->o3n1 & ~0xff00) | (data & 0xff00)); voice->o3n1 = (INT16)((voice->o3n1 & ~0xff00) | (data & 0xff00));
if (LOG_COMMANDS && eslog) 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; break;
case 0x03: /* O3(n-2) */ 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) if (ACCESSING_BITS_8_15)
voice->o3n2 = (INT16)((voice->o3n2 & ~0xff00) | (data & 0xff00)); voice->o3n2 = (INT16)((voice->o3n2 & ~0xff00) | (data & 0xff00));
if (LOG_COMMANDS && eslog) 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; break;
case 0x04: /* O2(n-1) */ 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) if (ACCESSING_BITS_8_15)
voice->o2n1 = (INT16)((voice->o2n1 & ~0xff00) | (data & 0xff00)); voice->o2n1 = (INT16)((voice->o2n1 & ~0xff00) | (data & 0xff00));
if (LOG_COMMANDS && eslog) 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; break;
case 0x05: /* O2(n-2) */ 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) if (ACCESSING_BITS_8_15)
voice->o2n2 = (INT16)((voice->o2n2 & ~0xff00) | (data & 0xff00)); voice->o2n2 = (INT16)((voice->o2n2 & ~0xff00) | (data & 0xff00));
if (LOG_COMMANDS && eslog) 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; break;
case 0x06: /* O1(n-1) */ 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) if (ACCESSING_BITS_8_15)
voice->o1n1 = (INT16)((voice->o1n1 & ~0xff00) | (data & 0xff00)); voice->o1n1 = (INT16)((voice->o1n1 & ~0xff00) | (data & 0xff00));
if (LOG_COMMANDS && eslog) 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; break;
case 0x07: 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]; 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 */ /* force an update */
stream_update(chip->stream); stream_update(chip->stream);

View File

@ -1,10 +1,10 @@
#include "sndintrf.h" #include "sndintrf.h"
#include "streams.h" #include "streams.h"
#include "deprecat.h"
#include "flt_rc.h" #include "flt_rc.h"
struct filter_rc_info struct filter_rc_info
{ {
const device_config *device;
sound_stream * stream; sound_stream * stream;
int k; int k;
int memory; 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) */ /* Cut Frequency = 1/(2*Pi*Req*C) */
/* k = (1-(EXP(-TIMEDELTA/RC))) */ /* 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)); info = auto_malloc(sizeof(*info));
memset(info, 0, 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); info->stream = stream_create(device, 1, 1, device->machine->sample_rate, info, filter_rc_update);
if (conf) if (conf)
set_RC_info(info, conf->type, conf->R1, conf->R2, conf->R3, conf->C); set_RC_info(info, conf->type, conf->R1, conf->R2, conf->R3, conf->C);

View File

@ -7,7 +7,6 @@
#include <math.h> #include <math.h>
#include "sndintrf.h" #include "sndintrf.h"
#include "deprecat.h"
#include "streams.h" #include "streams.h"
#include "cpuintrf.h" #include "cpuintrf.h"
#include "cpuexec.h" #include "cpuexec.h"
@ -42,8 +41,10 @@
enum { V_ON = 1, V_DONE = 2 }; enum { V_ON = 1, V_DONE = 2 };
struct ics2115{ struct ics2115
{
const ics2115_interface *intf; const ics2115_interface *intf;
const device_config *device;
int index; int index;
UINT8 *rom; UINT8 *rom;
INT16 *ulaw; INT16 *ulaw;
@ -79,7 +80,7 @@ static void recalc_irq(struct ics2115 *chip)
if(irq != chip->irq_on) { if(irq != chip->irq_on) {
chip->irq_on = irq; chip->irq_on = irq;
if(chip->intf->irq_cb) 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) static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb)
{ {
running_machine *machine = chip->device->machine;
switch(reg) { switch(reg) {
case 0x00: // [osc] Oscillator Configuration case 0x00: // [osc] Oscillator Configuration
if(msb) { if(msb) {
chip->voice[chip->osc].conf = data; 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); chip->voice[chip->osc].conf);
} }
break; 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); chip->voice[chip->osc].fc = (chip->voice[chip->osc].fc & 0xff)|(data << 8);
else else
chip->voice[chip->osc].fc = (chip->voice[chip->osc].fc & 0xff00)|data; 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); chip->voice[chip->osc].fc, chip->voice[chip->osc].fc*33075/1024);
break; 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); chip->voice[chip->osc].strth = (chip->voice[chip->osc].strth & 0xff)|(data << 8);
else else
chip->voice[chip->osc].strth = (chip->voice[chip->osc].strth & 0xff00)|data; 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); chip->voice[chip->osc].strth);
break; break;
case 0x03: // [osc] Wavesample loop start address 3-0.3-0 case 0x03: // [osc] Wavesample loop start address 3-0.3-0
if(msb) { if(msb) {
chip->voice[chip->osc].strtl = data; 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); chip->voice[chip->osc].strtl);
} }
break; 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); chip->voice[chip->osc].endh = (chip->voice[chip->osc].endh & 0xff)|(data << 8);
else else
chip->voice[chip->osc].endh = (chip->voice[chip->osc].endh & 0xff00)|data; 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); chip->voice[chip->osc].endh);
break; break;
case 0x05: // [osc] Wavesample loop end address 3-0.3-0 case 0x05: // [osc] Wavesample loop end address 3-0.3-0
if(msb) { if(msb) {
chip->voice[chip->osc].endl = data; 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); chip->voice[chip->osc].endl);
} }
break; break;
@ -248,7 +251,7 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb)
case 0x07: // [osc] Volume Start case 0x07: // [osc] Volume Start
if(msb) { if(msb) {
chip->voice[chip->osc].vstart = data; 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); chip->voice[chip->osc].vstart);
} }
break; break;
@ -256,7 +259,7 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb)
case 0x08: // [osc] Volume End case 0x08: // [osc] Volume End
if(msb) { if(msb) {
chip->voice[chip->osc].vend = data; 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); chip->voice[chip->osc].vend);
} }
break; 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); chip->voice[chip->osc].volacc = (chip->voice[chip->osc].volacc & 0xff)|(data << 8);
else else
chip->voice[chip->osc].volacc = (chip->voice[chip->osc].volacc & 0xff00)|data; 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); chip->voice[chip->osc].volacc);
break; 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); chip->voice[chip->osc].addrh = (chip->voice[chip->osc].addrh & 0xff)|(data << 8);
else else
chip->voice[chip->osc].addrh = (chip->voice[chip->osc].addrh & 0xff00)|data; 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); chip->voice[chip->osc].addrh);
break; 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); chip->voice[chip->osc].addrl = (chip->voice[chip->osc].addrl & 0xff)|(data << 8);
else else
chip->voice[chip->osc].addrl = (chip->voice[chip->osc].addrl & 0xff00)|data; 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); chip->voice[chip->osc].addrl);
break; break;
@ -292,7 +295,7 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb)
case 0x0c: // [osc] Pan case 0x0c: // [osc] Pan
if(msb) { if(msb) {
chip->voice[chip->osc].pan = data; 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); chip->voice[chip->osc].pan);
} }
break; 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 case 0x0d: // [osc] Volume Enveloppe Control
if(msb) { if(msb) {
chip->voice[chip->osc].vctl = data; 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); chip->voice[chip->osc].vctl);
} }
break; break;
@ -308,7 +311,7 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb)
case 0x10: // [osc] Oscillator Control case 0x10: // [osc] Oscillator Control
if(msb) { if(msb) {
chip->voice[chip->osc].ctl = data; 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); chip->voice[chip->osc].ctl);
if(data == 0) if(data == 0)
keyon(chip, chip->osc); 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 case 0x11: // [osc] Wavesample static address 27-20
if(msb) { if(msb) {
chip->voice[chip->osc].saddr = data; 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); chip->voice[chip->osc].saddr);
} }
break; break;
@ -326,7 +329,7 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb)
case 0x40: // Timer 1 Preset case 0x40: // Timer 1 Preset
if(!msb) { if(!msb) {
chip->timer[0].preset = data; 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); recalc_timer(chip, 0);
} }
break; break;
@ -334,7 +337,7 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb)
case 0x41: // Timer 2 Preset case 0x41: // Timer 2 Preset
if(!msb) { if(!msb) {
chip->timer[1].preset = data; 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); recalc_timer(chip, 1);
} }
break; break;
@ -342,7 +345,7 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb)
case 0x42: // Timer 1 Prescaler case 0x42: // Timer 1 Prescaler
if(!msb) { if(!msb) {
chip->timer[0].scale = data; 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); recalc_timer(chip, 0);
} }
break; break;
@ -350,7 +353,7 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb)
case 0x43: // Timer 2 Prescaler case 0x43: // Timer 2 Prescaler
if(!msb) { if(!msb) {
chip->timer[1].scale = data; 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); recalc_timer(chip, 1);
} }
break; break;
@ -358,7 +361,7 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb)
case 0x4a: // IRQ Enable case 0x4a: // IRQ Enable
if(!msb) { if(!msb) {
chip->irq_en = data; 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); recalc_irq(chip);
} }
break; 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 case 0x4f: // Oscillator Address being Programmed
if(!msb) { if(!msb) {
chip->osc = data & 31; 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; break;
default: 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) static UINT16 ics2115_reg_r(struct ics2115 *chip, UINT8 reg)
{ {
running_machine *machine = chip->device->machine;
switch(reg) { switch(reg) {
case 0x0d: // [osc] Volume Enveloppe Control 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; // res = chip->voice[chip->osc].vctl << 8;
// may expect |8 on voice irq with &40 == 0 // may expect |8 on voice irq with &40 == 0
// may expect |8 on reg 0 on voice irq with &80 == 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 ? res = 0x40 | osc; // 0x40 ? 0x80 ?
break; 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; return res << 8;
} }
case 0x40: // Timer 0 clear irq 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); chip->irq_pend &= ~(1<<0);
recalc_irq(chip); recalc_irq(chip);
return chip->timer[0].preset; return chip->timer[0].preset;
case 0x41: // Timer 1 clear irq 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); chip->irq_pend &= ~(1<<1);
recalc_irq(chip); recalc_irq(chip);
return chip->timer[1].preset; return chip->timer[1].preset;
case 0x43: // Timer status 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; return chip->irq_pend & 3;
case 0x4a: // IRQ Pending 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; return chip->irq_pend;
case 0x4b: // Address of Interrupting Oscillator 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; return 0x80;
case 0x4c: // Chip revision 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; return 0x01;
default: 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; return 0;
} }
} }
@ -443,6 +448,7 @@ static SND_START( ics2115 )
chip = auto_malloc(sizeof(*chip)); chip = auto_malloc(sizeof(*chip));
memset(chip, 0, sizeof(*chip)); memset(chip, 0, sizeof(*chip));
chip->device = device;
chip->intf = config; chip->intf = config;
chip->index = sndindex; chip->index = sndindex;
chip->rom = device->region; chip->rom = device->region;
@ -483,7 +489,7 @@ READ8_HANDLER( ics2115_r )
break; 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; return res;
} }
@ -511,7 +517,7 @@ WRITE8_HANDLER( ics2115_w )
ics2115_reg_w(chip, chip->reg, data, 1); ics2115_reg_w(chip, chip->reg, data, 1);
break; 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 ) static SND_RESET( ics2115 )

View File

@ -5,7 +5,6 @@
*********************************************************/ *********************************************************/
#include "sndintrf.h" #include "sndintrf.h"
#include "deprecat.h"
#include "streams.h" #include "streams.h"
#include "cpuintrf.h" #include "cpuintrf.h"
#include "cpuexec.h" #include "cpuexec.h"
@ -39,6 +38,7 @@ struct k053260_chip_def {
unsigned long *delta_table; unsigned long *delta_table;
struct k053260_channel_def channels[4]; struct k053260_channel_def channels[4];
const k053260_interface *intf; const k053260_interface *intf;
const device_config *device;
}; };
@ -210,6 +210,7 @@ static SND_START( k053260 )
memset(ic, 0, sizeof(*ic)); memset(ic, 0, sizeof(*ic));
/* Initialize our chip structure */ /* Initialize our chip structure */
ic->device = device;
ic->intf = (config != NULL) ? config : &defintrf; ic->intf = (config != NULL) ? config : &defintrf;
ic->mode = 0; 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" ); 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 i, t;
int r = offset; 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); 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 ); ic->channels[0].pos += ( 1 << 16 );
if ( offs > ic->rom_size ) { 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; return 0;
} }
@ -418,22 +419,22 @@ static UINT8 k053260_read( int chip, offs_t offset )
READ8_HANDLER( k053260_0_r ) READ8_HANDLER( k053260_0_r )
{ {
return k053260_read( 0, offset ); return k053260_read( space, offset, 0 );
} }
WRITE8_HANDLER( k053260_0_w ) WRITE8_HANDLER( k053260_0_w )
{ {
k053260_write( 0, offset, data ); k053260_write( space, offset, data, 0 );
} }
READ8_HANDLER( k053260_1_r ) READ8_HANDLER( k053260_1_r )
{ {
return k053260_read( 1, offset ); return k053260_read( space, offset, 1 );
} }
WRITE8_HANDLER( k053260_1_w ) WRITE8_HANDLER( k053260_1_w )
{ {
k053260_write( 1, offset, data ); k053260_write( space, offset, data, 1 );
} }
WRITE16_HANDLER( k053260_0_lsb_w ) WRITE16_HANDLER( k053260_0_lsb_w )

View File

@ -16,7 +16,6 @@
#include "sndintrf.h" #include "sndintrf.h"
#include "streams.h" #include "streams.h"
#include "deprecat.h"
#include "msm5205.h" #include "msm5205.h"
/* /*
@ -225,7 +224,7 @@ void msm5205_vclk_w (int num, int vclk)
if( voice->vclk != vclk) if( voice->vclk != vclk)
{ {
voice->vclk = vclk; voice->vclk = vclk;
if( !vclk ) MSM5205_vclk_callback(Machine, voice, 0); if( !vclk ) MSM5205_vclk_callback(voice->device->machine, voice, 0);
} }
} }
} }

View File

@ -68,7 +68,6 @@
#include "cpuintrf.h" #include "cpuintrf.h"
#include "cpuexec.h" #include "cpuexec.h"
#include "saa1099.h" #include "saa1099.h"
#include "deprecat.h"
#include <math.h> #include <math.h>
@ -103,6 +102,7 @@ struct saa1099_noise
/* this structure defines a SAA1099 chip */ /* this structure defines a SAA1099 chip */
struct SAA1099 struct SAA1099
{ {
const device_config *device;
sound_stream * stream; /* our stream */ sound_stream * stream; /* our stream */
int noise_params[2]; /* noise generators parameters */ int noise_params[2]; /* noise generators parameters */
int env_enable[2]; /* envelope generators enable */ int env_enable[2]; /* envelope generators enable */
@ -110,7 +110,7 @@ struct SAA1099
int env_mode[2]; /* envelope generators mode */ int env_mode[2]; /* envelope generators mode */
int env_bits[2]; /* non zero = 3 bits resolution */ int env_bits[2]; /* non zero = 3 bits resolution */
int env_clock[2]; /* envelope clock mode (non-zero external) */ 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 all_ch_enable; /* all channels enable */
int sync_state; /* sync all channels */ int sync_state; /* sync all channels */
int selected_reg; /* selected register */ int selected_reg; /* selected register */
@ -320,6 +320,7 @@ static SND_START( saa1099 )
memset(saa, 0, sizeof(*saa)); memset(saa, 0, sizeof(*saa));
/* copy global parameters */ /* copy global parameters */
saa->device = device;
saa->sample_rate = clock / 256; saa->sample_rate = clock / 256;
/* for each chip allocate one stream */ /* 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); struct SAA1099 *saa = sndti_token(SOUND_SAA1099, chip);
if ((data & 0xff) > 0x1c) if ((data & 0xff) > 0x1c)
{ {
/* Error! */ /* 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) if (saa->selected_reg == 0x18 || saa->selected_reg == 0x19)
{ {
/* clock the envelope channels */ /* clock the envelope channels */
@ -421,7 +422,7 @@ static void saa1099_write_port_w( int chip, int offset, int data )
int i; int i;
/* Synch & Reset generators */ /* 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++) for (i = 0; i < 6; i++)
{ {
saa->channels[i].level = 0; saa->channels[i].level = 0;
@ -430,7 +431,7 @@ static void saa1099_write_port_w( int chip, int offset, int data )
} }
break; break;
default: /* Error! */ 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);
} }
} }

View File

@ -1,6 +1,5 @@
#include "driver.h" #include "driver.h"
#include "streams.h" #include "streams.h"
#include "deprecat.h"
#include "samples.h" #include "samples.h"
@ -20,6 +19,7 @@ struct sample_channel
struct samples_info struct samples_info
{ {
const device_config *device;
int numchannels; /* how many channels */ int numchannels; /* how many channels */
struct sample_channel *channel;/* array of channels */ struct sample_channel *channel;/* array of channels */
struct loaded_samples *samples;/* array of samples */ 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->pos = 0;
chan->frac = 0; chan->frac = 0;
chan->basefreq = sample->frequency; 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; 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->pos = 0;
chan->frac = 0; chan->frac = 0;
chan->basefreq = frequency; 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; chan->loop = loop;
} }
@ -312,7 +312,7 @@ void sample_set_freq_n(int num,int channel,int freq)
/* force an update before we start */ /* force an update before we start */
stream_update(chan->stream); 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) void sample_set_freq(int channel,int freq)
@ -537,6 +537,7 @@ static SND_START( samples )
info = auto_malloc(sizeof(*info)); info = auto_malloc(sizeof(*info));
memset(info, 0, sizeof(*info)); memset(info, 0, sizeof(*info));
info->device = device;
sndintrf_register_token(info); sndintrf_register_token(info);
/* read audio samples */ /* read audio samples */

View File

@ -29,7 +29,6 @@
#include "streams.h" #include "streams.h"
#include "cpuintrf.h" #include "cpuintrf.h"
#include "cpuexec.h" #include "cpuexec.h"
#include "deprecat.h"
#include "scsp.h" #include "scsp.h"
#include "scspdsp.h" #include "scspdsp.h"
@ -225,6 +224,8 @@ struct _SCSP
int ARTABLE[64], DRTABLE[64]; int ARTABLE[64], DRTABLE[64];
struct _SCSPDSP DSP; struct _SCSPDSP DSP;
const device_config *device;
}; };
static void dma_scsp(const address_space *space, struct _SCSP *SCSP); /*SCSP DMA transfer function*/ 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 pend=SCSP->udata.data[0x20/2];
UINT32 en=SCSP->udata.data[0x1e/2]; UINT32 en=SCSP->udata.data[0x1e/2];
running_machine *machine = Machine; running_machine *machine = SCSP->device->machine;
if(SCSP->MidiW!=SCSP->MidiR) if(SCSP->MidiW!=SCSP->MidiR)
{ {
@ -301,7 +302,7 @@ static void CheckPendingIRQ(struct _SCSP *SCSP)
static void ResetInterrupts(struct _SCSP *SCSP) static void ResetInterrupts(struct _SCSP *SCSP)
{ {
UINT32 reset = SCSP->udata.data[0x22/2]; UINT32 reset = SCSP->udata.data[0x22/2];
running_machine *machine = Machine; running_machine *machine = SCSP->device->machine;
if (reset & 0x40) if (reset & 0x40)
{ {
@ -512,6 +513,7 @@ static void SCSP_Init(const device_config *device, struct _SCSP *SCSP, const scs
{ {
int i; int i;
SCSP->device = device;
SCSP->IrqTimA = SCSP->IrqTimBC = SCSP->IrqMidi = 0; SCSP->IrqTimA = SCSP->IrqTimBC = SCSP->IrqMidi = 0;
SCSP->MidiR=SCSP->MidiW=0; SCSP->MidiR=SCSP->MidiW=0;
SCSP->MidiOutR=SCSP->MidiOutW=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) static void SCSP_UpdateReg(struct _SCSP *SCSP, int reg)
{ {
/* temporary hack until this is converted to a device */ /* 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) switch(reg&0x3f)
{ {
case 0x2: case 0x2:
@ -839,7 +841,7 @@ static void SCSP_UpdateRegR(struct _SCSP *SCSP, int reg)
unsigned short v=SCSP->udata.data[0x5/2]; unsigned short v=SCSP->udata.data[0x5/2];
v&=0xff00; v&=0xff00;
v|=SCSP->MidiStack[SCSP->MidiR]; 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) if(SCSP->MidiR!=SCSP->MidiW)
{ {
++SCSP->MidiR; ++SCSP->MidiR;

View File

@ -41,7 +41,6 @@ TI's naming has D7 as LSB and D0 as MSB and is in uppercase
***********************************************************************************************/ ***********************************************************************************************/
#include "sndintrf.h" #include "sndintrf.h"
#include "deprecat.h"
#include "tms5220.h" #include "tms5220.h"
@ -158,7 +157,8 @@ struct tms5220
funny clipping/clamping logic, while the digital pin gives full 12? bit funny clipping/clamping logic, while the digital pin gives full 12? bit
resolution of the output data. 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)); tms = malloc_or_die(sizeof(*tms));
memset(tms, 0, 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_array(device, 0, tms->fifo);
state_save_register_device_item(device, 0, tms->fifo_head); state_save_register_device_item(device, 0, tms->fifo_head);
state_save_register_device_item(device, 0, tms->fifo_tail); state_save_register_device_item(device, 0, tms->fifo_tail);
@ -256,7 +257,7 @@ void tms5220_reset_chip(void *chip)
/* initialize the chip state */ /* 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 */ /* 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; 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->buffer_empty = tms->buffer_low = 1;
tms->RDB_flag = FALSE; 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) static void set_interrupt_state(struct tms5220 *tms, int state)
{ {
if (tms->irq_func && state != tms->irq_pin) if (tms->irq_func && state != tms->irq_pin)
tms->irq_func(Machine, state); tms->irq_func(tms->device->machine, state);
tms->irq_pin = state; tms->irq_pin = state;
} }

View File

@ -75,7 +75,6 @@ chirp 12-..: vokume 0 : silent
*/ */
#include "sndintrf.h" #include "sndintrf.h"
#include "streams.h" #include "streams.h"
#include "deprecat.h"
#include "vlm5030.h" #include "vlm5030.h"
/* interpolator per frame */ /* interpolator per frame */
@ -89,6 +88,7 @@ chirp 12-..: vokume 0 : silent
struct vlm5030_info struct vlm5030_info
{ {
const device_config *device;
const vlm5030_interface *intf; const vlm5030_interface *intf;
sound_stream * channel; 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) else if (chip->old_pitch <= 1)
{ /* generate unvoiced samples here */ { /* 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 else
{ {
@ -646,6 +646,7 @@ static SND_START( vlm5030 )
chip = auto_malloc(sizeof(*chip)); chip = auto_malloc(sizeof(*chip));
memset(chip, 0, sizeof(*chip)); memset(chip, 0, sizeof(*chip));
chip->device = device;
chip->intf = (config != NULL) ? config : &defintrf; chip->intf = (config != NULL) ? config : &defintrf;
emulation_rate = clock / 440; emulation_rate = clock / 440;

View File

@ -17,12 +17,12 @@ the variable VotraxBaseFrequency, this is defaulted to 8000
#include "sndintrf.h" #include "sndintrf.h"
#include "streams.h" #include "streams.h"
#include "deprecat.h"
#include "samples.h" #include "samples.h"
struct votrax_info struct votrax_info
{ {
const device_config *device;
int stream; int stream;
int frequency; /* Some games (Qbert) change this */ int frequency; /* Some games (Qbert) change this */
int volume; int volume;
@ -107,6 +107,7 @@ static SND_START( votrax )
votrax = auto_malloc(sizeof(*votrax)); votrax = auto_malloc(sizeof(*votrax));
memset(votrax, 0, sizeof(*votrax)); memset(votrax, 0, sizeof(*votrax));
votrax->device = device;
votrax->samples = readsamples(VotraxTable,"votrax"); votrax->samples = readsamples(VotraxTable,"votrax");
votrax->frequency = 8000; votrax->frequency = 8000;
votrax->volume = 230; votrax->volume = 230;
@ -140,7 +141,7 @@ void votrax_w(int data)
info->sample = &info->samples->sample[Phoneme]; info->sample = &info->samples->sample[Phoneme];
info->pos = 0; info->pos = 0;
info->frac = 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); stream_set_output_gain(info->channel, 0, (info->volume + (8*Intonation)*100/255) / 100.0);
} }
} }

View File

@ -14,7 +14,6 @@
#include <math.h> #include <math.h>
#include "sndintrf.h" #include "sndintrf.h"
#include "deprecat.h"
#include "streams.h" #include "streams.h"
#include "ymf271.h" #include "ymf271.h"
@ -114,6 +113,7 @@ typedef struct
UINT32 clock; UINT32 clock;
sound_stream * stream; sound_stream * stream;
const device_config *device;
} YMF271Chip; } YMF271Chip;
// slot mapping assists // slot mapping assists
@ -1375,7 +1375,7 @@ static TIMER_CALLBACK( ymf271_timer_b_tick )
static UINT8 ymf271_read_ext_memory(YMF271Chip *chip, UINT32 address) static UINT8 ymf271_read_ext_memory(YMF271Chip *chip, UINT32 address)
{ {
/* temporary hack until this is converted to a device */ /* 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 ) { if( chip->ext_mem_read ) {
return chip->ext_mem_read(space,address); return chip->ext_mem_read(space,address);
} else { } 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) static void ymf271_write_ext_memory(YMF271Chip *chip, UINT32 address, UINT8 data)
{ {
/* temporary hack until this is converted to a device */ /* 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 ) { if( chip->ext_mem_write ) {
chip->ext_mem_write(space, address, data); chip->ext_mem_write(space, address, data);
} }
@ -1399,7 +1399,7 @@ static void ymf271_write_timer(YMF271Chip *chip, int data)
int slotnum; int slotnum;
YMF271Group *group; YMF271Group *group;
attotime period; attotime period;
running_machine *machine = Machine; running_machine *machine = chip->device->machine;
slotnum = fm_tab[chip->timerreg & 0xf]; slotnum = fm_tab[chip->timerreg & 0xf];
group = &chip->groups[slotnum]; group = &chip->groups[slotnum];
@ -1751,6 +1751,7 @@ static SND_START( ymf271 )
chip = auto_malloc(sizeof(*chip)); chip = auto_malloc(sizeof(*chip));
memset(chip, 0, sizeof(*chip)); memset(chip, 0, sizeof(*chip));
chip->device = device;
chip->clock = clock; chip->clock = clock;
intf = (config != NULL) ? config : &defintrf; intf = (config != NULL) ? config : &defintrf;

View File

@ -24,7 +24,6 @@
#include <math.h> #include <math.h>
#include "sndintrf.h" #include "sndintrf.h"
#include "deprecat.h"
#include "streams.h" #include "streams.h"
#include "ymz280b.h" #include "ymz280b.h"
@ -100,6 +99,7 @@ struct YMZ280BChip
#endif #endif
INT16 *scratch; INT16 *scratch;
const device_config *device;
}; };
/* step size index shift table */ /* step size index shift table */
@ -145,14 +145,14 @@ INLINE void update_irq_state(struct YMZ280BChip *chip)
{ {
chip->irq_state = 1; chip->irq_state = 1;
if (chip->irq_callback) 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 logerror("YMZ280B: IRQ generated, but no callback specified!");
} }
else if (!irq_bits && chip->irq_state) else if (!irq_bits && chip->irq_state)
{ {
chip->irq_state = 0; chip->irq_state = 0;
if (chip->irq_callback) 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!"); 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; voice->playing = 0;
/* set update_irq_state_timer. IRQ is signaled on next CPU execution. */ /* 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; voice->irq_schedule = 1;
} }
} }
@ -636,6 +636,7 @@ static SND_START( ymz280b )
chip = auto_malloc(sizeof(*chip)); chip = auto_malloc(sizeof(*chip));
memset(chip, 0, sizeof(*chip)); memset(chip, 0, sizeof(*chip));
chip->device = device;
chip->ext_ram_read = intf->ext_read; chip->ext_ram_read = intf->ext_read;
chip->ext_ram_write = intf->ext_write; 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) if (chip->ext_ram_write)
{ {
/* temporary hack until this is converted to a device */ /* 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); chip->ext_ram_write(space, chip->rom_readback_addr, data);
} }
else else

View File

@ -2018,7 +2018,7 @@ static void sound_tx_callback(const device_config *device, int port, INT32 data)
dcs.ireg_base = source; dcs.ireg_base = source;
/* recompute the sample rate and timer */ /* recompute the sample rate and timer */
recompute_sample_rate(Machine); recompute_sample_rate(device->machine);
return; return;
} }
else else

View File

@ -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)) if (((megadrive_io_data_regs[portnum]&0x40)==0x00) && ((data&0x40) == 0x40))
{ {
io_stage[portnum]++; 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 */ /* emulate testmode plug */
static UINT8 megadrive_io_read_data_port_svp(running_machine *machine, int portnum) 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); return (megadrive_io_data_regs[0] & 0xc0);
} }

View File

@ -28,7 +28,6 @@
*/ */
#include "driver.h" #include "driver.h"
#include "deprecat.h"
#include "cpu/powerpc/ppc.h" #include "cpu/powerpc/ppc.h"
#include "machine/pci.h" #include "machine/pci.h"
#include "memconv.h" #include "memconv.h"

View File

@ -1,7 +1,6 @@
/* machine/n64.c - contains N64 hardware emulation shared between MAME and MESS */ /* machine/n64.c - contains N64 hardware emulation shared between MAME and MESS */
#include "driver.h" #include "driver.h"
#include "deprecat.h"
#include "cpu/mips/mips3.h" #include "cpu/mips/mips3.h"
#include "sound/custom.h" #include "sound/custom.h"
#include "streams.h" #include "streams.h"
@ -209,7 +208,7 @@ static void sp_set_status(const device_config *device, UINT32 status)
{ {
if (status & 0x1) if (status & 0x1)
{ {
//cpuexec_trigger(Machine, 6789); //cpuexec_trigger(device->machine, 6789);
cpu_set_input_line(device, INPUT_LINE_HALT, ASSERT_LINE); 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); cpu_set_reg(device, RSP_SR, cpu_get_reg(device, RSP_SR) | RSP_STATUS_HALT);