mirror of
https://github.com/holub/mame
synced 2025-05-24 14:56:21 +03:00
Keep MSVC and me happy :) (no whatsnew)
This commit is contained in:
parent
0584baf45f
commit
b49370f475
@ -40,7 +40,7 @@ enum
|
||||
//-------------------------------------------------
|
||||
|
||||
riot6532_device_config::riot6532_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
|
||||
: device_config(mconfig, static_alloc_device_config, "RIOT6532", tag, owner, clock)
|
||||
: device_config(mconfig, static_alloc_device_config, "RIOT6532", tag, owner, clock)
|
||||
{
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ riot6532_device_config::riot6532_device_config(const machine_config &mconfig, co
|
||||
|
||||
device_config *riot6532_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
|
||||
{
|
||||
return global_alloc(riot6532_device_config(mconfig, tag, owner, clock));
|
||||
return global_alloc(riot6532_device_config(mconfig, tag, owner, clock));
|
||||
}
|
||||
|
||||
|
||||
@ -62,7 +62,7 @@ device_config *riot6532_device_config::static_alloc_device_config(const machine_
|
||||
|
||||
device_t *riot6532_device_config::alloc_device(running_machine &machine) const
|
||||
{
|
||||
return auto_alloc(&machine, riot6532_device(machine, *this));
|
||||
return auto_alloc(&machine, riot6532_device(machine, *this));
|
||||
}
|
||||
|
||||
|
||||
@ -74,22 +74,22 @@ device_t *riot6532_device_config::alloc_device(running_machine &machine) const
|
||||
|
||||
void riot6532_device_config::device_config_complete()
|
||||
{
|
||||
// inherit a copy of the static data
|
||||
const riot6532_interface *intf = reinterpret_cast<const riot6532_interface *>(static_config());
|
||||
if (intf != NULL)
|
||||
{
|
||||
*static_cast<riot6532_interface *>(this) = *intf;
|
||||
}
|
||||
// inherit a copy of the static data
|
||||
const riot6532_interface *intf = reinterpret_cast<const riot6532_interface *>(static_config());
|
||||
if (intf != NULL)
|
||||
{
|
||||
*static_cast<riot6532_interface *>(this) = *intf;
|
||||
}
|
||||
|
||||
// or initialize to defaults if none provided
|
||||
else
|
||||
{
|
||||
memset(&m_in_a_func, 0, sizeof(m_in_a_func));
|
||||
memset(&m_in_b_func, 0, sizeof(m_in_b_func));
|
||||
memset(&m_out_a_func, 0, sizeof(m_out_a_func));
|
||||
memset(&m_out_b_func, 0, sizeof(m_out_b_func));
|
||||
memset(&m_irq_func, 0, sizeof(m_irq_func));
|
||||
}
|
||||
// or initialize to defaults if none provided
|
||||
else
|
||||
{
|
||||
memset(&m_in_a_func, 0, sizeof(m_in_a_func));
|
||||
memset(&m_in_b_func, 0, sizeof(m_in_b_func));
|
||||
memset(&m_out_a_func, 0, sizeof(m_out_a_func));
|
||||
memset(&m_out_b_func, 0, sizeof(m_out_b_func));
|
||||
memset(&m_irq_func, 0, sizeof(m_irq_func));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -108,13 +108,13 @@ void riot6532_device::update_irqstate()
|
||||
int state = (m_irqstate & m_irqenable);
|
||||
|
||||
if (m_irq_func.write != NULL)
|
||||
{
|
||||
{
|
||||
devcb_call_write_line(&m_irq_func, (state != 0) ? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
logerror("%s:6532RIOT chip #%d: no irq callback function\n", cpuexec_describe_context(&m_machine), m_index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -156,21 +156,21 @@ UINT8 riot6532_device::get_timer()
|
||||
{
|
||||
/* if idle, return 0 */
|
||||
if (m_timerstate == TIMER_IDLE)
|
||||
{
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* if counting, return the number of ticks remaining */
|
||||
else if (m_timerstate == TIMER_COUNTING)
|
||||
{
|
||||
{
|
||||
return attotime_to_ticks(timer_timeleft(m_timer), clock()) >> m_timershift;
|
||||
}
|
||||
}
|
||||
|
||||
/* if finishing, return the number of ticks without the shift */
|
||||
else
|
||||
{
|
||||
{
|
||||
return attotime_to_ticks(timer_timeleft(m_timer), clock());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -182,8 +182,8 @@ UINT8 riot6532_device::get_timer()
|
||||
|
||||
TIMER_CALLBACK( riot6532_device::timer_end_callback )
|
||||
{
|
||||
riot6532_device *via = reinterpret_cast<riot6532_device *>(ptr);
|
||||
via->timer_end();
|
||||
riot6532_device *via = reinterpret_cast<riot6532_device *>(ptr);
|
||||
via->timer_end();
|
||||
}
|
||||
|
||||
void riot6532_device::timer_end()
|
||||
@ -220,8 +220,8 @@ void riot6532_device::timer_end()
|
||||
|
||||
WRITE8_DEVICE_HANDLER( riot6532_w )
|
||||
{
|
||||
riot6532_device *via = reinterpret_cast<riot6532_device *>(device);
|
||||
via->reg_w(offset, data);
|
||||
riot6532_device *via = downcast<riot6532_device *>(device);
|
||||
via->reg_w(offset, data);
|
||||
}
|
||||
|
||||
void riot6532_device::reg_w(UINT8 offset, UINT8 data)
|
||||
@ -244,9 +244,9 @@ void riot6532_device::reg_w(UINT8 offset, UINT8 data)
|
||||
|
||||
/* writes here clear the timer flag */
|
||||
if (m_timerstate != TIMER_FINISHING || get_timer() != 0xff)
|
||||
{
|
||||
{
|
||||
m_irqstate &= ~TIMER_FLAG;
|
||||
}
|
||||
}
|
||||
update_irqstate();
|
||||
|
||||
/* update the timer */
|
||||
@ -260,13 +260,13 @@ void riot6532_device::reg_w(UINT8 offset, UINT8 data)
|
||||
{
|
||||
/* A1 contains the A7 IRQ enable */
|
||||
if (offset & 2)
|
||||
{
|
||||
{
|
||||
m_irqenable |= PA7_FLAG;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
m_irqenable &= ~PA7_FLAG;
|
||||
}
|
||||
}
|
||||
|
||||
/* A0 specifies the edge detect direction: 0=negative, 1=positive */
|
||||
m_pa7dir = (offset & 1) << 7;
|
||||
@ -280,29 +280,29 @@ void riot6532_device::reg_w(UINT8 offset, UINT8 data)
|
||||
|
||||
/* if A0 == 1, we are writing to the port's DDR */
|
||||
if (offset & 1)
|
||||
{
|
||||
{
|
||||
port->m_ddr = data;
|
||||
}
|
||||
}
|
||||
|
||||
/* if A0 == 0, we are writing to the port's output */
|
||||
else
|
||||
{
|
||||
port->m_out = data;
|
||||
if (port->m_out_func.write != NULL)
|
||||
{
|
||||
{
|
||||
devcb_call_write8(&port->m_out_func, 0, data);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
logerror("%s:6532RIOT chip %s: Port %c is being written to but has no handler. %02X\n", cpuexec_describe_context(&m_machine), tag(), 'A' + (offset & 1), data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* writes to port A need to update the PA7 state */
|
||||
if (port == &m_port[0])
|
||||
{
|
||||
{
|
||||
update_pa7_state();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -313,8 +313,8 @@ void riot6532_device::reg_w(UINT8 offset, UINT8 data)
|
||||
|
||||
READ8_DEVICE_HANDLER( riot6532_r )
|
||||
{
|
||||
riot6532_device *via = reinterpret_cast<riot6532_device *>(device);
|
||||
return via->reg_r(offset);
|
||||
riot6532_device *via = downcast<riot6532_device *>(device);
|
||||
return via->reg_r(offset);
|
||||
}
|
||||
|
||||
UINT8 riot6532_device::reg_r(UINT8 offset)
|
||||
@ -338,19 +338,19 @@ UINT8 riot6532_device::reg_r(UINT8 offset)
|
||||
|
||||
/* A3 contains the timer IRQ enable */
|
||||
if (offset & 8)
|
||||
{
|
||||
{
|
||||
m_irqenable |= TIMER_FLAG;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
m_irqenable &= ~TIMER_FLAG;
|
||||
}
|
||||
}
|
||||
|
||||
/* implicitly clears the timer flag */
|
||||
if (m_timerstate != TIMER_FINISHING || val != 0xff)
|
||||
{
|
||||
{
|
||||
m_irqstate &= ~TIMER_FLAG;
|
||||
}
|
||||
}
|
||||
update_irqstate();
|
||||
}
|
||||
|
||||
@ -362,9 +362,9 @@ UINT8 riot6532_device::reg_r(UINT8 offset)
|
||||
|
||||
/* if A0 == 1, we are reading the port's DDR */
|
||||
if (offset & 1)
|
||||
{
|
||||
{
|
||||
val = port->m_ddr;
|
||||
}
|
||||
}
|
||||
|
||||
/* if A0 == 0, we are reading the port as an input */
|
||||
else
|
||||
@ -376,14 +376,14 @@ UINT8 riot6532_device::reg_r(UINT8 offset)
|
||||
|
||||
/* changes to port A need to update the PA7 state */
|
||||
if (port == &m_port[0])
|
||||
{
|
||||
{
|
||||
update_pa7_state();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
logerror("%s:6532RIOT chip %s: Port %c is being read but has no handler\n", cpuexec_describe_context(&m_machine), tag(), 'A' + (offset & 1));
|
||||
}
|
||||
}
|
||||
|
||||
/* apply the DDR to the result */
|
||||
val = apply_ddr(port);
|
||||
@ -399,8 +399,8 @@ UINT8 riot6532_device::reg_r(UINT8 offset)
|
||||
|
||||
void riot6532_porta_in_set(running_device *device, UINT8 data, UINT8 mask)
|
||||
{
|
||||
riot6532_device *via = reinterpret_cast<riot6532_device *>(device);
|
||||
via->porta_in_set(data, mask);
|
||||
riot6532_device *via = downcast<riot6532_device *>(device);
|
||||
via->porta_in_set(data, mask);
|
||||
}
|
||||
|
||||
void riot6532_device::porta_in_set(UINT8 data, UINT8 mask)
|
||||
@ -416,8 +416,8 @@ void riot6532_device::porta_in_set(UINT8 data, UINT8 mask)
|
||||
|
||||
void riot6532_portb_in_set(running_device *device, UINT8 data, UINT8 mask)
|
||||
{
|
||||
riot6532_device *via = reinterpret_cast<riot6532_device *>(device);
|
||||
via->portb_in_set(data, mask);
|
||||
riot6532_device *via = downcast<riot6532_device *>(device);
|
||||
via->portb_in_set(data, mask);
|
||||
}
|
||||
|
||||
void riot6532_device::portb_in_set(UINT8 data, UINT8 mask)
|
||||
@ -432,8 +432,8 @@ void riot6532_device::portb_in_set(UINT8 data, UINT8 mask)
|
||||
|
||||
UINT8 riot6532_porta_in_get(running_device *device)
|
||||
{
|
||||
riot6532_device *via = reinterpret_cast<riot6532_device *>(device);
|
||||
return via->porta_in_get();
|
||||
riot6532_device *via = downcast<riot6532_device *>(device);
|
||||
return via->porta_in_get();
|
||||
}
|
||||
|
||||
UINT8 riot6532_device::porta_in_get()
|
||||
@ -448,8 +448,8 @@ UINT8 riot6532_device::porta_in_get()
|
||||
|
||||
UINT8 riot6532_portb_in_get(running_device *device)
|
||||
{
|
||||
riot6532_device *via = reinterpret_cast<riot6532_device *>(device);
|
||||
return via->portb_in_get();
|
||||
riot6532_device *via = downcast<riot6532_device *>(device);
|
||||
return via->portb_in_get();
|
||||
}
|
||||
|
||||
UINT8 riot6532_device::portb_in_get()
|
||||
@ -464,8 +464,8 @@ UINT8 riot6532_device::portb_in_get()
|
||||
|
||||
UINT8 riot6532_porta_out_get(running_device *device)
|
||||
{
|
||||
riot6532_device *via = reinterpret_cast<riot6532_device *>(device);
|
||||
return via->porta_out_get();
|
||||
riot6532_device *via = downcast<riot6532_device *>(device);
|
||||
return via->porta_out_get();
|
||||
}
|
||||
|
||||
UINT8 riot6532_device::porta_out_get()
|
||||
@ -480,8 +480,8 @@ UINT8 riot6532_device::porta_out_get()
|
||||
|
||||
UINT8 riot6532_portb_out_get(running_device *device)
|
||||
{
|
||||
riot6532_device *via = reinterpret_cast<riot6532_device *>(device);
|
||||
return via->portb_out_get();
|
||||
riot6532_device *via = downcast<riot6532_device *>(device);
|
||||
return via->portb_out_get();
|
||||
}
|
||||
|
||||
UINT8 riot6532_device::portb_out_get()
|
||||
@ -499,8 +499,8 @@ UINT8 riot6532_device::portb_out_get()
|
||||
//-------------------------------------------------
|
||||
|
||||
riot6532_device::riot6532_device(running_machine &_machine, const riot6532_device_config &config)
|
||||
: device_t(_machine, config),
|
||||
m_config(config)
|
||||
: device_t(_machine, config),
|
||||
m_config(config)
|
||||
{
|
||||
}
|
||||
|
||||
@ -517,33 +517,33 @@ void riot6532_device::device_start()
|
||||
m_index = m_machine.m_devicelist.index(RIOT6532, tag());
|
||||
|
||||
/* configure the ports */
|
||||
devcb_resolve_read8(&m_port[0].m_in_func, &m_config.m_in_a_func, this);
|
||||
devcb_resolve_write8(&m_port[0].m_out_func, &m_config.m_out_a_func, this);
|
||||
devcb_resolve_read8(&m_port[1].m_in_func, &m_config.m_in_b_func, this);
|
||||
devcb_resolve_write8(&m_port[1].m_out_func, &m_config.m_out_b_func, this);
|
||||
devcb_resolve_read8(&m_port[0].m_in_func, &m_config.m_in_a_func, this);
|
||||
devcb_resolve_write8(&m_port[0].m_out_func, &m_config.m_out_a_func, this);
|
||||
devcb_resolve_read8(&m_port[1].m_in_func, &m_config.m_in_b_func, this);
|
||||
devcb_resolve_write8(&m_port[1].m_out_func, &m_config.m_out_b_func, this);
|
||||
|
||||
/* resolve irq func */
|
||||
devcb_resolve_write_line(&m_irq_func, &m_config.m_irq_func, this);
|
||||
devcb_resolve_write_line(&m_irq_func, &m_config.m_irq_func, this);
|
||||
|
||||
/* allocate timers */
|
||||
m_timer = timer_alloc(&m_machine, timer_end_callback, (void *)this);
|
||||
m_timer = timer_alloc(&m_machine, timer_end_callback, (void *)this);
|
||||
|
||||
/* register for save states */
|
||||
state_save_register_device_item(this, 0, m_port[0].m_in);
|
||||
state_save_register_device_item(this, 0, m_port[0].m_out);
|
||||
state_save_register_device_item(this, 0, m_port[0].m_ddr);
|
||||
state_save_register_device_item(this, 0, m_port[1].m_in);
|
||||
state_save_register_device_item(this, 0, m_port[1].m_out);
|
||||
state_save_register_device_item(this, 0, m_port[1].m_ddr);
|
||||
state_save_register_device_item(this, 0, m_port[0].m_in);
|
||||
state_save_register_device_item(this, 0, m_port[0].m_out);
|
||||
state_save_register_device_item(this, 0, m_port[0].m_ddr);
|
||||
state_save_register_device_item(this, 0, m_port[1].m_in);
|
||||
state_save_register_device_item(this, 0, m_port[1].m_out);
|
||||
state_save_register_device_item(this, 0, m_port[1].m_ddr);
|
||||
|
||||
state_save_register_device_item(this, 0, m_irqstate);
|
||||
state_save_register_device_item(this, 0, m_irqenable);
|
||||
state_save_register_device_item(this, 0, m_irqstate);
|
||||
state_save_register_device_item(this, 0, m_irqenable);
|
||||
|
||||
state_save_register_device_item(this, 0, m_pa7dir);
|
||||
state_save_register_device_item(this, 0, m_pa7prev);
|
||||
state_save_register_device_item(this, 0, m_pa7dir);
|
||||
state_save_register_device_item(this, 0, m_pa7prev);
|
||||
|
||||
state_save_register_device_item(this, 0, m_timershift);
|
||||
state_save_register_device_item(this, 0, m_timerstate);
|
||||
state_save_register_device_item(this, 0, m_timershift);
|
||||
state_save_register_device_item(this, 0, m_timerstate);
|
||||
}
|
||||
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
//-------------------------------------------------
|
||||
|
||||
ttl74123_device_config::ttl74123_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
|
||||
: device_config(mconfig, static_alloc_device_config, "TTL74123", tag, owner, clock)
|
||||
: device_config(mconfig, static_alloc_device_config, "TTL74123", tag, owner, clock)
|
||||
{
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ ttl74123_device_config::ttl74123_device_config(const machine_config &mconfig, co
|
||||
|
||||
device_config *ttl74123_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
|
||||
{
|
||||
return global_alloc(ttl74123_device_config(mconfig, tag, owner, clock));
|
||||
return global_alloc(ttl74123_device_config(mconfig, tag, owner, clock));
|
||||
}
|
||||
|
||||
|
||||
@ -45,7 +45,7 @@ device_config *ttl74123_device_config::static_alloc_device_config(const machine_
|
||||
|
||||
device_t *ttl74123_device_config::alloc_device(running_machine &machine) const
|
||||
{
|
||||
return auto_alloc(&machine, ttl74123_device(machine, *this));
|
||||
return auto_alloc(&machine, ttl74123_device(machine, *this));
|
||||
}
|
||||
|
||||
|
||||
@ -71,8 +71,8 @@ void ttl74123_device_config::device_config_complete()
|
||||
//-------------------------------------------------
|
||||
|
||||
ttl74123_device::ttl74123_device(running_machine &_machine, const ttl74123_device_config &config)
|
||||
: device_t(_machine, config),
|
||||
m_config(config)
|
||||
: device_t(_machine, config),
|
||||
m_config(config)
|
||||
{
|
||||
|
||||
}
|
||||
@ -84,17 +84,17 @@ ttl74123_device::ttl74123_device(running_machine &_machine, const ttl74123_devic
|
||||
|
||||
void ttl74123_device::device_start()
|
||||
{
|
||||
m_timer = timer_alloc(&m_machine, clear_callback, (void *)this);
|
||||
m_timer = timer_alloc(&m_machine, clear_callback, (void *)this);
|
||||
|
||||
/* start with the defaults */
|
||||
m_a = m_config.m_a;
|
||||
m_b = m_config.m_b;
|
||||
m_clear = m_config.m_clear;
|
||||
m_a = m_config.m_a;
|
||||
m_b = m_config.m_b;
|
||||
m_clear = m_config.m_clear;
|
||||
|
||||
/* register for state saving */
|
||||
state_save_register_device_item(this, 0, m_a);
|
||||
state_save_register_device_item(this, 0, m_b);
|
||||
state_save_register_device_item(this, 0, m_clear);
|
||||
state_save_register_device_item(this, 0, m_a);
|
||||
state_save_register_device_item(this, 0, m_b);
|
||||
state_save_register_device_item(this, 0, m_clear);
|
||||
}
|
||||
|
||||
|
||||
@ -115,33 +115,33 @@ void ttl74123_device::device_reset()
|
||||
|
||||
attotime ttl74123_device::compute_duration()
|
||||
{
|
||||
double duration;
|
||||
double duration;
|
||||
|
||||
switch (m_config.m_connection_type)
|
||||
{
|
||||
case TTL74123_NOT_GROUNDED_NO_DIODE:
|
||||
duration = 0.28 * m_config.m_res * m_config.m_cap * (1.0 + (700.0 / m_config.m_res));
|
||||
break;
|
||||
switch (m_config.m_connection_type)
|
||||
{
|
||||
case TTL74123_NOT_GROUNDED_NO_DIODE:
|
||||
duration = 0.28 * m_config.m_res * m_config.m_cap * (1.0 + (700.0 / m_config.m_res));
|
||||
break;
|
||||
|
||||
case TTL74123_NOT_GROUNDED_DIODE:
|
||||
duration = 0.25 * m_config.m_res * m_config.m_cap * (1.0 + (700.0 / m_config.m_res));
|
||||
break;
|
||||
case TTL74123_NOT_GROUNDED_DIODE:
|
||||
duration = 0.25 * m_config.m_res * m_config.m_cap * (1.0 + (700.0 / m_config.m_res));
|
||||
break;
|
||||
|
||||
case TTL74123_GROUNDED:
|
||||
default:
|
||||
if (m_config.m_cap < CAP_U(0.1))
|
||||
{
|
||||
/* this is really a curve - a very flat one in the 0.1uF-.01uF range */
|
||||
duration = 0.32 * m_config.m_res * m_config.m_cap;
|
||||
}
|
||||
else
|
||||
{
|
||||
duration = 0.33 * m_config.m_res * m_config.m_cap;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TTL74123_GROUNDED:
|
||||
default:
|
||||
if (m_config.m_cap < CAP_U(0.1))
|
||||
{
|
||||
/* this is really a curve - a very flat one in the 0.1uF-.01uF range */
|
||||
duration = 0.32 * m_config.m_res * m_config.m_cap;
|
||||
}
|
||||
else
|
||||
{
|
||||
duration = 0.33 * m_config.m_res * m_config.m_cap;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return double_to_attotime(duration);
|
||||
return double_to_attotime(duration);
|
||||
}
|
||||
|
||||
|
||||
@ -151,150 +151,150 @@ attotime ttl74123_device::compute_duration()
|
||||
|
||||
int ttl74123_device::timer_running()
|
||||
{
|
||||
return (attotime_compare(timer_timeleft(m_timer), attotime_zero) > 0) &&
|
||||
(attotime_compare(timer_timeleft(m_timer), attotime_never) != 0);
|
||||
return (attotime_compare(timer_timeleft(m_timer), attotime_zero) > 0) &&
|
||||
(attotime_compare(timer_timeleft(m_timer), attotime_never) != 0);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
TIMER_CALLBACK( output_callback )
|
||||
TIMER_CALLBACK( output_callback )
|
||||
-------------------------------------------------*/
|
||||
|
||||
TIMER_CALLBACK( ttl74123_device::output_callback )
|
||||
{
|
||||
ttl74123_device *dev = reinterpret_cast<ttl74123_device*>(ptr);
|
||||
dev->output(param);
|
||||
ttl74123_device *dev = reinterpret_cast<ttl74123_device*>(ptr);
|
||||
dev->output(param);
|
||||
}
|
||||
|
||||
void ttl74123_device::output(INT32 param)
|
||||
{
|
||||
m_config.m_output_changed_cb(this, 0, param);
|
||||
m_config.m_output_changed_cb(this, 0, param);
|
||||
}
|
||||
|
||||
|
||||
void ttl74123_device::set_output()
|
||||
{
|
||||
int output = timer_running();
|
||||
int output = timer_running();
|
||||
|
||||
timer_set( &m_machine, attotime_zero, (void *)this, output, output_callback );
|
||||
timer_set( &m_machine, attotime_zero, (void *)this, output, output_callback );
|
||||
|
||||
if (LOG) logerror("74123 %s: Output: %d\n", tag(), output);
|
||||
if (LOG) logerror("74123 %s: Output: %d\n", tag(), output);
|
||||
}
|
||||
|
||||
|
||||
TIMER_CALLBACK( ttl74123_device::clear_callback )
|
||||
{
|
||||
ttl74123_device *dev = reinterpret_cast<ttl74123_device*>(ptr);
|
||||
dev->clear();
|
||||
ttl74123_device *dev = reinterpret_cast<ttl74123_device*>(ptr);
|
||||
dev->clear();
|
||||
}
|
||||
|
||||
void ttl74123_device::clear()
|
||||
{
|
||||
int output = timer_running();
|
||||
int output = timer_running();
|
||||
|
||||
m_config.m_output_changed_cb(this, 0, output);
|
||||
m_config.m_output_changed_cb(this, 0, output);
|
||||
}
|
||||
|
||||
|
||||
void ttl74123_device::start_pulse()
|
||||
{
|
||||
attotime duration = compute_duration();
|
||||
attotime duration = compute_duration();
|
||||
|
||||
if(timer_running())
|
||||
{
|
||||
/* retriggering, but not if we are called to quickly */
|
||||
attotime delay_time = attotime_make(0, ATTOSECONDS_PER_SECOND * m_config.m_cap * 220);
|
||||
if(timer_running())
|
||||
{
|
||||
/* retriggering, but not if we are called to quickly */
|
||||
attotime delay_time = attotime_make(0, ATTOSECONDS_PER_SECOND * m_config.m_cap * 220);
|
||||
|
||||
if(attotime_compare(timer_timeelapsed(m_timer), delay_time) >= 0)
|
||||
{
|
||||
timer_adjust_oneshot(m_timer, duration, 0);
|
||||
if(attotime_compare(timer_timeelapsed(m_timer), delay_time) >= 0)
|
||||
{
|
||||
timer_adjust_oneshot(m_timer, duration, 0);
|
||||
|
||||
if (LOG) logerror("74123 %s: Retriggering pulse. Duration: %f\n", tag(), attotime_to_double(duration));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (LOG) logerror("74123 %s: Retriggering failed.\n", tag());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* starting */
|
||||
timer_adjust_oneshot(m_timer, duration, 0);
|
||||
if (LOG) logerror("74123 %s: Retriggering pulse. Duration: %f\n", tag(), attotime_to_double(duration));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (LOG) logerror("74123 %s: Retriggering failed.\n", tag());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* starting */
|
||||
timer_adjust_oneshot(m_timer, duration, 0);
|
||||
|
||||
set_output();
|
||||
set_output();
|
||||
|
||||
if (LOG) logerror("74123 %s: Starting pulse. Duration: %f\n", tag(), attotime_to_double(duration));
|
||||
}
|
||||
if (LOG) logerror("74123 %s: Starting pulse. Duration: %f\n", tag(), attotime_to_double(duration));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
WRITE8_DEVICE_HANDLER( ttl74123_a_w )
|
||||
{
|
||||
ttl74123_device *dev = reinterpret_cast<ttl74123_device *>(device);
|
||||
dev->a_w(data);
|
||||
ttl74123_device *dev = downcast<ttl74123_device *>(device);
|
||||
dev->a_w(data);
|
||||
}
|
||||
|
||||
void ttl74123_device::a_w(UINT8 data)
|
||||
{
|
||||
/* start/regtrigger pulse if B=HI and falling edge on A (while clear is HI) */
|
||||
if (!data && m_a && m_b && m_clear)
|
||||
{
|
||||
start_pulse();
|
||||
}
|
||||
/* start/regtrigger pulse if B=HI and falling edge on A (while clear is HI) */
|
||||
if (!data && m_a && m_b && m_clear)
|
||||
{
|
||||
start_pulse();
|
||||
}
|
||||
|
||||
m_a = data;
|
||||
m_a = data;
|
||||
}
|
||||
|
||||
|
||||
WRITE8_DEVICE_HANDLER( ttl74123_b_w )
|
||||
{
|
||||
ttl74123_device *dev = reinterpret_cast<ttl74123_device *>(device);
|
||||
dev->b_w(data);
|
||||
ttl74123_device *dev = downcast<ttl74123_device *>(device);
|
||||
dev->b_w(data);
|
||||
}
|
||||
|
||||
void ttl74123_device::b_w(UINT8 data)
|
||||
{
|
||||
/* start/regtrigger pulse if A=LO and rising edge on B (while clear is HI) */
|
||||
if (data && !m_b && !m_a && m_clear)
|
||||
{
|
||||
start_pulse();
|
||||
}
|
||||
/* start/regtrigger pulse if A=LO and rising edge on B (while clear is HI) */
|
||||
if (data && !m_b && !m_a && m_clear)
|
||||
{
|
||||
start_pulse();
|
||||
}
|
||||
|
||||
m_b = data;
|
||||
m_b = data;
|
||||
}
|
||||
|
||||
|
||||
WRITE8_DEVICE_HANDLER( ttl74123_clear_w )
|
||||
{
|
||||
ttl74123_device *dev = reinterpret_cast<ttl74123_device *>(device);
|
||||
dev->clear_w(data);
|
||||
ttl74123_device *dev = downcast<ttl74123_device *>(device);
|
||||
dev->clear_w(data);
|
||||
}
|
||||
|
||||
void ttl74123_device::clear_w(UINT8 data)
|
||||
{
|
||||
/* start/regtrigger pulse if B=HI and A=LO and rising edge on clear */
|
||||
if (data && !m_a && m_b && !m_clear)
|
||||
{
|
||||
start_pulse();
|
||||
}
|
||||
else if (!data) /* clear the output */
|
||||
{
|
||||
timer_adjust_oneshot(m_timer, attotime_zero, 0);
|
||||
/* start/regtrigger pulse if B=HI and A=LO and rising edge on clear */
|
||||
if (data && !m_a && m_b && !m_clear)
|
||||
{
|
||||
start_pulse();
|
||||
}
|
||||
else if (!data) /* clear the output */
|
||||
{
|
||||
timer_adjust_oneshot(m_timer, attotime_zero, 0);
|
||||
|
||||
if (LOG) logerror("74123 #%s: Cleared\n", tag() );
|
||||
}
|
||||
m_clear = data;
|
||||
if (LOG) logerror("74123 #%s: Cleared\n", tag() );
|
||||
}
|
||||
m_clear = data;
|
||||
}
|
||||
|
||||
WRITE8_DEVICE_HANDLER( ttl74123_reset_w )
|
||||
{
|
||||
ttl74123_device *dev = reinterpret_cast<ttl74123_device *>(device);
|
||||
dev->reset_w();
|
||||
ttl74123_device *dev = downcast<ttl74123_device *>(device);
|
||||
dev->reset_w();
|
||||
}
|
||||
|
||||
void ttl74123_device::reset_w()
|
||||
{
|
||||
set_output();
|
||||
set_output();
|
||||
}
|
||||
|
||||
const device_type TTL74123 = ttl74123_device_config::static_alloc_device_config;
|
||||
|
Loading…
Reference in New Issue
Block a user