src/mess/layout/tec1.lay
| r11060 | r11061 | |
| 17 | 17 | <bezel element="background"> |
| 18 | 18 | <bounds left="1" top="1" right="600" bottom="480" /> |
| 19 | 19 | </bezel> |
| 20 | | <bezel name="digit0" element="digit"> |
| 20 | <bezel name="digit5" element="digit"> |
| 21 | 21 | <bounds left="107" top="105" right="155" bottom="185" /> |
| 22 | 22 | </bezel> |
| 23 | | <bezel name="digit1" element="digit"> |
| 23 | <bezel name="digit4" element="digit"> |
| 24 | 24 | <bounds left="155" top="105" right="203" bottom="185" /> |
| 25 | 25 | </bezel> |
| 26 | | <bezel name="digit2" element="digit"> |
| 26 | <bezel name="digit3" element="digit"> |
| 27 | 27 | <bounds left="203" top="105" right="251" bottom="185" /> |
| 28 | 28 | </bezel> |
| 29 | | <bezel name="digit3" element="digit"> |
| 29 | <bezel name="digit2" element="digit"> |
| 30 | 30 | <bounds left="251" top="105" right="299" bottom="185" /> |
| 31 | 31 | </bezel> |
| 32 | | <bezel name="digit4" element="digit"> |
| 32 | <bezel name="digit1" element="digit"> |
| 33 | 33 | <bounds left="323" top="105" right="370" bottom="185" /> |
| 34 | 34 | </bezel> |
| 35 | | <bezel name="digit5" element="digit"> |
| 35 | <bezel name="digit0" element="digit"> |
| 36 | 36 | <bounds left="371" top="105" right="418" bottom="185" /> |
| 37 | 37 | </bezel> |
| 38 | 38 | </view> |
src/mess/drivers/tec1.c
| r11060 | r11061 | |
| 33 | 33 | - Invaders: RESET AD 3 2 0 GO GO |
| 34 | 34 | - Luna Lander: RESET AD 4 9 0 GO GO |
| 35 | 35 | |
| 36 | | Not emulated / need to be checked: |
| 36 | Thanks to Chris Schwartz who dumped his ROM for me way back in the old days. |
| 37 | It's only taken 25 years to get around to emulating it... |
| 38 | |
| 39 | |
| 40 | ToDo: |
| 41 | - After a Soft Reset, pressing keys can crash the emulation. |
| 37 | 42 | - The 74C923 code may need to be revisited to improve keyboard response. |
| 43 | Sometimes have to press a key a few times before it registers. |
| 38 | 44 | - The 10ms debounce is not emulated. |
| 39 | | - Artwork needs to be produced. |
| 45 | - Needs proper artwork. |
| 40 | 46 | |
| 41 | | Thanks to Chris Schwartz who dumped his ROM for me way back in the old days. |
| 42 | | It's only taken 25 years to get around to emulating it... |
| 43 | | |
| 44 | 47 | ***************************************************************************/ |
| 45 | 48 | #define ADDRESS_MAP_MODERN |
| 46 | 49 | |
| r11060 | r11061 | |
| 49 | 52 | #include "sound/speaker.h" |
| 50 | 53 | #include "tec1.lh" |
| 51 | 54 | |
| 55 | #define MACHINE_RESET_MEMBER(name) void name::machine_reset() |
| 56 | #define MACHINE_START_MEMBER(name) void name::machine_start() |
| 52 | 57 | |
| 53 | 58 | class tec1_state : public driver_device |
| 54 | 59 | { |
| r11060 | r11061 | |
| 69 | 74 | UINT8 m_segment; |
| 70 | 75 | UINT8 m_digit; |
| 71 | 76 | UINT8 m_kbd_row; |
| 72 | | void tec1_display(); |
| 77 | UINT8 m_refresh[6]; |
| 73 | 78 | UINT8 tec1_convert_col_to_bin( UINT8 col, UINT8 row ); |
| 79 | virtual void machine_reset(); |
| 80 | virtual void machine_start(); |
| 74 | 81 | }; |
| 75 | 82 | |
| 76 | 83 | |
| r11060 | r11061 | |
| 81 | 88 | Display |
| 82 | 89 | |
| 83 | 90 | ***************************************************************************/ |
| 84 | | void tec1_state::tec1_display() |
| 85 | | { |
| 86 | | UINT8 i; |
| 87 | | for (i = 0; i < 6; i++) |
| 88 | | if (m_digit & (1 << i)) |
| 89 | | output_set_digit_value(5-i, m_segment); |
| 90 | | } |
| 91 | 91 | |
| 92 | 92 | WRITE8_MEMBER( tec1_state::tec1_segment_w ) |
| 93 | 93 | { |
| r11060 | r11061 | |
| 101 | 101 | d0 segment a */ |
| 102 | 102 | |
| 103 | 103 | m_segment = BITSWAP8(data, 4, 2, 1, 6, 7, 5, 3, 0); |
| 104 | | if (m_digit) tec1_display(); |
| 105 | 104 | } |
| 106 | 105 | |
| 107 | 106 | WRITE8_MEMBER( tec1_state::tec1_digit_w ) |
| r11060 | r11061 | |
| 115 | 114 | d1 address digit 3 |
| 116 | 115 | d0 address digit 4 */ |
| 117 | 116 | |
| 118 | | speaker_level_w(m_speaker, (data & 0x80) ? 1 : 0); |
| 117 | speaker_level_w(m_speaker, BIT(data, 7)); |
| 119 | 118 | |
| 120 | 119 | m_digit = data & 0x3f; |
| 121 | | if (m_digit) tec1_display(); |
| 122 | 120 | } |
| 123 | 121 | |
| 124 | 122 | |
| r11060 | r11061 | |
| 138 | 136 | { |
| 139 | 137 | UINT8 data = row; |
| 140 | 138 | |
| 141 | | if (col & 2) |
| 139 | if (BIT(col, 1)) |
| 142 | 140 | data |= 4; |
| 143 | 141 | else |
| 144 | | if (col & 4) |
| 142 | if (BIT(col, 2)) |
| 145 | 143 | data |= 8; |
| 146 | 144 | else |
| 147 | | if (col & 8) |
| 145 | if (BIT(col, 3)) |
| 148 | 146 | data |= 12; |
| 149 | 147 | else |
| 150 | | if (col & 16) |
| 148 | if (BIT(col, 4)) |
| 151 | 149 | data |= 16; |
| 152 | 150 | |
| 153 | 151 | return data; |
| r11060 | r11061 | |
| 157 | 155 | { |
| 158 | 156 | static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3" }; |
| 159 | 157 | tec1_state *state = machine.driver_data<tec1_state>(); |
| 160 | | /* 74C923 4 by 5 key encoder. */ |
| 161 | | /* if previous key is still held, bail out */ |
| 158 | UINT8 i; |
| 159 | |
| 160 | // Display the digits. Blank any digits that haven't been refreshed for a while. |
| 161 | // This will fix the problem reported by a user. |
| 162 | for (i = 0; i < 6; i++) |
| 163 | { |
| 164 | if (BIT(state->m_digit, i)) |
| 165 | { |
| 166 | state->m_refresh[i] = 1; |
| 167 | output_set_digit_value(i, state->m_segment); |
| 168 | } |
| 169 | else |
| 170 | if (state->m_refresh[i] == 0x80) |
| 171 | { |
| 172 | output_set_digit_value(i, 0); |
| 173 | state->m_refresh[i] = 0; |
| 174 | } |
| 175 | else |
| 176 | if (state->m_refresh[i]) |
| 177 | state->m_refresh[i]++; |
| 178 | } |
| 179 | |
| 180 | // 74C923 4 by 5 key encoder. |
| 181 | // if previous key is still held, bail out |
| 162 | 182 | if (input_port_read(machine, keynames[state->m_kbd_row])) |
| 163 | 183 | if (state->tec1_convert_col_to_bin(input_port_read(machine, keynames[state->m_kbd_row]), state->m_kbd_row) == state->m_kbd) |
| 164 | 184 | return; |
| r11060 | r11061 | |
| 181 | 201 | |
| 182 | 202 | ***************************************************************************/ |
| 183 | 203 | |
| 184 | | static MACHINE_START( tec1 ) |
| 204 | MACHINE_START_MEMBER( tec1_state ) |
| 185 | 205 | { |
| 186 | | tec1_state *state = machine.driver_data<tec1_state>(); |
| 187 | | state->m_kbd_timer = machine.scheduler().timer_alloc(FUNC(tec1_kbd_callback)); |
| 188 | | state->m_kbd_timer->adjust( attotime::zero, 0, attotime::from_hz(500) ); |
| 206 | m_kbd_timer = m_machine.scheduler().timer_alloc(FUNC(tec1_kbd_callback)); |
| 189 | 207 | } |
| 190 | 208 | |
| 191 | | static MACHINE_RESET( tec1 ) |
| 209 | MACHINE_RESET_MEMBER( tec1_state ) |
| 192 | 210 | { |
| 193 | | tec1_state *state = machine.driver_data<tec1_state>(); |
| 194 | | state->m_kbd = 0; |
| 211 | m_kbd = 0; |
| 212 | m_kbd_timer->adjust( attotime::zero, 0, attotime::from_hz(500) ); |
| 195 | 213 | } |
| 196 | 214 | |
| 197 | 215 | |
| r11060 | r11061 | |
| 265 | 283 | MCFG_CPU_PROGRAM_MAP(tec1_map) |
| 266 | 284 | MCFG_CPU_IO_MAP(tec1_io) |
| 267 | 285 | |
| 268 | | MCFG_MACHINE_START(tec1) |
| 269 | | MCFG_MACHINE_RESET(tec1) |
| 270 | | |
| 271 | 286 | /* video hardware */ |
| 272 | 287 | MCFG_DEFAULT_LAYOUT(layout_tec1) |
| 273 | 288 | |
| 274 | 289 | /* sound hardware */ |
| 275 | 290 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 276 | 291 | MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) |
| 277 | | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 292 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 278 | 293 | MACHINE_CONFIG_END |
| 279 | 294 | |
| 280 | 295 | |