From: Atari Ace [mailto:atari_ace@verizon.net]

Subject: [patch] Conditional code cleanup resubmit

Hi mamedev,

This is a resubmit of a previous patch.  The earlier version would not
compile with 32-bit MSVC, due to the fact that its linker required
external dependencies in dead code to be met before dead code
elimination was done, causing linker errors.  The proper fix for this
would be to add the necessary dependencies, so I instead simply left
the conditional code in place in winalloc.c and chd.c.

~aa

Original submission email below:
----
Conditionally compiled code tends to bitrot, so MAME should try to
avoid it as much as possible.  I sent a patch six months ago to
eliminate conditional code associated with logging, here's another
patch that does more of this.  Some notes:

1.  drc_ops.c: I couldn't find a LOG_CODE anywhere, so I used if (0).
2.  romload.c: I converted all the users of debugload to use
LOG((...)) instead, following the traditional conditional logging
pattern.
3.  windows/sound.c: I eliminated the separate sound log and directed
the few outputs to the error log.

~aa
This commit is contained in:
Aaron Giles 2008-07-24 06:26:47 +00:00
parent 9b63c42203
commit 0b77a69691
47 changed files with 280 additions and 461 deletions

View File

@ -312,6 +312,7 @@ static void drcbex64_get_info(drcbe_state *state, drcbe_info *info);
/* private helper functions */ /* private helper functions */
static void fixup_label(void *parameter, drccodeptr labelcodeptr); static void fixup_label(void *parameter, drccodeptr labelcodeptr);
static void debug_log_hashjmp(int mode, offs_t pc);
@ -714,9 +715,8 @@ static drcbe_state *drcbex64_alloc(drcuml_state *drcuml, drccache *cache, UINT32
/* get pointers to C functions we need to call */ /* get pointers to C functions we need to call */
drcbe->debug_cpu_instruction_hook = (x86code *)debug_cpu_instruction_hook; drcbe->debug_cpu_instruction_hook = (x86code *)debug_cpu_instruction_hook;
#if LOG_HASHJMPS if (LOG_HASHJMPS)
drcbe->debug_log_hashjmp = (x86code *)debug_log_hashjmp; drcbe->debug_log_hashjmp = (x86code *)debug_log_hashjmp;
#endif
drcbe->drcmap_get_value = (x86code *)drcmap_get_value; drcbe->drcmap_get_value = (x86code *)drcmap_get_value;
/* allocate hash tables */ /* allocate hash tables */
@ -2951,12 +2951,10 @@ static void fixup_exception(drccodeptr *codeptr, void *param1, void *param2, voi
logging of hashjmps logging of hashjmps
-------------------------------------------------*/ -------------------------------------------------*/
#if LOG_HASHJMPS
static void debug_log_hashjmp(int mode, offs_t pc) static void debug_log_hashjmp(int mode, offs_t pc)
{ {
printf("mode=%d PC=%08X\n", mode, pc); printf("mode=%d PC=%08X\n", mode, pc);
} }
#endif
@ -3155,11 +3153,12 @@ static x86code *op_hashjmp(drcbe_state *drcbe, x86code *dst, const drcuml_instru
/* normalize parameters */ /* normalize parameters */
param_normalize_3(drcbe, inst, &modep, PTYPE_MRI, &pcp, PTYPE_MRI, &exp, PTYPE_M); param_normalize_3(drcbe, inst, &modep, PTYPE_MRI, &pcp, PTYPE_MRI, &exp, PTYPE_M);
#if LOG_HASHJMPS if (LOG_HASHJMPS)
emit_mov_r32_p32(drcbe, &dst, REG_PARAM1, &pcp); {
emit_mov_r32_p32(drcbe, &dst, REG_PARAM2, &modep); emit_mov_r32_p32(drcbe, &dst, REG_PARAM1, &pcp);
emit_smart_call_m64(drcbe, &dst, &drcbe->debug_log_hashjmp); emit_mov_r32_p32(drcbe, &dst, REG_PARAM2, &modep);
#endif emit_smart_call_m64(drcbe, &dst, &drcbe->debug_log_hashjmp);
}
/* load the stack base one word early so we end up at the right spot after our call below */ /* load the stack base one word early so we end up at the right spot after our call below */
emit_mov_r64_m64(&dst, REG_RSP, MABS(drcbe, &drcbe->hashstacksave)); // mov rsp,[hashstacksave] emit_mov_r64_m64(&dst, REG_RSP, MABS(drcbe, &drcbe->hashstacksave)); // mov rsp,[hashstacksave]

View File

@ -3077,12 +3077,10 @@ static void fixup_exception(drccodeptr *codeptr, void *param1, void *param2, voi
logging of hashjmps logging of hashjmps
-------------------------------------------------*/ -------------------------------------------------*/
#if LOG_HASHJMPS
static void debug_log_hashjmp(int mode, offs_t pc) static void debug_log_hashjmp(int mode, offs_t pc)
{ {
printf("mode=%d PC=%08X\n", mode, pc); printf("mode=%d PC=%08X\n", mode, pc);
} }
#endif
@ -3280,11 +3278,12 @@ static x86code *op_hashjmp(drcbe_state *drcbe, x86code *dst, const drcuml_instru
/* normalize parameters */ /* normalize parameters */
param_normalize_3(drcbe, inst, &modep, PTYPE_MRI, &pcp, PTYPE_MRI, &exp, PTYPE_M); param_normalize_3(drcbe, inst, &modep, PTYPE_MRI, &pcp, PTYPE_MRI, &exp, PTYPE_M);
#if LOG_HASHJMPS if (LOG_HASHJMPS)
emit_mov_m32_p32(drcbe, &dst, MBD(REG_ESP, 4), &pcp); {
emit_mov_m32_p32(drcbe, &dst, MBD(REG_ESP, 0), &modep); emit_mov_m32_p32(drcbe, &dst, MBD(REG_ESP, 4), &pcp);
emit_call(&dst, (x86code *)debug_log_hashjmp); emit_mov_m32_p32(drcbe, &dst, MBD(REG_ESP, 0), &modep);
#endif emit_call(&dst, (x86code *)debug_log_hashjmp);
}
/* load the stack base one word early so we end up at the right spot after our call below */ /* load the stack base one word early so we end up at the right spot after our call below */
emit_mov_r32_m32(&dst, REG_ESP, MABS(&drcbe->hashstacksave)); // mov esp,[hashstacksave] emit_mov_r32_m32(&dst, REG_ESP, MABS(&drcbe->hashstacksave)); // mov esp,[hashstacksave]

View File

@ -1369,9 +1369,7 @@ static void simplify_instruction_with_no_flags(drcuml_block *block, drcuml_instr
static const UINT64 instsizemask[] = { 0, 0, 0, 0, 0xffffffff, 0, 0, 0, U64(0xffffffffffffffff) }; static const UINT64 instsizemask[] = { 0, 0, 0, 0, 0xffffffff, 0, 0, 0, U64(0xffffffffffffffff) };
static const UINT64 paramsizemask[] = { 0xff, 0xffff, 0xffffffff, U64(0xffffffffffffffff) }; static const UINT64 paramsizemask[] = { 0xff, 0xffff, 0xffffffff, U64(0xffffffffffffffff) };
drcuml_opcode origop = inst->opcode; drcuml_opcode origop = inst->opcode;
#if LOG_SIMPLIFICATIONS
drcuml_instruction orig = *inst; drcuml_instruction orig = *inst;
#endif
switch (inst->opcode) switch (inst->opcode)
{ {
@ -1688,15 +1686,13 @@ static void simplify_instruction_with_no_flags(drcuml_block *block, drcuml_instr
break; break;
} }
#if LOG_SIMPLIFICATIONS if (LOG_SIMPLIFICATIONS && memcmp(&orig, inst, sizeof(orig)) != 0)
if (memcmp(&orig, inst, sizeof(orig)) != 0)
{ {
char disasm1[256], disasm2[256]; char disasm1[256], disasm2[256];
drcuml_disasm(&orig, disasm1, block->drcuml); drcuml_disasm(&orig, disasm1, block->drcuml);
drcuml_disasm(inst, disasm2, block->drcuml); drcuml_disasm(inst, disasm2, block->drcuml);
mame_printf_debug("Simplified: %-50.50s -> %s\n", disasm1, disasm2); mame_printf_debug("Simplified: %-50.50s -> %s\n", disasm1, disasm2);
} }
#endif
/* if the opcode changed, validate and reoptimize */ /* if the opcode changed, validate and reoptimize */
if (inst->opcode != origop) if (inst->opcode != origop)

View File

@ -1295,9 +1295,7 @@ UINT32 jaguargpu_ctrl_r(int cpunum, offs_t offset)
{ {
UINT32 result; UINT32 result;
#if LOG_GPU_IO if (LOG_GPU_IO) logerror("%08X/%d:GPU read register @ F021%02X\n", activecpu_get_previouspc(), cpu_getactivecpu(), offset * 4);
logerror("%08X/%d:GPU read register @ F021%02X\n", activecpu_get_previouspc(), cpu_getactivecpu(), offset * 4);
#endif
/* switch to the target context */ /* switch to the target context */
cpuintrf_push_context(cpunum); cpuintrf_push_context(cpunum);
@ -1312,10 +1310,8 @@ void jaguargpu_ctrl_w(int cpunum, offs_t offset, UINT32 data, UINT32 mem_mask)
{ {
UINT32 oldval, newval; UINT32 oldval, newval;
#if LOG_GPU_IO if (LOG_GPU_IO && offset != G_HIDATA)
if (offset != G_HIDATA)
logerror("%08X/%d:GPU write register @ F021%02X = %08X\n", activecpu_get_previouspc(), cpu_getactivecpu(), offset * 4, data); logerror("%08X/%d:GPU write register @ F021%02X = %08X\n", activecpu_get_previouspc(), cpu_getactivecpu(), offset * 4, data);
#endif
/* switch to the target context */ /* switch to the target context */
cpuintrf_push_context(cpunum); cpuintrf_push_context(cpunum);
@ -1408,10 +1404,8 @@ UINT32 jaguardsp_ctrl_r(int cpunum, offs_t offset)
{ {
UINT32 result; UINT32 result;
#if LOG_DSP_IO if (LOG_DSP_IO && offset != D_FLAGS)
if (offset != D_FLAGS)
logerror("%08X/%d:DSP read register @ F1A1%02X\n", activecpu_get_previouspc(), cpu_getactivecpu(), offset * 4); logerror("%08X/%d:DSP read register @ F1A1%02X\n", activecpu_get_previouspc(), cpu_getactivecpu(), offset * 4);
#endif
/* switch to the target context */ /* switch to the target context */
cpuintrf_push_context(cpunum); cpuintrf_push_context(cpunum);
@ -1426,10 +1420,8 @@ void jaguardsp_ctrl_w(int cpunum, offs_t offset, UINT32 data, UINT32 mem_mask)
{ {
UINT32 oldval, newval; UINT32 oldval, newval;
#if LOG_DSP_IO if (LOG_DSP_IO && offset != D_FLAGS)
if (offset != D_FLAGS)
logerror("%08X/%d:DSP write register @ F1A1%02X = %08X\n", activecpu_get_previouspc(), cpu_getactivecpu(), offset * 4, data); logerror("%08X/%d:DSP write register @ F1A1%02X = %08X\n", activecpu_get_previouspc(), cpu_getactivecpu(), offset * 4, data);
#endif
/* switch to the target context */ /* switch to the target context */
cpuintrf_push_context(cpunum); cpuintrf_push_context(cpunum);

View File

@ -886,7 +886,8 @@ static void tlb_write_common(mips3_state *mips, int tlbindex)
static void tlb_entry_log_half(mips3_tlb_entry *entry, int tlbindex, int which) static void tlb_entry_log_half(mips3_tlb_entry *entry, int tlbindex, int which)
{ {
#if PRINTF_TLB if (PRINTF_TLB)
{
UINT64 hi = entry->entry_hi; UINT64 hi = entry->entry_hi;
UINT64 lo = entry->entry_lo[which]; UINT64 lo = entry->entry_lo[which];
UINT32 vpn = (((hi >> 13) & 0x07ffffff) << 1); UINT32 vpn = (((hi >> 13) & 0x07ffffff) << 1);
@ -903,5 +904,5 @@ static void tlb_entry_log_half(mips3_tlb_entry *entry, int tlbindex, int which)
printf("index=%08X pagesize=%08X vaddr=%08X%08X paddr=%08X%08X asid=%02X r=%X c=%X dvg=%c%c%c\n", printf("index=%08X pagesize=%08X vaddr=%08X%08X paddr=%08X%08X asid=%02X r=%X c=%X dvg=%c%c%c\n",
tlbindex, pagesize, (UINT32)(vaddr >> 32), (UINT32)vaddr, (UINT32)(paddr >> 32), (UINT32)paddr, tlbindex, pagesize, (UINT32)(vaddr >> 32), (UINT32)vaddr, (UINT32)(paddr >> 32), (UINT32)paddr,
asid, r, c, (lo & 4) ? 'd' : '.', (lo & 2) ? 'v' : '.', (lo & 1) ? 'g' : '.'); asid, r, c, (lo & 4) ? 'd' : '.', (lo & 2) ? 'v' : '.', (lo & 1) ? 'g' : '.');
#endif }
} }

View File

@ -260,8 +260,6 @@ static void mips_stop( void )
debugger_instruction_hook(Machine, mipscpu.pc ); debugger_instruction_hook(Machine, mipscpu.pc );
} }
#if LOG_BIOSCALL
static const struct static const struct
{ {
int address; int address;
@ -938,8 +936,6 @@ static void log_syscall( void )
logerror( "%08x: syscall %s\n", (unsigned int)activecpu_get_reg( MIPS_R31 ) - 8, buf ); logerror( "%08x: syscall %s\n", (unsigned int)activecpu_get_reg( MIPS_R31 ) - 8, buf );
} }
#endif
static UINT32 mips_cache_readword( UINT32 offset ) static UINT32 mips_cache_readword( UINT32 offset )
{ {
UINT32 data = 0; UINT32 data = 0;
@ -1450,12 +1446,10 @@ static void mips_common_exception( int exception, UINT32 romOffset, UINT32 ramOf
mips_set_cp0r( CP0_EPC, mipscpu.pc ); mips_set_cp0r( CP0_EPC, mipscpu.pc );
} }
#if LOG_BIOSCALL if( LOG_BIOSCALL && exception != EXC_INT )
if( exception != EXC_INT )
{ {
logerror( "%08x: Exception %d\n", mipscpu.pc, exception ); logerror( "%08x: Exception %d\n", mipscpu.pc, exception );
} }
#endif
mipscpu.delayr = 0; mipscpu.delayr = 0;
mipscpu.delayv = 0; mipscpu.delayv = 0;
@ -1799,10 +1793,7 @@ static int mips_execute( int cycles )
mips_ICount = cycles; mips_ICount = cycles;
do do
{ {
#if LOG_BIOSCALL if (LOG_BIOSCALL) log_bioscall();
log_bioscall();
#endif
debugger_instruction_hook(Machine, mipscpu.pc ); debugger_instruction_hook(Machine, mipscpu.pc );
mipscpu.op = cpu_readop32( mipscpu.pc ); mipscpu.op = cpu_readop32( mipscpu.pc );
@ -1848,9 +1839,7 @@ static int mips_execute( int cycles )
break; break;
case FUNCT_SYSCALL: case FUNCT_SYSCALL:
#if LOG_BIOSCALL if (LOG_BIOSCALL) log_syscall();
log_syscall();
#endif
mips_exception( EXC_SYS ); mips_exception( EXC_SYS );
break; break;

View File

@ -340,10 +340,7 @@
#define LOG 0 #define LOG 0
#define LOG_EXTRA 0 #define LOG_EXTRA 0
#ifndef LOG_IOT_EXTRA
#define LOG_IOT_EXTRA 0 #define LOG_IOT_EXTRA 0
#endif
static void execute_instruction(void); static void execute_instruction(void);

View File

@ -185,13 +185,12 @@ static void ppcdrc_recompile(drc_core *drc)
/* end the sequence */ /* end the sequence */
drc_end_sequence(drc); drc_end_sequence(drc);
#if LOG_CODE if (0)
{ {
char label[40]; char label[40];
sprintf(label, "Code @ %08X", ppc.pc); sprintf(label, "Code @ %08X", ppc.pc);
code_log(label, start, drc->cache_top); code_log(label, start, drc->cache_top);
} }
#endif
} }
static void update_counters(drc_core *drc) static void update_counters(drc_core *drc)

View File

@ -3966,11 +3966,12 @@ static int generate_instruction_3f(drcuml_block *block, compiler_state *compiler
static void log_add_disasm_comment(drcuml_block *block, UINT32 pc, UINT32 op) static void log_add_disasm_comment(drcuml_block *block, UINT32 pc, UINT32 op)
{ {
#if (LOG_UML)
char buffer[100]; char buffer[100];
ppc_dasm_one(buffer, pc, op); if (LOG_UML)
UML_COMMENT(block, "%08X: %s", pc, buffer); // comment {
#endif ppc_dasm_one(buffer, pc, op);
UML_COMMENT(block, "%08X: %s", pc, buffer); // comment
}
} }
@ -4149,14 +4150,16 @@ static void log_opcode_desc(drcuml_state *drcuml, const opcode_desc *desclist, i
char buffer[100]; char buffer[100];
/* disassemle the current instruction and output it to the log */ /* disassemle the current instruction and output it to the log */
#if (LOG_UML || LOG_NATIVE) if (LOG_UML || LOG_NATIVE)
if (desclist->flags & OPFLAG_VIRTUAL_NOOP) {
strcpy(buffer, "<virtual nop>"); if (desclist->flags & OPFLAG_VIRTUAL_NOOP)
strcpy(buffer, "<virtual nop>");
else
ppc_dasm_one(buffer, desclist->pc, *desclist->opptr.l);
}
else else
ppc_dasm_one(buffer, desclist->pc, *desclist->opptr.l); strcpy(buffer, "???");
#else
strcpy(buffer, "???");
#endif
drcuml_log_printf(drcuml, "%08X [%08X] t:%08X f:%s: %-30s", desclist->pc, desclist->physpc, desclist->targetpc, log_desc_flags_to_string(desclist->flags), buffer); drcuml_log_printf(drcuml, "%08X [%08X] t:%08X f:%s: %-30s", desclist->pc, desclist->physpc, desclist->targetpc, log_desc_flags_to_string(desclist->flags), buffer);
/* output register states */ /* output register states */

View File

@ -26,9 +26,7 @@
extern offs_t rsp_dasm_one(char *buffer, offs_t pc, UINT32 op); extern offs_t rsp_dasm_one(char *buffer, offs_t pc, UINT32 op);
#if LOG_INSTRUCTION_EXECUTION
static FILE *exec_output; static FILE *exec_output;
#endif
static rsp_config *config; static rsp_config *config;
@ -350,9 +348,8 @@ static void rsp_init(int index, int clock, const void *_config, int (*irqcallbac
int accumIdx; int accumIdx;
config = (rsp_config *)_config; config = (rsp_config *)_config;
#if LOG_INSTRUCTION_EXECUTION if (LOG_INSTRUCTION_EXECUTION)
exec_output = fopen("rsp_execute.txt", "wt"); exec_output = fopen("rsp_execute.txt", "wt");
#endif
rsp.irq_callback = irqcallback; rsp.irq_callback = irqcallback;
@ -427,9 +424,9 @@ static void rsp_exit(void)
} }
#endif #endif
#if LOG_INSTRUCTION_EXECUTION if (exec_output)
fclose(exec_output); fclose(exec_output);
#endif exec_output = NULL;
} }
static void rsp_reset(void) static void rsp_reset(void)
@ -2629,9 +2626,8 @@ static int rsp_execute(int cycles)
(config->sp_set_status)(0x3); (config->sp_set_status)(0x3);
rsp_icount = MIN(rsp_icount, 1); rsp_icount = MIN(rsp_icount, 1);
#if LOG_INSTRUCTION_EXECUTION if (LOG_INSTRUCTION_EXECUTION) fprintf(exec_output, "\n---------- break ----------\n\n");
fprintf(exec_output, "\n---------- break ----------\n\n");
#endif
break; break;
} }
case 0x20: /* ADD */ if (RDREG) RDVAL = (INT32)(RSVAL + RTVAL); break; case 0x20: /* ADD */ if (RDREG) RDVAL = (INT32)(RSVAL + RTVAL); break;
@ -2783,7 +2779,7 @@ static int rsp_execute(int cycles)
} }
} }
#if LOG_INSTRUCTION_EXECUTION if (LOG_INSTRUCTION_EXECUTION)
{ {
int i, l; int i, l;
static UINT32 prev_regs[32]; static UINT32 prev_regs[32];
@ -2827,7 +2823,6 @@ static int rsp_execute(int cycles)
fprintf(exec_output, "\n"); fprintf(exec_output, "\n");
} }
#endif
--rsp_icount; --rsp_icount;

View File

@ -31,4 +31,3 @@ enum {
}; };
#define PEEK_OP(pc) cpu_readop(pc) #define PEEK_OP(pc) cpu_readop(pc)
#define PEEK_NIBBLE(adr) cpu_readmem_16(adr)

View File

@ -39,12 +39,7 @@
// Defines ///////////////////////////////////////////////////////////// // Defines /////////////////////////////////////////////////////////////
#define PTMVERBOSE 0 #define PTMVERBOSE 0
#define PLOG(x) do { if (PTMVERBOSE) logerror x; } while (0)
#if PTMVERBOSE
#define PLOG(x) logerror x;
#else
#define PLOG(x)
#endif
enum enum
{ {

View File

@ -1345,7 +1345,7 @@ static void ide_controller_write(const device_config *device, offs_t offset, int
LOGPRINT(("IDE Unlocked master password\n")); LOGPRINT(("IDE Unlocked master password\n"));
ide->master_password_enable = 0; ide->master_password_enable = 0;
} }
#if PRINTF_IDE_PASSWORD if (PRINTF_IDE_PASSWORD)
{ {
int i; int i;
@ -1359,7 +1359,6 @@ static void ide_controller_write(const device_config *device, offs_t offset, int
} }
mame_printf_debug("\n"); mame_printf_debug("\n");
} }
#endif
/* clear the busy adn error flags */ /* clear the busy adn error flags */
ide->status &= ~IDE_STATUS_ERROR; ide->status &= ~IDE_STATUS_ERROR;
@ -1696,9 +1695,7 @@ static DEVICE_START( ide_controller )
ide->num_cylinders = hdinfo->cylinders; ide->num_cylinders = hdinfo->cylinders;
ide->num_sectors = hdinfo->sectors; ide->num_sectors = hdinfo->sectors;
ide->num_heads = hdinfo->heads; ide->num_heads = hdinfo->heads;
#if PRINTF_IDE_COMMANDS if (PRINTF_IDE_COMMANDS) mame_printf_debug("CHS: %d %d %d\n", ide->num_cylinders, ide->num_heads, ide->num_sectors);
mame_printf_debug("CHS: %d %d %d\n", ide->num_cylinders, ide->num_heads, ide->num_sectors);
#endif
} }
} }

View File

@ -19,7 +19,8 @@
#include "deprecat.h" #include "deprecat.h"
//#define LOG_LOAD #define LOG_LOAD 0
#define LOG(x) do { if (LOG_LOAD) debugload x; } while(0)
@ -163,7 +164,6 @@ const rom_entry *rom_next_chunk(const rom_entry *romp)
static void CLIB_DECL ATTR_PRINTF(1,2) debugload(const char *string, ...) static void CLIB_DECL ATTR_PRINTF(1,2) debugload(const char *string, ...)
{ {
#ifdef LOG_LOAD
static int opened; static int opened;
va_list arg; va_list arg;
FILE *f; FILE *f;
@ -176,7 +176,6 @@ static void CLIB_DECL ATTR_PRINTF(1,2) debugload(const char *string, ...)
va_end(arg); va_end(arg);
fclose(f); fclose(f);
} }
#endif
} }
@ -221,7 +220,7 @@ static int determine_bios_rom(rom_load_data *romdata, const rom_entry *romp)
bios_no = 1; bios_no = 1;
} }
debugload("Using System BIOS: %d\n", bios_no); LOG(("Using System BIOS: %d\n", bios_no));
return bios_no; return bios_no;
} }
@ -457,12 +456,12 @@ static void region_post_process(running_machine *machine, rom_load_data *romdata
UINT8 *base; UINT8 *base;
int i, j; int i, j;
debugload("+ datawidth=%d little=%d\n", datawidth, littleendian); LOG(("+ datawidth=%d little=%d\n", datawidth, littleendian));
/* if the region is inverted, do that now */ /* if the region is inverted, do that now */
if (regionflags & ROMREGION_INVERTMASK) if (regionflags & ROMREGION_INVERTMASK)
{ {
debugload("+ Inverting region\n"); LOG(("+ Inverting region\n"));
for (i = 0, base = regionbase; i < regionlength; i++) for (i = 0, base = regionbase; i < regionlength; i++)
*base++ ^= 0xff; *base++ ^= 0xff;
} }
@ -474,7 +473,7 @@ static void region_post_process(running_machine *machine, rom_load_data *romdata
if (datawidth > 1 && littleendian) if (datawidth > 1 && littleendian)
#endif #endif
{ {
debugload("+ Byte swapping region\n"); LOG(("+ Byte swapping region\n"));
for (i = 0, base = regionbase; i < regionlength; i += datawidth) for (i = 0, base = regionbase; i < regionlength; i += datawidth)
{ {
UINT8 temp[8]; UINT8 temp[8];
@ -562,7 +561,7 @@ static int read_rom_data(rom_load_data *romdata, const rom_entry *romp)
UINT8 *base = romdata->regionbase + ROM_GETOFFSET(romp); UINT8 *base = romdata->regionbase + ROM_GETOFFSET(romp);
int i; int i;
debugload("Loading ROM data: offs=%X len=%X mask=%02X group=%d skip=%d reverse=%d\n", ROM_GETOFFSET(romp), numbytes, datamask, groupsize, skip, reversed); LOG(("Loading ROM data: offs=%X len=%X mask=%02X group=%d skip=%d reverse=%d\n", ROM_GETOFFSET(romp), numbytes, datamask, groupsize, skip, reversed));
/* make sure the length was an even multiple of the group size */ /* make sure the length was an even multiple of the group size */
if (numbytes % groupsize != 0) if (numbytes % groupsize != 0)
@ -589,12 +588,12 @@ static int read_rom_data(rom_load_data *romdata, const rom_entry *romp)
UINT8 *bufptr = romdata->tempbuf; UINT8 *bufptr = romdata->tempbuf;
/* read as much as we can */ /* read as much as we can */
debugload(" Reading %X bytes into buffer\n", bytesleft); LOG((" Reading %X bytes into buffer\n", bytesleft));
if (rom_fread(romdata, romdata->tempbuf, bytesleft) != bytesleft) if (rom_fread(romdata, romdata->tempbuf, bytesleft) != bytesleft)
return 0; return 0;
numbytes -= bytesleft; numbytes -= bytesleft;
debugload(" Copying to %p\n", base); LOG((" Copying to %p\n", base));
/* unmasked cases */ /* unmasked cases */
if (datamask == 0xff) if (datamask == 0xff)
@ -650,7 +649,7 @@ static int read_rom_data(rom_load_data *romdata, const rom_entry *romp)
} }
} }
} }
debugload(" All done\n"); LOG((" All done\n"));
return ROM_GETLENGTH(romp); return ROM_GETLENGTH(romp);
} }
@ -753,7 +752,7 @@ static void process_rom_entries(rom_load_data *romdata, const rom_entry *romp)
int explength = 0; int explength = 0;
/* open the file */ /* open the file */
debugload("Opening ROM file: %s\n", ROM_GETNAME(romp)); LOG(("Opening ROM file: %s\n", ROM_GETNAME(romp)));
if (!open_rom_file(romdata, romp)) if (!open_rom_file(romdata, romp))
handle_missing_file(romdata, romp); handle_missing_file(romdata, romp);
@ -783,9 +782,9 @@ static void process_rom_entries(rom_load_data *romdata, const rom_entry *romp)
/* if this was the first use of this file, verify the length and CRC */ /* if this was the first use of this file, verify the length and CRC */
if (baserom) if (baserom)
{ {
debugload("Verifying length (%X) and checksums\n", explength); LOG(("Verifying length (%X) and checksums\n", explength));
verify_length_and_hash(romdata, ROM_GETNAME(baserom), explength, ROM_GETHASHDATA(baserom)); verify_length_and_hash(romdata, ROM_GETNAME(baserom), explength, ROM_GETHASHDATA(baserom));
debugload("Verify finished\n"); LOG(("Verify finished\n"));
} }
/* reseek to the start and clear the baserom so we don't reverify */ /* reseek to the start and clear the baserom so we don't reverify */
@ -799,7 +798,7 @@ static void process_rom_entries(rom_load_data *romdata, const rom_entry *romp)
/* close the file */ /* close the file */
if (romdata->file) if (romdata->file)
{ {
debugload("Closing ROM file\n"); LOG(("Closing ROM file\n"));
mame_fclose(romdata->file); mame_fclose(romdata->file);
romdata->file = NULL; romdata->file = NULL;
} }
@ -919,12 +918,12 @@ static chd_error open_disk_diff(const game_driver *drv, const rom_entry *romp, c
*diff_chd = NULL; *diff_chd = NULL;
/* try to open the diff */ /* try to open the diff */
debugload("Opening differencing image file: %s\n", astring_c(fname)); LOG(("Opening differencing image file: %s\n", astring_c(fname)));
filerr = mame_fopen(SEARCHPATH_IMAGE_DIFF, astring_c(fname), OPEN_FLAG_READ | OPEN_FLAG_WRITE, diff_file); filerr = mame_fopen(SEARCHPATH_IMAGE_DIFF, astring_c(fname), OPEN_FLAG_READ | OPEN_FLAG_WRITE, diff_file);
if (filerr != FILERR_NONE) if (filerr != FILERR_NONE)
{ {
/* didn't work; try creating it instead */ /* didn't work; try creating it instead */
debugload("Creating differencing image: %s\n", astring_c(fname)); LOG(("Creating differencing image: %s\n", astring_c(fname)));
filerr = mame_fopen(SEARCHPATH_IMAGE_DIFF, astring_c(fname), OPEN_FLAG_READ | OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, diff_file); filerr = mame_fopen(SEARCHPATH_IMAGE_DIFF, astring_c(fname), OPEN_FLAG_READ | OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, diff_file);
if (filerr != FILERR_NONE) if (filerr != FILERR_NONE)
{ {
@ -938,7 +937,7 @@ static chd_error open_disk_diff(const game_driver *drv, const rom_entry *romp, c
goto done; goto done;
} }
debugload("Opening differencing image file: %s\n", astring_c(fname)); LOG(("Opening differencing image file: %s\n", astring_c(fname)));
err = chd_open_file(mame_core_file(*diff_file), CHD_OPEN_READWRITE, source, diff_chd); err = chd_open_file(mame_core_file(*diff_file), CHD_OPEN_READWRITE, source, diff_chd);
if (err != CHDERR_NONE) if (err != CHDERR_NONE)
goto done; goto done;
@ -977,7 +976,7 @@ static void process_disk_entries(rom_load_data *romdata, const rom_entry *romp)
filename = astring_assemble_2(astring_alloc(), ROM_GETNAME(romp), ".chd"); filename = astring_assemble_2(astring_alloc(), ROM_GETNAME(romp), ".chd");
/* first open the source drive */ /* first open the source drive */
debugload("Opening disk image: %s\n", astring_c(filename)); LOG(("Opening disk image: %s\n", astring_c(filename)));
err = open_disk_image(Machine->gamedrv, romp, &chd.origfile, &chd.origchd); err = open_disk_image(Machine->gamedrv, romp, &chd.origfile, &chd.origchd);
if (err != CHDERR_NONE) if (err != CHDERR_NONE)
{ {
@ -1030,7 +1029,7 @@ static void process_disk_entries(rom_load_data *romdata, const rom_entry *romp)
} }
/* we're okay, add to the list of disks */ /* we're okay, add to the list of disks */
debugload("Assigning to handle %d\n", DISK_GETINDEX(romp)); LOG(("Assigning to handle %d\n", DISK_GETINDEX(romp)));
*chd_list_tailptr = auto_malloc(sizeof(**chd_list_tailptr)); *chd_list_tailptr = auto_malloc(sizeof(**chd_list_tailptr));
**chd_list_tailptr = chd; **chd_list_tailptr = chd;
chd_list_tailptr = &(*chd_list_tailptr)->next; chd_list_tailptr = &(*chd_list_tailptr)->next;
@ -1116,7 +1115,7 @@ void rom_init(running_machine *machine, const rom_entry *romp)
UINT32 regionflags = ROMREGION_GETFLAGS(region); UINT32 regionflags = ROMREGION_GETFLAGS(region);
int regiontype = ROMREGION_GETTYPE(region); int regiontype = ROMREGION_GETTYPE(region);
debugload("Processing region %02X (length=%X)\n", regiontype, regionlength); LOG(("Processing region %02X (length=%X)\n", regiontype, regionlength));
/* the first entry must be a region */ /* the first entry must be a region */
assert(ROMENTRY_ISREGION(region)); assert(ROMENTRY_ISREGION(region));
@ -1128,7 +1127,7 @@ void rom_init(running_machine *machine, const rom_entry *romp)
/* remember the base and length */ /* remember the base and length */
romdata.regionbase = new_memory_region(machine, regiontype, regionlength, regionflags); romdata.regionbase = new_memory_region(machine, regiontype, regionlength, regionflags);
romdata.regionlength = regionlength; romdata.regionlength = regionlength;
debugload("Allocated %X bytes @ %p\n", romdata.regionlength, romdata.regionbase); LOG(("Allocated %X bytes @ %p\n", romdata.regionlength, romdata.regionbase));
/* clear the region if it's requested */ /* clear the region if it's requested */
if (ROMREGION_ISERASE(region)) if (ROMREGION_ISERASE(region))
@ -1159,7 +1158,7 @@ void rom_init(running_machine *machine, const rom_entry *romp)
for (regnum = 0; regnum < REGION_MAX; regnum++) for (regnum = 0; regnum < REGION_MAX; regnum++)
if (regionlist[regnum]) if (regionlist[regnum])
{ {
debugload("Post-processing region %02X\n", regnum); LOG(("Post-processing region %02X\n", regnum));
region_post_process(machine, &romdata, regnum); region_post_process(machine, &romdata, regnum);
} }

View File

@ -334,9 +334,7 @@ static void bsmt2000_update(void *param, stream_sample_t **inputs, stream_sample
static void bsmt2000_reg_write(bsmt2000_chip *chip, offs_t offset, UINT16 data) static void bsmt2000_reg_write(bsmt2000_chip *chip, offs_t offset, UINT16 data)
{ {
#if LOG_COMMANDS if (LOG_COMMANDS) mame_printf_debug("BSMT write: reg %02X = %04X\n", offset, data);
mame_printf_debug("BSMT write: reg %02X = %04X\n", offset, data);
#endif
/* remember the last write */ /* remember the last write */
chip->last_register = offset; chip->last_register = offset;

View File

@ -186,10 +186,8 @@ static FILE *sample[1];
#endif #endif
#endif #endif
/* #define LOG_CYM_FILE */ #define LOG_CYM_FILE 0
#ifdef LOG_CYM_FILE static FILE * cymfile = NULL;
FILE * cymfile = NULL;
#endif
@ -1458,13 +1456,11 @@ static void OPLWriteReg(FM_OPL *OPL, int r, int v)
r &= 0xff; r &= 0xff;
v &= 0xff; v &= 0xff;
#ifdef LOG_CYM_FILE if (LOG_CYM_FILE && (cymfile) && (r!=0) )
if ((cymfile) && (r!=0) )
{ {
fputc( (unsigned char)r, cymfile ); fputc( (unsigned char)r, cymfile );
fputc( (unsigned char)v, cymfile ); fputc( (unsigned char)v, cymfile );
} }
#endif
switch(r&0xe0) switch(r&0xe0)
@ -1721,7 +1717,6 @@ static void OPLWriteReg(FM_OPL *OPL, int r, int v)
} }
} }
#ifdef LOG_CYM_FILE
static TIMER_CALLBACK( cymfile_callback ) static TIMER_CALLBACK( cymfile_callback )
{ {
if (cymfile) if (cymfile)
@ -1729,7 +1724,6 @@ static TIMER_CALLBACK( cymfile_callback )
fputc( (unsigned char)0, cymfile ); fputc( (unsigned char)0, cymfile );
} }
} }
#endif
/* lock/unlock for common table */ /* lock/unlock for common table */
static int OPL_LockTable(void) static int OPL_LockTable(void)
@ -1747,13 +1741,14 @@ static int OPL_LockTable(void)
return -1; return -1;
} }
#ifdef LOG_CYM_FILE if (LOG_CYM_FILE)
cymfile = fopen("3812_.cym","wb"); {
if (cymfile) cymfile = fopen("3812_.cym","wb");
timer_pulse ( ATTOTIME_IN_HZ(110), 0, cymfile_callback); /*110 Hz pulse timer*/ if (cymfile)
else timer_pulse ( ATTOTIME_IN_HZ(110), NULL, 0, cymfile_callback); /*110 Hz pulse timer*/
logerror("Could not create file 3812_.cym\n"); else
#endif logerror("Could not create file 3812_.cym\n");
}
return 0; return 0;
} }
@ -1768,11 +1763,9 @@ static void OPL_UnLockTable(void)
cur_chip = NULL; cur_chip = NULL;
OPLCloseTable(); OPLCloseTable();
#ifdef LOG_CYM_FILE if (cymfile)
fclose (cymfile); fclose (cymfile);
cymfile = NULL; cymfile = NULL;
#endif
} }
static void OPLResetChip(FM_OPL *OPL) static void OPLResetChip(FM_OPL *OPL)

