summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatarGravatar Dirk Best <mail@dirk-best.de>2020-02-26 12:53:29 +0100
committerGravatarGravatar Dirk Best <mail@dirk-best.de>2020-02-26 12:55:45 +0100
commitc2332dbf6a9000891c3f2c43853858e3e99434f9 (patch) (github)
tree2dd3ea106cf158a6f98bb8652dd415c341043027
parentcf3bba5bf8396b0097f21472d960e0f52659968e (diff)
downloadmame-c2332dbf6a9000891c3f2c43853858e3e99434f9.tar.bz2
mame-c2332dbf6a9000891c3f2c43853858e3e99434f9.zip
trvmadns: Hook up inputs using AY8910 and add a simple layout
showing the lamps and hook them up (heavy flickering fow now).
-rw-r--r--src/mame/drivers/trvmadns.cpp85
-rw-r--r--src/mame/layout/trvmadns.lay55
2 files changed, 110 insertions, 30 deletions
diff --git a/src/mame/drivers/trvmadns.cpp b/src/mame/drivers/trvmadns.cpp
index a63eb5dfce0..8c458f4df1a 100644
--- a/src/mame/drivers/trvmadns.cpp
+++ b/src/mame/drivers/trvmadns.cpp
@@ -95,40 +95,48 @@ Technology = NMOS
#include "speaker.h"
#include "tilemap.h"
+#include "trvmadns.lh"
class trvmadns_state : public driver_device
{
public:
trvmadns_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
- m_gfxram(*this, "gfxram"),
- m_tileram(*this, "tileram"),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
- m_generic_paletteram_8(*this, "paletteram") { }
+ m_generic_paletteram_8(*this, "paletteram"),
+ m_gfxram(*this, "gfxram"),
+ m_tileram(*this, "tileram"),
+ m_lamps(*this, "button_%u", 1U)
+ { }
void trvmadns(machine_config &config);
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
private:
- tilemap_t *m_bg_tilemap;
+ required_device<cpu_device> m_maincpu;
+ required_device<gfxdecode_device> m_gfxdecode;
+ required_device<palette_device> m_palette;
+ required_shared_ptr<uint8_t> m_generic_paletteram_8;
required_shared_ptr<uint8_t> m_gfxram;
required_shared_ptr<uint8_t> m_tileram;
+ output_finder<6> m_lamps;
+
+ tilemap_t *m_bg_tilemap;
int m_old_data;
DECLARE_WRITE8_MEMBER(trvmadns_banking_w);
DECLARE_WRITE8_MEMBER(trvmadns_gfxram_w);
DECLARE_WRITE8_MEMBER(trvmadns_palette_w);
DECLARE_WRITE8_MEMBER(w2);
- DECLARE_WRITE8_MEMBER(w3);
+ DECLARE_WRITE8_MEMBER(lamps_w);
DECLARE_WRITE8_MEMBER(trvmadns_tileram_w);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
- virtual void machine_reset() override;
- virtual void video_start() override;
uint32_t screen_update_trvmadns(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- required_device<cpu_device> m_maincpu;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
- required_shared_ptr<uint8_t> m_generic_paletteram_8;
void cpu_map(address_map &map);
void io_map(address_map &map);
};
@@ -234,12 +242,19 @@ WRITE8_MEMBER(trvmadns_state::w2)
*/
}
-WRITE8_MEMBER(trvmadns_state::w3)
+WRITE8_MEMBER(trvmadns_state::lamps_w)
{
-/* static int old = -1;
- if(data!=old)
- logerror("w3 = %02X\n",old=data);
-*/
+ // 7------- not used
+ // -6------ start button led
+ // --5----- not used
+ // ---43210 button lamps 5 to 1
+
+ m_lamps[0] = BIT(data, 0); // button 1
+ m_lamps[1] = BIT(data, 1); // button 2
+ m_lamps[2] = BIT(data, 2); // button 3
+ m_lamps[3] = BIT(data, 3); // button 4
+ m_lamps[4] = BIT(data, 4); // button 5
+ m_lamps[5] = BIT(data, 6); // button start
}
WRITE8_MEMBER(trvmadns_state::trvmadns_tileram_w)
@@ -266,31 +281,32 @@ void trvmadns_state::cpu_map(address_map &map)
map(0x6000, 0x6fff).bankr("bank1");
map(0x7000, 0x7fff).bankr("bank2");
map(0x6000, 0x7fff).w(FUNC(trvmadns_state::trvmadns_gfxram_w)).share("gfxram");
- map(0x8000, 0x87ff).ram();
- map(0xa000, 0xa7ff).ram().w(FUNC(trvmadns_state::trvmadns_tileram_w)).share("tileram");
+ map(0x8000, 0x87ff).ram(); // u3
+ map(0xa000, 0xa7ff).ram().w(FUNC(trvmadns_state::trvmadns_tileram_w)).share("tileram"); // u17
map(0xc000, 0xc01f).ram().w(FUNC(trvmadns_state::trvmadns_palette_w)).share("paletteram");
map(0xe000, 0xe000).w(FUNC(trvmadns_state::w2));//NOP
- map(0xe004, 0xe004).w(FUNC(trvmadns_state::w3));//NOP
+ map(0xe004, 0xe004).w(FUNC(trvmadns_state::lamps_w));
}
void trvmadns_state::io_map(address_map &map)
{
map.global_mask(0xff);
- map(0x00, 0x01).w("aysnd", FUNC(ay8910_device::address_data_w));
- map(0x02, 0x02).portr("IN0");
+ map(0x00, 0x00).w("aysnd", FUNC(ay8910_device::address_w));
+ map(0x01, 0x01).w("aysnd", FUNC(ay8910_device::data_w));
+ map(0x02, 0x02).r("aysnd", FUNC(ay8910_device::data_r));
map(0x80, 0x80).w(FUNC(trvmadns_state::trvmadns_banking_w));
}
static INPUT_PORTS_START( trvmadns )
PORT_START("IN0")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_POKER_HOLD1 )
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_POKER_HOLD2 )
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_POKER_HOLD3 )
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_POKER_HOLD4 )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_POKER_HOLD5 )
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 )
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
- PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
+ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_POKER_HOLD1)
+ PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_POKER_HOLD2)
+ PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_POKER_HOLD3)
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_POKER_HOLD4)
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_POKER_HOLD5)
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_COIN1)
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_START1)
+ PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_SERVICE)
INPUT_PORTS_END
static const gfx_layout charlayout =
@@ -383,6 +399,11 @@ uint32_t trvmadns_state::screen_update_trvmadns(screen_device &screen, bitmap_in
return 0;
}
+void trvmadns_state::machine_start()
+{
+ m_lamps.resolve();
+}
+
void trvmadns_state::machine_reset()
{
m_old_data = -1;
@@ -410,7 +431,11 @@ void trvmadns_state::trvmadns(machine_config &config)
/* sound hardware */
SPEAKER(config, "mono").front_center();
- AY8910(config, "aysnd", XTAL(10'000'000)/2/4).add_route(ALL_OUTPUTS, "mono", 1.0); //?
+ ay8910_device &aysnd(AY8910(config, "aysnd", XTAL(10'000'000)/2/4)); //?
+ aysnd.port_a_read_callback().set_ioport("IN0");
+ aysnd.add_route(ALL_OUTPUTS, "mono", 1.0);
+
+ config.set_default_layout(layout_trvmadns);
}
diff --git a/src/mame/layout/trvmadns.lay b/src/mame/layout/trvmadns.lay
new file mode 100644
index 00000000000..9a358c81465
--- /dev/null
+++ b/src/mame/layout/trvmadns.lay
@@ -0,0 +1,55 @@
+<?xml version="1.0"?>
+
+<!--
+license: CC0
+copyright-holders: Dirk Best
+Simple layout for Trivia Madness
+-->
+
+<mamelayout version="2">
+ <element name="background">
+ </element>
+ <element name="button" defstate="0">
+ <rect state="0">
+ <color red="0.2" green="0.2" blue="0.2" />
+ </rect>
+ <rect state="1">
+ <color red="0.8" green="0.8" blue="0.8" />
+ </rect>
+ </element>
+ <element name="start" defstate="0">
+ <rect state="0">
+ <color red="0.2" green="0.2" blue="0.2" />
+ </rect>
+ <rect state="1">
+ <color red="0.8" green="0.8" blue="0.8" />
+ </rect>
+ <text string="START"><color red="0.1" green="0.1" blue="0.1" /></text>
+ </element>
+ <view name="Buttons">
+ <backdrop element="background">
+ <bounds x="0" y="0" width="640" height="640" />
+ </backdrop>
+ <screen index="0">
+ <bounds left="0" top="0" right="640" bottom="480" />
+ </screen>
+ <cpanel name="button_1" element="button" inputtag="IN0" inputmask="0x01">
+ <bounds x="80" y="505" width="70" height="35" />
+ </cpanel>
+ <cpanel name="button_2" element="button" inputtag="IN0" inputmask="0x02">
+ <bounds x="180" y="505" width="70" height="35" />
+ </cpanel>
+ <cpanel name="button_3" element="button" inputtag="IN0" inputmask="0x04">
+ <bounds x="280" y="505" width="70" height="35" />
+ </cpanel>
+ <cpanel name="button_4" element="button" inputtag="IN0" inputmask="0x08">
+ <bounds x="380" y="505" width="70" height="35" />
+ </cpanel>
+ <cpanel name="button_5" element="button" inputtag="IN0" inputmask="0x10">
+ <bounds x="480" y="505" width="70" height="35" />
+ </cpanel>
+ <cpanel name="button_6" element="start" inputtag="IN0" inputmask="0x40">
+ <bounds x="250" y="565" width="130" height="35" />
+ </cpanel>
+ </view>
+</mamelayout>