summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Ivan Vangelista <mesgnet@yahoo.it>2024-05-21 18:37:02 +0200
committer Ivan Vangelista <mesgnet@yahoo.it>2024-05-21 18:37:02 +0200
commit0fcf07aab31ca258199472b85ebb0e8fcbd39005 (patch)
tree1d9d5fc8aa190bdb76dcc2b04fbaf7c3a67b00fc /src
parent80aaf80e99ccdeab2bb84d04c3d0a5eba935f3dc (diff)
skeleton/ganbaremo.cpp: added some preliminary mappings
Diffstat (limited to 'src')
-rw-r--r--src/mame/skeleton/ganbaremo.cpp188
1 files changed, 153 insertions, 35 deletions
diff --git a/src/mame/skeleton/ganbaremo.cpp b/src/mame/skeleton/ganbaremo.cpp
index 2e1320f529f..9a8d50d7b1a 100644
--- a/src/mame/skeleton/ganbaremo.cpp
+++ b/src/mame/skeleton/ganbaremo.cpp
@@ -1,9 +1,11 @@
// license:BSD-3-Clause
// copyright-holders:
+
/***************************************************************************************************
Skeleton driver for:
"Ganbare Momotarou Oni Taiji" (がんばれ ももたろう おにたいじ). Electromechanical arcade by Shoken.
+ https://www.youtube.com/watch?v=jxri_Wmoyfs
DISPLAY PCB
______________________________________________________________________________________________
@@ -58,18 +60,35 @@
| SN74LS161AN SN74LS161AN |_LM324N_| SHOKEN M904-A |:||
|__________________________________________________________________________________________|
+
+TODO:
+- figure out interrupts
+- figure out inputs
+- hook up MSM5205
+- simulate mechanical pieces via layouts
+- everything for the display PCB
*/
#include "emu.h"
#include "cpu/z80/z80.h"
#include "machine/i8255.h"
-
#include "sound/ay8910.h"
#include "sound/msm5205.h"
#include "speaker.h"
+
+// configurable logging
+#define LOG_PORTS (1U << 1)
+
+// #define VERBOSE (LOG_GENERAL | LOG_PORTS)
+
+#include "logmacro.h"
+
+#define LOGPORTS(...) LOGMASKED(LOG_PORTS, __VA_ARGS__)
+
+
namespace {
class ganbaremo_state : public driver_device
@@ -78,9 +97,7 @@ public:
ganbaremo_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag)
, m_maincpu(*this, "maincpu")
- , m_audiocpu(*this, "audiocpu")
- , m_ay8910(*this, "aysnd")
- , m_5205(*this, "musicrom")
+ , m_displaycpu(*this, "displaycpu")
{
}
@@ -88,60 +105,161 @@ public:
private:
required_device<z80_device> m_maincpu;
- required_device<z80_device> m_audiocpu;
- required_device<ay8910_device> m_ay8910;
- required_device<msm5205_device> m_5205;
+ required_device<z80_device> m_displaycpu;
+
+ void main_program_map(address_map &map);
+ void display_program_map(address_map &map);
+ void main_io_map(address_map &map);
+ void display_io_map(address_map &map);
};
-static INPUT_PORTS_START(ganbaremo)
+
+void ganbaremo_state::main_program_map(address_map &map)
+{
+ map(0x0000, 0x7fff).rom();
+ map(0x8000, 0x87ff).ram();
+}
+
+void ganbaremo_state::display_program_map(address_map &map)
+{
+ map(0x0000, 0x7fff).rom();
+ map(0x8000, 0x87ff).ram();
+}
+
+void ganbaremo_state::main_io_map(address_map &map)
+{
+ map.global_mask(0xff);
+
+ map(0x00, 0x03).rw("ppi1", FUNC(i8255_device::read), FUNC(i8255_device::write));
+ map(0x20, 0x23).rw("ppi2", FUNC(i8255_device::read), FUNC(i8255_device::write));
+ map(0x40, 0x43).rw("ppi3", FUNC(i8255_device::read), FUNC(i8255_device::write));
+ map(0x60, 0x60).w("ay8910", FUNC(ay8910_device::address_w));
+ map(0x61, 0x61).rw("ay8910", FUNC(ay8910_device::data_r), FUNC(ay8910_device::data_w));
+ //map(0x80, 0x80).w
+}
+
+void ganbaremo_state::display_io_map(address_map &map)
+{
+ map.global_mask(0xff);
+
+ // map(0x00, 0x00).w
+ // map(0x20, 0x20).w
+ // map(0x40, 0x40).w
+ // map(0x80, 0x80).w
+ // map(0xc0, 0xc0).r
+}
+
+
+static INPUT_PORTS_START( ganbaremo )
+ PORT_START("IN0")
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)
+ PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1)
+ PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1)
+ PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1)
+ PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(1)
+ PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(1)
+ PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_PLAYER(1)
+ PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_PLAYER(1)
+
+ PORT_START("IN1")
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2)
+ PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2)
+ PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(2)
+ PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(2)
+ PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(2)
+ PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(2)
+ PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_PLAYER(2)
+ PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_PLAYER(2)
+
+ PORT_START("IN2") // playing with these makes some sound effects / BGM play
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(3)
+ PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(3)
+ PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(3)
+ PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(3)
+ PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(3)
+ PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(3)
+ PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_PLAYER(3)
+ PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_PLAYER(3)
+
PORT_START("DSW0")
- PORT_DIPUNKNOWN_DIPLOC(0x01, 0x01, "SW0:1")
- PORT_DIPUNKNOWN_DIPLOC(0x02, 0x02, "SW0:2")
- PORT_DIPUNKNOWN_DIPLOC(0x04, 0x04, "SW0:3")
- PORT_DIPUNKNOWN_DIPLOC(0x08, 0x08, "SW0:4")
- PORT_DIPUNKNOWN_DIPLOC(0x10, 0x10, "SW0:5")
- PORT_DIPUNKNOWN_DIPLOC(0x20, 0x20, "SW0:6")
+ PORT_DIPUNKNOWN_DIPLOC(0x01, 0x00, "SW0:1")
+ PORT_DIPUNKNOWN_DIPLOC(0x02, 0x00, "SW0:2")
+ PORT_DIPUNKNOWN_DIPLOC(0x04, 0x00, "SW0:3")
+ PORT_DIPUNKNOWN_DIPLOC(0x08, 0x00, "SW0:4")
+ PORT_DIPUNKNOWN_DIPLOC(0x10, 0x00, "SW0:5")
+ PORT_DIPUNKNOWN_DIPLOC(0x20, 0x00, "SW0:6")
+ PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_START("DSW1")
- PORT_DIPUNKNOWN_DIPLOC(0x01, 0x01, "SW1:1")
- PORT_DIPUNKNOWN_DIPLOC(0x02, 0x02, "SW1:2")
- PORT_DIPUNKNOWN_DIPLOC(0x04, 0x04, "SW1:3")
- PORT_DIPUNKNOWN_DIPLOC(0x08, 0x08, "SW1:4")
+ PORT_DIPUNKNOWN_DIPLOC(0x01, 0x00, "SW1:1")
+ PORT_DIPUNKNOWN_DIPLOC(0x02, 0x00, "SW1:2")
+ PORT_DIPUNKNOWN_DIPLOC(0x04, 0x00, "SW1:3")
+ PORT_DIPUNKNOWN_DIPLOC(0x08, 0x00, "SW1:4")
+ PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNKNOWN )
INPUT_PORTS_END
+
void ganbaremo_state::ganbaremo(machine_config &config)
{
Z80(config, m_maincpu, 12_MHz_XTAL / 4); // Guess
+ m_maincpu->set_addrmap(AS_PROGRAM, &ganbaremo_state::main_program_map);
+ m_maincpu->set_addrmap(AS_IO, &ganbaremo_state::main_io_map);
+ m_maincpu->set_periodic_int(FUNC(ganbaremo_state::irq0_line_hold), attotime::from_hz(60*4)); // TODO: proper IRQ ack
- I8255A(config, "pia1"); // NEC D8255AC-2
- I8255A(config, "pia2"); // NEC D8255AC-2
- I8255A(config, "pia3"); // NEC D8255AC-2
+ Z80(config, m_displaycpu, 12_MHz_XTAL / 4); // Guess
+ m_displaycpu->set_addrmap(AS_PROGRAM, &ganbaremo_state::display_program_map);
+ m_displaycpu->set_addrmap(AS_IO, &ganbaremo_state::display_io_map);
- // Sound hardware
+ i8255_device &ppi1(I8255A(config, "ppi1")); // NEC D8255AC-2, inputs
+ ppi1.in_pa_callback().set([this] () { LOGPORTS("%s: PPI1 port A in\n", machine().describe_context()); return ioport("IN0")->read(); });
+ ppi1.in_pb_callback().set([this] () { LOGPORTS("%s: PPI1 port B in\n", machine().describe_context()); return ioport("IN1")->read(); });
+ ppi1.in_pc_callback().set([this] () { LOGPORTS("%s: PPI1 port C in\n", machine().describe_context()); return ioport("IN2")->read(); });
+ ppi1.out_pa_callback().set([this] (uint8_t data) { LOGPORTS("%s: PPI1 port A out %02x\n", machine().describe_context(), data); }); // doesn't seem to be written
+ ppi1.out_pb_callback().set([this] (uint8_t data) { LOGPORTS("%s: PPI1 port B out %02x\n", machine().describe_context(), data); }); // doesn't seem to be written
+ ppi1.out_pc_callback().set([this] (uint8_t data) { LOGPORTS("%s: PPI1 port C out %02x\n", machine().describe_context(), data); }); // doesn't seem to be written
- Z80(config, m_audiocpu, 12_MHz_XTAL / 4); // Guess
+ i8255_device &ppi2(I8255A(config, "ppi2")); // NEC D8255AC-2, comms to display CPU and/or MSM5205 commands?
+ ppi2.in_pa_callback().set([this] () { LOGPORTS("%s: PPI2 port A in\n", machine().describe_context()); return uint8_t(0); }); // doesn't seem to be read
+ ppi2.in_pb_callback().set([this] () { LOGPORTS("%s: PPI2 port B in\n", machine().describe_context()); return uint8_t(0); }); // doesn't seem to be read
+ ppi2.in_pc_callback().set([this] () { LOGPORTS("%s: PPI2 port C in\n", machine().describe_context()); return uint8_t(0); }); // doesn't seem to be read
+ ppi2.out_pa_callback().set([this] (uint8_t data) { LOGPORTS("%s: PPI2 port A out %02x\n", machine().describe_context(), data); }); // written
+ ppi2.out_pb_callback().set([this] (uint8_t data) { LOGPORTS("%s: PPI2 port B out %02x\n", machine().describe_context(), data); }); // written
+ ppi2.out_pc_callback().set([this] (uint8_t data) { LOGPORTS("%s: PPI2 port C out %02x\n", machine().describe_context(), data); }); // written
+ i8255_device &ppi3(I8255A(config, "ppi3")); // NEC D8255AC-2, DSW
+ ppi3.in_pa_callback().set([this] () { LOGPORTS("%s: PPI3 port A in\n", machine().describe_context()); return machine().rand(); });
+ ppi3.in_pb_callback().set([this] () { LOGPORTS("%s: PPI3 port B in\n", machine().describe_context()); return machine().rand(); });
+ ppi3.in_pc_callback().set([this] () { LOGPORTS("%s: PPI3 port C in\n", machine().describe_context()); return uint8_t(0); }); // doesn't seem to be read
+ ppi3.out_pa_callback().set([this] (uint8_t data) { LOGPORTS("%s: PPI3 port A out %02x\n", machine().describe_context(), data); }); // doesn't seem to be written
+ ppi3.out_pb_callback().set([this] (uint8_t data) { LOGPORTS("%s: PPI3 port B out %02x\n", machine().describe_context(), data); }); // doesn't seem to be written
+ ppi3.out_pc_callback().set([this] (uint8_t data) { LOGPORTS("%s: PPI3 port C out %02x\n", machine().describe_context(), data); }); // doesn't seem to be written
+
+ // Sound hardware
SPEAKER(config, "mono").front_center();
- AY8910(config, m_ay8910, 12_MHz_XTAL / 8); // Guess
- m_ay8910->port_a_read_callback().set_ioport("DSW0");
- m_ay8910->port_b_read_callback().set_ioport("DSW1");
- m_ay8910->add_route(ALL_OUTPUTS, "mono", 0.25);
+ ay8910_device &ay(AY8910(config, "ay8910", 12_MHz_XTAL / 8)); // Guess
+ ay.port_a_read_callback().set([this] () { LOGPORTS("%s: AY port A in\n", machine().describe_context()); return uint8_t(0); }); // doesn't seem to be read
+ ay.port_b_read_callback().set([this] () { LOGPORTS("%s: AY port B in\n", machine().describe_context()); return uint8_t(0); }); // doesn't seem to be read
+ ay.port_a_write_callback().set([this] (uint8_t data) { LOGPORTS("%s: AY port A out %02x\n", machine().describe_context(), data); }); // rarely written
+ ay.port_b_write_callback().set([this] (uint8_t data) { LOGPORTS("%s: AY port B out %02x\n", machine().describe_context(), data); }); // rarely written
+ ay.add_route(ALL_OUTPUTS, "mono", 0.25);
- MSM5205(config, m_5205, XTAL(384'000));
+ MSM5205(config, "msm5205", XTAL(384'000));
}
-ROM_START(ganbaremo)
- ROM_REGION(0x08000, "maincpu", 0)
- ROM_LOAD("m005_xx.bin", 0x00000, 0x08000, CRC(42a7aa23) SHA1(6140f4a7769ab35cb32e3079adbee6468f3ce880))
- ROM_REGION(0x08000, "audiocpu", 0)
- ROM_LOAD("m005_p5.bin", 0x00000, 0x08000, CRC(dddb97a6) SHA1(47465bb2cd26ddd0f80c729ef3bb3b187b684d97))
+ROM_START( ganbaremo )
+ ROM_REGION( 0x08000, "maincpu", 0 )
+ ROM_LOAD( "m005_p5.bin", 0x00000, 0x08000, CRC(dddb97a6) SHA1(47465bb2cd26ddd0f80c729ef3bb3b187b684d97) )
- ROM_REGION(0x10000, "musicrom", 0)
- ROM_LOAD("m005_v.bin", 0x00000, 0x10000, CRC(e3cb69a8) SHA1(a49878adae08d56d78d168367659ac322d7fb5eb))
+ ROM_REGION( 0x08000, "displaycpu", 0 )
+ ROM_LOAD( "m005_xx.bin", 0x00000, 0x08000, CRC(42a7aa23) SHA1(6140f4a7769ab35cb32e3079adbee6468f3ce880) )
+
+ ROM_REGION( 0x10000, "samples", 0)
+ ROM_LOAD( "m005_v.bin", 0x00000, 0x10000, CRC(e3cb69a8) SHA1(a49878adae08d56d78d168367659ac322d7fb5eb) )
ROM_END
} // anonymous namespace
+
GAME(19??, ganbaremo, 0, ganbaremo, ganbaremo, ganbaremo_state, empty_init, ROT0, "Shoken", "Ganbare Momotarou Oni Taiji", MACHINE_IS_SKELETON_MECHANICAL)