summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Sterophonick <34801996+Sterophonick@users.noreply.github.com>2020-02-27 08:35:52 -0700
committer GitHub <noreply@github.com>2020-02-27 10:35:51 -0500
commit6c3e1da14a0484e2aaafa87c805440a5e41d5a7f (patch)
tree2b026422cf66595d96380ec1504444220578c4eb /src
parent673232ea59df2c7fec1f59592cd0ed62bbd5ff9b (diff)
gigatron: add some meat on the bones (#6347)
* gigatron: make some changes (nw) * gigatron: add some meat on the bones * gigatron: make some fixes that ajr needed (nw) * (nw) * (nw) * (nw) * gigatron: make outx a callback (nw) * (nw) * (nw)
Diffstat (limited to 'src')
-rw-r--r--src/devices/cpu/gigatron/gigatron.cpp3
-rw-r--r--src/devices/cpu/gigatron/gigatron.h5
-rw-r--r--src/mame/drivers/gigatron.cpp30
3 files changed, 33 insertions, 5 deletions
diff --git a/src/devices/cpu/gigatron/gigatron.cpp b/src/devices/cpu/gigatron/gigatron.cpp
index 643e99dabe5..dc4f38cc3fe 100644
--- a/src/devices/cpu/gigatron/gigatron.cpp
+++ b/src/devices/cpu/gigatron/gigatron.cpp
@@ -119,6 +119,8 @@ void gigatron_cpu_device::init()
save_item(NAME(m_ppc));
save_item(NAME(m_inReg));
save_item(NAME(m_pc));
+
+ m_outx_cb.resolve_safe();
}
void gigatron_cpu_device::branchOp(uint8_t op, uint8_t mode, uint8_t bus, uint8_t d)
@@ -314,6 +316,7 @@ gigatron_cpu_device::gigatron_cpu_device(const machine_config &mconfig, const ch
, m_ramMask(0x7fff)
, m_program_config("program", ENDIANNESS_BIG, 16, 14, -1)
, m_data_config("data", ENDIANNESS_BIG, 8, 15, 0)
+ , m_outx_cb(*this)
{
}
diff --git a/src/devices/cpu/gigatron/gigatron.h b/src/devices/cpu/gigatron/gigatron.h
index 7ef0b9018b7..e11f48d226a 100644
--- a/src/devices/cpu/gigatron/gigatron.h
+++ b/src/devices/cpu/gigatron/gigatron.h
@@ -25,7 +25,8 @@ class gigatron_cpu_device : public cpu_device
public:
// construction/destruction
gigatron_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
+ auto outx_cb() { return m_outx_cb.bind(); }
+
protected:
// device-level overrides
virtual void device_start() override;
@@ -76,6 +77,8 @@ private:
int m_icount;
void gigatron_illegal();
+
+ devcb_write8 m_outx_cb;
};
diff --git a/src/mame/drivers/gigatron.cpp b/src/mame/drivers/gigatron.cpp
index 19b5cd459bc..acea33c2f5a 100644
--- a/src/mame/drivers/gigatron.cpp
+++ b/src/mame/drivers/gigatron.cpp
@@ -1,5 +1,5 @@
// license:BSD-3-Clause
-// copyright-holders:Sterophonick
+// copyright-holders:Sterophonick, Phil Thomas
/***************************************************************************
Skeleton driver for Gigatron TTL Microcomputer
@@ -21,8 +21,9 @@ class gigatron_state : public driver_device
{
public:
gigatron_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag)
- , m_maincpu(*this, "maincpu")
+ : driver_device(mconfig, type, tag),
+ m_maincpu(*this, "maincpu"),
+ m_io_inputs(*this, "GAMEPAD")
{
}
@@ -38,13 +39,18 @@ private:
void prog_map(address_map &map);
void data_map(address_map &map);
+
+ uint16_t lights_changed;
DECLARE_READ8_MEMBER(gigatron_random)
{
return machine().rand() & 0xff;
}
+
+ DECLARE_WRITE8_MEMBER(blinkenlights);
- required_device<cpu_device> m_maincpu;
+ required_device<gigatron_cpu_device> m_maincpu;
+ required_ioport m_io_inputs;
};
uint32_t gigatron_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
@@ -70,7 +76,22 @@ void gigatron_state::machine_reset()
{
}
+WRITE8_MEMBER(gigatron_state::blinkenlights)
+{
+ uint16_t light = data & 0xF;
+ lights_changed ^= light;
+}
+
static INPUT_PORTS_START(gigatron)
+ PORT_START("GAMEPAD")
+ PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
+ PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
+ PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
+ PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
+ PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(1) // START
+ PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SELECT ) PORT_PLAYER(1) // SELECT
+ PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("B Button") PORT_PLAYER(1) // B Button
+ PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("A Button") PORT_PLAYER(1) // A Button
INPUT_PORTS_END
void gigatron_state::gigatron(machine_config &config)
@@ -78,6 +99,7 @@ void gigatron_state::gigatron(machine_config &config)
GTRON(config, m_maincpu, MAIN_CLOCK);
m_maincpu->set_addrmap(AS_PROGRAM, &gigatron_state::prog_map);
m_maincpu->set_addrmap(AS_DATA, &gigatron_state::data_map);
+ m_maincpu->outx_cb().set(FUNC(gigatron_state::blinkenlights));
/* video hardware */
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));