diff options
Diffstat (limited to 'src/devices/machine/6840ptm.cpp')
-rw-r--r-- | src/devices/machine/6840ptm.cpp | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/src/devices/machine/6840ptm.cpp b/src/devices/machine/6840ptm.cpp index 883821cb039..8921c50201c 100644 --- a/src/devices/machine/6840ptm.cpp +++ b/src/devices/machine/6840ptm.cpp @@ -38,9 +38,9 @@ #include "emu.h" #include "6840ptm.h" +//#define VERBOSE 1 +#include "logmacro.h" -#define PTMVERBOSE 0 -#define PLOG(x) do { if (PTMVERBOSE) logerror x; } while (0) /*************************************************************************** LOCAL VARIABLES @@ -63,18 +63,18 @@ const char *const ptm6840_device::opmode[] = ***************************************************************************/ // device type definition -const device_type PTM6840 = device_creator<ptm6840_device>; +DEFINE_DEVICE_TYPE(PTM6840, ptm6840_device, "ptm6840", "MC6840 PTM") //------------------------------------------------- // ptm6840_device - constructor //------------------------------------------------- ptm6840_device::ptm6840_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, PTM6840, "6840 PTM", tag, owner, clock, "ptm6840", __FILE__), - m_out_cb{*this, *this, *this}, - m_irq_cb(*this) + : device_t(mconfig, PTM6840, tag, owner, clock) + , m_external_clock{ 0.0, 0.0, 0.0 } + , m_out_cb{*this, *this, *this} + , m_irq_cb(*this) { - m_external_clock[0] = m_external_clock[1] = m_external_clock[2] = 0.0; } //------------------------------------------------- @@ -300,7 +300,7 @@ uint16_t ptm6840_device::compute_counter( int counter ) const // If there's no timer, return the count if (!m_enabled[counter]) { - PLOG(("MC6840 #%s: read counter(%d): %d\n", tag(), counter, m_counter[counter])); + LOG("MC6840: read counter(%d): %d\n", counter, m_counter[counter]); return m_counter[counter]; } @@ -308,12 +308,12 @@ uint16_t ptm6840_device::compute_counter( int counter ) const if (m_control_reg[counter] & INTERNAL_CLK_EN) { clk = static_cast<double>(clock()); - PLOG(("MC6840 #%s: %d internal clock freq %f \n", tag(), counter, clk)); + LOG("MC6840: %d internal clock freq %f \n", counter, clk); } else { clk = m_external_clock[counter]; - PLOG(("MC6840 #%s: %d external clock freq %f \n", tag(), counter, clk)); + LOG("MC6840: %d external clock freq %f \n", counter, clk); } // See how many are left int remaining = (m_timer[counter]->remaining() * clk).as_double(); @@ -326,7 +326,7 @@ uint16_t ptm6840_device::compute_counter( int counter ) const int lsb = remaining % divisor; remaining = (msb << 8) | lsb; } - PLOG(("MC6840 #%s: read counter(%d): %d\n", tag(), counter, remaining)); + LOG("MC6840: read counter(%d): %d\n", counter, remaining); return remaining; } @@ -351,12 +351,12 @@ void ptm6840_device::reload_count(int idx) if (m_control_reg[idx] & INTERNAL_CLK_EN) { clk = static_cast<double> (clock()); - PLOG(("MC6840 #%s: %d internal clock freq %f \n", tag(), idx, clk)); + LOG("MC6840: %d internal clock freq %f \n", idx, clk); } else { clk = m_external_clock[idx]; - PLOG(("MC6840 #%s: %d external clock freq %f \n", tag(), idx, clk)); + LOG("MC6840: %d external clock freq %f \n", idx, clk); } // Determine the number of clock periods before we expire @@ -379,7 +379,7 @@ void ptm6840_device::reload_count(int idx) } // Set the timer - PLOG(("MC6840 #%s: reload_count(%d): clock = %f count = %d\n", tag(), idx, clk, count)); + LOG("MC6840: reload_count(%d): clock = %f count = %d\n", idx, clk, count); attotime duration = attotime::from_hz(clk) * count; if (idx == 2) @@ -387,7 +387,7 @@ void ptm6840_device::reload_count(int idx) duration *= m_t3_divisor; } - PLOG(("MC6840 #%s: reload_count(%d): output = %f\n", tag(), idx, duration.as_double())); + LOG("MC6840: reload_count(%d): output = %f\n", idx, duration.as_double()); #if 0 if (!(m_control_reg[idx] & INTERNAL_CLK_EN)) @@ -427,7 +427,7 @@ READ8_MEMBER( ptm6840_device::read ) case PTM_6840_STATUS: { - PLOG(("%s: MC6840 #%s: Status read = %04X\n", machine().describe_context(), tag(), m_status_reg)); + LOG("%s: MC6840: Status read = %04X\n", machine().describe_context(), m_status_reg); m_status_read_since_int |= m_status_reg & 0x07; val = m_status_reg; break; @@ -449,7 +449,7 @@ READ8_MEMBER( ptm6840_device::read ) m_lsb_buffer = result & 0xff; - PLOG(("%s: MC6840 #%s: Counter %d read = %04X\n", machine().describe_context(), tag(), idx, result >> 8)); + LOG("%s: MC6840: Counter %d read = %04X\n", machine().describe_context(), idx, result >> 8); val = result >> 8; break; } @@ -490,10 +490,10 @@ WRITE8_MEMBER( ptm6840_device::write ) m_mode[idx] = (data >> 3) & 0x07; m_control_reg[idx] = data; - PLOG(("MC6840 #%s : Control register %d selected\n", tag(), idx)); - PLOG(("operation mode = %s\n", opmode[ m_mode[idx] ])); - PLOG(("value = %04X\n", m_control_reg[idx])); - PLOG(("t3divisor = %d\n", m_t3_divisor)); + LOG("MC6840: Control register %d selected\n", idx); + LOG("operation mode = %s\n", opmode[m_mode[idx]]); + LOG("value = %04X\n", m_control_reg[idx]); + LOG("t3divisor = %d\n", m_t3_divisor); if (diffs & INTERRUPT_EN) update_interrupts(); @@ -510,7 +510,7 @@ WRITE8_MEMBER( ptm6840_device::write ) // Holding reset down if (data & RESET_TIMERS) { - PLOG(("MC6840 #%s : Timer reset\n", tag())); + LOG("MC6840: Timer reset\n"); for (int i = 0; i < 3; i++) { m_timer[i]->enable(false); @@ -542,7 +542,7 @@ WRITE8_MEMBER( ptm6840_device::write ) case PTM_6840_MSBBUF2: case PTM_6840_MSBBUF3: { - PLOG(("MC6840 #%s msbbuf%d = %02X\n", tag(), offset / 2, data)); + LOG("MC6840 msbbuf%d = %02X\n", offset / 2, data); m_msb_buffer = data; break; } @@ -564,7 +564,7 @@ WRITE8_MEMBER( ptm6840_device::write ) reload_count(idx); } - PLOG(("%s:MC6840 #%s: Counter %d latch = %04X\n", machine().describe_context(), tag(), idx, m_latch[idx])); + LOG("%s:MC6840: Counter %d latch = %04X\n", machine().describe_context(), idx, m_latch[idx]); break; } } @@ -577,7 +577,7 @@ WRITE8_MEMBER( ptm6840_device::write ) void ptm6840_device::timeout(int idx) { - PLOG(("**ptm6840 %s t%d timeout**\n", tag(), idx)); + LOG("**ptm6840 t%d timeout**\n", idx); // Set the interrupt flag m_status_reg |= (1 << idx); @@ -591,7 +591,7 @@ void ptm6840_device::timeout(int idx) case 0: case 2: m_output[idx] = m_output[idx] ^ 1; - PLOG(("**ptm6840 %s t%d output %d **\n", tag(), idx, m_output[idx])); + LOG("**ptm6840 t%d output %d **\n", idx, m_output[idx]); m_out_cb[idx](m_output[idx]); break; @@ -600,7 +600,7 @@ void ptm6840_device::timeout(int idx) if (!m_fired[idx]) { m_output[idx] = 1; - PLOG(("**ptm6840 %s t%d output %d **\n", tag(), idx, m_output[idx])); + LOG("**ptm6840 t%d output %d **\n", idx, m_output[idx]); m_out_cb[idx](m_output[idx]); |