hh_cop400: ctstein WIP

This commit is contained in:
hap 2016-03-05 11:00:51 +01:00
parent f5fd732de6
commit 80b569fb2b
2 changed files with 75 additions and 3 deletions

View File

@ -17,6 +17,7 @@
#include "sound/speaker.h"
// internal artwork
#include "ctstein.lh" // clickable
#include "einvaderc.lh" // test-layout(but still playable)
#include "funjacks.lh"
#include "funrlgl.lh"
@ -245,26 +246,74 @@ public:
ctstein_state(const machine_config &mconfig, device_type type, const char *tag)
: hh_cop400_state(mconfig, type, tag)
{ }
DECLARE_WRITE8_MEMBER(write_g);
DECLARE_WRITE8_MEMBER(write_l);
DECLARE_WRITE_LINE_MEMBER(write_sk);
DECLARE_READ8_MEMBER(read_l);
};
// handlers
//..
WRITE8_MEMBER(ctstein_state::write_g)
{
// G0-G2: input mux
m_inp_mux = ~data & 7;
}
WRITE8_MEMBER(ctstein_state::write_l)
{
// L0-L3: button lamps
display_matrix(4, 1, data & 0xf, 1);
}
READ8_MEMBER(ctstein_state::read_l)
{
// L4-L7: multiplexed inputs
return read_inputs(3) << 4 | 0xf;
}
WRITE_LINE_MEMBER(ctstein_state::write_sk)
{
// SK: speaker out
m_speaker->level_w(state);
}
// config
static INPUT_PORTS_START( ctstein )
PORT_START("IN.0") // D0 port L
PORT_CONFNAME( 0x0f, 0x01, DEF_STR( Difficulty ) )
PORT_CONFSETTING( 0x01, "1" )
PORT_CONFSETTING( 0x02, "2" )
PORT_CONFSETTING( 0x04, "3" )
PORT_CONFSETTING( 0x08, "4" )
PORT_START("IN.1") // D1 port L
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON5 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON6 )
PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("IN.2") // D2 port L
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 )
INPUT_PORTS_END
static MACHINE_CONFIG_START( ctstein, ctstein_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", COP421, 1000000) // approximation - RC osc. R=12K to +6V, C=100pf to GND
MCFG_CPU_ADD("maincpu", COP421, 2000000) // approximation - RC osc. R=12K to +6V, C=100pf to GND
MCFG_COP400_CONFIG(COP400_CKI_DIVISOR_16, COP400_CKO_OSCILLATOR_OUTPUT, false) // guessed
MCFG_COP400_WRITE_G_CB(WRITE8(ctstein_state, write_g))
MCFG_COP400_WRITE_L_CB(WRITE8(ctstein_state, write_l))
MCFG_COP400_WRITE_SK_CB(WRITELINE(ctstein_state, write_sk))
MCFG_COP400_READ_L_CB(READ8(ctstein_state, read_l))
MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_cop400_state, display_decay_tick, attotime::from_msec(1))
// MCFG_DEFAULT_LAYOUT(layout_ctstein)
MCFG_DEFAULT_LAYOUT(layout_ctstein)
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")

View File

@ -0,0 +1,23 @@
<?xml version="1.0"?>
<mamelayout version="2">
<!-- define elements -->
<element name="led" defstate="0">
<disk state="0"><color red="0.2" green="0.04" blue="0.046" /></disk>
<disk state="1"><color red="1.0" green="0.2" blue="0.23" /></disk>
</element>
<!-- build screen -->
<view name="Internal Layout">
<bounds left="0" right="100" top="0" bottom="100" />
<bezel name="0.0" element="led"><bounds x="1" y="1" width="1" height="1" /></bezel>
<bezel name="0.1" element="led"><bounds x="2" y="1" width="1" height="1" /></bezel>
<bezel name="0.2" element="led"><bounds x="3" y="1" width="1" height="1" /></bezel>
<bezel name="0.3" element="led"><bounds x="4" y="1" width="1" height="1" /></bezel>
</view>
</mamelayout>