mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
ffruits: Add some I/O (nw)
This commit is contained in:
parent
c69696b075
commit
f7276e6d76
@ -1,5 +1,5 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:
|
||||
// copyright-holders:AJR
|
||||
/*
|
||||
Skeleton driver for Cromptons Leisure Machines' Frantic Fruits redemption game.
|
||||
|
||||
@ -15,6 +15,8 @@
|
||||
|
||||
#include "emu.h"
|
||||
#include "cpu/mcs51/mcs51.h"
|
||||
#include "machine/74259.h"
|
||||
#include "machine/timekpr.h"
|
||||
#include "screen.h"
|
||||
|
||||
class cromptons_state : public driver_device
|
||||
@ -23,40 +25,69 @@ public:
|
||||
cromptons_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag)
|
||||
, m_maincpu(*this, "maincpu")
|
||||
, m_outlatch(*this, "outlatch%u", 0U)
|
||||
, m_inputs(*this, "IN%u", 0U)
|
||||
{ }
|
||||
|
||||
void cromptons(machine_config &config);
|
||||
|
||||
protected:
|
||||
virtual void machine_start() override;
|
||||
|
||||
private:
|
||||
required_device<cpu_device> m_maincpu;
|
||||
u8 port_r();
|
||||
void port_w(u8 data);
|
||||
|
||||
required_device<mcs51_cpu_device> m_maincpu;
|
||||
required_device_array<hc259_device, 4> m_outlatch;
|
||||
required_ioport_array<4> m_inputs;
|
||||
|
||||
void prg_map(address_map &map);
|
||||
void io_map(address_map &map);
|
||||
|
||||
u8 m_port_select;
|
||||
};
|
||||
|
||||
void cromptons_state::machine_start()
|
||||
{
|
||||
save_item(NAME(m_port_select));
|
||||
}
|
||||
|
||||
u8 cromptons_state::port_r()
|
||||
{
|
||||
return BIT(m_inputs[(m_port_select & 0x18) >> 3]->read(), m_port_select & 0x07) ? 0xff : 0x7f;
|
||||
}
|
||||
|
||||
void cromptons_state::port_w(u8 data)
|
||||
{
|
||||
if (!BIT(data, 6))
|
||||
m_outlatch[(data & 0x18) >> 3]->write_bit(data & 0x07, BIT(data, 5));
|
||||
|
||||
m_port_select = data;
|
||||
}
|
||||
|
||||
void cromptons_state::prg_map(address_map &map)
|
||||
{
|
||||
map(0x0000, 0xffff).rom();
|
||||
map(0x0000, 0xffff).rom().region("maincpu", 0);
|
||||
}
|
||||
|
||||
void cromptons_state::io_map(address_map &map)
|
||||
{
|
||||
map(0xe000, 0xffff).rw("timekpr", FUNC(timekeeper_device::read), FUNC(timekeeper_device::write));
|
||||
}
|
||||
|
||||
static INPUT_PORTS_START( cromptons )
|
||||
PORT_START("IN0")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNKNOWN)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNKNOWN)
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNKNOWN)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNKNOWN)
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNKNOWN)
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNKNOWN)
|
||||
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNKNOWN)
|
||||
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNKNOWN)
|
||||
|
||||
PORT_START("DSW1")
|
||||
PORT_START("IN1")
|
||||
PORT_DIPUNKNOWN_DIPLOC(0x01, 0x01, "SW1:1")
|
||||
PORT_DIPUNKNOWN_DIPLOC(0x02, 0x02, "SW1:2")
|
||||
PORT_DIPUNKNOWN_DIPLOC(0x04, 0x04, "SW1:3")
|
||||
@ -66,7 +97,7 @@ static INPUT_PORTS_START( cromptons )
|
||||
PORT_DIPUNKNOWN_DIPLOC(0x40, 0x40, "SW1:7")
|
||||
PORT_DIPUNKNOWN_DIPLOC(0x80, 0x80, "SW1:8")
|
||||
|
||||
PORT_START("DSW2")
|
||||
PORT_START("IN2")
|
||||
PORT_DIPUNKNOWN_DIPLOC(0x01, 0x01, "SW2:1")
|
||||
PORT_DIPUNKNOWN_DIPLOC(0x02, 0x02, "SW2:2")
|
||||
PORT_DIPUNKNOWN_DIPLOC(0x04, 0x04, "SW2:3")
|
||||
@ -75,6 +106,13 @@ static INPUT_PORTS_START( cromptons )
|
||||
PORT_DIPUNKNOWN_DIPLOC(0x20, 0x20, "SW2:6")
|
||||
PORT_DIPUNKNOWN_DIPLOC(0x40, 0x40, "SW2:7")
|
||||
PORT_DIPUNKNOWN_DIPLOC(0x80, 0x80, "SW2:8")
|
||||
|
||||
PORT_START("IN3")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNKNOWN)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNKNOWN)
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNKNOWN)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNKNOWN)
|
||||
PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
INPUT_PORTS_END
|
||||
|
||||
|
||||
@ -84,6 +122,15 @@ void cromptons_state::cromptons(machine_config &config)
|
||||
I80C32(config, m_maincpu, 11.0592_MHz_XTAL); // TS80C32X2-MCA
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &cromptons_state::prg_map);
|
||||
m_maincpu->set_addrmap(AS_IO, &cromptons_state::io_map);
|
||||
m_maincpu->port_in_cb<1>().set(FUNC(cromptons_state::port_r));
|
||||
m_maincpu->port_out_cb<1>().set(FUNC(cromptons_state::port_w));
|
||||
|
||||
MK48T08(config, "timekpr");
|
||||
|
||||
HC259(config, m_outlatch[0]); // types not verified
|
||||
HC259(config, m_outlatch[1]);
|
||||
HC259(config, m_outlatch[2]);
|
||||
HC259(config, m_outlatch[3]);
|
||||
|
||||
// sound ??
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user