summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Robbbert <Robbbert@users.noreply.github.com>2022-02-21 05:39:53 +1100
committer Robbbert <Robbbert@users.noreply.github.com>2022-02-21 05:39:53 +1100
commit035d0c926d734182b5dfaf880deca98293058b16 (patch)
tree35bb396919fda00d9fe6922d90f7d5e9c8ae944a
parent9782118a7e707671808556db38a69207ce750bc5 (diff)
alvg: added a layout.
-rw-r--r--src/mame/drivers/alvg.cpp64
-rw-r--r--src/mame/layout/alvg.lay145
2 files changed, 199 insertions, 10 deletions
diff --git a/src/mame/drivers/alvg.cpp b/src/mame/drivers/alvg.cpp
index 5d7cf88346f..1c1eb8ba2d8 100644
--- a/src/mame/drivers/alvg.cpp
+++ b/src/mame/drivers/alvg.cpp
@@ -43,6 +43,7 @@ ToDo:
#include "sound/okim6295.h"
#include "sound/ymopl.h"
#include "speaker.h"
+#include "alvg.lh"
namespace {
@@ -58,10 +59,12 @@ public:
, m_ppi0(*this, "ppi0")
, m_ppi1(*this, "ppi1")
, m_ppi2(*this, "ppi2")
+ , m_ppi3(*this, "ppi3")
, m_via(*this, "via")
, m_via0(*this, "via0")
, m_via1(*this, "via1")
, m_io_keyboard(*this, "X%d", 0U)
+ , m_digits(*this, "digit%d", 0U)
, m_io_outputs(*this, "out%d", 0U)
{ }
@@ -82,6 +85,9 @@ private:
void ppi2_pa_w(u8 data) { m_lamp_data = (m_lamp_data & 0xff00) | data; }
void ppi2_pb_w(u8 data) { m_lamp_data = (m_lamp_data & 0xff) | (data << 8); }
void ppi2_pc_w(u8 data);
+ void ppi3_pa_w(u8 data);
+ void ppi3_pb_w(u8 data);
+ void ppi3_pc_w(u8 data);
void via_pb_w(u8 data);
u8 via0_pa_r();
u8 via0_pb_r() { return m_io_keyboard[12]->read(); }
@@ -89,16 +95,19 @@ private:
u16 m_row = 0U;
u16 m_lamp_data = 0U;
+ u8 m_strobe = 0U;
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
required_device<okim6295_device> m_oki;
required_device<i8255_device> m_ppi0;
required_device<i8255_device> m_ppi1;
required_device<i8255_device> m_ppi2;
+ required_device<i8255_device> m_ppi3;
required_device<via6522_device> m_via;
required_device<via6522_device> m_via0;
required_device<via6522_device> m_via1;
required_ioport_array<13> m_io_keyboard;
+ output_finder<40> m_digits;
output_finder<128> m_io_outputs; // 32 solenoids + 96 lamps
};
@@ -110,7 +119,8 @@ void alvg_state::main_map(address_map &map)
map(0x2000, 0x2003).mirror(0x3f0).rw(m_ppi0, FUNC(i8255_device::read), FUNC(i8255_device::write)); // U12
map(0x2400, 0x2403).mirror(0x3f0).rw(m_ppi1, FUNC(i8255_device::read), FUNC(i8255_device::write)); // U13
map(0x2800, 0x2803).mirror(0x3f0).rw(m_ppi2, FUNC(i8255_device::read), FUNC(i8255_device::write)); // U14
- map(0x2c00, 0x2cff).mirror(0x300).w(FUNC(alvg_state::display_w));
+ map(0x2c00, 0x2c00).mirror(0x37f).w(FUNC(alvg_state::display_w));
+ map(0x2c80, 0x2c83).mirror(0x37c).rw(m_ppi3, FUNC(i8255_device::read), FUNC(i8255_device::write)); // IC1 on display board
map(0x3800, 0x380f).mirror(0x3f0).m("via1", FUNC(via6522_device::map)); // U8
map(0x3c00, 0x3c0f).mirror(0x3f0).m("via0", FUNC(via6522_device::map)); // U7
}
@@ -138,7 +148,7 @@ static INPUT_PORTS_START( alvg )
PORT_START("X1")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START )
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_X) PORT_NAME("INP10") // Tilt on Mystery Castle, Punchy, Pistol Pete
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_X) PORT_NAME("INP10") // Tilt on Mystery Castle, Punchy, Pistol Poker
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_NAME("INP11")
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_B) PORT_NAME("INP12")
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_NAME("INP13")
@@ -201,7 +211,7 @@ static INPUT_PORTS_START( alvg )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_PGUP) PORT_NAME("INP58")
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("INP59")
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME("INP60")
- // From here, these inputs only used by Pistol Pete
+ // From here, these inputs only used by Pistol Poker
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME("INP61")
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("INP62")
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("INP63")
@@ -238,11 +248,6 @@ static INPUT_PORTS_START( alvg )
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("Test")
INPUT_PORTS_END
-void alvg_state::display_w(offs_t offset, u8 data)
-{
- //printf("%X:%X ",offset,data);
-}
-
void alvg_state::ppi2_pc_w(u8 data)
{
for (u8 i = 0; i < 12; i++)
@@ -251,6 +256,30 @@ void alvg_state::ppi2_pc_w(u8 data)
m_io_outputs[24U+8*i+j] = BIT(data, j);
}
+void alvg_state::ppi3_pa_w(u8 data)
+{
+ u16 t = m_digits[m_strobe] & 0xff00;
+ m_digits[m_strobe] = t | data;
+}
+
+void alvg_state::ppi3_pb_w(u8 data)
+{
+ u16 t = m_digits[m_strobe] & 0xff;
+ m_digits[m_strobe] = t | (data << 8);
+}
+
+void alvg_state::ppi3_pc_w(u8 data)
+{
+ u16 t = m_digits[m_strobe+20] & 0xff00;
+ m_digits[m_strobe+20] = t | data;
+}
+
+void alvg_state::display_w(offs_t offset, u8 data)
+{
+ u16 t = m_digits[m_strobe+20] & 0xff;
+ m_digits[m_strobe+20] = t | (data << 8);
+}
+
void alvg_state::via_pb_w(u8 data)
{
m_via1->write_ca1(BIT(data, 1));
@@ -259,6 +288,12 @@ void alvg_state::via_pb_w(u8 data)
void alvg_state::via1_pb_w(u8 data)
{
m_via->write_ca2(BIT(data, 1));
+ if ((data & 0x38)==0)
+ {
+ m_strobe++;
+ if (m_strobe > 19)
+ m_strobe = 0;
+ }
}
u8 alvg_state::via0_pa_r()
@@ -275,7 +310,7 @@ void alvg_state::machine_start()
{
genpin_class::machine_start();
- //m_digits.resolve();
+ m_digits.resolve();
m_io_outputs.resolve();
save_item(NAME(m_row));
@@ -287,6 +322,7 @@ void alvg_state::machine_reset()
genpin_class::machine_reset();
for (u8 i = 0; i < m_io_outputs.size(); i++)
m_io_outputs[i] = 0;
+ m_strobe = 0U;
}
void alvg_state::alvg(machine_config &config)
@@ -297,6 +333,9 @@ void alvg_state::alvg(machine_config &config)
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
+ /* Video */
+ config.set_default_layout(layout_alvg);
+
MOS6522(config, m_via0, XTAL(4'000'000) / 2); // U7, uses clock2 from maincpu; switch inputs
m_via0->readpa_handler().set(FUNC(alvg_state::via0_pa_r));
m_via0->readpb_handler().set(FUNC(alvg_state::via0_pb_r));
@@ -308,7 +347,7 @@ void alvg_state::alvg(machine_config &config)
MOS6522(config, m_via1, XTAL(4'000'000) / 2); // U8, uses clock2 from maincpu; port A = to sound; port B = serial to display
//m_via1->readpb_handler().set(FUNC(alvg_state::via1_pb_r));
- m_via1->writepa_handler().set("via", FUNC(via6522_device::write_pa));
+ m_via1->writepa_handler().set(m_via, FUNC(via6522_device::write_pa));
m_via1->writepb_handler().set(FUNC(alvg_state::via1_pb_w));
//m_via1->ca2_handler().set_nop();
//m_via1->cb2_handler().set_nop();
@@ -329,6 +368,11 @@ void alvg_state::alvg(machine_config &config)
m_ppi2->out_pb_callback().set(FUNC(alvg_state::ppi2_pb_w)); // Lamps
m_ppi2->out_pc_callback().set(FUNC(alvg_state::ppi2_pc_w)); // Lamps
+ I8255A(config, m_ppi3); // U14
+ m_ppi3->out_pa_callback().set(FUNC(alvg_state::ppi3_pa_w)); // Alpha Display
+ m_ppi3->out_pb_callback().set(FUNC(alvg_state::ppi3_pb_w)); // Alpha Display
+ m_ppi3->out_pc_callback().set(FUNC(alvg_state::ppi3_pc_w)); // Alpha Display
+
// Sound
MC6809(config, m_audiocpu, XTAL(8'000'000)); // 68B09, 8 MHz crystal, internal divide by 4 to produce E/Q outputs
m_audiocpu->set_addrmap(AS_PROGRAM, &alvg_state::audio_map);
diff --git a/src/mame/layout/alvg.lay b/src/mame/layout/alvg.lay
new file mode 100644
index 00000000000..42725a3e15c
--- /dev/null
+++ b/src/mame/layout/alvg.lay
@@ -0,0 +1,145 @@
+<?xml version="1.0"?>
+<!--
+license:CC0
+-->
+
+<mamelayout version="2">
+
+ <element name="digit" defstate="0">
+ <led14segsc>
+ <color red="0.0" green="0.75" blue="1.0" />
+ </led14segsc>
+ </element>
+ <element name="P3"><text string="Player 1"><color red="1.0" green="1.0" blue="1.0" /></text></element>
+ <element name="P4"><text string="Player 2"><color red="1.0" green="1.0" blue="1.0" /></text></element>
+ <element name="P5"><text string="Player 3"><color red="1.0" green="1.0" blue="1.0" /></text></element>
+ <element name="P6"><text string="Player 4"><color red="1.0" green="1.0" blue="1.0" /></text></element>
+
+ <view name="Default Layout">
+ <bounds left="0" top="25" right="496" bottom="149" />
+
+ <!-- Top Row -->
+ <element name="digit0" ref="digit">
+ <bounds left="10" top="45" right="30" bottom="84" />
+ </element>
+ <element name="digit1" ref="digit">
+ <bounds left="34" top="45" right="54" bottom="84" />
+ </element>
+ <element name="digit2" ref="digit">
+ <bounds left="58" top="45" right="78" bottom="84" />
+ </element>
+ <element name="digit3" ref="digit">
+ <bounds left="82" top="45" right="102" bottom="84" />
+ </element>
+ <element name="digit4" ref="digit">
+ <bounds left="106" top="45" right="126" bottom="84" />
+ </element>
+ <element name="digit5" ref="digit">
+ <bounds left="130" top="45" right="150" bottom="84" />
+ </element>
+ <element name="digit6" ref="digit">
+ <bounds left="154" top="45" right="174" bottom="84" />
+ </element>
+ <element name="digit7" ref="digit">
+ <bounds left="178" top="45" right="198" bottom="84" />
+ </element>
+ <element name="digit8" ref="digit">
+ <bounds left="202" top="45" right="222" bottom="84" />
+ </element>
+ <element name="digit9" ref="digit">
+ <bounds left="226" top="45" right="246" bottom="84" />
+ </element>
+ <element name="digit10" ref="digit">
+ <bounds left="250" top="45" right="270" bottom="84" />
+ </element>
+ <element name="digit11" ref="digit">
+ <bounds left="274" top="45" right="294" bottom="84" />
+ </element>
+ <element name="digit12" ref="digit">
+ <bounds left="298" top="45" right="318" bottom="84" />
+ </element>
+ <element name="digit13" ref="digit">
+ <bounds left="322" top="45" right="342" bottom="84" />
+ </element>
+ <element name="digit14" ref="digit">
+ <bounds left="346" top="45" right="366" bottom="84" />
+ </element>
+ <element name="digit15" ref="digit">
+ <bounds left="370" top="45" right="390" bottom="84" />
+ </element>
+ <element name="digit16" ref="digit">
+ <bounds left="394" top="45" right="414" bottom="84" />
+ </element>
+ <element name="digit17" ref="digit">
+ <bounds left="418" top="45" right="438" bottom="84" />
+ </element>
+ <element name="digit18" ref="digit">
+ <bounds left="442" top="45" right="462" bottom="84" />
+ </element>
+ <element name="digit19" ref="digit">
+ <bounds left="466" top="45" right="486" bottom="84" />
+ </element>
+
+ <!-- Bottom Row -->
+ <element name="digit20" ref="digit">
+ <bounds left="10" top="100" right="30" bottom="139" />
+ </element>
+ <element name="digit21" ref="digit">
+ <bounds left="34" top="100" right="54" bottom="139" />
+ </element>
+ <element name="digit22" ref="digit">
+ <bounds left="58" top="100" right="78" bottom="139" />
+ </element>
+ <element name="digit23" ref="digit">
+ <bounds left="82" top="100" right="102" bottom="139" />
+ </element>
+ <element name="digit24" ref="digit">
+ <bounds left="106" top="100" right="126" bottom="139" />
+ </element>
+ <element name="digit25" ref="digit">
+ <bounds left="130" top="100" right="150" bottom="139" />
+ </element>
+ <element name="digit26" ref="digit">
+ <bounds left="154" top="100" right="174" bottom="139" />
+ </element>
+ <element name="digit27" ref="digit">
+ <bounds left="178" top="100" right="198" bottom="139" />
+ </element>
+ <element name="digit28" ref="digit">
+ <bounds left="202" top="100" right="222" bottom="139" />
+ </element>
+ <element name="digit29" ref="digit">
+ <bounds left="226" top="100" right="246" bottom="139" />
+ </element>
+ <element name="digit30" ref="digit">
+ <bounds left="250" top="100" right="270" bottom="139" />
+ </element>
+ <element name="digit31" ref="digit">
+ <bounds left="274" top="100" right="294" bottom="139" />
+ </element>
+ <element name="digit32" ref="digit">
+ <bounds left="298" top="100" right="318" bottom="139" />
+ </element>
+ <element name="digit33" ref="digit">
+ <bounds left="322" top="100" right="342" bottom="139" />
+ </element>
+ <element name="digit34" ref="digit">
+ <bounds left="346" top="100" right="366" bottom="139" />
+ </element>
+ <element name="digit35" ref="digit">
+ <bounds left="370" top="100" right="390" bottom="139" />
+ </element>
+ <element name="digit36" ref="digit">
+ <bounds left="394" top="100" right="414" bottom="139" />
+ </element>
+ <element name="digit37" ref="digit">
+ <bounds left="418" top="100" right="438" bottom="139" />
+ </element>
+ <element name="digit38" ref="digit">
+ <bounds left="442" top="100" right="462" bottom="139" />
+ </element>
+ <element name="digit39" ref="digit">
+ <bounds left="466" top="100" right="486" bottom="139" />
+ </element>
+ </view>
+</mamelayout>