From 9ea37cb4d18aee7bcbb030dba38e01d3885e253a Mon Sep 17 00:00:00 2001 From: AJR Date: Thu, 6 May 2021 13:14:51 -0400 Subject: iwm.cpp, swim2.cpp: Use logmacro and disable logging by default * macadb.cpp: Minor logging improvements --- src/devices/machine/iwm.cpp | 14 +++++++++++--- src/devices/machine/swim2.cpp | 28 ++++++++++++++++++---------- src/mame/machine/macadb.cpp | 12 ++++++------ 3 files changed, 35 insertions(+), 19 deletions(-) diff --git a/src/devices/machine/iwm.cpp b/src/devices/machine/iwm.cpp index e2d1c0202be..0f5663908a7 100644 --- a/src/devices/machine/iwm.cpp +++ b/src/devices/machine/iwm.cpp @@ -11,6 +11,14 @@ #include "emu.h" #include "iwm.h" +#define LOG_CONTROL (1 << 1U) +#define LOG_MODE (1 << 2U) +#define VERBOSE 0 +#include "logmacro.h" + +#define LOGCNTRL(...) LOGMASKED(LOG_CONTROL, __VA_ARGS__) +#define LOGMODE(...) LOGMASKED(LOG_MODE, __VA_ARGS__) + DEFINE_DEVICE_TYPE(IWM, iwm_device, "iwm", "Apple IWM floppy controller") iwm_device::iwm_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, uint32_t q3_clock) : @@ -106,7 +114,7 @@ void iwm_device::set_floppy(floppy_image_device *floppy) sync(); flush_write(); - logerror("floppy %s\n", floppy ? floppy->tag() : "-"); + LOG("floppy %s\n", floppy ? floppy->tag() : "-"); if(m_floppy && (m_control & 0x10)) m_floppy->mon_w(true); @@ -255,7 +263,7 @@ u8 iwm_device::control(int offset, u8 data) if(s == 0xc0 && m_active) slot = "write load / write data"; - logerror("%s control %c%c %c%c %c%c%c%c (%s) [%s, %s] whd=%02x data=%02x\n", + LOGCNTRL("%s control %c%c %c%c %c%c%c%c (%s) [%s, %s] whd=%02x data=%02x\n", machine().time().to_string(), m_control & 0x80 ? '1' : '0', m_control & 0x40 ? '1' : '0', @@ -288,7 +296,7 @@ void iwm_device::mode_w(u8 data) { m_mode = data; m_status = (m_status & 0xe0) | (data & 0x1f); - logerror("mode %02x%s%s%s%s%s%s%s\n", m_mode, + LOGMODE("mode %02x%s%s%s%s%s%s%s\n", m_mode, m_mode & 0x80 ? " b7" : "", m_mode & 0x40 ? " mz-reset" : "", m_mode & 0x20 ? " test" : " normal", diff --git a/src/devices/machine/swim2.cpp b/src/devices/machine/swim2.cpp index 9f2bee96bfc..da26c70cb41 100644 --- a/src/devices/machine/swim2.cpp +++ b/src/devices/machine/swim2.cpp @@ -9,6 +9,14 @@ #include "emu.h" #include "swim2.h" +#define LOG_SETUP (1 << 1U) +#define LOG_MODE (1 << 2U) +#define VERBOSE 0 +#include "logmacro.h" + +#define LOGSETUP(...) LOGMASKED(LOG_SETUP, __VA_ARGS__) +#define LOGMODE(...) LOGMASKED(LOG_MODE, __VA_ARGS__) + DEFINE_DEVICE_TYPE(SWIM2, swim2_device, "swim2", "Apple SWIM2 (Sander/Wozniak Integrated Machine) version 2 floppy controller") swim2_device::swim2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : @@ -121,7 +129,7 @@ void swim2_device::flush_write(u64 when) void swim2_device::show_mode() const { - logerror("mode%s hdsel=%c %c%s %c%c%s\n", + LOGMODE("mode%s hdsel=%c %c%s %c%c%s\n", m_mode & 0x80 ? " motoron" : "", m_mode & 0x20 ? '1' : '0', m_mode & 0x10 ? 'w' : 'r', @@ -209,7 +217,7 @@ u8 swim2_device::read(offs_t offset) } default: - logerror("read %s\n", names[offset & 7]); + LOG("read %s\n", names[offset & 7]); break; } return 0xff; @@ -245,7 +253,7 @@ void swim2_device::write(offs_t offset, u8 data) static const char *const pname[4] = { "late", "time0", "early", "time1" }; - logerror("param[%s] = %02x\n", pname[m_param_idx], data); + LOG("param[%s] = %02x\n", pname[m_param_idx], data); m_param[m_param_idx] = data; m_param_idx = (m_param_idx + 1) & 3; break; @@ -259,7 +267,7 @@ void swim2_device::write(offs_t offset, u8 data) case 5: // setup m_setup = data; m_sel35_cb((m_setup >> 1) & 1); - logerror("setup write=%s %s test=%s %s %s 3.5=%s %s\n", + LOGSETUP("setup write=%s %s test=%s %s %s 3.5=%s %s\n", m_setup & 0x40 ? "gcr" : "mfm", m_setup & 0x20 ? "ibm" : "apple", m_setup & 0x10 ? "on" : "off", @@ -282,7 +290,7 @@ void swim2_device::write(offs_t offset, u8 data) break; default: - logerror("write %s, %02x\n", names[offset & 7], data); + LOG("write %s, %02x\n", names[offset & 7], data); break; } @@ -297,7 +305,7 @@ void swim2_device::write(offs_t offset, u8 data) if((m_mode & 0x18) == 0x18 && ((prev_mode & 0x18) != 0x18)) { // Entering write mode m_current_bit = 0; - logerror("%s write start %s %s floppy=%p\n", machine().time().to_string(), m_setup & 0x40 ? "gcr" : "mfm", m_setup & 0x08 ? "fclk/2" : "fclk", m_floppy); + LOG("%s write start %s %s floppy=%p\n", machine().time().to_string(), m_setup & 0x40 ? "gcr" : "mfm", m_setup & 0x08 ? "fclk/2" : "fclk", m_floppy); m_flux_write_start = m_last_sync; m_flux_write_count = 0; @@ -307,7 +315,7 @@ void swim2_device::write(offs_t offset, u8 data) m_flux_write_start = 0; m_current_bit = 0xff; m_half_cycles_before_change = 0; - logerror("%s write end\n", machine().time().to_string()); + LOG("%s write end\n", machine().time().to_string()); } if((m_mode & 0x18) == 0x08 && ((prev_mode & 0x18) != 0x08)) { @@ -315,20 +323,20 @@ void swim2_device::write(offs_t offset, u8 data) m_current_bit = 0; m_sr = 0; m_mfm_sync_counter = 0; - logerror("%s read start %s %s floppy=%p\n", machine().time().to_string(), m_setup & 0x04 ? "gcr" : "mfm", m_setup & 0x08 ? "fclk/2" : "fclk", m_floppy); + LOG("%s read start %s %s floppy=%p\n", machine().time().to_string(), m_setup & 0x04 ? "gcr" : "mfm", m_setup & 0x08 ? "fclk/2" : "fclk", m_floppy); m_pll.reset(machine().time()); static const int cycles_per_cell[4] = { 16, 31, 31, 63 }; m_pll.set_clock(attotime::from_ticks(cycles_per_cell[(m_setup >> 2) & 3], clock())); - logerror("PLL read clock %s\n", attotime::from_ticks(cycles_per_cell[(m_setup >> 2) & 3], clock()).to_string()); + LOG("PLL read clock %s\n", attotime::from_ticks(cycles_per_cell[(m_setup >> 2) & 3], clock()).to_string()); } else if((prev_mode & 0x18) == 0x08 && (m_mode & 0x18) != 0x08) { // Exiting read mode flush_write(); m_current_bit = 0xff; m_half_cycles_before_change = 0; - logerror("%s read end\n", machine().time().to_string()); + LOG("%s read end\n", machine().time().to_string()); } } diff --git a/src/mame/machine/macadb.cpp b/src/mame/machine/macadb.cpp index 80fc9d68ece..17620477bfd 100644 --- a/src/mame/machine/macadb.cpp +++ b/src/mame/machine/macadb.cpp @@ -290,20 +290,20 @@ static char const *const adb_statenames[4] = { "NEW", "EVEN", "ODD", "IDLE" }; int macadb_device::adb_pollkbd(int update) { - int i, j, keybuf, report, codes[2], result; + int report, codes[2], result; codes[0] = codes[1] = 0xff; // key up report = result = 0; - for (i = 0; i < 6; i++) + for (int i = 0; i < 6; i++) { - keybuf = m_keys[i]->read(); + int keybuf = m_keys[i]->read(); // any changes in this row? if ((keybuf != m_key_matrix[i]) && (report < 2)) { // check each column bit - for (j=0; j<16; j++) + for (int j = 0; j < 16; j++) { if (((keybuf ^ m_key_matrix[i]) >> j) & 1) { @@ -538,7 +538,7 @@ void macadb_device::adb_talk() } else { - LOGMASKED(LOG_TALK_LISTEN, "ADB LISTEN to unknown device, timing out\n"); + LOGMASKED(LOG_TALK_LISTEN, "ADB LISTEN to unknown device %d, timing out\n", addr); m_adb_direction = 0; } break; @@ -1118,7 +1118,7 @@ WRITE_LINE_MEMBER(macadb_device::adb_linechange_w) { m_adb_command |= 1; } - LOGMASKED(LOG_LINESTATE, "ADB bit %d\n", m_adb_command & 1); + LOGMASKED(LOG_LINESTATE, "ADB bit %d (dtime = %d)\n", m_adb_command & 1, dtime); if (m_adb_linestate != LST_BIT7) { -- cgit v1.2.3