Previous 199869 Revisions Next

r34358 Monday 12th January, 2015 at 18:50:01 UTC by hap
copypasted my generic led-anti-flicker routine, tispeak needs it when it combines digit symbols eg. number+dot.

Also added lamp outputs per digit segments, this makes it possible to have custom external artwork with accurate TI digit shapes.
[src/mess/drivers]tispeak.c
[src/mess/layout]lantutor.lay tispeak.lay

trunk/src/mess/drivers/tispeak.c
r242869r242870
4141      m_tms5100(*this, "tms5100"),
4242      m_tms6100(*this, "tms6100"),
4343      m_cart(*this, "cartslot"),
44      m_filoff_timer(*this, "filoff"),
4544      m_button_matrix(*this, "IN")
4645   { }
4746
r242869r242870
4948   required_device<tms5100_device> m_tms5100;
5049   required_device<tms6100_device> m_tms6100;
5150   optional_device<generic_slot_device> m_cart;
52   required_device<timer_device> m_filoff_timer;
5351   required_ioport_array<9> m_button_matrix;
5452
5553   UINT16 m_r;
5654   UINT16 m_o;
57   int m_filament_on;
5855   int m_power_on;
5956
60   UINT16 m_digit_state[0x10];
61   void display_update();
62   TIMER_DEVICE_CALLBACK_MEMBER(delayed_filament_off);
57   UINT16 m_leds_state[0x10];
58   UINT16 m_leds_cache[0x10];
59   UINT8 m_leds_decay[0x100];
60   void leds_update();
61   TIMER_DEVICE_CALLBACK_MEMBER(leds_decay_tick);
6362
6463   UINT32 m_cart_max_size;
6564   UINT8* m_cart_base;
r242869r242870
128127// The device strobes the filament-enable very fast, it is unnoticeable to the user.
129128// To prevent flickering here, we need to simulate a decay.
130129
131// decay time in milliseconds
132#define FILOFF_DECAY_TIME 20
130// decay time, in steps of 10ms
131#define LEDS_DECAY_TIME 4
133132
134TIMER_DEVICE_CALLBACK_MEMBER(tispeak_state::delayed_filament_off)
133void tispeak_state::leds_update()
135134{
136   // turn off display
137   m_filament_on = 0;
138   display_update();
139}
135   int filament_on = (m_r & 0x8000) ? 1 : 0;
136   UINT16 active_state[0x10];
140137
141void tispeak_state::display_update()
142{
143   // filament on/off
144   if (m_r & 0x8000)
138   for (int i = 0; i < 0x10; i++)
145139   {
146      m_filament_on = 1;
147      m_filoff_timer->reset();
140      // update current state
141      if (m_r >> i & 1)
142         m_leds_state[i] = m_o;
143
144      active_state[i] = 0;
145
146      for (int j = 0; j < 0x10; j++)
147      {
148         int di = j << 4 | i;
149
150         // turn on powered leds
151         if (m_power_on && filament_on && m_leds_state[i] >> j & 1)
152            m_leds_decay[di] = LEDS_DECAY_TIME;
153
154         // determine active state
155         int ds = (m_leds_decay[di] != 0) ? 1 : 0;
156         active_state[i] |= (ds << j);
157      }
148158   }
149   else if (m_filament_on && m_filoff_timer->time_left() == attotime::never)
150   {
151      // schedule delayed filament-off
152      m_filoff_timer->adjust(attotime::from_msec(FILOFF_DECAY_TIME));
153   }
154159
155   // update digit state
160   // on difference, send to output
156161   for (int i = 0; i < 0x10; i++)
157      if (m_r >> i & 1)
158         m_digit_state[i] = m_o;
162      if (m_leds_cache[i] != active_state[i])
163      {
164         output_set_digit_value(i, active_state[i] & 0x3fff);
159165
160   // send to output
161   for (int i = 0; i < 0x10; i++)
162   {
163      // standard led14seg
164      output_set_digit_value(i, m_filament_on ? m_digit_state[i] & 0x3fff : 0);
166         for (int j = 0; j < 0x10; j++)
167            output_set_lamp_value(i*0x10 + j, active_state[i] >> j & 1);
168      }
165169
166      // DP(display point) and AP(apostrophe) segments as lamps
167      output_set_lamp_value(i*10 + 0, m_digit_state[i] >> 14 & m_filament_on);
168      output_set_lamp_value(i*10 + 1, m_digit_state[i] >> 15 & m_filament_on);
169   }
170   memcpy(m_leds_cache, active_state, sizeof(m_leds_cache));
170171}
171172
173TIMER_DEVICE_CALLBACK_MEMBER(tispeak_state::leds_decay_tick)
174{
175   // slowly turn off unpowered leds
176   for (int i = 0; i < 0x100; i++)
177      if (!(m_leds_state[i & 0xf] >> (i>>4) & 1) && m_leds_decay[i])
178         m_leds_decay[i]--;
172179
180   leds_update();
181}
173182
183
184
174185/***************************************************************************
175186
176187  I/O
r242869r242870
195206WRITE16_MEMBER(tispeak_state::snspell_write_r)
196207{
197208   // R0-R7: input mux and select digit (+R8 if the device has 9 digits)
198   // R15: filament on (handled in display_update)
209   // R15: filament on (handled in leds_update)
199210   // R13: power-off request, on falling edge
200211   if ((m_r >> 13 & 1) && !(data >> 13 & 1))
201212      power_off();
202213
203214   // other bits: MCU internal use
204215   m_r = data;
205   display_update();
216   leds_update();
206217}
207218
208219WRITE16_MEMBER(tispeak_state::snspell_write_o)
r242869r242870
211222   // E,D,C,G,B,A,I,M,L,K,N,J,[AP],H,F,[DP] (sidenote: TI KLMN = MAME MLNK)
212223   m_o = BITSWAP16(data,12,15,10,7,8,9,11,6,13,3,14,0,1,2,4,5);
213224
214   display_update();
225   leds_update();
215226}
216227
217228
r242869r242870
233244   // [DP],D,C,H,F,B,I,M,L,K,N,J,[AP],E,G,A (sidenote: TI KLMN = MAME MLNK)
234245   m_o = BITSWAP16(data,12,0,10,7,8,9,11,6,3,14,4,13,1,2,5,15);
235246
236   display_update();
247   leds_update();
237248}
238249
239250
r242869r242870
243254{
244255   // same as default, except R13 is used for an extra digit
245256   m_r = data;
246   display_update();
257   leds_update();
247258}
248259
249260
r242869r242870
426437
427438void tispeak_state::machine_reset()
428439{
429   m_filament_on = 0;
430440   m_power_on = 1;
431441}
432442
433443void tispeak_state::machine_start()
434444{
435445   // zerofill
436   memset(m_digit_state, 0, sizeof(m_digit_state));
446   memset(m_leds_state, 0, sizeof(m_leds_state));
447   memset(m_leds_cache, 0, sizeof(m_leds_cache));
448   memset(m_leds_decay, 0, sizeof(m_leds_decay));
449
437450   m_r = 0;
438451   m_o = 0;
439   m_filament_on = 0;
440452   m_power_on = 0;
441453
442454   // register for savestates
443   save_item(NAME(m_digit_state));
455   save_item(NAME(m_leds_state));
456   save_item(NAME(m_leds_cache));
457   save_item(NAME(m_leds_decay));
458
444459   save_item(NAME(m_r));
445460   save_item(NAME(m_o));
446   save_item(NAME(m_filament_on));
447461   save_item(NAME(m_power_on));
448462
449463   // init cartridge
r242869r242870
469483   MCFG_TMS0270_WRITE_CTL_CB(DEVWRITE8("tms5100", tms5100_device, ctl_w))
470484   MCFG_TMS0270_WRITE_PDC_CB(DEVWRITELINE("tms5100", tms5100_device, pdc_w))
471485
472   MCFG_TIMER_DRIVER_ADD("filoff", tispeak_state, delayed_filament_off)
486   MCFG_TIMER_DRIVER_ADD_PERIODIC("leds_decay", tispeak_state, leds_decay_tick, attotime::from_msec(10))
473487   MCFG_DEFAULT_LAYOUT(layout_tispeak) // max 9 digits
474488
475489   /* no video! */
trunk/src/mess/layout/lantutor.lay
r242869r242870
3131      <bezel name="digit8" element="digit"><bounds x="88" y="4" width="10" height="15" /></bezel>
3232      <bezel name="digit13" element="digit"><bounds x="99" y="4" width="10" height="15" /></bezel>
3333
34      <bezel name="lamp0" element="triangle_mark"><bounds x="4" y="0" width="4" height="3" /></bezel>
35      <bezel name="lamp10" element="triangle_mark"><bounds x="15" y="0" width="4" height="3" /></bezel>
36      <bezel name="lamp20" element="triangle_mark"><bounds x="26" y="0" width="4" height="3" /></bezel>
37      <bezel name="lamp30" element="triangle_mark"><bounds x="37" y="0" width="4" height="3" /></bezel>
38      <bezel name="lamp40" element="triangle_mark"><bounds x="48" y="0" width="4" height="3" /></bezel>
39      <bezel name="lamp50" element="triangle_mark"><bounds x="59" y="0" width="4" height="3" /></bezel>
40      <bezel name="lamp60" element="triangle_mark"><bounds x="70" y="0" width="4" height="3" /></bezel>
41      <bezel name="lamp70" element="triangle_mark"><bounds x="81" y="0" width="4" height="3" /></bezel>
42      <bezel name="lamp80" element="triangle_mark"><bounds x="92" y="0" width="4" height="3" /></bezel>
43      <bezel name="lamp130" element="triangle_mark"><bounds x="103" y="0" width="4" height="3" /></bezel>
34      <bezel name="lamp14" element="triangle_mark"><bounds x="4" y="0" width="4" height="3" /></bezel>
35      <bezel name="lamp30" element="triangle_mark"><bounds x="15" y="0" width="4" height="3" /></bezel>
36      <bezel name="lamp46" element="triangle_mark"><bounds x="26" y="0" width="4" height="3" /></bezel>
37      <bezel name="lamp62" element="triangle_mark"><bounds x="37" y="0" width="4" height="3" /></bezel>
38      <bezel name="lamp78" element="triangle_mark"><bounds x="48" y="0" width="4" height="3" /></bezel>
39      <bezel name="lamp94" element="triangle_mark"><bounds x="59" y="0" width="4" height="3" /></bezel>
40      <bezel name="lamp110" element="triangle_mark"><bounds x="70" y="0" width="4" height="3" /></bezel>
41      <bezel name="lamp126" element="triangle_mark"><bounds x="81" y="0" width="4" height="3" /></bezel>
42      <bezel name="lamp142" element="triangle_mark"><bounds x="92" y="0" width="4" height="3" /></bezel>
43      <bezel name="lamp222" element="triangle_mark"><bounds x="103" y="0" width="4" height="3" /></bezel>
4444
4545   </view>
4646</mamelayout>
trunk/src/mess/layout/tispeak.lay
r242869r242870
3030   <!-- 9 digits (snspell has 8, snmath has 9) -->
3131
3232      <bezel name="digit0" element="digit"><bounds x="0" y="0" width="10" height="15" /></bezel>
33      <bezel name="lamp0" element="lamp_dp"><bounds x="9" y="13.5" width="1.5" height="1.5" /></bezel>
34      <bezel name="lamp1" element="lamp_ap"><bounds x="10.5" y="0" width="0.5" height="3.5" /></bezel>
33      <bezel name="lamp14" element="lamp_dp"><bounds x="9" y="13.5" width="1.5" height="1.5" /></bezel>
34      <bezel name="lamp15" element="lamp_ap"><bounds x="10.5" y="0" width="0.5" height="3.5" /></bezel>
3535
3636      <bezel name="digit1" element="digit"><bounds x="11" y="0" width="10" height="15" /></bezel>
37      <bezel name="lamp10" element="lamp_dp"><bounds x="20" y="13.5" width="1.5" height="1.5" /></bezel>
38      <bezel name="lamp11" element="lamp_ap"><bounds x="21.5" y="0" width="0.5" height="3.5" /></bezel>
37      <bezel name="lamp30" element="lamp_dp"><bounds x="20" y="13.5" width="1.5" height="1.5" /></bezel>
38      <bezel name="lamp31" element="lamp_ap"><bounds x="21.5" y="0" width="0.5" height="3.5" /></bezel>
3939
4040      <bezel name="digit2" element="digit"><bounds x="22" y="0" width="10" height="15" /></bezel>
41      <bezel name="lamp20" element="lamp_dp"><bounds x="31" y="13.5" width="1.5" height="1.5" /></bezel>
42      <bezel name="lamp21" element="lamp_ap"><bounds x="32.5" y="0" width="0.5" height="3.5" /></bezel>
41      <bezel name="lamp46" element="lamp_dp"><bounds x="31" y="13.5" width="1.5" height="1.5" /></bezel>
42      <bezel name="lamp47" element="lamp_ap"><bounds x="32.5" y="0" width="0.5" height="3.5" /></bezel>
4343
4444      <bezel name="digit3" element="digit"><bounds x="33" y="0" width="10" height="15" /></bezel>
45      <bezel name="lamp30" element="lamp_dp"><bounds x="42" y="13.5" width="1.5" height="1.5" /></bezel>
46      <bezel name="lamp31" element="lamp_ap"><bounds x="43.5" y="0" width="0.5" height="3.5" /></bezel>
45      <bezel name="lamp62" element="lamp_dp"><bounds x="42" y="13.5" width="1.5" height="1.5" /></bezel>
46      <bezel name="lamp63" element="lamp_ap"><bounds x="43.5" y="0" width="0.5" height="3.5" /></bezel>
4747
4848      <bezel name="digit4" element="digit"><bounds x="44" y="0" width="10" height="15" /></bezel>
49      <bezel name="lamp40" element="lamp_dp"><bounds x="53" y="13.5" width="1.5" height="1.5" /></bezel>
50      <bezel name="lamp41" element="lamp_ap"><bounds x="54.5" y="0" width="0.5" height="3.5" /></bezel>
49      <bezel name="lamp78" element="lamp_dp"><bounds x="53" y="13.5" width="1.5" height="1.5" /></bezel>
50      <bezel name="lamp79" element="lamp_ap"><bounds x="54.5" y="0" width="0.5" height="3.5" /></bezel>
5151
5252      <bezel name="digit5" element="digit"><bounds x="55" y="0" width="10" height="15" /></bezel>
53      <bezel name="lamp50" element="lamp_dp"><bounds x="64" y="13.5" width="1.5" height="1.5" /></bezel>
54      <bezel name="lamp51" element="lamp_ap"><bounds x="65.5" y="0" width="0.5" height="3.5" /></bezel>
53      <bezel name="lamp94" element="lamp_dp"><bounds x="64" y="13.5" width="1.5" height="1.5" /></bezel>
54      <bezel name="lamp95" element="lamp_ap"><bounds x="65.5" y="0" width="0.5" height="3.5" /></bezel>
5555
5656      <bezel name="digit6" element="digit"><bounds x="66" y="0" width="10" height="15" /></bezel>
57      <bezel name="lamp60" element="lamp_dp"><bounds x="75" y="13.5" width="1.5" height="1.5" /></bezel>
58      <bezel name="lamp61" element="lamp_ap"><bounds x="76.5" y="0" width="0.5" height="3.5" /></bezel>
57      <bezel name="lamp110" element="lamp_dp"><bounds x="75" y="13.5" width="1.5" height="1.5" /></bezel>
58      <bezel name="lamp111" element="lamp_ap"><bounds x="76.5" y="0" width="0.5" height="3.5" /></bezel>
5959
6060      <bezel name="digit7" element="digit"><bounds x="77" y="0" width="10" height="15" /></bezel>
61      <bezel name="lamp70" element="lamp_dp"><bounds x="86" y="13.5" width="1.5" height="1.5" /></bezel>
62      <bezel name="lamp71" element="lamp_ap"><bounds x="87.5" y="0" width="0.5" height="3.5" /></bezel>
61      <bezel name="lamp126" element="lamp_dp"><bounds x="86" y="13.5" width="1.5" height="1.5" /></bezel>
62      <bezel name="lamp127" element="lamp_ap"><bounds x="87.5" y="0" width="0.5" height="3.5" /></bezel>
6363
6464      <bezel name="digit8" element="digit"><bounds x="88" y="0" width="10" height="15" /></bezel>
65      <bezel name="lamp80" element="lamp_dp"><bounds x="97" y="13.5" width="1.5" height="1.5" /></bezel>
66      <bezel name="lamp81" element="lamp_ap"><bounds x="98.5" y="0" width="0.5" height="3.5" /></bezel>
65      <bezel name="lamp142" element="lamp_dp"><bounds x="97" y="13.5" width="1.5" height="1.5" /></bezel>
66      <bezel name="lamp143" element="lamp_ap"><bounds x="98.5" y="0" width="0.5" height="3.5" /></bezel>
6767
6868   </view>
6969</mamelayout>


Previous 199869 Revisions Next


© 1997-2024 The MAME Team