View File

@ -45,7 +45,7 @@ Registers per channel:
#define LOG_SOUND(x) do { if (VERBOSE_SOUND) logerror x; } while (0) #define LOG_SOUND(x) do { if (VERBOSE_SOUND) logerror x; } while (0)
#define LOG_READ_WRITES(x) do { if (VERBOSE_READ_WRITES) logerror x; } while (0) #define LOG_READ_WRITES(x) do { if (VERBOSE_READ_WRITES) logerror x; } while (0)
//#define LOG_WAVE 1 #define LOG_WAVE 0
//#define ALT_MIX //#define ALT_MIX
#define GAELCO_NUM_CHANNELS 0x07 #define GAELCO_NUM_CHANNELS 0x07
@ -76,9 +76,7 @@ struct GAELCOSND
INT16 volume_table[VOLUME_LEVELS][256]; INT16 volume_table[VOLUME_LEVELS][256];
}; };
#ifdef LOG_WAVE static void * wavraw; /* raw waveform */
void * wavraw; /* raw waveform */
#endif
/*============================================================================ /*============================================================================
CG-1V/GAE1 Sound Update CG-1V/GAE1 Sound Update
@ -182,9 +180,8 @@ static void gaelco_update(void *param, stream_sample_t **inputs, stream_sample_t
buffer[1][j] = output_r; buffer[1][j] = output_r;
} }
#ifdef LOG_WAVE if (wavraw)
wav_add_data_16lr(wavraw, buffer[0], buffer[1], length); wav_add_data_32lr(wavraw, buffer[0], buffer[1], length, 0);
#endif
} }
/*============================================================================ /*============================================================================
@ -271,9 +268,8 @@ static void *gaelcosnd_start(sound_type sndtype, int sndindex, int clock, const
} }
} }
#ifdef LOG_WAVE if (LOG_WAVE)
wavraw = wav_open("gae1_snd.wav", 8000, 2); wavraw = wav_open("gae1_snd.wav", 8000, 2);
#endif
return info; return info;
} }
@ -291,9 +287,9 @@ static void *gaelco_cg1v_start(int sndindex, int clock, const void *config)
static void gaelco_stop(void *chip) static void gaelco_stop(void *chip)
{ {
#ifdef LOG_WAVE if (wavraw)
wav_close(wavraw); wav_close(wavraw);
#endif wavraw = NULL;
} }

View File

@ -73,7 +73,7 @@ static int caller_get_pc(void)
if(pc == 0x14b || pc == 0x26e || pc == 0x284 || pc == 0x28d || if(pc == 0x14b || pc == 0x26e || pc == 0x284 || pc == 0x28d ||
pc == 0x290 || pc == 0x299 || pc == 0x2a2 || pc == 0x2b3) { pc == 0x290 || pc == 0x299 || pc == 0x2a2 || pc == 0x2b3) {
int sp = z80_get_reg(Z80_SP); int sp = z80_get_reg(Z80_SP);
pc = cpu_readmem16(sp)|(cpu_readmem16((UINT16)(sp+1)) << 8); pc = program_read_word(sp)|(program_read_word((UINT16)(sp+1)) << 8);
} }
#endif #endif

View File

@ -246,9 +246,7 @@ INLINE void check_bounds( struct K053260_chip_def *ic, int channel ) {
ic->channels[channel].size = ic->rom_size - channel_start; ic->channels[channel].size = ic->rom_size - channel_start;
} }
#if LOG 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" );
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" );
#endif
} }
static void K053260_write( int chip, offs_t offset, UINT8 data ) static void K053260_write( int chip, offs_t offset, UINT8 data )

View File

@ -86,10 +86,8 @@ struct qsound_info
int pan_table[33]; /* Pan volume table */ int pan_table[33]; /* Pan volume table */
float frq_ratio; /* Frequency ratio */ float frq_ratio; /* Frequency ratio */
#if LOG_WAVE
FILE *fpRawDataL; FILE *fpRawDataL;
FILE *fpRawDataR; FILE *fpRawDataR;
#endif
}; };
/* Function prototypes */ /* Function prototypes */
@ -132,14 +130,11 @@ static void *qsound_start(int sndindex, int clock, const void *config)
qsound_update ); qsound_update );
} }
#if LOG_WAVE if (LOG_WAVE)
chip->fpRawDataR=fopen("qsoundr.raw", "w+b");
chip->fpRawDataL=fopen("qsoundl.raw", "w+b");
if (!chip->fpRawDataR || !chip->fpRawDataL)
{ {
return NULL; chip->fpRawDataR=fopen("qsoundr.raw", "w+b");
chip->fpRawDataL=fopen("qsoundl.raw", "w+b");
} }
#endif
/* state save */ /* state save */
for (i=0; i<QSOUND_CHANNELS; i++) for (i=0; i<QSOUND_CHANNELS; i++)
@ -163,16 +158,17 @@ static void *qsound_start(int sndindex, int clock, const void *config)
static void qsound_stop (void *_chip) static void qsound_stop (void *_chip)
{ {
#if LOG_WAVE struct qsound_info *chip = _chip;
if (chip->fpRawDataR) if (chip->fpRawDataR)
{ {
fclose(chip->fpRawDataR); fclose(chip->fpRawDataR);
} }
chip->fpRawDataR = NULL;
if (chip->fpRawDataL) if (chip->fpRawDataL)
{ {
fclose(chip->fpRawDataL); fclose(chip->fpRawDataL);
} }
#endif chip->fpRawDataL = NULL;
} }
WRITE8_HANDLER( qsound_data_h_w ) WRITE8_HANDLER( qsound_data_h_w )
@ -365,10 +361,10 @@ static void qsound_update( void *param, stream_sample_t **inputs, stream_sample_
pC++; pC++;
} }
#if LOG_WAVE if (chip->fpRawDataL)
fwrite(datap[0], length*sizeof(QSOUND_SAMPLE), 1, chip->fpRawDataL); fwrite(datap[0], length*sizeof(QSOUND_SAMPLE), 1, chip->fpRawDataL);
fwrite(datap[1], length*sizeof(QSOUND_SAMPLE), 1, chip->fpRawDataR); if (chip->fpRawDataR)
#endif fwrite(datap[1], length*sizeof(QSOUND_SAMPLE), 1, chip->fpRawDataR);
} }

