mirror of
https://github.com/holub/mame
synced 2025-05-29 00:53:09 +03:00
Some cleanup in 6821pia.c and a fix for NULL timer callbacks in 6522via.c. drivedge now works again. No whatsnew.
This commit is contained in:
parent
65425075d3
commit
da1d1e1084
@ -209,6 +209,8 @@ UINT16 via6522_device::get_counter1_value()
|
|||||||
// LIVE DEVICE
|
// LIVE DEVICE
|
||||||
//**************************************************************************
|
//**************************************************************************
|
||||||
|
|
||||||
|
const device_type VIA6522 = via6522_device_config::static_alloc_device_config;
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
// via6522_device - constructor
|
// via6522_device - constructor
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
@ -245,9 +247,9 @@ void via6522_device::device_start()
|
|||||||
m_t2ll = 0xff; /* taken from vice */
|
m_t2ll = 0xff; /* taken from vice */
|
||||||
m_t2lh = 0xff;
|
m_t2lh = 0xff;
|
||||||
m_time2 = m_time1 = timer_get_time(&m_machine);
|
m_time2 = m_time1 = timer_get_time(&m_machine);
|
||||||
m_t1 = timer_alloc(&m_machine, t1_timeout_callback, 0);
|
m_t1 = timer_alloc(&m_machine, t1_timeout_callback, (void *)this);
|
||||||
m_t2 = timer_alloc(&m_machine, t2_timeout_callback, 0);
|
m_t2 = timer_alloc(&m_machine, t2_timeout_callback, (void *)this);
|
||||||
m_shift_timer = timer_alloc(&m_machine, shift_callback, 0);
|
m_shift_timer = timer_alloc(&m_machine, shift_callback, (void *)this);
|
||||||
|
|
||||||
/* Default clock is from CPU1 */
|
/* Default clock is from CPU1 */
|
||||||
if (clock() == 0)
|
if (clock() == 0)
|
||||||
@ -517,11 +519,6 @@ void via6522_device::t2_timeout()
|
|||||||
via_r - CPU interface for VIA read
|
via_r - CPU interface for VIA read
|
||||||
-------------------------------------------------*/
|
-------------------------------------------------*/
|
||||||
|
|
||||||
READ8_DEVICE_HANDLER(via_r)
|
|
||||||
{
|
|
||||||
return downcast<via6522_device *>(device)->reg_r(offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
UINT8 via6522_device::reg_r(UINT8 offset)
|
UINT8 via6522_device::reg_r(UINT8 offset)
|
||||||
{
|
{
|
||||||
int val = 0;
|
int val = 0;
|
||||||
@ -712,11 +709,6 @@ UINT8 via6522_device::reg_r(UINT8 offset)
|
|||||||
via_w - CPU interface for VIA write
|
via_w - CPU interface for VIA write
|
||||||
-------------------------------------------------*/
|
-------------------------------------------------*/
|
||||||
|
|
||||||
WRITE8_DEVICE_HANDLER(via_w)
|
|
||||||
{
|
|
||||||
downcast<via6522_device *>(device)->reg_w(offset, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
void via6522_device::reg_w(UINT8 offset, UINT8 data)
|
void via6522_device::reg_w(UINT8 offset, UINT8 data)
|
||||||
{
|
{
|
||||||
offset &=0x0f;
|
offset &=0x0f;
|
||||||
@ -978,40 +970,11 @@ void via6522_device::reg_w(UINT8 offset, UINT8 data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-------------------------------------------------
|
|
||||||
via_ca1_r - interface returning VIA port
|
|
||||||
CA1 input
|
|
||||||
-------------------------------------------------*/
|
|
||||||
|
|
||||||
READ_LINE_DEVICE_HANDLER(via_ca1_r)
|
|
||||||
{
|
|
||||||
return downcast<via6522_device *>(device)->ca1_r();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------
|
/*-------------------------------------------------
|
||||||
via_ca2_r - interface returning VIA port
|
ca1_w - interface setting VIA port CA1 input
|
||||||
CA2 input
|
|
||||||
-------------------------------------------------*/
|
-------------------------------------------------*/
|
||||||
|
|
||||||
READ_LINE_DEVICE_HANDLER(via_ca2_r)
|
|
||||||
{
|
|
||||||
return downcast<via6522_device *>(device)->ca2_r();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------
|
|
||||||
via_ca1_w - interface setting VIA port
|
|
||||||
CA1 input
|
|
||||||
-------------------------------------------------*/
|
|
||||||
|
|
||||||
WRITE_LINE_DEVICE_HANDLER(via_ca1_w)
|
|
||||||
{
|
|
||||||
downcast<via6522_device *>(device)->ca1_w(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
void via6522_device::ca1_w(UINT8 state)
|
void via6522_device::ca1_w(UINT8 state)
|
||||||
{
|
{
|
||||||
/* handle the active transition */
|
/* handle the active transition */
|
||||||
@ -1056,17 +1019,10 @@ void via6522_device::ca1_w(UINT8 state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------
|
/*-------------------------------------------------
|
||||||
via_ca2_w - interface setting VIA port
|
ca2_w - interface setting VIA port CA2 input
|
||||||
CA2 input
|
|
||||||
-------------------------------------------------*/
|
-------------------------------------------------*/
|
||||||
|
|
||||||
WRITE_LINE_DEVICE_HANDLER(via_ca2_w)
|
|
||||||
{
|
|
||||||
downcast<via6522_device *>(device)->ca2_w(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
void via6522_device::ca2_w(UINT8 state)
|
void via6522_device::ca2_w(UINT8 state)
|
||||||
{
|
{
|
||||||
/* CA2 is in input mode */
|
/* CA2 is in input mode */
|
||||||
@ -1088,41 +1044,10 @@ void via6522_device::ca2_w(UINT8 state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------
|
/*-------------------------------------------------
|
||||||
via_cb1_r - interface returning VIA port
|
cb1_w - interface setting VIA port CB1 input
|
||||||
CB1 input
|
|
||||||
-------------------------------------------------*/
|
-------------------------------------------------*/
|
||||||
|
|
||||||
READ_LINE_DEVICE_HANDLER(via_cb1_r)
|
|
||||||
{
|
|
||||||
return downcast<via6522_device *>(device)->cb1_r();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------
|
|
||||||
via_cb2_r - interface returning VIA port
|
|
||||||
CB2 input
|
|
||||||
-------------------------------------------------*/
|
|
||||||
|
|
||||||
READ_LINE_DEVICE_HANDLER(via_cb2_r)
|
|
||||||
{
|
|
||||||
return downcast<via6522_device *>(device)->cb2_r();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------
|
|
||||||
via_cb1_w - interface setting VIA port
|
|
||||||
CB1 input
|
|
||||||
-------------------------------------------------*/
|
|
||||||
|
|
||||||
WRITE_LINE_DEVICE_HANDLER( via_cb1_w )
|
|
||||||
{
|
|
||||||
downcast<via6522_device *>(device)->cb1_w(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
void via6522_device::cb1_w(UINT8 state)
|
void via6522_device::cb1_w(UINT8 state)
|
||||||
{
|
{
|
||||||
/* handle the active transition */
|
/* handle the active transition */
|
||||||
@ -1168,15 +1093,9 @@ void via6522_device::cb1_w(UINT8 state)
|
|||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------
|
/*-------------------------------------------------
|
||||||
via_cb2_w - interface setting VIA port
|
cb2_w - interface setting VIA port CB2 input
|
||||||
CB2 input
|
|
||||||
-------------------------------------------------*/
|
-------------------------------------------------*/
|
||||||
|
|
||||||
WRITE_LINE_DEVICE_HANDLER(via_cb2_w)
|
|
||||||
{
|
|
||||||
downcast<via6522_device *>(device)->cb2_w(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
void via6522_device::cb2_w(UINT8 state)
|
void via6522_device::cb2_w(UINT8 state)
|
||||||
{
|
{
|
||||||
/* CB2 is in input mode */
|
/* CB2 is in input mode */
|
||||||
@ -1197,31 +1116,28 @@ void via6522_device::cb2_w(UINT8 state)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-------------------------------------------------
|
|
||||||
via_porta_w - interface writing VIA port A
|
|
||||||
-------------------------------------------------*/
|
|
||||||
|
|
||||||
WRITE8_DEVICE_HANDLER(via_porta_w)
|
|
||||||
{
|
|
||||||
downcast<via6522_device *>(device)->porta_w(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*-------------------------------------------------
|
/***************************************************************************
|
||||||
via_portb_w - interface writing VIA port B
|
TRAMPOLINES
|
||||||
-------------------------------------------------*/
|
***************************************************************************/
|
||||||
|
|
||||||
WRITE8_DEVICE_HANDLER(via_portb_w)
|
READ8_DEVICE_HANDLER(via_r) { return downcast<via6522_device *>(device)->reg_r(offset); }
|
||||||
{
|
WRITE8_DEVICE_HANDLER(via_w) { downcast<via6522_device *>(device)->reg_w(offset, data); }
|
||||||
downcast<via6522_device *>(device)->portb_w(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*-------------------------------------------------
|
READ_LINE_DEVICE_HANDLER(via_ca1_r) { return downcast<via6522_device *>(device)->ca1_r(); }
|
||||||
via_portb_r - interface reading VIA port B
|
WRITE_LINE_DEVICE_HANDLER(via_ca1_w) { downcast<via6522_device *>(device)->ca1_w(state); }
|
||||||
-------------------------------------------------*/
|
|
||||||
|
|
||||||
READ8_DEVICE_HANDLER(via_portb_w)
|
READ_LINE_DEVICE_HANDLER(via_ca2_r) { return downcast<via6522_device *>(device)->ca2_r(); }
|
||||||
{
|
WRITE_LINE_DEVICE_HANDLER(via_ca2_w) { downcast<via6522_device *>(device)->ca2_w(state); }
|
||||||
return downcast<via6522_device *>(device)->portb_r();
|
|
||||||
}
|
|
||||||
|
|
||||||
const device_type VIA6522 = via6522_device_config::static_alloc_device_config;
|
READ_LINE_DEVICE_HANDLER(via_cb1_r) { return downcast<via6522_device *>(device)->cb1_r(); }
|
||||||
|
WRITE_LINE_DEVICE_HANDLER(via_cb1_w) { downcast<via6522_device *>(device)->cb1_w(state); }
|
||||||
|
|
||||||
|
READ_LINE_DEVICE_HANDLER(via_cb2_r) { return downcast<via6522_device *>(device)->cb2_r(); }
|
||||||
|
WRITE_LINE_DEVICE_HANDLER(via_cb2_w) { downcast<via6522_device *>(device)->cb2_w(state); }
|
||||||
|
|
||||||
|
WRITE8_DEVICE_HANDLER(via_porta_w) { downcast<via6522_device *>(device)->porta_w(data); }
|
||||||
|
|
||||||
|
READ8_DEVICE_HANDLER(via_portb_r) { return downcast<via6522_device *>(device)->portb_r(); }
|
||||||
|
WRITE8_DEVICE_HANDLER(via_portb_w) { downcast<via6522_device *>(device)->portb_w(data); }
|
||||||
|
@ -111,6 +111,8 @@ void pia6821_device_config::device_config_complete()
|
|||||||
// LIVE DEVICE
|
// LIVE DEVICE
|
||||||
//**************************************************************************
|
//**************************************************************************
|
||||||
|
|
||||||
|
const device_type PIA6821 = pia6821_device_config::static_alloc_device_config;
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
// pia6821_device - constructor
|
// pia6821_device - constructor
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
@ -1420,5 +1422,3 @@ int pia6821_device::get_irq_b()
|
|||||||
{
|
{
|
||||||
return m_irq_b_state;
|
return m_irq_b_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
const device_type PIA6821 = pia6821_device_config::static_alloc_device_config;
|
|
||||||
|
Loading…
Reference in New Issue
Block a user