summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Robbbert <Robbbert@users.noreply.github.com>2018-04-07 00:42:05 +1000
committer Robbbert <Robbbert@users.noreply.github.com>2018-04-07 00:42:05 +1000
commit53dec1c0afa865771debb839c83502e9aab76d27 (patch)
tree3516f576897baf9a0a8764701a32575ab92afe81 /src
parent5512e70061c4251e8e2518dabbd249c527b414fb (diff)
(nw) output finder for cosmicos, newbrain.
Diffstat (limited to 'src')
-rw-r--r--src/mame/drivers/cosmicos.cpp33
-rw-r--r--src/mame/drivers/newbrain.cpp4
-rw-r--r--src/mame/includes/cosmicos.h45
-rw-r--r--src/mame/includes/newbrain.h6
-rw-r--r--src/mame/layout/cosmicos.lay2
5 files changed, 51 insertions, 39 deletions
diff --git a/src/mame/drivers/cosmicos.cpp b/src/mame/drivers/cosmicos.cpp
index 609bf5631e4..c304bbb67eb 100644
--- a/src/mame/drivers/cosmicos.cpp
+++ b/src/mame/drivers/cosmicos.cpp
@@ -163,7 +163,7 @@ WRITE8_MEMBER( cosmicos_state::segment_w )
if ((m_counter > 0) && (m_counter < 9))
{
- output().set_digit_value(10 - m_counter, data);
+ m_digits[10 - m_counter] = data;
}
}
@@ -208,7 +208,7 @@ INPUT_CHANGED_MEMBER( cosmicos_state::data )
if (!BIT(data, i))
{
m_data |= (1 << i);
- output().set_led_value(LED_D0 - i, 1);
+ m_leds[LED_D0 - i] = 1;
}
}
}
@@ -228,29 +228,29 @@ INPUT_CHANGED_MEMBER( cosmicos_state::single_step )
void cosmicos_state::set_cdp1802_mode(int mode)
{
- output().set_led_value(LED_RUN, 0);
- output().set_led_value(LED_LOAD, 0);
- output().set_led_value(LED_PAUSE, 0);
- output().set_led_value(LED_RESET, 0);
+ m_leds[LED_RUN] = 0;
+ m_leds[LED_LOAD] = 0;
+ m_leds[LED_PAUSE] = 0;
+ m_leds[LED_RESET] = 0;
switch (mode)
{
case MODE_RUN:
- output().set_led_value(LED_RUN, 1);
+ m_leds[LED_RUN] = 1;
m_wait = 1;
m_clear = 1;
break;
case MODE_LOAD:
- output().set_led_value(LED_LOAD, 1);
+ m_leds[LED_LOAD] = 1;
m_wait = 0;
m_clear = 0;
break;
case MODE_PAUSE:
- output().set_led_value(LED_PAUSE, 1);
+ m_leds[LED_PAUSE] = 1;
m_wait = 1;
m_clear = 0;
@@ -264,7 +264,7 @@ void cosmicos_state::set_cdp1802_mode(int mode)
m_clear = 0;
m_boot = 1;
- output().set_led_value(LED_RESET, 1);
+ m_leds[LED_RESET] = 1;
break;
}
}
@@ -282,7 +282,7 @@ void cosmicos_state::clear_input_data()
for (i = 0; i < 8; i++)
{
- output().set_led_value(LED_D0 - i, 0);
+ m_leds[LED_D0 - i] = 0;
}
}
@@ -358,9 +358,11 @@ INPUT_PORTS_END
TIMER_DEVICE_CALLBACK_MEMBER(cosmicos_state::digit_tick)
{
- m_digit = !m_digit;
+// commented this out because (a) m_digit isn't initialised anywhere,
+// and (b) writing to a negative digit is not a good idea.
+// m_digit = !m_digit;
- output().set_digit_value(m_digit, m_segment);
+// m_digits[m_digit] = m_segment;
}
TIMER_DEVICE_CALLBACK_MEMBER(cosmicos_state::int_tick)
@@ -402,7 +404,7 @@ READ_LINE_MEMBER( cosmicos_state::ef2_r )
uint8_t special = m_special->read();
int casin = (m_cassette)->input() < 0.0;
- output().set_led_value(LED_CASSETTE, casin);
+ m_leds[LED_CASSETTE] = casin;
return BIT(special, 1) | BIT(special, 3) | casin;
}
@@ -460,6 +462,9 @@ WRITE8_MEMBER( cosmicos_state::sc_w )
void cosmicos_state::machine_start()
{
+ m_digits.resolve();
+ m_leds.resolve();
+
/* initialize LED display */
m_led->rbi_w(1);
diff --git a/src/mame/drivers/newbrain.cpp b/src/mame/drivers/newbrain.cpp
index 62af2714b16..7e5444f9157 100644
--- a/src/mame/drivers/newbrain.cpp
+++ b/src/mame/drivers/newbrain.cpp
@@ -515,7 +515,7 @@ WRITE8_MEMBER( newbrain_state::cop_d_w )
// COP to VFD serial format, bits 15..0
// A B J I x H G2 C x F G1 E K L M D
uint16_t value = bitswap<16>(m_402_q, 11, 7, 1, 13, 10, 3, 2, 12, 9, 5, 6, 4, 0, 8, 14, 15) & 0x3fff;
- output().set_digit_value(m_405_q & 0x0f, value);
+ m_digits[m_405_q & 0x0f] = value;
if (LOG_VFD) logerror("%s %s vfd segment %u 402.Q %04x data %04x\n", machine().time().as_string(), machine().describe_context(), m_405_q & 0x0f, m_402_q, value);
}
@@ -725,6 +725,8 @@ int newbrain_state::get_pwrup_t()
void newbrain_state::machine_start()
{
+ m_digits.resolve();
+
// set power up timer
timer_set(attotime::from_usec(get_pwrup_t()), TIMER_ID_PWRUP);
diff --git a/src/mame/includes/cosmicos.h b/src/mame/includes/cosmicos.h
index a0210af1c20..eab984c12e6 100644
--- a/src/mame/includes/cosmicos.h
+++ b/src/mame/includes/cosmicos.h
@@ -54,23 +54,10 @@ public:
m_io_data(*this, "DATA"),
m_special(*this, "SPECIAL"),
m_buttons(*this, "BUTTONS")
+ , m_digits(*this, "digit%u", 0U)
+ , m_leds(*this, "led%u", 0U)
{ }
- required_device<cosmac_device> m_maincpu;
- required_device<cdp1864_device> m_cti;
- required_device<dm9368_device> m_led;
- required_device<cassette_image_device> m_cassette;
- required_device<speaker_sound_device> m_speaker;
- required_device<ram_device> m_ram;
- required_memory_region m_rom;
- required_ioport_array<4> m_key_row;
- required_ioport m_io_data;
- required_ioport m_special;
- required_ioport m_buttons;
-
- virtual void machine_start() override;
- virtual void machine_reset() override;
-
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
DECLARE_READ8_MEMBER( video_off_r );
@@ -105,7 +92,14 @@ public:
DECLARE_INPUT_CHANGED_MEMBER( memory_disable );
DECLARE_QUICKLOAD_LOAD_MEMBER( cosmicos );
+ DECLARE_DRIVER_INIT(cosmicos);
+ TIMER_DEVICE_CALLBACK_MEMBER(digit_tick);
+ TIMER_DEVICE_CALLBACK_MEMBER(int_tick);
+ void cosmicos(machine_config &config);
+ void cosmicos_io(address_map &map);
+ void cosmicos_mem(address_map &map);
+private:
void set_cdp1802_mode(int mode);
void clear_input_data();
@@ -132,12 +126,21 @@ public:
int m_efx;
int m_video_on;
- DECLARE_DRIVER_INIT(cosmicos);
- TIMER_DEVICE_CALLBACK_MEMBER(digit_tick);
- TIMER_DEVICE_CALLBACK_MEMBER(int_tick);
- void cosmicos(machine_config &config);
- void cosmicos_io(address_map &map);
- void cosmicos_mem(address_map &map);
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ required_device<cosmac_device> m_maincpu;
+ required_device<cdp1864_device> m_cti;
+ required_device<dm9368_device> m_led;
+ required_device<cassette_image_device> m_cassette;
+ required_device<speaker_sound_device> m_speaker;
+ required_device<ram_device> m_ram;
+ required_memory_region m_rom;
+ required_ioport_array<4> m_key_row;
+ required_ioport m_io_data;
+ required_ioport m_special;
+ required_ioport m_buttons;
+ output_finder<10> m_digits;
+ output_finder<14> m_leds;
};
#endif // MAME_INCLUDES_COSMICOS_H
diff --git a/src/mame/includes/newbrain.h b/src/mame/includes/newbrain.h
index 2b7953cd899..b57b3f149e1 100644
--- a/src/mame/includes/newbrain.h
+++ b/src/mame/includes/newbrain.h
@@ -39,8 +39,9 @@ public:
m_ram(*this, RAM_TAG),
m_rom(*this, Z80_TAG),
m_char_rom(*this, "chargen"),
- m_y(*this, "Y%u", 0),
- m_pwrup(0),
+ m_y(*this, "Y%u", 0)
+ , m_digits(*this, "digit%u", 0U)
+ , m_pwrup(0),
m_userint(1),
m_clkint(1),
m_copint(1),
@@ -113,6 +114,7 @@ protected:
required_memory_region m_rom;
required_memory_region m_char_rom;
required_ioport_array<16> m_y;
+ output_finder<16> m_digits;
int m_clk;
int m_tvp;
diff --git a/src/mame/layout/cosmicos.lay b/src/mame/layout/cosmicos.lay
index 68bb3a05370..f5eff6d4364 100644
--- a/src/mame/layout/cosmicos.lay
+++ b/src/mame/layout/cosmicos.lay
@@ -126,7 +126,7 @@
</bezel>
<!-- cassette led -->
- <bezel name="led12" element="red_led">
+ <bezel name="led13" element="red_led">
<bounds x="144" y="0" width="5" height="5" />
</bezel>
</view>