View File

@ -31,6 +31,7 @@
#include "sndintrf.h" #include "sndintrf.h"
#include "streams.h" #include "streams.h"
#include "deprecat.h" #include "deprecat.h"
#include "wavwrite.h"
#include "sn76477.h" #include "sn76477.h"
@ -258,9 +259,7 @@ struct SN76477
UINT32 index; UINT32 index;
int sample_rate; /* from machine->sample_rate */ int sample_rate; /* from machine->sample_rate */
#if LOG_WAV
wav_file *file; /* handle of the wave file to produce */ wav_file *file; /* handle of the wave file to produce */
#endif
}; };
@ -907,10 +906,6 @@ static void log_complete_state(struct SN76477 *sn)
* *
*****************************************************************************/ *****************************************************************************/
#if LOG_WAV
#include "wavwrite.h"
static void open_wav_file(struct SN76477 *sn) static void open_wav_file(struct SN76477 *sn)
{ {
@ -934,8 +929,6 @@ static void add_wav_data(struct SN76477 *sn, INT16 data_l, INT16 data_r)
wav_add_data_16lr(sn->file, &data_l, &data_r, 1); wav_add_data_16lr(sn->file, &data_l, &data_r, 1);
} }
#endif
/***************************************************************************** /*****************************************************************************
@ -2280,48 +2273,45 @@ static void SN76477_update(void *param, stream_sample_t **inputs, stream_sample_
*/ */
*buffer++ = (((voltage_out - OUT_LOW_CLIP_THRESHOLD) / (OUT_CENTER_LEVEL_VOLTAGE - OUT_LOW_CLIP_THRESHOLD)) - 1) * 32767; *buffer++ = (((voltage_out - OUT_LOW_CLIP_THRESHOLD) / (OUT_CENTER_LEVEL_VOLTAGE - OUT_LOW_CLIP_THRESHOLD)) - 1) * 32767;
#if LOG_WAV if (LOG_WAV && LOG_WAV_ENABLED_ONLY && !sn->enable)
#if LOG_WAV_ENABLED_ONLY
if (!sn->enable)
#endif
{ {
INT16 log_data_l; INT16 log_data_l;
INT16 log_data_r; INT16 log_data_r;
#if LOG_WAV_VALUE_L == 0 switch (LOG_WAV_VALUE_L)
log_data_l = LOG_WAV_GAIN_FACTOR * voltage_out; {
#elif LOG_WAV_VALUE_L == 1 case 0:
log_data_l = LOG_WAV_GAIN_FACTOR * sn->enable; log_data_l = LOG_WAV_GAIN_FACTOR * voltage_out;
#elif LOG_WAV_VALUE_L == 2 log_data_r = LOG_WAV_GAIN_FACTOR * voltage_out;
log_data_l = LOG_WAV_GAIN_FACTOR * sn->one_shot_cap_voltage; break;
#elif LOG_WAV_VALUE_L == 3 case 1:
log_data_l = LOG_WAV_GAIN_FACTOR * sn->attack_decay_cap_voltage; log_data_l = LOG_WAV_GAIN_FACTOR * sn->enable;
#elif LOG_WAV_VALUE_L == 4 log_data_r = LOG_WAV_GAIN_FACTOR * sn->enable;
log_data_l = LOG_WAV_GAIN_FACTOR * sn->slf_cap_voltage; break;
#elif LOG_WAV_VALUE_L == 5 case 2:
log_data_l = LOG_WAV_GAIN_FACTOR * sn->vco_cap_voltage; log_data_l = LOG_WAV_GAIN_FACTOR * sn->one_shot_cap_voltage;
#elif LOG_WAV_VALUE_L == 6 log_data_r = LOG_WAV_GAIN_FACTOR * sn->one_shot_cap_voltage;
log_data_l = LOG_WAV_GAIN_FACTOR * sn->noise_filter_cap_voltage; break;
#endif case 3:
log_data_l = LOG_WAV_GAIN_FACTOR * sn->attack_decay_cap_voltage;
log_data_r = LOG_WAV_GAIN_FACTOR * sn->attack_decay_cap_voltage;
break;
case 4:
log_data_l = LOG_WAV_GAIN_FACTOR * sn->slf_cap_voltage;
log_data_r = LOG_WAV_GAIN_FACTOR * sn->slf_cap_voltage;
break;
case 5:
log_data_l = LOG_WAV_GAIN_FACTOR * sn->vco_cap_voltage;
log_data_r = LOG_WAV_GAIN_FACTOR * sn->vco_cap_voltage;
break;
case 6:
log_data_l = LOG_WAV_GAIN_FACTOR * sn->noise_filter_cap_voltage;
log_data_r = LOG_WAV_GAIN_FACTOR * sn->noise_filter_cap_voltage;
break;
}
#if LOG_WAV_VALUE_R == 0
log_data_r = LOG_WAV_GAIN_FACTOR * voltage_out;
#elif LOG_WAV_VALUE_R == 1
log_data_r = LOG_WAV_GAIN_FACTOR * sn->enable;
#elif LOG_WAV_VALUE_R == 2
log_data_r = LOG_WAV_GAIN_FACTOR * sn->one_shot_cap_voltage;
#elif LOG_WAV_VALUE_R == 3
log_data_r = LOG_WAV_GAIN_FACTOR * sn->attack_decay_cap_voltage;
#elif LOG_WAV_VALUE_R == 4
log_data_r = LOG_WAV_GAIN_FACTOR * sn->slf_cap_voltage;
#elif LOG_WAV_VALUE_R == 5
log_data_r = LOG_WAV_GAIN_FACTOR * sn->vco_cap_voltage;
#elif LOG_WAV_VALUE_R == 6
log_data_r = LOG_WAV_GAIN_FACTOR * sn->noise_filter_cap_voltage;
#endif
add_wav_data(sn, log_data_l, log_data_r); add_wav_data(sn, log_data_l, log_data_r);
} }
#endif
} }
} }
@ -2465,22 +2455,20 @@ static void *sn76477_start(int sndindex, int clock, const void *config)
log_complete_state(sn); log_complete_state(sn);
#if LOG_WAV if (LOG_WAV)
open_wav_file(sn); open_wav_file(sn);
#endif
return sn; return sn;
} }
#if LOG_WAV
static void sn76477_stop(void *token) static void sn76477_stop(void *token)
{ {
struct SN76477 *sn = (struct SN76477 *)token; struct SN76477 *sn = (struct SN76477 *)token;
close_wav_file(sn); if (LOG_WAV)
close_wav_file(sn);
} }
#endif
void sn76477_get_info(void *token, UINT32 state, sndinfo *info) void sn76477_get_info(void *token, UINT32 state, sndinfo *info)
@ -2488,9 +2476,7 @@ void sn76477_get_info(void *token, UINT32 state, sndinfo *info)
switch (state) switch (state)
{ {
case SNDINFO_PTR_START: info->start = sn76477_start; break; case SNDINFO_PTR_START: info->start = sn76477_start; break;
#if LOG_WAV
case SNDINFO_PTR_STOP: info->stop = sn76477_stop; break; case SNDINFO_PTR_STOP: info->stop = sn76477_stop; break;
#endif
case SNDINFO_STR_NAME: info->s = "SN76477"; break; case SNDINFO_STR_NAME: info->s = "SN76477"; break;
case SNDINFO_STR_CORE_FAMILY: info->s = "Analog"; break; case SNDINFO_STR_CORE_FAMILY: info->s = "Analog"; break;
case SNDINFO_STR_CORE_VERSION: info->s = "2.1"; break; case SNDINFO_STR_CORE_VERSION: info->s = "2.1"; break;

View File

@ -22,12 +22,9 @@
#undef USE_MAME_TIMERS #undef USE_MAME_TIMERS
#endif #endif
#endif #endif
#ifdef USE_MAME_TIMERS
/*#define LOG_CYM_FILE*/ #define LOG_CYM_FILE 0
#ifdef LOG_CYM_FILE static FILE * cymfile = NULL;
FILE * cymfile = NULL;
#endif
#endif
/* struct describing a single operator */ /* struct describing a single operator */
@ -1061,13 +1058,11 @@ void YM2151WriteReg(void *_chip, int r, int v)
chip->status |= 0x80; /* set busy flag for 64 chip clock cycles */ chip->status |= 0x80; /* set busy flag for 64 chip clock cycles */
#endif #endif
#ifdef LOG_CYM_FILE if (LOG_CYM_FILE && (cymfile) && (r!=0) )
if ((cymfile) && (r!=0) )
{ {
fputc( (unsigned char)r, cymfile ); fputc( (unsigned char)r, cymfile );
fputc( (unsigned char)v, cymfile ); fputc( (unsigned char)v, cymfile );
} }
#endif
switch(r & 0xe0){ switch(r & 0xe0){
@ -1364,13 +1359,11 @@ void YM2151WriteReg(void *_chip, int r, int v)
} }
#ifdef LOG_CYM_FILE
static TIMER_CALLBACK( cymfile_callback ) static TIMER_CALLBACK( cymfile_callback )
{ {
if (cymfile) if (cymfile)
fputc( (unsigned char)0, cymfile ); fputc( (unsigned char)0, cymfile );
} }
#endif
int YM2151ReadStatus( void *_chip ) int YM2151ReadStatus( void *_chip )
@ -1552,13 +1545,14 @@ void * YM2151Init(int index, int clock, int rate)
YM2151ResetChip(PSG); YM2151ResetChip(PSG);
/*logerror("YM2151[init] clock=%i sampfreq=%i\n", PSG->clock, PSG->sampfreq);*/ /*logerror("YM2151[init] clock=%i sampfreq=%i\n", PSG->clock, PSG->sampfreq);*/
#ifdef LOG_CYM_FILE if (LOG_CYM_FILE)
cymfile = fopen("2151_.cym","wb"); {
if (cymfile) cymfile = fopen("2151_.cym","wb");
timer_pulse ( ATTOTIME_IN_HZ(110), 0, cymfile_callback); /*110 Hz pulse timer*/ if (cymfile)
else timer_pulse ( ATTOTIME_IN_HZ(110), NULL, 0, cymfile_callback); /*110 Hz pulse timer*/
logerror("Could not create file 2151_.cym\n"); else
#endif logerror("Could not create file 2151_.cym\n");
}
return PSG; return PSG;
} }
@ -1571,10 +1565,9 @@ void YM2151Shutdown(void *_chip)
free (chip); free (chip);
#ifdef LOG_CYM_FILE if (cymfile)
fclose (cymfile); fclose (cymfile);
cymfile = NULL; cymfile = NULL;
#endif
#ifdef SAVE_SAMPLE #ifdef SAVE_SAMPLE
fclose(sample[8]); fclose(sample[8]);

