Previous 199869 Revisions Next

r35099 Wednesday 18th February, 2015 at 01:32:38 UTC by hap
tc4 hooked up inputs and leds
[src/mess/drivers]splitsec.c tc4.c
[src/mess/layout]tc4.lay

trunk/src/mess/drivers/splitsec.c
r243610r243611
190190
191191WRITE16_MEMBER(splitsec_state::write_o)
192192{
193   // O0-O6: led rows
193   // O0-O6: led columns
194194   // O7: N/C
195195   m_o = data;
196196   display_update();
r243610r243611
204204   // R9,R10: input mux
205205   m_input_mux = data >> 9 & 3;
206206   
207   // R0-R7: led columns
207   // R0-R7: led rows
208208   m_r = data & 0xff;
209209   display_update();
210210}
r243610r243611
217217   // R2,R3: input mux
218218   m_input_mux = data >> 2 & 3;
219219   
220   // R2-R10: led columns
220   // R2-R10: led rows
221221   m_r = data & ~3;
222222   display_update();
223223}
r243610r243611
246246
247247
248248/* bankshot physical button layout and labels is like this:
249  (note: remember that you can rotate the display in MESS)
249250
250251    [SELECT  [BALL UP] [BALL OVER]
251252     SCORE]
trunk/src/mess/drivers/tc4.c
r243610r243611
1818
1919#include "tc4.lh"
2020
21// The master clock is a single stage RC oscillator: R=27.3K, C=100pf,
22//..
21// The master clock is a single stage RC oscillator: R=27.3K, C=100pf.
22// TMS1400 RC curve is unknown, so let's do an approximation until it is.
2323#define MASTER_CLOCK (475000)
2424
2525
r243610r243611
2929   tc4_state(const machine_config &mconfig, device_type type, const char *tag)
3030      : driver_device(mconfig, type, tag),
3131      m_maincpu(*this, "maincpu"),
32//      m_button_matrix(*this, "IN"),
32      m_button_matrix(*this, "IN"),
3333      m_speaker(*this, "speaker")
3434   { }
3535
3636   required_device<cpu_device> m_maincpu;
37//   required_ioport_array<2> m_button_matrix;
37   required_ioport_array<6> m_button_matrix;
3838   required_device<speaker_sound_device> m_speaker;
3939
4040   UINT16 m_r;
r243610r243611
4949   DECLARE_WRITE16_MEMBER(write_r);
5050
5151   TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick);
52   bool index_is_7segled(int index);
5253   void display_update();
5354
5455   virtual void machine_start();
r243610r243611
6869// decay time, in steps of 1ms
6970#define DISPLAY_DECAY_TIME 40
7071
72inline bool tc4_state::index_is_7segled(int index)
73{
74   // R5,7,8,9 are 7segs
75   return (index >= 5 && index <= 9 && index != 6);
76}
7177
78
7279void tc4_state::display_update()
7380{
7481   UINT16 active_state[0x10];
r243610r243611
98105   for (int i = 0; i < 0x10; i++)
99106      if (m_display_cache[i] != active_state[i])
100107      {
101//         if (index_is_7segled(i))
102//            output_set_digit_value(i, BITSWAP8(active_state[i],7,0,1,2,3,4,5,6) & 0x7f);
108         if (index_is_7segled(i))
109            output_set_digit_value(i, active_state[i] & 0x7f);
103110
104111         for (int j = 0; j < 9; j++)
105112            output_set_lamp_value(i*10 + j, active_state[i] >> j & 1);
r243610r243611
130137{
131138   UINT8 k = 0;
132139
140   // read selected button rows
141   for (int i = 0; i < 6; i++)
142      if (m_r >> i & 1)
143         k |= m_button_matrix[i]->read();
144   
145   // read from cartridge
146   if (m_r & 0x200)
147      k |= ioport("CART")->read();
148   
133149   return k;
134150}
135151
136152WRITE16_MEMBER(tc4_state::write_o)
137153{
154   // O0-O7: leds/7segment
155   m_o = data;
156   display_update();
138157}
139158
140159WRITE16_MEMBER(tc4_state::write_r)
141160{
161   // R10: speaker out
162   m_speaker->level_w(data >> 10 & 1);
163
164   // R0-R5: input mux
165   // R6: led column 8
166   // R9: to cartridge slot
167   // +other: select leds
168   m_r = data & 0x3ff;
169   display_update();
142170}
143171
144172
r243610r243611
151179***************************************************************************/
152180
153181static INPUT_PORTS_START( tc4 )
182   PORT_START("IN.0") // R0
183   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 )
184   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 )
185   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 )
186   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 )
187
188   PORT_START("IN.1") // R1
189   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_RIGHT )
190   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_LEFT )
191   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_UP )
192   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_DOWN )
193
194   PORT_START("IN.2") // R2
195   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_RIGHT )
196   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_LEFT )
197   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_UP )
198   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_DOWN )
199
200   PORT_START("IN.3") // R3
201   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_RIGHT ) PORT_PLAYER(2)
202   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_LEFT ) PORT_PLAYER(2)
203   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_UP ) PORT_PLAYER(2)
204   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_DOWN ) PORT_PLAYER(2)
205
206   PORT_START("IN.4") // R4
207   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_RIGHT ) PORT_PLAYER(2)
208   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_LEFT ) PORT_PLAYER(2)
209   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_UP ) PORT_PLAYER(2)
210   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_DOWN ) PORT_PLAYER(2)
211
212   PORT_START("IN.5") // R5
213   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2)
214   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2)
215   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(2)
216   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(2)
217
218   PORT_START("CART")
219   PORT_DIPUNKNOWN_DIPLOC( 0x01, 0x00, "R9:1" )
220   PORT_DIPUNKNOWN_DIPLOC( 0x02, 0x00, "R9:2" )
221   PORT_DIPUNKNOWN_DIPLOC( 0x04, 0x00, "R9:3" )
222   PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x00, "R9:4" )
154223INPUT_PORTS_END
155224
156225
trunk/src/mess/layout/tc4.lay
r243610r243611
33
44<!-- define elements -->
55
6   <element name="digit" defstate="0">
7      <led7seg><color red="1.0" green="0.25" blue="0.28" /></led7seg>
8   </element>
9
610   <element name="led" defstate="0">
7      <disk state="0"><color red="0.15" green="0.03" blue="0.03" /></disk>
8      <disk state="1"><color red="1.0" green="0.3" blue="0.3" /></disk>
11      <disk state="0"><color red="0.1" green="0.025" blue="0.028" /></disk>
12      <disk state="1"><color red="1.0" green="0.25" blue="0.28" /></disk>
913   </element>
1014
1115
r243610r243611
1519   <view name="Internal Layout">
1620      <bounds left="0" right="100" top="0" bottom="100" />
1721
22      <bezel name="digit5" element="digit"><bounds x="0" y="0" width="10" height="15" /></bezel>
23      <bezel name="digit9" element="digit"><bounds x="10" y="0" width="10" height="15" /></bezel>
24      <bezel name="digit8" element="digit"><bounds x="20" y="0" width="10" height="15" /></bezel>
25      <bezel name="digit7" element="digit"><bounds x="20" y="0" width="10" height="15" /></bezel>
1826
27      <bezel name="lamp77" element="led"><bounds x="0" y="20" width="1" height="1" /></bezel>
28      <bezel name="lamp87" element="led"><bounds x="2" y="20" width="1" height="1" /></bezel>
29      <bezel name="lamp97" element="led"><bounds x="4" y="20" width="1" height="1" /></bezel>
30      <bezel name="lamp57" element="led"><bounds x="6" y="20" width="1" height="1" /></bezel>
31
32      <bezel name="lamp0" element="led"><bounds x="2" y="30" width="1" height="1" /></bezel>
33      <bezel name="lamp1" element="led"><bounds x="4" y="30" width="1" height="1" /></bezel>
34      <bezel name="lamp2" element="led"><bounds x="6" y="30" width="1" height="1" /></bezel>
35      <bezel name="lamp3" element="led"><bounds x="8" y="30" width="1" height="1" /></bezel>
36      <bezel name="lamp4" element="led"><bounds x="10" y="30" width="1" height="1" /></bezel>
37      <bezel name="lamp5" element="led"><bounds x="12" y="30" width="1" height="1" /></bezel>
38      <bezel name="lamp6" element="led"><bounds x="14" y="30" width="1" height="1" /></bezel>
39      <bezel name="lamp7" element="led"><bounds x="16" y="30" width="1" height="1" /></bezel>
40      <bezel name="lamp8" element="led"><bounds x="18" y="30" width="1" height="1" /></bezel>
41
42      <bezel name="lamp10" element="led"><bounds x="2" y="32" width="1" height="1" /></bezel>
43      <bezel name="lamp11" element="led"><bounds x="4" y="32" width="1" height="1" /></bezel>
44      <bezel name="lamp12" element="led"><bounds x="6" y="32" width="1" height="1" /></bezel>
45      <bezel name="lamp13" element="led"><bounds x="8" y="32" width="1" height="1" /></bezel>
46      <bezel name="lamp14" element="led"><bounds x="10" y="32" width="1" height="1" /></bezel>
47      <bezel name="lamp15" element="led"><bounds x="12" y="32" width="1" height="1" /></bezel>
48      <bezel name="lamp16" element="led"><bounds x="14" y="32" width="1" height="1" /></bezel>
49      <bezel name="lamp17" element="led"><bounds x="16" y="32" width="1" height="1" /></bezel>
50      <bezel name="lamp18" element="led"><bounds x="18" y="32" width="1" height="1" /></bezel>
51
52      <bezel name="lamp88" element="led"><bounds x="0" y="34" width="1" height="1" /></bezel>
53      <bezel name="lamp20" element="led"><bounds x="2" y="34" width="1" height="1" /></bezel>
54      <bezel name="lamp21" element="led"><bounds x="4" y="34" width="1" height="1" /></bezel>
55      <bezel name="lamp22" element="led"><bounds x="6" y="34" width="1" height="1" /></bezel>
56      <bezel name="lamp23" element="led"><bounds x="8" y="34" width="1" height="1" /></bezel>
57      <bezel name="lamp24" element="led"><bounds x="10" y="34" width="1" height="1" /></bezel>
58      <bezel name="lamp25" element="led"><bounds x="12" y="34" width="1" height="1" /></bezel>
59      <bezel name="lamp26" element="led"><bounds x="14" y="34" width="1" height="1" /></bezel>
60      <bezel name="lamp27" element="led"><bounds x="16" y="34" width="1" height="1" /></bezel>
61      <bezel name="lamp28" element="led"><bounds x="18" y="34" width="1" height="1" /></bezel>
62      <bezel name="lamp78" element="led"><bounds x="20" y="34" width="1" height="1" /></bezel>
63
64      <bezel name="lamp30" element="led"><bounds x="2" y="36" width="1" height="1" /></bezel>
65      <bezel name="lamp31" element="led"><bounds x="4" y="36" width="1" height="1" /></bezel>
66      <bezel name="lamp32" element="led"><bounds x="6" y="36" width="1" height="1" /></bezel>
67      <bezel name="lamp33" element="led"><bounds x="8" y="36" width="1" height="1" /></bezel>
68      <bezel name="lamp34" element="led"><bounds x="10" y="36" width="1" height="1" /></bezel>
69      <bezel name="lamp35" element="led"><bounds x="12" y="36" width="1" height="1" /></bezel>
70      <bezel name="lamp36" element="led"><bounds x="14" y="36" width="1" height="1" /></bezel>
71      <bezel name="lamp37" element="led"><bounds x="16" y="36" width="1" height="1" /></bezel>
72      <bezel name="lamp38" element="led"><bounds x="18" y="36" width="1" height="1" /></bezel>
73
74      <bezel name="lamp40" element="led"><bounds x="2" y="38" width="1" height="1" /></bezel>
75      <bezel name="lamp41" element="led"><bounds x="4" y="38" width="1" height="1" /></bezel>
76      <bezel name="lamp42" element="led"><bounds x="6" y="38" width="1" height="1" /></bezel>
77      <bezel name="lamp43" element="led"><bounds x="8" y="38" width="1" height="1" /></bezel>
78      <bezel name="lamp44" element="led"><bounds x="10" y="38" width="1" height="1" /></bezel>
79      <bezel name="lamp45" element="led"><bounds x="12" y="38" width="1" height="1" /></bezel>
80      <bezel name="lamp46" element="led"><bounds x="14" y="38" width="1" height="1" /></bezel>
81      <bezel name="lamp47" element="led"><bounds x="16" y="38" width="1" height="1" /></bezel>
82      <bezel name="lamp48" element="led"><bounds x="18" y="38" width="1" height="1" /></bezel>
83
84
1985   </view>
2086</mamelayout>


Previous 199869 Revisions Next


© 1997-2024 The MAME Team