mirror of
https://github.com/holub/mame
synced 2025-06-05 20:33:45 +03:00
pokey: Cleanups
- Use logmacro.h instead of custom macros for debug logging and add IRQ logging type - Include the machine context in logging messages rather than the device tag (which gets prepended automatically now) - Replace custom IRQ callback with line handler and allow the output to be cleared properly without HOLD_LINE * a800 et al., maxaflex.cpp: Enable PIA IRQs (these will be useful later)
This commit is contained in:
parent
b3c21ce2e4
commit
c7a2547d7c
@ -100,21 +100,24 @@
|
||||
|
||||
#define POKEY_DEFAULT_GAIN (32767/11/4)
|
||||
|
||||
#define VERBOSE 0
|
||||
#define VERBOSE_SOUND 0
|
||||
#define VERBOSE_TIMER 0
|
||||
#define VERBOSE_POLY 0
|
||||
#define VERBOSE_RAND 0
|
||||
#define VERBOSE_SOUND (1 << 1U)
|
||||
#define VERBOSE_TIMER (1 << 2U)
|
||||
#define VERBOSE_POLY (1 << 3U)
|
||||
#define VERBOSE_RAND (1 << 4U)
|
||||
#define VERBOSE_IRQ (1 << 5U)
|
||||
#define VERBOSE (0)
|
||||
|
||||
#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
|
||||
#include "logmacro.h"
|
||||
|
||||
#define LOG_SOUND(x) do { if (VERBOSE_SOUND) logerror x; } while (0)
|
||||
#define LOG_SOUND(...) LOGMASKED(VERBOSE_SOUND, __VA_ARGS__)
|
||||
|
||||
#define LOG_TIMER(x) do { if (VERBOSE_TIMER) logerror x; } while (0)
|
||||
#define LOG_TIMER(...) LOGMASKED(VERBOSE_TIMER, __VA_ARGS__)
|
||||
|
||||
#define LOG_POLY(x) do { if (VERBOSE_POLY) logerror x; } while (0)
|
||||
#define LOG_POLY(...) LOGMASKED(VERBOSE_POLY, __VA_ARGS__)
|
||||
|
||||
#define LOG_RAND(x) do { if (VERBOSE_RAND) logerror x; } while (0)
|
||||
#define LOG_RAND(...) LOGMASKED(VERBOSE_RAND, __VA_ARGS__)
|
||||
|
||||
#define LOG_IRQ(...) LOGMASKED(VERBOSE_IRQ, __VA_ARGS__)
|
||||
|
||||
#define CHAN1 0
|
||||
#define CHAN2 1
|
||||
@ -200,8 +203,8 @@ pokey_device::pokey_device(const machine_config &mconfig, const char *tag, devic
|
||||
m_allpot_r_cb(*this),
|
||||
m_serin_r_cb(*this),
|
||||
m_serout_w_cb(*this),
|
||||
m_irq_w_cb(*this),
|
||||
m_keyboard_r(*this),
|
||||
m_irq_f(*this),
|
||||
m_output_type(LEGACY_LINEAR),
|
||||
m_serout_ready_timer(nullptr),
|
||||
m_serout_complete_timer(nullptr),
|
||||
@ -226,7 +229,6 @@ void pokey_device::device_start()
|
||||
|
||||
// bind callbacks
|
||||
m_keyboard_r.resolve();
|
||||
m_irq_f.resolve();
|
||||
|
||||
/* calculate the A/D times
|
||||
* In normal, slow mode (SKCTL bit SK_PADDLE is clear) the conversion
|
||||
@ -287,6 +289,7 @@ void pokey_device::device_start()
|
||||
m_allpot_r_cb.resolve();
|
||||
m_serin_r_cb.resolve();
|
||||
m_serout_w_cb.resolve_safe();
|
||||
m_irq_w_cb.resolve_safe();
|
||||
|
||||
m_stream = stream_alloc(0, 1, clock());
|
||||
|
||||
@ -393,18 +396,18 @@ TIMER_CALLBACK_MEMBER(pokey_device::serout_ready_irq)
|
||||
if (m_IRQEN & IRQ_SEROR)
|
||||
{
|
||||
m_IRQST |= IRQ_SEROR;
|
||||
if (!m_irq_f.isnull())
|
||||
m_irq_f(IRQ_SEROR);
|
||||
LOG_IRQ("POKEY SEROR IRQ raised\n");
|
||||
m_irq_w_cb(ASSERT_LINE);
|
||||
}
|
||||
}
|
||||
|
||||
TIMER_CALLBACK_MEMBER(pokey_device::serout_complete_irq)
|
||||
{
|
||||
m_IRQST |= IRQ_SEROC;
|
||||
if (m_IRQEN & IRQ_SEROC)
|
||||
{
|
||||
m_IRQST |= IRQ_SEROC;
|
||||
if (!m_irq_f.isnull())
|
||||
m_irq_f(IRQ_SEROC);
|
||||
LOG_IRQ("POKEY SEROC IRQ raised\n");
|
||||
m_irq_w_cb(ASSERT_LINE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -413,8 +416,8 @@ TIMER_CALLBACK_MEMBER(pokey_device::serin_ready_irq)
|
||||
if (m_IRQEN & IRQ_SERIN)
|
||||
{
|
||||
m_IRQST |= IRQ_SERIN;
|
||||
if (!m_irq_f.isnull())
|
||||
m_irq_f(IRQ_SERIN);
|
||||
LOG_IRQ("POKEY SERIN IRQ raised\n");
|
||||
m_irq_w_cb(ASSERT_LINE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -433,7 +436,9 @@ TIMER_CALLBACK_MEMBER(pokey_device::sync_pot)
|
||||
|
||||
TIMER_CALLBACK_MEMBER(pokey_device::sync_set_irqst)
|
||||
{
|
||||
LOG_IRQ("POKEY TIMR%d IRQ raised\n", param);
|
||||
m_IRQST |= (param & 0xff);
|
||||
m_irq_w_cb(ASSERT_LINE);
|
||||
}
|
||||
|
||||
void pokey_device::execute_run()
|
||||
@ -468,9 +473,9 @@ void pokey_device::step_keyboard()
|
||||
/* check if the break IRQ is enabled */
|
||||
if (m_IRQEN & IRQ_BREAK)
|
||||
{
|
||||
LOG_IRQ("POKEY BREAK IRQ raised\n");
|
||||
m_IRQST |= IRQ_BREAK;
|
||||
if (!m_irq_f.isnull())
|
||||
m_irq_f(IRQ_BREAK);
|
||||
m_irq_w_cb(ASSERT_LINE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -507,9 +512,9 @@ void pokey_device::step_keyboard()
|
||||
/* last interrupt not acknowledged ? */
|
||||
if (m_IRQST & IRQ_KEYBD)
|
||||
m_SKSTAT |= SK_KBERR;
|
||||
LOG_IRQ("POKEY KEYBD IRQ raised\n");
|
||||
m_IRQST |= IRQ_KEYBD;
|
||||
if (!m_irq_f.isnull())
|
||||
m_irq_f(IRQ_KEYBD);
|
||||
m_irq_w_cb(ASSERT_LINE);
|
||||
}
|
||||
m_kbd_state++;
|
||||
}
|
||||
@ -668,9 +673,6 @@ void pokey_device::step_one_clock()
|
||||
else
|
||||
m_channel[CHAN2].m_filter_sample = 1;
|
||||
|
||||
if ((m_IRQST & IRQ_TIMR4) && !m_irq_f.isnull())
|
||||
m_irq_f(IRQ_TIMR4);
|
||||
|
||||
m_old_raw_inval = true;
|
||||
}
|
||||
|
||||
@ -690,10 +692,6 @@ void pokey_device::step_one_clock()
|
||||
// TODO: If two-tone is enabled *and* serial output == 1 then reset the channel 2 timer.
|
||||
|
||||
process_channel(CHAN1);
|
||||
|
||||
// check if some of the requested timer interrupts are enabled
|
||||
if ((m_IRQST & IRQ_TIMR1) && !m_irq_f.isnull())
|
||||
m_irq_f(IRQ_TIMR1);
|
||||
}
|
||||
|
||||
if (m_channel[CHAN2].check_borrow())
|
||||
@ -704,10 +702,6 @@ void pokey_device::step_one_clock()
|
||||
m_channel[CHAN2].reset_channel();
|
||||
|
||||
process_channel(CHAN2);
|
||||
|
||||
// check if some of the requested timer interrupts are enabled
|
||||
if ((m_IRQST & IRQ_TIMR2) && !m_irq_f.isnull())
|
||||
m_irq_f(IRQ_TIMR2);
|
||||
}
|
||||
|
||||
if (m_old_raw_inval)
|
||||
@ -817,12 +811,12 @@ uint8_t pokey_device::read(offs_t offset)
|
||||
{
|
||||
/* we have a value measured */
|
||||
data = m_POTx[pot];
|
||||
LOG(("POKEY '%s' read POT%d (final value) $%02x\n", tag(), pot, data));
|
||||
LOG("%s: POKEY read POT%d (final value) $%02x\n", machine().describe_context(), pot, data);
|
||||
}
|
||||
else
|
||||
{
|
||||
data = m_pot_counter;
|
||||
LOG(("POKEY '%s' read POT%d (interpolated) $%02x\n", tag(), pot, data));
|
||||
LOG("%s: POKEY read POT%d (interpolated) $%02x\n", machine().describe_context(), pot, data);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -834,17 +828,17 @@ uint8_t pokey_device::read(offs_t offset)
|
||||
if ((m_SKCTL & SK_RESET) == 0)
|
||||
{
|
||||
data = m_ALLPOT;
|
||||
LOG(("POKEY '%s' ALLPOT internal $%02x (reset)\n", tag(), data));
|
||||
LOG("%s: POKEY ALLPOT internal $%02x (reset)\n", machine().describe_context(), data);
|
||||
}
|
||||
else if (!m_allpot_r_cb.isnull())
|
||||
{
|
||||
m_ALLPOT = data = m_allpot_r_cb(offset);
|
||||
LOG(("%s: POKEY '%s' ALLPOT callback $%02x\n", machine().describe_context(), tag(), data));
|
||||
LOG("%s: POKEY ALLPOT callback $%02x\n", machine().describe_context(), data);
|
||||
}
|
||||
else
|
||||
{
|
||||
data = m_ALLPOT ^ 0xff;
|
||||
LOG(("POKEY '%s' ALLPOT internal $%02x\n", tag(), data));
|
||||
LOG("%s: POKEY ALLPOT internal $%02x\n", machine().describe_context(), data);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -856,12 +850,12 @@ uint8_t pokey_device::read(offs_t offset)
|
||||
if (m_AUDCTL & POLY9)
|
||||
{
|
||||
data = m_poly9[m_p9] & 0xff;
|
||||
LOG_RAND(("POKEY '%s' rand9[$%05x]: $%02x\n", tag(), m_p9, data));
|
||||
LOG_RAND("%s: POKEY rand9[$%05x]: $%02x\n", machine().describe_context(), m_p9, data);
|
||||
}
|
||||
else
|
||||
{
|
||||
data = (m_poly17[m_p17] >> 8) & 0xff;
|
||||
LOG_RAND(("POKEY '%s' rand17[$%05x]: $%02x\n", tag(), m_p17, data));
|
||||
LOG_RAND("%s: POKEY rand17[$%05x]: $%02x\n", machine().describe_context(), m_p17, data);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -869,24 +863,24 @@ uint8_t pokey_device::read(offs_t offset)
|
||||
if (!m_serin_r_cb.isnull())
|
||||
m_SERIN = m_serin_r_cb(offset);
|
||||
data = m_SERIN;
|
||||
LOG(("POKEY '%s' SERIN $%02x\n", tag(), data));
|
||||
LOG("%s: POKEY SERIN $%02x\n", machine().describe_context(), data);
|
||||
break;
|
||||
|
||||
case IRQST_C:
|
||||
/* IRQST is an active low input port; we keep it active high */
|
||||
/* internally to ease the (un-)masking of bits */
|
||||
data = m_IRQST ^ 0xff;
|
||||
LOG(("POKEY '%s' IRQST $%02x\n", tag(), data));
|
||||
LOG("%s: POKEY IRQST $%02x\n", machine().describe_context(), data);
|
||||
break;
|
||||
|
||||
case SKSTAT_C:
|
||||
/* SKSTAT is also an active low input port */
|
||||
data = m_SKSTAT ^ 0xff;
|
||||
LOG(("POKEY '%s' SKSTAT $%02x\n", tag(), data));
|
||||
LOG("%s: POKEY SKSTAT $%02x\n", machine().describe_context(), data);
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG(("POKEY '%s' register $%02x\n", tag(), offset));
|
||||
LOG("%s: POKEY register $%02x\n", machine().describe_context(), offset);
|
||||
data = 0xff;
|
||||
break;
|
||||
}
|
||||
@ -909,45 +903,45 @@ void pokey_device::write_internal(offs_t offset, uint8_t data)
|
||||
switch (offset & 15)
|
||||
{
|
||||
case AUDF1_C:
|
||||
LOG_SOUND(("POKEY '%s' AUDF1 $%02x\n", tag(), data));
|
||||
LOG_SOUND("%s: AUDF1 = $%02x\n", machine().describe_context(), data);
|
||||
m_channel[CHAN1].m_AUDF = data;
|
||||
break;
|
||||
|
||||
case AUDC1_C:
|
||||
LOG_SOUND(("POKEY '%s' AUDC1 $%02x (%s)\n", tag(), data, audc2str(data)));
|
||||
LOG_SOUND("%s: POKEY AUDC1 $%02x (%s)\n", machine().describe_context(), data, audc2str(data));
|
||||
m_channel[CHAN1].m_AUDC = data;
|
||||
m_old_raw_inval = true;
|
||||
break;
|
||||
|
||||
case AUDF2_C:
|
||||
LOG_SOUND(("POKEY '%s' AUDF2 $%02x\n", tag(), data));
|
||||
LOG_SOUND("%s: POKEY AUDF2 $%02x\n", machine().describe_context(), data);
|
||||
m_channel[CHAN2].m_AUDF = data;
|
||||
break;
|
||||
|
||||
case AUDC2_C:
|
||||
LOG_SOUND(("POKEY '%s' AUDC2 $%02x (%s)\n", tag(), data, audc2str(data)));
|
||||
LOG_SOUND("%s: POKEY AUDC2 $%02x (%s)\n", machine().describe_context(), data, audc2str(data));
|
||||
m_channel[CHAN2].m_AUDC = data;
|
||||
m_old_raw_inval = true;
|
||||
break;
|
||||
|
||||
case AUDF3_C:
|
||||
LOG_SOUND(("POKEY '%s' AUDF3 $%02x\n", tag(), data));
|
||||
LOG_SOUND("%s: POKEY AUDF3 $%02x\n", machine().describe_context(), data);
|
||||
m_channel[CHAN3].m_AUDF = data;
|
||||
break;
|
||||
|
||||
case AUDC3_C:
|
||||
LOG_SOUND(("POKEY '%s' AUDC3 $%02x (%s)\n", tag(), data, audc2str(data)));
|
||||
LOG_SOUND("%s: POKEY AUDC3 $%02x (%s)\n", machine().describe_context(), data, audc2str(data));
|
||||
m_channel[CHAN3].m_AUDC = data;
|
||||
m_old_raw_inval = true;
|
||||
break;
|
||||
|
||||
case AUDF4_C:
|
||||
LOG_SOUND(("POKEY '%s' AUDF4 $%02x\n", tag(), data));
|
||||
LOG_SOUND("%s: POKEY AUDF4 $%02x\n", machine().describe_context(), data);
|
||||
m_channel[CHAN4].m_AUDF = data;
|
||||
break;
|
||||
|
||||
case AUDC4_C:
|
||||
LOG_SOUND(("POKEY '%s' AUDC4 $%02x (%s)\n", tag(), data, audc2str(data)));
|
||||
LOG_SOUND("%s: POKEY AUDC4 $%02x (%s)\n", machine().describe_context(), data, audc2str(data));
|
||||
m_channel[CHAN4].m_AUDC = data;
|
||||
m_old_raw_inval = true;
|
||||
break;
|
||||
@ -955,13 +949,13 @@ void pokey_device::write_internal(offs_t offset, uint8_t data)
|
||||
case AUDCTL_C:
|
||||
if (data == m_AUDCTL)
|
||||
return;
|
||||
LOG_SOUND(("POKEY '%s' AUDCTL $%02x (%s)\n", tag(), data, audctl2str(data)));
|
||||
LOG_SOUND("%s: POKEY AUDCTL $%02x (%s)\n", machine().describe_context(), data, audctl2str(data));
|
||||
m_AUDCTL = data;
|
||||
m_old_raw_inval = true;
|
||||
break;
|
||||
|
||||
case STIMER_C:
|
||||
LOG_TIMER(("POKEY '%s' STIMER $%02x\n", tag(), data));
|
||||
LOG_TIMER("%s: POKEY STIMER $%02x\n", machine().describe_context(), data);
|
||||
|
||||
/* From the pokey documentation:
|
||||
* reset all counters to zero (side effect)
|
||||
@ -979,17 +973,17 @@ void pokey_device::write_internal(offs_t offset, uint8_t data)
|
||||
|
||||
case SKREST_C:
|
||||
/* reset SKSTAT */
|
||||
LOG(("POKEY '%s' SKREST $%02x\n", tag(), data));
|
||||
LOG("%s: POKEY SKREST $%02x\n", machine().describe_context(), data);
|
||||
m_SKSTAT &= ~(SK_FRAME|SK_OVERRUN|SK_KBERR);
|
||||
break;
|
||||
|
||||
case POTGO_C:
|
||||
LOG(("POKEY '%s' POTGO $%02x\n", tag(), data));
|
||||
LOG("%s: POKEY POTGO $%02x\n", machine().describe_context(), data);
|
||||
pokey_potgo();
|
||||
break;
|
||||
|
||||
case SEROUT_C:
|
||||
LOG(("POKEY '%s' SEROUT $%02x\n", tag(), data));
|
||||
LOG("%s: POKEY SEROUT $%02x\n", machine().describe_context(), data);
|
||||
m_serout_w_cb(offset, data);
|
||||
m_SKSTAT |= SK_SEROUT;
|
||||
/*
|
||||
@ -1003,7 +997,7 @@ void pokey_device::write_internal(offs_t offset, uint8_t data)
|
||||
break;
|
||||
|
||||
case IRQEN_C:
|
||||
LOG(("POKEY '%s' IRQEN $%02x\n", tag(), data));
|
||||
LOG("%s: POKEY IRQEN $%02x\n", machine().describe_context(), data);
|
||||
|
||||
/* acknowledge one or more IRQST bits ? */
|
||||
if (m_IRQST & ~data)
|
||||
@ -1016,15 +1010,20 @@ void pokey_device::write_internal(offs_t offset, uint8_t data)
|
||||
/* if SEROC irq is enabled trigger an irq (acid5200 pokey_seroc test) */
|
||||
if (m_IRQEN & m_IRQST & IRQ_SEROC)
|
||||
{
|
||||
if (!m_irq_f.isnull())
|
||||
m_irq_f(IRQ_SEROC);
|
||||
LOG_IRQ("POKEY SEROC IRQ enabled\n");
|
||||
m_irq_w_cb(ASSERT_LINE);
|
||||
}
|
||||
else if (!(m_IRQEN & m_IRQST))
|
||||
{
|
||||
LOG_IRQ("POKEY IRQs all cleared\n");
|
||||
m_irq_w_cb(CLEAR_LINE);
|
||||
}
|
||||
break;
|
||||
|
||||
case SKCTL_C:
|
||||
if (data == m_SKCTL)
|
||||
return;
|
||||
LOG(("POKEY '%s' SKCTL $%02x\n", tag(), data));
|
||||
LOG("%s: POKEY SKCTL $%02x\n", machine().describe_context(), data);
|
||||
m_SKCTL = data;
|
||||
if (!(data & SK_RESET))
|
||||
{
|
||||
@ -1103,7 +1102,7 @@ void pokey_device::pokey_potgo()
|
||||
if (!(m_SKCTL & SK_RESET))
|
||||
return;
|
||||
|
||||
LOG(("POKEY #%p pokey_potgo\n", (void *) this));
|
||||
LOG("pokey_potgo\n");
|
||||
|
||||
m_ALLPOT = 0x00;
|
||||
m_pot_counter = 0;
|
||||
@ -1115,7 +1114,7 @@ void pokey_device::pokey_potgo()
|
||||
{
|
||||
int r = m_pot_r_cb[pot](pot);
|
||||
|
||||
LOG(("POKEY %s pot_r(%d) returned $%02x\n", tag(), pot, r));
|
||||
LOG("POKEY pot_r(%d) returned $%02x\n", pot, r);
|
||||
if (r >= 228)
|
||||
r = 228;
|
||||
|
||||
@ -1156,12 +1155,12 @@ void pokey_device::vol_init()
|
||||
}
|
||||
r_chan[j] = 1.0 / rTot;
|
||||
}
|
||||
if (VERBOSE)
|
||||
if (VERBOSE & LOG_GENERAL)
|
||||
for (int j=0; j<16; j++)
|
||||
{
|
||||
rTot = 1.0 / r_chan[j] + 3.0 / r_chan[0];
|
||||
rTot = 1.0 / rTot;
|
||||
LOG(("%s: %3d - %4.3f\n", tag(), j, rTot / (rTot+pull_up)*4.75));
|
||||
LOG("%3d - %4.3f\n", j, rTot / (rTot+pull_up)*4.75);
|
||||
}
|
||||
for (int j=0; j<0x10000; j++)
|
||||
{
|
||||
@ -1178,7 +1177,7 @@ void pokey_device::vol_init()
|
||||
|
||||
void pokey_device::poly_init_4_5(uint32_t *poly, int size)
|
||||
{
|
||||
LOG_POLY(("poly %d\n", size));
|
||||
LOG_POLY("poly %d\n", size);
|
||||
|
||||
int mask = (1 << size) - 1;
|
||||
uint32_t lfsr = 0;
|
||||
@ -1194,7 +1193,7 @@ void pokey_device::poly_init_4_5(uint32_t *poly, int size)
|
||||
|
||||
void pokey_device::poly_init_9_17(uint32_t *poly, int size)
|
||||
{
|
||||
LOG_RAND(("rand %d\n", size));
|
||||
LOG_RAND("rand %d\n", size);
|
||||
|
||||
const uint32_t mask = util::make_bitmask<uint32_t>(size);
|
||||
uint32_t lfsr = mask;
|
||||
@ -1210,7 +1209,7 @@ void pokey_device::poly_init_9_17(uint32_t *poly, int size)
|
||||
lfsr = (lfsr & 0xff7f) | (in8 << 7);
|
||||
lfsr = (in << 16) | lfsr;
|
||||
*poly = lfsr;
|
||||
LOG_RAND(("%05x: %02x\n", i, *poly));
|
||||
LOG_RAND("%05x: %02x\n", i, *poly);
|
||||
poly++;
|
||||
}
|
||||
}
|
||||
@ -1223,7 +1222,7 @@ void pokey_device::poly_init_9_17(uint32_t *poly, int size)
|
||||
lfsr = lfsr >> 1;
|
||||
lfsr = (in << 8) | lfsr;
|
||||
*poly = lfsr;
|
||||
LOG_RAND(("%05x: %02x\n", i, *poly));
|
||||
LOG_RAND("%05x: %02x\n", i, *poly);
|
||||
poly++;
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,6 @@
|
||||
//**************************************************************************
|
||||
|
||||
#define POKEY_KEYBOARD_CB_MEMBER(_name) uint8_t _name(uint8_t k543210)
|
||||
#define POKEY_INTERRUPT_CB_MEMBER(_name) void _name(int mask)
|
||||
|
||||
//**************************************************************************
|
||||
// TYPE DEFINITIONS
|
||||
@ -131,15 +130,13 @@ public:
|
||||
auto allpot_r() { return m_allpot_r_cb.bind(); }
|
||||
auto serin_r() { return m_serin_r_cb.bind(); }
|
||||
auto serout_w() { return m_serout_w_cb.bind(); }
|
||||
auto irq_w() { return m_irq_w_cb.bind(); }
|
||||
|
||||
/* k543210 = k5 ... k0 returns bit0: kr1, bit1: kr2 */
|
||||
/* all are, in contrast to actual hardware, ACTIVE_HIGH */
|
||||
typedef device_delegate<uint8_t (uint8_t k543210)> kb_cb_delegate;
|
||||
template <typename... T> void set_keyboard_callback(T &&... args) { m_keyboard_r.set(std::forward<T>(args)...); }
|
||||
|
||||
typedef device_delegate<void (int mask)> int_cb_delegate;
|
||||
template <typename... T> void set_interrupt_callback(T &&... args) { m_irq_f.set(std::forward<T>(args)...); }
|
||||
|
||||
uint8_t read(offs_t offset);
|
||||
void write(offs_t offset, uint8_t data);
|
||||
|
||||
@ -279,9 +276,9 @@ private:
|
||||
devcb_read8 m_allpot_r_cb;
|
||||
devcb_read8 m_serin_r_cb;
|
||||
devcb_write8 m_serout_w_cb;
|
||||
devcb_write_line m_irq_w_cb;
|
||||
|
||||
kb_cb_delegate m_keyboard_r;
|
||||
int_cb_delegate m_irq_f;
|
||||
|
||||
uint8_t m_POTx[8]; /* POTx (R/D200-D207) */
|
||||
uint8_t m_AUDCTL; /* AUDCTL (W/D208) */
|
||||
|
@ -44,6 +44,7 @@
|
||||
|
||||
#include "cpu/m6502/m6502.h"
|
||||
#include "machine/6821pia.h"
|
||||
#include "machine/input_merger.h"
|
||||
#include "machine/ram.h"
|
||||
#include "machine/timer.h"
|
||||
#include "atarifdc.h"
|
||||
@ -2176,7 +2177,7 @@ void a400_state::atari_common_nodac(machine_config &config)
|
||||
//m_pokey->oclk_w().set("sio", FUNC(a8sio_device::clock_out_w));
|
||||
//m_pokey->sod_w().set("sio", FUNC(a8sio_device::data_out_w));
|
||||
m_pokey->set_keyboard_callback(FUNC(a400_state::a800_keyboard));
|
||||
m_pokey->set_interrupt_callback(FUNC(a400_state::interrupt_cb));
|
||||
m_pokey->irq_w().set_inputline(m_maincpu, m6502_device::IRQ_LINE);
|
||||
m_pokey->add_route(ALL_OUTPUTS, "speaker", 1.0);
|
||||
}
|
||||
|
||||
@ -2184,6 +2185,9 @@ void a400_state::atari_common(machine_config &config)
|
||||
{
|
||||
atari_common_nodac(config);
|
||||
|
||||
INPUT_MERGER_ANY_HIGH(config, "mainirq").output_handler().set_inputline(m_maincpu, m6502_device::IRQ_LINE);
|
||||
m_pokey->irq_w().set("mainirq", FUNC(input_merger_device::in_w<0>));
|
||||
|
||||
DAC_1BIT(config, "dac", 0).add_route(ALL_OUTPUTS, "speaker", 0.03);
|
||||
|
||||
/* internal ram */
|
||||
@ -2203,6 +2207,8 @@ void a400_state::atari_common(machine_config &config)
|
||||
m_pia->ca2_handler().set("sio", FUNC(a8sio_device::motor_w));
|
||||
m_pia->cb2_handler().set("fdc", FUNC(atari_fdc_device::pia_cb2_w));
|
||||
m_pia->cb2_handler().append("sio", FUNC(a8sio_device::command_w));
|
||||
m_pia->irqa_handler().set("mainirq", FUNC(input_merger_device::in_w<1>));
|
||||
m_pia->irqb_handler().set("mainirq", FUNC(input_merger_device::in_w<2>));
|
||||
|
||||
a8sio_device &sio(A8SIO(config, "sio", nullptr));
|
||||
//sio.clock_in().set("pokey", FUNC(pokey_device::bclk_w));
|
||||
@ -2400,7 +2406,6 @@ void a400_state::a5200(machine_config &config)
|
||||
m_pokey->serin_r().set_constant(0);
|
||||
m_pokey->serout_w().set_nop();
|
||||
m_pokey->set_keyboard_callback(FUNC(a400_state::a5200_keypads));
|
||||
m_pokey->set_interrupt_callback(FUNC(a400_state::interrupt_cb));
|
||||
m_pokey->add_route(ALL_OUTPUTS, "speaker", 1.0);
|
||||
|
||||
ATARI_GTIA(config, m_gtia, 0);
|
||||
|
@ -49,7 +49,6 @@ protected:
|
||||
|
||||
void atari_palette(palette_device &palette) const;
|
||||
|
||||
POKEY_INTERRUPT_CB_MEMBER(interrupt_cb);
|
||||
POKEY_KEYBOARD_CB_MEMBER(a5200_keypads);
|
||||
POKEY_KEYBOARD_CB_MEMBER(a800_keyboard);
|
||||
|
||||
|
@ -14,43 +14,10 @@
|
||||
#include "atari400.h"
|
||||
#include "sound/pokey.h"
|
||||
|
||||
#define VERBOSE_POKEY 1
|
||||
#define VERBOSE_SERIAL 1
|
||||
#define VERBOSE_TIMERS 1
|
||||
|
||||
|
||||
POKEY_INTERRUPT_CB_MEMBER(atari_common_state::interrupt_cb)
|
||||
{
|
||||
if (VERBOSE_POKEY)
|
||||
{
|
||||
if (mask & 0x80)
|
||||
logerror("atari interrupt_cb BREAK\n");
|
||||
if (mask & 0x40)
|
||||
logerror("atari interrupt_cb KBCOD\n");
|
||||
}
|
||||
if (VERBOSE_SERIAL)
|
||||
{
|
||||
if (mask & 0x20)
|
||||
logerror("atari interrupt_cb SERIN\n");
|
||||
if (mask & 0x10)
|
||||
logerror("atari interrupt_cb SEROR\n");
|
||||
if (mask & 0x08)
|
||||
logerror("atari interrupt_cb SEROC\n");
|
||||
}
|
||||
if (VERBOSE_TIMERS)
|
||||
{
|
||||
if (mask & 0x04)
|
||||
logerror("atari interrupt_cb TIMR4\n");
|
||||
if (mask & 0x02)
|
||||
logerror("atari interrupt_cb TIMR2\n");
|
||||
if (mask & 0x01)
|
||||
logerror("atari interrupt_cb TIMR1\n");
|
||||
}
|
||||
|
||||
m_maincpu->set_input_line(0, HOLD_LINE);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************
|
||||
*
|
||||
* Keyboard
|
||||
|
@ -161,7 +161,7 @@ void bartop52_state::a5200(machine_config &config)
|
||||
m_pokey->pot_r<2>().set_ioport("analog_2");
|
||||
m_pokey->pot_r<3>().set_ioport("analog_3");
|
||||
m_pokey->set_keyboard_callback(FUNC(bartop52_state::a5200_keypads));
|
||||
m_pokey->set_interrupt_callback(FUNC(bartop52_state::interrupt_cb));
|
||||
m_pokey->irq_w().set_inputline(m_maincpu, m6502_device::IRQ_LINE);
|
||||
m_pokey->add_route(ALL_OUTPUTS, "mono", 1.00);
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "cpu/m6805/m68705.h"
|
||||
|
||||
#include "machine/6821pia.h"
|
||||
#include "machine/input_merger.h"
|
||||
#include "machine/rescap.h"
|
||||
#include "machine/timer.h"
|
||||
|
||||
@ -331,6 +332,8 @@ void maxaflex_state::maxaflex(machine_config &config)
|
||||
maincpu.set_addrmap(AS_PROGRAM, &maxaflex_state::a600xl_mem);
|
||||
TIMER(config, "scantimer").configure_scanline(FUNC(maxaflex_state::mf_interrupt), "screen", 0, 1);
|
||||
|
||||
INPUT_MERGER_ANY_HIGH(config, "mainirq").output_handler().set_inputline("maincpu", m6502_device::IRQ_LINE);
|
||||
|
||||
M68705P3(config, m_mcu, 3579545);
|
||||
m_mcu->porta_r().set(FUNC(maxaflex_state::mcu_porta_r));
|
||||
m_mcu->porta_w().set(FUNC(maxaflex_state::mcu_porta_w));
|
||||
@ -349,6 +352,8 @@ void maxaflex_state::maxaflex(machine_config &config)
|
||||
pia.readpb_handler().set(FUNC(maxaflex_state::pia_pb_r));
|
||||
pia.writepb_handler().set(FUNC(maxaflex_state::pia_pb_w));
|
||||
pia.cb2_handler().set(FUNC(maxaflex_state::pia_cb2_w));
|
||||
pia.irqa_handler().set("mainirq", FUNC(input_merger_device::in_w<1>));
|
||||
pia.irqb_handler().set("mainirq", FUNC(input_merger_device::in_w<2>));
|
||||
|
||||
/* video hardware */
|
||||
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
|
||||
@ -366,7 +371,7 @@ void maxaflex_state::maxaflex(machine_config &config)
|
||||
SPEAKER(config, "mono").front_center();
|
||||
|
||||
POKEY(config, m_pokey, pokey_device::FREQ_17_EXACT);
|
||||
m_pokey->set_interrupt_callback(FUNC(maxaflex_state::interrupt_cb));
|
||||
m_pokey->irq_w().set("mainirq", FUNC(input_merger_device::in_w<0>));
|
||||
m_pokey->set_output_rc(RES_K(1), CAP_U(0.0), 5.0);
|
||||
m_pokey->add_route(ALL_OUTPUTS, "mono", 1.0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user