View File

@ -160,10 +160,8 @@ static FILE *sample[1];
#endif #endif
#endif #endif
/*#define LOG_CYM_FILE*/ #define LOG_CYM_FILE 0
#ifdef LOG_CYM_FILE static FILE * cymfile = NULL;
FILE * cymfile = NULL;
#endif
@ -1661,13 +1659,11 @@ static void OPLLWriteReg(YM2413 *chip, int r, int v)
v &= 0xff; v &= 0xff;
#ifdef LOG_CYM_FILE if (LOG_CYM_FILE && (cymfile) && (r!=8) )
if ((cymfile) && (r!=8) )
{ {
fputc( (unsigned char)r, cymfile ); fputc( (unsigned char)r, cymfile );
fputc( (unsigned char)v, cymfile ); fputc( (unsigned char)v, cymfile );
} }
#endif
switch(r&0xf0) switch(r&0xf0)
@ -1916,7 +1912,6 @@ static void OPLLWriteReg(YM2413 *chip, int r, int v)
} }
} }
#ifdef LOG_CYM_FILE
static TIMER_CALLBACK( cymfile_callback ) static TIMER_CALLBACK( cymfile_callback )
{ {
if (cymfile) if (cymfile)
@ -1924,7 +1919,6 @@ static TIMER_CALLBACK( cymfile_callback )
fputc( (unsigned char)8, cymfile ); fputc( (unsigned char)8, cymfile );
} }
} }
#endif
/* lock/unlock for common table */ /* lock/unlock for common table */
static int OPLL_LockTable(void) static int OPLL_LockTable(void)
@ -1942,13 +1936,14 @@ static int OPLL_LockTable(void)
return -1; return -1;
} }
#ifdef LOG_CYM_FILE if (LOG_CYM_FILE)
cymfile = fopen("2413_.cym","wb"); {
if (cymfile) cymfile = fopen("2413_.cym","wb");
timer_pulse ( ATTOTIME_IN_HZ(110), 0, cymfile_callback); /*110 Hz pulse timer*/ if (cymfile)
else timer_pulse ( ATTOTIME_IN_HZ(110), NULL, 0, cymfile_callback); /*110 Hz pulse timer*/
logerror("Could not create file 2413_.cym\n"); else
#endif logerror("Could not create file 2413_.cym\n");
}
return 0; return 0;
} }
@ -1963,11 +1958,9 @@ static void OPLL_UnLockTable(void)
cur_chip = NULL; cur_chip = NULL;
OPLCloseTable(); OPLCloseTable();
#ifdef LOG_CYM_FILE if (cymfile)
fclose (cymfile); fclose (cymfile);
cymfile = NULL; cymfile = NULL;
#endif
} }
static void OPLLResetChip(YM2413 *chip) static void OPLLResetChip(YM2413 *chip)

