summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author hap <happppp@users.noreply.github.com>2014-12-03 21:41:26 +0100
committer hap <happppp@users.noreply.github.com>2014-12-03 21:41:26 +0100
commit6ec3066e0ab50881297948ccc64127dc49432bc5 (patch)
tree4f6d7793cd2ed581acf6480f54e4b826ece99ef5
parentf7e2061aec178472483292e62d535b91425cfc85 (diff)
added prelim input/outputs, you can see it strobing the 7segleds
-rw-r--r--src/mess/drivers/cnsector.c61
-rw-r--r--src/mess/layout/cnsector.lay46
2 files changed, 100 insertions, 7 deletions
diff --git a/src/mess/drivers/cnsector.c b/src/mess/drivers/cnsector.c
index 05ada6e36c0..c78f19d074d 100644
--- a/src/mess/drivers/cnsector.c
+++ b/src/mess/drivers/cnsector.c
@@ -14,17 +14,22 @@
#include "cnsector.lh"
+// master clock is cpu internal, the value below is an approximation
+#define MASTER_CLOCK (250000)
+
+
class cnsector_state : public driver_device
{
public:
cnsector_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu")
+ m_maincpu(*this, "maincpu"),
+ m_button_matrix(*this, "IN")
{ }
required_device<cpu_device> m_maincpu;
+ required_ioport_array<5> m_button_matrix;
- UINT16 m_r;
UINT16 m_o;
DECLARE_READ8_MEMBER(read_k);
@@ -44,16 +49,31 @@ public:
READ8_MEMBER(cnsector_state::read_k)
{
- return 0;
+ UINT8 k = 0;
+
+ // read selected button rows
+ for (int i = 0; i < 5; i++)
+ if (m_o & (1 << i))
+ k |= m_button_matrix[i]->read();
+
+ return k;
}
WRITE16_MEMBER(cnsector_state::write_r)
{
- m_r = data;
+ // R0-R5: select digit
+ for (int i = 0; i < 6; i++)
+ output_set_digit_value(i, (data >> i & 1) ? m_o : 0);
+
+ // R6-R9: direction leds
+ for (int i = 6; i < 10; i++)
+ output_set_lamp_value(i - 6, data >> i & 1);
}
WRITE16_MEMBER(cnsector_state::write_o)
{
+ // O0-O4: input mux
+ // O0-O7: digit segments
m_o = data;
}
@@ -66,6 +86,35 @@ WRITE16_MEMBER(cnsector_state::write_o)
***************************************************************************/
static INPUT_PORTS_START( cnsector )
+ PORT_START("IN.0") // O0
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) // ? next
+ PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) // ? left
+ PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) // nc?
+ PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) // ? range
+
+ PORT_START("IN.1") // O1
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) // ? aim
+ PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) // ? right
+ PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) // nc?
+ PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) // ?nc
+
+ PORT_START("IN.2") // O2
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) // ? fire
+ PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) // ? evasive
+ PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) // nc?
+ PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) // ? recall
+
+ PORT_START("IN.3") // O3
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) // ? finder
+ PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) // ? slow
+ PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) // nc?
+ PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) // ?nc
+
+ PORT_START("IN.4") // O4
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) // ? teach
+ PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) // ? fast
+ PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) // nc?
+ PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) // ? move
INPUT_PORTS_END
@@ -78,10 +127,8 @@ INPUT_PORTS_END
void cnsector_state::machine_start()
{
- m_r = 0;
m_o = 0;
- save_item(NAME(m_r));
save_item(NAME(m_o));
}
@@ -89,7 +136,7 @@ void cnsector_state::machine_start()
static MACHINE_CONFIG_START( cnsector, cnsector_state )
/* basic machine hardware */
- MCFG_CPU_ADD("maincpu", TMS0970, 250000)
+ MCFG_CPU_ADD("maincpu", TMS0970, MASTER_CLOCK)
MCFG_TMS1XXX_READ_K_CB(READ8(cnsector_state, read_k))
MCFG_TMS1XXX_WRITE_O_CB(WRITE16(cnsector_state, write_o))
MCFG_TMS1XXX_WRITE_R_CB(WRITE16(cnsector_state, write_r))
diff --git a/src/mess/layout/cnsector.lay b/src/mess/layout/cnsector.lay
index 08148b1f45a..42dcb2e7f92 100644
--- a/src/mess/layout/cnsector.lay
+++ b/src/mess/layout/cnsector.lay
@@ -1,8 +1,54 @@
<?xml version="1.0"?>
<mamelayout version="2">
+<!-- define elements -->
+
+ <element name="digit" defstate="0">
+ <led7seg><color red="1.0" green="0.25" blue="0.20" /></led7seg>
+ </element>
+
+ <element name="lamp" defstate="0">
+ <disk state="1"><color red="1.0" green="0.25" blue="0.20" /></disk>
+ <disk state="0"><color red="0.2" green="0.0" blue="0.0" /></disk>
+ </element>
+
+
+<!-- build screen -->
+
<view name="Internal Layout">
<bounds left="0" right="200" top="0" bottom="200" />
+ <bezel name="digit0" element="digit">
+ <bounds x="0" y="0" width="10" height="15" />
+ </bezel>
+ <bezel name="digit1" element="digit">
+ <bounds x="10" y="0" width="10" height="15" />
+ </bezel>
+ <bezel name="digit2" element="digit">
+ <bounds x="20" y="0" width="10" height="15" />
+ </bezel>
+ <bezel name="digit3" element="digit">
+ <bounds x="30" y="0" width="10" height="15" />
+ </bezel>
+ <bezel name="digit4" element="digit">
+ <bounds x="40" y="0" width="10" height="15" />
+ </bezel>
+ <bezel name="digit5" element="digit">
+ <bounds x="50" y="0" width="10" height="15" />
+ </bezel>
+
+ <bezel name="lamp0" element="lamp">
+ <bounds x="20" y="20" width="5" height="5" />
+ </bezel>
+ <bezel name="lamp1" element="lamp">
+ <bounds x="20" y="30" width="5" height="5" />
+ </bezel>
+ <bezel name="lamp2" element="lamp">
+ <bounds x="30" y="25" width="5" height="5" />
+ </bezel>
+ <bezel name="lamp3" element="lamp">
+ <bounds x="10" y="25" width="5" height="5" />
+ </bezel>
+
</view>
</mamelayout>