summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2018-02-28 21:19:37 +1100
committer Vas Crabb <vas@vastheman.com>2018-02-28 21:19:37 +1100
commit910d2267cad32587d3f8fa19ff603e15d2f336cb (patch)
tree8043cd8c70f7611949ba24bd1bbf564bff951bd5 /src/mame/drivers
parent0a365065c39b81628bcb9c938fbbc95920a260ab (diff)
Start squeezing out the poor-performing parts of the output_manager:
* Turn deprecated declataion warnings on by default and make them non-fatal * Make output_finder iterable in algorithms and range-based for loops * Replace a lot of set_something with output_finder
Diffstat (limited to 'src/mame/drivers')
-rw-r--r--src/mame/drivers/4004clk.cpp49
-rw-r--r--src/mame/drivers/acrnsys1.cpp24
-rw-r--r--src/mame/drivers/alesis.cpp11
-rw-r--r--src/mame/drivers/atari400.cpp8
-rw-r--r--src/mame/drivers/bartop52.cpp12
-rw-r--r--src/mame/drivers/bfm_sc4.cpp65
-rw-r--r--src/mame/drivers/cmi.cpp31
-rw-r--r--src/mame/drivers/dlair.cpp68
-rw-r--r--src/mame/drivers/ecoinf3.cpp130
-rw-r--r--src/mame/drivers/elekscmp.cpp40
-rw-r--r--src/mame/drivers/junior.cpp46
-rw-r--r--src/mame/drivers/maxaflex.cpp65
-rw-r--r--src/mame/drivers/mpu3.cpp65
-rw-r--r--src/mame/drivers/sitcom.cpp28
-rw-r--r--src/mame/drivers/tk80.cpp83
-rw-r--r--src/mame/drivers/wacky_gator.cpp108
16 files changed, 453 insertions, 380 deletions
diff --git a/src/mame/drivers/4004clk.cpp b/src/mame/drivers/4004clk.cpp
index 45d4fd4b217..d187741c3d2 100644
--- a/src/mame/drivers/4004clk.cpp
+++ b/src/mame/drivers/4004clk.cpp
@@ -21,18 +21,24 @@
class nixieclock_state : public driver_device
{
public:
- nixieclock_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) { }
+ nixieclock_state(const machine_config &mconfig, device_type type, const char *tag)
+ : driver_device(mconfig, type, tag)
+ , m_nixie_out(*this, "nixie%u", 0U)
+ , m_neon_out(*this, "neon%u", 0U)
+ { }
+ void _4004clk(machine_config &config);
+
+protected:
DECLARE_WRITE8_MEMBER( nixie_w );
DECLARE_WRITE8_MEMBER( neon_w );
- void _4004clk(machine_config &config);
void _4004clk_mem(address_map &map);
void _4004clk_mp(address_map &map);
void _4004clk_rom(address_map &map);
void _4004clk_rp(address_map &map);
void _4004clk_stat(address_map &map);
-protected:
+
virtual void machine_start() override;
private:
@@ -52,36 +58,28 @@ private:
10;
}
- void output_set_nixie_value(int index, int value)
- {
- output().set_indexed_value("nixie", index, value);
- }
-
- void output_set_neon_value(int index, int value)
- {
- output().set_indexed_value("neon", index, value);
- }
-
uint16_t m_nixie[16];
+ output_finder<6> m_nixie_out;
+ output_finder<4> m_neon_out;
};
WRITE8_MEMBER(nixieclock_state::nixie_w)
{
m_nixie[offset >> 4] = data;
- output_set_nixie_value(5, nixie_to_num(((m_nixie[2] & 3)<<8) | (m_nixie[1] << 4) | m_nixie[0]));
- output_set_nixie_value(4, nixie_to_num((m_nixie[4] << 6) | (m_nixie[3] << 2) | (m_nixie[2] >>2)));
- output_set_nixie_value(3, nixie_to_num(((m_nixie[7] & 3)<<8) | (m_nixie[6] << 4) | m_nixie[5]));
- output_set_nixie_value(2, nixie_to_num((m_nixie[9] << 6) | (m_nixie[8] << 2) | (m_nixie[7] >>2)));
- output_set_nixie_value(1, nixie_to_num(((m_nixie[12] & 3)<<8) | (m_nixie[11] << 4) | m_nixie[10]));
- output_set_nixie_value(0, nixie_to_num((m_nixie[14] << 6) | (m_nixie[13] << 2) | (m_nixie[12] >>2)));
+ m_nixie_out[5] = nixie_to_num(((m_nixie[2] & 3)<<8) | (m_nixie[1] << 4) | m_nixie[0]);
+ m_nixie_out[4] = nixie_to_num((m_nixie[4] << 6) | (m_nixie[3] << 2) | (m_nixie[2] >>2));
+ m_nixie_out[3] = nixie_to_num(((m_nixie[7] & 3)<<8) | (m_nixie[6] << 4) | m_nixie[5]);
+ m_nixie_out[2] = nixie_to_num((m_nixie[9] << 6) | (m_nixie[8] << 2) | (m_nixie[7] >>2));
+ m_nixie_out[1] = nixie_to_num(((m_nixie[12] & 3)<<8) | (m_nixie[11] << 4) | m_nixie[10]);
+ m_nixie_out[0] = nixie_to_num((m_nixie[14] << 6) | (m_nixie[13] << 2) | (m_nixie[12] >>2));
}
WRITE8_MEMBER(nixieclock_state::neon_w)
{
- output_set_neon_value(0, BIT(data,3));
- output_set_neon_value(1, BIT(data,2));
- output_set_neon_value(2, BIT(data,1));
- output_set_neon_value(3, BIT(data,0));
+ m_neon_out[0] = BIT(data,3);
+ m_neon_out[1] = BIT(data,2);
+ m_neon_out[2] = BIT(data,1);
+ m_neon_out[3] = BIT(data,0);
}
ADDRESS_MAP_START(nixieclock_state::_4004clk_rom)
@@ -125,6 +123,9 @@ INPUT_PORTS_END
void nixieclock_state::machine_start()
{
+ m_nixie_out.resolve();
+ m_neon_out.resolve();
+
/* register for state saving */
save_pointer(NAME(m_nixie), 6);
}
@@ -132,7 +133,7 @@ void nixieclock_state::machine_start()
MACHINE_CONFIG_START(nixieclock_state::_4004clk)
/* basic machine hardware */
- MCFG_CPU_ADD("maincpu", I4004, XTAL(5'000'000) / 8)
+ MCFG_CPU_ADD("maincpu", I4004, 5_MHz_XTAL / 8);
MCFG_I4004_ROM_MAP(_4004clk_rom)
MCFG_I4004_RAM_MEMORY_MAP(_4004clk_mem)
MCFG_I4004_ROM_PORTS_MAP(_4004clk_rp)
diff --git a/src/mame/drivers/acrnsys1.cpp b/src/mame/drivers/acrnsys1.cpp
index 62623ef4900..b5fe96b04f5 100644
--- a/src/mame/drivers/acrnsys1.cpp
+++ b/src/mame/drivers/acrnsys1.cpp
@@ -66,12 +66,14 @@ public:
m_maincpu(*this, "maincpu"),
m_ttl74145(*this, "ic8_7445"),
m_cass(*this, "cassette"),
+ m_display(*this, "digit%u", 0U),
m_digit(0)
{ }
void acrnsys1(machine_config &config);
protected:
+ virtual void machine_start() override;
DECLARE_READ8_MEMBER(ins8154_b1_port_a_r);
DECLARE_WRITE8_MEMBER(ins8154_b1_port_a_w);
DECLARE_WRITE8_MEMBER(acrnsys1_led_segment_w);
@@ -83,6 +85,7 @@ private:
required_device<cpu_device> m_maincpu;
required_device<ttl74145_device> m_ttl74145;
required_device<cassette_image_device> m_cass;
+ output_finder<9> m_display;
uint8_t m_digit;
uint8_t m_cass_data[4];
bool m_cass_state;
@@ -91,6 +94,17 @@ private:
+void acrnsys1_state::machine_start()
+{
+ m_display.resolve();
+
+ save_item(NAME(m_digit));
+ save_item(NAME(m_cass_data));
+ save_item(NAME(m_cass_state));
+ save_item(NAME(m_cassold));
+}
+
+
/***************************************************************************
KEYBOARD HANDLING
***************************************************************************/
@@ -157,9 +171,11 @@ TIMER_DEVICE_CALLBACK_MEMBER(acrnsys1_state::acrnsys1_p)
WRITE8_MEMBER( acrnsys1_state::acrnsys1_led_segment_w )
{
- uint8_t key_line = m_ttl74145->read();
+ uint16_t const key_line = m_ttl74145->read();
- output().set_digit_value(key_line, data);
+ for (unsigned i = 0U; 9U > i; ++i)
+ if (BIT(key_line, i))
+ m_display[i] = data;
}
@@ -286,5 +302,5 @@ ROM_END
GAME DRIVERS
***************************************************************************/
-/* YEAR NAME PARENT COMPAT MACHINE INPUT STATE INIT COMPANY FULLNAME FLAGS */
-COMP( 1978, acrnsys1, 0, 0, acrnsys1, acrnsys1, acrnsys1_state, 0, "Acorn", "Acorn System 1", 0 )
+// YEAR NAME PARENT COMPAT MACHINE INPUT STATE INIT COMPANY FULLNAME FLAGS
+COMP( 1978, acrnsys1, 0, 0, acrnsys1, acrnsys1, acrnsys1_state, 0, "Acorn", "Acorn System 1", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/alesis.cpp b/src/mame/drivers/alesis.cpp
index 0b37917059a..515ad47d800 100644
--- a/src/mame/drivers/alesis.cpp
+++ b/src/mame/drivers/alesis.cpp
@@ -96,7 +96,7 @@ READ8_MEMBER( alesis_state::mmt8_led_r )
WRITE8_MEMBER( alesis_state::track_led_w )
{
for (int i=0; i<8; i++)
- output().set_indexed_value("track_led", i + 1, BIT(data, i));
+ m_track_led[i] = BIT(data, i);
}
READ8_MEMBER( alesis_state::mmt8_p3_r )
@@ -330,6 +330,11 @@ PALETTE_INIT_MEMBER(alesis_state, alesis)
palette.set_pen_color(1, rgb_t(92, 83, 88));
}
+void alesis_state::machine_start()
+{
+ m_track_led.resolve();
+}
+
void alesis_state::machine_reset()
{
m_kb_matrix = 0xff;
@@ -348,7 +353,7 @@ HD44780_PIXEL_UPDATE(alesis_state::sr16_pixel_update)
MACHINE_CONFIG_START(alesis_state::hr16)
/* basic machine hardware */
- MCFG_CPU_ADD("maincpu",I8031, XTAL(12'000'000))
+ MCFG_CPU_ADD("maincpu",I8031, 12_MHz_XTAL)
MCFG_CPU_PROGRAM_MAP(hr16_mem)
MCFG_CPU_IO_MAP(hr16_io)
MCFG_MCS51_PORT_P1_IN_CB(IOPORT("SELECT"))
@@ -376,7 +381,7 @@ MACHINE_CONFIG_START(alesis_state::hr16)
MCFG_HD44780_LCD_SIZE(2, 16)
/* sound hardware */
- MCFG_ALESIS_DM3AG_ADD("dm3ag", XTAL(12'000'000)/2)
+ MCFG_ALESIS_DM3AG_ADD("dm3ag", 12_MHz_XTAL/2)
MCFG_NVRAM_ADD_0FILL("nvram")
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/atari400.cpp b/src/mame/drivers/atari400.cpp
index 717917d8f7a..fd58c220450 100644
--- a/src/mame/drivers/atari400.cpp
+++ b/src/mame/drivers/atari400.cpp
@@ -2137,8 +2137,8 @@ MACHINE_CONFIG_START(a400_state::atari_common_nodac)
MCFG_POKEY_POT7_R_CB(IOPORT("analog_7"))
MCFG_POKEY_SERIN_R_CB(DEVREAD8("fdc", atari_fdc_device, serin_r))
MCFG_POKEY_SEROUT_W_CB(DEVWRITE8("fdc", atari_fdc_device, serout_w))
- MCFG_POKEY_KEYBOARD_CB(atari_common_state, a800_keyboard)
- MCFG_POKEY_INTERRUPT_CB(atari_common_state, interrupt_cb)
+ MCFG_POKEY_KEYBOARD_CB(a400_state, a800_keyboard)
+ MCFG_POKEY_INTERRUPT_CB(a400_state, interrupt_cb)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 1.0)
MACHINE_CONFIG_END
@@ -2350,8 +2350,8 @@ MACHINE_CONFIG_START(a400_state::a5200)
MCFG_SOUND_MODIFY("pokey")
MCFG_POKEY_SERIN_R_CB(NOOP)
MCFG_POKEY_SEROUT_W_CB(NOOP)
- MCFG_POKEY_KEYBOARD_CB(atari_common_state, a5200_keypads)
- MCFG_POKEY_INTERRUPT_CB(atari_common_state, interrupt_cb)
+ MCFG_POKEY_KEYBOARD_CB(a400_state, a5200_keypads)
+ MCFG_POKEY_INTERRUPT_CB(a400_state, interrupt_cb)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 1.0)
diff --git a/src/mame/drivers/bartop52.cpp b/src/mame/drivers/bartop52.cpp
index 0a05694af39..b24c40fc455 100644
--- a/src/mame/drivers/bartop52.cpp
+++ b/src/mame/drivers/bartop52.cpp
@@ -37,10 +37,12 @@ public:
: atari_common_state(mconfig, type, tag)
{ }
+ void a5200(machine_config &config);
+
+protected:
TIMER_DEVICE_CALLBACK_MEMBER( bartop_interrupt );
virtual void machine_reset() override;
- void a5200(machine_config &config);
void a5200_mem(address_map &map);
};
@@ -113,6 +115,8 @@ INPUT_PORTS_END
void bartop52_state::machine_reset()
{
+ atari_common_state::machine_reset();
+
pokey_device *pokey = machine().device<pokey_device>("pokey");
pokey->write(15,0);
}
@@ -143,7 +147,7 @@ MACHINE_CONFIG_START(bartop52_state::a5200)
MCFG_SCREEN_PALETTE("palette")
MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(atari_common_state, atari)
+ MCFG_PALETTE_INIT_OWNER(bartop52_state, atari)
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
@@ -153,8 +157,8 @@ MACHINE_CONFIG_START(bartop52_state::a5200)
MCFG_POKEY_POT1_R_CB(IOPORT("analog_1"))
MCFG_POKEY_POT2_R_CB(IOPORT("analog_2"))
MCFG_POKEY_POT3_R_CB(IOPORT("analog_3"))
- MCFG_POKEY_KEYBOARD_CB(atari_common_state, a5200_keypads)
- MCFG_POKEY_INTERRUPT_CB(atari_common_state, interrupt_cb)
+ MCFG_POKEY_KEYBOARD_CB(bartop52_state, a5200_keypads)
+ MCFG_POKEY_INTERRUPT_CB(bartop52_state, interrupt_cb)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
diff --git a/src/mame/drivers/bfm_sc4.cpp b/src/mame/drivers/bfm_sc4.cpp
index 5b5e27fab51..0cb777215bd 100644
--- a/src/mame/drivers/bfm_sc4.cpp
+++ b/src/mame/drivers/bfm_sc4.cpp
@@ -445,28 +445,28 @@ READ16_MEMBER(sc4_state::sc4_mem_r)
return 0x0000;
}
-WRITE8_MEMBER(bfm_sc45_state::mux_output_w)
+void bfm_sc45_state::machine_start()
{
- int i;
- int off = offset<<3;
-
- for (i=0; i<8; i++)
- output().set_lamp_value(off+i, ((data & (1 << i)) != 0));
+ m_lamps.resolve();
+ m_matrix.resolve();
+ m_digits.resolve();
+}
+WRITE8_MEMBER(bfm_sc45_state::mux_output_w)
+{
+ int const off = offset<<3;
- output().set_indexed_value("matrix", off+i, ((data & (1 << i)) != 0));
+ for (int i=0; i<8; i++)
+ m_lamps[off+i] = BIT(data, i);
}
WRITE8_MEMBER(bfm_sc45_state::mux_output2_w)
{
- int i;
- int off = offset<<3;
+ int const off = offset<<3;
// some games use this as a matrix port (luckb etc.)
- for (i=0; i<8; i++)
- {
- output().set_indexed_value("matrix", off+i, ((data & (1 << i)) != 0));
- }
+ for (int i=0; i<8; i++)
+ m_matrix[off+i] = BIT(data, i);
// others drive 7-segs with it.. so rendering it there as well in our debug layouts
@@ -474,28 +474,24 @@ WRITE8_MEMBER(bfm_sc45_state::mux_output2_w)
{
m_segment_34_cache[offset] = data;
- uint16_t short_data;
- uint8_t byte_data_first_segment;
- uint8_t byte_data_second_segment;
for (int digit = 0; digit < 32; digit += 2)
{
- short_data = (m_segment_34_cache[digit + 1] << 8) | m_segment_34_cache[digit];
- byte_data_first_segment = (short_data >> 1) & 15;
- byte_data_second_segment = (short_data >> 6) & 15;
- output().set_digit_value(digit, SEGMENT_34_ENCODING_LOOKUP[byte_data_first_segment]);
- output().set_digit_value(digit + 1, SEGMENT_34_ENCODING_LOOKUP[byte_data_second_segment]);
+ uint16_t const short_data = (m_segment_34_cache[digit + 1] << 8) | m_segment_34_cache[digit];
+ uint8_t byte_data_first_segment = (short_data >> 1) & 15;
+ uint8_t const byte_data_second_segment = (short_data >> 6) & 15;
+ m_digits[digit] = SEGMENT_34_ENCODING_LOOKUP[byte_data_first_segment];
+ m_digits[digit + 1] = SEGMENT_34_ENCODING_LOOKUP[byte_data_second_segment];
if (digit == 0 || digit == 2)
{
byte_data_first_segment = (short_data >> 11) & 15;
- output().set_digit_value((digit / 2) + 32, SEGMENT_34_ENCODING_LOOKUP[byte_data_first_segment]);
+ m_digits[(digit / 2) + 32] = SEGMENT_34_ENCODING_LOOKUP[byte_data_first_segment];
}
}
}
else
{
- uint8_t bf7segdata = bitswap<8>(data,0,7,6,5,4,3,2,1);
- output().set_digit_value(offset, bf7segdata);
+ m_digits[offset] = bitswap<8>(data,0,7,6,5,4,3,2,1);
}
}
@@ -805,16 +801,20 @@ uint16_t sc4_state::bfm_sc4_68307_portb_r(address_space &space, bool dedicated,
}
}
-MACHINE_RESET_MEMBER(sc4_state,sc4)
+void sc4_state::machine_reset()
{
+ bfm_sc45_state::machine_reset();
+
m_dochk41 = true;
sec.reset();
}
-MACHINE_START_MEMBER(sc4_state,sc4)
+void sc4_state::machine_start()
{
+ bfm_sc45_state::machine_start();
+
m_nvram->set_base(m_mainram, sizeof(m_mainram));
m_maincpu->set_port_callbacks(
@@ -897,9 +897,6 @@ MACHINE_CONFIG_START(sc4_state::sc4_common)
MCFG_MC68307_SERIAL_INPORT_CALLBACK(READ8(sc4_state, m68307_duart_input_r))
MCFG_MC68307_SERIAL_OUTPORT_CALLBACK(WRITE8(sc4_state, m68307_duart_output_w))
- MCFG_MACHINE_START_OVERRIDE(sc4_state, sc4 )
- MCFG_MACHINE_RESET_OVERRIDE(sc4_state, sc4 )
-
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
@@ -1245,11 +1242,11 @@ MACHINE_CONFIG_START(sc4_state::sc4_no_reels)
sc4_common(config);
MACHINE_CONFIG_END
-MACHINE_START_MEMBER(sc4_adder4_state,adder4)
+void sc4_adder4_state::machine_start()
{
- m_adder4cpuregion = (uint32_t*)memregion( "adder4" )->base();
+ sc4_state::machine_start();
+
m_adder4ram = make_unique_clear<uint32_t[]>(0x10000);
- MACHINE_START_CALL_MEMBER(sc4);
}
MACHINE_CONFIG_START(sc4_adder4_state::sc4_adder4)
@@ -1257,8 +1254,6 @@ MACHINE_CONFIG_START(sc4_adder4_state::sc4_adder4)
MCFG_CPU_ADD("adder4", M68340, 25175000) // 68340 (CPU32 core)
MCFG_CPU_PROGRAM_MAP(sc4_adder4_map)
-
- MCFG_MACHINE_START_OVERRIDE(sc4_adder4_state, adder4 )
MACHINE_CONFIG_END
MACHINE_CONFIG_START(sc4_state::sc4dmd)
@@ -1269,8 +1264,6 @@ MACHINE_CONFIG_START(sc4_state::sc4dmd)
MCFG_DEVICE_ADD("dm01", BFM_DM01, 0)
MCFG_BFM_DM01_BUSY_CB(WRITELINE(sc4_state, bfmdm01_busy))
- MCFG_MACHINE_START_OVERRIDE(sc4_state, sc4 )
-
MCFG_STARPOINT_RM20_48STEP_ADD("reel1")
MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel1_optic_cb))
MCFG_STARPOINT_RM20_48STEP_ADD("reel2")
diff --git a/src/mame/drivers/cmi.cpp b/src/mame/drivers/cmi.cpp
index 9e5a27c1ffb..424e910cdf6 100644
--- a/src/mame/drivers/cmi.cpp
+++ b/src/mame/drivers/cmi.cpp
@@ -447,6 +447,7 @@ public:
, m_keypad_a_port(*this, "KEYPAD_A")
, m_keypad_b_port(*this, "KEYPAD_B")
, m_key_mux_ports{ { *this, "KEY_%u_0", 0 }, { *this, "KEY_%u_1", 0 }, { *this, "KEY_%u_2", 0 }, { *this, "KEY_%u_3", 0 } }
+ , m_digit(*this, "digit%u", 0U)
, m_cmi07_ram(*this, "cmi07_ram")
{
}
@@ -547,9 +548,7 @@ public:
DECLARE_WRITE_LINE_MEMBER( cmi10_u20_cb2_w );
DECLARE_WRITE_LINE_MEMBER( cmi10_u21_cb2_w );
DECLARE_READ8_MEMBER( cmi10_u21_a_r );
- DECLARE_WRITE16_MEMBER( cmi_iix_update_dp1 );
- DECLARE_WRITE16_MEMBER( cmi_iix_update_dp2 );
- DECLARE_WRITE16_MEMBER( cmi_iix_update_dp3 );
+ template <unsigned N> DECLARE_WRITE16_MEMBER( cmi_iix_update_dp );
DECLARE_WRITE_LINE_MEMBER( msm5832_irq );
DECLARE_WRITE_LINE_MEMBER( mkbd_kbd_acia_int );
@@ -564,8 +563,8 @@ public:
void maincpu2_map(address_map &map);
void midicpu_map(address_map &map);
void muskeys_map(address_map &map);
-protected:
+protected:
required_device<mc6809e_device> m_maincpu1;
required_device<mc6809e_device> m_maincpu2;
required_device<m6802_cpu_device> m_muskeyscpu;
@@ -626,6 +625,8 @@ protected:
required_ioport_array<3> m_key_mux_ports[4];
+ output_finder<12> m_digit;
+
required_shared_ptr<uint8_t> m_cmi07_ram;
address_space *m_cpu1space;
@@ -2506,19 +2507,9 @@ WRITE_LINE_MEMBER( cmi_state::cmi10_u20_cb2_w )
m_dp3->wr_w(state);
}
-WRITE16_MEMBER( cmi_state::cmi_iix_update_dp1 )
-{
- output().set_digit_value(0 + (offset ^ 3), data);
-}
-
-WRITE16_MEMBER( cmi_state::cmi_iix_update_dp2 )
+template <unsigned N> WRITE16_MEMBER( cmi_state::cmi_iix_update_dp )
{
- output().set_digit_value(4 + (offset ^ 3), data);
-}
-
-WRITE16_MEMBER( cmi_state::cmi_iix_update_dp3 )
-{
- output().set_digit_value(8 + (offset ^ 3), data);
+ m_digit[(N << 2) | ((offset ^ 3) & 3)] = data;
}
/* Begin Conversion */
@@ -2700,6 +2691,8 @@ void cmi_state::machine_reset()
void cmi_state::machine_start()
{
+ m_digit.resolve();
+
m_q133_rom = (uint8_t *)m_q133_region->base();
// allocate timers for the built-in two channel timer
@@ -2776,11 +2769,11 @@ MACHINE_CONFIG_START(cmi_state::cmi2x)
/* alpha-numeric display */
MCFG_DEVICE_ADD("dp1", DL1416T, 0)
- MCFG_DL1416_UPDATE_HANDLER(WRITE16(cmi_state, cmi_iix_update_dp1))
+ MCFG_DL1416_UPDATE_HANDLER(WRITE16(cmi_state, cmi_iix_update_dp<0>))
MCFG_DEVICE_ADD("dp2", DL1416T, 0)
- MCFG_DL1416_UPDATE_HANDLER(WRITE16(cmi_state, cmi_iix_update_dp2))
+ MCFG_DL1416_UPDATE_HANDLER(WRITE16(cmi_state, cmi_iix_update_dp<1>))
MCFG_DEVICE_ADD("dp3", DL1416T, 0)
- MCFG_DL1416_UPDATE_HANDLER(WRITE16(cmi_state, cmi_iix_update_dp3))
+ MCFG_DL1416_UPDATE_HANDLER(WRITE16(cmi_state, cmi_iix_update_dp<2>))
/* video hardware */
MCFG_SCREEN_ADD_MONOCHROME("screen", RASTER, rgb_t::green())
diff --git a/src/mame/drivers/dlair.cpp b/src/mame/drivers/dlair.cpp
index fa234128fd2..739739cf65d 100644
--- a/src/mame/drivers/dlair.cpp
+++ b/src/mame/drivers/dlair.cpp
@@ -63,19 +63,22 @@ public:
m_ldv1000(*this, "ld_ldv1000"),
m_pr7820(*this, "ld_pr7820"),
m_22vp932(*this, "ld_22vp932"),
- m_videoram(*this, "videoram")
+ m_videoram(*this, "videoram"),
+ m_digits(*this, "digit%u", 0U)
{
}
- required_device<cpu_device> m_maincpu;
- optional_device<speaker_sound_device> m_speaker;
- optional_device<gfxdecode_device> m_gfxdecode;
- optional_device<palette_device> m_palette;
- optional_device<pioneer_ldv1000_device> m_ldv1000;
- optional_device<pioneer_pr7820_device> m_pr7820;
- optional_device<phillips_22vp932_device> m_22vp932;
- optional_shared_ptr<uint8_t> m_videoram;
+ DECLARE_CUSTOM_INPUT_MEMBER(laserdisc_status_r);
+ DECLARE_CUSTOM_INPUT_MEMBER(laserdisc_command_r);
+ DECLARE_DRIVER_INIT(fixed);
+ DECLARE_DRIVER_INIT(variable);
+
+ void dlair_base(machine_config &config);
+ void dlair_pr7820(machine_config &config);
+ void dleuro(machine_config &config);
+ void dlair_ldv1000(machine_config &config);
+protected:
void laserdisc_data_w(uint8_t data)
{
if (m_ldv1000 != nullptr) m_ldv1000->data_w(data);
@@ -115,30 +118,35 @@ public:
return CLEAR_LINE;
}
- uint8_t m_last_misc;
- uint8_t m_laserdisc_data;
DECLARE_WRITE8_MEMBER(misc_w);
DECLARE_WRITE8_MEMBER(dleuro_misc_w);
DECLARE_WRITE8_MEMBER(led_den1_w);
DECLARE_WRITE8_MEMBER(led_den2_w);
DECLARE_READ8_MEMBER(laserdisc_r);
DECLARE_WRITE8_MEMBER(laserdisc_w);
- DECLARE_CUSTOM_INPUT_MEMBER(laserdisc_status_r);
- DECLARE_CUSTOM_INPUT_MEMBER(laserdisc_command_r);
- DECLARE_DRIVER_INIT(fixed);
- DECLARE_DRIVER_INIT(variable);
- DECLARE_MACHINE_START(dlair);
- DECLARE_MACHINE_RESET(dlair);
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
DECLARE_PALETTE_INIT(dleuro);
uint32_t screen_update_dleuro(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(write_speaker);
- void dlair_base(machine_config &config);
- void dlair_pr7820(machine_config &config);
- void dleuro(machine_config &config);
- void dlair_ldv1000(machine_config &config);
+
void dleuro_io_map(address_map &map);
void dleuro_map(address_map &map);
void dlus_map(address_map &map);
+
+private:
+ required_device<cpu_device> m_maincpu;
+ optional_device<speaker_sound_device> m_speaker;
+ optional_device<gfxdecode_device> m_gfxdecode;
+ optional_device<palette_device> m_palette;
+ optional_device<pioneer_ldv1000_device> m_ldv1000;
+ optional_device<pioneer_pr7820_device> m_pr7820;
+ optional_device<phillips_22vp932_device> m_22vp932;
+ optional_shared_ptr<uint8_t> m_videoram;
+ output_finder<16> m_digits;
+
+ uint8_t m_last_misc;
+ uint8_t m_laserdisc_data;
};
@@ -239,12 +247,16 @@ uint32_t dlair_state::screen_update_dleuro(screen_device &screen, bitmap_ind16 &
*
*************************************/
-MACHINE_START_MEMBER(dlair_state,dlair)
+void dlair_state::machine_start()
{
+ m_digits.resolve();
+
+ save_item(NAME(m_last_misc));
+ save_item(NAME(m_laserdisc_data));
}
-MACHINE_RESET_MEMBER(dlair_state,dlair)
+void dlair_state::machine_reset()
{
#if 0
@@ -317,13 +329,13 @@ WRITE8_MEMBER(dlair_state::dleuro_misc_w)
WRITE8_MEMBER(dlair_state::led_den1_w)
{
- output().set_digit_value(0 + (offset & 7), led_map[data & 0x0f]);
+ m_digits[0 | (offset & 7)] = led_map[data & 0x0f];
}
WRITE8_MEMBER(dlair_state::led_den2_w)
{
- output().set_digit_value(8 + (offset & 7), led_map[data & 0x0f]);
+ m_digits[8 | (offset & 7)] = led_map[data & 0x0f];
}
@@ -721,9 +733,6 @@ MACHINE_CONFIG_START(dlair_state::dlair_base)
MCFG_CPU_PROGRAM_MAP(dlus_map)
MCFG_CPU_PERIODIC_INT_DRIVER(dlair_state, irq0_line_hold, (double)MASTER_CLOCK_US/8/16/16/16/16)
- MCFG_MACHINE_START_OVERRIDE(dlair_state,dlair)
- MCFG_MACHINE_RESET_OVERRIDE(dlair_state,dlair)
-
/* sound hardware */
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
@@ -771,9 +780,6 @@ MACHINE_CONFIG_START(dlair_state::dleuro)
MCFG_WATCHDOG_ADD("watchdog")
MCFG_WATCHDOG_TIME_INIT(attotime::from_hz(MASTER_CLOCK_EURO/(16*16*16*16*16*8)))
- MCFG_MACHINE_START_OVERRIDE(dlair_state,dlair)
- MCFG_MACHINE_RESET_OVERRIDE(dlair_state,dlair)
-
MCFG_LASERDISC_22VP932_ADD("ld_22vp932")
MCFG_LASERDISC_OVERLAY_DRIVER(256, 256, dlair_state, screen_update_dleuro)
MCFG_LASERDISC_OVERLAY_PALETTE("palette")
diff --git a/src/mame/drivers/ecoinf3.cpp b/src/mame/drivers/ecoinf3.cpp
index 90b969d2c67..ac88dea594b 100644
--- a/src/mame/drivers/ecoinf3.cpp
+++ b/src/mame/drivers/ecoinf3.cpp
@@ -23,42 +23,40 @@
#include "ecoinf3.lh"
+#include <algorithm>
+
class ecoinf3_state : public driver_device
{
public:
- ecoinf3_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ ecoinf3_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
- m_reel0(*this, "reel0"),
- m_reel1(*this, "reel1"),
- m_reel2(*this, "reel2"),
- m_reel3(*this, "reel3")
+ m_reels(*this, "reel%u", 0U),
+ m_lamp_outputs(*this, "lamp%u", 0U),
+ m_vfd_outputs(*this, "vfd%u", 0U)
{
- strobe_amount = 0;
- strobe_addr = 0;
- m_percent_mux = 0;
}
- required_device<z180_device> m_maincpu;
- required_device<stepper_device> m_reel0;
- required_device<stepper_device> m_reel1;
- required_device<stepper_device> m_reel2;
- required_device<stepper_device> m_reel3;
-
- uint16_t m_lamps[16];
- uint16_t m_chars[14];
- void update_display();
+ DECLARE_DRIVER_INIT(ecoinf3);
+ DECLARE_DRIVER_INIT(ecoinf3_swap);
+ void ecoinf3_pyramid(machine_config &config);
- int strobe_addr;
- int strobe_amount;
- int m_optic_pattern;
- DECLARE_WRITE_LINE_MEMBER(reel0_optic_cb) { if (state) m_optic_pattern |= 0x01; else m_optic_pattern &= ~0x01; }
- DECLARE_WRITE_LINE_MEMBER(reel1_optic_cb) { if (state) m_optic_pattern |= 0x02; else m_optic_pattern &= ~0x02; }
- DECLARE_WRITE_LINE_MEMBER(reel2_optic_cb) { if (state) m_optic_pattern |= 0x04; else m_optic_pattern &= ~0x04; }
- DECLARE_WRITE_LINE_MEMBER(reel3_optic_cb) { if (state) m_optic_pattern |= 0x08; else m_optic_pattern &= ~0x08; }
+protected:
+ virtual void machine_start() override
+ {
+ m_lamp_outputs.resolve();
+ m_vfd_outputs.resolve();
+
+ save_item(NAME(m_lamps));
+ save_item(NAME(m_chars));
+ save_item(NAME(m_strobe_addr));
+ save_item(NAME(m_strobe_amount));
+ save_item(NAME(m_optic_pattern));
+ save_item(NAME(m_percent_mux));
+ }
- int m_percent_mux;
+ template <unsigned N> DECLARE_WRITE_LINE_MEMBER(reel_optic_cb) { if (state) m_optic_pattern |= (1 << N); else m_optic_pattern &= ~(1 << N); }
DECLARE_READ8_MEMBER(ppi8255_intf_a_read_a) { int ret = 0x00; logerror("%04x - ppi8255_intf_a_read_a %02x\n", m_maincpu->pcbase(), ret); return ret; }
DECLARE_READ8_MEMBER(ppi8255_intf_a_read_b)
@@ -170,16 +168,12 @@ public:
}
DECLARE_READ8_MEMBER(ppi8255_intf_h_read_c) { int ret = 0x00; logerror("%04x - ppi8255_intf_h_read_c %02x\n", m_maincpu->pcbase(), ret); return ret; }
- void update_lamps(void)
+ void update_lamps()
{
for (int i=0; i<16; i++)
{
- for (int bit=0;bit<16;bit++)
- {
- int data = ((m_lamps[i] << bit)&0x8000)>>15;
-
- output().set_indexed_value("lamp", (i*16)+bit, data );
- }
+ for (int bit=0; bit<16; bit++)
+ m_lamp_outputs[(i << 4) | bit] = BIT(m_lamps[i], 15 - bit);
}
}
@@ -187,20 +181,20 @@ public:
DECLARE_WRITE8_MEMBER(ppi8255_intf_a_write_a_strobedat0)
{
// logerror("%04x - ppi8255_intf_a_(used)write_a %02x (STROBEDAT?)\n", m_maincpu->pcbase(), data);
- if (strobe_amount)
+ if (m_strobe_amount)
{
- m_lamps[strobe_addr] = (m_lamps[strobe_addr] &0xff00) | (data & 0x00ff);
- strobe_amount--;
+ m_lamps[m_strobe_addr] = (m_lamps[m_strobe_addr] & 0xff00) | (data & 0x00ff);
+ m_strobe_amount--;
}
}
DECLARE_WRITE8_MEMBER(ppi8255_intf_a_write_b_strobedat1)
{
// logerror("%04x - ppi8255_intf_a_(used)write_b %02x (STROBEDAT?)\n", m_maincpu->pcbase(), data);
- if (strobe_amount)
+ if (m_strobe_amount)
{
- m_lamps[strobe_addr] = (m_lamps[strobe_addr] &0x00ff) | (data << 8);
- strobe_amount--;
+ m_lamps[m_strobe_addr] = (m_lamps[m_strobe_addr] & 0x00ff) | (data << 8);
+ m_strobe_amount--;
}
}
DECLARE_WRITE8_MEMBER(ppi8255_intf_a_write_c_strobe)
@@ -208,11 +202,11 @@ public:
if (data>=0xf0)
{
// logerror("%04x - ppi8255_intf_a_(used)write_c %02x (STROBE?)\n", m_maincpu->pcbase(), data);
- strobe_addr = data & 0xf;
+ m_strobe_addr = data & 0xf;
// hack, it writes values for the lamps, then writes 0x00 afterwards, probably giving the bulbs power, then removing the power
// before switching the strobe to the next line?
- strobe_amount = 2;
+ m_strobe_amount = 2;
update_lamps();
}
@@ -230,22 +224,22 @@ public:
DECLARE_WRITE8_MEMBER(ppi8255_intf_d_write_a_reel01)
{
// logerror("%04x - ppi8255_intf_d_(used)write_a %02x\n", m_maincpu->pcbase(), data);
- m_reel0->update( data &0x0f);
- m_reel1->update((data>>4)&0x0f);
+ m_reels[0]->update( data &0x0f);
+ m_reels[1]->update((data>>4)&0x0f);
- awp_draw_reel(machine(),"reel1", *m_reel0);
- awp_draw_reel(machine(),"reel2", *m_reel1);
+ awp_draw_reel(machine(),"reel1", *m_reels[0]);
+ awp_draw_reel(machine(),"reel2", *m_reels[1]);
}
DECLARE_WRITE8_MEMBER(ppi8255_intf_d_write_b_reel23)
{
// logerror("%04x - ppi8255_intf_d_(used)write_b %02x\n", m_maincpu->pcbase(), data);
- m_reel2->update( data &0x0f);
- m_reel3->update((data>>4)&0x0f);
+ m_reels[2]->update( data &0x0f);
+ m_reels[3]->update((data>>4)&0x0f);
- awp_draw_reel(machine(),"reel3", *m_reel2);
- awp_draw_reel(machine(),"reel4", *m_reel3);
+ awp_draw_reel(machine(),"reel3", *m_reels[2]);
+ awp_draw_reel(machine(),"reel4", *m_reels[3]);
}
DECLARE_WRITE8_MEMBER(ppi8255_intf_d_write_c) { logerror("%04x - ppi8255_intf_d_(used)write_c %02x\n", m_maincpu->pcbase(), data);}
@@ -271,12 +265,23 @@ public:
DECLARE_WRITE8_MEMBER(ppi8255_intf_h_write_b) { logerror("%04x - ppi8255_intf_h_(used)write_b %02x\n", m_maincpu->pcbase(), data); }
DECLARE_WRITE8_MEMBER(ppi8255_intf_h_write_c) { logerror("%04x - ppi8255_intf_h_(used)write_c %02x\n", m_maincpu->pcbase(), data); }
-
- DECLARE_DRIVER_INIT(ecoinf3);
- DECLARE_DRIVER_INIT(ecoinf3_swap);
- void ecoinf3_pyramid(machine_config &config);
void pyramid_memmap(address_map &map);
void pyramid_portmap(address_map &map);
+
+private:
+ required_device<z180_device> m_maincpu;
+ required_device_array<stepper_device, 4> m_reels;
+ output_finder<16 * 16> m_lamp_outputs;
+ output_finder<14> m_vfd_outputs;
+
+ uint16_t m_lamps[16];
+ uint16_t m_chars[14];
+
+ int m_strobe_addr = 0;
+ int m_strobe_amount = 0;
+ int m_optic_pattern = 0;
+
+ int m_percent_mux = 0;
};
@@ -357,14 +362,6 @@ static uint32_t set_display(uint32_t segin)
return bitswap<32>(segin, 31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,11,9,15,13,12,8,10,14,7,6,5,4,3,2,1,0);
}
-void ecoinf3_state::update_display()
-{
- for (int i =0; i<14; i++)
- {
- output().set_indexed_value("vfd", i, set_display(m_chars[i]) );
- }
-}
-
// is the 2 digit bank display part of this, or multiplexed elsewhere
WRITE8_MEMBER(ecoinf3_state::ppi8255_intf_e_write_a_alpha_display)
{
@@ -427,8 +424,7 @@ WRITE8_MEMBER(ecoinf3_state::ppi8255_intf_e_write_a_alpha_display)
send_buffer = data;
}
- update_display();
-
+ std::transform(std::begin(m_chars), std::end(m_chars), std::begin(m_vfd_outputs), set_display);
}
ADDRESS_MAP_START(ecoinf3_state::pyramid_memmap)
@@ -743,13 +739,13 @@ MACHINE_CONFIG_START(ecoinf3_state::ecoinf3_pyramid)
MCFG_I8255_OUT_PORTC_CB(WRITE8(ecoinf3_state, ppi8255_intf_h_write_c))
MCFG_ECOIN_200STEP_ADD("reel0")
- MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinf3_state, reel0_optic_cb))
+ MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinf3_state, reel_optic_cb<0>))
MCFG_ECOIN_200STEP_ADD("reel1")
- MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinf3_state, reel1_optic_cb))
+ MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinf3_state, reel_optic_cb<1>))
MCFG_ECOIN_200STEP_ADD("reel2")
- MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinf3_state, reel2_optic_cb))
+ MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinf3_state, reel_optic_cb<2>))
MCFG_ECOIN_200STEP_ADD("reel3")
- MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinf3_state, reel3_optic_cb))
+ MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinf3_state, reel_optic_cb<3>))
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/elekscmp.cpp b/src/mame/drivers/elekscmp.cpp
index 4f60d6fb802..7fe1c306533 100644
--- a/src/mame/drivers/elekscmp.cpp
+++ b/src/mame/drivers/elekscmp.cpp
@@ -34,30 +34,36 @@ public:
elekscmp_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag)
, m_maincpu(*this, "maincpu")
- , m_x0(*this, "X0")
- , m_x1(*this, "X1")
- , m_x2(*this, "X2")
- , m_x3(*this, "X3")
- { }
+ , m_x(*this, "X%u", 0U)
+ , m_digit(*this, "digit%u", 0U)
+ { }
+
+ void elekscmp(machine_config &config);
+
+protected:
+ virtual void machine_start() override;
DECLARE_READ8_MEMBER(keyboard_r);
DECLARE_WRITE8_MEMBER(hex_display_w);
uint8_t convert_key(uint8_t data);
- void elekscmp(machine_config &config);
void mem_map(address_map &map);
+
private:
required_device<cpu_device> m_maincpu;
- required_ioport m_x0;
- required_ioport m_x1;
- required_ioport m_x2;
- required_ioport m_x3;
+ required_ioport_array<4> m_x;
+ output_finder<8> m_digit;
};
+void elekscmp_state::machine_start()
+{
+ m_digit.resolve();
+}
+
WRITE8_MEMBER(elekscmp_state::hex_display_w)
{
- output().set_digit_value(offset, data);
+ m_digit[offset & 0x7] = data;
}
uint8_t elekscmp_state::convert_key(uint8_t data)
@@ -73,23 +79,19 @@ READ8_MEMBER(elekscmp_state::keyboard_r)
{
uint8_t data;
- data = m_x0->read();
-
+ data = m_x[0]->read();
if (data)
return 0x80 | convert_key(data);
- data = m_x1->read();
-
+ data = m_x[1]->read();
if (data)
return 0x88 | convert_key(data);
- data = m_x2->read();
-
+ data = m_x[2]->read();
if (data)
return 0x80 | (convert_key(data) << 4);
- data = m_x3->read();
-
+ data = m_x[3]->read();
if (data)
m_maincpu->reset();
diff --git a/src/mame/drivers/junior.cpp b/src/mame/drivers/junior.cpp
index e8ca25c0036..dd4c158e88b 100644
--- a/src/mame/drivers/junior.cpp
+++ b/src/mame/drivers/junior.cpp
@@ -39,24 +39,34 @@ public:
: driver_device(mconfig, type, tag)
, m_riot(*this, "riot")
, m_maincpu(*this, "maincpu")
+ , m_line(*this, "LINE%u", 0U)
+ , m_digit(*this, "digit%u", 0U)
{
}
- required_device<mos6532_new_device> m_riot;
+ DECLARE_INPUT_CHANGED_MEMBER(junior_reset);
+ void junior(machine_config &config);
+
+protected:
DECLARE_READ8_MEMBER(junior_riot_a_r);
DECLARE_READ8_MEMBER(junior_riot_b_r);
DECLARE_WRITE8_MEMBER(junior_riot_a_w);
DECLARE_WRITE8_MEMBER(junior_riot_b_w);
- uint8_t m_port_a;
- uint8_t m_port_b;
- uint8_t m_led_time[6];
+
virtual void machine_start() override;
virtual void machine_reset() override;
- DECLARE_INPUT_CHANGED_MEMBER(junior_reset);
TIMER_DEVICE_CALLBACK_MEMBER(junior_update_leds);
- required_device<cpu_device> m_maincpu;
- void junior(machine_config &config);
+
void junior_mem(address_map &map);
+
+private:
+ required_device<mos6532_new_device> m_riot;
+ uint8_t m_port_a;
+ uint8_t m_port_b;
+ uint8_t m_led_time[6];
+ required_device<cpu_device> m_maincpu;
+ required_ioport_array<4> m_line;
+ output_finder<6> m_digit;
};
@@ -130,16 +140,13 @@ READ8_MEMBER( junior_state::junior_riot_a_r )
{
uint8_t data = 0xff;
- switch( ( m_port_b >> 1 ) & 0x0f )
+ uint8_t const sel = ( m_port_b >> 1) & 0x0f;
+ switch ( sel )
{
case 0:
- data = ioport("LINE0")->read();
- break;
case 1:
- data = ioport("LINE1")->read();
- break;
case 2:
- data = ioport("LINE2")->read();
+ data = m_line[sel]->read();
break;
}
return data;
@@ -165,7 +172,7 @@ WRITE8_MEMBER( junior_state::junior_riot_a_w )
if ((idx >= 4 && idx < 10) & ( m_port_a != 0xff ))
{
- output().set_digit_value( idx-4, m_port_a ^ 0x7f );
+ m_digit[idx - 4] = m_port_a ^ 0x7f;
m_led_time[idx - 4] = 10;
}
}
@@ -179,7 +186,7 @@ WRITE8_MEMBER( junior_state::junior_riot_b_w )
if ((idx >= 4 && idx < 10) & ( m_port_a != 0xff ))
{
- output().set_digit_value( idx-4, m_port_a ^ 0x7f );
+ m_digit[idx - 4] = m_port_a ^ 0x7f;
m_led_time[idx - 4] = 10;
}
}
@@ -194,15 +201,18 @@ TIMER_DEVICE_CALLBACK_MEMBER(junior_state::junior_update_leds)
if ( m_led_time[i] )
m_led_time[i]--;
else
- output().set_digit_value( i, 0 );
+ m_digit[i] = 0;
}
}
void junior_state::machine_start()
{
+ m_digit.resolve();
+
save_item(NAME(m_port_a));
save_item(NAME(m_port_b));
+ save_item(NAME(m_led_time));
}
@@ -217,7 +227,7 @@ void junior_state::machine_reset()
MACHINE_CONFIG_START(junior_state::junior)
/* basic machine hardware */
- MCFG_CPU_ADD("maincpu",M6502, XTAL(1'000'000))
+ MCFG_CPU_ADD("maincpu",M6502, 1_MHz_XTAL)
MCFG_CPU_PROGRAM_MAP(junior_mem)
MCFG_QUANTUM_TIME(attotime::from_hz(50))
@@ -225,7 +235,7 @@ MACHINE_CONFIG_START(junior_state::junior)
MCFG_DEFAULT_LAYOUT( layout_junior )
/* Devices */
- MCFG_DEVICE_ADD("riot", MOS6532_NEW, XTAL(1'000'000))
+ MCFG_DEVICE_ADD("riot", MOS6532_NEW, 1_MHz_XTAL)
MCFG_MOS6530n_IN_PA_CB(READ8(junior_state, junior_riot_a_r))
MCFG_MOS6530n_OUT_PA_CB(WRITE8(junior_state, junior_riot_a_w))
MCFG_MOS6530n_IN_PB_CB(READ8(junior_state, junior_riot_b_r))
diff --git a/src/mame/drivers/maxaflex.cpp b/src/mame/drivers/maxaflex.cpp
index d44b05030d2..9976eb734ff 100644
--- a/src/mame/drivers/maxaflex.cpp
+++ b/src/mame/drivers/maxaflex.cpp
@@ -45,30 +45,37 @@ public:
, m_console(*this, "console")
, m_joy01(*this, "djoy_0_1")
, m_joy23(*this, "djoy_2_3")
+ , m_lamp(*this, "lamp%u", 0U)
+ , m_digit(*this, "digit%u", 0U)
{
}
- uint8_t m_portB_out;
- uint8_t m_portC_out;
+ DECLARE_INPUT_CHANGED_MEMBER(coin_inserted);
+ void maxaflex(machine_config &config);
+
+protected:
DECLARE_READ8_MEMBER(mcu_portA_r);
DECLARE_WRITE8_MEMBER(mcu_portA_w);
DECLARE_WRITE8_MEMBER(mcu_portB_w);
DECLARE_WRITE8_MEMBER(mcu_portC_w);
- DECLARE_INPUT_CHANGED_MEMBER(coin_inserted);
DECLARE_READ8_MEMBER(pia_pa_r);
DECLARE_READ8_MEMBER(pia_pb_r);
WRITE8_MEMBER(pia_pb_w) { mmu(data); }
WRITE_LINE_MEMBER(pia_cb2_w) { } // This is used by Floppy drive on Atari 8bits Home Computers
TIMER_DEVICE_CALLBACK_MEMBER(mf_interrupt);
- void maxaflex(machine_config &config);
- void a600xl_mem(address_map &map);
-protected:
+ virtual void machine_start() override;
virtual void machine_reset() override;
bool atari_input_disabled() const { return !BIT(m_portB_out, 7); }
void mmu(uint8_t new_mmu);
+private:
+ void a600xl_mem(address_map &map);
+
+ uint8_t m_portB_out;
+ uint8_t m_portC_out;
+
required_device<cpu_device> m_mcu;
required_device<speaker_sound_device> m_speaker;
required_region_ptr<uint8_t> m_region_maincpu;
@@ -77,6 +84,8 @@ protected:
required_ioport m_console;
required_ioport m_joy01;
required_ioport m_joy23;
+ output_finder<4> m_lamp;
+ output_finder<3> m_digit;
};
@@ -155,10 +164,10 @@ WRITE8_MEMBER(maxaflex_state::mcu_portB_w)
/* latch for lamps */
if (BIT(diff, 6) && !BIT(data, 6))
{
- output().set_lamp_value(0, BIT(m_portC_out, 0));
- output().set_lamp_value(1, BIT(m_portC_out, 1));
- output().set_lamp_value(2, BIT(m_portC_out, 2));
- output().set_lamp_value(3, BIT(m_portC_out, 3));
+ m_lamp[0] = BIT(m_portC_out, 0);
+ m_lamp[1] = BIT(m_portC_out, 1);
+ m_lamp[2] = BIT(m_portC_out, 2);
+ m_lamp[3] = BIT(m_portC_out, 3);
}
}
@@ -177,13 +186,9 @@ WRITE8_MEMBER(maxaflex_state::mcu_portC_w)
m_portC_out = data & 0x0f;
/* displays */
- switch (m_portB_out & 0x03)
- {
- case 0x0: output().set_digit_value(0, ls48_map[m_portC_out]); break;
- case 0x1: output().set_digit_value(1, ls48_map[m_portC_out]); break;
- case 0x2: output().set_digit_value(2, ls48_map[m_portC_out]); break;
- case 0x3: break;
- }
+ uint8_t const sel = m_portB_out & 0x03;
+ if (3U > sel)
+ m_digit[sel] = ls48_map[m_portC_out];
}
INPUT_CHANGED_MEMBER(maxaflex_state::coin_inserted)
@@ -285,8 +290,21 @@ READ8_MEMBER(maxaflex_state::pia_pb_r)
}
+void maxaflex_state::machine_start()
+{
+ atari_common_state::machine_start();
+
+ m_lamp.resolve();
+ m_digit.resolve();
+
+ save_item(NAME(m_portB_out));
+ save_item(NAME(m_portC_out));
+}
+
void maxaflex_state::machine_reset()
{
+ atari_common_state::machine_reset();
+
pokey_device *pokey = machine().device<pokey_device>("pokey");
pokey->write(15,0);
@@ -294,13 +312,8 @@ void maxaflex_state::machine_reset()
m_portB_out = 0xff;
m_portC_out = 0xff;
- output().set_lamp_value(0, 0);
- output().set_lamp_value(1, 0);
- output().set_lamp_value(2, 0);
- output().set_lamp_value(3, 0);
- output().set_digit_value(0, 0x00);
- output().set_digit_value(1, 0x00);
- output().set_digit_value(2, 0x00);
+ std::fill(std::begin(m_lamp), std::end(m_lamp), 0);
+ std::fill(std::begin(m_digit), std::end(m_digit), 0x00);
}
TIMER_DEVICE_CALLBACK_MEMBER( maxaflex_state::mf_interrupt )
@@ -342,14 +355,14 @@ MACHINE_CONFIG_START(maxaflex_state::maxaflex)
MCFG_SCREEN_PALETTE("palette")
MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(atari_common_state, atari)
+ MCFG_PALETTE_INIT_OWNER(maxaflex_state, atari)
MCFG_DEFAULT_LAYOUT(layout_maxaflex)
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_SOUND_ADD("pokey", POKEY, pokey_device::FREQ_17_EXACT)
- MCFG_POKEY_INTERRUPT_CB(atari_common_state, interrupt_cb)
+ MCFG_POKEY_INTERRUPT_CB(maxaflex_state, interrupt_cb)
MCFG_POKEY_OUTPUT_RC(RES_K(1), CAP_U(0.0), 5.0)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
diff --git a/src/mame/drivers/mpu3.cpp b/src/mame/drivers/mpu3.cpp
index e00510a6655..c021390dfcd 100644
--- a/src/mame/drivers/mpu3.cpp
+++ b/src/mame/drivers/mpu3.cpp
@@ -165,7 +165,7 @@ TODO: - Distinguish door switches using manual
#include "video/awpvid.h" //Fruit Machines Only
-#define MPU3_MASTER_CLOCK (XTAL(4'000'000))
+static constexpr XTAL MPU3_MASTER_CLOCK = 4_MHz_XTAL;
/* Lookup table for CHR data */
@@ -184,6 +184,9 @@ public:
, m_reels(*this, "reel%u", 0U)
, m_meters(*this, "meters")
, m_vfd(*this, "vfd")
+ , m_triac(*this, "triac%u", 0U)
+ , m_digit(*this, "digit%u", 0U)
+ , m_lamp(*this, "lamp%u", 0U)
{ }
DECLARE_DRIVER_INIT(m3hprvpr);
@@ -224,7 +227,6 @@ protected:
void ic11_update();
void ic21_output(int data);
void ic21_setup();
- void mpu3_config_common();
virtual void machine_start() override;
virtual void machine_reset() override;
@@ -265,6 +267,9 @@ private:
required_device_array<stepper_device, 4> m_reels;
required_device<meters_device> m_meters;
optional_device<roc10937_device> m_vfd;
+ output_finder<8> m_triac;
+ output_finder<8> m_digit;
+ output_finder<8 * 8> m_lamp;
};
#define DISPLAY_PORT 0
@@ -274,14 +279,11 @@ private:
void mpu3_state::update_triacs()
{
- int i,triacdata;
+ int const triacdata = m_triac_ic3 + (m_triac_ic4 << 8) + (m_triac_ic5 << 9);
- triacdata=m_triac_ic3 + (m_triac_ic4 << 8) + (m_triac_ic5 << 9);
-
- for (i = 0; i < 8; i++)
- {
- output().set_indexed_value("triac", i, triacdata & (1 << i));
- }
+ // FIXME: m_triac_ic4 and m_triac_ic5 won't be used because they're shifted past what's checked here
+ for (int i = 0; i < 8; i++)
+ m_triac[i] = BIT(triacdata, i);
}
/* called if board is reset */
@@ -352,18 +354,17 @@ void mpu3_state::ic11_update()
if (m_IC11G1)
{
if ( m_IC11GA ) m_input_strobe |= 0x01;
- else m_input_strobe &= ~0x01;
+ else m_input_strobe &= ~0x01;
if ( m_IC11GB ) m_input_strobe |= 0x02;
- else m_input_strobe &= ~0x02;
+ else m_input_strobe &= ~0x02;
if ( m_IC11GC ) m_input_strobe |= 0x04;
- else m_input_strobe &= ~0x04;
+ else m_input_strobe &= ~0x04;
}
}
}
- else
- if ((m_IC11G2A)||(m_IC11G2B)||(!m_IC11G1))
+ else if ((m_IC11G2A)||(m_IC11G2B)||(!m_IC11G1))
{
m_input_strobe = 0x00;
}
@@ -487,32 +488,31 @@ READ8_MEMBER(mpu3_state::pia_ic4_porta_r)
/* IC4, 7 seg leds */
WRITE8_MEMBER(mpu3_state::pia_ic4_porta_w)
{
- int meter,swizzle;
LOG(("%s: IC4 PIA Port A Set to %2x (DISPLAY PORT)\n", machine().describe_context(),data));
m_ic4_input_a=data;
switch (m_disp_func)
{
- case DISPLAY_PORT:
+ case DISPLAY_PORT:
if(m_ic11_active)
{
if(m_led_strobe != m_input_strobe)
{
- swizzle = ((m_ic4_input_a & 0x01) << 2)+(m_ic4_input_a & 0x02)+((m_ic4_input_a & 0x4) >> 2)+(m_ic4_input_a & 0x08)+((m_ic4_input_a & 0x10) << 2)+(m_ic4_input_a & 0x20)+((m_ic4_input_a & 0x40) >> 2);
- output().set_digit_value(7 - m_input_strobe,swizzle);
+ int const swizzle = ((m_ic4_input_a & 0x01) << 2)+(m_ic4_input_a & 0x02)+((m_ic4_input_a & 0x4) >> 2)+(m_ic4_input_a & 0x08)+((m_ic4_input_a & 0x10) << 2)+(m_ic4_input_a & 0x20)+((m_ic4_input_a & 0x40) >> 2);
+ m_digit[7 - m_input_strobe] = swizzle;
}
m_led_strobe = m_input_strobe;
}
break;
- case METER_PORT:
- for (meter = 0; meter < 6; meter ++)
+ case METER_PORT:
+ for (int meter = 0; meter < 6; meter ++)
{
- swizzle = ((m_ic4_input_a ^ 0xff) & 0x3f);
- m_meters->update(meter, (swizzle & (1 << meter)));
+ int const swizzle = ((m_ic4_input_a ^ 0xff) & 0x3f);
+ m_meters->update(meter, swizzle & (1 << meter));
}
break;
- case BWB_FUNCTIONALITY:
+ case BWB_FUNCTIONALITY:
//Need to find a game to work this out, MFME has a specific option for it, but I see no activity there.
break;
@@ -522,8 +522,7 @@ WRITE8_MEMBER(mpu3_state::pia_ic4_porta_w)
WRITE8_MEMBER(mpu3_state::pia_ic4_portb_w)
{
LOG(("%s: IC4 PIA Port B Set to %2x (Lamp)\n", machine().describe_context(),data));
- int i;
- if(m_ic11_active)
+ if (m_ic11_active)
{
if (m_lamp_strobe != m_input_strobe)
{
@@ -531,10 +530,9 @@ WRITE8_MEMBER(mpu3_state::pia_ic4_portb_w)
// As a consequence, the lamp column data can change before the input strobe (effectively writing 0 to the previous strobe)
// without causing the relevant lamps to black out.
- for (i = 0; i < 8; i++)
- {
- output().set_lamp_value((8*m_input_strobe)+i, ((data & (1 << i)) !=0));
- }
+ for (int i = 0; i < 8; i++)
+ m_lamp[(m_input_strobe << 3)|i] = BIT(data, i);
+
m_lamp_strobe = m_input_strobe;
}
}
@@ -734,14 +732,13 @@ static INPUT_PORTS_START( mpu3 )
INPUT_PORTS_END
/* Common configurations */
-void mpu3_state::mpu3_config_common()
+void mpu3_state::machine_start()
{
m_ic21_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mpu3_state::ic21_timeout),this));
-}
-void mpu3_state::machine_start()
-{
- mpu3_config_common();
+ m_triac.resolve();
+ m_digit.resolve();
+ m_lamp.resolve();
}
/*
Characteriser (CHR)
diff --git a/src/mame/drivers/sitcom.cpp b/src/mame/drivers/sitcom.cpp
index 2e77a776f41..557d3f0402e 100644
--- a/src/mame/drivers/sitcom.cpp
+++ b/src/mame/drivers/sitcom.cpp
@@ -60,10 +60,16 @@ public:
, m_buttons(*this, "BUTTONS")
, m_maincpu(*this, "maincpu")
, m_bank(*this, "bank")
+ , m_leds(*this, "p%c%u", unsigned('a'), 0U)
, m_rxd(true)
{
}
+ DECLARE_INPUT_CHANGED_MEMBER(update_buttons);
+
+ void sitcom(machine_config &config);
+
+protected:
template <unsigned D> DECLARE_WRITE16_MEMBER(update_ds) { output().set_digit_value((D << 2) | offset, data); }
DECLARE_WRITE_LINE_MEMBER(update_rxd) { m_rxd = bool(state); }
DECLARE_WRITE_LINE_MEMBER(sod_led) { output().set_value("sod_led", state); }
@@ -72,19 +78,17 @@ public:
virtual DECLARE_WRITE8_MEMBER(update_pia_pa);
virtual DECLARE_WRITE8_MEMBER(update_pia_pb);
- DECLARE_INPUT_CHANGED_MEMBER(update_buttons);
-
- void sitcom(machine_config &config);
void sitcom_bank(address_map &map);
void sitcom_io(address_map &map);
void sitcom_mem(address_map &map);
-protected:
+
virtual void machine_start() override;
virtual void machine_reset() override;
required_ioport m_buttons;
required_device<cpu_device> m_maincpu;
required_device<address_map_bank_device> m_bank;
+ output_finder<2, 8> m_leds;
bool m_rxd;
};
@@ -110,15 +114,16 @@ public:
{
}
- virtual DECLARE_WRITE8_MEMBER(update_pia_pa) override;
- virtual DECLARE_WRITE8_MEMBER(update_pia_pb) override;
DECLARE_READ_LINE_MEMBER(shutter_r);
-
DECLARE_INPUT_CHANGED_MEMBER(update_shutter);
DECLARE_INPUT_CHANGED_MEMBER(update_speed);
void sitcomtmr(machine_config &config);
+
protected:
+ virtual DECLARE_WRITE8_MEMBER(update_pia_pa) override;
+ virtual DECLARE_WRITE8_MEMBER(update_pia_pb) override;
+
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
virtual void machine_start() override;
@@ -201,6 +206,8 @@ INPUT_PORTS_END
void sitcom_state::machine_start()
{
+ m_leds.resolve();
+
save_item(NAME(m_rxd));
m_rxd = true;
@@ -214,13 +221,13 @@ void sitcom_state::machine_reset()
WRITE8_MEMBER( sitcom_state::update_pia_pa )
{
for (int i = 0; 8 > i; ++i)
- output().set_indexed_value("pa", i, BIT(data, i));
+ m_leds[0][i] = BIT(data, i);
}
WRITE8_MEMBER( sitcom_state::update_pia_pb )
{
for (int i = 0; 8 > i; ++i)
- output().set_indexed_value("pb", i, BIT(data, i));
+ m_leds[1][i] = BIT(data, i);
}
INPUT_CHANGED_MEMBER( sitcom_state::update_buttons )
@@ -374,8 +381,9 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_START(sitcom_timer_state::sitcomtmr)
sitcom(config);
+
MCFG_DEVICE_ADD("ds2", DL1414T, 0) // remote display
- MCFG_DL1414_UPDATE_HANDLER(WRITE16(sitcom_state, update_ds<2>))
+ MCFG_DL1414_UPDATE_HANDLER(WRITE16(sitcom_timer_state, update_ds<2>))
MCFG_DEFAULT_LAYOUT(layout_sitcomtmr)
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/tk80.cpp b/src/mame/drivers/tk80.cpp
index f2a53cdb5ae..0c2961c7cf9 100644
--- a/src/mame/drivers/tk80.cpp
+++ b/src/mame/drivers/tk80.cpp
@@ -60,8 +60,18 @@ public:
tk80_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag)
, m_maincpu(*this, "maincpu")
+ , m_digit(*this, "digit%u", 0U)
{ }
+ void ics8080(machine_config &config);
+ void tk80(machine_config &config);
+ void mikrolab(machine_config &config);
+ void nd80z(machine_config &config);
+ void tk85(machine_config &config);
+
+protected:
+ virtual void machine_start() override;
+
DECLARE_READ8_MEMBER(key_matrix_r);
DECLARE_READ8_MEMBER(nd80z_key_r);
DECLARE_READ8_MEMBER(serial_r);
@@ -69,34 +79,45 @@ public:
DECLARE_WRITE8_MEMBER(mikrolab_serial_w);
DECLARE_READ8_MEMBER(display_r);
DECLARE_WRITE8_MEMBER(display_w);
- uint8_t m_term_data;
- uint8_t m_keyb_press;
- uint8_t m_keyb_press_flag;
- uint8_t m_shift_press_flag;
- uint8_t m_ppi_portc;
- required_device<cpu_device> m_maincpu;
- void ics8080(machine_config &config);
- void tk80(machine_config &config);
- void mikrolab(machine_config &config);
- void nd80z(machine_config &config);
- void tk85(machine_config &config);
+
void ics8080_mem(address_map &map);
void mikrolab_io(address_map &map);
void nd80z_io(address_map &map);
void tk80_io(address_map &map);
void tk80_mem(address_map &map);
void tk85_mem(address_map &map);
+
+private:
+ uint8_t m_term_data;
+ uint8_t m_keyb_press;
+ uint8_t m_keyb_press_flag;
+ uint8_t m_shift_press_flag;
+ uint8_t m_ppi_portc;
+
+ required_device<cpu_device> m_maincpu;
+ output_finder<8> m_digit;
};
+void tk80_state::machine_start()
+{
+ m_digit.resolve();
+
+ save_item(NAME(m_term_data));
+ save_item(NAME(m_keyb_press));
+ save_item(NAME(m_keyb_press_flag));
+ save_item(NAME(m_shift_press_flag));
+ save_item(NAME(m_ppi_portc));
+}
+
READ8_MEMBER( tk80_state::display_r )
{
- return output().get_digit_value(offset);
+ return m_digit[offset & 0x7];
}
WRITE8_MEMBER( tk80_state::display_w )
{
- output().set_digit_value(offset, data);
+ m_digit[offset & 0x7] = data;
}
ADDRESS_MAP_START(tk80_state::tk80_mem)
@@ -204,7 +225,7 @@ INPUT_PORTS_END
READ8_MEMBER( tk80_state::key_matrix_r )
{
-// PA0-7 keyscan in
+ // PA0-7 keyscan in
uint8_t data = 0xff;
@@ -220,16 +241,14 @@ READ8_MEMBER( tk80_state::key_matrix_r )
READ8_MEMBER( tk80_state::nd80z_key_r )
{
-// PA0-7 keyscan in
+ // PA0-7 keyscan in
uint8_t data = 0xff, row = m_ppi_portc & 7;
if (row == 6)
data &= ioport("X0")->read();
- else
- if (row == 5)
+ else if (row == 5)
data &= ioport("X1")->read();
- else
- if (row == 3)
+ else if (row == 3)
data &= ioport("X2")->read();
return data;
@@ -237,7 +256,7 @@ READ8_MEMBER( tk80_state::nd80z_key_r )
READ8_MEMBER( tk80_state::serial_r )
{
-// PB0 - serial in
+ // PB0 - serial in
//printf("B R\n");
return 0;
@@ -245,17 +264,17 @@ READ8_MEMBER( tk80_state::serial_r )
WRITE8_MEMBER( tk80_state::serial_w )
{
-// PC0 - serial out
-// PC4-6 keyscan out
-// PC7 - display on/off
+ // PC0 - serial out
+ // PC4-6 keyscan out
+ // PC7 - display on/off
m_ppi_portc = data ^ 0x70;
}
WRITE8_MEMBER( tk80_state::mikrolab_serial_w )
{
-// PC0 - serial out
-// PC4-6 keyscan out
-// PC7 - display on/off
+ // PC0 - serial out
+ // PC4-6 keyscan out
+ // PC7 - display on/off
m_ppi_portc = data;
}
@@ -290,7 +309,7 @@ MACHINE_CONFIG_START(tk80_state::mikrolab)
MACHINE_CONFIG_END
MACHINE_CONFIG_START(tk80_state::nd80z)
- MCFG_CPU_ADD("maincpu", Z80, XTAL(1'000'000)) // Sharp LH0080A, can't see writing on xtal
+ MCFG_CPU_ADD("maincpu", Z80, 1e6 ) // Sharp LH0080A, can't see writing on xtal
MCFG_CPU_PROGRAM_MAP(tk85_mem)
MCFG_CPU_IO_MAP(nd80z_io)
@@ -355,8 +374,8 @@ ROM_END
/* Driver */
// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS
-COMP( 1976, tk80, 0, 0, tk80, tk80, tk80_state, 0, "NEC", "TK-80", MACHINE_NO_SOUND_HW )
-COMP( 1980, nectk85, tk80, 0, tk85, tk80, tk80_state, 0, "NEC", "TK-85", MACHINE_NO_SOUND_HW )
-COMP( 19??, nd80z, tk80, 0, nd80z, tk80, tk80_state, 0, "Chunichi", "ND-80Z", MACHINE_NO_SOUND_HW )
-COMP( 19??, mikrolab, tk80, 0, mikrolab, mikrolab, tk80_state, 0, "<unknown>", "Mikrolab KR580IK80", MACHINE_NO_SOUND_HW )
-COMP( 19??, ics8080, tk80, 0, ics8080, ics8080, tk80_state, 0, "<unknown>", "ICS8080", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW )
+COMP( 1976, tk80, 0, 0, tk80, tk80, tk80_state, 0, "NEC", "TK-80", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW )
+COMP( 1980, nectk85, tk80, 0, tk85, tk80, tk80_state, 0, "NEC", "TK-85", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW )
+COMP( 19??, nd80z, tk80, 0, nd80z, tk80, tk80_state, 0, "Chunichi", "ND-80Z", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW )
+COMP( 19??, mikrolab, tk80, 0, mikrolab, mikrolab, tk80_state, 0, "<unknown>", "Mikrolab KR580IK80", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW )
+COMP( 19??, ics8080, tk80, 0, ics8080, ics8080, tk80_state, 0, "<unknown>", "ICS8080", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW )
diff --git a/src/mame/drivers/wacky_gator.cpp b/src/mame/drivers/wacky_gator.cpp
index d445e5b14de..7837ba110fa 100644
--- a/src/mame/drivers/wacky_gator.cpp
+++ b/src/mame/drivers/wacky_gator.cpp
@@ -32,60 +32,61 @@
class wackygtr_state : public driver_device
{
public:
- wackygtr_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ wackygtr_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_msm(*this, "msm"),
m_pit8253_0(*this, "pit8253_0"),
m_pit8253_1(*this, "pit8253_1"),
m_ticket(*this, "ticket"),
- m_samples(*this, "oki")
+ m_samples(*this, "oki"),
+ m_alligator(*this, "alligator%u", 0U),
+ m_digit(*this, "digit%u", 0U),
+ m_lamp(*this, "lamp%u", 0U)
{ }
- required_device<cpu_device> m_maincpu;
- required_device<msm5205_device> m_msm;
- required_device<pit8253_device> m_pit8253_0;
- required_device<pit8253_device> m_pit8253_1;
- required_device<ticket_dispenser_device> m_ticket;
- required_memory_region m_samples;
+ DECLARE_CUSTOM_INPUT_MEMBER(alligators_rear_sensors_r);
+ DECLARE_CUSTOM_INPUT_MEMBER(alligators_front_sensors_r);
+
+ void wackygtr(machine_config &config);
- DECLARE_DRIVER_INIT(wackygtr);
- void machine_reset() override;
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
DECLARE_WRITE_LINE_MEMBER(adpcm_int);
DECLARE_WRITE8_MEMBER(sample_ctrl_w);
DECLARE_WRITE8_MEMBER(alligators_ctrl1_w);
DECLARE_WRITE8_MEMBER(alligators_ctrl2_w);
- DECLARE_CUSTOM_INPUT_MEMBER(alligators_rear_sensors_r);
- DECLARE_CUSTOM_INPUT_MEMBER(alligators_front_sensors_r);
void set_lamps(int p, uint8_t value);
DECLARE_WRITE8_MEMBER(status_lamps_w);
- DECLARE_WRITE8_MEMBER(timing_lamps_0_w) { set_lamps(8 , data); }
- DECLARE_WRITE8_MEMBER(timing_lamps_1_w) { set_lamps(16, data); }
- DECLARE_WRITE8_MEMBER(timing_lamps_2_w) { set_lamps(24, data); }
+ template <unsigned N> DECLARE_WRITE8_MEMBER(timing_lamps_w) { set_lamps((N + 1) << 3, data); }
void set_digits(int p, uint8_t value);
- DECLARE_WRITE8_MEMBER(disp0_w) { set_digits(0, data); }
- DECLARE_WRITE8_MEMBER(disp1_w) { set_digits(2, data); }
- DECLARE_WRITE8_MEMBER(disp2_w) { set_digits(4, data); }
- DECLARE_WRITE8_MEMBER(disp3_w) { set_digits(6, data); }
+ template <unsigned N> DECLARE_WRITE8_MEMBER(disp_w) { set_digits(N << 1, data); }
void pmm8713_ck(int i, int state);
- DECLARE_WRITE_LINE_MEMBER(alligator0_ck) { pmm8713_ck(0, state); }
- DECLARE_WRITE_LINE_MEMBER(alligator1_ck) { pmm8713_ck(1, state); }
- DECLARE_WRITE_LINE_MEMBER(alligator2_ck) { pmm8713_ck(2, state); }
- DECLARE_WRITE_LINE_MEMBER(alligator3_ck) { pmm8713_ck(3, state); }
- DECLARE_WRITE_LINE_MEMBER(alligator4_ck) { pmm8713_ck(4, state); }
+ template <unsigned N> DECLARE_WRITE_LINE_MEMBER(alligator_ck) { pmm8713_ck(N, state); }
DECLARE_WRITE8_MEMBER(irq_ack_w) { m_maincpu->set_input_line(M6809_IRQ_LINE, CLEAR_LINE); }
DECLARE_WRITE8_MEMBER(firq_ack_w) { m_maincpu->set_input_line(M6809_FIRQ_LINE, CLEAR_LINE); }
TIMER_DEVICE_CALLBACK_MEMBER(nmi_timer) { m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); }
- void wackygtr(machine_config &config);
void program_map(address_map &map);
+
private:
+ required_device<cpu_device> m_maincpu;
+ required_device<msm5205_device> m_msm;
+ required_device<pit8253_device> m_pit8253_0;
+ required_device<pit8253_device> m_pit8253_1;
+ required_device<ticket_dispenser_device> m_ticket;
+ required_memory_region m_samples;
+ output_finder<5> m_alligator;
+ output_finder<8> m_digit;
+ output_finder<32> m_lamp;
+
int m_adpcm_sel;
uint16_t m_adpcm_pos;
uint8_t m_adpcm_ctrl;
@@ -95,10 +96,6 @@ private:
};
-DRIVER_INIT_MEMBER(wackygtr_state, wackygtr)
-{
-}
-
WRITE8_MEMBER(wackygtr_state::status_lamps_w)
{
/*
@@ -161,7 +158,7 @@ void wackygtr_state::pmm8713_ck(int i, int state)
int alligator_state = m_motors_pos[i] / 10;
if (alligator_state > 5) alligator_state = 5;
if (alligator_state < 0) alligator_state = 0;
- output().set_indexed_value("alligator", i, alligator_state);
+ m_alligator[i] = alligator_state;
}
}
@@ -184,6 +181,19 @@ CUSTOM_INPUT_MEMBER(wackygtr_state::alligators_front_sensors_r)
((m_motors_pos[4] < 5 || m_motors_pos[4] > 55) ? 0x10 : 0);
}
+void wackygtr_state::machine_start()
+{
+ m_alligator.resolve();
+ m_digit.resolve();
+ m_lamp.resolve();
+
+ save_item(NAME(m_adpcm_sel));
+ save_item(NAME(m_adpcm_pos));
+ save_item(NAME(m_adpcm_ctrl));
+ save_item(NAME(m_alligators_ctrl));
+ save_item(NAME(m_motors_pos));
+}
+
void wackygtr_state::machine_reset()
{
m_adpcm_pos = 0;
@@ -193,15 +203,15 @@ void wackygtr_state::machine_reset()
void wackygtr_state::set_digits(int p, uint8_t value)
{
- static uint8_t bcd2hex[] = { 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x67, 0, 0, 0, 0, 0, 0 }; // not accurate
- output().set_digit_value(p + 0, bcd2hex[value & 0x0f]);
- output().set_digit_value(p + 1, bcd2hex[(value >> 4) & 0x0f]);
+ static constexpr uint8_t bcd2hex[] = { 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x67, 0, 0, 0, 0, 0, 0 }; // not accurate
+ m_digit[p + 0] = bcd2hex[value & 0x0f];
+ m_digit[p + 1] = bcd2hex[(value >> 4) & 0x0f];
}
void wackygtr_state::set_lamps(int p, uint8_t value)
{
- for(int i=0; i<8; i++)
- output().set_lamp_value(p + i, BIT(value, i));
+ for (int i=0; i<8; i++)
+ m_lamp[p + i] = BIT(value, i);
}
static INPUT_PORTS_START( wackygtr )
@@ -254,10 +264,10 @@ WRITE_LINE_MEMBER(wackygtr_state::adpcm_int)
ADDRESS_MAP_START(wackygtr_state::program_map)
AM_RANGE(0x0200, 0x0200) AM_READNOP AM_WRITE(irq_ack_w)
AM_RANGE(0x0400, 0x0400) AM_READNOP AM_WRITE(firq_ack_w)
- AM_RANGE(0x0600, 0x0600) AM_WRITE(disp0_w)
- AM_RANGE(0x0800, 0x0800) AM_WRITE(disp1_w)
- AM_RANGE(0x0a00, 0x0a00) AM_WRITE(disp2_w)
- AM_RANGE(0x0c00, 0x0c00) AM_WRITE(disp3_w)
+ AM_RANGE(0x0600, 0x0600) AM_WRITE(disp_w<0>)
+ AM_RANGE(0x0800, 0x0800) AM_WRITE(disp_w<1>)
+ AM_RANGE(0x0a00, 0x0a00) AM_WRITE(disp_w<2>)
+ AM_RANGE(0x0c00, 0x0c00) AM_WRITE(disp_w<3>)
AM_RANGE(0x0e00, 0x0e00) AM_WRITE(sample_ctrl_w)
AM_RANGE(0x1000, 0x1001) AM_DEVWRITE("ymsnd", ym2413_device, write)
@@ -300,9 +310,9 @@ MACHINE_CONFIG_START(wackygtr_state::wackygtr)
MCFG_I8255_OUT_PORTC_CB(WRITE8(wackygtr_state, alligators_ctrl2_w))
MCFG_DEVICE_ADD("i8255_1", I8255, 0)
- MCFG_I8255_OUT_PORTA_CB(WRITE8(wackygtr_state, timing_lamps_0_w))
- MCFG_I8255_OUT_PORTB_CB(WRITE8(wackygtr_state, timing_lamps_1_w))
- MCFG_I8255_OUT_PORTC_CB(WRITE8(wackygtr_state, timing_lamps_2_w))
+ MCFG_I8255_OUT_PORTA_CB(WRITE8(wackygtr_state, timing_lamps_w<0>))
+ MCFG_I8255_OUT_PORTB_CB(WRITE8(wackygtr_state, timing_lamps_w<1>))
+ MCFG_I8255_OUT_PORTC_CB(WRITE8(wackygtr_state, timing_lamps_w<2>))
MCFG_DEVICE_ADD("i8255_2", I8255, 0)
MCFG_I8255_IN_PORTA_CB(IOPORT("IN0"))
@@ -311,19 +321,19 @@ MACHINE_CONFIG_START(wackygtr_state::wackygtr)
MCFG_DEVICE_ADD("pit8253_0", PIT8253, 0)
MCFG_PIT8253_CLK0(XTAL(3'579'545)/16) // this is a guess
- MCFG_PIT8253_OUT0_HANDLER(WRITELINE(wackygtr_state, alligator0_ck))
+ MCFG_PIT8253_OUT0_HANDLER(WRITELINE(wackygtr_state, alligator_ck<0>))
MCFG_PIT8253_CLK1(XTAL(3'579'545)/16) // this is a guess
- MCFG_PIT8253_OUT1_HANDLER(WRITELINE(wackygtr_state, alligator1_ck))
+ MCFG_PIT8253_OUT1_HANDLER(WRITELINE(wackygtr_state, alligator_ck<1>))
MCFG_PIT8253_CLK2(XTAL(3'579'545)/16) // this is a guess
- MCFG_PIT8253_OUT2_HANDLER(WRITELINE(wackygtr_state, alligator2_ck))
+ MCFG_PIT8253_OUT2_HANDLER(WRITELINE(wackygtr_state, alligator_ck<2>))
MCFG_DEVICE_ADD("pit8253_1", PIT8253, 0)
MCFG_PIT8253_CLK0(XTAL(3'579'545)/16) // this is a guess
MCFG_PIT8253_OUT0_HANDLER(INPUTLINE("maincpu", M6809_FIRQ_LINE))
MCFG_PIT8253_CLK1(XTAL(3'579'545)/16) // this is a guess
- MCFG_PIT8253_OUT1_HANDLER(WRITELINE(wackygtr_state, alligator3_ck))
+ MCFG_PIT8253_OUT1_HANDLER(WRITELINE(wackygtr_state, alligator_ck<3>))
MCFG_PIT8253_CLK2(XTAL(3'579'545)/16) // this is a guess
- MCFG_PIT8253_OUT2_HANDLER(WRITELINE(wackygtr_state, alligator4_ck))
+ MCFG_PIT8253_OUT2_HANDLER(WRITELINE(wackygtr_state, alligator_ck<4>))
MCFG_TICKET_DISPENSER_ADD("ticket", attotime::from_msec(200), TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_HIGH)
MACHINE_CONFIG_END
@@ -337,4 +347,4 @@ ROM_START( wackygtr )
ROM_LOAD("wp3-vo0.2h", 0x0000, 0x10000, CRC(91c7986f) SHA1(bc9fa0d41c1caa0f909a349f511d022b7e42c6cd))
ROM_END
-GAME(1990, wackygtr, 0, wackygtr, wackygtr, wackygtr_state, wackygtr, ROT0, "Data East", "Wacky Gator", MACHINE_IS_SKELETON_MECHANICAL | MACHINE_CLICKABLE_ARTWORK)
+GAME(1990, wackygtr, 0, wackygtr, wackygtr, wackygtr_state, 0, ROT0, "Data East", "Wacky Gator", MACHINE_IS_SKELETON_MECHANICAL | MACHINE_CLICKABLE_ARTWORK)