From 6909c7a0de2264c67f066c9b0e9dec75d0150459 Mon Sep 17 00:00:00 2001 From: AJR Date: Tue, 13 Mar 2018 01:11:28 -0400 Subject: [PATCH] 68230pit.cpp: Subtle but helpful internal improvements (nw) - Publicize IACK functions - Don't store meaningless dummy value in timer control register so it can be read back - Use logmacro.h for logging (and remove LOG_PRINTF since that no longer works) - Spelling correction for #include guard manohman.cpp: Both interrupts are hooked up now (nw) --- src/devices/machine/68230pit.cpp | 31 +++++++++++-------------------- src/devices/machine/68230pit.h | 11 ++++++----- src/mame/drivers/manohman.cpp | 11 +++++++++-- 3 files changed, 26 insertions(+), 27 deletions(-) diff --git a/src/devices/machine/68230pit.cpp b/src/devices/machine/68230pit.cpp index 5a17c848685..ca9ccc8ca63 100644 --- a/src/devices/machine/68230pit.cpp +++ b/src/devices/machine/68230pit.cpp @@ -26,27 +26,19 @@ #define LOG_GENERAL 0x01 #define LOG_SETUP 0x02 -#define LOG_PRINTF 0x04 -#define LOG_READ 0x08 -#define LOG_BIT 0x10 -#define LOG_DR 0x20 -#define LOG_INT 0x40 +#define LOG_READ 0x04 +#define LOG_BIT 0x08 +#define LOG_DR 0x10 +#define LOG_INT 0x20 -#define VERBOSE 0 //(LOG_PRINTF | LOG_SETUP | LOG_GENERAL | LOG_INT | LOG_BIT | LOG_DR) +#define VERBOSE 0 //(LOG_SETUP | LOG_GENERAL | LOG_INT | LOG_BIT | LOG_DR) +#include "logmacro.h" -#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 LOGR(...) LOGMASK(LOG_READ, __VA_ARGS__) -#define LOGBIT(...) LOGMASK(LOG_BIT, __VA_ARGS__) -#define LOGDR(...) LOGMASK(LOG_DR, __VA_ARGS__) -#define LOGINT(...) LOGMASK(LOG_INT, __VA_ARGS__) - -#if VERBOSE & LOG_PRINTF -#define logerror printf -#endif +#define LOGSETUP(...) LOGMASKED(LOG_SETUP, __VA_ARGS__) +#define LOGR(...) LOGMASKED(LOG_READ, __VA_ARGS__) +#define LOGBIT(...) LOGMASKED(LOG_BIT, __VA_ARGS__) +#define LOGDR(...) LOGMASKED(LOG_DR, __VA_ARGS__) +#define LOGINT(...) LOGMASKED(LOG_INT, __VA_ARGS__) #ifdef _MSC_VER #define FUNCNAME __func__ @@ -687,7 +679,6 @@ void pit68230_device::wr_pitreg_tcr(uint8_t data) else { pit_timer->adjust(attotime::never, TIMER_ID_PIT, attotime::never); - m_tcr = tout + tiack + irq + sqr; // remove this when the variables are used for the different modes!! Just here to to avoid warnings } } diff --git a/src/devices/machine/68230pit.h b/src/devices/machine/68230pit.h index 23c1af3bb09..e34ac52aa65 100644 --- a/src/devices/machine/68230pit.h +++ b/src/devices/machine/68230pit.h @@ -32,8 +32,8 @@ * **********************************************************************/ -#ifndef MAME_MACHIEN_68230PIT_H -#define MAME_MACHIEN_68230PIT_H +#ifndef MAME_MACHINE_68230PIT_H +#define MAME_MACHINE_68230PIT_H #pragma once @@ -172,6 +172,9 @@ public: DECLARE_WRITE_LINE_MEMBER( pc6_w ) { pc_update_bit(6, state); } DECLARE_WRITE_LINE_MEMBER( pc7_w ) { pc_update_bit(7, state); } + uint8_t irq_tiack(); + uint8_t irq_piack(); + private: void wr_pitreg_pgcr(uint8_t data); void wr_pitreg_psrr(uint8_t data); @@ -320,8 +323,6 @@ protected: // Interrupt methods void trigger_interrupt(int source); - uint8_t irq_tiack(); - uint8_t irq_piack(); int m_icount; @@ -379,4 +380,4 @@ protected: // device type definition DECLARE_DEVICE_TYPE(PIT68230, pit68230_device) -#endif // MAME_MACHIEN_68230PIT_H +#endif // MAME_MACHINE_68230PIT_H diff --git a/src/mame/drivers/manohman.cpp b/src/mame/drivers/manohman.cpp index 0e5d765a4b2..bd23d434f16 100644 --- a/src/mame/drivers/manohman.cpp +++ b/src/mame/drivers/manohman.cpp @@ -173,8 +173,12 @@ void manohman_state::machine_start() IRQ_CALLBACK_MEMBER(manohman_state::iack_handler) { - // TODO: fetch 68230 vector - return m_duart->get_irq_vector(); + if (irqline >= M68K_IRQ_4) + return m_duart->get_irq_vector(); + else if (irqline >= M68K_IRQ_2) + return m_pit->irq_tiack(); + else + return M68K_INT_ACK_SPURIOUS; // doesn't really matter } @@ -189,6 +193,8 @@ ADDRESS_MAP_START(manohman_state::mem_map) AM_RANGE(0x300000, 0x300003) AM_DEVWRITE8("saa", saa1099_device, write, 0x00ff) AM_READNOP AM_RANGE(0x400000, 0x40001f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write, 0x00ff) AM_RANGE(0x500000, 0x503fff) AM_RAM AM_SHARE("nvram") //work RAM + AM_RANGE(0x600002, 0x600003) AM_WRITENOP // output through shift register? + AM_RANGE(0x600004, 0x600005) AM_READNOP AM_RANGE(0x600006, 0x600007) AM_NOP //(r) is discarded (watchdog?) ADDRESS_MAP_END @@ -242,6 +248,7 @@ MACHINE_CONFIG_START(manohman_state::manohman) MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(manohman_state, iack_handler) MCFG_DEVICE_ADD("pit", PIT68230, XTAL(8'000'000)) // MC68230P8 + MCFG_PIT68230_TIMER_IRQ_CB(INPUTLINE("maincpu", M68K_IRQ_2)) MCFG_DEVICE_ADD("duart", MC68681, XTAL(3'686'400)) MCFG_MC68681_IRQ_CALLBACK(INPUTLINE("maincpu", M68K_IRQ_4))