View File

@ -133,10 +133,8 @@ static FILE *sample[1];
#endif #endif
#endif #endif
/*#define LOG_CYM_FILE*/ #define LOG_CYM_FILE 0
#ifdef LOG_CYM_FILE static FILE * cymfile = NULL;
FILE * cymfile = NULL;
#endif
@ -1623,8 +1621,7 @@ static void OPL3WriteReg(OPL3 *chip, int r, int v)
#ifdef LOG_CYM_FILE if (LOG_CYM_FILE && (cymfile) && ((r&255)!=0) && (r!=255) )
if ((cymfile) && ((r&255)!=0) && (r!=255) )
{ {
if (r>0xff) if (r>0xff)
fputc( (unsigned char)0xff, cymfile );/*mark writes to second register set*/ fputc( (unsigned char)0xff, cymfile );/*mark writes to second register set*/
@ -1632,7 +1629,6 @@ static void OPL3WriteReg(OPL3 *chip, int r, int v)
fputc( (unsigned char)r&0xff, cymfile ); fputc( (unsigned char)r&0xff, cymfile );
fputc( (unsigned char)v, cymfile ); fputc( (unsigned char)v, cymfile );
} }
#endif
if(r&0x100) if(r&0x100)
{ {
@ -2240,7 +2236,6 @@ static void OPL3WriteReg(OPL3 *chip, int r, int v)
} }
} }
#ifdef LOG_CYM_FILE
static TIMER_CALLBACK( cymfile_callback ) static TIMER_CALLBACK( cymfile_callback )
{ {
if (cymfile) if (cymfile)
@ -2248,7 +2243,6 @@ static TIMER_CALLBACK( cymfile_callback )
fputc( (unsigned char)0, cymfile ); fputc( (unsigned char)0, cymfile );
} }
} }
#endif
/* lock/unlock for common table */ /* lock/unlock for common table */
static int OPL3_LockTable(void) static int OPL3_LockTable(void)
@ -2266,13 +2260,14 @@ static int OPL3_LockTable(void)
return -1; return -1;
} }
#ifdef LOG_CYM_FILE if (LOG_CYM_FILE)
cymfile = fopen("ymf262_.cym","wb"); {
if (cymfile) cymfile = fopen("ymf262_.cym","wb");
timer_pulse ( ATTOTIME_IN_HZ(110), 0, cymfile_callback); /*110 Hz pulse timer*/ if (cymfile)
else timer_pulse ( ATTOTIME_IN_HZ(110), NULL, 0, cymfile_callback); /*110 Hz pulse timer*/
logerror("Could not create ymf262_.cym file\n"); else
#endif logerror("Could not create ymf262_.cym file\n");
}
return 0; return 0;
} }
@ -2287,11 +2282,9 @@ static void OPL3_UnLockTable(void)
cur_chip = NULL; cur_chip = NULL;
OPLCloseTable(); OPLCloseTable();
#ifdef LOG_CYM_FILE if (LOG_CYM_FILE)
fclose (cymfile); fclose (cymfile);
cymfile = NULL; cymfile = NULL;
#endif
} }
static void OPL3ResetChip(OPL3 *chip) static void OPL3ResetChip(OPL3 *chip)

View File

@ -203,7 +203,8 @@ double compute_resistor_weights(
} }
/* debug code */ /* debug code */
#if VERBOSE if (VERBOSE)
{
logerror("compute_resistor_weights(): scaler = %15.10f\n",scale); logerror("compute_resistor_weights(): scaler = %15.10f\n",scale);
logerror("min val :%i max val:%i Total number of networks :%i\n", minval, maxval, networks_no ); logerror("min val :%i max val:%i Total number of networks :%i\n", minval, maxval, networks_no );
@ -224,7 +225,7 @@ double compute_resistor_weights(
} }
logerror(" sum of scaled weights = %15.10f\n", sum ); logerror(" sum of scaled weights = %15.10f\n", sum );
} }
#endif }
/* debug end */ /* debug end */
return (scale); return (scale);
@ -396,7 +397,8 @@ double compute_resistor_net_outputs(
} }
/* debug code */ /* debug code */
#if VERBOSE if (VERBOSE)
{
logerror("compute_resistor_net_outputs(): scaler = %15.10f\n",scale); logerror("compute_resistor_net_outputs(): scaler = %15.10f\n",scale);
logerror("min val :%i max val:%i Total number of networks :%i\n", minval, maxval, networks_no ); logerror("min val :%i max val:%i Total number of networks :%i\n", minval, maxval, networks_no );
@ -418,7 +420,7 @@ double compute_resistor_net_outputs(
logerror(" combination %2i out=%10.5f (scaled = %15.10f)\n", n, o[i*(1<<MAX_RES_PER_NET)+n], os[i*(1<<MAX_RES_PER_NET)+n] ); logerror(" combination %2i out=%10.5f (scaled = %15.10f)\n", n, o[i*(1<<MAX_RES_PER_NET)+n], os[i*(1<<MAX_RES_PER_NET)+n] );
} }
} }
#endif }
/* debug end */ /* debug end */
free(o); free(o);

View File

