renamed generic leds_decay stuff to display_decay so it makes sense on vfd/lamp/lcd devices

This commit is contained in:
hap 2015-02-14 18:48:58 +01:00
parent 57af55aa8c
commit d2c0b19c1b
9 changed files with 265 additions and 265 deletions

View File

@ -38,16 +38,16 @@ public:
UINT16 m_o;
UINT16 m_leds_state[0x10];
UINT16 m_leds_cache[0x10];
UINT8 m_leds_decay[0x100];
UINT16 m_display_state[0x10];
UINT16 m_display_cache[0x10];
UINT8 m_display_decay[0x100];
DECLARE_READ8_MEMBER(read_k);
DECLARE_WRITE16_MEMBER(write_o);
DECLARE_WRITE16_MEMBER(write_r);
TIMER_DEVICE_CALLBACK_MEMBER(leds_decay_tick);
void leds_update();
TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick);
void display_update();
virtual void machine_start();
};
@ -56,7 +56,7 @@ public:
/***************************************************************************
LEDs
LED Display
***************************************************************************/
@ -64,9 +64,9 @@ public:
// To prevent flickering here, we need to simulate a decay.
// decay time, in steps of 10ms
#define LEDS_DECAY_TIME 4
#define DISPLAY_DECAY_TIME 4
void cnsector_state::leds_update()
void cnsector_state::display_update()
{
UINT16 active_state[0x10];
@ -78,32 +78,32 @@ void cnsector_state::leds_update()
{
int di = j << 4 | i;
// turn on powered leds
if (m_leds_state[i] >> j & 1)
m_leds_decay[di] = LEDS_DECAY_TIME;
// turn on powered segments
if (m_display_state[i] >> j & 1)
m_display_decay[di] = DISPLAY_DECAY_TIME;
// determine active state
int ds = (m_leds_decay[di] != 0) ? 1 : 0;
int ds = (m_display_decay[di] != 0) ? 1 : 0;
active_state[i] |= (ds << j);
}
}
// on difference, send to output
for (int i = 0; i < 0x10; i++)
if (m_leds_cache[i] != active_state[i])
if (m_display_cache[i] != active_state[i])
output_set_digit_value(i, active_state[i]);
memcpy(m_leds_cache, active_state, sizeof(m_leds_cache));
memcpy(m_display_cache, active_state, sizeof(m_display_cache));
}
TIMER_DEVICE_CALLBACK_MEMBER(cnsector_state::leds_decay_tick)
TIMER_DEVICE_CALLBACK_MEMBER(cnsector_state::display_decay_tick)
{
// slowly turn off unpowered leds
// slowly turn off unpowered segments
for (int i = 0; i < 0x100; i++)
if (!(m_leds_state[i & 0xf] >> (i>>4) & 1) && m_leds_decay[i])
m_leds_decay[i]--;
if (!(m_display_state[i & 0xf] >> (i>>4) & 1) && m_display_decay[i])
m_display_decay[i]--;
leds_update();
display_update();
}
@ -130,8 +130,8 @@ WRITE16_MEMBER(cnsector_state::write_r)
{
// R0-R5: select digit (right-to-left)
for (int i = 0; i < 6; i++)
m_leds_state[i] = (data >> i & 1) ? m_o : 0;
leds_update();
m_display_state[i] = (data >> i & 1) ? m_o : 0;
display_update();
// R6-R9: direction leds
for (int i = 6; i < 10; i++)
@ -196,16 +196,16 @@ INPUT_PORTS_END
void cnsector_state::machine_start()
{
// zerofill
memset(m_leds_state, 0, sizeof(m_leds_state));
memset(m_leds_cache, 0, sizeof(m_leds_cache));
memset(m_leds_decay, 0, sizeof(m_leds_decay));
memset(m_display_state, 0, sizeof(m_display_state));
memset(m_display_cache, 0, sizeof(m_display_cache));
memset(m_display_decay, 0, sizeof(m_display_decay));
m_o = 0;
// register for savestates
save_item(NAME(m_leds_state));
save_item(NAME(m_leds_cache));
save_item(NAME(m_leds_decay));
save_item(NAME(m_display_state));
save_item(NAME(m_display_cache));
save_item(NAME(m_display_decay));
save_item(NAME(m_o));
}
@ -219,7 +219,7 @@ static MACHINE_CONFIG_START( cnsector, cnsector_state )
MCFG_TMS1XXX_WRITE_O_CB(WRITE16(cnsector_state, write_o))
MCFG_TMS1XXX_WRITE_R_CB(WRITE16(cnsector_state, write_r))
MCFG_TIMER_DRIVER_ADD_PERIODIC("leds_decay", cnsector_state, leds_decay_tick, attotime::from_msec(10))
MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", cnsector_state, display_decay_tick, attotime::from_msec(10))
MCFG_DEFAULT_LAYOUT(layout_cnsector)

View File

@ -41,15 +41,15 @@ public:
UINT16 m_o;
UINT16 m_leds_state;
UINT8 m_leds_decay[0x10];
UINT16 m_display_state;
UINT8 m_display_decay[0x10];
DECLARE_READ8_MEMBER(read_k);
DECLARE_WRITE16_MEMBER(write_o);
DECLARE_WRITE16_MEMBER(write_r);
TIMER_DEVICE_CALLBACK_MEMBER(leds_decay_tick);
void leds_update();
TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick);
void display_update();
virtual void machine_start();
};
@ -57,7 +57,7 @@ public:
/***************************************************************************
LEDs
LED Display
***************************************************************************/
@ -65,29 +65,29 @@ public:
// To prevent flickering here, we need to simulate a decay.
// decay time, in steps of 10ms
#define LEDS_DECAY_TIME 2
#define DISPLAY_DECAY_TIME 2
void comp4_state::leds_update()
void comp4_state::display_update()
{
for (int i = 0; i < 0x10; i++)
{
// turn on powered leds
if (m_leds_state >> i & 1)
m_leds_decay[i] = LEDS_DECAY_TIME;
// turn on powered segments
if (m_display_state >> i & 1)
m_display_decay[i] = DISPLAY_DECAY_TIME;
// send to output
output_set_lamp_value(i, (m_leds_decay[i] != 0) ? 1 : 0);
output_set_lamp_value(i, (m_display_decay[i] != 0) ? 1 : 0);
}
}
TIMER_DEVICE_CALLBACK_MEMBER(comp4_state::leds_decay_tick)
TIMER_DEVICE_CALLBACK_MEMBER(comp4_state::display_decay_tick)
{
// slowly turn off unpowered leds
// slowly turn off unpowered segments
for (int i = 0; i < 0x10; i++)
if (!(m_leds_state >> i & 1) && m_leds_decay[i])
m_leds_decay[i]--;
if (!(m_display_state >> i & 1) && m_display_decay[i])
m_display_decay[i]--;
leds_update();
display_update();
}
@ -118,8 +118,8 @@ WRITE16_MEMBER(comp4_state::write_r)
// R2 R7
// R1 R6
// R0 R5
m_leds_state = data;
leds_update();
m_display_state = data;
display_update();
}
WRITE16_MEMBER(comp4_state::write_o)
@ -169,14 +169,14 @@ INPUT_PORTS_END
void comp4_state::machine_start()
{
// zerofill
m_leds_state = 0;
memset(m_leds_decay, 0, sizeof(m_leds_decay));
m_display_state = 0;
memset(m_display_decay, 0, sizeof(m_display_decay));
m_o = 0;
// register for savestates
save_item(NAME(m_leds_state));
save_item(NAME(m_leds_decay));
save_item(NAME(m_display_state));
save_item(NAME(m_display_decay));
save_item(NAME(m_o));
}
@ -190,7 +190,7 @@ static MACHINE_CONFIG_START( comp4, comp4_state )
MCFG_TMS1XXX_WRITE_O_CB(WRITE16(comp4_state, write_o))
MCFG_TMS1XXX_WRITE_R_CB(WRITE16(comp4_state, write_r))
MCFG_TIMER_DRIVER_ADD_PERIODIC("leds_decay", comp4_state, leds_decay_tick, attotime::from_msec(10))
MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", comp4_state, display_decay_tick, attotime::from_msec(10))
MCFG_DEFAULT_LAYOUT(layout_comp4)

