mirror of
https://github.com/holub/mame
synced 2025-04-25 09:50:04 +03:00
Cleaned up 6840 device modernization, removing legacy trampolines
and using device timers.
This commit is contained in:
parent
a5a153d114
commit
1c7b9ec528
@ -111,7 +111,7 @@ void ptm6840_device::device_config_complete()
|
||||
void ptm6840_device::device_start()
|
||||
{
|
||||
m_internal_clock = m_internal_clock;
|
||||
/* resolve callbacks */
|
||||
// resolve callbacks
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
m_out_func[i].resolve(m_out_cb[i], *this);
|
||||
@ -130,9 +130,9 @@ void ptm6840_device::device_start()
|
||||
}
|
||||
|
||||
|
||||
m_timer[0] = machine().scheduler().timer_alloc(FUNC(ptm6840_timer1_cb), (void *)this);
|
||||
m_timer[1] = machine().scheduler().timer_alloc(FUNC(ptm6840_timer2_cb), (void *)this);
|
||||
m_timer[2] = machine().scheduler().timer_alloc(FUNC(ptm6840_timer3_cb), (void *)this);
|
||||
m_timer[0] = timer_alloc(0);
|
||||
m_timer[1] = timer_alloc(1);
|
||||
m_timer[2] = timer_alloc(2);
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
@ -141,7 +141,7 @@ void ptm6840_device::device_start()
|
||||
|
||||
m_irq_func.resolve(m_irq_cb, *this);
|
||||
|
||||
/* register for state saving */
|
||||
// register for state saving
|
||||
save_item(NAME(m_lsb_buffer));
|
||||
save_item(NAME(m_msb_buffer));
|
||||
save_item(NAME(m_status_read_since_int));
|
||||
@ -187,48 +187,47 @@ void ptm6840_device::device_reset()
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_timer - handle timer callbacks
|
||||
//-------------------------------------------------
|
||||
|
||||
/*-------------------------------------------------
|
||||
ptm6840_get_status - Get enabled status
|
||||
-------------------------------------------------*/
|
||||
|
||||
int ptm6840_get_status( device_t *device, int clock )
|
||||
void ptm6840_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
|
||||
{
|
||||
return downcast<ptm6840_device*>(device)->ptm6840_get_status(clock);
|
||||
timeout(id);
|
||||
}
|
||||
|
||||
int ptm6840_device::ptm6840_get_status( int clock )
|
||||
|
||||
//-------------------------------------------------
|
||||
// status - Get enabled status
|
||||
//-------------------------------------------------
|
||||
|
||||
int ptm6840_device::status( int clock ) const
|
||||
{
|
||||
return m_enabled[clock - 1];
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
ptm6840_get_irq - Get IRQ state
|
||||
-------------------------------------------------*/
|
||||
//-------------------------------------------------
|
||||
// irq - Get IRQ state
|
||||
//-------------------------------------------------
|
||||
|
||||
int ptm6840_get_irq( device_t *device )
|
||||
{
|
||||
return downcast<ptm6840_device*>(device)->ptm6840_get_irq();
|
||||
}
|
||||
|
||||
int ptm6840_device::ptm6840_get_irq()
|
||||
int ptm6840_device::irq_state() const
|
||||
{
|
||||
return m_IRQ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
subtract_from_counter - Subtract from Counter
|
||||
-------------------------------------------------*/
|
||||
//-------------------------------------------------
|
||||
// subtract_from_counter - Subtract from Counter
|
||||
//-------------------------------------------------
|
||||
|
||||
void ptm6840_device::subtract_from_counter(int counter, int count)
|
||||
{
|
||||
double clock;
|
||||
|
||||
/* Determine the clock frequency for this timer */
|
||||
// Determine the clock frequency for this timer
|
||||
if (m_control_reg[counter] & 0x02)
|
||||
{
|
||||
clock = m_internal_clock;
|
||||
@ -238,53 +237,53 @@ void ptm6840_device::subtract_from_counter(int counter, int count)
|
||||
clock = m_external_clock[counter];
|
||||
}
|
||||
|
||||
/* Dual-byte mode */
|
||||
// Dual-byte mode
|
||||
if (m_control_reg[counter] & 0x04)
|
||||
{
|
||||
int lsb = m_counter[counter] & 0xff;
|
||||
int msb = m_counter[counter] >> 8;
|
||||
|
||||
/* Count the clocks */
|
||||
// Count the clocks
|
||||
lsb -= count;
|
||||
|
||||
/* Loop while we're less than zero */
|
||||
// Loop while we're less than zero
|
||||
while (lsb < 0)
|
||||
{
|
||||
/* Borrow from the MSB */
|
||||
// Borrow from the MSB
|
||||
lsb += (m_latch[counter] & 0xff) + 1;
|
||||
msb--;
|
||||
|
||||
/* If MSB goes less than zero, we've expired */
|
||||
// If MSB goes less than zero, we've expired
|
||||
if (msb < 0)
|
||||
{
|
||||
ptm6840_timeout(counter);
|
||||
timeout(counter);
|
||||
msb = (m_latch[counter] >> 8) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Store the result */
|
||||
// Store the result
|
||||
m_counter[counter] = (msb << 8) | lsb;
|
||||
}
|
||||
|
||||
/* Word mode */
|
||||
// Word mode
|
||||
else
|
||||
{
|
||||
int word = m_counter[counter];
|
||||
|
||||
/* Count the clocks */
|
||||
// Count the clocks
|
||||
word -= count;
|
||||
|
||||
/* loop while we're less than zero */
|
||||
// loop while we're less than zero
|
||||
while (word < 0)
|
||||
{
|
||||
/* Borrow from the MSB */
|
||||
// Borrow from the MSB
|
||||
word += m_latch[counter] + 1;
|
||||
|
||||
/* We've expired */
|
||||
ptm6840_timeout(counter);
|
||||
// We've expired
|
||||
timeout(counter);
|
||||
}
|
||||
|
||||
/* Store the result */
|
||||
// Store the result
|
||||
m_counter[counter] = word;
|
||||
}
|
||||
|
||||
@ -303,11 +302,11 @@ void ptm6840_device::subtract_from_counter(int counter, int count)
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
ptm_tick
|
||||
-------------------------------------------------*/
|
||||
//-------------------------------------------------
|
||||
// tick
|
||||
//-------------------------------------------------
|
||||
|
||||
void ptm6840_device::ptm_tick(int counter, int count)
|
||||
void ptm6840_device::tick(int counter, int count)
|
||||
{
|
||||
if (counter == 2)
|
||||
{
|
||||
@ -327,14 +326,9 @@ void ptm6840_device::ptm_tick(int counter, int count)
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
update_interrupts - Update Internal Interrupts
|
||||
-------------------------------------------------*/
|
||||
|
||||
void update_interrupts( device_t *device )
|
||||
{
|
||||
downcast<ptm6840_device*>(device)->update_interrupts();
|
||||
}
|
||||
//-------------------------------------------------
|
||||
// update_interrupts - Update Internal Interrupts
|
||||
//-------------------------------------------------
|
||||
|
||||
void ptm6840_device::update_interrupts()
|
||||
{
|
||||
@ -361,22 +355,22 @@ void ptm6840_device::update_interrupts()
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
compute_counter - Compute Counter
|
||||
-------------------------------------------------*/
|
||||
//-------------------------------------------------
|
||||
// compute_counter - Compute Counter
|
||||
//-------------------------------------------------
|
||||
|
||||
UINT16 ptm6840_device::compute_counter( int counter )
|
||||
UINT16 ptm6840_device::compute_counter( int counter ) const
|
||||
{
|
||||
double clock;
|
||||
|
||||
/* If there's no timer, return the count */
|
||||
// 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]));
|
||||
return m_counter[counter];
|
||||
}
|
||||
|
||||
/* determine the clock frequency for this timer */
|
||||
// determine the clock frequency for this timer
|
||||
if (m_control_reg[counter] & 0x02)
|
||||
{
|
||||
clock = m_internal_clock;
|
||||
@ -387,10 +381,10 @@ UINT16 ptm6840_device::compute_counter( int counter )
|
||||
clock = m_external_clock[counter];
|
||||
PLOG(("MC6840 #%s: %d external clock freq %f \n", tag(), counter, clock));
|
||||
}
|
||||
/* See how many are left */
|
||||
// See how many are left
|
||||
int remaining = (m_timer[counter]->remaining() * clock).as_double();
|
||||
|
||||
/* Adjust the count for dual byte mode */
|
||||
// Adjust the count for dual byte mode
|
||||
if (m_control_reg[counter] & 0x04)
|
||||
{
|
||||
int divisor = (m_counter[counter] & 0xff) + 1;
|
||||
@ -404,18 +398,18 @@ UINT16 ptm6840_device::compute_counter( int counter )
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
reload_count - Reload Counter
|
||||
-------------------------------------------------*/
|
||||
//-------------------------------------------------
|
||||
// reload_count - Reload Counter
|
||||
//-------------------------------------------------
|
||||
|
||||
void ptm6840_device::reload_count(int idx)
|
||||
{
|
||||
double clock;
|
||||
|
||||
/* Copy the latched value in */
|
||||
// Copy the latched value in
|
||||
m_counter[idx] = m_latch[idx];
|
||||
|
||||
/* Determine the clock frequency for this timer */
|
||||
// Determine the clock frequency for this timer
|
||||
if (m_control_reg[idx] & 0x02)
|
||||
{
|
||||
clock = m_internal_clock;
|
||||
@ -427,7 +421,7 @@ void ptm6840_device::reload_count(int idx)
|
||||
PLOG(("MC6840 #%s: %d external clock freq %f \n", tag(), idx, clock));
|
||||
}
|
||||
|
||||
/* Determine the number of clock periods before we expire */
|
||||
// Determine the number of clock periods before we expire
|
||||
int count = m_counter[idx];
|
||||
if (m_control_reg[idx] & 0x04)
|
||||
{
|
||||
@ -449,7 +443,7 @@ void ptm6840_device::reload_count(int idx)
|
||||
}
|
||||
}
|
||||
|
||||
/* Set the timer */
|
||||
// Set the timer
|
||||
PLOG(("MC6840 #%s: reload_count(%d): clock = %f count = %d\n", tag(), idx, clock, count));
|
||||
|
||||
attotime duration = attotime::from_hz(clock) * count;
|
||||
@ -480,11 +474,16 @@ void ptm6840_device::reload_count(int idx)
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
ptm6840_read - Read Timer
|
||||
-------------------------------------------------*/
|
||||
//-------------------------------------------------
|
||||
// read - Read Timer
|
||||
//-------------------------------------------------
|
||||
|
||||
READ8_DEVICE_HANDLER_TRAMPOLINE(ptm6840, ptm6840_read)
|
||||
READ8_MEMBER( ptm6840_device::read )
|
||||
{
|
||||
return read(offset);
|
||||
}
|
||||
|
||||
UINT8 ptm6840_device::read(offs_t offset)
|
||||
{
|
||||
int val;
|
||||
|
||||
@ -511,7 +510,7 @@ READ8_DEVICE_HANDLER_TRAMPOLINE(ptm6840, ptm6840_read)
|
||||
int idx = (offset - 2) / 2;
|
||||
int result = compute_counter(idx);
|
||||
|
||||
/* Clear the interrupt if the status has been read */
|
||||
// Clear the interrupt if the status has been read
|
||||
if (m_status_read_since_int & (1 << idx))
|
||||
{
|
||||
m_status_reg &= ~(1 << idx);
|
||||
@ -544,11 +543,16 @@ READ8_DEVICE_HANDLER_TRAMPOLINE(ptm6840, ptm6840_read)
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
ptm6840_write - Write Timer
|
||||
-------------------------------------------------*/
|
||||
//-------------------------------------------------
|
||||
// write - Write Timer
|
||||
//-------------------------------------------------
|
||||
|
||||
WRITE8_DEVICE_HANDLER_TRAMPOLINE(ptm6840, ptm6840_write)
|
||||
WRITE8_MEMBER( ptm6840_device::write )
|
||||
{
|
||||
write(offset, data);
|
||||
}
|
||||
|
||||
void ptm6840_device::write(offs_t offset, UINT8 data)
|
||||
{
|
||||
switch ( offset )
|
||||
{
|
||||
@ -568,13 +572,13 @@ WRITE8_DEVICE_HANDLER_TRAMPOLINE(ptm6840, ptm6840_write)
|
||||
|
||||
if (!(m_control_reg[idx] & 0x80 ))
|
||||
{
|
||||
/* Output cleared */
|
||||
// Output cleared
|
||||
m_out_func[idx](0, 0);
|
||||
}
|
||||
/* Reset? */
|
||||
// Reset?
|
||||
if (idx == 0 && (diffs & 0x01))
|
||||
{
|
||||
/* Holding reset down */
|
||||
// Holding reset down
|
||||
if (data & 0x01)
|
||||
{
|
||||
PLOG(("MC6840 #%s : Timer reset\n", tag()));
|
||||
@ -584,7 +588,7 @@ WRITE8_DEVICE_HANDLER_TRAMPOLINE(ptm6840, ptm6840_write)
|
||||
m_enabled[i] = 0;
|
||||
}
|
||||
}
|
||||
/* Releasing reset */
|
||||
// Releasing reset
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
@ -596,7 +600,7 @@ WRITE8_DEVICE_HANDLER_TRAMPOLINE(ptm6840, ptm6840_write)
|
||||
m_status_reg = 0;
|
||||
update_interrupts();
|
||||
|
||||
/* Changing the clock source? (e.g. Zwackery) */
|
||||
// Changing the clock source? (e.g. Zwackery)
|
||||
if (diffs & 0x02)
|
||||
{
|
||||
reload_count(idx);
|
||||
@ -621,11 +625,11 @@ WRITE8_DEVICE_HANDLER_TRAMPOLINE(ptm6840, ptm6840_write)
|
||||
int idx = (offset - 3) / 2;
|
||||
m_latch[idx] = (m_msb_buffer << 8) | (data & 0xff);
|
||||
|
||||
/* Clear the interrupt */
|
||||
// Clear the interrupt
|
||||
m_status_reg &= ~(1 << idx);
|
||||
update_interrupts();
|
||||
|
||||
/* Reload the count if in an appropriate mode */
|
||||
// Reload the count if in an appropriate mode
|
||||
if (!(m_control_reg[idx] & 0x10))
|
||||
{
|
||||
reload_count(idx);
|
||||
@ -638,15 +642,15 @@ WRITE8_DEVICE_HANDLER_TRAMPOLINE(ptm6840, ptm6840_write)
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
ptm6840_timeout - Called if timer is mature
|
||||
-------------------------------------------------*/
|
||||
//-------------------------------------------------
|
||||
// timeout - Called if timer is mature
|
||||
//-------------------------------------------------
|
||||
|
||||
void ptm6840_device::ptm6840_timeout(int idx)
|
||||
void ptm6840_device::timeout(int idx)
|
||||
{
|
||||
PLOG(("**ptm6840 %s t%d timeout**\n", tag(), idx + 1));
|
||||
|
||||
/* Set the interrupt flag */
|
||||
// Set the interrupt flag
|
||||
m_status_reg |= (1 << idx);
|
||||
m_status_read_since_int &= ~(1 << idx);
|
||||
update_interrupts();
|
||||
@ -669,7 +673,7 @@ void ptm6840_device::ptm6840_timeout(int idx)
|
||||
|
||||
m_out_func[idx](0, m_output[idx]);
|
||||
|
||||
/* No changes in output until reinit */
|
||||
// No changes in output until reinit
|
||||
m_fired[idx] = 1;
|
||||
|
||||
m_status_reg |= (1 << idx);
|
||||
@ -683,31 +687,11 @@ void ptm6840_device::ptm6840_timeout(int idx)
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
TIMER_CALLBACKs for Timer 1, 2 & 3
|
||||
-------------------------------------------------*/
|
||||
//-------------------------------------------------
|
||||
// set_gate - set gate status (0 or 1)
|
||||
//-------------------------------------------------
|
||||
|
||||
TIMER_CALLBACK( ptm6840_device::ptm6840_timer1_cb )
|
||||
{
|
||||
reinterpret_cast<ptm6840_device *>(ptr)->ptm6840_timeout(0);
|
||||
}
|
||||
|
||||
TIMER_CALLBACK( ptm6840_device::ptm6840_timer2_cb )
|
||||
{
|
||||
reinterpret_cast<ptm6840_device *>(ptr)->ptm6840_timeout(1);
|
||||
}
|
||||
|
||||
TIMER_CALLBACK( ptm6840_device::ptm6840_timer3_cb )
|
||||
{
|
||||
reinterpret_cast<ptm6840_device *>(ptr)->ptm6840_timeout(2);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
ptm6840_set_gate - set gate status (0 or 1)
|
||||
-------------------------------------------------*/
|
||||
|
||||
void ptm6840_device::ptm6840_set_gate(int state, int idx)
|
||||
void ptm6840_device::set_gate(int idx, int state)
|
||||
{
|
||||
if ( (m_mode[idx] == 0) || (m_mode[idx] == 2) || (m_mode[0] == 4) || (m_mode[idx] == 6) )
|
||||
{
|
||||
@ -719,32 +703,16 @@ void ptm6840_device::ptm6840_set_gate(int state, int idx)
|
||||
m_gate[idx] = state;
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
WRITE8_DEVICE_HANDLERs for Gate 1, 2 & 3
|
||||
-------------------------------------------------*/
|
||||
|
||||
WRITE8_DEVICE_HANDLER( ptm6840_set_g1 )
|
||||
{
|
||||
downcast<ptm6840_device*>(device)->ptm6840_set_gate(data, 0);
|
||||
}
|
||||
|
||||
WRITE8_DEVICE_HANDLER( ptm6840_set_g2 )
|
||||
{
|
||||
downcast<ptm6840_device*>(device)->ptm6840_set_gate(data, 1);
|
||||
}
|
||||
|
||||
WRITE8_DEVICE_HANDLER( ptm6840_set_g3 )
|
||||
{
|
||||
downcast<ptm6840_device*>(device)->ptm6840_set_gate(data, 2);
|
||||
}
|
||||
WRITE_LINE_MEMBER( ptm6840_device::set_g1 ) { set_gate(0, state); }
|
||||
WRITE_LINE_MEMBER( ptm6840_device::set_g2 ) { set_gate(1, state); }
|
||||
WRITE_LINE_MEMBER( ptm6840_device::set_g3 ) { set_gate(2, state); }
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
ptm6840_set_clock - set clock status (0 or 1)
|
||||
-------------------------------------------------*/
|
||||
//-------------------------------------------------
|
||||
// set_clock - set clock status (0 or 1)
|
||||
//-------------------------------------------------
|
||||
|
||||
void ptm6840_device::ptm6840_set_clock(int state, int idx)
|
||||
void ptm6840_device::set_clock(int idx, int state)
|
||||
{
|
||||
m_clk[idx] = state;
|
||||
|
||||
@ -752,57 +720,31 @@ void ptm6840_device::ptm6840_set_clock(int state, int idx)
|
||||
{
|
||||
if (state)
|
||||
{
|
||||
ptm_tick(idx, 1);
|
||||
tick(idx, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
WRITE8_DEVICE_HANDLERs for Clock 1, 2 & 3
|
||||
-------------------------------------------------*/
|
||||
|
||||
WRITE8_DEVICE_HANDLER( ptm6840_set_c1 )
|
||||
{
|
||||
downcast<ptm6840_device*>(device)->ptm6840_set_clock(data, 0);
|
||||
}
|
||||
|
||||
WRITE8_DEVICE_HANDLER( ptm6840_set_c2 )
|
||||
{
|
||||
downcast<ptm6840_device*>(device)->ptm6840_set_clock(data, 1);
|
||||
}
|
||||
|
||||
WRITE8_DEVICE_HANDLER( ptm6840_set_c3 )
|
||||
{
|
||||
downcast<ptm6840_device*>(device)->ptm6840_set_clock(data, 2);
|
||||
}
|
||||
WRITE_LINE_MEMBER( ptm6840_device::set_c1 ) { set_clock(0, state); }
|
||||
WRITE_LINE_MEMBER( ptm6840_device::set_c2 ) { set_clock(1, state); }
|
||||
WRITE_LINE_MEMBER( ptm6840_device::set_c3 ) { set_clock(2, state); }
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
ptm6840_get_count - get count value
|
||||
-------------------------------------------------*/
|
||||
//-------------------------------------------------
|
||||
// count - get count value
|
||||
//-------------------------------------------------
|
||||
|
||||
UINT16 ptm6840_get_count(device_t *device, int counter)
|
||||
{
|
||||
return downcast<ptm6840_device*>(device)->ptm6840_get_count(counter);
|
||||
}
|
||||
|
||||
UINT16 ptm6840_device::ptm6840_get_count(int counter)
|
||||
UINT16 ptm6840_device::count(int counter) const
|
||||
{
|
||||
return compute_counter(counter);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------
|
||||
ptm6840_set_ext_clock - set external clock frequency
|
||||
------------------------------------------------------------*/
|
||||
//-------------------------------------------------
|
||||
// set_ext_clock - set external clock frequency
|
||||
//-------------------------------------------------
|
||||
|
||||
void ptm6840_set_ext_clock(device_t *device, int counter, double clock)
|
||||
{
|
||||
downcast<ptm6840_device*>(device)->ptm6840_set_ext_clock(counter, clock);
|
||||
}
|
||||
|
||||
void ptm6840_device::ptm6840_set_ext_clock(int counter, double clock)
|
||||
void ptm6840_device::set_ext_clock(int counter, double clock)
|
||||
{
|
||||
m_external_clock[counter] = clock;
|
||||
|
||||
@ -819,7 +761,7 @@ void ptm6840_device::ptm6840_set_ext_clock(int counter, double clock)
|
||||
int count;
|
||||
attotime duration;
|
||||
|
||||
/* Determine the number of clock periods before we expire */
|
||||
// Determine the number of clock periods before we expire
|
||||
count = m_counter[counter];
|
||||
|
||||
if (m_control_reg[counter] & 0x04)
|
||||
@ -845,16 +787,11 @@ void ptm6840_device::ptm6840_set_ext_clock(int counter, double clock)
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------
|
||||
ptm6840_get_ext_clock - get external clock frequency
|
||||
------------------------------------------------------------*/
|
||||
//-------------------------------------------------
|
||||
// ext_clock - get external clock frequency
|
||||
//-------------------------------------------------
|
||||
|
||||
int ptm6840_get_ext_clock( device_t *device, int counter )
|
||||
{
|
||||
return downcast<ptm6840_device*>(device)->ptm6840_get_ext_clock(counter);
|
||||
}
|
||||
|
||||
int ptm6840_device::ptm6840_get_ext_clock(int counter)
|
||||
int ptm6840_device::ext_clock(int counter) const
|
||||
{
|
||||
return m_external_clock[counter];
|
||||
}
|
||||
|
@ -50,24 +50,26 @@ public:
|
||||
// construction/destruction
|
||||
ptm6840_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
int ptm6840_get_status(int clock); // get whether timer is enabled
|
||||
int ptm6840_get_irq(); // get IRQ state
|
||||
UINT16 ptm6840_get_count(int counter); // get counter value
|
||||
void ptm6840_set_ext_clock(int counter, double clock); // set clock frequency
|
||||
int ptm6840_get_ext_clock(int counter); // get clock frequency
|
||||
int status(int clock) const; // get whether timer is enabled
|
||||
int irq_state() const; // get IRQ state
|
||||
UINT16 count(int counter) const; // get counter value
|
||||
void set_ext_clock(int counter, double clock); // set clock frequency
|
||||
int ext_clock(int counter) const; // get clock frequency
|
||||
|
||||
void ptm6840_set_g1(UINT32 offset, UINT8 data); // set gate1 state
|
||||
void ptm6840_set_g2(UINT32 offset, UINT8 data); // set gate2 state
|
||||
void ptm6840_set_g3(UINT32 offset, UINT8 data); // set gate3 state
|
||||
void ptm6840_set_c1(UINT32 offset, UINT8 data); // set clock1 state
|
||||
void ptm6840_set_c2(UINT32 offset, UINT8 data); // set clock2 state
|
||||
void ptm6840_set_c3(UINT32 offset, UINT8 data); // set clock3 state
|
||||
DECLARE_WRITE8_MEMBER( write );
|
||||
void write(offs_t offset, UINT8 data);
|
||||
DECLARE_READ8_MEMBER( read );
|
||||
UINT8 read(offs_t offset);
|
||||
|
||||
void ptm6840_write(UINT32 offset, UINT8 data);
|
||||
UINT8 ptm6840_read(UINT32 offset);
|
||||
void set_gate(int idx, int state);
|
||||
DECLARE_WRITE_LINE_MEMBER( set_g1 );
|
||||
DECLARE_WRITE_LINE_MEMBER( set_g2 );
|
||||
DECLARE_WRITE_LINE_MEMBER( set_g3 );
|
||||
|
||||
void ptm6840_set_gate(int state, int idx);
|
||||
void ptm6840_set_clock(int state, int idx);
|
||||
void set_clock(int idx, int state);
|
||||
DECLARE_WRITE_LINE_MEMBER( set_c1 );
|
||||
DECLARE_WRITE_LINE_MEMBER( set_c2 );
|
||||
DECLARE_WRITE_LINE_MEMBER( set_c3 );
|
||||
|
||||
void update_interrupts();
|
||||
|
||||
@ -76,21 +78,14 @@ protected:
|
||||
virtual void device_config_complete();
|
||||
virtual void device_start();
|
||||
virtual void device_reset();
|
||||
virtual void device_post_load() { }
|
||||
virtual void device_clock_changed() { }
|
||||
|
||||
static TIMER_CALLBACK( ptm6840_timer1_cb );
|
||||
static TIMER_CALLBACK( ptm6840_timer2_cb );
|
||||
static TIMER_CALLBACK( ptm6840_timer3_cb );
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
|
||||
|
||||
private:
|
||||
|
||||
void subtract_from_counter(int counter, int count);
|
||||
void ptm_tick(int counter, int count);
|
||||
void tick(int counter, int count);
|
||||
void timeout(int idx);
|
||||
|
||||
void ptm6840_timeout(int idx);
|
||||
|
||||
UINT16 compute_counter(int counter);
|
||||
UINT16 compute_counter(int counter) const;
|
||||
void reload_count(int idx);
|
||||
|
||||
enum
|
||||
@ -110,9 +105,9 @@ private:
|
||||
devcb_resolved_write_line m_irq_func; // function called if IRQ line changes
|
||||
|
||||
UINT8 m_control_reg[3];
|
||||
UINT8 m_output[3]; /* Output states */
|
||||
UINT8 m_gate[3]; /* Input gate states */
|
||||
UINT8 m_clk[3]; /* Clock states */
|
||||
UINT8 m_output[3]; // Output states
|
||||
UINT8 m_gate[3]; // Input gate states
|
||||
UINT8 m_clk[3]; // Clock states
|
||||
UINT8 m_enabled[3];
|
||||
UINT8 m_mode[3];
|
||||
UINT8 m_fired[3];
|
||||
@ -124,7 +119,7 @@ private:
|
||||
UINT8 m_lsb_buffer;
|
||||
UINT8 m_msb_buffer;
|
||||
|
||||
/* Each PTM has 3 timers */
|
||||
// Each PTM has 3 timers
|
||||
emu_timer *m_timer[3];
|
||||
|
||||
UINT16 m_latch[3];
|
||||
@ -138,25 +133,4 @@ private:
|
||||
extern const device_type PTM6840;
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
PROTOTYPES
|
||||
***************************************************************************/
|
||||
|
||||
int ptm6840_get_status( device_t *device, int clock ); // get whether timer is enabled
|
||||
int ptm6840_get_irq( device_t *device ); // get IRQ state
|
||||
UINT16 ptm6840_get_count( device_t *device, int counter );// get counter value
|
||||
void ptm6840_set_ext_clock( device_t *device, int counter, double clock ); // set clock frequency
|
||||
int ptm6840_get_ext_clock( device_t *device, int counter );// get clock frequency
|
||||
|
||||
WRITE8_DEVICE_HANDLER( ptm6840_set_g1 ); // set gate1 state
|
||||
WRITE8_DEVICE_HANDLER( ptm6840_set_g2 ); // set gate2 state
|
||||
WRITE8_DEVICE_HANDLER( ptm6840_set_g3 ); // set gate3 state
|
||||
WRITE8_DEVICE_HANDLER( ptm6840_set_c1 ); // set clock1 state
|
||||
WRITE8_DEVICE_HANDLER( ptm6840_set_c2 ); // set clock2 state
|
||||
WRITE8_DEVICE_HANDLER( ptm6840_set_c3 ); // set clock3 state
|
||||
|
||||
WRITE8_DEVICE_HANDLER( ptm6840_write );
|
||||
READ8_DEVICE_HANDLER( ptm6840_read );
|
||||
|
||||
#endif /* __6840PTM_H__ */
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
static ADDRESS_MAP_START( memmap, AS_PROGRAM, 16 )
|
||||
AM_RANGE(0x000000, 0x00ffff) AM_ROM
|
||||
AM_RANGE(0x040000, 0x04000f) AM_DEVREADWRITE8("6840ptm", ptm6840_read, ptm6840_write, 0xff)
|
||||
AM_RANGE(0x040000, 0x04000f) AM_DEVREADWRITE8_MODERN("6840ptm", ptm6840_device, read, write, 0xff)
|
||||
AM_RANGE(0x050000, 0x050001) AM_WRITE(cchasm_refresh_control_w)
|
||||
AM_RANGE(0x060000, 0x060001) AM_READ_PORT("DSW") AM_WRITE(cchasm_led_w)
|
||||
AM_RANGE(0x070000, 0x070001) AM_WRITE(watchdog_reset16_w)
|
||||
|
@ -641,7 +641,7 @@ static ADDRESS_MAP_START( sound_cpu_map, AS_PROGRAM, 8 )
|
||||
AM_RANGE(0x200d, 0x200d) AM_WRITE(control_w)
|
||||
AM_RANGE(0x200e, 0x200e) AM_READWRITE(s_200e_r, s_200e_w)
|
||||
AM_RANGE(0x200f, 0x200f) AM_READWRITE(s_200f_r, s_200f_w)
|
||||
AM_RANGE(0x2020, 0x2027) AM_DEVREADWRITE("6840ptm", ptm6840_read, ptm6840_write)
|
||||
AM_RANGE(0x2020, 0x2027) AM_DEVREADWRITE_MODERN("6840ptm", ptm6840_device, read, write)
|
||||
AM_RANGE(0x8000, 0x9fff) AM_ROMBANK("bank2")
|
||||
AM_RANGE(0xa000, 0xbfff) AM_ROMBANK("bank3")
|
||||
AM_RANGE(0xc000, 0xdfff) AM_ROMBANK("bank4")
|
||||
|
@ -685,7 +685,7 @@ static ADDRESS_MAP_START( guab_map, AS_PROGRAM, 16 )
|
||||
AM_RANGE(0x0c0000, 0x0c007f) AM_READWRITE(io_r, io_w)
|
||||
AM_RANGE(0x0c0080, 0x0c0083) AM_NOP /* ACIA 1 */
|
||||
AM_RANGE(0x0c00a0, 0x0c00a3) AM_NOP /* ACIA 2 */
|
||||
AM_RANGE(0x0c00c0, 0x0c00cf) AM_DEVREADWRITE8("6840ptm", ptm6840_read, ptm6840_write, 0xff)
|
||||
AM_RANGE(0x0c00c0, 0x0c00cf) AM_DEVREADWRITE8_MODERN("6840ptm", ptm6840_device, read, write, 0xff)
|
||||
AM_RANGE(0x0c00e0, 0x0c00e7) AM_READWRITE(wd1770_r, wd1770_w)
|
||||
AM_RANGE(0x080000, 0x080fff) AM_RAM
|
||||
AM_RANGE(0x100000, 0x100003) AM_READWRITE(ef9369_r, ef9369_w)
|
||||
|
@ -288,7 +288,7 @@ static ADDRESS_MAP_START( 68000_map, AS_PROGRAM, 16 )
|
||||
AM_RANGE(0x046000, 0x046001) AM_WRITENOP
|
||||
AM_RANGE(0x046020, 0x046021) AM_DEVREADWRITE8("acia6850_0", acia6850_stat_r, acia6850_ctrl_w, 0xff)
|
||||
AM_RANGE(0x046022, 0x046023) AM_DEVREADWRITE8("acia6850_0", acia6850_data_r, acia6850_data_w, 0xff)
|
||||
AM_RANGE(0x046040, 0x04604f) AM_DEVREADWRITE8("6840ptm", ptm6840_read, ptm6840_write, 0xff)
|
||||
AM_RANGE(0x046040, 0x04604f) AM_DEVREADWRITE8_MODERN("6840ptm", ptm6840_device, read, write, 0xff)
|
||||
AM_RANGE(0x046060, 0x046061) AM_READ_PORT("DIRECT") AM_WRITENOP
|
||||
AM_RANGE(0x046062, 0x046063) AM_WRITENOP
|
||||
AM_RANGE(0x046064, 0x046065) AM_WRITENOP
|
||||
|
@ -199,14 +199,14 @@ static WRITE_LINE_DEVICE_HANDLER( cpu0_irq )
|
||||
device_t *pia4 = device->machine().device("pia_ic4");
|
||||
device_t *pia5 = device->machine().device("pia_ic5");
|
||||
device_t *pia6 = device->machine().device("pia_ic6");
|
||||
device_t *ptm2 = device->machine().device("ptm_ic2");
|
||||
ptm6840_device *ptm2 = device->machine().device<ptm6840_device>("ptm_ic2");
|
||||
|
||||
/* The PIA and PTM IRQ lines are all connected to a common PCB track, leading directly to the 6809 IRQ line. */
|
||||
int combined_state = pia6821_get_irq_a(pia3) | pia6821_get_irq_b(pia3) |
|
||||
pia6821_get_irq_a(pia4) | pia6821_get_irq_b(pia4) |
|
||||
pia6821_get_irq_a(pia5) | pia6821_get_irq_b(pia5) |
|
||||
pia6821_get_irq_a(pia6) | pia6821_get_irq_b(pia6) |
|
||||
ptm6840_get_irq(ptm2);
|
||||
ptm2->irq_state();
|
||||
|
||||
cputag_set_input_line(device->machine(), "maincpu", M6800_IRQ_LINE, combined_state ? ASSERT_LINE : CLEAR_LINE);
|
||||
LOG(("6808 int%d \n", combined_state));
|
||||
@ -831,7 +831,7 @@ static TIMER_DEVICE_CALLBACK( gen_50hz )
|
||||
falling edges of the pulse are used means the timer actually gives a 100Hz
|
||||
oscillating signal.*/
|
||||
state->m_signal_50hz = state->m_signal_50hz?0:1;
|
||||
ptm6840_set_c1(timer.machine().device("ptm_ic2"), 0, state->m_signal_50hz);
|
||||
timer.machine().device<ptm6840_device>("ptm_ic2")->set_c1(state->m_signal_50hz);
|
||||
pia6821_cb1_w(timer.machine().device("pia_ic3"), ~state->m_signal_50hz);
|
||||
update_triacs(timer.machine());
|
||||
}
|
||||
@ -842,22 +842,22 @@ static TIMER_DEVICE_CALLBACK( ic10_callback )
|
||||
// TODO: Use discrete handler for 555, this is far too simplistic
|
||||
|
||||
state->m_ic10_output = state->m_ic10_output?0:1;
|
||||
ptm6840_set_c2(timer.machine().device("ptm_ic2"), 0, state->m_ic10_output);
|
||||
timer.machine().device<ptm6840_device>("ptm_ic2")->set_c2(state->m_ic10_output);
|
||||
pia6821_ca1_w(timer.machine().device("pia_ic4"), state->m_ic10_output);
|
||||
|
||||
}
|
||||
static WRITE8_HANDLER( mpu3ptm_w )
|
||||
{
|
||||
device_t *ptm2 = space->machine().device("ptm_ic2");
|
||||
ptm6840_device *ptm2 = space->machine().device<ptm6840_device>("ptm_ic2");
|
||||
|
||||
ptm6840_write(ptm2,offset >>2,data);//((offset & 0x1f) >>2),data);
|
||||
ptm2->write(offset >>2,data);//((offset & 0x1f) >>2),data);
|
||||
}
|
||||
|
||||
static READ8_HANDLER( mpu3ptm_r )
|
||||
{
|
||||
device_t *ptm2 = space->machine().device("ptm_ic2");
|
||||
ptm6840_device *ptm2 = space->machine().device<ptm6840_device>("ptm_ic2");
|
||||
|
||||
return ptm6840_read(ptm2,offset >>2);
|
||||
return ptm2->read(offset >>2);
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( mpu3_basemap, AS_PROGRAM, 8 )
|
||||
|
@ -674,7 +674,7 @@ static WRITE_LINE_DEVICE_HANDLER( cpu0_irq )
|
||||
device_t *pia6 = device->machine().device("pia_ic6");
|
||||
device_t *pia7 = device->machine().device("pia_ic7");
|
||||
device_t *pia8 = device->machine().device("pia_ic8");
|
||||
device_t *ptm2 = device->machine().device("ptm_ic2");
|
||||
ptm6840_device *ptm2 = device->machine().device<ptm6840_device>("ptm_ic2");
|
||||
|
||||
/* The PIA and PTM IRQ lines are all connected to a common PCB track, leading directly to the 6809 IRQ line. */
|
||||
int combined_state = pia6821_get_irq_a(pia3) | pia6821_get_irq_b(pia3) |
|
||||
@ -683,7 +683,7 @@ static WRITE_LINE_DEVICE_HANDLER( cpu0_irq )
|
||||
pia6821_get_irq_a(pia6) | pia6821_get_irq_b(pia6) |
|
||||
pia6821_get_irq_a(pia7) | pia6821_get_irq_b(pia7) |
|
||||
pia6821_get_irq_a(pia8) | pia6821_get_irq_b(pia8) |
|
||||
ptm6840_get_irq(ptm2);
|
||||
ptm2->irq_state();
|
||||
|
||||
if (!drvstate->m_link7a_connected) //7B = IRQ, 7A = FIRQ, both = NMI
|
||||
{
|
||||
@ -732,7 +732,7 @@ static WRITE8_HANDLER( bankset_w )
|
||||
/* IC2 6840 PTM handler */
|
||||
static WRITE8_DEVICE_HANDLER( ic2_o1_callback )
|
||||
{
|
||||
ptm6840_set_c2(device, 0, data);
|
||||
downcast<ptm6840_device *>(device)->set_c2(data);
|
||||
|
||||
/* copy output value to IC2 c2
|
||||
this output is the clock for timer2 */
|
||||
@ -746,7 +746,7 @@ static WRITE8_DEVICE_HANDLER( ic2_o2_callback )
|
||||
pia6821_ca1_w(pia, data); /* copy output value to IC3 ca1 */
|
||||
/* the output from timer2 is the input clock for timer3 */
|
||||
/* miscellaneous interrupts generated here */
|
||||
ptm6840_set_c3(device, 0, data);
|
||||
downcast<ptm6840_device *>(device)->set_c3(data);
|
||||
}
|
||||
|
||||
|
||||
@ -755,7 +755,7 @@ static WRITE8_DEVICE_HANDLER( ic2_o3_callback )
|
||||
/* the output from timer3 is used as a square wave for the alarm output
|
||||
and as an external clock source for timer 1! */
|
||||
/* also runs lamp fade */
|
||||
ptm6840_set_c1(device, 0, data);
|
||||
downcast<ptm6840_device *>(device)->set_c1(data);
|
||||
}
|
||||
|
||||
|
||||
@ -1755,19 +1755,19 @@ The sample speed divisor is f/300
|
||||
//O3 -> G1 O1 -> c2 o2 -> c1
|
||||
static WRITE8_DEVICE_HANDLER( ic3ss_o1_callback )
|
||||
{
|
||||
ptm6840_set_c2(device, 0, data);
|
||||
downcast<ptm6840_device *>(device)->set_c2(data);
|
||||
}
|
||||
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( ic3ss_o2_callback )//Generates 'beep' tone
|
||||
{
|
||||
ptm6840_set_c1(device, 0, data);//?
|
||||
downcast<ptm6840_device *>(device)->set_c1(data);//?
|
||||
}
|
||||
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( ic3ss_o3_callback )
|
||||
{
|
||||
ptm6840_set_g1(device, 0, data); /* this output is the clock for timer1 */
|
||||
downcast<ptm6840_device *>(device)->set_g1(data); /* this output is the clock for timer1 */
|
||||
}
|
||||
|
||||
|
||||
@ -2636,7 +2636,7 @@ static ADDRESS_MAP_START( mod2_memmap, AS_PROGRAM, 8 )
|
||||
|
||||
/* AM_RANGE(0x08e0, 0x08e7) AM_READWRITE(68681_duart_r,68681_duart_w) */ //Runs hoppers
|
||||
|
||||
AM_RANGE(0x0900, 0x0907) AM_DEVREADWRITE("ptm_ic2", ptm6840_read, ptm6840_write)/* PTM6840 IC2 */
|
||||
AM_RANGE(0x0900, 0x0907) AM_DEVREADWRITE_MODERN("ptm_ic2", ptm6840_device, read, write)/* PTM6840 IC2 */
|
||||
|
||||
AM_RANGE(0x0a00, 0x0a03) AM_DEVREADWRITE("pia_ic3", pia6821_r, pia6821_w) /* PIA6821 IC3 */
|
||||
AM_RANGE(0x0b00, 0x0b03) AM_DEVREADWRITE("pia_ic4", pia6821_r, pia6821_w) /* PIA6821 IC4 */
|
||||
@ -2659,7 +2659,7 @@ static ADDRESS_MAP_START( mod4_yam_map, AS_PROGRAM, 8 )
|
||||
|
||||
/* AM_RANGE(0x08e0, 0x08e7) AM_READWRITE(68681_duart_r,68681_duart_w) */ //Runs hoppers
|
||||
|
||||
AM_RANGE(0x0900, 0x0907) AM_DEVREADWRITE("ptm_ic2", ptm6840_read, ptm6840_write)/* PTM6840 IC2 */
|
||||
AM_RANGE(0x0900, 0x0907) AM_DEVREADWRITE_MODERN("ptm_ic2", ptm6840_device, read, write)/* PTM6840 IC2 */
|
||||
|
||||
AM_RANGE(0x0a00, 0x0a03) AM_DEVREADWRITE("pia_ic3", pia6821_r, pia6821_w) /* PIA6821 IC3 */
|
||||
AM_RANGE(0x0b00, 0x0b03) AM_DEVREADWRITE("pia_ic4", pia6821_r, pia6821_w) /* PIA6821 IC4 */
|
||||
@ -2680,11 +2680,11 @@ static ADDRESS_MAP_START( mod4_oki_map, AS_PROGRAM, 8 )
|
||||
|
||||
AM_RANGE(0x0880, 0x0883) AM_DEVREADWRITE("pia_ic4ss", pia6821_r,pia6821_w) // PIA6821 on sampled sound board
|
||||
|
||||
AM_RANGE(0x08c0, 0x08c7) AM_DEVREADWRITE("ptm_ic3ss", ptm6840_read, ptm6840_write) // 6840PTM on sampled sound board
|
||||
AM_RANGE(0x08c0, 0x08c7) AM_DEVREADWRITE_MODERN("ptm_ic3ss", ptm6840_device, read, write) // 6840PTM on sampled sound board
|
||||
|
||||
// AM_RANGE(0x08e0, 0x08e7) AM_READWRITE(68681_duart_r,68681_duart_w) //Runs hoppers
|
||||
|
||||
AM_RANGE(0x0900, 0x0907) AM_DEVREADWRITE("ptm_ic2", ptm6840_read, ptm6840_write)/* PTM6840 IC2 */
|
||||
AM_RANGE(0x0900, 0x0907) AM_DEVREADWRITE_MODERN("ptm_ic2", ptm6840_device, read, write)/* PTM6840 IC2 */
|
||||
|
||||
AM_RANGE(0x0a00, 0x0a03) AM_DEVREADWRITE("pia_ic3", pia6821_r, pia6821_w) /* PIA6821 IC3 */
|
||||
AM_RANGE(0x0b00, 0x0b03) AM_DEVREADWRITE("pia_ic4", pia6821_r, pia6821_w) /* PIA6821 IC4 */
|
||||
@ -2707,11 +2707,11 @@ static ADDRESS_MAP_START( mpu4_bwb_map, AS_PROGRAM, 8 )
|
||||
AM_RANGE(0x0878, 0x0878) AM_WRITE(bankset_w) // write bank (rom page select)
|
||||
AM_RANGE(0x0880, 0x0883) AM_DEVREADWRITE("pia_ic4ss", pia6821_r,pia6821_w) // PIA6821 on sampled sound board
|
||||
|
||||
AM_RANGE(0x08c0, 0x08c7) AM_DEVREADWRITE("ptm_ic3ss", ptm6840_read, ptm6840_write) // 6840PTM on sampled sound board
|
||||
AM_RANGE(0x08c0, 0x08c7) AM_DEVREADWRITE_MODERN("ptm_ic3ss", ptm6840_device, read, write) // 6840PTM on sampled sound board
|
||||
|
||||
// AM_RANGE(0x08e0, 0x08e7) AM_READWRITE(68681_duart_r,68681_duart_w) //Runs hoppers
|
||||
|
||||
AM_RANGE(0x0900, 0x0907) AM_DEVREADWRITE("ptm_ic2", ptm6840_read, ptm6840_write)/* PTM6840 IC2 */
|
||||
AM_RANGE(0x0900, 0x0907) AM_DEVREADWRITE_MODERN("ptm_ic2", ptm6840_device, read, write)/* PTM6840 IC2 */
|
||||
|
||||
AM_RANGE(0x0a00, 0x0a03) AM_DEVREADWRITE("pia_ic3", pia6821_r, pia6821_w) /* PIA6821 IC3 */
|
||||
AM_RANGE(0x0b00, 0x0b03) AM_DEVREADWRITE("pia_ic4", pia6821_r, pia6821_w) /* PIA6821 IC4 */
|
||||
@ -2734,11 +2734,11 @@ static ADDRESS_MAP_START( dutch_memmap, AS_PROGRAM, 8 )
|
||||
AM_RANGE(0x0850, 0x0850) AM_WRITE(bankswitch_w) // write bank (rom page select)
|
||||
AM_RANGE(0x0880, 0x0883) AM_DEVREADWRITE("pia_ic4ss", pia6821_r,pia6821_w) // PIA6821 on sampled sound board
|
||||
|
||||
AM_RANGE(0x08c0, 0x08c7) AM_DEVREADWRITE("ptm_ic3ss", ptm6840_read, ptm6840_write) // 6840PTM on sampled sound board
|
||||
AM_RANGE(0x08c0, 0x08c7) AM_DEVREADWRITE_MODERN("ptm_ic3ss", ptm6840_device, read, write) // 6840PTM on sampled sound board
|
||||
|
||||
// AM_RANGE(0x08e0, 0x08e7) AM_READWRITE(68681_duart_r,68681_duart_w) //Runs hoppers
|
||||
|
||||
AM_RANGE(0x0900, 0x0907) AM_DEVREADWRITE("ptm_ic2", ptm6840_read, ptm6840_write)/* PTM6840 IC2 */
|
||||
AM_RANGE(0x0900, 0x0907) AM_DEVREADWRITE_MODERN("ptm_ic2", ptm6840_device, read, write)/* PTM6840 IC2 */
|
||||
|
||||
AM_RANGE(0x0a00, 0x0a03) AM_DEVREADWRITE("pia_ic3", pia6821_r, pia6821_w) /* PIA6821 IC3 */
|
||||
AM_RANGE(0x0b00, 0x0b03) AM_DEVREADWRITE("pia_ic4", pia6821_r, pia6821_w) /* PIA6821 IC4 */
|
||||
|
@ -345,7 +345,7 @@ static WRITE_LINE_DEVICE_HANDLER( cpu1_ptm_irq )
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( vid_o1_callback )
|
||||
{
|
||||
ptm6840_set_c2(device, 0, data); /* this output is the clock for timer2 */
|
||||
downcast<ptm6840_device *>(device)->set_c2(data); /* this output is the clock for timer2 */
|
||||
|
||||
if (data)
|
||||
{
|
||||
@ -361,13 +361,13 @@ static WRITE8_DEVICE_HANDLER( vid_o1_callback )
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( vid_o2_callback )
|
||||
{
|
||||
ptm6840_set_c3(device, 0, data); /* this output is the clock for timer3 */
|
||||
downcast<ptm6840_device *>(device)->set_c3(data); /* this output is the clock for timer3 */
|
||||
}
|
||||
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( vid_o3_callback )
|
||||
{
|
||||
ptm6840_set_c1(device, 0, data); /* this output is the clock for timer1 */
|
||||
downcast<ptm6840_device *>(device)->set_c1(data); /* this output is the clock for timer1 */
|
||||
}
|
||||
|
||||
|
||||
@ -1971,7 +1971,7 @@ static ADDRESS_MAP_START( mpu4_68k_map, AS_PROGRAM, 16 )
|
||||
AM_RANGE(0xc00000, 0xc1ffff) AM_READWRITE(mpu4_vid_vidram_r, mpu4_vid_vidram_w)
|
||||
AM_RANGE(0xff8000, 0xff8001) AM_DEVREADWRITE8("acia6850_1", acia6850_stat_r, acia6850_ctrl_w, 0xff)
|
||||
AM_RANGE(0xff8002, 0xff8003) AM_DEVREADWRITE8("acia6850_1", acia6850_data_r, acia6850_data_w, 0xff)
|
||||
AM_RANGE(0xff9000, 0xff900f) AM_DEVREADWRITE8("6840ptm_68k", ptm6840_read, ptm6840_write, 0xff)
|
||||
AM_RANGE(0xff9000, 0xff900f) AM_DEVREADWRITE8_MODERN("6840ptm_68k", ptm6840_device, read, write, 0xff)
|
||||
AM_RANGE(0xffd000, 0xffd00f) AM_READWRITE(characteriser16_r, characteriser16_w)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -1981,7 +1981,7 @@ static ADDRESS_MAP_START( mpu4_6809_map, AS_PROGRAM, 8 )
|
||||
AM_RANGE(0x0800, 0x0800) AM_DEVREADWRITE("acia6850_0", acia6850_stat_r, acia6850_ctrl_w)
|
||||
AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE("acia6850_0", acia6850_data_r, acia6850_data_w)
|
||||
AM_RANGE(0x0880, 0x0881) AM_NOP //Read/write here
|
||||
AM_RANGE(0x0900, 0x0907) AM_DEVREADWRITE("ptm_ic2", ptm6840_read, ptm6840_write)
|
||||
AM_RANGE(0x0900, 0x0907) AM_DEVREADWRITE_MODERN("ptm_ic2", ptm6840_device, read, write)
|
||||
AM_RANGE(0x0a00, 0x0a03) AM_DEVREADWRITE("pia_ic3", pia6821_r, pia6821_w)
|
||||
AM_RANGE(0x0b00, 0x0b03) AM_DEVREADWRITE("pia_ic4", pia6821_r, pia6821_w)
|
||||
AM_RANGE(0x0c00, 0x0c03) AM_DEVREADWRITE("pia_ic5", pia6821_r, pia6821_w)
|
||||
@ -2006,7 +2006,7 @@ static ADDRESS_MAP_START( vp_68k_map, AS_PROGRAM, 16 )
|
||||
/* AM_RANGE(0xe05000, 0xe05001) AM_READWRITE(adpcm_r, adpcm_w) */
|
||||
AM_RANGE(0xff8000, 0xff8001) AM_DEVREADWRITE8("acia6850_1", acia6850_stat_r, acia6850_ctrl_w, 0xff)
|
||||
AM_RANGE(0xff8002, 0xff8003) AM_DEVREADWRITE8("acia6850_1", acia6850_data_r, acia6850_data_w, 0xff)
|
||||
AM_RANGE(0xff9000, 0xff900f) AM_DEVREADWRITE8("6840ptm_68k", ptm6840_read, ptm6840_write, 0xff)
|
||||
AM_RANGE(0xff9000, 0xff900f) AM_DEVREADWRITE8_MODERN("6840ptm_68k", ptm6840_device, read, write, 0xff)
|
||||
/* AM_RANGE(0xffd000, 0xffd00f) AM_READWRITE(characteriser16_r, characteriser16_w) Word-based version of old CHR??? */
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -2015,7 +2015,7 @@ static ADDRESS_MAP_START( bwbvid_6809_map, AS_PROGRAM, 8 )
|
||||
AM_RANGE(0x0800, 0x0800) AM_DEVREADWRITE("acia6850_0", acia6850_stat_r, acia6850_ctrl_w)
|
||||
AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE("acia6850_0", acia6850_data_r, acia6850_data_w)
|
||||
AM_RANGE(0x0880, 0x0881) //AM_NOP //Read/write here
|
||||
AM_RANGE(0x0900, 0x0907) AM_DEVREADWRITE("ptm_ic2", ptm6840_read, ptm6840_write)
|
||||
AM_RANGE(0x0900, 0x0907) AM_DEVREADWRITE_MODERN("ptm_ic2", ptm6840_device, read, write)
|
||||
AM_RANGE(0x0a00, 0x0a03) AM_DEVREADWRITE("pia_ic3", pia6821_r, pia6821_w)
|
||||
AM_RANGE(0x0b00, 0x0b03) AM_DEVREADWRITE("pia_ic4", pia6821_r, pia6821_w)
|
||||
AM_RANGE(0x0c00, 0x0c03) AM_DEVREADWRITE("pia_ic5", pia6821_r, pia6821_w)
|
||||
@ -2040,7 +2040,7 @@ static ADDRESS_MAP_START( bwbvid_68k_map, AS_PROGRAM, 16 )
|
||||
AM_RANGE(0xc00000, 0xc1ffff) AM_READWRITE(mpu4_vid_vidram_r, mpu4_vid_vidram_w)
|
||||
AM_RANGE(0xe00000, 0xe00001) AM_DEVREADWRITE8("acia6850_1", acia6850_stat_r, acia6850_ctrl_w, 0xff)
|
||||
AM_RANGE(0xe00002, 0xe00003) AM_DEVREADWRITE8("acia6850_1", acia6850_data_r, acia6850_data_w, 0xff)
|
||||
AM_RANGE(0xe01000, 0xe0100f) AM_DEVREADWRITE8("6840ptm_68k", ptm6840_read, ptm6840_write, 0xff)
|
||||
AM_RANGE(0xe01000, 0xe0100f) AM_DEVREADWRITE8_MODERN("6840ptm_68k", ptm6840_device, read, write, 0xff)
|
||||
//AM_RANGE(0xa00004, 0xa0000f) AM_READWRITE(bwb_characteriser16_r, bwb_characteriser16_w)//AM_READWRITE(adpcm_r, adpcm_w) CHR ?
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -2057,9 +2057,9 @@ static ADDRESS_MAP_START( bwbvid5_68k_map, AS_PROGRAM, 16 )
|
||||
AM_RANGE(0xc00000, 0xc1ffff) AM_READWRITE(mpu4_vid_vidram_r, mpu4_vid_vidram_w)
|
||||
AM_RANGE(0xe00000, 0xe00001) AM_DEVREADWRITE8("acia6850_1", acia6850_stat_r, acia6850_ctrl_w, 0xff)
|
||||
AM_RANGE(0xe00002, 0xe00003) AM_DEVREADWRITE8("acia6850_1", acia6850_data_r, acia6850_data_w, 0xff)
|
||||
AM_RANGE(0xe01000, 0xe0100f) AM_DEVREADWRITE8("6840ptm_68k", ptm6840_read, ptm6840_write, 0xff)
|
||||
AM_RANGE(0xe01000, 0xe0100f) AM_DEVREADWRITE8_MODERN("6840ptm_68k", ptm6840_device, read, write, 0xff)
|
||||
AM_RANGE(0xe02000, 0xe02007) AM_DEVREADWRITE8("pia_ic4ss", pia6821_r, pia6821_w, 0xff)
|
||||
AM_RANGE(0xe03000, 0xe0300f) AM_DEVREADWRITE8("6840ptm_ic3ss", ptm6840_read, ptm6840_write, 0xff)
|
||||
AM_RANGE(0xe03000, 0xe0300f) AM_DEVREADWRITE8_MODERN("6840ptm_ic3ss", ptm6840_device, read, write, 0xff)
|
||||
AM_RANGE(0xe04000, 0xe0400f) AM_READWRITE(bwb_characteriser16_r, bwb_characteriser16_w)//AM_READWRITE(adpcm_r, adpcm_w) CHR ?
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -2202,7 +2202,7 @@ static ADDRESS_MAP_START( dealem_memmap, AS_PROGRAM, 8 )
|
||||
|
||||
/* AM_RANGE(0x08e0, 0x08e7) AM_READWRITE(68681_duart_r,68681_duart_w) */ //Runs hoppers
|
||||
|
||||
AM_RANGE(0x0900, 0x0907) AM_DEVREADWRITE("ptm_ic2", ptm6840_read, ptm6840_write)/* PTM6840 IC2 */
|
||||
AM_RANGE(0x0900, 0x0907) AM_DEVREADWRITE_MODERN("ptm_ic2", ptm6840_device, read, write)/* PTM6840 IC2 */
|
||||
|
||||
AM_RANGE(0x0a00, 0x0a03) AM_DEVREADWRITE("pia_ic3", pia6821_r, pia6821_w) /* PIA6821 IC3 */
|
||||
AM_RANGE(0x0b00, 0x0b03) AM_DEVREADWRITE("pia_ic4", pia6821_r, pia6821_w) /* PIA6821 IC4 */
|
||||
|
@ -182,7 +182,7 @@ static WRITE8_HANDLER( blitter_w )
|
||||
static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8 )
|
||||
ADDRESS_MAP_GLOBAL_MASK(0x3fff)
|
||||
AM_RANGE(0x0000, 0x01ff) AM_RAM /* vpoker has 0x100, 5acespkr has 0x200 */
|
||||
AM_RANGE(0x0400, 0x0407) AM_DEVREADWRITE("6840ptm", ptm6840_read, ptm6840_write)
|
||||
AM_RANGE(0x0400, 0x0407) AM_DEVREADWRITE_MODERN("6840ptm", ptm6840_device, read, write)
|
||||
AM_RANGE(0x0800, 0x0807) AM_READ(blitter_r) AM_WRITE(blitter_w)
|
||||
AM_RANGE(0x2000, 0x3fff) AM_ROM
|
||||
ADDRESS_MAP_END
|
||||
|
Loading…
Reference in New Issue
Block a user