@ -19,12 +19,7 @@
#include "v9938.h" #include "v9938.h"
#define VERBOSE 0 #define VERBOSE 0
#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
#if VERBOSE
#define LOG(x) logerror x
#else
#define LOG(x)
#endif
typedef struct { typedef struct {
/* general */ /* general */
@ -2423,7 +2418,6 @@ static UINT8 v9938_vdp_to_cpu (void)
/*************************************************************/ /*************************************************************/
static void ReportVdpCommand(register UINT8 Op) static void ReportVdpCommand(register UINT8 Op)
{ {
#if VERBOSE
static const char *const Ops[16] = static const char *const Ops[16] =
{ {
"SET ","AND ","OR ","XOR ","NOT ","NOP ","NOP ","NOP ", "SET ","AND ","OR ","XOR ","NOT ","NOP ","NOP ","NOP ",
@ -2434,7 +2428,6 @@ static void ReportVdpCommand(register UINT8 Op)
" ABRT"," ????"," ????"," ????","POINT"," PSET"," SRCH"," LINE", " ABRT"," ????"," ????"," ????","POINT"," PSET"," SRCH"," LINE",
" LMMV"," LMMM"," LMCM"," LMMC"," HMMV"," HMMM"," YMMM"," HMMC" " LMMV"," LMMM"," LMCM"," LMMC"," HMMV"," HMMM"," YMMM"," HMMC"
}; };
#endif
register UINT8 CL, CM, LO; register UINT8 CL, CM, LO;
register int SX,SY, DX,DY, NX,NY; register int SX,SY, DX,DY, NX,NY;

View File

@ -812,9 +812,7 @@ void chd_close(chd_file *chd)
if (chd->owns_file && chd->file != NULL) if (chd->owns_file && chd->file != NULL)
core_fclose(chd->file); core_fclose(chd->file);
#if PRINTF_MAX_HUNK if (PRINTF_MAX_HUNK) printf("Max hunk = %d/%d\n", chd->maxhunk, chd->header.totalhunks);
printf("Max hunk = %d/%d\n", chd->maxhunk, chd->header.totalhunks);
#endif
/* free our memory */ /* free our memory */
free(chd); free(chd);

View File

@ -4,6 +4,8 @@
#include "sound/discrete.h" #include "sound/discrete.h"
#include "sound/samples.h" #include "sound/samples.h"
#define BLOCKADE_LOG 0
/* /*
* This still needs the noise generator stuff, * This still needs the noise generator stuff,
* along with proper mixing and volume control * along with proper mixing and volume control
@ -42,18 +44,14 @@ WRITE8_HANDLER( blockade_sound_freq_w )
WRITE8_HANDLER( blockade_env_on_w ) WRITE8_HANDLER( blockade_env_on_w )
{ {
//#ifdef BLOCKADE_LOG if (BLOCKADE_LOG) mame_printf_debug("Boom Start\n");
// mame_printf_debug("Boom Start\n");
//#endif
sample_start(0,0,0); sample_start(0,0,0);
return; return;
} }
WRITE8_HANDLER( blockade_env_off_w ) WRITE8_HANDLER( blockade_env_off_w )
{ {
//#ifdef BLOCKADE_LOG if (BLOCKADE_LOG) mame_printf_debug("Boom End\n");
// mame_printf_debug("Boom End\n");
//#endif
return; return;
} }

View File

@ -286,9 +286,7 @@ static void tmek_update_mode(offs_t offset)
static void tmek_protection_w(offs_t offset, UINT16 data) static void tmek_protection_w(offs_t offset, UINT16 data)
{ {
#if LOG_PROTECTION if (LOG_PROTECTION) logerror("%06X:Protection W@%06X = %04X\n", activecpu_get_previouspc(), offset, data);
logerror("%06X:Protection W@%06X = %04X\n", activecpu_get_previouspc(), offset, data);
#endif
/* track accesses */ /* track accesses */
tmek_update_mode(offset); tmek_update_mode(offset);
@ -303,9 +301,7 @@ static void tmek_protection_w(offs_t offset, UINT16 data)
static void tmek_protection_r(offs_t offset, UINT16 *data) static void tmek_protection_r(offs_t offset, UINT16 *data)
{ {
#if LOG_PROTECTION if (LOG_PROTECTION) logerror("%06X:Protection R@%06X\n", activecpu_get_previouspc(), offset);
logerror("%06X:Protection R@%06X\n", activecpu_get_previouspc(), offset);
#endif
/* track accesses */ /* track accesses */
tmek_update_mode(offset); tmek_update_mode(offset);
@ -347,21 +343,21 @@ static void primage_update_mode(offs_t offset)
/* this is from the code at $20f90 */ /* this is from the code at $20f90 */
if (protaddr[1] == 0xdcc7c4 && protaddr[2] == 0xdcc7c4 && protaddr[3] == 0xdc4010) if (protaddr[1] == 0xdcc7c4 && protaddr[2] == 0xdcc7c4 && protaddr[3] == 0xdc4010)
{ {
// logerror("prot:Entering mode 1\n"); if (LOG_PROTECTION) logerror("prot:Entering mode 1\n");
protmode = 1; protmode = 1;
} }
/* this is from the code at $27592 */ /* this is from the code at $27592 */
if (protaddr[0] == 0xdcc7ca && protaddr[1] == 0xdcc7ca && protaddr[2] == 0xdcc7c6 && protaddr[3] == 0xdc4022) if (protaddr[0] == 0xdcc7ca && protaddr[1] == 0xdcc7ca && protaddr[2] == 0xdcc7c6 && protaddr[3] == 0xdc4022)
{ {
// logerror("prot:Entering mode 2\n"); if (LOG_PROTECTION) logerror("prot:Entering mode 2\n");
protmode = 2; protmode = 2;
} }
/* this is from the code at $3d8dc */ /* this is from the code at $3d8dc */
if (protaddr[0] == 0xdcc7c0 && protaddr[1] == 0xdcc7c0 && protaddr[2] == 0xdc80f2 && protaddr[3] == 0xdc7af2) if (protaddr[0] == 0xdcc7c0 && protaddr[1] == 0xdcc7c0 && protaddr[2] == 0xdc80f2 && protaddr[3] == 0xdc7af2)
{ {
// logerror("prot:Entering mode 3\n"); if (LOG_PROTECTION) logerror("prot:Entering mode 3\n");
protmode = 3; protmode = 3;
} }
} }
@ -371,8 +367,8 @@ static void primage_update_mode(offs_t offset)
static void primrage_protection_w(offs_t offset, UINT16 data) static void primrage_protection_w(offs_t offset, UINT16 data)
{ {
#if LOG_PROTECTION if (LOG_PROTECTION)
{ {
UINT32 pc = activecpu_get_previouspc(); UINT32 pc = activecpu_get_previouspc();
switch (pc) switch (pc)
{ {
@ -409,8 +405,7 @@ static void primrage_protection_w(offs_t offset, UINT16 data)
logerror("%06X:Unknown protection W@%06X = %04X\n", activecpu_get_previouspc(), offset, data); logerror("%06X:Unknown protection W@%06X = %04X\n", activecpu_get_previouspc(), offset, data);
break; break;
} }
} }
#endif
/* mask = 0x78fff */ /* mask = 0x78fff */
@ -424,7 +419,7 @@ static void primrage_protection_w(offs_t offset, UINT16 data)
if (protmode == 2) if (protmode == 2)
{ {
int temp = (offset - 0xdc7800) / 2; int temp = (offset - 0xdc7800) / 2;
// logerror("prot:mode 2 param = %04X\n", temp); if (LOG_PROTECTION) logerror("prot:mode 2 param = %04X\n", temp);
protresult = temp * 0x6915 + 0x6915; protresult = temp * 0x6915 + 0x6915;
} }
@ -432,7 +427,7 @@ static void primrage_protection_w(offs_t offset, UINT16 data)
{ {
if (offset == 0xdc4700) if (offset == 0xdc4700)
{ {
// logerror("prot:Clearing mode 3\n"); if (LOG_PROTECTION) logerror("prot:Clearing mode 3\n");
protmode = 0; protmode = 0;
} }
} }
@ -445,7 +440,7 @@ static void primrage_protection_r(offs_t offset, UINT16 *data)
/* track accesses */ /* track accesses */
primage_update_mode(offset); primage_update_mode(offset);
#if LOG_PROTECTION if (LOG_PROTECTION)
{ {
UINT32 pc = activecpu_get_previouspc(); UINT32 pc = activecpu_get_previouspc();
UINT32 p1, p2, a6; UINT32 p1, p2, a6;
@ -468,8 +463,8 @@ static void primrage_protection_r(offs_t offset, UINT16 *data)
break; break;
case 0x275cc: case 0x275cc:
a6 = activecpu_get_reg(M68K_A6); a6 = activecpu_get_reg(M68K_A6);
p1 = (cpu_readmem24bedw_word(a6+8) << 16) | cpu_readmem24bedw_word(a6+10); p1 = (program_read_word(a6+8) << 16) | program_read_word(a6+10);
p2 = (cpu_readmem24bedw_word(a6+12) << 16) | cpu_readmem24bedw_word(a6+14); p2 = (program_read_word(a6+12) << 16) | program_read_word(a6+14);
logerror("Known Protection @ 275BC(%08X, %08X): R@%06X ", p1, p2, offset); logerror("Known Protection @ 275BC(%08X, %08X): R@%06X ", p1, p2, offset);
break; break;
case 0x275d2: case 0x275d2:
@ -486,7 +481,7 @@ static void primrage_protection_r(offs_t offset, UINT16 *data)
/* protection code from 3d8dc - 3d95a */ /* protection code from 3d8dc - 3d95a */
case 0x3d8f4: case 0x3d8f4:
a6 = activecpu_get_reg(M68K_A6); a6 = activecpu_get_reg(M68K_A6);
p1 = (cpu_readmem24bedw_word(a6+12) << 16) | cpu_readmem24bedw_word(a6+14); p1 = (program_read_word(a6+12) << 16) | program_read_word(a6+14);
logerror("Known Protection @ 3D8F4(%08X): R@%06X ", p1, offset); logerror("Known Protection @ 3D8F4(%08X): R@%06X ", p1, offset);
break; break;
case 0x3d8fa: case 0x3d8fa:
@ -497,7 +492,7 @@ static void primrage_protection_r(offs_t offset, UINT16 *data)
/* protection code from 437fa - 43860 */ /* protection code from 437fa - 43860 */
case 0x43814: case 0x43814:
a6 = activecpu_get_reg(M68K_A6); a6 = activecpu_get_reg(M68K_A6);
p1 = cpu_readmem24bedw(a6+15); p1 = program_read_dword(a6+14) & 0xffffff;
logerror("Known Protection @ 43814(%08X): R@%06X ", p1, offset); logerror("Known Protection @ 43814(%08X): R@%06X ", p1, offset);
break; break;
case 0x4381c: case 0x4381c:
@ -514,7 +509,6 @@ static void primrage_protection_r(offs_t offset, UINT16 *data)
break; break;
} }
} }
#endif
/* handle specific reads */ /* handle specific reads */
switch (offset) switch (offset)
@ -533,7 +527,7 @@ static void primrage_protection_r(offs_t offset, UINT16 *data)
{ {
*data = protresult; *data = protresult;
protmode = 0; protmode = 0;
// logerror("prot:Clearing mode 2\n"); if (LOG_PROTECTION) logerror("prot:Clearing mode 2\n");
} }
break; break;
@ -541,7 +535,7 @@ static void primrage_protection_r(offs_t offset, UINT16 *data)
if (protmode == 1) if (protmode == 1)
{ {
protmode = 0; protmode = 0;
// logerror("prot:Clearing mode 1\n"); if (LOG_PROTECTION) logerror("prot:Clearing mode 1\n");
} }
break; break;
} }

View File

@ -33,7 +33,7 @@ Notes: Support is complete with the exception of the noise generator.
#include "sound/samples.h" #include "sound/samples.h"
#include "sound/discrete.h" #include "sound/discrete.h"
/* #define BLOCKADE_LOG 1 */ #define BLOCKADE_LOG 0
/* These are used to simulate coin latch circuitry */ /* These are used to simulate coin latch circuitry */
@ -86,9 +86,7 @@ static WRITE8_HANDLER( blockade_coin_latch_w )
{ {
if (data & 0x80) if (data & 0x80)
{ {
#ifdef BLOCKADE_LOG if (BLOCKADE_LOG) mame_printf_debug("Reset Coin Latch\n");
mame_printf_debug("Reset Coin Latch\n");
#endif
if (just_been_reset) if (just_been_reset)
{ {
just_been_reset = 0; just_been_reset = 0;
@ -100,15 +98,11 @@ static WRITE8_HANDLER( blockade_coin_latch_w )
if (data & 0x20) if (data & 0x20)
{ {
#ifdef BLOCKADE_LOG if (BLOCKADE_LOG) mame_printf_debug("Pin 19 High\n");
mame_printf_debug("Pin 19 High\n");
#endif
} }
else else
{ {
#ifdef BLOCKADE_LOG if (BLOCKADE_LOG) mame_printf_debug("Pin 19 Low\n");
mame_printf_debug("Pin 19 Low\n");
#endif
} }
return; return;

View File

@ -32,12 +32,7 @@
*************************************/ *************************************/
#define LOG_FDC_COMMANDS 0 #define LOG_FDC_COMMANDS 0
#define FDC_LOG(x) do { if (LOG_FDC_COMMANDS) mame_printf_debug x; } while(0)
#if LOG_FDC_COMMANDS
#define FDC_LOG(x) mame_printf_debug x
#else
#define FDC_LOG(x)
#endif
enum enum

View File

@ -550,9 +550,10 @@ static WRITE32_HANDLER ( rabbit_rombank_w )
static WRITE32_HANDLER( rabbit_audio_w ) static WRITE32_HANDLER( rabbit_audio_w )
{ {
#if VERBOSE_AUDIO_LOG
int reg, voice, base, i; int reg, voice, base, i;
if (VERBOSE_AUDIO_LOG)
{
if (mem_mask == 0xffff0000) if (mem_mask == 0xffff0000)
{ {
reg = offset*2; reg = offset*2;
@ -602,7 +603,7 @@ static WRITE32_HANDLER( rabbit_audio_w )
logerror("Unknown write %04x to global reg %d\n", data, reg); logerror("Unknown write %04x to global reg %d\n", data, reg);
} }
} }
#endif }
} }
#define BLITCMDLOG 0 #define BLITCMDLOG 0

View File

@ -174,10 +174,12 @@ static READ16_HANDLER( thunderj_atarivc_r )
memory (which is what it does if this interrupt test fails -- see the code memory (which is what it does if this interrupt test fails -- see the code
at $1E56 to see!) */ at $1E56 to see!) */
/* Use these lines to detect when things go south: /* Use these lines to detect when things go south: */
if (cpu_readmem24bew_word(0x163482) > 0xfff) #if 0
mame_printf_debug("You're screwed!");*/ if (program_read_word(0x163482) > 0xfff)
mame_printf_debug("You're screwed!");
#endif
return atarivc_r(machine->primary_screen, offset); return atarivc_r(machine->primary_screen, offset);
} }

View File

@ -185,9 +185,7 @@ static TIMER_CALLBACK( m68k_asic65_deferred_w )
WRITE16_HANDLER( asic65_data_w ) WRITE16_HANDLER( asic65_data_w )
{ {
/* logging */ /* logging */
#if LOG_ASIC if (LOG_ASIC && !asic65_log) asic65_log = fopen("asic65.log", "w");
if (!asic65_log) asic65_log = fopen("asic65.log", "w");
#endif
/* rom-based use a deferred write mechanism */ /* rom-based use a deferred write mechanism */
if (asic65_type == ASIC65_ROMBASED) if (asic65_type == ASIC65_ROMBASED)
@ -434,9 +432,7 @@ READ16_HANDLER( asic65_r )
} }
} }
#if LOG_ASIC if (LOG_ASIC && !asic65_log) asic65_log = fopen("asic65.log", "w");
if (!asic65_log) asic65_log = fopen("asic65.log", "w");
#endif
if (asic65_log) fprintf(asic65_log, " (R=%04X)", result); if (asic65_log) fprintf(asic65_log, " (R=%04X)", result);
return result; return result;

View File

@ -241,7 +241,6 @@ static UINT32 akiko_c2p_read(void)
return val; return val;
} }
#if LOG_AKIKO
static const char *const akiko_reg_names[] = static const char *const akiko_reg_names[] =
{ {
/*0*/ "ID", /*0*/ "ID",
@ -272,7 +271,6 @@ const char* get_akiko_reg_name(int reg)
return "???"; return "???";
} }
} }
#endif
/************************************* /*************************************
* *
@ -358,9 +356,7 @@ static void akiko_set_cd_status( UINT32 status )
if ( akiko.cdrom_status[0] & akiko.cdrom_status[1] ) if ( akiko.cdrom_status[0] & akiko.cdrom_status[1] )
{ {
#if LOG_AKIKO_CD if (LOG_AKIKO_CD) logerror( "Akiko CD IRQ\n" );
logerror( "Akiko CD IRQ\n" );
#endif
amiga_custom_w(Machine, REG_INTREQ, 0x8000 | INTENA_PORTS, 0xffff); amiga_custom_w(Machine, REG_INTREQ, 0x8000 | INTENA_PORTS, 0xffff);
} }
} }
@ -462,9 +458,7 @@ static TIMER_CALLBACK(akiko_dma_proc)
} }
} }
#if LOG_AKIKO_CD if (LOG_AKIKO_CD) logerror( "DMA: sector %d - address %08x\n", akiko.cdrom_lba_cur, akiko.cdrom_address[0] + (index*4096) );
logerror( "DMA: sector %d - address %08x\n", akiko.cdrom_lba_cur, akiko.cdrom_address[0] + (index*4096) );
#endif
for( i = 0; i < 2352; i += 2 ) for( i = 0; i < 2352; i += 2 )
{ {
@ -551,9 +545,7 @@ static TIMER_CALLBACK( akiko_cd_delayed_cmd )
if ( param == 0x05 ) if ( param == 0x05 )
{ {
#if LOG_AKIKO_CD if (LOG_AKIKO_CD) logerror( "AKIKO: Completing Command %d\n", param );
logerror( "AKIKO: Completing Command %d\n", param );
#endif
resp[0] = 0x06; resp[0] = 0x06;
@ -591,9 +583,7 @@ static void akiko_update_cdrom( void )
cmd &= 0x0f; cmd &= 0x0f;
#if LOG_AKIKO_CD if (LOG_AKIKO_CD) logerror( "CDROM command: %02X\n", cmd );
logerror( "CDROM command: %02X\n", cmd );
#endif
if ( cmd == 0x02 ) /* pause audio */ if ( cmd == 0x02 ) /* pause audio */
{ {
@ -651,9 +641,7 @@ static void akiko_update_cdrom( void )
if ( cmdbuf[7] == 0x80 ) if ( cmdbuf[7] == 0x80 )
{ {
#if LOG_AKIKO_CD if (LOG_AKIKO_CD) logerror( "AKIKO CD: PC:%06x Data read - start lba: %08x - end lba: %08x\n", safe_activecpu_get_pc(), startpos, endpos );
logerror( "AKIKO CD: PC:%06x Data read - start lba: %08x - end lba: %08x\n", safe_activecpu_get_pc(), startpos, endpos );
#endif
akiko.cdrom_speed = (cmdbuf[8] & 0x40) ? 2 : 1; akiko.cdrom_speed = (cmdbuf[8] & 0x40) ? 2 : 1;
akiko.cdrom_lba_start = startpos; akiko.cdrom_lba_start = startpos;
akiko.cdrom_lba_end = endpos; akiko.cdrom_lba_end = endpos;
@ -668,9 +656,7 @@ static void akiko_update_cdrom( void )
} }
else else
{ {
#if LOG_AKIKO_CD if (LOG_AKIKO_CD) logerror( "AKIKO CD: Seek - start lba: %08x - end lba: %08x\n", startpos, endpos );
logerror( "AKIKO CD: Seek - start lba: %08x - end lba: %08x\n", startpos, endpos );
#endif
akiko.cdrom_track_index = 0; akiko.cdrom_track_index = 0;
for( i = 0; i < cdrom_get_last_track(akiko.cdrom); i++ ) for( i = 0; i < cdrom_get_last_track(akiko.cdrom); i++ )
@ -763,12 +749,10 @@ READ32_HANDLER(amiga_akiko32_r)
{ {
UINT32 retval; UINT32 retval;
#if LOG_AKIKO if ( LOG_AKIKO && offset < (0x30/4) )
if ( offset < (0x30/4) )
{ {
logerror( "Reading AKIKO reg %0x [%s] at PC=%06x\n", offset, get_akiko_reg_name(offset), activecpu_get_pc() ); logerror( "Reading AKIKO reg %0x [%s] at PC=%06x\n", offset, get_akiko_reg_name(offset), activecpu_get_pc() );
} }
#endif
switch( offset ) switch( offset )
{ {
@ -825,12 +809,10 @@ READ32_HANDLER(amiga_akiko32_r)
WRITE32_HANDLER(amiga_akiko32_w) WRITE32_HANDLER(amiga_akiko32_w)
{ {
#if LOG_AKIKO if ( LOG_AKIKO && offset < (0x30/4) )
if ( offset < (0x30/4) )
{ {
logerror( "Writing AKIKO reg %0x [%s] with %08x at PC=%06x\n", offset, get_akiko_reg_name(offset), data, activecpu_get_pc() ); logerror( "Writing AKIKO reg %0x [%s] with %08x at PC=%06x\n", offset, get_akiko_reg_name(offset), data, activecpu_get_pc() );
} }
#endif
switch( offset ) switch( offset )
{ {
@ -869,9 +851,7 @@ WRITE32_HANDLER(amiga_akiko32_w)
break; break;
case 0x20/4: /* CDROM DMA SECTOR READ REQUEST WRITE */ case 0x20/4: /* CDROM DMA SECTOR READ REQUEST WRITE */
#if LOG_AKIKO_CD if (LOG_AKIKO_CD) logerror( "Read Req mask W: data %08x - mem mask %08x\n", data, mem_mask );
logerror( "Read Req mask W: data %08x - mem mask %08x\n", data, mem_mask );
#endif
if ( ACCESSING_BITS_16_31 ) if ( ACCESSING_BITS_16_31 )
{ {
akiko.cdrom_readreqmask = (data >> 16); akiko.cdrom_readreqmask = (data >> 16);
@ -880,9 +860,7 @@ WRITE32_HANDLER(amiga_akiko32_w)
break; break;
case 0x24/4: /* CDROM DMA ENABLE? */ case 0x24/4: /* CDROM DMA ENABLE? */
#if LOG_AKIKO_CD if (LOG_AKIKO_CD) logerror( "DMA enable W: data %08x - mem mask %08x\n", data, mem_mask );
logerror( "DMA enable W: data %08x - mem mask %08x\n", data, mem_mask );
#endif
if ( ( akiko.cdrom_dmacontrol ^ data ) & 0x04000000 ) if ( ( akiko.cdrom_dmacontrol ^ data ) & 0x04000000 )
{ {
if ( data & 0x04000000 ) if ( data & 0x04000000 )

View File

@ -912,8 +912,7 @@ WRITE16_HANDLER( hd68k_adsp_buffer_w )
static TIMER_CALLBACK( deferred_adsp_bank_switch ) static TIMER_CALLBACK( deferred_adsp_bank_switch )
{ {
#if LOG_COMMANDS if (LOG_COMMANDS && m68k_adsp_buffer_bank != param && input_code_pressed(KEYCODE_L))
if (m68k_adsp_buffer_bank != param && input_code_pressed(KEYCODE_L))
{ {
static FILE *commands; static FILE *commands;
if (!commands) commands = fopen("commands.log", "w"); if (!commands) commands = fopen("commands.log", "w");
@ -956,7 +955,7 @@ static TIMER_CALLBACK( deferred_adsp_bank_switch )
fprintf(commands, " %04X\n", *current++); fprintf(commands, " %04X\n", *current++);
} }
} }
#endif
m68k_adsp_buffer_bank = param; m68k_adsp_buffer_bank = param;
logerror("ADSP bank = %d\n", param); logerror("ADSP bank = %d\n", param);
} }

View File

@ -794,13 +794,8 @@ static UINT8 bit_xor;
static struct slapstic_data slapstic; static struct slapstic_data slapstic;
#if LOG_SLAPSTIC static void slapstic_log(offs_t offset);
static void slapstic_log(offs_t offset); static FILE *slapsticlog;
static FILE *slapsticlog;
#else
#define slapstic_log(o)
#endif
/************************************* /*************************************
@ -1123,7 +1118,8 @@ int slapstic_tweak(offs_t offset)
} }
/* log this access */ /* log this access */
slapstic_log(offset); if (LOG_SLAPSTIC)
slapstic_log(offset);
/* return the active bank */ /* return the active bank */
return current_bank; return current_bank;
@ -1137,7 +1133,6 @@ int slapstic_tweak(offs_t offset)
* *
*************************************/ *************************************/
#if LOG_SLAPSTIC
static void slapstic_log(offs_t offset) static void slapstic_log(offs_t offset)
{ {
static attotime last_time; static attotime last_time;
@ -1192,4 +1187,3 @@ static void slapstic_log(offs_t offset)
fflush(slapsticlog); fflush(slapsticlog);
} }
} }
#endif

View File

@ -912,11 +912,7 @@ static void process_object_list(running_machine *machine, int vc, UINT16 *_scanl
for (x = 0; x < 336; x++) for (x = 0; x < 336; x++)
scanline[x] = gpu_regs[BG]; scanline[x] = gpu_regs[BG];
#if LOG_OBJECTS logit = LOG_OBJECTS;
logit = (y == cliprect->min_y);
#else
logit = 0;
#endif
/* fetch the object pointer */ /* fetch the object pointer */
objdata = (UINT32 *)get_jaguar_memory((gpu_regs[OLP_H] << 16) | gpu_regs[OLP_L]); objdata = (UINT32 *)get_jaguar_memory((gpu_regs[OLP_H] << 16) | gpu_regs[OLP_L]);

View File

@ -551,7 +551,7 @@ static void blitter_run(void)
#endif #endif
#if LOG_BLITTER_STATS if (LOG_BLITTER_STATS)
{ {
static UINT32 blitter_stats[1000][4]; static UINT32 blitter_stats[1000][4];
static UINT64 blitter_pixels[1000]; static UINT64 blitter_pixels[1000];
@ -584,7 +584,6 @@ if (++reps % 100 == 99)
mame_printf_debug("---\n"); mame_printf_debug("---\n");
} }
} }
#endif
generic_blitter(blitter_regs[B_CMD], blitter_regs[A1_FLAGS], blitter_regs[A2_FLAGS]); generic_blitter(blitter_regs[B_CMD], blitter_regs[A1_FLAGS], blitter_regs[A2_FLAGS]);
profiler_mark(PROFILER_END); profiler_mark(PROFILER_END);

View File

@ -718,7 +718,8 @@ WRITE16_HANDLER( midtunit_dma_w )
/* determine the offset */ /* determine the offset */
gfxoffset = dma_register[DMA_OFFSETLO] | (dma_register[DMA_OFFSETHI] << 16); gfxoffset = dma_register[DMA_OFFSETLO] | (dma_register[DMA_OFFSETHI] << 16);
#if LOG_DMA if (LOG_DMA)
{
if (input_code_pressed(KEYCODE_L)) if (input_code_pressed(KEYCODE_L))
{ {
logerror("DMA command %04X: (bpp=%d skip=%d xflip=%d yflip=%d preskip=%d postskip=%d)\n", logerror("DMA command %04X: (bpp=%d skip=%d xflip=%d yflip=%d preskip=%d postskip=%d)\n",
@ -734,8 +735,7 @@ WRITE16_HANDLER( midtunit_dma_w )
dma_register[DMA_CONFIG]); dma_register[DMA_CONFIG]);
logerror("----\n"); logerror("----\n");
} }
#endif }
/* special case: drawing mode C doesn't need to know about any pixel data */ /* special case: drawing mode C doesn't need to know about any pixel data */
if ((command & 0x0f) == 0x0c) if ((command & 0x0f) == 0x0c)
gfxoffset = 0; gfxoffset = 0;

View File

@ -457,7 +457,8 @@ WRITE16_HANDLER( midyunit_dma_w )
if (!(command & 0x8000)) if (!(command & 0x8000))
return; return;
#if LOG_DMA if (LOG_DMA)
{
if (input_code_pressed(KEYCODE_L)) if (input_code_pressed(KEYCODE_L))
{ {
logerror("----\n"); logerror("----\n");
@ -470,7 +471,7 @@ WRITE16_HANDLER( midyunit_dma_w )
logerror(" palette=%04X color=%04X\n", logerror(" palette=%04X color=%04X\n",
dma_register[DMA_PALETTE], dma_register[DMA_COLOR]); dma_register[DMA_PALETTE], dma_register[DMA_COLOR]);
} }
#endif }
profiler_mark(PROFILER_USER1); profiler_mark(PROFILER_USER1);

View File

@ -8,9 +8,7 @@
#define LOG_RDP_EXECUTION 0 #define LOG_RDP_EXECUTION 0
#if LOG_RDP_EXECUTION
static FILE *rdp_exec; static FILE *rdp_exec;
#endif
static UINT32 rdp_cmd_data[0x1000]; static UINT32 rdp_cmd_data[0x1000];
static int rdp_cmd_ptr = 0; static int rdp_cmd_ptr = 0;
@ -262,9 +260,8 @@ while (0)
VIDEO_START(n64) VIDEO_START(n64)
{ {
#if LOG_RDP_EXECUTION if (LOG_RDP_EXECUTION)
rdp_exec = fopen("rdp_execute.txt", "wt"); rdp_exec = fopen("rdp_execute.txt", "wt");
#endif
texture_cache = auto_malloc(0x100000); texture_cache = auto_malloc(0x100000);
@ -2485,10 +2482,8 @@ INLINE UINT32 READ_RDP_DATA(UINT32 address)
} }
} }
#if LOG_RDP_EXECUTION
static const char *const image_format[] = { "RGBA", "YUV", "CI", "IA", "I", "???", "???", "???" }; static const char *const image_format[] = { "RGBA", "YUV", "CI", "IA", "I", "???", "???", "???" };
static const char *const image_size[] = { "4-bit", "8-bit", "16-bit", "32-bit" }; static const char *const image_size[] = { "4-bit", "8-bit", "16-bit", "32-bit" };
#endif
static const int rdp_command_length[64] = static const int rdp_command_length[64] =
{ {
@ -2558,7 +2553,6 @@ static const int rdp_command_length[64] =
8 // 0x3f, Set_Color_Image 8 // 0x3f, Set_Color_Image
}; };
#if LOG_RDP_EXECUTION
static int rdp_dasm(char *buffer) static int rdp_dasm(char *buffer)
{ {
int i; int i;
@ -2865,7 +2859,6 @@ static int rdp_dasm(char *buffer)
return rdp_command_length[command]; return rdp_command_length[command];
} }
#endif
/*****************************************************************************/ /*****************************************************************************/
@ -3496,14 +3489,13 @@ void rdp_process_list(void)
//fatalerror("rdp_process_list: not enough rdp command data: cur = %d, ptr = %d, expected = %d\n", rdp_cmd_cur, rdp_cmd_ptr, rdp_command_length[cmd]); //fatalerror("rdp_process_list: not enough rdp command data: cur = %d, ptr = %d, expected = %d\n", rdp_cmd_cur, rdp_cmd_ptr, rdp_command_length[cmd]);
} }
#if LOG_RDP_EXECUTION if (LOG_RDP_EXECUTION)
{ {
char string[4000]; char string[4000];
rdp_dasm(string); rdp_dasm(string);
fprintf(rdp_exec, "%08X: %08X %08X %s\n", dp_start+(rdp_cmd_cur * 4), rdp_cmd_data[rdp_cmd_cur+0], rdp_cmd_data[rdp_cmd_cur+1], string); fprintf(rdp_exec, "%08X: %08X %08X %s\n", dp_start+(rdp_cmd_cur * 4), rdp_cmd_data[rdp_cmd_cur+0], rdp_cmd_data[rdp_cmd_cur+1], string);
} }
#endif
// execute the command // execute the command
rdp_command_table[cmd](rdp_cmd_data[rdp_cmd_cur+0], rdp_cmd_data[rdp_cmd_cur+1]); rdp_command_table[cmd](rdp_cmd_data[rdp_cmd_cur+0], rdp_cmd_data[rdp_cmd_cur+1]);

View File

@ -2378,7 +2378,6 @@ static void mix_all_layers(int which, int xoffs, bitmap_t *bitmap, const rectang
static void print_mixer_data(int which) static void print_mixer_data(int which)
{ {
#if PRINTF_MIXER_DATA
static int count = 0; static int count = 0;
if (++count > 60 * 5) if (++count > 60 * 5)
{ {
@ -2446,7 +2445,6 @@ static void print_mixer_data(int which)
mixer_control[which][0x2f]); mixer_control[which][0x2f]);
count = 0; count = 0;
} }
#endif
} }
VIDEO_UPDATE( system32 ) VIDEO_UPDATE( system32 )
@ -2486,9 +2484,7 @@ VIDEO_UPDATE( system32 )
mix_all_layers(0, 0, bitmap, cliprect, enablemask); mix_all_layers(0, 0, bitmap, cliprect, enablemask);
profiler_mark(PROFILER_END); profiler_mark(PROFILER_END);
#if LOG_SPRITES if (LOG_SPRITES && input_code_pressed(KEYCODE_L))
{
if (input_code_pressed(KEYCODE_L))
{ {
const rectangle *visarea = video_screen_get_visible_area(screen); const rectangle *visarea = video_screen_get_visible_area(screen);
FILE *f = fopen("sprite.txt", "w"); FILE *f = fopen("sprite.txt", "w");
@ -2543,8 +2539,6 @@ VIDEO_UPDATE( system32 )
} }
fclose(f); fclose(f);
} }
}
#endif
#if SHOW_ALPHA #if SHOW_ALPHA
{ {
@ -2626,7 +2620,7 @@ for (showclip = 0; showclip < 4; showclip++)
} }
#endif #endif
print_mixer_data(0); if (PRINTF_MIXER_DATA) print_mixer_data(0);
return 0; return 0;
} }
@ -2670,11 +2664,12 @@ VIDEO_UPDATE( multi32 )
mix_all_layers(((screen == left_screen) ? 0 : 1), 0, bitmap, cliprect, enablemask); mix_all_layers(((screen == left_screen) ? 0 : 1), 0, bitmap, cliprect, enablemask);
profiler_mark(PROFILER_END); profiler_mark(PROFILER_END);
if (PRINTF_MIXER_DATA)
{
if (!input_code_pressed(KEYCODE_M)) print_mixer_data(0); if (!input_code_pressed(KEYCODE_M)) print_mixer_data(0);
else print_mixer_data(1); else print_mixer_data(1);
#if LOG_SPRITES }
{ if (LOG_SPRITES && input_code_pressed(KEYCODE_L))
if (input_code_pressed(KEYCODE_L))
{ {
const rectangle *visarea = video_screen_get_visible_area(screen); const rectangle *visarea = video_screen_get_visible_area(screen);
FILE *f = fopen("sprite.txt", "w"); FILE *f = fopen("sprite.txt", "w");
@ -2689,8 +2684,6 @@ VIDEO_UPDATE( multi32 )
} }
fclose(f); fclose(f);
} }
}
#endif
return 0; return 0;
} }

View File

@ -21,7 +21,8 @@ READ16_HANDLER( tx1_crtc_r )
WRITE16_HANDLER( tx1_crtc_w ) WRITE16_HANDLER( tx1_crtc_w )
{ {
#if PRINT_CRTC_DATA if (PRINT_CRTC_DATA)
{
data &= 0xff; data &= 0xff;
if (offset == 0) if (offset == 0)
{ {
@ -51,7 +52,7 @@ WRITE16_HANDLER( tx1_crtc_w )
{ {
mame_printf_debug("0x%.2x, (%d)\n",data, data); mame_printf_debug("0x%.2x, (%d)\n",data, data);
} }
#endif }
} }

View File

@ -35,6 +35,7 @@
#define LOG_SOUND 0 #define LOG_SOUND 0
#define LOG(x) do { if (LOG_SOUND) logerror x; } while(0)
//============================================================ //============================================================
@ -61,12 +62,6 @@ static WAVEFORMATEX stream_format;
static int buffer_underflows; static int buffer_underflows;
static int buffer_overflows; static int buffer_overflows;
// debugging
#if LOG_SOUND
static FILE * sound_log;
#endif
//============================================================ //============================================================
// PROTOTYPES // PROTOTYPES
@ -86,10 +81,6 @@ static void dsound_destroy_buffers(void);
void winsound_init(running_machine *machine) void winsound_init(running_machine *machine)
{ {
#if LOG_SOUND
sound_log = fopen("sound.log", "w");
#endif
// if no sound, don't create anything // if no sound, don't create anything
if (!options_get_bool(mame_options(), OPTION_SOUND)) if (!options_get_bool(mame_options(), OPTION_SOUND))
return; return;
@ -117,11 +108,7 @@ static void sound_exit(running_machine *machine)
if (buffer_overflows || buffer_underflows) if (buffer_overflows || buffer_underflows)
mame_printf_verbose("Sound: buffer overflows=%d underflows=%d\n", buffer_overflows, buffer_underflows); mame_printf_verbose("Sound: buffer overflows=%d underflows=%d\n", buffer_overflows, buffer_underflows);
#if LOG_SOUND LOG(("Sound buffer: overflows=%d underflows=%d\n", buffer_overflows, buffer_underflows));
if (sound_log)
fprintf(sound_log, "Sound buffer: overflows=%d underflows=%d\n", buffer_overflows, buffer_underflows);
fclose(sound_log);
#endif
} }
@ -289,9 +276,8 @@ static HRESULT dsound_init(running_machine *machine)
stream_buffer_size = (stream_buffer_size / 1024) * 1024; stream_buffer_size = (stream_buffer_size / 1024) * 1024;
if (stream_buffer_size < 1024) if (stream_buffer_size < 1024)
stream_buffer_size = 1024; stream_buffer_size = 1024;
#if LOG_SOUND
fprintf(sound_log, "stream_buffer_size = %d\n", stream_buffer_size); LOG(("stream_buffer_size = %d\n", stream_buffer_size));
#endif
// create the buffers // create the buffers
result = dsound_create_buffers(); result = dsound_create_buffers();

View File

@ -39,6 +39,12 @@
// set this to 1 to record all mallocs and frees in the logfile // set this to 1 to record all mallocs and frees in the logfile
#define LOG_CALLS 0 #define LOG_CALLS 0
#if LOG_CALLS
#define LOG(x) do { if (LOG_CALLS) logerror x; } while (0)
void CLIB_DECL logerror(const char *text,...);
#else
#define LOG(x)
#endif
//============================================================ //============================================================
@ -177,13 +183,11 @@ void *malloc_file_line(size_t size, const char *file, int line)
block_base = (UINT8 *)GlobalAlloc(GMEM_FIXED, size); block_base = (UINT8 *)GlobalAlloc(GMEM_FIXED, size);
} }
#if LOG_CALLS
// logging // logging
if (file != NULL) if (file != NULL)
logerror("malloc #%06d size = %d (%s:%d)\n", id, size, file, line); LOG(("malloc #%06d size = %d (%s:%d)\n", id, size, file, line));
else else
logerror("malloc #%06d size = %d\n", id, size); LOG(("malloc #%06d size = %d\n", id, size));
#endif // LOG_CALLS
return block_base; return block_base;
} }
@ -344,9 +348,7 @@ void CLIB_DECL free_file_line(void *memory, const char *file, int line)
// free the memory // free the memory
VirtualFree((UINT8 *)memory - ((size_t)memory & (PAGE_SIZE-1)) - PAGE_SIZE, 0, MEM_RELEASE); VirtualFree((UINT8 *)memory - ((size_t)memory & (PAGE_SIZE-1)) - PAGE_SIZE, 0, MEM_RELEASE);
#if LOG_CALLS LOG(("free #%06d size = %d\n", entry->id, entry->size));
logerror("free #%06d size = %d\n", entry->id, entry->size);
#endif // LOG_CALLS
} }
else else
{ {

View File

@ -183,6 +183,7 @@ static void mtlog_dump(void)
} }
#else #else
void mtlog_add(const char *event) { } void mtlog_add(const char *event) { }
static void mtlog_dump(void) { }
#endif #endif
@ -286,9 +287,7 @@ static void winwindow_exit(running_machine *machine)
PostThreadMessage(window_threadid, WM_USER_SELF_TERMINATE, 0, 0); PostThreadMessage(window_threadid, WM_USER_SELF_TERMINATE, 0, 0);
WaitForSingleObject(window_thread, INFINITE); WaitForSingleObject(window_thread, INFINITE);
#if (LOG_THREADS)
mtlog_dump(); mtlog_dump();
#endif
} }
// kill the UI pause event // kill the UI pause event