Previous 15994 Revisions Next

r11061 Sunday 3rd April, 2011 at 13:37:46 UTC by Robbbert
[TEC1] Fixed a bug that has been there since the driver was first written [reported by maguman21]
[src/mess/drivers]tec1.c
[src/mess/layout]tec1.lay

src/mess/layout/tec1.lay
r11060r11061
1717      <bezel element="background">
1818         <bounds left="1" top="1" right="600" bottom="480" />
1919      </bezel>
20      <bezel name="digit0" element="digit">
20      <bezel name="digit5" element="digit">
2121         <bounds left="107" top="105" right="155" bottom="185" />
2222      </bezel>
23      <bezel name="digit1" element="digit">
23      <bezel name="digit4" element="digit">
2424         <bounds left="155" top="105" right="203" bottom="185" />
2525      </bezel>
26      <bezel name="digit2" element="digit">
26      <bezel name="digit3" element="digit">
2727         <bounds left="203" top="105" right="251" bottom="185" />
2828      </bezel>
29      <bezel name="digit3" element="digit">
29      <bezel name="digit2" element="digit">
3030         <bounds left="251" top="105" right="299" bottom="185" />
3131      </bezel>
32      <bezel name="digit4" element="digit">
32      <bezel name="digit1" element="digit">
3333         <bounds left="323" top="105" right="370" bottom="185" />
3434      </bezel>
35      <bezel name="digit5" element="digit">
35      <bezel name="digit0" element="digit">
3636         <bounds left="371" top="105" right="418" bottom="185" />
3737      </bezel>
3838   </view>
src/mess/drivers/tec1.c
r11060r11061
3333- Invaders: RESET AD 3 2 0 GO GO
3434- Luna Lander: RESET AD 4 9 0 GO GO
3535
36Not emulated / need to be checked:
36Thanks to Chris Schwartz who dumped his ROM for me way back in the old days.
37It's only taken 25 years to get around to emulating it...
38
39
40ToDo:
41- After a Soft Reset, pressing keys can crash the emulation.
3742- 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.
3844- The 10ms debounce is not emulated.
39- Artwork needs to be produced.
45- Needs proper artwork.
4046
41Thanks to Chris Schwartz who dumped his ROM for me way back in the old days.
42It's only taken 25 years to get around to emulating it...
43
4447***************************************************************************/
4548#define ADDRESS_MAP_MODERN
4649
r11060r11061
4952#include "sound/speaker.h"
5053#include "tec1.lh"
5154
55#define MACHINE_RESET_MEMBER(name) void name::machine_reset()
56#define MACHINE_START_MEMBER(name) void name::machine_start()
5257
5358class tec1_state : public driver_device
5459{
r11060r11061
6974   UINT8 m_segment;
7075   UINT8 m_digit;
7176   UINT8 m_kbd_row;
72   void tec1_display();
77   UINT8 m_refresh[6];
7378   UINT8 tec1_convert_col_to_bin( UINT8 col, UINT8 row );
79   virtual void machine_reset();
80   virtual void machine_start();
7481};
7582
7683
r11060r11061
8188    Display
8289
8390***************************************************************************/
84void 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}
9191
9292WRITE8_MEMBER( tec1_state::tec1_segment_w )
9393{
r11060r11061
101101    d0 segment a */
102102
103103   m_segment = BITSWAP8(data, 4, 2, 1, 6, 7, 5, 3, 0);
104   if (m_digit) tec1_display();
105104}
106105
107106WRITE8_MEMBER( tec1_state::tec1_digit_w )
r11060r11061
115114    d1 address digit 3
116115    d0 address digit 4 */
117116
118   speaker_level_w(m_speaker, (data & 0x80) ? 1 : 0);
117   speaker_level_w(m_speaker, BIT(data, 7));
119118
120119   m_digit = data & 0x3f;
121   if (m_digit) tec1_display();
122120}
123121
124122
r11060r11061
138136{
139137   UINT8 data = row;
140138
141   if (col & 2)
139   if (BIT(col, 1))
142140      data |= 4;
143141   else
144   if (col & 4)
142   if (BIT(col, 2))
145143      data |= 8;
146144   else
147   if (col & 8)
145   if (BIT(col, 3))
148146      data |= 12;
149147   else
150   if (col & 16)
148   if (BIT(col, 4))
151149      data |= 16;
152150
153151   return data;
r11060r11061
157155{
158156   static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3" };
159157   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
162182   if (input_port_read(machine, keynames[state->m_kbd_row]))
163183      if (state->tec1_convert_col_to_bin(input_port_read(machine, keynames[state->m_kbd_row]), state->m_kbd_row) == state->m_kbd)
164184         return;
r11060r11061
181201
182202***************************************************************************/
183203
184static MACHINE_START( tec1 )
204MACHINE_START_MEMBER( tec1_state )
185205{
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));
189207}
190208
191static MACHINE_RESET( tec1 )
209MACHINE_RESET_MEMBER( tec1_state )
192210{
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) );
195213}
196214
197215
r11060r11061
265283   MCFG_CPU_PROGRAM_MAP(tec1_map)
266284   MCFG_CPU_IO_MAP(tec1_io)
267285
268   MCFG_MACHINE_START(tec1)
269   MCFG_MACHINE_RESET(tec1)
270
271286   /* video hardware */
272287   MCFG_DEFAULT_LAYOUT(layout_tec1)
273288
274289   /* sound hardware */
275290   MCFG_SPEAKER_STANDARD_MONO("mono")
276291   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)
278293MACHINE_CONFIG_END
279294
280295

Previous 15994 Revisions Next


© 1998-2018 The MESS Team