Previous 199869 Revisions Next

r33660 Wednesday 3rd December, 2014 at 20:41:26 UTC by hap
added prelim input/outputs, you can see it strobing the 7segleds
[src/mess/drivers]cnsector.c
[src/mess/layout]cnsector.lay

trunk/src/mess/drivers/cnsector.c
r242171r242172
1414#include "cnsector.lh"
1515
1616
17// master clock is cpu internal, the value below is an approximation
18#define MASTER_CLOCK (250000)
19
20
1721class cnsector_state : public driver_device
1822{
1923public:
2024   cnsector_state(const machine_config &mconfig, device_type type, const char *tag)
2125      : driver_device(mconfig, type, tag),
22      m_maincpu(*this, "maincpu")
26      m_maincpu(*this, "maincpu"),
27      m_button_matrix(*this, "IN")
2328   { }
2429
2530   required_device<cpu_device> m_maincpu;
31   required_ioport_array<5> m_button_matrix;
2632
27   UINT16 m_r;
2833   UINT16 m_o;
2934
3035   DECLARE_READ8_MEMBER(read_k);
r242171r242172
4449
4550READ8_MEMBER(cnsector_state::read_k)
4651{
47   return 0;
52   UINT8 k = 0;
53
54   // read selected button rows
55   for (int i = 0; i < 5; i++)
56      if (m_o & (1 << i))
57         k |= m_button_matrix[i]->read();
58   
59   return k;
4860}
4961
5062WRITE16_MEMBER(cnsector_state::write_r)
5163{
52   m_r = data;
64   // R0-R5: select digit
65   for (int i = 0; i < 6; i++)
66      output_set_digit_value(i, (data >> i & 1) ? m_o : 0);
67
68   // R6-R9: direction leds
69   for (int i = 6; i < 10; i++)
70      output_set_lamp_value(i - 6, data >> i & 1);
5371}
5472
5573WRITE16_MEMBER(cnsector_state::write_o)
5674{
75   // O0-O4: input mux
76   // O0-O7: digit segments
5777   m_o = data;
5878}
5979
r242171r242172
6686***************************************************************************/
6787
6888static INPUT_PORTS_START( cnsector )
89   PORT_START("IN.0") // O0
90   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) // ?  next
91   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) // ?  left
92   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) // nc?
93   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) // ?  range
94
95   PORT_START("IN.1") // O1
96   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) // ?  aim
97   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) // ?  right
98   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) // nc?
99   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) // ?nc
100
101   PORT_START("IN.2") // O2
102   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) // ?  fire
103   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) // ?  evasive
104   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) // nc?
105   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) // ?  recall
106
107   PORT_START("IN.3") // O3
108   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) // ?  finder
109   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) // ?  slow
110   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) // nc?
111   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) // ?nc
112
113   PORT_START("IN.4") // O4
114   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) // ?  teach
115   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) // ?  fast
116   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) // nc?
117   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) // ?  move
69118INPUT_PORTS_END
70119
71120
r242171r242172
78127
79128void cnsector_state::machine_start()
80129{
81   m_r = 0;
82130   m_o = 0;
83131   
84   save_item(NAME(m_r));
85132   save_item(NAME(m_o));
86133}
87134
r242171r242172
89136static MACHINE_CONFIG_START( cnsector, cnsector_state )
90137
91138   /* basic machine hardware */
92   MCFG_CPU_ADD("maincpu", TMS0970, 250000)
139   MCFG_CPU_ADD("maincpu", TMS0970, MASTER_CLOCK)
93140   MCFG_TMS1XXX_READ_K_CB(READ8(cnsector_state, read_k))
94141   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(cnsector_state, write_o))
95142   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(cnsector_state, write_r))
trunk/src/mess/layout/cnsector.lay
r242171r242172
11<?xml version="1.0"?>
22<mamelayout version="2">
33
4<!-- define elements -->
5
6   <element name="digit" defstate="0">
7      <led7seg><color red="1.0" green="0.25" blue="0.20" /></led7seg>
8   </element>
9
10   <element name="lamp" defstate="0">
11      <disk state="1"><color red="1.0" green="0.25" blue="0.20" /></disk>
12      <disk state="0"><color red="0.2" green="0.0" blue="0.0" /></disk>
13   </element>
14
15
16<!-- build screen -->
17
418   <view name="Internal Layout">
519      <bounds left="0" right="200" top="0" bottom="200" />
620
21      <bezel name="digit0" element="digit">
22         <bounds x="0" y="0" width="10" height="15" />
23      </bezel>
24      <bezel name="digit1" element="digit">
25         <bounds x="10" y="0" width="10" height="15" />
26      </bezel>
27      <bezel name="digit2" element="digit">
28         <bounds x="20" y="0" width="10" height="15" />
29      </bezel>
30      <bezel name="digit3" element="digit">
31         <bounds x="30" y="0" width="10" height="15" />
32      </bezel>
33      <bezel name="digit4" element="digit">
34         <bounds x="40" y="0" width="10" height="15" />
35      </bezel>
36      <bezel name="digit5" element="digit">
37         <bounds x="50" y="0" width="10" height="15" />
38      </bezel>
39
40      <bezel name="lamp0" element="lamp">
41         <bounds x="20" y="20" width="5" height="5" />
42      </bezel>
43      <bezel name="lamp1" element="lamp">
44         <bounds x="20" y="30" width="5" height="5" />
45      </bezel>
46      <bezel name="lamp2" element="lamp">
47         <bounds x="30" y="25" width="5" height="5" />
48      </bezel>
49      <bezel name="lamp3" element="lamp">
50         <bounds x="10" y="25" width="5" height="5" />
51      </bezel>
52
753   </view>
854</mamelayout>


Previous 199869 Revisions Next


© 1997-2024 The MAME Team