View File

@ -44,9 +44,9 @@ public:
UINT16 m_o;
bool m_power_on;
UINT16 m_leds_state[0x10];
UINT16 m_leds_cache[0x10];
UINT8 m_leds_decay[0x100];
UINT16 m_display_state[0x10];
UINT16 m_display_cache[0x10];
UINT8 m_display_decay[0x100];
DECLARE_READ8_MEMBER(read_k);
DECLARE_WRITE16_MEMBER(write_o);
@ -55,8 +55,8 @@ public:
DECLARE_INPUT_CHANGED_MEMBER(power_button);
DECLARE_WRITE_LINE_MEMBER(auto_power_off);
TIMER_DEVICE_CALLBACK_MEMBER(leds_decay_tick);
void leds_update();
TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick);
void display_update();
virtual void machine_reset();
virtual void machine_start();
@ -66,7 +66,7 @@ public:
/***************************************************************************
LEDs
LED Display
***************************************************************************/
@ -74,9 +74,9 @@ public:
// To prevent flickering here, we need to simulate a decay.
// decay time, in steps of 10ms
#define LEDS_DECAY_TIME 4
#define DISPLAY_DECAY_TIME 4
void elecdet_state::leds_update()
void elecdet_state::display_update()
{
UINT16 active_state[0x10];
@ -88,32 +88,32 @@ void elecdet_state::leds_update()
{
int di = j << 4 | i;
// turn on powered leds
if (m_power_on && m_leds_state[i] >> j & 1)
m_leds_decay[di] = LEDS_DECAY_TIME;
// turn on powered segments
if (m_power_on && m_display_state[i] >> j & 1)
m_display_decay[di] = DISPLAY_DECAY_TIME;
// determine active state
int ds = (m_leds_decay[di] != 0) ? 1 : 0;
int ds = (m_display_decay[di] != 0) ? 1 : 0;
active_state[i] |= (ds << j);
}
}
// on difference, send to output
for (int i = 0; i < 0x10; i++)
if (m_leds_cache[i] != active_state[i])
if (m_display_cache[i] != active_state[i])
output_set_digit_value(i, active_state[i]);
memcpy(m_leds_cache, active_state, sizeof(m_leds_cache));
memcpy(m_display_cache, active_state, sizeof(m_display_cache));
}
TIMER_DEVICE_CALLBACK_MEMBER(elecdet_state::leds_decay_tick)
TIMER_DEVICE_CALLBACK_MEMBER(elecdet_state::display_decay_tick)
{
// slowly turn off unpowered leds
// slowly turn off unpowered segments
for (int i = 0; i < 0x100; i++)
if (!(m_leds_state[i & 0xf] >> (i>>4) & 1) && m_leds_decay[i])
m_leds_decay[i]--;
if (!(m_display_state[i & 0xf] >> (i>>4) & 1) && m_display_decay[i])
m_display_decay[i]--;
leds_update();
display_update();
}
@ -145,9 +145,9 @@ WRITE16_MEMBER(elecdet_state::write_r)
// R0-R6: select digit
UINT8 o = BITSWAP8(m_o,7,5,2,1,4,0,6,3) & 0x7f;
for (int i = 0; i < 7; i++)
m_leds_state[i] = (data >> i & 1) ? o : 0;
m_display_state[i] = (data >> i & 1) ? o : 0;
leds_update();
display_update();
// R7,R8: speaker on
m_speaker->level_w((data & 0x180 && m_o & 0x80) ? 1 : 0);
@ -249,17 +249,17 @@ void elecdet_state::machine_reset()
void elecdet_state::machine_start()
{
// zerofill
memset(m_leds_state, 0, sizeof(m_leds_state));
memset(m_leds_cache, 0, sizeof(m_leds_cache));
memset(m_leds_decay, 0, sizeof(m_leds_decay));
memset(m_display_state, 0, sizeof(m_display_state));
memset(m_display_cache, 0, sizeof(m_display_cache));
memset(m_display_decay, 0, sizeof(m_display_decay));
m_o = 0;
m_power_on = false;
// register for savestates
save_item(NAME(m_leds_state));
save_item(NAME(m_leds_cache));
save_item(NAME(m_leds_decay));
save_item(NAME(m_display_state));
save_item(NAME(m_display_cache));
save_item(NAME(m_display_decay));
save_item(NAME(m_o));
save_item(NAME(m_power_on));
@ -275,7 +275,7 @@ static MACHINE_CONFIG_START( elecdet, elecdet_state )
MCFG_TMS1XXX_WRITE_R_CB(WRITE16(elecdet_state, write_r))
MCFG_TMS1XXX_POWER_OFF_CB(WRITELINE(elecdet_state, auto_power_off))
MCFG_TIMER_DRIVER_ADD_PERIODIC("leds_decay", elecdet_state, leds_decay_tick, attotime::from_msec(10))
MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", elecdet_state, display_decay_tick, attotime::from_msec(10))
MCFG_DEFAULT_LAYOUT(layout_elecdet)

View File

@ -72,17 +72,17 @@ public:
UINT16 m_r;
UINT16 m_o;
UINT16 m_leds_state[0x10];
UINT16 m_leds_cache[0x10];
UINT8 m_leds_decay[0x100];
UINT16 m_display_state[0x10];
UINT16 m_display_cache[0x10];
UINT8 m_display_decay[0x100];
DECLARE_READ8_MEMBER(read_k);
DECLARE_WRITE16_MEMBER(write_o);
DECLARE_WRITE16_MEMBER(splitsec_write_r);
DECLARE_WRITE16_MEMBER(bankshot_write_r);
TIMER_DEVICE_CALLBACK_MEMBER(leds_decay_tick);
void leds_update();
TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick);
void display_update();
virtual void machine_start();
};
@ -91,7 +91,7 @@ public:
/***************************************************************************
LEDs
LED Display
***************************************************************************/
@ -99,7 +99,7 @@ public:
// To prevent flickering here, we need to simulate a decay.
// decay time, in steps of 10ms
#define LEDS_DECAY_TIME 4
#define DISPLAY_DECAY_TIME 4
/* display layout, where number xy is lamp R(x),O(y)
@ -122,14 +122,14 @@ public:
*/
void splitsec_state::leds_update()
void splitsec_state::display_update()
{
UINT16 active_state[0x10];
for (int i = 0; i < 0x10; i++)
{
// update current state
m_leds_state[i] = (m_r >> i & 1) ? m_o : 0;
m_display_state[i] = (m_r >> i & 1) ? m_o : 0;
active_state[i] = 0;
@ -137,35 +137,35 @@ void splitsec_state::leds_update()
{
int di = j << 4 | i;
// turn on powered leds
if (m_leds_state[i] >> j & 1)
m_leds_decay[di] = LEDS_DECAY_TIME;
// turn on powered segments
if (m_display_state[i] >> j & 1)
m_display_decay[di] = DISPLAY_DECAY_TIME;
// determine active state
int ds = (m_leds_decay[di] != 0) ? 1 : 0;
int ds = (m_display_decay[di] != 0) ? 1 : 0;
active_state[i] |= (ds << j);
}
}
// on difference, send to output
for (int i = 0; i < 0x10; i++)
if (m_leds_cache[i] != active_state[i])
if (m_display_cache[i] != active_state[i])
{
for (int j = 0; j < 8; j++)
output_set_lamp_value(i*10 + j, active_state[i] >> j & 1);
}
memcpy(m_leds_cache, active_state, sizeof(m_leds_cache));
memcpy(m_display_cache, active_state, sizeof(m_display_cache));
}
TIMER_DEVICE_CALLBACK_MEMBER(splitsec_state::leds_decay_tick)
TIMER_DEVICE_CALLBACK_MEMBER(splitsec_state::display_decay_tick)
{
// slowly turn off unpowered leds
// slowly turn off unpowered segments
for (int i = 0; i < 0x100; i++)
if (!(m_leds_state[i & 0xf] >> (i>>4) & 1) && m_leds_decay[i])
m_leds_decay[i]--;
if (!(m_display_state[i & 0xf] >> (i>>4) & 1) && m_display_decay[i])
m_display_decay[i]--;
leds_update();
display_update();
}
@ -193,7 +193,7 @@ WRITE16_MEMBER(splitsec_state::write_o)
// O0-O6: led rows
// O7: N/C
m_o = data;
leds_update();
display_update();
}
WRITE16_MEMBER(splitsec_state::splitsec_write_r)
@ -206,7 +206,7 @@ WRITE16_MEMBER(splitsec_state::splitsec_write_r)
// R0-R7: led columns
m_r = data & 0xff;
leds_update();
display_update();
}
WRITE16_MEMBER(splitsec_state::bankshot_write_r)
@ -219,7 +219,7 @@ WRITE16_MEMBER(splitsec_state::bankshot_write_r)
// R2-R10: led columns
m_r = data & ~3;
leds_update();
display_update();
}
@ -281,18 +281,18 @@ INPUT_PORTS_END
void splitsec_state::machine_start()
{
// zerofill
memset(m_leds_state, 0, sizeof(m_leds_state));
memset(m_leds_cache, 0, sizeof(m_leds_cache));
memset(m_leds_decay, 0, sizeof(m_leds_decay));
memset(m_display_state, 0, sizeof(m_display_state));
memset(m_display_cache, 0, sizeof(m_display_cache));
memset(m_display_decay, 0, sizeof(m_display_decay));
m_input_mux = 0;
m_r = 0;
m_o = 0;
// register for savestates
save_item(NAME(m_leds_state));
save_item(NAME(m_leds_cache));
save_item(NAME(m_leds_decay));
save_item(NAME(m_display_state));
save_item(NAME(m_display_cache));
save_item(NAME(m_display_decay));
save_item(NAME(m_input_mux));
save_item(NAME(m_r));
@ -308,7 +308,7 @@ static MACHINE_CONFIG_START( splitsec, splitsec_state )
MCFG_TMS1XXX_WRITE_O_CB(WRITE16(splitsec_state, write_o))
MCFG_TMS1XXX_WRITE_R_CB(WRITE16(splitsec_state, splitsec_write_r))
MCFG_TIMER_DRIVER_ADD_PERIODIC("leds_decay", splitsec_state, leds_decay_tick, attotime::from_msec(10))
MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", splitsec_state, display_decay_tick, attotime::from_msec(10))
MCFG_DEFAULT_LAYOUT(layout_splitsec)

View File

@ -39,16 +39,16 @@ public:
UINT16 m_r;
UINT16 m_o;
UINT16 m_leds_state[0x10];
UINT16 m_leds_cache[0x10];
UINT8 m_leds_decay[0x100];
UINT16 m_display_state[0x10];
UINT16 m_display_cache[0x10];
UINT8 m_display_decay[0x100];
DECLARE_READ8_MEMBER(read_k);
DECLARE_WRITE16_MEMBER(write_o);
DECLARE_WRITE16_MEMBER(write_r);
TIMER_DEVICE_CALLBACK_MEMBER(leds_decay_tick);
void leds_update();
TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick);
void display_update();
void prepare_and_update();
virtual void machine_start();
@ -58,7 +58,7 @@ public:
/***************************************************************************
LEDs
LED Display
***************************************************************************/
@ -66,9 +66,9 @@ public:
// To prevent flickering here, we need to simulate a decay.
// decay time, in steps of 10ms
#define LEDS_DECAY_TIME 4
#define DISPLAY_DECAY_TIME 4
void starwbc_state::leds_update()
void starwbc_state::display_update()
{
UINT16 active_state[0x10];
@ -80,19 +80,19 @@ void starwbc_state::leds_update()
{
int di = j << 4 | i;
// turn on powered leds
if (m_leds_state[i] >> j & 1)
m_leds_decay[di] = LEDS_DECAY_TIME;
// turn on powered segments
if (m_display_state[i] >> j & 1)
m_display_decay[di] = DISPLAY_DECAY_TIME;
// determine active state
int ds = (m_leds_decay[di] != 0) ? 1 : 0;
int ds = (m_display_decay[di] != 0) ? 1 : 0;
active_state[i] |= (ds << j);
}
}
// on difference, send to output
for (int i = 0; i < 0x10; i++)
if (m_leds_cache[i] != active_state[i])
if (m_display_cache[i] != active_state[i])
{
output_set_digit_value(i, active_state[i]);
@ -100,17 +100,17 @@ void starwbc_state::leds_update()
output_set_lamp_value(i*10 + j, active_state[i] >> j & 1);
}
memcpy(m_leds_cache, active_state, sizeof(m_leds_cache));
memcpy(m_display_cache, active_state, sizeof(m_display_cache));
}
TIMER_DEVICE_CALLBACK_MEMBER(starwbc_state::leds_decay_tick)
TIMER_DEVICE_CALLBACK_MEMBER(starwbc_state::display_decay_tick)
{
// slowly turn off unpowered leds
// slowly turn off unpowered segments
for (int i = 0; i < 0x100; i++)
if (!(m_leds_state[i & 0xf] >> (i>>4) & 1) && m_leds_decay[i])
m_leds_decay[i]--;
if (!(m_display_state[i & 0xf] >> (i>>4) & 1) && m_display_decay[i])
m_display_decay[i]--;
leds_update();
display_update();
}
void starwbc_state::prepare_and_update()
@ -120,9 +120,9 @@ void starwbc_state::prepare_and_update()
// R0,R2,R4,R6,R8
for (int i = 0; i < 5; i++)
m_leds_state[i*2] = (m_r >> (i*2) & 1) ? (o & mask[i]) : 0;
m_display_state[i*2] = (m_r >> (i*2) & 1) ? (o & mask[i]) : 0;
leds_update();
display_update();
}
@ -227,17 +227,17 @@ INPUT_PORTS_END
void starwbc_state::machine_start()
{
// zerofill
memset(m_leds_state, 0, sizeof(m_leds_state));
memset(m_leds_cache, 0, sizeof(m_leds_cache));
memset(m_leds_decay, 0, sizeof(m_leds_decay));
memset(m_display_state, 0, sizeof(m_display_state));
memset(m_display_cache, 0, sizeof(m_display_cache));
memset(m_display_decay, 0, sizeof(m_display_decay));
m_r = 0;
m_o = 0;
// register for savestates
save_item(NAME(m_leds_state));
save_item(NAME(m_leds_cache));
save_item(NAME(m_leds_decay));
save_item(NAME(m_display_state));
save_item(NAME(m_display_cache));
save_item(NAME(m_display_decay));
save_item(NAME(m_r));
save_item(NAME(m_o));
@ -252,7 +252,7 @@ static MACHINE_CONFIG_START( starwbc, starwbc_state )
MCFG_TMS1XXX_WRITE_O_CB(WRITE16(starwbc_state, write_o))
MCFG_TMS1XXX_WRITE_R_CB(WRITE16(starwbc_state, write_r))
MCFG_TIMER_DRIVER_ADD_PERIODIC("leds_decay", starwbc_state, leds_decay_tick, attotime::from_msec(10))
MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", starwbc_state, display_decay_tick, attotime::from_msec(10))
MCFG_DEFAULT_LAYOUT(layout_starwbc)

View File

@ -43,9 +43,9 @@ public:
UINT16 m_o;
bool m_power_on;
UINT16 m_leds_state[0x10];
UINT16 m_leds_cache[0x10];
UINT8 m_leds_decay[0x100];
UINT16 m_display_state[0x10];
UINT16 m_display_cache[0x10];
UINT8 m_display_decay[0x100];
DECLARE_READ8_MEMBER(read_k);
DECLARE_WRITE16_MEMBER(write_o);
@ -54,8 +54,8 @@ public:
DECLARE_INPUT_CHANGED_MEMBER(power_button);
DECLARE_WRITE_LINE_MEMBER(auto_power_off);
TIMER_DEVICE_CALLBACK_MEMBER(leds_decay_tick);
void leds_update();
TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick);
void display_update();
virtual void machine_reset();
virtual void machine_start();
@ -65,7 +65,7 @@ public:
/***************************************************************************
LEDs
LED Display
***************************************************************************/
@ -73,9 +73,9 @@ public:
// To prevent flickering here, we need to simulate a decay.
// decay time, in steps of 10ms
#define LEDS_DECAY_TIME 4
#define DISPLAY_DECAY_TIME 4
void stopthief_state::leds_update()
void stopthief_state::display_update()
{
UINT16 active_state[0x10];
@ -87,32 +87,32 @@ void stopthief_state::leds_update()
{
int di = j << 4 | i;
// turn on powered leds
if (m_power_on && m_leds_state[i] >> j & 1)
m_leds_decay[di] = LEDS_DECAY_TIME;
// turn on powered segments
if (m_power_on && m_display_state[i] >> j & 1)
m_display_decay[di] = DISPLAY_DECAY_TIME;
// determine active state
int ds = (m_leds_decay[di] != 0) ? 1 : 0;
int ds = (m_display_decay[di] != 0) ? 1 : 0;
active_state[i] |= (ds << j);
}
}
// on difference, send to output
for (int i = 0; i < 0x10; i++)
if (m_leds_cache[i] != active_state[i])
if (m_display_cache[i] != active_state[i])
output_set_digit_value(i, active_state[i]);
memcpy(m_leds_cache, active_state, sizeof(m_leds_cache));
memcpy(m_display_cache, active_state, sizeof(m_display_cache));
}
TIMER_DEVICE_CALLBACK_MEMBER(stopthief_state::leds_decay_tick)
TIMER_DEVICE_CALLBACK_MEMBER(stopthief_state::display_decay_tick)
{
// slowly turn off unpowered leds
// slowly turn off unpowered segments
for (int i = 0; i < 0x100; i++)
if (!(m_leds_state[i & 0xf] >> (i>>4) & 1) && m_leds_decay[i])
m_leds_decay[i]--;
if (!(m_display_state[i & 0xf] >> (i>>4) & 1) && m_display_decay[i])
m_display_decay[i]--;
leds_update();
display_update();
}
@ -144,9 +144,9 @@ WRITE16_MEMBER(stopthief_state::write_r)
// R0-R2: select digit
UINT8 o = BITSWAP8(m_o,3,5,2,1,4,0,6,7) & 0x7f;
for (int i = 0; i < 3; i++)
m_leds_state[i] = (data >> i & 1) ? o : 0;
m_display_state[i] = (data >> i & 1) ? o : 0;
leds_update();
display_update();
// R3-R8: speaker on
m_speaker->level_w((data & 0x1f8 && m_o & 8) ? 1 : 0);
@ -234,17 +234,17 @@ void stopthief_state::machine_reset()
void stopthief_state::machine_start()
{
// zerofill
memset(m_leds_state, 0, sizeof(m_leds_state));
memset(m_leds_cache, 0, sizeof(m_leds_cache));
memset(m_leds_decay, 0, sizeof(m_leds_decay));
memset(m_display_state, 0, sizeof(m_display_state));
memset(m_display_cache, 0, sizeof(m_display_cache));
memset(m_display_decay, 0, sizeof(m_display_decay));
m_o = 0;
m_power_on = false;
// register for savestates
save_item(NAME(m_leds_state));
save_item(NAME(m_leds_cache));
save_item(NAME(m_leds_decay));
save_item(NAME(m_display_state));
save_item(NAME(m_display_cache));
save_item(NAME(m_display_decay));
save_item(NAME(m_o));
save_item(NAME(m_power_on));
@ -260,7 +260,7 @@ static MACHINE_CONFIG_START( stopthief, stopthief_state )
MCFG_TMS1XXX_WRITE_R_CB(WRITE16(stopthief_state, write_r))
MCFG_TMS1XXX_POWER_OFF_CB(WRITELINE(stopthief_state, auto_power_off))
MCFG_TIMER_DRIVER_ADD_PERIODIC("leds_decay", stopthief_state, leds_decay_tick, attotime::from_msec(10))
MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", stopthief_state, display_decay_tick, attotime::from_msec(10))
MCFG_DEFAULT_LAYOUT(layout_stopthie)

View File

@ -37,14 +37,14 @@ public:
UINT16 m_o;
bool m_power_on;
UINT16 m_leds_state[0x10];
UINT16 m_leds_cache[0x10];
UINT8 m_leds_decay[0x100];
UINT16 m_display_state[0x10];
UINT16 m_display_cache[0x10];
UINT8 m_display_decay[0x100];
DECLARE_READ8_MEMBER(tisr16_read_k);
DECLARE_WRITE16_MEMBER(tisr16_write_o);
DECLARE_WRITE16_MEMBER(tisr16_write_r);
void tisr16_leds_update();
void tisr16_display_update();
DECLARE_READ8_MEMBER(ti1270_read_k);
DECLARE_WRITE16_MEMBER(ti1270_write_o);
@ -61,8 +61,8 @@ public:
DECLARE_INPUT_CHANGED_MEMBER(power_button);
DECLARE_WRITE_LINE_MEMBER(auto_power_off);
TIMER_DEVICE_CALLBACK_MEMBER(leds_decay_tick);
void leds_update();
TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick);
void display_update();
virtual void machine_reset();
virtual void machine_start();
@ -72,7 +72,7 @@ public:
/***************************************************************************
LEDs
LED Display
***************************************************************************/
@ -80,9 +80,9 @@ public:
// To prevent flickering here, we need to simulate a decay.
// decay time, in steps of 10ms
#define LEDS_DECAY_TIME 5
#define DISPLAY_DECAY_TIME 5
void ticalc1x_state::leds_update()
void ticalc1x_state::display_update()
{
UINT16 active_state[0x10];
@ -94,19 +94,19 @@ void ticalc1x_state::leds_update()
{
int di = j << 4 | i;
// turn on powered leds
if (m_power_on && m_leds_state[i] >> j & 1)
m_leds_decay[di] = LEDS_DECAY_TIME;
// turn on powered segments
if (m_power_on && m_display_state[i] >> j & 1)
m_display_decay[di] = DISPLAY_DECAY_TIME;
// determine active state
int ds = (m_leds_decay[di] != 0) ? 1 : 0;
int ds = (m_display_decay[di] != 0) ? 1 : 0;
active_state[i] |= (ds << j);
}
}
// on difference, send to output
for (int i = 0; i < 0x10; i++)
if (m_leds_cache[i] != active_state[i])
if (m_display_cache[i] != active_state[i])
{
output_set_digit_value(i, active_state[i]);
@ -114,17 +114,17 @@ void ticalc1x_state::leds_update()
output_set_lamp_value(i*10 + j, active_state[i] >> j & 1);
}
memcpy(m_leds_cache, active_state, sizeof(m_leds_cache));
memcpy(m_display_cache, active_state, sizeof(m_display_cache));
}
TIMER_DEVICE_CALLBACK_MEMBER(ticalc1x_state::leds_decay_tick)
TIMER_DEVICE_CALLBACK_MEMBER(ticalc1x_state::display_decay_tick)
{
// slowly turn off unpowered leds
// slowly turn off unpowered segments
for (int i = 0; i < 0x100; i++)
if (!(m_leds_state[i & 0xf] >> (i>>4) & 1) && m_leds_decay[i])
m_leds_decay[i]--;
if (!(m_display_state[i & 0xf] >> (i>>4) & 1) && m_display_decay[i])
m_display_decay[i]--;
leds_update();
display_update();
}
@ -137,19 +137,19 @@ TIMER_DEVICE_CALLBACK_MEMBER(ticalc1x_state::leds_decay_tick)
// SR-16: TMS1000 MCU labeled TMS1001NL. die labeled 1001A
void ticalc1x_state::tisr16_leds_update()
void ticalc1x_state::tisr16_display_update()
{
// update leds state
for (int i = 0; i < 11; i++)
if (m_r >> i & 1)
m_leds_state[i] = m_o;
m_display_state[i] = m_o;
// exponent sign (not 100% sure this is correct)
m_leds_state[11] = (m_leds_state[0] | m_leds_state[1]) ? 0x40 : 0;
m_display_state[11] = (m_display_state[0] | m_display_state[1]) ? 0x40 : 0;
// send to output
for (int i = 0; i < 12; i++)
output_set_digit_value(i, m_leds_state[i]);
output_set_digit_value(i, m_display_state[i]);
}
READ8_MEMBER(ticalc1x_state::tisr16_read_k)
@ -170,7 +170,7 @@ WRITE16_MEMBER(ticalc1x_state::tisr16_write_r)
// R0-R10: select digit (right-to-left)
m_r = data;
tisr16_leds_update();
tisr16_display_update();
}
WRITE16_MEMBER(ticalc1x_state::tisr16_write_o)
@ -178,7 +178,7 @@ WRITE16_MEMBER(ticalc1x_state::tisr16_write_o)
// O0-O7: digit segments
m_o = data;
tisr16_leds_update();
tisr16_display_update();
}
@ -200,9 +200,9 @@ WRITE16_MEMBER(ticalc1x_state::ti1270_write_r)
{
// R0-R7: select digit (right-to-left)
for (int i = 0; i < 8; i++)
m_leds_state[i] = (data >> i & 1) ? m_o : 0;
m_display_state[i] = (data >> i & 1) ? m_o : 0;
leds_update();
display_update();
}
WRITE16_MEMBER(ticalc1x_state::ti1270_write_o)
@ -232,12 +232,12 @@ WRITE16_MEMBER(ticalc1x_state::wizatron_write_r)
// R0-R8: select digit (right-to-left)
// note: 3rd digit is custom(not 7seg), for math symbols
for (int i = 0; i < 9; i++)
m_leds_state[i] = (data >> i & 1) ? m_o : 0;
m_display_state[i] = (data >> i & 1) ? m_o : 0;
// 6th digit only has A and G for =
m_leds_state[3] &= 0x41;
m_display_state[3] &= 0x41;
leds_update();
display_update();
}
WRITE16_MEMBER(ticalc1x_state::wizatron_write_o)
@ -271,12 +271,12 @@ WRITE16_MEMBER(ticalc1x_state::ti30_write_r)
// R0-R8: select digit
UINT8 o = BITSWAP8(m_o,7,5,2,1,4,0,6,3);
for (int i = 0; i < 9; i++)
m_leds_state[i] = (data >> i & 1) ? o : 0;
m_display_state[i] = (data >> i & 1) ? o : 0;
// 1st digit only has segments B,F,G,DP
m_leds_state[0] &= 0xe2;
m_display_state[0] &= 0xe2;
leds_update();
display_update();
}
WRITE16_MEMBER(ticalc1x_state::ti30_write_o)
@ -654,18 +654,18 @@ void ticalc1x_state::machine_reset()
void ticalc1x_state::machine_start()
{
// zerofill
memset(m_leds_state, 0, sizeof(m_leds_state));
memset(m_leds_cache, 0, sizeof(m_leds_cache));
memset(m_leds_decay, 0, sizeof(m_leds_decay));
memset(m_display_state, 0, sizeof(m_display_state));
memset(m_display_cache, 0, sizeof(m_display_cache));
memset(m_display_decay, 0, sizeof(m_display_decay));
m_r = 0;
m_o = 0;
m_power_on = false;
// register for savestates
save_item(NAME(m_leds_state));
save_item(NAME(m_leds_cache));
save_item(NAME(m_leds_decay));
save_item(NAME(m_display_state));
save_item(NAME(m_display_cache));
save_item(NAME(m_display_decay));
save_item(NAME(m_r));
save_item(NAME(m_o));
@ -688,7 +688,7 @@ MACHINE_CONFIG_END
static MACHINE_CONFIG_START( t9base, ticalc1x_state )
/* basic machine hardware */
MCFG_TIMER_DRIVER_ADD_PERIODIC("leds_decay", ticalc1x_state, leds_decay_tick, attotime::from_msec(10))
MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", ticalc1x_state, display_decay_tick, attotime::from_msec(10))
/* no video! */

View File

@ -54,11 +54,11 @@ public:
UINT16 m_o;
int m_power_on;
UINT16 m_leds_state[0x10];
UINT16 m_leds_cache[0x10];
UINT8 m_leds_decay[0x100];
void leds_update();
TIMER_DEVICE_CALLBACK_MEMBER(leds_decay_tick);
UINT16 m_display_state[0x10];
UINT16 m_display_cache[0x10];
UINT8 m_display_decay[0x100];
void display_update();
TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick);
UINT32 m_cart_max_size;
UINT8* m_cart_base;
@ -128,9 +128,9 @@ DRIVER_INIT_MEMBER(tispeak_state, lantutor)
// To prevent flickering here, we need to simulate a decay.
// decay time, in steps of 10ms
#define LEDS_DECAY_TIME 4
#define DISPLAY_DECAY_TIME 4
void tispeak_state::leds_update()
void tispeak_state::display_update()
{
int filament_on = (m_r & 0x8000) ? 1 : 0;
UINT16 active_state[0x10];
@ -138,7 +138,7 @@ void tispeak_state::leds_update()
for (int i = 0; i < 0x10; i++)
{
// update current state
m_leds_state[i] = (m_r >> i & 1) ? m_o : 0;
m_display_state[i] = (m_r >> i & 1) ? m_o : 0;
active_state[i] = 0;
@ -146,19 +146,19 @@ void tispeak_state::leds_update()
{
int di = j << 4 | i;
// turn on powered leds
if (m_power_on && filament_on && m_leds_state[i] >> j & 1)
m_leds_decay[di] = LEDS_DECAY_TIME;
// turn on powered segments
if (m_power_on && filament_on && m_display_state[i] >> j & 1)
m_display_decay[di] = DISPLAY_DECAY_TIME;
// determine active state
int ds = (m_leds_decay[di] != 0) ? 1 : 0;
int ds = (m_display_decay[di] != 0) ? 1 : 0;
active_state[i] |= (ds << j);
}
}
// on difference, send to output
for (int i = 0; i < 0x10; i++)
if (m_leds_cache[i] != active_state[i])
if (m_display_cache[i] != active_state[i])
{
output_set_digit_value(i, active_state[i] & 0x3fff);
@ -166,17 +166,17 @@ void tispeak_state::leds_update()
output_set_lamp_value(i*0x10 + j, active_state[i] >> j & 1);
}
memcpy(m_leds_cache, active_state, sizeof(m_leds_cache));
memcpy(m_display_cache, active_state, sizeof(m_display_cache));
}
TIMER_DEVICE_CALLBACK_MEMBER(tispeak_state::leds_decay_tick)
TIMER_DEVICE_CALLBACK_MEMBER(tispeak_state::display_decay_tick)
{
// slowly turn off unpowered leds
// slowly turn off unpowered segments
for (int i = 0; i < 0x100; i++)
if (!(m_leds_state[i & 0xf] >> (i>>4) & 1) && m_leds_decay[i])
m_leds_decay[i]--;
if (!(m_display_state[i & 0xf] >> (i>>4) & 1) && m_display_decay[i])
m_display_decay[i]--;
leds_update();
display_update();
}
@ -212,7 +212,7 @@ WRITE16_MEMBER(tispeak_state::snspell_write_r)
// other bits: MCU internal use
m_r = data;
leds_update();
display_update();
}
WRITE16_MEMBER(tispeak_state::snspell_write_o)
@ -221,7 +221,7 @@ WRITE16_MEMBER(tispeak_state::snspell_write_o)
// E,D,C,G,B,A,I,M,L,K,N,J,[AP],H,F,[DP] (sidenote: TI KLMN = MAME MLNK)
m_o = BITSWAP16(data,12,15,10,7,8,9,11,6,13,3,14,0,1,2,4,5);
leds_update();
display_update();
}
@ -243,7 +243,7 @@ WRITE16_MEMBER(tispeak_state::snmath_write_o)
// [DP],D,C,H,F,B,I,M,L,K,N,J,[AP],E,G,A (sidenote: TI KLMN = MAME MLNK)
m_o = BITSWAP16(data,12,0,10,7,8,9,11,6,3,14,4,13,1,2,5,15);
leds_update();
display_update();
}
@ -253,7 +253,7 @@ WRITE16_MEMBER(tispeak_state::lantutor_write_r)
{
// same as default, except R13 is used for an extra digit
m_r = data;
leds_update();
display_update();
}
@ -442,18 +442,18 @@ void tispeak_state::machine_reset()
void tispeak_state::machine_start()
{
// zerofill
memset(m_leds_state, 0, sizeof(m_leds_state));
memset(m_leds_cache, 0, sizeof(m_leds_cache));
memset(m_leds_decay, 0, sizeof(m_leds_decay));
memset(m_display_state, 0, sizeof(m_display_state));
memset(m_display_cache, 0, sizeof(m_display_cache));
memset(m_display_decay, 0, sizeof(m_display_decay));
m_r = 0;
m_o = 0;
m_power_on = 0;
// register for savestates
save_item(NAME(m_leds_state));
save_item(NAME(m_leds_cache));
save_item(NAME(m_leds_decay));
save_item(NAME(m_display_state));
save_item(NAME(m_display_cache));
save_item(NAME(m_display_decay));
save_item(NAME(m_r));
save_item(NAME(m_o));
@ -482,7 +482,7 @@ static MACHINE_CONFIG_START( snmath, tispeak_state )
MCFG_TMS0270_WRITE_CTL_CB(DEVWRITE8("tms5100", tms5100_device, ctl_w))
MCFG_TMS0270_WRITE_PDC_CB(DEVWRITELINE("tms5100", tms5100_device, pdc_w))
MCFG_TIMER_DRIVER_ADD_PERIODIC("leds_decay", tispeak_state, leds_decay_tick, attotime::from_msec(10))
MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", tispeak_state, display_decay_tick, attotime::from_msec(10))
MCFG_DEFAULT_LAYOUT(layout_snspell) // max 9 digits
/* no video! */

View File

@ -46,16 +46,16 @@ public:
UINT8 m_d;
UINT16 m_a;
UINT16 m_leds_state[0x10];
UINT16 m_leds_cache[0x10];
UINT8 m_leds_decay[0x100];
UINT16 m_display_state[0x10];
UINT16 m_display_cache[0x10];
UINT8 m_display_decay[0x100];
DECLARE_READ8_MEMBER(read_k);
DECLARE_WRITE8_MEMBER(write_d);
DECLARE_WRITE16_MEMBER(write_a);
TIMER_DEVICE_CALLBACK_MEMBER(leds_decay_tick);
void leds_update();
TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick);
void display_update();
bool index_is_7segled(int index);
virtual void machine_start();
@ -65,7 +65,7 @@ public:
/***************************************************************************
LEDs
LED Display
***************************************************************************/
@ -73,7 +73,7 @@ public:
// To prevent flickering here, we need to simulate a decay.
// decay time, in steps of 10ms
#define LEDS_DECAY_TIME 4
#define DISPLAY_DECAY_TIME 4
inline bool wildfire_state::index_is_7segled(int index)
{
@ -81,14 +81,14 @@ inline bool wildfire_state::index_is_7segled(int index)
return (index < 3);
}
void wildfire_state::leds_update()
void wildfire_state::display_update()
{
UINT16 active_state[0x10];
for (int i = 0; i < 0x10; i++)
{
// update current state
m_leds_state[i] = (~m_a >> i & 1) ? m_d : 0;
m_display_state[i] = (~m_a >> i & 1) ? m_d : 0;
active_state[i] = 0;
@ -96,19 +96,19 @@ void wildfire_state::leds_update()
{
int di = j << 4 | i;
// turn on powered leds
if (m_leds_state[i] >> j & 1)
m_leds_decay[di] = LEDS_DECAY_TIME;
// turn on powered segments
if (m_display_state[i] >> j & 1)
m_display_decay[di] = DISPLAY_DECAY_TIME;
// determine active state
int ds = (m_leds_decay[di] != 0) ? 1 : 0;
int ds = (m_display_decay[di] != 0) ? 1 : 0;
active_state[i] |= (ds << j);
}
}
// on difference, send to output
for (int i = 0; i < 0x10; i++)
if (m_leds_cache[i] != active_state[i])
if (m_display_cache[i] != active_state[i])
{
if (index_is_7segled(i))
output_set_digit_value(i, BITSWAP8(active_state[i],7,0,1,2,3,4,5,6) & 0x7f);
@ -117,17 +117,17 @@ void wildfire_state::leds_update()
output_set_lamp_value(i*10 + j, active_state[i] >> j & 1);
}
memcpy(m_leds_cache, active_state, sizeof(m_leds_cache));
memcpy(m_display_cache, active_state, sizeof(m_display_cache));
}
TIMER_DEVICE_CALLBACK_MEMBER(wildfire_state::leds_decay_tick)
TIMER_DEVICE_CALLBACK_MEMBER(wildfire_state::display_decay_tick)
{
// slowly turn off unpowered leds
// slowly turn off unpowered segments
for (int i = 0; i < 0x100; i++)
if (!(m_leds_state[i & 0xf] >> (i>>4) & 1) && m_leds_decay[i])
m_leds_decay[i]--;
if (!(m_display_state[i & 0xf] >> (i>>4) & 1) && m_display_decay[i])
m_display_decay[i]--;
leds_update();
display_update();
}
@ -147,13 +147,13 @@ READ8_MEMBER(wildfire_state::read_k)
WRITE8_MEMBER(wildfire_state::write_d)
{
m_d = data;
leds_update();
display_update();
}
WRITE16_MEMBER(wildfire_state::write_a)
{
m_a = data;
leds_update();
display_update();
}
@ -183,17 +183,17 @@ INPUT_PORTS_END
void wildfire_state::machine_start()
{
// zerofill
memset(m_leds_state, 0, sizeof(m_leds_state));
memset(m_leds_cache, 0, sizeof(m_leds_cache));
memset(m_leds_decay, 0, sizeof(m_leds_decay));
memset(m_display_state, 0, sizeof(m_display_state));
memset(m_display_cache, 0, sizeof(m_display_cache));
memset(m_display_decay, 0, sizeof(m_display_decay));
m_d = 0;
m_a = 0;
// register for savestates
save_item(NAME(m_leds_state));
save_item(NAME(m_leds_cache));
save_item(NAME(m_leds_decay));
save_item(NAME(m_display_state));
save_item(NAME(m_display_cache));
save_item(NAME(m_display_decay));
save_item(NAME(m_d));
save_item(NAME(m_a));
@ -209,7 +209,7 @@ static MACHINE_CONFIG_START( wildfire, wildfire_state )
MCFG_AMI_S2000_WRITE_D_CB(WRITE8(wildfire_state, write_d))
MCFG_AMI_S2000_WRITE_A_CB(WRITE16(wildfire_state, write_a))
MCFG_TIMER_DRIVER_ADD_PERIODIC("leds_decay", wildfire_state, leds_decay_tick, attotime::from_msec(10))
MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", wildfire_state, display_decay_tick, attotime::from_msec(10))
MCFG_DEFAULT_LAYOUT(layout_wildfire)