summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/meyc8088.cpp
diff options
context:
space:
mode:
author Ivan Vangelista <mesgnet@yahoo.it>2018-05-12 09:14:17 +0200
committer Ivan Vangelista <mesgnet@yahoo.it>2018-05-12 09:14:17 +0200
commiteaffd4b5a4f15dafbd2fc356b3cf0f0f409e076d (patch)
tree814c39bbae76e8d887009d9a884e3414e8e243c3 /src/mame/drivers/meyc8088.cpp
parentff3481e806c840ca788cec3978c5f63873cc5d0d (diff)
mey8088.cpp: output_finder (nw)
Diffstat (limited to 'src/mame/drivers/meyc8088.cpp')
-rw-r--r--src/mame/drivers/meyc8088.cpp72
1 files changed, 44 insertions, 28 deletions
diff --git a/src/mame/drivers/meyc8088.cpp b/src/mame/drivers/meyc8088.cpp
index 7e0bc79ddbd..b55f9ff3cbc 100644
--- a/src/mame/drivers/meyc8088.cpp
+++ b/src/mame/drivers/meyc8088.cpp
@@ -44,14 +44,23 @@ public:
m_maincpu(*this,"maincpu"),
m_vram(*this, "vram"),
m_heartbeat(*this, "heartbeat"),
- m_switches(*this, {"C0", "C1", "C2", "C3"})
+ m_switches(*this, {"C0", "C1", "C2", "C3"}),
+ m_lamps(*this, "lamp%u", 0U)
{ }
+ void meyc8088(machine_config &config);
+
+protected:
+ virtual void machine_start() override;
+
+private:
required_device<cpu_device> m_maincpu;
required_shared_ptr<uint8_t> m_vram;
required_device<timer_device> m_heartbeat;
- optional_ioport_array<4> m_switches;
+ required_ioport_array<4> m_switches;
+
+ output_finder<16> m_lamps;
uint8_t m_status;
uint8_t m_common;
@@ -61,17 +70,16 @@ public:
DECLARE_READ8_MEMBER(video5_flip_r);
DECLARE_WRITE8_MEMBER(screen_flip_w);
DECLARE_READ8_MEMBER(screen_flip_r);
- DECLARE_READ8_MEMBER(meyc8088_input_r);
- DECLARE_READ8_MEMBER(meyc8088_status_r);
- DECLARE_WRITE8_MEMBER(meyc8088_lights1_w);
- DECLARE_WRITE8_MEMBER(meyc8088_lights2_w);
- DECLARE_WRITE8_MEMBER(meyc8088_common_w);
+ DECLARE_READ8_MEMBER(input_r);
+ DECLARE_READ8_MEMBER(status_r);
+ DECLARE_WRITE8_MEMBER(lights1_w);
+ DECLARE_WRITE8_MEMBER(lights2_w);
+ DECLARE_WRITE8_MEMBER(common_w);
DECLARE_PALETTE_INIT(meyc8088);
- uint32_t screen_update_meyc8088(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- DECLARE_WRITE_LINE_MEMBER(screen_vblank_meyc8088);
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ DECLARE_WRITE_LINE_MEMBER(screen_vblank);
TIMER_DEVICE_CALLBACK_MEMBER(heartbeat_callback);
- void meyc8088(machine_config &config);
void meyc8088_map(address_map &map);
};
@@ -131,7 +139,7 @@ PALETTE_INIT_MEMBER(meyc8088_state, meyc8088)
palette.set_pen_colors(0, rgb);
}
-uint32_t meyc8088_state::screen_update_meyc8088(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+uint32_t meyc8088_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
uint8_t v[5];
v[4] = m_status << 2 & 0x10; // video5: color prom d4
@@ -160,7 +168,7 @@ uint32_t meyc8088_state::screen_update_meyc8088(screen_device &screen, bitmap_in
return 0;
}
-WRITE_LINE_MEMBER(meyc8088_state::screen_vblank_meyc8088)
+WRITE_LINE_MEMBER(meyc8088_state::screen_vblank)
{
// LC255(200ns pulse) rising edge asserts INTR at start and end of vblank
// INTA wired back to INTR to clear it, vector is hardwired to $20
@@ -231,7 +239,7 @@ void meyc8088_state::meyc8088_map(address_map &map)
}
-READ8_MEMBER(meyc8088_state::meyc8088_input_r)
+READ8_MEMBER(meyc8088_state::input_r)
{
uint8_t ret = 0xff;
@@ -244,7 +252,7 @@ READ8_MEMBER(meyc8088_state::meyc8088_input_r)
return ret;
}
-READ8_MEMBER(meyc8088_state::meyc8088_status_r)
+READ8_MEMBER(meyc8088_state::status_r)
{
// d0: /CR2
// d1: screen on
@@ -256,21 +264,21 @@ READ8_MEMBER(meyc8088_state::meyc8088_status_r)
}
-WRITE8_MEMBER(meyc8088_state::meyc8088_lights1_w)
+WRITE8_MEMBER(meyc8088_state::lights1_w)
{
// lite 1-8
for (int i = 0; i < 8; i++)
- output().set_lamp_value(i, ~data >> i & 1);
+ m_lamps[i] = BIT(~data, i);
}
-WRITE8_MEMBER(meyc8088_state::meyc8088_lights2_w)
+WRITE8_MEMBER(meyc8088_state::lights2_w)
{
// lite 9-16
for (int i = 0; i < 8; i++)
- output().set_lamp_value(i + 8, ~data >> i & 1);
+ m_lamps[i + 8] = BIT(~data, i);
}
-WRITE8_MEMBER(meyc8088_state::meyc8088_common_w)
+WRITE8_MEMBER(meyc8088_state::common_w)
{
// d0: /CR2
m_status = (m_status & ~1) | (data & 1);
@@ -282,6 +290,14 @@ WRITE8_MEMBER(meyc8088_state::meyc8088_common_w)
m_common = data >> 2 & 0xf;
}
+void meyc8088_state::machine_start()
+{
+ m_lamps.resolve();
+
+ save_item(NAME(m_status));
+ save_item(NAME(m_common));
+}
+
/***************************************************************************
@@ -350,21 +366,21 @@ INPUT_PORTS_END
MACHINE_CONFIG_START(meyc8088_state::meyc8088)
/* basic machine hardware */
- MCFG_DEVICE_ADD("maincpu", I8088, (XTAL(15'000'000) / 3) * 0.95) // NOTE: underclocked to prevent errors on diagnostics, MAME i8088 cycle timing is probably inaccurate
+ MCFG_DEVICE_ADD(m_maincpu, I8088, (XTAL(15'000'000) / 3) * 0.95) // NOTE: underclocked to prevent errors on diagnostics, MAME i8088 cycle timing is probably inaccurate
MCFG_DEVICE_PROGRAM_MAP(meyc8088_map)
MCFG_DEVICE_ADD("i8155_1", I8155, XTAL(15'000'000) / (3*1))
// all ports set to input
- MCFG_I8155_IN_PORTA_CB(READ8(*this, meyc8088_state, meyc8088_input_r))
+ MCFG_I8155_IN_PORTA_CB(READ8(*this, meyc8088_state, input_r))
MCFG_I8155_IN_PORTB_CB(IOPORT("SW"))
- MCFG_I8155_IN_PORTC_CB(READ8(*this, meyc8088_state, meyc8088_status_r))
+ MCFG_I8155_IN_PORTC_CB(READ8(*this, meyc8088_state, status_r))
// i8251A trigger txc/rxc (debug related, unpopulated on sold boards)
MCFG_DEVICE_ADD("i8155_2", I8155, XTAL(15'000'000) / (3*32))
// all ports set to output
- MCFG_I8155_OUT_PORTA_CB(WRITE8(*this, meyc8088_state, meyc8088_lights2_w))
- MCFG_I8155_OUT_PORTB_CB(WRITE8(*this, meyc8088_state, meyc8088_lights1_w))
- MCFG_I8155_OUT_PORTC_CB(WRITE8(*this, meyc8088_state, meyc8088_common_w))
+ MCFG_I8155_OUT_PORTA_CB(WRITE8(*this, meyc8088_state, lights2_w))
+ MCFG_I8155_OUT_PORTB_CB(WRITE8(*this, meyc8088_state, lights1_w))
+ MCFG_I8155_OUT_PORTC_CB(WRITE8(*this, meyc8088_state, common_w))
MCFG_I8155_OUT_TIMEROUT_CB(WRITELINE("dac", dac_bit_interface, write))
MCFG_NVRAM_ADD_0FILL("nvram")
@@ -374,8 +390,8 @@ MACHINE_CONFIG_START(meyc8088_state::meyc8088)
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(XTAL(15'000'000)/3, 320, 0, 256, 261, 0, 224)
- MCFG_SCREEN_UPDATE_DRIVER(meyc8088_state, screen_update_meyc8088)
- MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, meyc8088_state, screen_vblank_meyc8088))
+ MCFG_SCREEN_UPDATE_DRIVER(meyc8088_state, screen_update)
+ MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, meyc8088_state, screen_vblank))
MCFG_SCREEN_PALETTE("palette")
MCFG_PALETTE_ADD("palette", 32)
@@ -401,4 +417,4 @@ ROM_START( gldarrow )
ROM_END
-GAMEL(1984, gldarrow, 0, meyc8088, gldarrow, meyc8088_state, 0, ROT0, "Meyco Games, Inc.", "Golden Arrow (Standard G8-03)", 0, layout_gldarrow )
+GAMEL(1984, gldarrow, 0, meyc8088, gldarrow, meyc8088_state, 0, ROT0, "Meyco Games, Inc.", "Golden Arrow (Standard G8-03)", MACHINE_SUPPORTS_SAVE, layout_gldarrow )