diff --git a/src/devices/cpu/cop400/cop400.cpp b/src/devices/cpu/cop400/cop400.cpp index 58a5c672a35..01c9422ec14 100644 --- a/src/devices/cpu/cop400/cop400.cpp +++ b/src/devices/cpu/cop400/cop400.cpp @@ -1192,14 +1192,14 @@ offs_t cop400_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const uint READ8_MEMBER( cop400_cpu_device::microbus_rd ) { - if (LOG_MICROBUS) logerror("%s %s MICROBUS RD %02x\n", machine().time().as_string(), machine().describe_context(), Q); + if (IS_ENABLED(LOG_MICROBUS)) logerror("%s %s MICROBUS RD %02x\n", machine().time().as_string(), machine().describe_context(), Q); return Q; } WRITE8_MEMBER( cop400_cpu_device::microbus_wr ) { - if (LOG_MICROBUS) logerror("%s %s MICROBUS WR %02x\n", machine().time().as_string(), machine().describe_context(), data); + if (IS_ENABLED(LOG_MICROBUS)) logerror("%s %s MICROBUS WR %02x\n", machine().time().as_string(), machine().describe_context(), data); WRITE_G(G & 0xe); diff --git a/src/devices/cpu/m6809/m6809.cpp b/src/devices/cpu/m6809/m6809.cpp index db0cbee9a3c..0c70a3afb66 100644 --- a/src/devices/cpu/m6809/m6809.cpp +++ b/src/devices/cpu/m6809/m6809.cpp @@ -446,7 +446,7 @@ uint32_t m6809_base_device::execute_input_lines() const void m6809_base_device::execute_set_input(int inputnum, int state) { - if (LOG_INTERRUPTS) + if (IS_ENABLED(LOG_INTERRUPTS)) logerror("%s: inputnum=%s state=%d totalcycles=%d\n", machine().describe_context(), inputnum_string(inputnum), state, (int) attotime_to_clocks(machine().time())); switch(inputnum) diff --git a/src/devices/cpu/tms9900/ti990_10.cpp b/src/devices/cpu/tms9900/ti990_10.cpp index 6465ecf8475..071b5dc7dd2 100644 --- a/src/devices/cpu/tms9900/ti990_10.cpp +++ b/src/devices/cpu/tms9900/ti990_10.cpp @@ -69,7 +69,7 @@ void ti990_10_device::device_start() void ti990_10_device::device_stop() { - if (TRACE_SETUP) logerror("ti990_10: Deleting lookup tables\n"); + if (IS_ENABLED(TRACE_SETUP)) logerror("ti990_10: Deleting lookup tables\n"); } /* @@ -79,7 +79,7 @@ void ti990_10_device::device_stop() */ void ti990_10_device::device_reset() { - if (TRACE_EMU) logerror("ti990_10: Device reset by emulator\n"); + if (IS_ENABLED(TRACE_EMU)) logerror("ti990_10: Device reset by emulator\n"); } const address_space_config *ti990_10_device::memory_space_config(address_spacenum spacenum) const diff --git a/src/devices/cpu/tms9900/tms9900.cpp b/src/devices/cpu/tms9900/tms9900.cpp index 9bac8fdf937..5238fb9d33a 100644 --- a/src/devices/cpu/tms9900/tms9900.cpp +++ b/src/devices/cpu/tms9900/tms9900.cpp @@ -314,7 +314,7 @@ void tms99xx_device::resolve_lines() */ void tms99xx_device::device_reset() { - if (TRACE_EMU) logerror("Device reset by emulator\n"); + if (IS_ENABLED(TRACE_EMU)) logerror("Device reset by emulator\n"); m_reset = true; m_check_ready = false; m_wait_state = false; @@ -1106,7 +1106,7 @@ void tms99xx_device::build_command_lookup_table() { inst = &s_command[i]; table = m_command_lookup_table.get(); - if (TRACE_SETUP) logerror("=== opcode=%04x, len=%d\n", inst->opcode, format_mask_len[inst->format]); + if (IS_ENABLED(TRACE_SETUP)) logerror("=== opcode=%04x, len=%d\n", inst->opcode, format_mask_len[inst->format]); bitcount = 4; opcode = inst->opcode; cmdindex = (opcode>>12) & 0x000f; @@ -1116,7 +1116,7 @@ void tms99xx_device::build_command_lookup_table() // Descend if (table[cmdindex].next_digit == nullptr) { - if (TRACE_SETUP) logerror("create new table at bitcount=%d for index=%d\n", bitcount, cmdindex); + if (IS_ENABLED(TRACE_SETUP)) logerror("create new table at bitcount=%d for index=%d\n", bitcount, cmdindex); table[cmdindex].next_digit = std::make_unique(16); for (int j=0; j < 16; j++) { @@ -1126,7 +1126,7 @@ void tms99xx_device::build_command_lookup_table() } else { - if (TRACE_SETUP) logerror("found a table at bitcount=%d\n", bitcount); + if (IS_ENABLED(TRACE_SETUP)) logerror("found a table at bitcount=%d\n", bitcount); } table = table[cmdindex].next_digit.get(); @@ -1134,17 +1134,17 @@ void tms99xx_device::build_command_lookup_table() bitcount = bitcount+4; opcode <<= 4; cmdindex = (opcode>>12) & 0x000f; - if (TRACE_SETUP) logerror("next index=%x\n", cmdindex); + if (IS_ENABLED(TRACE_SETUP)) logerror("next index=%x\n", cmdindex); } - if (TRACE_SETUP) logerror("bitcount=%d\n", bitcount); + if (IS_ENABLED(TRACE_SETUP)) logerror("bitcount=%d\n", bitcount); // We are at the target level // Need to fill in the same entry for all values in the bitcount // (if a command needs 10 bits we have to copy it four // times for all combinations with 12 bits) for (int j=0; j < (1<<(bitcount-format_mask_len[inst->format])); j++) { - if (TRACE_SETUP) logerror("opcode=%04x at position %d\n", inst->opcode, cmdindex+j); + if (IS_ENABLED(TRACE_SETUP)) logerror("opcode=%04x at position %d\n", inst->opcode, cmdindex+j); table[cmdindex+j].index = i; } i++; @@ -1193,7 +1193,7 @@ void tms99xx_device::execute_run() { if (m_reset) service_interrupt(); - if (TRACE_EMU) logerror("calling execute_run for %d cycles\n", m_icount); + if (IS_ENABLED(TRACE_EMU)) logerror("calling execute_run for %d cycles\n", m_icount); do { // Only when last instruction has completed @@ -1219,7 +1219,7 @@ void tms99xx_device::execute_run() if (m_program_index == NOPRG && m_idle_state) { - if (TRACE_WAIT) logerror("idle state\n"); + if (IS_ENABLED(TRACE_WAIT)) logerror("idle state\n"); pulse_clock(1); if (!m_external_operation.isnull()) { @@ -1243,7 +1243,7 @@ void tms99xx_device::execute_run() program[MPC] != MEMORY_READ && program[MPC] != MEMORY_WRITE && program[MPC] != REG_READ && program[MPC] != REG_WRITE))) { - if (TRACE_WAIT) logerror("hold\n"); + if (IS_ENABLED(TRACE_WAIT)) logerror("hold\n"); if (!m_hold_acknowledged) acknowledge_hold(); pulse_clock(1); } @@ -1254,7 +1254,7 @@ void tms99xx_device::execute_run() { // We are in a wait state set_wait_state(true); - if (TRACE_WAIT) logerror("wait\n"); + if (IS_ENABLED(TRACE_WAIT)) logerror("wait\n"); // The clock output should be used to change the state of an outer // device which operates the READY line pulse_clock(1); @@ -1266,7 +1266,7 @@ void tms99xx_device::execute_run() // If we don't have a microprogram, acquire the next instruction uint8_t op = (m_program_index==NOPRG)? IAQ : program[MPC]; - if (TRACE_MICRO) logerror("MPC = %d, op = %d\n", MPC, op); + if (IS_ENABLED(TRACE_MICRO)) logerror("MPC = %d, op = %d\n", MPC, op); // Call the operation of the microprogram (this->*s_microoperation[op])(); // If we have multiple passes (as in the TMS9980) @@ -1282,7 +1282,7 @@ void tms99xx_device::execute_run() } } } while (m_icount>0 && !m_reset); - if (TRACE_EMU) logerror("cycles expired; will return soon.\n"); + if (IS_ENABLED(TRACE_EMU)) logerror("cycles expired; will return soon.\n"); } /**************************************************************************/ @@ -1310,11 +1310,11 @@ void tms99xx_device::execute_set_input(int irqline, int state) if (state==ASSERT_LINE) { m_irq_level = get_intlevel(state); - if (TRACE_INT) logerror("/INT asserted, level=%d, ST=%04x\n", m_irq_level, ST); + if (IS_ENABLED(TRACE_INT)) logerror("/INT asserted, level=%d, ST=%04x\n", m_irq_level, ST); } else { - if (TRACE_INT) logerror("/INT cleared\n"); + if (IS_ENABLED(TRACE_INT)) logerror("/INT cleared\n"); } } } @@ -1362,7 +1362,7 @@ void tms99xx_device::service_interrupt() m_reset = false; } - if (TRACE_INT) + if (IS_ENABLED(TRACE_INT)) { switch (m_irq_level) { @@ -1387,7 +1387,7 @@ void tms99xx_device::pulse_clock(int count) m_ready = m_ready_bufd; // get the latched READY state if (!m_clock_out_line.isnull()) m_clock_out_line(CLEAR_LINE); m_icount--; // This is the only location where we count down the cycles. - if (TRACE_CLOCK) + if (IS_ENABLED(TRACE_CLOCK)) { if (m_check_ready) logerror("pulse_clock, READY=%d\n", m_ready? 1:0); else logerror("pulse_clock\n"); @@ -1460,7 +1460,7 @@ void tms99xx_device::decode(uint16_t inst) while (!complete) { ix = (opcode >> 12) & 0x000f; - if (TRACE_MICRO) logerror("Check next hex digit of instruction %x\n", ix); + if (IS_ENABLED(TRACE_MICRO)) logerror("Check next hex digit of instruction %x\n", ix); if (table[ix].next_digit != nullptr) { table = table[ix].next_digit.get(); @@ -1482,7 +1482,7 @@ void tms99xx_device::decode(uint16_t inst) const tms_instruction decoded = s_command[m_program_index]; MPC = -1; m_command = decoded.id; - if (TRACE_MICRO) logerror("Command decoded as id %d, %s, base opcode %04x\n", m_command, opname[m_command], decoded.opcode); + if (IS_ENABLED(TRACE_MICRO)) logerror("Command decoded as id %d, %s, base opcode %04x\n", m_command, opname[m_command], decoded.opcode); // Byte operations are either format 1 with the byte flag set // or format 4 (CRU multi bit operations) with 1-8 bits to transfer. m_byteop = ((decoded.format==1 && ((IR & 0x1000)!=0)) @@ -1510,7 +1510,7 @@ void tms99xx_device::acquire_instruction() if (m_mem_phase == 1) { decode(m_current_value); - if (TRACE_EXEC) logerror("%04x: %04x (%s)\n", PC, IR, opname[m_command]); + if (IS_ENABLED(TRACE_EXEC)) logerror("%04x: %04x (%s)\n", PC, IR, opname[m_command]); debugger_instruction_hook(this, PC); PC = (PC + 2) & 0xfffe & m_prgaddr_mask; // IAQ will be cleared in the main loop @@ -1534,7 +1534,7 @@ void tms99xx_device::mem_read() m_check_ready = true; m_mem_phase = 2; m_pass = 2; - if (TRACE_ADDRESSBUS) logerror("set address (r) %04x\n", m_address); + if (IS_ENABLED(TRACE_ADDRESSBUS)) logerror("set address (r) %04x\n", m_address); pulse_clock(1); // Concludes the first cycle // If READY has been found to be low, the CPU will now stay in the wait state loop @@ -1546,7 +1546,7 @@ void tms99xx_device::mem_read() pulse_clock(1); if (!m_dbin_line.isnull()) m_dbin_line(CLEAR_LINE); m_mem_phase = 1; // reset to phase 1 - if (TRACE_MEM) logerror("mem r %04x -> %04x\n", m_address, m_current_value); + if (IS_ENABLED(TRACE_MEM)) logerror("mem r %04x -> %04x\n", m_address, m_current_value); } } @@ -1556,9 +1556,9 @@ void tms99xx_device::mem_write() { if (!m_dbin_line.isnull()) m_dbin_line(CLEAR_LINE); // When writing, the data bus is asserted immediately after the address bus - if (TRACE_ADDRESSBUS) logerror("set address (w) %04x\n", m_address); + if (IS_ENABLED(TRACE_ADDRESSBUS)) logerror("set address (w) %04x\n", m_address); m_prgspace->set_address(m_address & m_prgaddr_mask & 0xfffe); - if (TRACE_MEM) logerror("mem w %04x <- %04x\n", m_address, m_current_value); + if (IS_ENABLED(TRACE_MEM)) logerror("mem w %04x <- %04x\n", m_address, m_current_value); m_prgspace->write_word(m_address & m_prgaddr_mask & 0xfffe, m_current_value); m_check_ready = true; m_mem_phase = 2; @@ -1676,7 +1676,7 @@ void tms99xx_device::cru_output_operation() // Write m_count bits from cru_address for (int i=0; i < m_count; i++) { - if (TRACE_CRU) logerror("CRU output operation, address %04x, value %d\n", location<<1, value & 0x01); + if (IS_ENABLED(TRACE_CRU)) logerror("CRU output operation, address %04x, value %d\n", location<<1, value & 0x01); m_cru->write_byte(location, (value & 0x01)); value >>= 1; location = (location + 1) & m_cruaddr_mask; @@ -1697,7 +1697,7 @@ void tms99xx_device::return_from_subprogram() void tms99xx_device::command_completed() { // Pseudo state at the end of the current instruction cycle sequence - if (TRACE_CYCLES) + if (IS_ENABLED(TRACE_CYCLES)) { logerror("------"); int cycles = m_first_cycle - m_icount; @@ -1764,7 +1764,7 @@ inline void tms99xx_device::compare_and_set_lae(uint16_t value1, uint16_t value2 set_status_bit(ST_EQ, value1 == value2); set_status_bit(ST_LH, value1 > value2); set_status_bit(ST_AGT, (int16_t)value1 > (int16_t)value2); - if (TRACE_STATUS) logerror("ST = %04x (val1=%04x, val2=%04x)\n", ST, value1, value2); + if (IS_ENABLED(TRACE_STATUS)) logerror("ST = %04x (val1=%04x, val2=%04x)\n", ST, value1, value2); } /************************************************************************** @@ -2001,7 +2001,7 @@ void tms99xx_device::alu_f3() compare_and_set_lae(m_current_value, 0); } } - if (TRACE_STATUS) logerror("ST = %04x\n", ST); + if (IS_ENABLED(TRACE_STATUS)) logerror("ST = %04x\n", ST); break; } @@ -2020,7 +2020,7 @@ void tms99xx_device::alu_multiply() m_address = ((IR >> 5) & 0x001e) + WP; break; case 1: // After reading the register (multiplier) - if (TRACE_ALU) logerror("Multiply %04x by %04x\n", m_current_value, m_source_value); + if (IS_ENABLED(TRACE_ALU)) logerror("Multiply %04x by %04x\n", m_current_value, m_source_value); result = (m_source_value & 0x0000ffff) * (m_current_value & 0x0000ffff); m_current_value = (result >> 16) & 0xffff; m_value_copy = result & 0xffff; @@ -2069,11 +2069,11 @@ void tms99xx_device::alu_divide() // Create full word and perform division uval32 = (m_value_copy << 16) | m_current_value; - if (TRACE_ALU) logerror("Dividing %08x by %04x\n", uval32, m_source_value); + if (IS_ENABLED(TRACE_ALU)) logerror("Dividing %08x by %04x\n", uval32, m_source_value); m_current_value = uval32 / m_source_value; m_value_copy = uval32 % m_source_value; - if (TRACE_ALU) logerror("Quotient %04x, remainder %04x\n", m_current_value, m_value_copy); + if (IS_ENABLED(TRACE_ALU)) logerror("Quotient %04x, remainder %04x\n", m_current_value, m_value_copy); m_address = m_address_copy; @@ -2099,7 +2099,7 @@ void tms99xx_device::alu_divide() // Prepare to write the remainder m_current_value = m_value_copy; m_address = m_address + 2; - if (TRACE_STATUS) logerror("ST = %04x (div)\n", ST); + if (IS_ENABLED(TRACE_STATUS)) logerror("ST = %04x (div)\n", ST); break; } pulse_clock(2); @@ -2249,7 +2249,7 @@ void tms99xx_device::alu_abs() void tms99xx_device::alu_x() { - if (TRACE_ALU) logerror("Substituting current command by %04x\n", m_current_value); + if (IS_ENABLED(TRACE_ALU)) logerror("Substituting current command by %04x\n", m_current_value); decode(m_current_value); pulse_clock(2); } @@ -2269,7 +2269,7 @@ void tms99xx_device::alu_b() m_current_value = PC; PC = m_address & m_prgaddr_mask & 0xfffe; m_address = WP + 22; - if (TRACE_ALU) logerror("Set new PC = %04x\n", PC); + if (IS_ENABLED(TRACE_ALU)) logerror("Set new PC = %04x\n", PC); pulse_clock(2); } @@ -2297,7 +2297,7 @@ void tms99xx_device::alu_blwp() break; case 4: PC = m_current_value & m_prgaddr_mask & 0xfffe; - if (TRACE_ALU) logerror("tms9900: Context switch complete; WP=%04x, PC=%04x, ST=%04x\n", WP, PC, ST); + if (IS_ENABLED(TRACE_ALU)) logerror("tms9900: Context switch complete; WP=%04x, PC=%04x, ST=%04x\n", WP, PC, ST); break; } pulse_clock(2); @@ -2339,7 +2339,7 @@ void tms99xx_device::alu_ldcr() } m_cru_address = m_current_value; m_value = value; - if (TRACE_CRU) logerror("Load CRU address %04x (%d bits), value = %04x\n", m_cru_address, m_count, m_value); + if (IS_ENABLED(TRACE_CRU)) logerror("Load CRU address %04x (%d bits), value = %04x\n", m_cru_address, m_count, m_value); } m_state++; pulse_clock(2); @@ -2371,7 +2371,7 @@ void tms99xx_device::alu_stcr() value = m_value & 0xffff; if (m_count < 9) { - if (TRACE_CRU) logerror("Store CRU at %04x (%d bits) in %04x, result = %02x\n", m_cru_address, m_count, m_source_address, value); + if (IS_ENABLED(TRACE_CRU)) logerror("Store CRU at %04x (%d bits) in %04x, result = %02x\n", m_cru_address, m_count, m_source_address, value); set_status_parity((uint8_t)(value & 0xff)); compare_and_set_lae(value<<8, 0); if (m_source_even) @@ -2383,7 +2383,7 @@ void tms99xx_device::alu_stcr() } else { - if (TRACE_CRU) logerror("Store CRU at %04x (%d bits) in %04x, result = %04x\n", m_cru_address, m_count, m_source_address, value); + if (IS_ENABLED(TRACE_CRU)) logerror("Store CRU at %04x (%d bits) in %04x, result = %04x\n", m_cru_address, m_count, m_source_address, value); m_current_value = value; compare_and_set_lae(value, 0); pulse_clock(2*(5 + (16-m_count))); @@ -2429,7 +2429,7 @@ void tms99xx_device::alu_tb() break; case 2: set_status_bit(ST_EQ, m_value!=0); - if (TRACE_STATUS) logerror("ST = %04x\n", ST); + if (IS_ENABLED(TRACE_STATUS)) logerror("ST = %04x\n", ST); break; } m_state++; @@ -2487,11 +2487,11 @@ void tms99xx_device::alu_jmp() } if (!cond) { - if (TRACE_ALU) logerror("Jump condition false\n"); + if (IS_ENABLED(TRACE_ALU)) logerror("Jump condition false\n"); MPC+=1; // skip next ALU call } else - if (TRACE_ALU) logerror("Jump condition true\n"); + if (IS_ENABLED(TRACE_ALU)) logerror("Jump condition true\n"); } else { @@ -2532,7 +2532,7 @@ void tms99xx_device::alu_shift() } else { - if (TRACE_ALU) logerror("Shift operation gets count from R0\n"); + if (IS_ENABLED(TRACE_ALU)) logerror("Shift operation gets count from R0\n"); pulse_clock(2); } pulse_clock(2); @@ -2581,7 +2581,7 @@ void tms99xx_device::alu_shift() set_status_bit(ST_OV, overflow); compare_and_set_lae(m_current_value, 0); m_address = m_address_saved; // Register address - if (TRACE_STATUS) logerror("ST = %04x (val=%04x)\n", ST, m_current_value); + if (IS_ENABLED(TRACE_STATUS)) logerror("ST = %04x (val=%04x)\n", ST, m_current_value); break; } m_state++; @@ -2632,7 +2632,7 @@ void tms99xx_device::alu_lwpi() void tms99xx_device::alu_limi() { ST = (ST & 0xfff0) | (m_current_value & 0x000f); - if (TRACE_STATUS) logerror("ST = %04x\n", ST); + if (IS_ENABLED(TRACE_STATUS)) logerror("ST = %04x\n", ST); pulse_clock(2); } @@ -2688,7 +2688,7 @@ void tms99xx_device::alu_rtwp() void tms99xx_device::alu_int() { - if (TRACE_EMU) logerror("INT state %d; irq_level %d\n", m_state, m_irq_level); + if (IS_ENABLED(TRACE_EMU)) logerror("INT state %d; irq_level %d\n", m_state, m_irq_level); switch (m_state) { case 0: @@ -2723,7 +2723,7 @@ void tms99xx_device::alu_int() break; case 4: m_address = (m_address_copy + 2) & 0xfffe & m_prgaddr_mask; - if (TRACE_ALU) logerror("read from %04x\n", m_address); + if (IS_ENABLED(TRACE_ALU)) logerror("read from %04x\n", m_address); break; case 5: PC = m_current_value & m_prgaddr_mask & 0xfffe; diff --git a/src/devices/cpu/tms9900/tms9980a.cpp b/src/devices/cpu/tms9900/tms9980a.cpp index 5cb028e543a..f536205c09f 100644 --- a/src/devices/cpu/tms9900/tms9980a.cpp +++ b/src/devices/cpu/tms9900/tms9980a.cpp @@ -148,7 +148,7 @@ void tms9980a_device::execute_set_input(int irqline, int state) // Clear all interrupts m_load_state = false; m_irq_state = false; - if (TRACE_INT) logerror("tms9980a: clear interrupts\n"); + if (IS_ENABLED(TRACE_INT)) logerror("tms9980a: clear interrupts\n"); break; } @@ -163,7 +163,7 @@ void tms9980a_device::execute_set_input(int irqline, int state) m_load_state = true; } else m_irq_state = true; - if (TRACE_INT) logerror("tms9980a: interrupt level=%d, ST=%04x\n", m_irq_level, ST); + if (IS_ENABLED(TRACE_INT)) logerror("tms9980a: interrupt level=%d, ST=%04x\n", m_irq_level, ST); } } @@ -182,24 +182,24 @@ void tms9980a_device::mem_read() m_pass = 4; // make the CPU visit this method more than once if (!m_dbin_line.isnull()) m_dbin_line(ASSERT_LINE); m_prgspace->set_address(m_address & m_prgaddr_mask & ~1); - if (TRACE_ADDRESSBUS) logerror("tms9980a: set address bus %04x\n", m_address & m_prgaddr_mask & ~1); + if (IS_ENABLED(TRACE_ADDRESSBUS)) logerror("tms9980a: set address bus %04x\n", m_address & m_prgaddr_mask & ~1); m_check_ready = true; break; case 2: // Sample the value on the data bus (high byte) value = m_prgspace->read_byte(m_address & m_prgaddr_mask & ~1); - if (TRACE_MEM) logerror("tms9980a: memory read high byte %04x -> %02x\n", m_address & m_prgaddr_mask & ~1, value); + if (IS_ENABLED(TRACE_MEM)) logerror("tms9980a: memory read high byte %04x -> %02x\n", m_address & m_prgaddr_mask & ~1, value); m_current_value = (value << 8) & 0xff00; break; case 3: m_prgspace->set_address((m_address & m_prgaddr_mask) | 1); - if (TRACE_ADDRESSBUS) logerror("tms9980a: set address bus %04x\n", (m_address & m_prgaddr_mask) | 1); + if (IS_ENABLED(TRACE_ADDRESSBUS)) logerror("tms9980a: set address bus %04x\n", (m_address & m_prgaddr_mask) | 1); break; case 4: // Sample the value on the data bus (low byte) value = m_prgspace->read_byte((m_address & m_prgaddr_mask) | 1); m_current_value = m_current_value | (value & 0x00ff); - if (TRACE_MEM) logerror("tms9980a: memory read low byte %04x -> %02x -> complete word %04x\n", (m_address & m_prgaddr_mask) | 1, value, m_current_value); + if (IS_ENABLED(TRACE_MEM)) logerror("tms9980a: memory read low byte %04x -> %02x -> complete word %04x\n", (m_address & m_prgaddr_mask) | 1, value, m_current_value); break; } pulse_clock(1); @@ -215,9 +215,9 @@ void tms9980a_device::mem_write() m_pass = 4; // make the CPU visit this method once more if (!m_dbin_line.isnull()) m_dbin_line(CLEAR_LINE); m_prgspace->set_address(m_address & m_prgaddr_mask & ~1); - if (TRACE_ADDRESSBUS) logerror("tms9980a: set address bus %04x\n", m_address & m_prgaddr_mask & ~1); + if (IS_ENABLED(TRACE_ADDRESSBUS)) logerror("tms9980a: set address bus %04x\n", m_address & m_prgaddr_mask & ~1); m_prgspace->write_byte(m_address & 0x3ffe & ~1, (m_current_value >> 8)&0xff); - if (TRACE_MEM) logerror("tms9980a: memory write high byte %04x <- %02x\n", m_address & m_prgaddr_mask & ~1, (m_current_value >> 8)&0xff); + if (IS_ENABLED(TRACE_MEM)) logerror("tms9980a: memory write high byte %04x <- %02x\n", m_address & m_prgaddr_mask & ~1, (m_current_value >> 8)&0xff); m_check_ready = true; break; case 2: @@ -225,9 +225,9 @@ void tms9980a_device::mem_write() break; case 3: m_prgspace->set_address((m_address & m_prgaddr_mask) | 1); - if (TRACE_ADDRESSBUS) logerror("tms9980a: set address bus %04x\n", (m_address & m_prgaddr_mask) | 1); + if (IS_ENABLED(TRACE_ADDRESSBUS)) logerror("tms9980a: set address bus %04x\n", (m_address & m_prgaddr_mask) | 1); m_prgspace->write_byte((m_address & m_prgaddr_mask) | 1, m_current_value & 0xff); - if (TRACE_MEM) logerror("tms9980a: memory write low byte %04x <- %02x\n", (m_address & m_prgaddr_mask) | 1, m_current_value & 0xff); + if (IS_ENABLED(TRACE_MEM)) logerror("tms9980a: memory write low byte %04x <- %02x\n", (m_address & m_prgaddr_mask) | 1, m_current_value & 0xff); break; case 4: // no action here, just wait for READY @@ -250,7 +250,7 @@ void tms9980a_device::acquire_instruction() if (m_mem_phase == 1) // changed by mem_read and wrapped { decode(m_current_value); - if (TRACE_OP) logerror("tms9980a: ===== Next operation %04x (%s) at %04x =====\n", IR, opname[m_command], PC); + if (IS_ENABLED(TRACE_OP)) logerror("tms9980a: ===== Next operation %04x (%s) at %04x =====\n", IR, opname[m_command], PC); debugger_instruction_hook(this, PC); PC = (PC + 2) & 0xfffe & m_prgaddr_mask; } diff --git a/src/devices/cpu/tms9900/tms9995.cpp b/src/devices/cpu/tms9900/tms9995.cpp index b161ec05ce3..44b48e1b7dc 100644 --- a/src/devices/cpu/tms9900/tms9995.cpp +++ b/src/devices/cpu/tms9900/tms9995.cpp @@ -271,7 +271,7 @@ void tms9995_device::device_start() // Set up the lookup table for command decoding build_command_lookup_table(); - if (TRACE_CONFIG) logerror("%s: Variant = %s, Overflow int = %s\n", tag(), m_mp9537? "MP9537 (no on-chip RAM)" : "with on-chip RAM", m_check_overflow? "check" : "no check"); + if (IS_ENABLED(TRACE_CONFIG)) logerror("%s: Variant = %s, Overflow int = %s\n", tag(), m_mp9537? "MP9537 (no on-chip RAM)" : "with on-chip RAM", m_check_overflow? "check" : "no check"); // Register persistable state variables // save_item(NAME(m_state_any)); // only for debugger output @@ -1216,7 +1216,7 @@ void tms9995_device::build_command_lookup_table() { inst = &s_command[i]; table = m_command_lookup_table.get(); - if (TRACE_EMU) logerror("=== opcode=%04x, len=%d\n", inst->opcode, format_mask_len[inst->format]); + if (IS_ENABLED(TRACE_EMU)) logerror("=== opcode=%04x, len=%d\n", inst->opcode, format_mask_len[inst->format]); bitcount = 4; opcode = inst->opcode; cmdindex = (opcode>>12) & 0x000f; @@ -1226,7 +1226,7 @@ void tms9995_device::build_command_lookup_table() // Descend if (table[cmdindex].next_digit == nullptr) { - if (TRACE_EMU) logerror("create new table at bitcount=%d for index=%d\n", bitcount, cmdindex); + if (IS_ENABLED(TRACE_EMU)) logerror("create new table at bitcount=%d for index=%d\n", bitcount, cmdindex); table[cmdindex].next_digit = std::make_unique(16); for (int j=0; j < 16; j++) { @@ -1236,7 +1236,7 @@ void tms9995_device::build_command_lookup_table() } else { - if (TRACE_EMU) logerror("found a table at bitcount=%d\n", bitcount); + if (IS_ENABLED(TRACE_EMU)) logerror("found a table at bitcount=%d\n", bitcount); } table = table[cmdindex].next_digit.get(); @@ -1244,17 +1244,17 @@ void tms9995_device::build_command_lookup_table() bitcount = bitcount+4; opcode <<= 4; cmdindex = (opcode>>12) & 0x000f; - if (TRACE_EMU) logerror("next index=%x\n", cmdindex); + if (IS_ENABLED(TRACE_EMU)) logerror("next index=%x\n", cmdindex); } - if (TRACE_EMU) logerror("bitcount=%d\n", bitcount); + if (IS_ENABLED(TRACE_EMU)) logerror("bitcount=%d\n", bitcount); // We are at the target level // Need to fill in the same entry for all values in the bitcount // (if a command needs 10 bits we have to copy it four // times for all combinations with 12 bits) for (int j=0; j < (1<<(bitcount-format_mask_len[inst->format])); j++) { - if (TRACE_EMU) logerror("opcode=%04x at position %d\n", inst->opcode, cmdindex+j); + if (IS_ENABLED(TRACE_EMU)) logerror("opcode=%04x at position %d\n", inst->opcode, cmdindex+j); table[cmdindex+j].index = i; } @@ -1278,14 +1278,14 @@ void tms9995_device::execute_run() { if (m_reset) service_interrupt(); - if (TRACE_EMU) logerror("calling execute_run for %d cycles\n", m_icount); + if (IS_ENABLED(TRACE_EMU)) logerror("calling execute_run for %d cycles\n", m_icount); do { // Normal operation if (m_check_ready && m_ready == false) { // We are in a wait state - if (TRACE_WAITHOLD) logerror("wait state\n"); + if (IS_ENABLED(TRACE_WAITHOLD)) logerror("wait state\n"); // The clock output should be used to change the state of an outer // device which operates the READY line pulse_clock(1); @@ -1295,7 +1295,7 @@ void tms9995_device::execute_run() if (m_check_hold && m_hold_requested) { set_hold_state(true); - if (TRACE_WAITHOLD) logerror("HOLD state\n"); + if (IS_ENABLED(TRACE_WAITHOLD)) logerror("HOLD state\n"); pulse_clock(1); } else @@ -1304,7 +1304,7 @@ void tms9995_device::execute_run() m_check_ready = false; - if (TRACE_MICRO) logerror("main loop, operation %s, MPC = %d\n", opname[m_command], MPC); + if (IS_ENABLED(TRACE_MICRO)) logerror("main loop, operation %s, MPC = %d\n", opname[m_command], MPC); uint8_t* program = (uint8_t*)s_command[m_index].prog; (this->*s_microoperation[program[MPC]])(); @@ -1320,7 +1320,7 @@ void tms9995_device::execute_run() } } while (m_icount>0 && !m_reset); - if (TRACE_EMU) logerror("cycles expired; will return soon.\n"); + if (IS_ENABLED(TRACE_EMU)) logerror("cycles expired; will return soon.\n"); } /**************************************************************************/ @@ -1347,28 +1347,28 @@ void tms9995_device::execute_set_input(int irqline, int state) if (irqline == INPUT_LINE_NMI) { m_nmi_active = (state==ASSERT_LINE); - if (TRACE_INT) logerror("NMI interrupt line state=%d\n", state); + if (IS_ENABLED(TRACE_INT)) logerror("NMI interrupt line state=%d\n", state); } else { if (irqline == INT_9995_INT1) { m_int1_active = m_flag[2] = (state==ASSERT_LINE); - if (TRACE_INT) logerror("Line INT1 state=%d\n", state); + if (IS_ENABLED(TRACE_INT)) logerror("Line INT1 state=%d\n", state); } else { if (irqline == INT_9995_INT4) { - if (TRACE_INT) logerror("Line INT4/EC state=%d\n", state); + if (IS_ENABLED(TRACE_INT)) logerror("Line INT4/EC state=%d\n", state); if (m_flag[0]==false) { - if (TRACE_INT) logerror("set as interrupt\n"); + if (IS_ENABLED(TRACE_INT)) logerror("set as interrupt\n"); m_int4_active = m_flag[4] = (state==ASSERT_LINE); } else { - if (TRACE_INT) logerror("set as event count\n"); + if (IS_ENABLED(TRACE_INT)) logerror("set as event count\n"); trigger_decrementer(); } } @@ -1400,7 +1400,7 @@ void tms9995_device::pulse_clock(int count) m_ready = m_ready_bufd && !m_request_auto_wait_state; // get the latched READY state if (!m_clock_out_line.isnull()) m_clock_out_line(CLEAR_LINE); m_icount--; // This is the only location where we count down the cycles. - if (TRACE_CLOCK) + if (IS_ENABLED(TRACE_CLOCK)) { if (m_check_ready) logerror("pulse_clock, READY=%d, auto_wait=%d\n", m_ready_bufd? 1:0, m_auto_wait? 1:0); else logerror("pulse_clock\n"); @@ -1422,7 +1422,7 @@ void tms9995_device::pulse_clock(int count) WRITE_LINE_MEMBER( tms9995_device::hold_line ) { m_hold_requested = (state==ASSERT_LINE); - if (TRACE_WAITHOLD) logerror("set HOLD = %d\n", state); + if (IS_ENABLED(TRACE_WAITHOLD)) logerror("set HOLD = %d\n", state); if (!m_hold_requested) { if (!m_holda_line.isnull()) m_holda_line(CLEAR_LINE); @@ -1439,7 +1439,7 @@ WRITE_LINE_MEMBER( tms9995_device::ready_line ) else { m_ready_bufd = (state==ASSERT_LINE); - if (TRACE_READY) logerror("set READY = %d\n", m_ready_bufd? 1 : 0); + if (IS_ENABLED(TRACE_READY)) logerror("set READY = %d\n", m_ready_bufd? 1 : 0); } } @@ -1481,7 +1481,7 @@ void tms9995_device::decode(uint16_t inst) while (!complete) { ix = (opcode >> 12) & 0x000f; - if (TRACE_EMU) logerror("Check next hex digit of instruction %x\n", ix); + if (IS_ENABLED(TRACE_EMU)) logerror("Check next hex digit of instruction %x\n", ix); if (table[ix].next_digit != nullptr) { table = table[ix].next_digit.get(); @@ -1506,7 +1506,7 @@ void tms9995_device::decode(uint16_t inst) m_pre_command = decoded.id; m_pre_index = program_index; m_pre_byteop = ((decoded.format == 1) && ((inst & 0x1000)!=0)); - if (TRACE_EMU) logerror("Command decoded as id %d, %s, base opcode %04x\n", decoded.id, opname[decoded.id], decoded.opcode); + if (IS_ENABLED(TRACE_EMU)) logerror("Command decoded as id %d, %s, base opcode %04x\n", decoded.id, opname[decoded.id], decoded.opcode); m_pass = 1; } } @@ -1526,7 +1526,7 @@ void tms9995_device::int_prefetch_and_decode() // Check interrupt lines if (m_nmi_active) { - if (TRACE_INT) logerror("Checking interrupts ... NMI active\n"); + if (IS_ENABLED(TRACE_INT)) logerror("Checking interrupts ... NMI active\n"); m_int_pending |= PENDING_NMI; m_idle_state = false; PC = (PC + 2) & 0xfffe; // we have not prefetched the next instruction @@ -1549,19 +1549,19 @@ void tms9995_device::int_prefetch_and_decode() if (m_idle_state) { m_idle_state = false; - if (TRACE_INT) logerror("Interrupt occurred, terminate IDLE state\n"); + if (IS_ENABLED(TRACE_INT)) logerror("Interrupt occurred, terminate IDLE state\n"); } PC = PC + 2; // PC must be advanced (see flow chart), but no prefetch - if (TRACE_INT) logerror("Interrupts pending; no prefetch; advance PC to %04x\n", PC); + if (IS_ENABLED(TRACE_INT)) logerror("Interrupts pending; no prefetch; advance PC to %04x\n", PC); return; } else { - if (TRACE_INT) logerror("Checking interrupts ... none pending\n"); + if (IS_ENABLED(TRACE_INT)) logerror("Checking interrupts ... none pending\n"); // No pending interrupts if (m_idle_state) { - if (TRACE_WAITHOLD) logerror("IDLE state\n"); + if (IS_ENABLED(TRACE_WAITHOLD)) logerror("IDLE state\n"); // We are IDLE, stay in the loop and do not advance the PC m_pass = 2; pulse_clock(1); @@ -1591,7 +1591,7 @@ void tms9995_device::prefetch_and_decode() m_value_copy = m_current_value; if (!m_iaq_line.isnull()) m_iaq_line(ASSERT_LINE); m_address = PC; - if (TRACE_OP) logerror("**** Prefetching new instruction at %04x ****\n", PC); + if (IS_ENABLED(TRACE_OP)) logerror("**** Prefetching new instruction at %04x ****\n", PC); } word_read(); // changes m_mem_phase @@ -1604,7 +1604,7 @@ void tms9995_device::prefetch_and_decode() m_current_value = m_value_copy; // restore m_current_value PC = (PC + 2) & 0xfffe; // advance PC if (!m_iaq_line.isnull()) m_iaq_line(CLEAR_LINE); - if (TRACE_OP) logerror("++++ Prefetch done ++++\n"); + if (IS_ENABLED(TRACE_OP)) logerror("++++ Prefetch done ++++\n"); } } @@ -1635,9 +1635,9 @@ void tms9995_device::next_command() // This is a preset for opcodes which do not need an opcode address derivation m_address = WP + ((IR & 0x000f)<<1); MPC = -1; - if (TRACE_OP) logerror("===== Next operation %04x (%s) at %04x =====\n", IR, opname[m_command], PC-2); + if (IS_ENABLED(TRACE_OP)) logerror("===== Next operation %04x (%s) at %04x =====\n", IR, opname[m_command], PC-2); - if (TRACE_EXEC) + if (IS_ENABLED(TRACE_EXEC)) { if (m_servicing_interrupt) logerror("i%04x\n", PC-2); else logerror("%04x\n", PC-2); @@ -1654,7 +1654,7 @@ void tms9995_device::next_command() void tms9995_device::command_completed() { // Pseudo state at the end of the current instruction cycle sequence - if (TRACE_CYCLES) + if (IS_ENABLED(TRACE_CYCLES)) { logerror("+++++ Instruction %04x (%s) completed", IR, opname[m_command]); int cycles = m_first_cycle - m_icount; @@ -1716,7 +1716,7 @@ void tms9995_device::service_interrupt() vectorpos = 0x0008; m_intmask = 0x0001; PC = (PC + 2) & 0xfffe; - if (TRACE_INT) logerror("***** MID pending\n"); + if (IS_ENABLED(TRACE_INT)) logerror("***** MID pending\n"); m_mid_active = false; } else @@ -1726,7 +1726,7 @@ void tms9995_device::service_interrupt() vectorpos = 0xfffc; m_int_pending &= ~PENDING_NMI; m_intmask = 0; - if (TRACE_INT) logerror("***** NMI pending\n"); + if (IS_ENABLED(TRACE_INT)) logerror("***** NMI pending\n"); } else { @@ -1736,7 +1736,7 @@ void tms9995_device::service_interrupt() m_int_pending &= ~PENDING_LEVEL1; m_flag[2] = false; m_intmask = 0; - if (TRACE_INT) logerror("***** INT1 pending\n"); + if (IS_ENABLED(TRACE_INT)) logerror("***** INT1 pending\n"); } else { @@ -1745,7 +1745,7 @@ void tms9995_device::service_interrupt() vectorpos = 0x0008; m_int_pending &= ~PENDING_OVERFLOW; m_intmask = 0x0001; - if (TRACE_INT) logerror("***** OVERFL pending\n"); + if (IS_ENABLED(TRACE_INT)) logerror("***** OVERFL pending\n"); } else { @@ -1756,7 +1756,7 @@ void tms9995_device::service_interrupt() m_int_pending &= ~PENDING_DECR; m_flag[3] = false; m_int_decrementer = false; - if (TRACE_DEC) logerror("***** DECR pending\n"); + if (IS_ENABLED(TRACE_DEC)) logerror("***** DECR pending\n"); } else { @@ -1764,7 +1764,7 @@ void tms9995_device::service_interrupt() m_intmask = 0x0003; m_int_pending &= ~PENDING_LEVEL4; m_flag[4] = false; - if (TRACE_INT) logerror("***** INT4 pending\n"); + if (IS_ENABLED(TRACE_INT)) logerror("***** INT4 pending\n"); } } } @@ -1772,7 +1772,7 @@ void tms9995_device::service_interrupt() } } - if (TRACE_INT) logerror("********* triggered an interrupt with vector %04x/%04x\n", vectorpos, vectorpos+2); + if (IS_ENABLED(TRACE_INT)) logerror("********* triggered an interrupt with vector %04x/%04x\n", vectorpos, vectorpos+2); // just for debugging purposes if (!m_reset) m_servicing_interrupt = true; @@ -1824,7 +1824,7 @@ void tms9995_device::mem_read() if ((m_address & 0xfffe)==0xfffa && !m_mp9537) { - if (TRACE_DEC) logerror("read decrementer\n"); + if (IS_ENABLED(TRACE_DEC)) logerror("read decrementer\n"); // Decrementer mapped into the address space m_current_value = m_decrementer_value; if (m_byteop) @@ -1843,7 +1843,7 @@ void tms9995_device::mem_read() // byte operations (e.g. when retrieving the index register) if (m_word_access || !m_byteop) m_address &= 0xfffe; - if (TRACE_MEM) logerror("read onchip memory (single pass, address %04x)\n", m_address); + if (IS_ENABLED(TRACE_MEM)) logerror("read onchip memory (single pass, address %04x)\n", m_address); // Ignore the READY state m_check_ready = false; @@ -1878,7 +1878,7 @@ void tms9995_device::mem_read() else m_pass = 2; m_check_hold = false; - if (TRACE_ADDRESSBUS) logerror("set address bus %04x\n", m_address & ~1); + if (IS_ENABLED(TRACE_ADDRESSBUS)) logerror("set address bus %04x\n", m_address & ~1); m_prgspace->set_address(address); m_request_auto_wait_state = m_auto_wait; pulse_clock(1); @@ -1887,12 +1887,12 @@ void tms9995_device::mem_read() // Sample the value on the data bus (high byte) if (m_word_access || !m_byteop) address &= 0xfffe; value = m_prgspace->read_byte(address); - if (TRACE_MEM) logerror("memory read byte %04x -> %02x\n", m_address & ~1, value); + if (IS_ENABLED(TRACE_MEM)) logerror("memory read byte %04x -> %02x\n", m_address & ~1, value); m_current_value = (value << 8) & 0xff00; break; case 3: // Set address + 1 (unless byte command) - if (TRACE_ADDRESSBUS) logerror("set address bus %04x\n", m_address | 1); + if (IS_ENABLED(TRACE_ADDRESSBUS)) logerror("set address bus %04x\n", m_address | 1); m_prgspace->set_address(m_address | 1); m_request_auto_wait_state = m_auto_wait; pulse_clock(1); @@ -1901,7 +1901,7 @@ void tms9995_device::mem_read() // Read low byte value = m_prgspace->read_byte(m_address | 1); m_current_value |= value; - if (TRACE_MEM) logerror("memory read byte %04x -> %02x, complete word = %04x\n", m_address | 1, value, m_current_value); + if (IS_ENABLED(TRACE_MEM)) logerror("memory read byte %04x -> %02x, complete word = %04x\n", m_address | 1, value, m_current_value); m_check_hold = true; break; } @@ -1969,7 +1969,7 @@ void tms9995_device::mem_write() { m_starting_count_storage_register = m_decrementer_value = m_current_value; } - if (TRACE_DEC) logerror("Setting decrementer to %04x, PC=%04x\n", m_current_value, PC); + if (IS_ENABLED(TRACE_DEC)) logerror("Setting decrementer to %04x, PC=%04x\n", m_current_value, PC); pulse_clock(1); return; } @@ -1981,7 +1981,7 @@ void tms9995_device::mem_write() // byte operations (e.g. when retrieving the index register) if (m_word_access || !m_byteop) m_address &= 0xfffe; - if (TRACE_MEM) logerror("write to onchip memory (single pass, address %04x, value=%04x)\n", m_address, m_current_value); + if (IS_ENABLED(TRACE_MEM)) logerror("write to onchip memory (single pass, address %04x, value=%04x)\n", m_address, m_current_value); m_check_ready = false; m_onchip_memory[m_address & 0x00ff] = (m_current_value >> 8) & 0xff; if (m_word_access || !m_byteop) @@ -2010,9 +2010,9 @@ void tms9995_device::mem_write() else m_pass = 2; m_check_hold = false; - if (TRACE_ADDRESSBUS) logerror("set address bus %04x\n", address); + if (IS_ENABLED(TRACE_ADDRESSBUS)) logerror("set address bus %04x\n", address); m_prgspace->set_address(address); - if (TRACE_MEM) logerror("memory write byte %04x <- %02x\n", address, (m_current_value >> 8)&0xff); + if (IS_ENABLED(TRACE_MEM)) logerror("memory write byte %04x <- %02x\n", address, (m_current_value >> 8)&0xff); m_prgspace->write_byte(address, (m_current_value >> 8)&0xff); m_request_auto_wait_state = m_auto_wait; pulse_clock(1); @@ -2023,9 +2023,9 @@ void tms9995_device::mem_write() break; case 3: // Set address + 1 (unless byte command) - if (TRACE_ADDRESSBUS) logerror("set address bus %04x\n", m_address | 1); + if (IS_ENABLED(TRACE_ADDRESSBUS)) logerror("set address bus %04x\n", m_address | 1); m_prgspace->set_address(m_address | 1); - if (TRACE_MEM) logerror("memory write byte %04x <- %02x\n", m_address | 1, m_current_value & 0xff); + if (IS_ENABLED(TRACE_MEM)) logerror("memory write byte %04x <- %02x\n", m_address | 1, m_current_value & 0xff); m_prgspace->write_byte(m_address | 1, m_current_value & 0xff); m_request_auto_wait_state = m_auto_wait; pulse_clock(1); @@ -2066,7 +2066,7 @@ void tms9995_device::return_with_address() m_index = m_caller_index; MPC = m_caller_MPC; // will be increased on return m_address = m_current_value + m_address_add; - if (TRACE_DETAIL) logerror("+++ return from operand address derivation +++\n"); + if (IS_ENABLED(TRACE_DETAIL)) logerror("+++ return from operand address derivation +++\n"); // no clock pulse } @@ -2080,7 +2080,7 @@ void tms9995_device::return_with_address_copy() m_index = m_caller_index; MPC = m_caller_MPC; // will be increased on return m_address = m_address_saved; - if (TRACE_DETAIL) logerror("+++ return from operand address derivation (auto inc) +++\n"); + if (IS_ENABLED(TRACE_DETAIL)) logerror("+++ return from operand address derivation (auto inc) +++\n"); // no clock pulse } @@ -2121,7 +2121,7 @@ void tms9995_device::return_with_address_copy() void tms9995_device::cru_output_operation() { - if (TRACE_CRU) logerror("CRU output operation, address %04x, value %d\n", m_cru_address, m_cru_value & 0x01); + if (IS_ENABLED(TRACE_CRU)) logerror("CRU output operation, address %04x, value %d\n", m_cru_address, m_cru_value & 0x01); if (m_cru_address == 0x1fda) { @@ -2136,7 +2136,7 @@ void tms9995_device::cru_output_operation() { m_check_ready = false; // FLAG2, FLAG3, and FLAG4 are read-only - if (TRACE_CRU) logerror("set CRU address %04x to %d\n", m_cru_address, m_cru_value&1); + if (IS_ENABLED(TRACE_CRU)) logerror("set CRU address %04x to %d\n", m_cru_address, m_cru_value&1); if ((m_cru_address != 0x1ee4) && (m_cru_address != 0x1ee6) && (m_cru_address != 0x1ee8)) m_flag[(m_cru_address>>1)&0x000f] = (m_cru_value & 0x01); } @@ -2193,7 +2193,7 @@ void tms9995_device::cru_input_operation() // ........ ........ X....... ........ // crubyte = m_cru->read_byte((m_cru_address >> 4)& CRUREADMASK); - if (TRACE_DETAIL) logerror("Need to get next 8 bits (addresses %04x-%04x): %02x\n", (m_cru_address&0xfff0)+14, m_cru_address&0xfff0, crubyte); + if (IS_ENABLED(TRACE_DETAIL)) logerror("Need to get next 8 bits (addresses %04x-%04x): %02x\n", (m_cru_address&0xfff0)+14, m_cru_address&0xfff0, crubyte); m_cru_read = crubyte << 15; m_cru_bits_left = 8; @@ -2205,7 +2205,7 @@ void tms9995_device::cru_input_operation() m_cru_first_read = false; m_pass = m_count; } - if (TRACE_DETAIL) logerror("adjusted value for shift: %06x\n", m_cru_read); + if (IS_ENABLED(TRACE_DETAIL)) logerror("adjusted value for shift: %06x\n", m_cru_read); } crubit = (m_cru_read & 0x8000); @@ -2231,7 +2231,7 @@ void tms9995_device::cru_input_operation() } } - if (TRACE_CRU) logerror("CRU input operation, address %04x, value %d\n", m_cru_address, (crubit & 0x8000)>>15); + if (IS_ENABLED(TRACE_CRU)) logerror("CRU input operation, address %04x, value %d\n", m_cru_address, (crubit & 0x8000)>>15); m_cru_value |= crubit; @@ -2261,11 +2261,11 @@ void tms9995_device::trigger_decrementer() m_decrementer_value--; if (m_decrementer_value==0) { - if (TRACE_DEC) logerror("decrementer reached 0\n"); + if (IS_ENABLED(TRACE_DEC)) logerror("decrementer reached 0\n"); m_decrementer_value = m_starting_count_storage_register; if (m_flag[1]==true) { - if (TRACE_DEC) logerror("decrementer flags interrupt\n"); + if (IS_ENABLED(TRACE_DEC)) logerror("decrementer flags interrupt\n"); m_flag[3] = true; m_int_decrementer = true; } @@ -2314,12 +2314,12 @@ void tms9995_device::operand_address_subprogram() { if (m_regnumber != 0) { - if (TRACE_DETAIL) logerror("indexed addressing\n"); + if (IS_ENABLED(TRACE_DETAIL)) logerror("indexed addressing\n"); MPC = 16; // indexed } else { - if (TRACE_DETAIL) logerror("symbolic addressing\n"); + if (IS_ENABLED(TRACE_DETAIL)) logerror("symbolic addressing\n"); m_address = PC; PC = (PC + 2) & 0xfffe; } @@ -2329,7 +2329,7 @@ void tms9995_device::operand_address_subprogram() m_mem_phase = 1; m_address_add = 0; MPC--; // will be increased in the mail loop - if (TRACE_DETAIL) logerror("*** Operand address derivation; address=%04x; index=%d\n", m_address, MPC+1); + if (IS_ENABLED(TRACE_DETAIL)) logerror("*** Operand address derivation; address=%04x; index=%d\n", m_address, MPC+1); } /* @@ -2471,7 +2471,7 @@ void tms9995_device::alu_add_s_sxc() { set_status_parity((uint8_t)(dest_new>>8)); } - if (TRACE_STATUS) logerror("ST = %04x (val=%04x)\n", ST, m_current_value); + if (IS_ENABLED(TRACE_STATUS)) logerror("ST = %04x (val=%04x)\n", ST, m_current_value); // No clock pulse (will be done by prefetch) } @@ -2518,7 +2518,7 @@ void tms9995_device::alu_blwp() case 4: PC = m_current_value & 0xfffe; n = 0; - if (TRACE_OP) logerror("Context switch complete; WP=%04x, PC=%04x, ST=%04x\n", WP, PC, ST); + if (IS_ENABLED(TRACE_OP)) logerror("Context switch complete; WP=%04x, PC=%04x, ST=%04x\n", WP, PC, ST); break; } m_inst_state++; @@ -2539,7 +2539,7 @@ void tms9995_device::alu_c() set_status_parity((uint8_t)(m_source_value>>8)); } compare_and_set_lae(m_source_value, m_current_value); - if (TRACE_STATUS) logerror("ST = %04x (val1=%04x, val2=%04x)\n", ST, m_source_value, m_current_value); + if (IS_ENABLED(TRACE_STATUS)) logerror("ST = %04x (val1=%04x, val2=%04x)\n", ST, m_source_value, m_current_value); } /* @@ -2550,12 +2550,12 @@ void tms9995_device::alu_ci() // We have the register value in m_source_value, the register address in m_address_saved // and the immediate value in m_current_value compare_and_set_lae(m_source_value, m_current_value); - if (TRACE_STATUS) logerror("ST = %04x (val1=%04x, val2=%04x)\n", ST, m_source_value, m_current_value); + if (IS_ENABLED(TRACE_STATUS)) logerror("ST = %04x (val1=%04x, val2=%04x)\n", ST, m_source_value, m_current_value); } void tms9995_device::alu_clr_seto() { - if (TRACE_OP) logerror("clr/seto: Setting values for address %04x\n", m_address); + if (IS_ENABLED(TRACE_OP)) logerror("clr/seto: Setting values for address %04x\n", m_address); switch (m_command) { case CLR: @@ -2764,14 +2764,14 @@ void tms9995_device::alu_external() if (m_command == IDLE) { - if (TRACE_OP) logerror("Entering IDLE state\n"); + if (IS_ENABLED(TRACE_OP)) logerror("Entering IDLE state\n"); m_idle_state = true; } if (m_command == RSET) { ST &= 0xfff0; - if (TRACE_OP) logerror("RSET, new ST = %04x\n", ST); + if (IS_ENABLED(TRACE_OP)) logerror("RSET, new ST = %04x\n", ST); } if (!m_external_operation.isnull()) @@ -2813,7 +2813,7 @@ void tms9995_device::alu_f3() compare_and_set_lae(m_current_value, 0); } } - if (TRACE_STATUS) logerror("ST = %04x\n", ST); + if (IS_ENABLED(TRACE_STATUS)) logerror("ST = %04x\n", ST); break; } m_inst_state++; @@ -2849,7 +2849,7 @@ void tms9995_device::alu_imm_arithm() m_current_value = (uint16_t)(dest_new & 0xffff); compare_and_set_lae(m_current_value, 0); m_address = m_address_saved; - if (TRACE_STATUS) logerror("ST = %04x (val=%04x)\n", ST, m_current_value); + if (IS_ENABLED(TRACE_STATUS)) logerror("ST = %04x (val=%04x)\n", ST, m_current_value); } /* @@ -2905,11 +2905,11 @@ void tms9995_device::alu_jump() if (!cond) { - if (TRACE_OP) logerror("Jump condition false\n"); + if (IS_ENABLED(TRACE_OP)) logerror("Jump condition false\n"); } else { - if (TRACE_OP) logerror("Jump condition true\n"); + if (IS_ENABLED(TRACE_OP)) logerror("Jump condition true\n"); PC = (PC + (displacement<<1)) & 0xfffe; } } @@ -2929,7 +2929,7 @@ void tms9995_device::alu_ldcr() case 1: // We have read the byte or word into m_current_value. compare_and_set_lae(m_current_value, 0); - if (TRACE_STATUS) logerror("ST = %04x (val=%04x)\n", ST, m_current_value); + if (IS_ENABLED(TRACE_STATUS)) logerror("ST = %04x (val=%04x)\n", ST, m_current_value); // Parity is computed from the complete byte, even when less than // 8 bits are transferred (see [1]). @@ -2961,7 +2961,7 @@ void tms9995_device::alu_li() // The immediate value is still in m_current_value m_address = m_address_saved; compare_and_set_lae(m_current_value, 0); - if (TRACE_STATUS) logerror("ST = %04x (val=%04x)\n", ST, m_current_value); + if (IS_ENABLED(TRACE_STATUS)) logerror("ST = %04x (val=%04x)\n", ST, m_current_value); } void tms9995_device::alu_limi_lwpi() @@ -2970,13 +2970,13 @@ void tms9995_device::alu_limi_lwpi() if (m_command == LIMI) { ST = (ST & 0xfff0) | (m_current_value & 0x000f); - if (TRACE_OP) logerror("LIMI sets ST = %04x\n", ST); + if (IS_ENABLED(TRACE_OP)) logerror("LIMI sets ST = %04x\n", ST); pulse_clock(1); // needs one more than LWPI } else { WP = m_current_value & 0xfffe; - if (TRACE_OP) logerror("LWPI sets new WP = %04x\n", WP); + if (IS_ENABLED(TRACE_OP)) logerror("LWPI sets new WP = %04x\n", WP); } } @@ -2989,13 +2989,13 @@ void tms9995_device::alu_lst_lwp() if (m_command==LST) { ST = m_current_value; - if (TRACE_OP) logerror("new ST = %04x\n", ST); + if (IS_ENABLED(TRACE_OP)) logerror("new ST = %04x\n", ST); pulse_clock(1); } else { WP = m_current_value & 0xfffe; - if (TRACE_OP) logerror("new WP = %04x\n", WP); + if (IS_ENABLED(TRACE_OP)) logerror("new WP = %04x\n", WP); } } @@ -3013,7 +3013,7 @@ void tms9995_device::alu_mov() set_status_parity((uint8_t)(m_current_value>>8)); } compare_and_set_lae(m_current_value, 0); - if (TRACE_STATUS) logerror("ST = %04x (val=%04x)\n", ST, m_current_value); + if (IS_ENABLED(TRACE_STATUS)) logerror("ST = %04x (val=%04x)\n", ST, m_current_value); // No clock pulse, as next instruction is prefetch } @@ -3106,7 +3106,7 @@ void tms9995_device::alu_rtwp() // Just for debugging purposes m_servicing_interrupt = false; - if (TRACE_OP) logerror("RTWP restored old context (WP=%04x, PC=%04x, ST=%04x)\n", WP, PC, ST); + if (IS_ENABLED(TRACE_OP)) logerror("RTWP restored old context (WP=%04x, PC=%04x, ST=%04x)\n", WP, PC, ST); break; } m_inst_state++; @@ -3159,7 +3159,7 @@ void tms9995_device::alu_shift() } else { - if (TRACE_DETAIL) logerror("Shift operation gets count from R0\n"); + if (IS_ENABLED(TRACE_DETAIL)) logerror("Shift operation gets count from R0\n"); } pulse_clock(1); pulse_clock(1); @@ -3204,7 +3204,7 @@ void tms9995_device::alu_shift() set_status_bit(ST_OV, overflow); compare_and_set_lae(m_current_value, 0); m_address = m_address_saved; // Register address - if (TRACE_STATUS) logerror("ST = %04x (val=%04x)\n", ST, m_current_value); + if (IS_ENABLED(TRACE_STATUS)) logerror("ST = %04x (val=%04x)\n", ST, m_current_value); break; } m_inst_state++; @@ -3300,7 +3300,7 @@ void tms9995_device::alu_single_arithm() m_current_value = dest_new & 0xffff; compare_and_set_lae(m_current_value, 0); - if (TRACE_STATUS) logerror("ST = %04x (val=%04x)\n", ST, m_current_value); + if (IS_ENABLED(TRACE_STATUS)) logerror("ST = %04x (val=%04x)\n", ST, m_current_value); // No clock pulse, as next instruction is prefetch } @@ -3338,7 +3338,7 @@ void tms9995_device::alu_stcr() m_current_value <<= 8; } else n += 8; - if (TRACE_STATUS) logerror("ST = %04x (val=%04x)\n", ST, m_current_value); + if (IS_ENABLED(TRACE_STATUS)) logerror("ST = %04x (val=%04x)\n", ST, m_current_value); break; } m_inst_state++; @@ -3378,7 +3378,7 @@ void tms9995_device::alu_tb() break; case 2: set_status_bit(ST_EQ, m_cru_value!=0); - if (TRACE_STATUS) logerror("ST = %04x\n", ST); + if (IS_ENABLED(TRACE_STATUS)) logerror("ST = %04x\n", ST); break; } m_inst_state++; @@ -3461,7 +3461,7 @@ void tms9995_device::alu_int() case 0: PC = (PC - 2) & 0xfffe; m_address_saved = m_address; - if (TRACE_INTD) logerror("interrupt service (0): Prepare to read vector\n"); + if (IS_ENABLED(TRACE_INTD)) logerror("interrupt service (0): Prepare to read vector\n"); break; case 1: pulse = 2; // two cycles (with the one at the end) @@ -3469,30 +3469,30 @@ void tms9995_device::alu_int() WP = m_current_value & 0xfffe; // new WP m_current_value = ST; m_address = (WP + 30)&0xfffe; - if (TRACE_INTD) logerror("interrupt service (1): Read new WP = %04x, save ST to %04x\n", WP, m_address); + if (IS_ENABLED(TRACE_INTD)) logerror("interrupt service (1): Read new WP = %04x, save ST to %04x\n", WP, m_address); break; case 2: m_address = (WP + 28)&0xfffe; m_current_value = PC; - if (TRACE_INTD) logerror("interrupt service (2): Save PC to %04x\n", m_address); + if (IS_ENABLED(TRACE_INTD)) logerror("interrupt service (2): Save PC to %04x\n", m_address); break; case 3: m_address = (WP + 26)&0xfffe; m_current_value = m_source_value; // old WP - if (TRACE_INTD) logerror("interrupt service (3): Save WP to %04x\n", m_address); + if (IS_ENABLED(TRACE_INTD)) logerror("interrupt service (3): Save WP to %04x\n", m_address); break; case 4: m_address = (m_address_saved + 2) & 0xfffe; - if (TRACE_INTD) logerror("interrupt service (4): Read PC from %04x\n", m_address); + if (IS_ENABLED(TRACE_INTD)) logerror("interrupt service (4): Read PC from %04x\n", m_address); break; case 5: PC = m_current_value & 0xfffe; ST = (ST & 0xfe00) | m_intmask; - if (TRACE_INTD) logerror("interrupt service (5): Context switch complete; WP=%04x, PC=%04x, ST=%04x\n", WP, PC, ST); + if (IS_ENABLED(TRACE_INTD)) logerror("interrupt service (5): Context switch complete; WP=%04x, PC=%04x, ST=%04x\n", WP, PC, ST); if (((m_int_pending & PENDING_MID)!=0) && m_nmi_active) { - if (TRACE_INTD) logerror("interrupt service (6): NMI active after context switch\n"); + if (IS_ENABLED(TRACE_INTD)) logerror("interrupt service (6): NMI active after context switch\n"); m_int_pending &= ~PENDING_MID; m_address = 0xfffc; m_intmask = 0; @@ -3502,7 +3502,7 @@ void tms9995_device::alu_int() { if (m_from_reset) { - if (TRACE_INTD) logerror("interrupt service (6): RESET completed\n"); + if (IS_ENABLED(TRACE_INTD)) logerror("interrupt service (6): RESET completed\n"); // We came from the RESET interrupt m_from_reset = false; ST &= 0x01ff; diff --git a/src/devices/imagedev/flopdrv.cpp b/src/devices/imagedev/flopdrv.cpp index ad0884d3379..cab64aebe6c 100644 --- a/src/devices/imagedev/flopdrv.cpp +++ b/src/devices/imagedev/flopdrv.cpp @@ -355,7 +355,7 @@ void legacy_floppy_image_device::floppy_drive_read_sector_data(int side, int ind floppy_read_indexed_sector(m_floppy, side, m_track, index1, 0, ptr, length); - if (LOG_FLOPPY) + if (IS_ENABLED(LOG_FLOPPY)) log_readwrite("sector_read", side, m_track, index1, (const char *)ptr, length); } @@ -368,7 +368,7 @@ void legacy_floppy_image_device::floppy_drive_write_sector_data(int side, int in if (!m_floppy) return; - if (LOG_FLOPPY) + if (IS_ENABLED(LOG_FLOPPY)) log_readwrite("sector_write", side, m_track, index1, (const char *)ptr, length); floppy_write_indexed_sector(m_floppy, side, m_track, index1, 0, ptr, length, ddam); diff --git a/src/devices/imagedev/floppy.cpp b/src/devices/imagedev/floppy.cpp index fbd508c579a..99d77a7388c 100644 --- a/src/devices/imagedev/floppy.cpp +++ b/src/devices/imagedev/floppy.cpp @@ -634,7 +634,7 @@ void floppy_image_device::stp_w(int state) } if(ocyl != cyl) { - if (TRACE_STEP) logerror("%s: track %d\n", tag(), cyl); + if (IS_ENABLED(TRACE_STEP)) logerror("%s: track %d\n", tag(), cyl); // Do we want a stepper sound? // We plan for 5 zones with possibly specific sounds if (m_make_sound) m_sound_out->step(cyl*5/tracks); @@ -1180,7 +1180,7 @@ void floppy_sound_device::step(int zone) // Changing the pitch does not always sound convincing if (!PITCH_SEEK_SAMPLES) m_seek_pitch = 1; - if (TRACE_AUDIO) logerror("Seek sample = %d, pitch = %f\n", m_seek_playback_sample, m_seek_pitch); + if (IS_ENABLED(TRACE_AUDIO)) logerror("Seek sample = %d, pitch = %f\n", m_seek_playback_sample, m_seek_pitch); // Set the timeout for the seek sound. When it expires, // we assume that the seek process is over, and we'll play the diff --git a/src/devices/imagedev/mfmhd.cpp b/src/devices/imagedev/mfmhd.cpp index 312c597a31c..47a3dbc6125 100644 --- a/src/devices/imagedev/mfmhd.cpp +++ b/src/devices/imagedev/mfmhd.cpp @@ -444,12 +444,12 @@ image_init_result mfm_harddisk_device::call_load() return image_init_result::FAIL; } - if (TRACE_CONFIG) logerror("CHD metadata: %s\n", metadata.c_str()); + if (IS_ENABLED(TRACE_CONFIG)) logerror("CHD metadata: %s\n", metadata.c_str()); // Parse the metadata mfmhd_layout_params param; param.encoding = m_encoding; - if (TRACE_CONFIG) logerror("Set encoding to %d\n", m_encoding); + if (IS_ENABLED(TRACE_CONFIG)) logerror("Set encoding to %d\n", m_encoding); if (sscanf(metadata.c_str(), HARD_DISK_METADATA_FORMAT, ¶m.cylinders, ¶m.heads, ¶m.sectors_per_track, ¶m.sector_size) != 4) { @@ -457,7 +457,7 @@ image_init_result mfm_harddisk_device::call_load() return image_init_result::FAIL; } - if (TRACE_CONFIG) logerror("CHD image has geometry cyl=%d, head=%d, sect=%d, size=%d\n", param.cylinders, param.heads, param.sectors_per_track, param.sector_size); + if (IS_ENABLED(TRACE_CONFIG)) logerror("CHD image has geometry cyl=%d, head=%d, sect=%d, size=%d\n", param.cylinders, param.heads, param.sectors_per_track, param.sector_size); if (m_max_cylinders != 0 && (param.cylinders != m_max_cylinders || param.heads != m_max_heads)) { @@ -483,11 +483,11 @@ image_init_result mfm_harddisk_device::call_load() if (!param.sane_rec()) { - if (TRACE_CONFIG) logerror("Sector arrangement/recording specs have invalid values, applying defaults\n"); + if (IS_ENABLED(TRACE_CONFIG)) logerror("Sector arrangement/recording specs have invalid values, applying defaults\n"); param.reset_rec(); } else - if (TRACE_CONFIG) logerror("MFM HD rec specs: interleave=%d, cylskew=%d, headskew=%d, wpcom=%d, rwc=%d\n", + if (IS_ENABLED(TRACE_CONFIG)) logerror("MFM HD rec specs: interleave=%d, cylskew=%d, headskew=%d, wpcom=%d, rwc=%d\n", param.interleave, param.cylskew, param.headskew, param.write_precomp_cylinder, param.reduced_wcurr_cylinder); state = chdfile->read_metadata(MFM_HARD_DISK_METADATA_TAG, 1, metadata); @@ -502,11 +502,11 @@ image_init_result mfm_harddisk_device::call_load() if (!param.sane_gap()) { - if (TRACE_CONFIG) logerror("MFM HD gap specs have invalid values, applying defaults\n"); + if (IS_ENABLED(TRACE_CONFIG)) logerror("MFM HD gap specs have invalid values, applying defaults\n"); param.reset_gap(); } else - if (TRACE_CONFIG) logerror("MFM HD gap specs: gap1=%d, gap2=%d, gap3=%d, sync=%d, headerlen=%d, ecctype=%d\n", + if (IS_ENABLED(TRACE_CONFIG)) logerror("MFM HD gap specs: gap1=%d, gap2=%d, gap3=%d, sync=%d, headerlen=%d, ecctype=%d\n", param.gap1, param.gap2, param.gap3, param.sync, param.headerlen, param.ecctype); m_format->set_layout_params(param); @@ -527,7 +527,7 @@ image_init_result mfm_harddisk_device::call_load() float realmax = (m_maxseek_time==0)? (m_actual_cylinders * 0.2) : (m_maxseek_time * 0.8); float settle_us = ((m_actual_cylinders-1.0) * realnext - realmax) / (m_actual_cylinders-2.0) * 1000; float step_us = realnext * 1000 - settle_us; - if (TRACE_CONFIG) logerror("Calculated settle time: %0.2f ms, step: %d us\n", settle_us/1000, (int)step_us); + if (IS_ENABLED(TRACE_CONFIG)) logerror("Calculated settle time: %0.2f ms, step: %d us\n", settle_us/1000, (int)step_us); m_settle_time = attotime::from_usec((int)settle_us); m_step_time = attotime::from_usec((int)step_us); @@ -612,7 +612,7 @@ attotime mfm_harddisk_device::track_end_time() if (!m_revolution_start_time.is_never()) { endtime = m_revolution_start_time + nexttime; - if (TRACE_TIMING) logerror("Track start time = %s, end time = %s\n", tts(m_revolution_start_time).c_str(), tts(endtime).c_str()); + if (IS_ENABLED(TRACE_TIMING)) logerror("Track start time = %s, end time = %s\n", tts(m_revolution_start_time).c_str(), tts(endtime).c_str()); } return endtime; } @@ -654,7 +654,7 @@ void mfm_harddisk_device::device_timer(emu_timer &timer, device_timer_id id, int // Start the settle timer m_step_phase = STEP_SETTLE; m_seek_timer->adjust(m_settle_time); - if (TRACE_STEPS && TRACE_DETAIL) logerror("Arrived at target cylinder %d, settling ...\n", m_current_cylinder); + if (IS_ENABLED(TRACE_STEPS && TRACE_DETAIL)) logerror("Arrived at target cylinder %d, settling ...\n", m_current_cylinder); } else { @@ -672,12 +672,12 @@ void mfm_harddisk_device::device_timer(emu_timer &timer, device_timer_id id, int { m_ready = true; m_recalibrated = true; - if (TRACE_STATE) logerror("Spinup complete, drive recalibrated and positioned at cylinder %d; drive is READY\n", m_current_cylinder); + if (IS_ENABLED(TRACE_STATE)) logerror("Spinup complete, drive recalibrated and positioned at cylinder %d; drive is READY\n", m_current_cylinder); if (!m_ready_cb.isnull()) m_ready_cb(this, ASSERT_LINE); } else { - if (TRACE_SIGNALS) logerror("Settling done at cylinder %d, seek complete\n", m_current_cylinder); + if (IS_ENABLED(TRACE_SIGNALS)) logerror("Settling done at cylinder %d, seek complete\n", m_current_cylinder); } m_seek_complete = true; if (!m_seek_complete_cb.isnull()) m_seek_complete_cb(this, ASSERT_LINE); @@ -690,7 +690,7 @@ void mfm_harddisk_device::device_timer(emu_timer &timer, device_timer_id id, int void mfm_harddisk_device::recalibrate() { - if (TRACE_STEPS) logerror("Recalibrate to track 0\n"); + if (IS_ENABLED(TRACE_STEPS)) logerror("Recalibrate to track 0\n"); direction_in_w(CLEAR_LINE); while (-m_track_delta < m_phys_cylinders) { @@ -703,13 +703,13 @@ void mfm_harddisk_device::head_move() { int steps = m_track_delta; if (steps < 0) steps = -steps; - if (TRACE_STEPS) logerror("Moving head by %d step(s) %s\n", steps, (m_track_delta<0)? "outward" : "inward"); + if (IS_ENABLED(TRACE_STEPS)) logerror("Moving head by %d step(s) %s\n", steps, (m_track_delta<0)? "outward" : "inward"); // We simulate the head movement by pausing for n*step_time with n being the cylinder delta m_step_phase = STEP_MOVING; m_seek_timer->adjust(m_step_time * steps); - if (TRACE_TIMING) logerror("Head movement takes %s time\n", tts(m_step_time * steps).c_str()); + if (IS_ENABLED(TRACE_TIMING)) logerror("Head movement takes %s time\n", tts(m_step_time * steps).c_str()); // We pretend that we already arrived // TODO: Check auto truncation? m_current_cylinder += m_track_delta; @@ -721,7 +721,7 @@ void mfm_harddisk_device::head_move() void mfm_harddisk_device::direction_in_w(line_state line) { m_seek_inward = (line == ASSERT_LINE); - if (TRACE_STEPS && TRACE_DETAIL) logerror("Setting seek direction %s\n", m_seek_inward? "inward" : "outward"); + if (IS_ENABLED(TRACE_STEPS && TRACE_DETAIL)) logerror("Setting seek direction %s\n", m_seek_inward? "inward" : "outward"); } /* @@ -772,10 +772,10 @@ void mfm_harddisk_device::step_w(line_state line) // Counter will be adjusted according to the direction (+-1) m_track_delta += (m_seek_inward)? +1 : -1; - if (TRACE_STEPS && TRACE_DETAIL) logerror("Got seek pulse; track delta %d\n", m_track_delta); + if (IS_ENABLED(TRACE_STEPS && TRACE_DETAIL)) logerror("Got seek pulse; track delta %d\n", m_track_delta); if (m_track_delta < -m_phys_cylinders || m_track_delta > m_phys_cylinders) { - if (TRACE_STEPS) logerror("Excessive step pulses - doing auto-truncation\n"); + if (IS_ENABLED(TRACE_STEPS)) logerror("Excessive step pulses - doing auto-truncation\n"); m_autotruncation = true; } m_seek_timer->adjust(attotime::from_usec(250)); // Start step collect timer @@ -808,7 +808,7 @@ bool mfm_harddisk_device::find_position(attotime &from_when, const attotime &lim // Reached the end if (bytepos >= m_trackimage_size) { - if (TRACE_TIMING) logerror("Reached end: rev_start = %s, live = %s\n", tts(m_revolution_start_time).c_str(), tts(from_when).c_str()); + if (IS_ENABLED(TRACE_TIMING)) logerror("Reached end: rev_start = %s, live = %s\n", tts(m_revolution_start_time).c_str(), tts(from_when).c_str()); m_revolution_start_time += m_rev_time; cell = (from_when - m_revolution_start_time).as_ticks(freq); bytepos = cell / 16; @@ -816,7 +816,7 @@ bool mfm_harddisk_device::find_position(attotime &from_when, const attotime &lim if (bytepos < 0) { - if (TRACE_TIMING) logerror("Negative cell number: rev_start = %s, live = %s\n", tts(m_revolution_start_time).c_str(), tts(from_when).c_str()); + if (IS_ENABLED(TRACE_TIMING)) logerror("Negative cell number: rev_start = %s, live = %s\n", tts(m_revolution_start_time).c_str(), tts(from_when).c_str()); bytepos = 0; } bit = cell % 16; @@ -853,12 +853,12 @@ bool mfm_harddisk_device::read(attotime &from_when, const attotime &limit, uint1 { // We will deliver a single bit cdata = ((track[bytepos] << bitpos) & 0x8000) >> 15; - if (TRACE_BITS) logerror("Reading (c=%d,h=%d,bit=%d) at cell %d [%s] = %d\n", m_current_cylinder, m_current_head, bitpos, ((bytepos<<4) + bitpos), tts(fw).c_str(), cdata); + if (IS_ENABLED(TRACE_BITS)) logerror("Reading (c=%d,h=%d,bit=%d) at cell %d [%s] = %d\n", m_current_cylinder, m_current_head, bitpos, ((bytepos<<4) + bitpos), tts(fw).c_str(), cdata); } else { // We will deliver a whole byte - if (TRACE_READ) logerror("Reading (c=%d,h=%d) at position %d\n", m_current_cylinder, m_current_head, bytepos); + if (IS_ENABLED(TRACE_READ)) logerror("Reading (c=%d,h=%d) at position %d\n", m_current_cylinder, m_current_head, bytepos); cdata = track[bytepos]; } return false; @@ -911,7 +911,7 @@ bool mfm_harddisk_device::write(attotime &from_when, const attotime &limit, uint if (wpcom && (params->write_precomp_cylinder == -1 || m_current_cylinder < params->write_precomp_cylinder)) params->write_precomp_cylinder = m_current_cylinder; - if (TRACE_WRITE) if ((bitpos&0x0f)==0) logerror("Wrote data=%04x (c=%d,h=%d) at position %04x, wpcom=%d, rwc=%d\n", track[bytepos], m_current_cylinder, m_current_head, bytepos, wpcom, reduced_wc); + if (IS_ENABLED(TRACE_WRITE)) if ((bitpos&0x0f)==0) logerror("Wrote data=%04x (c=%d,h=%d) at position %04x, wpcom=%d, rwc=%d\n", track[bytepos], m_current_cylinder, m_current_head, bytepos, wpcom, reduced_wc); return false; } @@ -999,7 +999,7 @@ mfmhd_trackimage_cache::mfmhd_trackimage_cache(running_machine &machine): mfmhd_trackimage_cache::~mfmhd_trackimage_cache() { mfmhd_trackimage* current = m_tracks; - if (TRACE_CACHE) m_machine.logerror("[%s:cache] MFM HD cache destroy\n", m_mfmhd->tag()); + if (IS_ENABLED(TRACE_CACHE)) m_machine.logerror("[%s:cache] MFM HD cache destroy\n", m_mfmhd->tag()); while (current != nullptr) { @@ -1030,12 +1030,12 @@ void mfmhd_trackimage_cache::write_back_one() void mfmhd_trackimage_cache::cleanup() { mfmhd_trackimage* current = m_tracks; - if (TRACE_CACHE) m_machine.logerror("[%s:cache] MFM HD cache cleanup\n", m_mfmhd->tag()); + if (IS_ENABLED(TRACE_CACHE)) m_machine.logerror("[%s:cache] MFM HD cache cleanup\n", m_mfmhd->tag()); // Still dirty? while (current != nullptr) { - if (TRACE_CACHE) m_machine.logerror("[%s:cache] MFM HD cache: evict line cylinder=%d head=%d\n", m_mfmhd->tag(), current->cylinder, current->head); + if (IS_ENABLED(TRACE_CACHE)) m_machine.logerror("[%s:cache] MFM HD cache: evict line cylinder=%d head=%d\n", m_mfmhd->tag(), current->cylinder, current->head); if (current->dirty) { m_mfmhd->write_track(current->encdata, current->cylinder, current->head); @@ -1062,7 +1062,7 @@ const char *encnames[] = { "MFM_BITS","MFM_BYTE","SEPARATE","SSIMPLE " }; */ void mfmhd_trackimage_cache::init(mfm_harddisk_device* mfmhd, int tracksize, int trackslots) { - if (TRACE_CACHE) m_machine.logerror("[%s:cache] MFM HD cache init; cache size is %d tracks\n", mfmhd->tag(), trackslots); + if (IS_ENABLED(TRACE_CACHE)) m_machine.logerror("[%s:cache] MFM HD cache init; cache size is %d tracks\n", mfmhd->tag(), trackslots); chd_error state; @@ -1078,7 +1078,7 @@ void mfmhd_trackimage_cache::init(mfm_harddisk_device* mfmhd, int tracksize, int while (track < trackslots) { - if (TRACE_CACHE && TRACE_DETAIL) m_machine.logerror("[%s:cache] MFM HD allocate cache slot\n", mfmhd->tag()); + if (IS_ENABLED(TRACE_CACHE && TRACE_DETAIL)) m_machine.logerror("[%s:cache] MFM HD allocate cache slot\n", mfmhd->tag()); previous = current; current = global_alloc(mfmhd_trackimage); current->encdata = global_alloc_array(uint16_t, tracksize); @@ -1157,7 +1157,7 @@ uint16_t* mfmhd_trackimage_cache::get_trackimage(int cylinder, int head) // previous points to the second to last element current = previous->next; - if (TRACE_CACHE) m_machine.logerror("[%s:cache] evict line (c=%d,h=%d)\n", m_mfmhd->tag(), current->cylinder, current->head); + if (IS_ENABLED(TRACE_CACHE)) m_machine.logerror("[%s:cache] evict line (c=%d,h=%d)\n", m_mfmhd->tag(), current->cylinder, current->head); if (current->dirty) { diff --git a/src/devices/machine/laserdsc.cpp b/src/devices/machine/laserdsc.cpp index badbd395354..f23c8230dc0 100644 --- a/src/devices/machine/laserdsc.cpp +++ b/src/devices/machine/laserdsc.cpp @@ -497,7 +497,7 @@ void laserdisc_device::set_slider_speed(int32_t tracks_per_vsync) else m_attospertrack = -(vsyncperiod / -tracks_per_vsync).as_attoseconds(); - if (LOG_SLIDER) + if (IS_ENABLED(LOG_SLIDER)) printf("Slider speed = %d\n", tracks_per_vsync); } @@ -514,7 +514,7 @@ void laserdisc_device::advance_slider(int32_t numtracks) // then update the track position add_and_clamp_track(numtracks); - if (LOG_SLIDER) + if (IS_ENABLED(LOG_SLIDER)) printf("Advance by %d\n", numtracks); } diff --git a/src/devices/sound/cem3394.cpp b/src/devices/sound/cem3394.cpp index 4e264f5be1b..555369cf605 100644 --- a/src/devices/sound/cem3394.cpp +++ b/src/devices/sound/cem3394.cpp @@ -452,7 +452,7 @@ void cem3394_device::set_voltage(int input, double voltage) else { temp = voltage * 0.5; - if (LIMIT_WIDTH) + if (IS_ENABLED(LIMIT_WIDTH)) temp = MINIMUM_WIDTH + (MAXIMUM_WIDTH - MINIMUM_WIDTH) * temp; m_pulse_width = (uint32_t)(temp * FRACTION_ONE_D); m_wave_select |= WAVE_PULSE; diff --git a/src/devices/sound/votrax.cpp b/src/devices/sound/votrax.cpp index 505ccd3d0a6..2bbe34b4415 100644 --- a/src/devices/sound/votrax.cpp +++ b/src/devices/sound/votrax.cpp @@ -508,27 +508,27 @@ void votrax_sc01_device::sound_stream_update(sound_stream &stream, stream_sample uint8_t noise_out_digital = 0; for (int curclock = 0; curclock < half_clocks_per_sample; curclock++) { -if (LOG_TIMING | LOG_LOWPARAM | LOG_GLOTTAL | LOG_TRANSITION) +if (IS_ENABLED(LOG_TIMING | LOG_LOWPARAM | LOG_GLOTTAL | LOG_TRANSITION)) { if (m_counter_34 % 32 == 0 && m_master_clock == 0) { - if (LOG_TIMING) + if (IS_ENABLED(LOG_TIMING)) osd_printf_debug("MCLK C034 L070 L072 BET1 P1 P2 PHI1 PHI2 PH1' PH2' SUBC C088 C084 L092 IIRQ "); - if (LOG_LOWPARAM) + if (IS_ENABLED(LOG_LOWPARAM)) osd_printf_debug("F132 F114 F112 F142 L080 "); - if (LOG_GLOTTAL) + if (IS_ENABLED(LOG_GLOTTAL)) osd_printf_debug("C220 C222 C224 C234 C236 FGAT GLSY "); - if (LOG_TRANSITION) + if (IS_ENABLED(LOG_TRANSITION)) osd_printf_debug("0625 C046 L046 A0-2 L168 L170 FC VA FA F1 F2 F3 F2Q "); osd_printf_debug("\n"); } - if (LOG_TIMING) + if (IS_ENABLED(LOG_TIMING)) osd_printf_debug("%4X %4X %4X %4X %4X %4X %4X %4X %4X %4X %4X %4X %4X %4X %4X %4X ", m_master_clock, m_counter_34, m_latch_70, m_latch_72, m_beta1, m_p1, m_p2, m_phi1, m_phi2, m_phi1_20, m_phi2_20, m_subphoneme_count, m_clock_88, m_counter_84, m_latch_92, m_internal_request); - if (LOG_LOWPARAM) + if (IS_ENABLED(LOG_LOWPARAM)) osd_printf_debug("%d %d %d %d %d ", m_srff_132, m_srff_114, m_srff_112, m_srff_142, m_latch_80); - if (LOG_GLOTTAL) + if (IS_ENABLED(LOG_GLOTTAL)) osd_printf_debug("%4X %4X %4X %4X %4X %4X %4X ", m_counter_220, m_counter_222, m_counter_224, m_counter_234, m_counter_236, m_fgate, m_glottal_sync); - if (LOG_TRANSITION) + if (IS_ENABLED(LOG_TRANSITION)) osd_printf_debug("%4X %4X %4X %4X %4X %4X %4X %4X %4X %4X %4X %4X %4X ", m_0625_clock, m_counter_46, m_latch_46, m_latch_72 & 7, m_latch_168, m_latch_170, m_fc, m_va, m_fa, m_f1, m_f2, m_f3, m_f2q); osd_printf_debug("\n"); } @@ -771,7 +771,7 @@ osd_printf_debug("[PH=%02X]\n", m_latch_80); } // counter 222 is always enabled - if (1) + if (IS_ENABLED(1)) { // if counter 220's TC is 1, do a load instead of a count if (counter_220_tc) @@ -781,7 +781,7 @@ osd_printf_debug("[PH=%02X]\n", m_latch_80); } // counter 236 is always enabled - if (1) + if (IS_ENABLED(1)) { m_counter_236 = (m_counter_236 + 1) & 0xf; diff --git a/src/devices/video/poly.h b/src/devices/video/poly.h index d67e570826f..69048a3869f 100644 --- a/src/devices/video/poly.h +++ b/src/devices/video/poly.h @@ -450,7 +450,7 @@ void poly_manager<_BaseType, _ObjectData, _MaxParams, _MaxPolys>::wait(const cha osd_ticks_t time; // remember the start time if we're logging - if (LOG_WAITS) + if (IS_ENABLED(LOG_WAITS)) time = get_profile_ticks(); // wait for all pending work items to complete @@ -463,7 +463,7 @@ void poly_manager<_BaseType, _ObjectData, _MaxParams, _MaxPolys>::wait(const cha work_item_callback(&m_unit[unitnum], 0); // log any long waits - if (LOG_WAITS) + if (IS_ENABLED(LOG_WAITS)) { time = get_profile_ticks() - time; if (time > LOG_WAIT_THRESHOLD) diff --git a/src/frontend/mame/ui/filecreate.cpp b/src/frontend/mame/ui/filecreate.cpp index a1540e403a5..9cb825cd949 100644 --- a/src/frontend/mame/ui/filecreate.cpp +++ b/src/frontend/mame/ui/filecreate.cpp @@ -155,7 +155,7 @@ void menu_file_create::custom_render(void *selectedref, float top, float bottom, void menu_file_create::populate() { std::string buffer; - const image_device_format *format; + const image_device_format *format = nullptr; const std::string *new_image_name; // append the "New Image Name" item @@ -171,8 +171,8 @@ void menu_file_create::populate() item_append(_("New Image Name:"), *new_image_name, 0, ITEMREF_NEW_IMAGE_NAME); // do we support multiple formats? - if (ENABLE_FORMATS) format = m_image->formatlist().front().get(); - if (ENABLE_FORMATS && (format != nullptr)) + if (IS_ENABLED(ENABLE_FORMATS)) format = m_image->formatlist().front().get(); + if (IS_ENABLED(ENABLE_FORMATS) && (format != nullptr)) { item_append(_("Image Format:"), m_current_format->description(), 0, ITEMREF_FORMAT); m_current_format = format; diff --git a/src/lib/formats/cassimg.cpp b/src/lib/formats/cassimg.cpp index 87636b81349..d711aa01770 100644 --- a/src/lib/formats/cassimg.cpp +++ b/src/lib/formats/cassimg.cpp @@ -509,7 +509,7 @@ cassette_image::error cassette_put_samples(cassette_image *cassette, int channel cassette->sample_count = ranges.sample_last + 1; cassette->flags |= CASSETTE_FLAG_DIRTY; - if (LOG_PUT_SAMPLES) + if (IS_ENABLED(LOG_PUT_SAMPLES)) { LOG_FORMATS("cassette_put_samples(): Putting samples TIME=[%2.6g..%2.6g] INDEX=[%i..%i]\n", time_index, time_index + sample_period, diff --git a/src/lib/formats/fdi_dsk.cpp b/src/lib/formats/fdi_dsk.cpp index c703f29cc69..11036e40e51 100644 --- a/src/lib/formats/fdi_dsk.cpp +++ b/src/lib/formats/fdi_dsk.cpp @@ -241,7 +241,7 @@ FLOPPY_CONSTRUCT( fdi_dsk_construct ) tag->tracks = pick_integer_be(header.ltrack, 0, 2) + 1; tag->heads = header.lhead + 1; - if (LOG) + if (IS_ENABLED(LOG)) { LOG_FORMATS("FDI creator: %s\n", header.creator); LOG_FORMATS("FDI comment: %s\n", header.comment); @@ -264,7 +264,7 @@ FLOPPY_CONSTRUCT( fdi_dsk_construct ) uint8_t type = header.track[track].type; int size = header.track[track].size * 256; - if (LOG) LOG_FORMATS("FDI track %d type %02x size %d offset %d\n", track, type, size, offset); + if (IS_ENABLED(LOG)) LOG_FORMATS("FDI track %d type %02x size %d offset %d\n", track, type, size, offset); tag->track_offset[track] = offset; tag->track_type[track] = type; diff --git a/src/lib/util/corefile.cpp b/src/lib/util/corefile.cpp index 264d80f4113..6272ea120ad 100644 --- a/src/lib/util/corefile.cpp +++ b/src/lib/util/corefile.cpp @@ -663,7 +663,7 @@ bool core_in_memory_file::eof() const { // check for buffered chars if (has_putback()) - return 0; + return false; // if the offset == length, we're at EOF return (m_offset >= m_length); diff --git a/src/lib/util/jedparse.cpp b/src/lib/util/jedparse.cpp index c2c9a139a6a..dc7c4ac4706 100644 --- a/src/lib/util/jedparse.cpp +++ b/src/lib/util/jedparse.cpp @@ -137,7 +137,7 @@ static void process_field(jed_data *data, const uint8_t *cursrc, const uint8_t * /* default fuse state (0 or 1) */ case 'F': cursrc++; - if (LOG_PARSE) printf("F%c\n", *cursrc); + if (IS_ENABLED(LOG_PARSE)) printf("F%c\n", *cursrc); if (*cursrc == '0') memset(data->fusemap, 0x00, sizeof(data->fusemap)); else @@ -152,14 +152,14 @@ static void process_field(jed_data *data, const uint8_t *cursrc, const uint8_t * /* read the fuse number */ cursrc++; curfuse = suck_number(&cursrc); - if (LOG_PARSE) printf("L%u\n", curfuse); + if (IS_ENABLED(LOG_PARSE)) printf("L%u\n", curfuse); /* read digits, skipping delimiters */ for ( ; cursrc < srcend; cursrc++) if (*cursrc == '0' || *cursrc == '1') { jed_set_fuse(data, curfuse, *cursrc - '0'); - if (LOG_PARSE) printf(" fuse %u = %d\n", curfuse, 0); + if (IS_ENABLED(LOG_PARSE)) printf(" fuse %u = %d\n", curfuse, 0); if (curfuse >= data->numfuses) data->numfuses = curfuse + 1; curfuse++; diff --git a/src/lib/util/plaparse.cpp b/src/lib/util/plaparse.cpp index d1e7c679f97..518089a8452 100644 --- a/src/lib/util/plaparse.cpp +++ b/src/lib/util/plaparse.cpp @@ -113,14 +113,14 @@ static bool process_terms(jed_data *data, const uint8_t **src, const uint8_t *sr jed_set_fuse(data, data->numfuses++, 0); jed_set_fuse(data, data->numfuses++, 1); - if (LOG_PARSE) printf("01"); + if (IS_ENABLED(LOG_PARSE)) printf("01"); break; case '1': jed_set_fuse(data, data->numfuses++, 1); jed_set_fuse(data, data->numfuses++, 0); - if (LOG_PARSE) printf("10"); + if (IS_ENABLED(LOG_PARSE)) printf("10"); break; // anything goes @@ -128,7 +128,7 @@ static bool process_terms(jed_data *data, const uint8_t **src, const uint8_t *sr jed_set_fuse(data, data->numfuses++, 1); jed_set_fuse(data, data->numfuses++, 1); - if (LOG_PARSE) printf("11"); + if (IS_ENABLED(LOG_PARSE)) printf("11"); break; // this product term is inhibited @@ -136,14 +136,14 @@ static bool process_terms(jed_data *data, const uint8_t **src, const uint8_t *sr jed_set_fuse(data, data->numfuses++, 0); jed_set_fuse(data, data->numfuses++, 0); - if (LOG_PARSE) printf("00"); + if (IS_ENABLED(LOG_PARSE)) printf("00"); break; case ' ': case '\t': if (curinput > 0) { outputs = true; - if (LOG_PARSE) printf(" "); + if (IS_ENABLED(LOG_PARSE)) printf(" "); } break; @@ -160,13 +160,13 @@ static bool process_terms(jed_data *data, const uint8_t **src, const uint8_t *sr if (**src == '1') { jed_set_fuse(data, data->numfuses++, 0); - if (LOG_PARSE) printf("0"); + if (IS_ENABLED(LOG_PARSE)) printf("0"); } else { // write 1 for anything else jed_set_fuse(data, data->numfuses++, 1); - if (LOG_PARSE) printf("1"); + if (IS_ENABLED(LOG_PARSE)) printf("1"); } } } @@ -174,7 +174,7 @@ static bool process_terms(jed_data *data, const uint8_t **src, const uint8_t *sr if (iscrlf(**src) && outputs) { outputs = false; - if (LOG_PARSE) printf("\n"); + if (IS_ENABLED(LOG_PARSE)) printf("\n"); if (curinput != pinfo->inputs || curoutput != pinfo->outputs) return false; @@ -241,7 +241,7 @@ static bool process_field(jed_data *data, const uint8_t **src, const uint8_t *sr if (pinfo->inputs == 0 || pinfo->inputs >= (JED_MAX_FUSES/2)) return false; - if (LOG_PARSE) printf("Inputs: %u\n", pinfo->inputs); + if (IS_ENABLED(LOG_PARSE)) printf("Inputs: %u\n", pinfo->inputs); break; // number of outputs @@ -250,7 +250,7 @@ static bool process_field(jed_data *data, const uint8_t **src, const uint8_t *sr if (pinfo->outputs == 0 || pinfo->outputs >= (JED_MAX_FUSES/2)) return false; - if (LOG_PARSE) printf("Outputs: %u\n", pinfo->outputs); + if (IS_ENABLED(LOG_PARSE)) printf("Outputs: %u\n", pinfo->outputs); break; // number of product terms (optional) @@ -259,12 +259,12 @@ static bool process_field(jed_data *data, const uint8_t **src, const uint8_t *sr if (pinfo->terms == 0 || pinfo->terms >= (JED_MAX_FUSES/2)) return false; - if (LOG_PARSE) printf("Terms: %u\n", pinfo->terms); + if (IS_ENABLED(LOG_PARSE)) printf("Terms: %u\n", pinfo->terms); break; // output polarity (optional) case KW_PHASE: - if (LOG_PARSE) printf("Phase...\n"); + if (IS_ENABLED(LOG_PARSE)) printf("Phase...\n"); while (*src < srcend && !iscrlf(**src) && pinfo->xorptr < (JED_MAX_FUSES/2)) { if (**src == '0' || **src == '1') @@ -280,7 +280,7 @@ static bool process_field(jed_data *data, const uint8_t **src, const uint8_t *sr // end of file (optional) case KW_END: - if (LOG_PARSE) printf("End of file\n"); + if (IS_ENABLED(LOG_PARSE)) printf("End of file\n"); break; } @@ -349,15 +349,15 @@ int pla_parse(const void *data, size_t length, jed_data *result) // write output polarity if (pinfo.xorptr > 0) { - if (LOG_PARSE) printf("Polarity: "); + if (IS_ENABLED(LOG_PARSE)) printf("Polarity: "); for (int i = 0; i < pinfo.outputs; i++) { int bit = pinfo.xorval[i/32] >> (i & 31) & 1; jed_set_fuse(result, result->numfuses++, bit); - if (LOG_PARSE) printf("%d", bit); + if (IS_ENABLED(LOG_PARSE)) printf("%d", bit); } - if (LOG_PARSE) printf("\n"); + if (IS_ENABLED(LOG_PARSE)) printf("\n"); } return JEDERR_NONE; diff --git a/src/lib/util/vbiparse.cpp b/src/lib/util/vbiparse.cpp index bfd145dd99f..dc9c22f9176 100644 --- a/src/lib/util/vbiparse.cpp +++ b/src/lib/util/vbiparse.cpp @@ -204,7 +204,7 @@ bool vbi_parse_white_flag(const uint16_t *source, int sourcewidth, int sourceshi break; /* this is useful for debugging issues with white flag detection */ - if (PRINTF_WHITE_FLAG) + if (IS_ENABLED(PRINTF_WHITE_FLAG)) { printf("Histo: min=%02X max=%02X\n", minval, maxval); for (x = 0; x < 256; x++) @@ -214,7 +214,7 @@ bool vbi_parse_white_flag(const uint16_t *source, int sourcewidth, int sourceshi /* ignore if we have no dynamic range */ if (maxval - minval < 10) { - if (PRINTF_WHITE_FLAG) + if (IS_ENABLED(PRINTF_WHITE_FLAG)) printf("White flag NOT detected; threshold too low\n"); return false; } @@ -242,7 +242,7 @@ bool vbi_parse_white_flag(const uint16_t *source, int sourcewidth, int sourceshi /* return true if it is above the 90% mark */ result = (peakval > minval + 9 * (maxval - minval) / 10); - if (PRINTF_WHITE_FLAG) + if (IS_ENABLED(PRINTF_WHITE_FLAG)) printf("White flag %s: peak=%02X thresh=%02X\n", result ? "detected" : "NOT detected", peakval, minval + 9 * (maxval - minval) / 10); return result; diff --git a/src/mame/audio/exidy.cpp b/src/mame/audio/exidy.cpp index 8a726672e89..6c1feec8894 100644 --- a/src/mame/audio/exidy.cpp +++ b/src/mame/audio/exidy.cpp @@ -862,7 +862,7 @@ READ8_MEMBER( victory_sound_device::response_r ) { uint8_t ret = m_pia1->b_output(); - if (VICTORY_LOG_SOUND) logerror("%04X:!!!! Sound response read = %02X\n", m_maincpu->pcbase(), ret); + if (IS_ENABLED(VICTORY_LOG_SOUND)) logerror("%04X:!!!! Sound response read = %02X\n", m_maincpu->pcbase(), ret); m_pia1_cb1 = 0; m_pia1->cb1_w(m_pia1_cb1); @@ -875,7 +875,7 @@ READ8_MEMBER( victory_sound_device::status_r ) { uint8_t ret = (m_pia1_ca1 << 7) | (m_pia1_cb1 << 6); - if (VICTORY_LOG_SOUND) logerror("%04X:!!!! Sound status read = %02X\n", m_maincpu->pcbase(), ret); + if (IS_ENABLED(VICTORY_LOG_SOUND)) logerror("%04X:!!!! Sound status read = %02X\n", m_maincpu->pcbase(), ret); return ret; } @@ -890,7 +890,7 @@ TIMER_CALLBACK_MEMBER( victory_sound_device::delayed_command_w ) WRITE8_MEMBER( victory_sound_device::command_w ) { - if (VICTORY_LOG_SOUND) logerror("%04X:!!!! Sound command = %02X\n", m_maincpu->pcbase(), data); + if (IS_ENABLED(VICTORY_LOG_SOUND)) logerror("%04X:!!!! Sound command = %02X\n", m_maincpu->pcbase(), data); space.machine().scheduler().synchronize(timer_expired_delegate(FUNC(victory_sound_device::delayed_command_w), this), data); } @@ -898,7 +898,7 @@ WRITE8_MEMBER( victory_sound_device::command_w ) WRITE_LINE_MEMBER( victory_sound_device::irq_clear_w ) { - if (VICTORY_LOG_SOUND) logerror("%s:!!!! Sound IRQ clear = %02X\n", machine().describe_context(), state); + if (IS_ENABLED(VICTORY_LOG_SOUND)) logerror("%s:!!!! Sound IRQ clear = %02X\n", machine().describe_context(), state); if (!state) { @@ -910,7 +910,7 @@ WRITE_LINE_MEMBER( victory_sound_device::irq_clear_w ) WRITE_LINE_MEMBER( victory_sound_device::main_ack_w ) { - if (VICTORY_LOG_SOUND) logerror("%s:!!!! Sound Main ACK W = %02X\n", machine().describe_context(), state); + if (IS_ENABLED(VICTORY_LOG_SOUND)) logerror("%s:!!!! Sound Main ACK W = %02X\n", machine().describe_context(), state); if (m_victory_sound_response_ack_clk && !state) { diff --git a/src/mame/audio/exidy440.cpp b/src/mame/audio/exidy440.cpp index 23fd2ed37a6..166d449f85f 100644 --- a/src/mame/audio/exidy440.cpp +++ b/src/mame/audio/exidy440.cpp @@ -131,7 +131,7 @@ void exidy440_sound_device::device_start() m_mixer_buffer_left = make_unique_clear(clock()); m_mixer_buffer_right = make_unique_clear(clock()); - if (SOUND_LOG) + if (IS_ENABLED(SOUND_LOG)) m_debuglog = fopen("sound.log", "w"); } @@ -141,7 +141,7 @@ void exidy440_sound_device::device_start() void exidy440_sound_device::device_stop() { - if (SOUND_LOG && m_debuglog) + if (IS_ENABLED(SOUND_LOG) && m_debuglog) fclose(m_debuglog); } diff --git a/src/mame/video/victory.cpp b/src/mame/video/victory.cpp index de0b82ff60e..51b3f4cce34 100644 --- a/src/mame/video/victory.cpp +++ b/src/mame/video/victory.cpp @@ -143,7 +143,7 @@ READ8_MEMBER(victory_state::video_control_r) { case 0x00: /* 5XFIQ */ result = m_fgcollx; - if (LOG_COLLISION) logerror("%04X:5XFIQ read = %02X\n", space.device().safe_pcbase(), result); + if (IS_ENABLED(LOG_COLLISION)) logerror("%04X:5XFIQ read = %02X\n", space.device().safe_pcbase(), result); return result; case 0x01: /* 5CLFIQ */ @@ -153,12 +153,12 @@ READ8_MEMBER(victory_state::video_control_r) m_fgcoll = 0; update_irq(); } - if (LOG_COLLISION) logerror("%04X:5CLFIQ read = %02X\n", space.device().safe_pcbase(), result); + if (IS_ENABLED(LOG_COLLISION)) logerror("%04X:5CLFIQ read = %02X\n", space.device().safe_pcbase(), result); return result; case 0x02: /* 5BACKX */ result = m_bgcollx & 0xfc; - if (LOG_COLLISION) logerror("%04X:5BACKX read = %02X\n", space.device().safe_pcbase(), result); + if (IS_ENABLED(LOG_COLLISION)) logerror("%04X:5BACKX read = %02X\n", space.device().safe_pcbase(), result); return result; case 0x03: /* 5BACKY */ @@ -168,7 +168,7 @@ READ8_MEMBER(victory_state::video_control_r) m_bgcoll = 0; update_irq(); } - if (LOG_COLLISION) logerror("%04X:5BACKY read = %02X\n", space.device().safe_pcbase(), result); + if (IS_ENABLED(LOG_COLLISION)) logerror("%04X:5BACKY read = %02X\n", space.device().safe_pcbase(), result); return result; case 0x04: /* 5STAT */ @@ -183,7 +183,7 @@ READ8_MEMBER(victory_state::video_control_r) result |= (~m_vblank_irq & 1) << 5; result |= (~m_bgcoll & 1) << 4; result |= (m_screen->vpos() & 0x100) >> 5; - if (LOG_COLLISION) logerror("%04X:5STAT read = %02X\n", space.device().safe_pcbase(), result); + if (IS_ENABLED(LOG_COLLISION)) logerror("%04X:5STAT read = %02X\n", space.device().safe_pcbase(), result); return result; default: @@ -207,22 +207,22 @@ WRITE8_MEMBER(victory_state::video_control_w) switch (offset) { case 0x00: /* LOAD IL */ - if (LOG_MICROCODE) logerror("%04X:IL=%02X\n", space.device().safe_pcbase(), data); + if (IS_ENABLED(LOG_MICROCODE)) logerror("%04X:IL=%02X\n", space.device().safe_pcbase(), data); micro.i = (micro.i & 0xff00) | (data & 0x00ff); break; case 0x01: /* LOAD IH */ - if (LOG_MICROCODE) logerror("%04X:IH=%02X\n", space.device().safe_pcbase(), data); + if (IS_ENABLED(LOG_MICROCODE)) logerror("%04X:IH=%02X\n", space.device().safe_pcbase(), data); micro.i = (micro.i & 0x00ff) | ((data << 8) & 0xff00); if (micro.cmdlo == 5) { - if (LOG_MICROCODE) logerror(" Command 5 triggered by write to IH\n"); + if (IS_ENABLED(LOG_MICROCODE)) logerror(" Command 5 triggered by write to IH\n"); command5(); } break; case 0x02: /* LOAD CMD */ - if (LOG_MICROCODE) logerror("%04X:CMD=%02X\n", space.device().safe_pcbase(), data); + if (IS_ENABLED(LOG_MICROCODE)) logerror("%04X:CMD=%02X\n", space.device().safe_pcbase(), data); micro.cmd = data; micro.cmdlo = data & 7; if (micro.cmdlo == 0) @@ -231,63 +231,63 @@ WRITE8_MEMBER(victory_state::video_control_w) logerror(" Command 1 triggered\n"); else if (micro.cmdlo == 6) { - if (LOG_MICROCODE) logerror(" Command 6 triggered\n"); + if (IS_ENABLED(LOG_MICROCODE)) logerror(" Command 6 triggered\n"); command6(); } break; case 0x03: /* LOAD G */ - if (LOG_MICROCODE) logerror("%04X:G=%02X\n", space.device().safe_pcbase(), data); + if (IS_ENABLED(LOG_MICROCODE)) logerror("%04X:G=%02X\n", space.device().safe_pcbase(), data); micro.g = data; break; case 0x04: /* LOAD X */ - if (LOG_MICROCODE) logerror("%04X:X=%02X\n", space.device().safe_pcbase(), data); + if (IS_ENABLED(LOG_MICROCODE)) logerror("%04X:X=%02X\n", space.device().safe_pcbase(), data); micro.xp = data; if (micro.cmdlo == 3) { - if (LOG_MICROCODE) logerror(" Command 3 triggered by write to X\n"); + if (IS_ENABLED(LOG_MICROCODE)) logerror(" Command 3 triggered by write to X\n"); command3(); } break; case 0x05: /* LOAD Y */ - if (LOG_MICROCODE) logerror("%04X:Y=%02X\n", space.device().safe_pcbase(), data); + if (IS_ENABLED(LOG_MICROCODE)) logerror("%04X:Y=%02X\n", space.device().safe_pcbase(), data); micro.yp = data; if (micro.cmdlo == 4) { - if (LOG_MICROCODE) logerror(" Command 4 triggered by write to Y\n"); + if (IS_ENABLED(LOG_MICROCODE)) logerror(" Command 4 triggered by write to Y\n"); command4(); } break; case 0x06: /* LOAD R */ - if (LOG_MICROCODE) logerror("%04X:R=%02X\n", space.device().safe_pcbase(), data); + if (IS_ENABLED(LOG_MICROCODE)) logerror("%04X:R=%02X\n", space.device().safe_pcbase(), data); micro.r = data; break; case 0x07: /* LOAD B */ - if (LOG_MICROCODE) logerror("%04X:B=%02X\n", space.device().safe_pcbase(), data); + if (IS_ENABLED(LOG_MICROCODE)) logerror("%04X:B=%02X\n", space.device().safe_pcbase(), data); micro.b = data; if (micro.cmdlo == 2) { - if (LOG_MICROCODE) logerror(" Command 2 triggered by write to B\n"); + if (IS_ENABLED(LOG_MICROCODE)) logerror(" Command 2 triggered by write to B\n"); command2(); } else if (micro.cmdlo == 7) { - if (LOG_MICROCODE) logerror(" Command 7 triggered by write to B\n"); + if (IS_ENABLED(LOG_MICROCODE)) logerror(" Command 7 triggered by write to B\n"); command7(); } break; case 0x08: /* SCROLLX */ - if (LOG_MICROCODE) logerror("%04X:SCROLLX write = %02X\n", space.device().safe_pcbase(), data); + if (IS_ENABLED(LOG_MICROCODE)) logerror("%04X:SCROLLX write = %02X\n", space.device().safe_pcbase(), data); m_scrollx = data; break; case 0x09: /* SCROLLY */ - if (LOG_MICROCODE) logerror("%04X:SCROLLY write = %02X\n", space.device().safe_pcbase(), data); + if (IS_ENABLED(LOG_MICROCODE)) logerror("%04X:SCROLLY write = %02X\n", space.device().safe_pcbase(), data); m_scrolly = data; break; @@ -299,18 +299,18 @@ WRITE8_MEMBER(victory_state::video_control_w) // D3 = SINVERT // D2 = BIR12 // D1 = SELOVER - if (LOG_MICROCODE) logerror("%04X:CONTROL write = %02X\n", space.device().safe_pcbase(), data); + if (IS_ENABLED(LOG_MICROCODE)) logerror("%04X:CONTROL write = %02X\n", space.device().safe_pcbase(), data); m_video_control = data; break; case 0x0b: /* CLRVIRQ */ - if (LOG_MICROCODE) logerror("%04X:CLRVIRQ write = %02X\n", space.device().safe_pcbase(), data); + if (IS_ENABLED(LOG_MICROCODE)) logerror("%04X:CLRVIRQ write = %02X\n", space.device().safe_pcbase(), data); m_vblank_irq = 0; update_irq(); break; default: - if (LOG_MICROCODE) logerror("%04X:video_control_w(%02X) = %02X\n", space.device().safe_pcbase(), offset, data); + if (IS_ENABLED(LOG_MICROCODE)) logerror("%04X:video_control_w(%02X) = %02X\n", space.device().safe_pcbase(), offset, data); break; } } @@ -701,7 +701,7 @@ int victory_state::command4() */ int keep_going = 0; - if (LOG_MICROCODE) logerror("================= EXECUTE BEGIN\n"); + if (IS_ENABLED(LOG_MICROCODE)) logerror("================= EXECUTE BEGIN\n"); count_states(micro, 4); @@ -714,7 +714,7 @@ int victory_state::command4() micro.r = m_gram[0x2001 + micro.pc]; micro.xp = m_rram[0x2001 + micro.pc]; micro.yp = m_bram[0x2001 + micro.pc]; - if (LOG_MICROCODE) logerror("PC=%03X CMD=%02X I=%04X R=%02X X=%02X Y=%02X\n", micro.pc, micro.cmd, micro.i, micro.r, micro.xp, micro.yp); + if (IS_ENABLED(LOG_MICROCODE)) logerror("PC=%03X CMD=%02X I=%04X R=%02X X=%02X Y=%02X\n", micro.pc, micro.cmd, micro.i, micro.r, micro.xp, micro.yp); micro.pc = (micro.pc + 2) & 0x1ff; switch (micro.cmdlo) @@ -730,7 +730,7 @@ int victory_state::command4() } } while (keep_going); - if (LOG_MICROCODE) logerror("================= EXECUTE END\n"); + if (IS_ENABLED(LOG_MICROCODE)) logerror("================= EXECUTE END\n"); return micro.cmd & 0x80; } diff --git a/src/osd/windows/window.cpp b/src/osd/windows/window.cpp index b71ccae5c2b..7c1453f3c6a 100644 --- a/src/osd/windows/window.cpp +++ b/src/osd/windows/window.cpp @@ -990,7 +990,7 @@ void winwindow_ui_pause(running_machine &machine, int pause) } } - if (LOG_TEMP_PAUSE) + if (IS_ENABLED(LOG_TEMP_PAUSE)) osd_printf_verbose("winwindow_ui_pause(): %d --> %d\n", old_temp_pause, ui_temp_pause); }