diff options
author | 2017-01-01 14:03:34 +0100 | |
---|---|---|
committer | 2017-01-01 14:03:34 +0100 | |
commit | d0c0e15a78ac60c2495212082b1cbdce95467831 (patch) | |
tree | 70c8becf4e7faf6c0b59b802e3de0d7826b6e364 /src/devices/machine/6821pia.cpp | |
parent | 424ec5cc1c41cdcbb5a2adb7fdc1baa844bd0807 (diff) |
Updated the LOG mechanism
Diffstat (limited to 'src/devices/machine/6821pia.cpp')
-rw-r--r-- | src/devices/machine/6821pia.cpp | 71 |
1 files changed, 42 insertions, 29 deletions
diff --git a/src/devices/machine/6821pia.cpp b/src/devices/machine/6821pia.cpp index d47e7ffe1cb..1951beee11b 100644 --- a/src/devices/machine/6821pia.cpp +++ b/src/devices/machine/6821pia.cpp @@ -9,14 +9,27 @@ #include "emu.h" #include "6821pia.h" - //************************************************************************** // MACROS //************************************************************************** -#define VERBOSE 0 +#define LOG_GENERAL 0x01 +#define LOG_SETUP 0x02 +#define LOG_PRINTF 0x04 +#define LOG_CA1 0x08 + +#define VERBOSE 0 //(LOG_PRINTF | LOG_SETUP | LOG_GENERAL) + +#define LOGMASK(mask, ...) do { if (VERBOSE & mask) logerror(__VA_ARGS__); } while (0) +#define LOGLEVEL(mask, level, ...) do { if ((VERBOSE & mask) >= level) logerror(__VA_ARGS__); } while (0) + +#define LOG(...) LOGMASK(LOG_GENERAL, __VA_ARGS__) +#define LOGSETUP(...) LOGMASK(LOG_SETUP, __VA_ARGS__) +#define LOGCA1(...) LOGMASK(LOG_CA1, __VA_ARGS__) -#define LOG(x) do { if (VERBOSE) logerror x; } while (0) +#if VERBOSE & LOG_PRINTF +#define logerror printf +#endif #define PIA_IRQ1 (0x80) #define PIA_IRQ2 (0x40) @@ -426,7 +439,7 @@ uint8_t pia6821_device::port_a_r() } } - LOG(("PIA #%s: port A read = %02X\n", tag(), ret)); + LOG("PIA #%s: port A read = %02X\n", tag(), ret); return ret; } @@ -440,7 +453,7 @@ uint8_t pia6821_device::ddr_a_r() { uint8_t ret = m_ddr_a; - LOG(("PIA #%s: DDR A read = %02X\n", tag(), ret)); + LOG("PIA #%s: DDR A read = %02X\n", tag(), ret); return ret; } @@ -468,7 +481,7 @@ uint8_t pia6821_device::port_b_r() m_irq_b2 = false; update_interrupts(); - LOG(("PIA #%s: port B read = %02X\n", tag(), ret)); + LOG("PIA #%s: port B read = %02X\n", tag(), ret); return ret; } @@ -482,7 +495,7 @@ uint8_t pia6821_device::ddr_b_r() { uint8_t ret = m_ddr_b; - LOG(("PIA #%s: DDR B read = %02X\n", tag(), ret)); + LOG("PIA #%s: DDR B read = %02X\n", tag(), ret); return ret; } @@ -531,7 +544,7 @@ uint8_t pia6821_device::control_a_r() ret |= PIA_IRQ2; } - LOG(("PIA #%s: control A read = %02X\n", tag(), ret)); + LOG("PIA #%s: control A read = %02X\n", tag(), ret); return ret; } @@ -576,7 +589,7 @@ uint8_t pia6821_device::control_b_r() ret |= PIA_IRQ2; } - LOG(("PIA #%s: control B read = %02X\n", tag(), ret)); + LOG("PIA #%s: control B read = %02X\n", tag(), ret); return ret; } @@ -638,7 +651,7 @@ void pia6821_device::send_to_out_a_func(const char* message) // input pins are pulled high uint8_t data = get_out_a_value(); - LOG(("PIA #%s: %s = %02X\n", tag(), message, data)); + LOG("PIA #%s: %s = %02X\n", tag(), message, data); if(!m_out_a_handler.isnull()) { @@ -665,7 +678,7 @@ void pia6821_device::send_to_out_b_func(const char* message) // input pins are high-impedance - we just send them as zeros for backwards compatibility uint8_t data = get_out_b_value(); - LOG(("PIA #%s: %s = %02X\n", tag(), message, data)); + LOG("PIA #%s: %s = %02X\n", tag(), message, data); if(!m_out_b_handler.isnull()) { @@ -704,15 +717,15 @@ void pia6821_device::ddr_a_w(uint8_t data) { if(data == 0x00) { - LOG(("PIA #%s: DDR A write = %02X (input mode)\n", tag(), data)); + LOG("PIA #%s: DDR A write = %02X (input mode)\n", tag(), data); } else if(data == 0xff) { - LOG(("PIA #%s: DDR A write = %02X (output mode)\n", tag(), data)); + LOG("PIA #%s: DDR A write = %02X (output mode)\n", tag(), data); } else { - LOG(("PIA #%s: DDR A write = %02X (mixed mode)\n", tag(), data)); + LOG("PIA #%s: DDR A write = %02X (mixed mode)\n", tag(), data); } if(m_ddr_a != data) @@ -759,15 +772,15 @@ void pia6821_device::ddr_b_w(uint8_t data) { if (data == 0x00) { - LOG(("PIA #%s: DDR B write = %02X (input mode)\n", tag(), data)); + LOG("PIA #%s: DDR B write = %02X (input mode)\n", tag(), data); } else if (data == 0xff) { - LOG(("PIA #%s: DDR B write = %02X (output mode)\n", tag(), data)); + LOG("PIA #%s: DDR B write = %02X (output mode)\n", tag(), data); } else { - LOG(("PIA #%s: DDR B write = %02X (mixed mode)\n", tag(), data)); + LOG("PIA #%s: DDR B write = %02X (mixed mode)\n", tag(), data); } if(m_ddr_b != data) @@ -789,7 +802,7 @@ void pia6821_device::control_a_w(uint8_t data) // bit 7 and 6 are read only data &= 0x3f; - LOG(("PIA #%s: control A write = %02X\n", tag(), data)); + LOG("PIA #%s: control A write = %02X\n", tag(), data); // update the control register m_ctl_a = data; @@ -829,7 +842,7 @@ void pia6821_device::control_b_w(uint8_t data) // bit 7 and 6 are read only data &= 0x3f; - LOG(("PIA #%s: control B write = %02X\n", tag(), data)); + LOG("PIA #%s: control B write = %02X\n", tag(), data); // update the control register m_ctl_b = data; @@ -902,7 +915,7 @@ void pia6821_device::set_a_input(uint8_t data, uint8_t z_mask) { assert_always(m_in_a_handler.isnull(), "pia6821_porta_w() called when in_a_func implemented"); - LOG(("PIA #%s: set input port A = %02X\n", tag(), data)); + LOG("PIA #%s: set input port A = %02X\n", tag(), data); m_in_a = data; m_port_a_z_mask = z_mask; @@ -938,12 +951,12 @@ uint8_t pia6821_device::a_output() WRITE_LINE_MEMBER( pia6821_device::ca1_w ) { - LOG(("PIA #%s: set input CA1 = %d\n", tag(), state)); + LOGCA1("PIA #%s: set input CA1 = %d\n", tag(), state); // the new state has caused a transition if((m_in_ca1 != state) && ((state && C1_LOW_TO_HIGH(m_ctl_a)) || (!state && C1_HIGH_TO_LOW(m_ctl_a)))) { - LOG(("PIA #%s: CA1 triggering\n", tag())); + LOGCA1("PIA #%s: CA1 triggering\n", tag()); // mark the IRQ m_irq_a1 = true; @@ -970,12 +983,12 @@ WRITE_LINE_MEMBER( pia6821_device::ca1_w ) WRITE_LINE_MEMBER( pia6821_device::ca2_w ) { - LOG(("PIA #%s: set input CA2 = %d\n", tag(), state)); + LOG("PIA #%s: set input CA2 = %d\n", tag(), state); // if input mode and the new state has caused a transition if(C2_INPUT(m_ctl_a) && (m_in_ca2 != state) && ((state && C2_LOW_TO_HIGH(m_ctl_a)) || (!state && C2_HIGH_TO_LOW(m_ctl_a)))) { - LOG(("PIA #%s: CA2 triggering\n", tag())); + LOG("PIA #%s: CA2 triggering\n", tag()); // mark the IRQ m_irq_a2 = true; @@ -1025,7 +1038,7 @@ void pia6821_device::portb_w(uint8_t data) { assert_always(m_in_b_handler.isnull(), "pia_set_input_b() called when in_b_func implemented"); - LOG(("PIA #%s: set input port B = %02X\n", tag(), data)); + LOG("PIA #%s: set input port B = %02X\n", tag(), data); m_in_b = data; m_in_b_pushed = true; @@ -1050,12 +1063,12 @@ uint8_t pia6821_device::b_output() WRITE_LINE_MEMBER( pia6821_device::cb1_w ) { - LOG(("PIA #%s: set input CB1 = %d\n", tag(), state)); + LOG("PIA #%s: set input CB1 = %d\n", tag(), state); // the new state has caused a transition if((m_in_cb1 != state) && ((state && C1_LOW_TO_HIGH(m_ctl_b)) || (!state && C1_HIGH_TO_LOW(m_ctl_b)))) { - LOG(("PIA #%s: CB1 triggering\n", tag())); + LOG("PIA #%s: CB1 triggering\n", tag()); // mark the IRQ m_irq_b1 = 1; @@ -1081,14 +1094,14 @@ WRITE_LINE_MEMBER( pia6821_device::cb1_w ) WRITE_LINE_MEMBER( pia6821_device::cb2_w ) { - LOG(("PIA #%s: set input CB2 = %d\n", tag(), state)); + LOG("PIA #%s: set input CB2 = %d\n", tag(), state); // if input mode and the new state has caused a transition if (C2_INPUT(m_ctl_b) && (m_in_cb2 != state) && ((state && C2_LOW_TO_HIGH(m_ctl_b)) || (!state && C2_HIGH_TO_LOW(m_ctl_b)))) { - LOG(("PIA #%s: CB2 triggering\n", tag())); + LOG("PIA #%s: CB2 triggering\n", tag()); // mark the IRQ m_irq_b2 = 1; |