trunk/src/mess/drivers/tispeak.c
| r242869 | r242870 | |
| 41 | 41 | m_tms5100(*this, "tms5100"), |
| 42 | 42 | m_tms6100(*this, "tms6100"), |
| 43 | 43 | m_cart(*this, "cartslot"), |
| 44 | | m_filoff_timer(*this, "filoff"), |
| 45 | 44 | m_button_matrix(*this, "IN") |
| 46 | 45 | { } |
| 47 | 46 | |
| r242869 | r242870 | |
| 49 | 48 | required_device<tms5100_device> m_tms5100; |
| 50 | 49 | required_device<tms6100_device> m_tms6100; |
| 51 | 50 | optional_device<generic_slot_device> m_cart; |
| 52 | | required_device<timer_device> m_filoff_timer; |
| 53 | 51 | required_ioport_array<9> m_button_matrix; |
| 54 | 52 | |
| 55 | 53 | UINT16 m_r; |
| 56 | 54 | UINT16 m_o; |
| 57 | | int m_filament_on; |
| 58 | 55 | int m_power_on; |
| 59 | 56 | |
| 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); |
| 63 | 62 | |
| 64 | 63 | UINT32 m_cart_max_size; |
| 65 | 64 | UINT8* m_cart_base; |
| r242869 | r242870 | |
| 128 | 127 | // The device strobes the filament-enable very fast, it is unnoticeable to the user. |
| 129 | 128 | // To prevent flickering here, we need to simulate a decay. |
| 130 | 129 | |
| 131 | | // decay time in milliseconds |
| 132 | | #define FILOFF_DECAY_TIME 20 |
| 130 | // decay time, in steps of 10ms |
| 131 | #define LEDS_DECAY_TIME 4 |
| 133 | 132 | |
| 134 | | TIMER_DEVICE_CALLBACK_MEMBER(tispeak_state::delayed_filament_off) |
| 133 | void tispeak_state::leds_update() |
| 135 | 134 | { |
| 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]; |
| 140 | 137 | |
| 141 | | void tispeak_state::display_update() |
| 142 | | { |
| 143 | | // filament on/off |
| 144 | | if (m_r & 0x8000) |
| 138 | for (int i = 0; i < 0x10; i++) |
| 145 | 139 | { |
| 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 | } |
| 148 | 158 | } |
| 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 | | } |
| 154 | 159 | |
| 155 | | // update digit state |
| 160 | // on difference, send to output |
| 156 | 161 | 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); |
| 159 | 165 | |
| 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 | } |
| 165 | 169 | |
| 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)); |
| 170 | 171 | } |
| 171 | 172 | |
| 173 | TIMER_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]--; |
| 172 | 179 | |
| 180 | leds_update(); |
| 181 | } |
| 173 | 182 | |
| 183 | |
| 184 | |
| 174 | 185 | /*************************************************************************** |
| 175 | 186 | |
| 176 | 187 | I/O |
| r242869 | r242870 | |
| 195 | 206 | WRITE16_MEMBER(tispeak_state::snspell_write_r) |
| 196 | 207 | { |
| 197 | 208 | // 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) |
| 199 | 210 | // R13: power-off request, on falling edge |
| 200 | 211 | if ((m_r >> 13 & 1) && !(data >> 13 & 1)) |
| 201 | 212 | power_off(); |
| 202 | 213 | |
| 203 | 214 | // other bits: MCU internal use |
| 204 | 215 | m_r = data; |
| 205 | | display_update(); |
| 216 | leds_update(); |
| 206 | 217 | } |
| 207 | 218 | |
| 208 | 219 | WRITE16_MEMBER(tispeak_state::snspell_write_o) |
| r242869 | r242870 | |
| 211 | 222 | // E,D,C,G,B,A,I,M,L,K,N,J,[AP],H,F,[DP] (sidenote: TI KLMN = MAME MLNK) |
| 212 | 223 | m_o = BITSWAP16(data,12,15,10,7,8,9,11,6,13,3,14,0,1,2,4,5); |
| 213 | 224 | |
| 214 | | display_update(); |
| 225 | leds_update(); |
| 215 | 226 | } |
| 216 | 227 | |
| 217 | 228 | |
| r242869 | r242870 | |
| 233 | 244 | // [DP],D,C,H,F,B,I,M,L,K,N,J,[AP],E,G,A (sidenote: TI KLMN = MAME MLNK) |
| 234 | 245 | m_o = BITSWAP16(data,12,0,10,7,8,9,11,6,3,14,4,13,1,2,5,15); |
| 235 | 246 | |
| 236 | | display_update(); |
| 247 | leds_update(); |
| 237 | 248 | } |
| 238 | 249 | |
| 239 | 250 | |
| r242869 | r242870 | |
| 243 | 254 | { |
| 244 | 255 | // same as default, except R13 is used for an extra digit |
| 245 | 256 | m_r = data; |
| 246 | | display_update(); |
| 257 | leds_update(); |
| 247 | 258 | } |
| 248 | 259 | |
| 249 | 260 | |
| r242869 | r242870 | |
| 426 | 437 | |
| 427 | 438 | void tispeak_state::machine_reset() |
| 428 | 439 | { |
| 429 | | m_filament_on = 0; |
| 430 | 440 | m_power_on = 1; |
| 431 | 441 | } |
| 432 | 442 | |
| 433 | 443 | void tispeak_state::machine_start() |
| 434 | 444 | { |
| 435 | 445 | // 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 | |
| 437 | 450 | m_r = 0; |
| 438 | 451 | m_o = 0; |
| 439 | | m_filament_on = 0; |
| 440 | 452 | m_power_on = 0; |
| 441 | 453 | |
| 442 | 454 | // 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 | |
| 444 | 459 | save_item(NAME(m_r)); |
| 445 | 460 | save_item(NAME(m_o)); |
| 446 | | save_item(NAME(m_filament_on)); |
| 447 | 461 | save_item(NAME(m_power_on)); |
| 448 | 462 | |
| 449 | 463 | // init cartridge |
| r242869 | r242870 | |
| 469 | 483 | MCFG_TMS0270_WRITE_CTL_CB(DEVWRITE8("tms5100", tms5100_device, ctl_w)) |
| 470 | 484 | MCFG_TMS0270_WRITE_PDC_CB(DEVWRITELINE("tms5100", tms5100_device, pdc_w)) |
| 471 | 485 | |
| 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)) |
| 473 | 487 | MCFG_DEFAULT_LAYOUT(layout_tispeak) // max 9 digits |
| 474 | 488 | |
| 475 | 489 | /* no video! */ |
trunk/src/mess/layout/lantutor.lay
| r242869 | r242870 | |
| 31 | 31 | <bezel name="digit8" element="digit"><bounds x="88" y="4" width="10" height="15" /></bezel> |
| 32 | 32 | <bezel name="digit13" element="digit"><bounds x="99" y="4" width="10" height="15" /></bezel> |
| 33 | 33 | |
| 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> |
| 44 | 44 | |
| 45 | 45 | </view> |
| 46 | 46 | </mamelayout> |
trunk/src/mess/layout/tispeak.lay
| r242869 | r242870 | |
| 30 | 30 | <!-- 9 digits (snspell has 8, snmath has 9) --> |
| 31 | 31 | |
| 32 | 32 | <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> |
| 35 | 35 | |
| 36 | 36 | <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> |
| 39 | 39 | |
| 40 | 40 | <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> |
| 43 | 43 | |
| 44 | 44 | <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> |
| 47 | 47 | |
| 48 | 48 | <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> |
| 51 | 51 | |
| 52 | 52 | <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> |
| 55 | 55 | |
| 56 | 56 | <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> |
| 59 | 59 | |
| 60 | 60 | <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> |
| 63 | 63 | |
| 64 | 64 | <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> |
| 67 | 67 | |
| 68 | 68 | </view> |
| 69 | 69 | </mamelayout> |