From 56e1f2c7b1881fa61c4ac0e5184161d559210ff2 Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Wed, 23 Aug 2023 20:30:40 +0200 Subject: various drivers: removed some output().set_value() calls --- src/mame/barcrest/mpu5.cpp | 5 +- src/mame/barcrest/mpu5.h | 7 +- src/mame/jaleco/cischeat.cpp | 10 ++- src/mame/jaleco/cischeat.h | 8 ++ src/mame/jpm/jpmimpct.cpp | 6 +- src/mame/jpm/jpmimpct.h | 4 + src/mame/midway/sspeedr.cpp | 10 ++- src/mame/midway/sspeedr.h | 6 +- src/mame/misc/joystand.cpp | 33 +++++--- src/mame/misc/rbmk.cpp | 5 +- src/mame/namco/namcos11.cpp | 15 +++- src/mame/olympia/portrait.cpp | 2 +- src/mame/olympia/portrait.h | 4 +- src/mame/pce/ggconnie.cpp | 6 +- src/mame/ramtek/m79amb.cpp | 151 +++++++++++++++++++++++++-------- src/mame/ramtek/m79amb.h | 59 ------------- src/mame/ramtek/m79amb_a.cpp | 190 +++++++++++++++++------------------------- src/mame/ramtek/m79amb_a.h | 30 +++++++ src/mame/taito/grchamp.cpp | 3 +- src/mame/taito/grchamp.h | 4 +- src/mame/taito/othunder.cpp | 6 +- src/mame/taito/othunder.h | 5 +- src/mame/taito/undrfire.cpp | 27 +++--- src/mame/taito/undrfire.h | 11 ++- 24 files changed, 356 insertions(+), 251 deletions(-) delete mode 100644 src/mame/ramtek/m79amb.h create mode 100644 src/mame/ramtek/m79amb_a.h diff --git a/src/mame/barcrest/mpu5.cpp b/src/mame/barcrest/mpu5.cpp index f14e394fe09..0c3b73c079c 100644 --- a/src/mame/barcrest/mpu5.cpp +++ b/src/mame/barcrest/mpu5.cpp @@ -279,8 +279,8 @@ void mpu5_state::asic_w8(offs_t offset, uint8_t data) m_sec->cs_w(~data&0x04); [[fallthrough]]; case 0x0b: - output().set_value("statuslamp1", BIT(data, 4)); - output().set_value("statuslamp2", BIT(data, 5)); + m_statuslamp[0] = BIT(data, 4); + m_statuslamp[1] = BIT(data, 5); if (data & 0x40) { @@ -425,6 +425,7 @@ INPUT_PORTS_END void mpu5_state::machine_start() { + m_statuslamp.resolve(); m_cpuregion = (uint16_t*)memregion( "maincpu" )->base(); m_mainram = make_unique_clear(0x20000); m_pic_output_bit =0; diff --git a/src/mame/barcrest/mpu5.h b/src/mame/barcrest/mpu5.h index 5ca15429b47..fb6460f0457 100644 --- a/src/mame/barcrest/mpu5.h +++ b/src/mame/barcrest/mpu5.h @@ -17,10 +17,14 @@ public: : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") , m_sec(*this, "sec") + , m_statuslamp(*this, "statuslamp%u", 1U) { } void mpu5(machine_config &config); +protected: + virtual void machine_start() override; + private: uint16_t mpu5_mem_r(offs_t offset, uint16_t mem_mask = ~0); void mpu5_mem_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); @@ -33,7 +37,6 @@ private: uint16_t pic_r(offs_t offset); void pic_w(offs_t offset, uint16_t data); - virtual void machine_start() override; void mpu5_map(address_map &map); uint16_t* m_cpuregion = nullptr; @@ -53,6 +56,8 @@ private: // devices required_device m_maincpu; required_device m_sec; + + output_finder<2> m_statuslamp; }; INPUT_PORTS_EXTERN( mpu5 ); diff --git a/src/mame/jaleco/cischeat.cpp b/src/mame/jaleco/cischeat.cpp index 6dd111039f9..5e8778fe6e8 100644 --- a/src/mame/jaleco/cischeat.cpp +++ b/src/mame/jaleco/cischeat.cpp @@ -723,6 +723,14 @@ void armchamp2_state::armchmp2_map(address_map &map) #define RIGHT 0 #define LEFT 1 +void captflag_state::machine_start() +{ + cischeat_state::machine_start(); + + m_motor_left_output.resolve(); + m_motor_right_output.resolve(); +} + void captflag_state::leds_w(offs_t offset, uint16_t data, uint16_t mem_mask) { COMBINE_DATA( &m_captflag_leds ); @@ -824,7 +832,7 @@ void captflag_state::motor_move(int side, uint16_t data) dev.reset(); } - output().set_value((side == RIGHT) ? "right" : "left", pos); + (side == RIGHT) ? (m_motor_right_output = pos) : (m_motor_left_output = pos) ; } template diff --git a/src/mame/jaleco/cischeat.h b/src/mame/jaleco/cischeat.h index 41d59a419bc..dc6ecfd0a09 100644 --- a/src/mame/jaleco/cischeat.h +++ b/src/mame/jaleco/cischeat.h @@ -213,6 +213,8 @@ public: , m_motor_right(*this, "motor_right") , m_oki1_bank(*this, "oki1_bank") , m_oki2_bank(*this, "oki2_bank") + , m_motor_left_output(*this, "left") + , m_motor_right_output(*this, "right") { for (int side = 0; side < 2; ++side) m_motor_command[side] = m_motor_pos[side] = 0; @@ -225,6 +227,9 @@ public: void init_captflag(); void init_vscaptfl(); +protected: + virtual void machine_start() override; + private: void motor_command_right_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); void motor_command_left_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); @@ -247,6 +252,9 @@ private: required_memory_bank m_oki1_bank; required_memory_bank m_oki2_bank; + output_finder<> m_motor_left_output; + output_finder<> m_motor_right_output; + uint16_t m_captflag_leds; uint16_t m_motor_command[2]; uint16_t m_motor_pos[2]; diff --git a/src/mame/jpm/jpmimpct.cpp b/src/mame/jpm/jpmimpct.cpp index dfe0ff667c3..4f52db34090 100644 --- a/src/mame/jpm/jpmimpct.cpp +++ b/src/mame/jpm/jpmimpct.cpp @@ -246,6 +246,8 @@ void jpmimpct_state::machine_start() { m_digits.resolve(); m_lamp_output.resolve(); + m_pwrled.resolve(); + m_statled.resolve(); save_item(NAME(m_optic_pattern)); save_item(NAME(m_payen)); @@ -373,8 +375,8 @@ uint16_t jpmimpct_state::jpmio_r() void jpmimpct_state::pwrled_w(offs_t offset, uint16_t data, uint16_t mem_mask) { - output().set_value("PWRLED",!(data&0x100)); - output().set_value("STATLED",!(data&0x200)); + m_pwrled = !(data & 0x100); + m_statled = !(data & 0x200); } void jpmimpct_state::reels_0123_w(offs_t offset, uint16_t data, uint16_t mem_mask) diff --git a/src/mame/jpm/jpmimpct.h b/src/mame/jpm/jpmimpct.h index 56c3aea3751..6f636f6af4a 100644 --- a/src/mame/jpm/jpmimpct.h +++ b/src/mame/jpm/jpmimpct.h @@ -76,6 +76,8 @@ public: , m_upd7759(*this, "upd") , m_reel(*this, "reel%u", 0U) , m_lamp_output(*this, "lamp%u", 0U) + , m_pwrled(*this, "PWRLED") + , m_statled(*this, "STATLED") { } void impact_nonvideo(machine_config &config); @@ -171,6 +173,8 @@ private: required_device m_upd7759; optional_device_array m_reel; output_finder<256> m_lamp_output; + output_finder<> m_pwrled; + output_finder<> m_statled; }; class jpmimpct_video_state : public jpmimpct_state diff --git a/src/mame/midway/sspeedr.cpp b/src/mame/midway/sspeedr.cpp index 219e20b2918..73a90af6c0a 100644 --- a/src/mame/midway/sspeedr.cpp +++ b/src/mame/midway/sspeedr.cpp @@ -21,6 +21,12 @@ TODO: #include "sspeedr.lh" +void sspeedr_state::machine_start() +{ + m_digits.resolve(); + m_lampgo.resolve(); + m_lampep.resolve(); +} void sspeedr_state::palette(palette_device &palette) const { @@ -50,8 +56,8 @@ void sspeedr_state::int_ack_w(uint8_t data) void sspeedr_state::lamp_w(uint8_t data) { - output().set_value("lampGO", BIT(data, 0)); - output().set_value("lampEP", BIT(data, 1)); + m_lampgo = BIT(data, 0); + m_lampep = BIT(data, 1); machine().bookkeeping().coin_counter_w(0, data & 8); } diff --git a/src/mame/midway/sspeedr.h b/src/mame/midway/sspeedr.h index 863766cdccf..5a2a636f008 100644 --- a/src/mame/midway/sspeedr.h +++ b/src/mame/midway/sspeedr.h @@ -17,6 +17,8 @@ public: , m_gfxdecode(*this, "gfxdecode") , m_palette(*this, "palette") , m_digits(*this, "digit%u", 0U) + , m_lampgo(*this, "lampGO") + , m_lampep(*this, "lampEP") , m_pedal_bit0(*this, "sound_nl:pedal_bit0") , m_pedal_bit1(*this, "sound_nl:pedal_bit1") , m_pedal_bit2(*this, "sound_nl:pedal_bit2") @@ -35,7 +37,7 @@ public: protected: virtual void video_start() override; - virtual void machine_start() override { m_digits.resolve(); } + virtual void machine_start() override; private: void int_ack_w(uint8_t data); @@ -82,6 +84,8 @@ private: required_device m_gfxdecode; required_device m_palette; output_finder<26> m_digits; + output_finder<> m_lampgo; + output_finder<> m_lampep; required_device m_pedal_bit0; required_device m_pedal_bit1; required_device m_pedal_bit2; diff --git a/src/mame/misc/joystand.cpp b/src/mame/misc/joystand.cpp index 30048df4c9b..b3ba80d33bb 100644 --- a/src/mame/misc/joystand.cpp +++ b/src/mame/misc/joystand.cpp @@ -127,14 +127,18 @@ public: m_bg15_1_ram(*this, "bg15_1_ram"), m_scroll(*this, "scroll"), m_enable(*this, "enable"), - m_outputs(*this, "outputs") + m_outputs(*this, "outputs"), + m_blocker(*this, "blocker"), + m_error_lamp(*this, "error_lamp"), + m_photo_lamp(*this, "photo_lamp"), + m_ok_button_led(*this, "ok_button_led"), + m_cancel_button_led(*this, "cancel_button_led") { } void joystand(machine_config &config); protected: virtual void machine_start() override; - virtual void machine_reset() override; virtual void video_start() override; private: @@ -157,6 +161,13 @@ private: required_shared_ptr m_enable; required_shared_ptr m_outputs; + // I/O + output_finder<> m_blocker; + output_finder<> m_error_lamp; + output_finder<> m_photo_lamp; + output_finder<> m_ok_button_led; + output_finder<> m_cancel_button_led; + // tilemaps tilemap_t *m_bg1_tmap = nullptr; tilemap_t *m_bg2_tmap = nullptr; @@ -392,14 +403,14 @@ void joystand_state::outputs_w(offs_t offset, uint16_t data, uint16_t mem_mask) machine().bookkeeping().coin_counter_w(0, BIT(data, 0)); // coin counter 1 machine().bookkeeping().coin_counter_w(1, BIT(data, 1)); // coin counter 2 - output().set_value("blocker", BIT(data, 2)); - output().set_value("error_lamp", BIT(data, 3)); // counter error - output().set_value("photo_lamp", BIT(data, 4)); // during photo + m_blocker = BIT(data, 2); + m_error_lamp = BIT(data, 3); // counter error + m_photo_lamp = BIT(data, 4); // during photo } if (ACCESSING_BITS_8_15) { - output().set_value("ok_button_led", BIT(data, 8)); - output().set_value("cancel_button_led", BIT(data, 9)); + m_ok_button_led = BIT(data, 8); + m_cancel_button_led = BIT(data, 9); } } @@ -549,11 +560,13 @@ GFXDECODE_END void joystand_state::machine_start() { + m_blocker.resolve(); + m_error_lamp.resolve(); + m_photo_lamp.resolve(); + m_ok_button_led.resolve(); + m_cancel_button_led.resolve(); } -void joystand_state::machine_reset() -{ -} void joystand_state::joystand(machine_config &config) { diff --git a/src/mame/misc/rbmk.cpp b/src/mame/misc/rbmk.cpp index 440d9b1bc1f..ef11dc6daad 100644 --- a/src/mame/misc/rbmk.cpp +++ b/src/mame/misc/rbmk.cpp @@ -142,11 +142,13 @@ uint16_t rbmk_state::dip_mux_r() { uint16_t res = 0xffff; + // TODO: & 0x00ff are the inputs for keyboard mode in rbmk switch (m_dip_mux & 0x7000) { case 0x1000: res = m_dsw[0]->read(); break; case 0x2000: res = m_dsw[1]->read(); break; case 0x4000: res = m_dsw[2]->read(); break; + // TODO: 0x8000 is checked at startup by super555, which has 4 DIP banks. However the game doesn`t use the 4th anywhere. } return res; @@ -192,8 +194,9 @@ void rbmk_state::rbmk_mem(address_map &map) map(0xc00000, 0xc00001).rw(FUNC(rbmk_state::dip_mux_r), FUNC(rbmk_state::dip_mux_w)); map(0xc08000, 0xc08001).portr("IN1").w(FUNC(rbmk_state::tilebank_w)); map(0xc10000, 0xc10001).portr("IN2"); - map(0xc18080, 0xc18081).r(FUNC(rbmk_state::unk_r)); + map(0xc18080, 0xc18081).r(FUNC(rbmk_state::unk_r)); // TODO: from MCU? map(0xc20000, 0xc20000).r("oki", FUNC(okim6295_device::read)); + //map(0xc20080, 0xc20081) // TODO: to MCU? map(0xc28000, 0xc28000).w("oki", FUNC(okim6295_device::write)); } diff --git a/src/mame/namco/namcos11.cpp b/src/mame/namco/namcos11.cpp index 7ff7a01ce57..ad0d378d0d0 100644 --- a/src/mame/namco/namcos11.cpp +++ b/src/mame/namco/namcos11.cpp @@ -469,6 +469,8 @@ public: , m_bankedroms(*this, "bankedroms") , m_bank(*this, "bank%u", 1) , m_lightgun_io(*this, {"GUN1X", "GUN1Y", "GUN2X", "GUN2Y"}) + , m_led(*this, "led%u", 0U) + , m_recoil(*this, "recoil%u", 0U) { } @@ -516,6 +518,8 @@ private: optional_memory_region m_bankedroms; optional_memory_bank_array<8> m_bank; optional_ioport_array<4> m_lightgun_io; + output_finder<2> m_led; + output_finder<2> m_recoil; uint32_t m_n_bankoffset; uint8_t m_su_83; @@ -561,10 +565,10 @@ void namcos11_state::lightgun_w(offs_t offset, uint16_t data, uint16_t mem_mask) switch( offset ) { case 0: - output().set_value( "led0", !( data & 0x08 ) ); - output().set_value( "led1", !( data & 0x04 ) ); - output().set_value( "recoil0", !( data & 0x02 ) ); - output().set_value( "recoil1", !( data & 0x01 ) ); + m_led[0] = !( data & 0x08 ); + m_led[1] = !( data & 0x04 ); + m_recoil[0] = !( data & 0x02 ); + m_recoil[1] = !( data & 0x01 ); verboselog(1, "lightgun_w: outputs (%08x %08x)\n", data, mem_mask ); break; @@ -703,6 +707,9 @@ void namcos11_state::c76_speedup_w(offs_t offset, uint16_t data, uint16_t mem_ma void namcos11_state::driver_start() { + m_led.resolve(); + m_recoil.resolve(); + // C76 idle skipping, large speedboost if (C76_SPEEDUP) { diff --git a/src/mame/olympia/portrait.cpp b/src/mame/olympia/portrait.cpp index 39aee701464..18d30d2d794 100644 --- a/src/mame/olympia/portrait.cpp +++ b/src/mame/olympia/portrait.cpp @@ -120,7 +120,7 @@ void portrait_state::ctrl_w(uint8_t data) m_lamps[1] = BIT(data, 6); /* shows the black and white photo from the camera */ - output().set_value("photo", (data >> 7) & 1); + m_photo = (data >> 7) & 1; } // $9235-$9236 raw scroll values up to 511 diff --git a/src/mame/olympia/portrait.h b/src/mame/olympia/portrait.h index eeb70f0cef0..38c4d3de864 100644 --- a/src/mame/olympia/portrait.h +++ b/src/mame/olympia/portrait.h @@ -24,6 +24,7 @@ public: , m_fgvideoram(*this, "fgvideoram") , m_spriteram(*this, "spriteram") , m_lamps(*this, "lamp%u", 0U) + , m_photo(*this, "photo") { } static constexpr feature_type unemulated_features() { return feature::CAMERA; } @@ -31,7 +32,7 @@ public: void portrait(machine_config &config); protected: - virtual void machine_start() override { m_lamps.resolve(); } + virtual void machine_start() override { m_lamps.resolve(); m_photo.resolve(); } virtual void video_start() override; private: @@ -61,6 +62,7 @@ private: required_shared_ptr m_fgvideoram; required_shared_ptr m_spriteram; output_finder<2> m_lamps; + output_finder<> m_photo; int m_scroll = 0; tilemap_t *m_foreground = nullptr; diff --git a/src/mame/pce/ggconnie.cpp b/src/mame/pce/ggconnie.cpp index 9511050297a..3a5e41f70d9 100644 --- a/src/mame/pce/ggconnie.cpp +++ b/src/mame/pce/ggconnie.cpp @@ -40,6 +40,7 @@ public: , m_rtc(*this, "rtc") , m_oki(*this, "oki") , m_okibank(*this, "okibank") + , m_lamp(*this, "lamp") { } void ggconnie(machine_config &config); @@ -58,17 +59,20 @@ private: required_device m_rtc; required_device m_oki; required_memory_bank m_okibank; + output_finder<> m_lamp; }; void ggconnie_state::machine_start() { + m_lamp.resolve(); + m_okibank->configure_entries(0, 8, memregion("oki")->base(), 0x10000); } void ggconnie_state::lamp_w(uint8_t data) { - output().set_value("lamp", !BIT(data,0)); + m_lamp =!BIT(data, 0); } void ggconnie_state::output_w(uint8_t data) diff --git a/src/mame/ramtek/m79amb.cpp b/src/mame/ramtek/m79amb.cpp index fad5dad407d..ef691325d7b 100644 --- a/src/mame/ramtek/m79amb.cpp +++ b/src/mame/ramtek/m79amb.cpp @@ -1,5 +1,6 @@ // license:BSD-3-Clause -// copyright-holders:Al Kossow +// copyright-holders: Al Kossow + /* Ramtek M79 Ambush @@ -57,27 +58,109 @@ and two large (paddles pretending to be) guns. */ #include "emu.h" -#include "m79amb.h" + +#include "m79amb_a.h" + +#include "cpu/i8085/i8085.h" +#include "sound/discrete.h" #include "screen.h" #include "speaker.h" + +namespace { + +class m79amb_state : public driver_device +{ +public: + m79amb_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_videoram(*this, "videoram"), + m_mask(*this, "mask"), + m_discrete(*this, "discrete"), + m_maincpu(*this, "maincpu"), + m_gun_port(*this, "800%u", 4U), + m_gun_pos(*this, "GUN%u", 1U), + m_self_test(*this, "SELF_TEST"), + m_exp_lamp(*this, "EXP_LAMP") + { } + + void m79amb(machine_config &config); + + void init_m79amb(); + +protected: + void machine_start() override; + +private: + required_shared_ptr m_videoram; + required_shared_ptr m_mask; + + required_device m_discrete; + required_device m_maincpu; + + required_ioport_array<2> m_gun_port; + required_ioport_array<2> m_gun_pos; + output_finder<> m_self_test; + output_finder<> m_exp_lamp; + + // misc + uint8_t m_lut_gun[2][0x100]{}; + + void videoram_w(offs_t offset, uint8_t data); + template uint8_t gray5bit_controller_r(); + void _8000_w(uint8_t data); + void _8002_w(uint8_t data); + void _8003_w(uint8_t data); + uint8_t inta_r(); + + uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + void main_map(address_map &map); +}; + + +// the ports are guessed from operation +// the schematics do not show the actual hookup + +void m79amb_state::_8000_w(uint8_t data) +{ + // these values are not latched + // they are pulsed when the port is addressed + // the discrete system will just trigger from them + m_discrete->write(M79AMB_SHOT_EN, data & 0x01); + m_discrete->write(M79AMB_BOOM_EN, data & 0x02); + m_discrete->write(M79AMB_THUD_EN, data & 0x04); +} + +void m79amb_state::_8003_w(uint8_t data) +{ + // Self Test goes low on reset and lights LED + // LED goes off on pass + m_self_test = BIT(data, 0); + m_discrete->write(M79AMB_MC_REV_EN, data & 0x02); + m_discrete->write(M79AMB_MC_CONTROL_EN, data & 0x04); + m_discrete->write(M79AMB_TANK_TRUCK_JEEP_EN, data & 0x08); + m_discrete->write(M79AMB_WHISTLE_B_EN, data & 0x10); + m_discrete->write(M79AMB_WHISTLE_A_EN, data & 0x20); +} + void m79amb_state::machine_start() { m_self_test.resolve(); + m_exp_lamp.resolve(); } -void m79amb_state::ramtek_videoram_w(offs_t offset, uint8_t data) +void m79amb_state::videoram_w(offs_t offset, uint8_t data) { m_videoram[offset] = data & ~*m_mask; } -uint32_t m79amb_state::screen_update_ramtek(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +uint32_t m79amb_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { for (offs_t offs = 0; offs < 0x2000; offs++) { uint8_t data = m_videoram[offs]; - int y = offs >> 5; + int const y = offs >> 5; int x = (offs & 0x1f) << 3; for (int i = 0; i < 8; i++) @@ -94,42 +177,35 @@ uint32_t m79amb_state::screen_update_ramtek(screen_device &screen, bitmap_rgb32 } -uint8_t m79amb_state::gray5bit_controller0_r() +template +uint8_t m79amb_state::gray5bit_controller_r() { - uint8_t port_data = ioport("8004")->read(); - uint8_t gun_pos = ioport("GUN1")->read(); + uint8_t const port_data = m_gun_port[Which]->read(); + uint8_t const gun_pos = m_gun_pos[Which]->read(); - return (port_data & 0xe0) | m_lut_gun1[gun_pos]; + return (port_data & 0xe0) | m_lut_gun[Which][gun_pos]; } -uint8_t m79amb_state::gray5bit_controller1_r() +void m79amb_state::_8002_w(uint8_t data) { - uint8_t port_data = ioport("8005")->read(); - uint8_t gun_pos = ioport("GUN2")->read(); - - return (port_data & 0xe0) | m_lut_gun2[gun_pos]; -} - -void m79amb_state::m79amb_8002_w(uint8_t data) -{ - /* D1 may also be watchdog reset */ - /* port goes to 0x7f to turn on explosion lamp */ - output().set_value("EXP_LAMP", data ? 1 : 0); + // D1 may also be watchdog reset + // port goes to 0x7f to turn on explosion lamp + m_exp_lamp = data ? 1 : 0; } void m79amb_state::main_map(address_map &map) { map(0x0000, 0x1fff).rom(); - map(0x4000, 0x5fff).ram().w(FUNC(m79amb_state::ramtek_videoram_w)).share("videoram"); - map(0x6000, 0x63ff).ram(); /* ?? */ - map(0x8000, 0x8000).portr("8000").w(FUNC(m79amb_state::m79amb_8000_w)); + map(0x4000, 0x5fff).ram().w(FUNC(m79amb_state::videoram_w)).share(m_videoram); + map(0x6000, 0x63ff).ram(); // ?? + map(0x8000, 0x8000).portr("8000").w(FUNC(m79amb_state::_8000_w)); map(0x8001, 0x8001).writeonly().share("mask"); - map(0x8002, 0x8002).portr("8002").w(FUNC(m79amb_state::m79amb_8002_w)); - map(0x8003, 0x8003).w(FUNC(m79amb_state::m79amb_8003_w)); - map(0x8004, 0x8004).r(FUNC(m79amb_state::gray5bit_controller0_r)); - map(0x8005, 0x8005).r(FUNC(m79amb_state::gray5bit_controller1_r)); - map(0xc000, 0xc07f).ram(); /* ?? */ - map(0xc200, 0xc27f).ram(); /* ?? */ + map(0x8002, 0x8002).portr("8002").w(FUNC(m79amb_state::_8002_w)); + map(0x8003, 0x8003).w(FUNC(m79amb_state::_8003_w)); + map(0x8004, 0x8004).r(FUNC(m79amb_state::gray5bit_controller_r<0>)); + map(0x8005, 0x8005).r(FUNC(m79amb_state::gray5bit_controller_r<1>)); + map(0xc000, 0xc07f).ram(); // ?? + map(0xc200, 0xc27f).ram(); // ?? } @@ -194,18 +270,18 @@ uint8_t m79amb_state::inta_r() void m79amb_state::m79amb(machine_config &config) { - /* basic machine hardware */ + // basic machine hardware I8080(config, m_maincpu, 19.6608_MHz_XTAL / 10); m_maincpu->set_addrmap(AS_PROGRAM, &m79amb_state::main_map); m_maincpu->in_inta_func().set(FUNC(m79amb_state::inta_r)); - /* video hardware */ + // video hardware screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_raw(19.6608_MHz_XTAL / 4, 320, 0, 256, 262, 32, 256); - screen.set_screen_update(FUNC(m79amb_state::screen_update_ramtek)); + screen.set_screen_update(FUNC(m79amb_state::screen_update)); screen.screen_vblank().set_inputline(m_maincpu, 0, ASSERT_LINE); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); DISCRETE(config, m_discrete, m79amb_discrete).add_route(ALL_OUTPUTS, "mono", 1.0); @@ -269,12 +345,15 @@ void m79amb_state::init_m79amb() // gun 1, start at left 18 while (j < 0x100 && j <= lut_cross[i]) - m_lut_gun1[j++] = gray; + m_lut_gun[0][j++] = gray; // gun 2, start at right 235 while (k >= 0 && k >= 253 - lut_cross[i]) - m_lut_gun2[k--] = gray; + m_lut_gun[1][k--] = gray; } } +} // anonymous namespace + + GAME( 1977, m79amb, 0, m79amb, m79amb, m79amb_state, init_m79amb, ROT0, "Ramtek", "M-79 Ambush", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/ramtek/m79amb.h b/src/mame/ramtek/m79amb.h deleted file mode 100644 index 4e0aba6c134..00000000000 --- a/src/mame/ramtek/m79amb.h +++ /dev/null @@ -1,59 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Al Kossow -#ifndef MAME_RAMTEK_M79AMB_H -#define MAME_RAMTEK_M79AMB_H - -#pragma once - -#include "cpu/i8085/i8085.h" -#include "sound/discrete.h" - -class m79amb_state : public driver_device -{ -public: - m79amb_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_videoram(*this, "videoram"), - m_mask(*this, "mask"), - m_discrete(*this, "discrete"), - m_maincpu(*this, "maincpu"), - m_self_test(*this, "SELF_TEST") - { } - - void m79amb(machine_config &config); - - void init_m79amb(); - -protected: - void machine_start() override; - -private: - void ramtek_videoram_w(offs_t offset, uint8_t data); - uint8_t gray5bit_controller0_r(); - uint8_t gray5bit_controller1_r(); - void m79amb_8000_w(uint8_t data); - void m79amb_8002_w(uint8_t data); - void m79amb_8003_w(uint8_t data); - uint8_t inta_r(); - - uint32_t screen_update_ramtek(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - void main_map(address_map &map); - - /* memory pointers */ - required_shared_ptr m_videoram; - required_shared_ptr m_mask; - required_device m_discrete; - required_device m_maincpu; - - output_finder<> m_self_test; - - /* misc */ - uint8_t m_lut_gun1[0x100]{}; - uint8_t m_lut_gun2[0x100]{}; -}; - -/*----------- defined in audio/m79amb.c -----------*/ - -DISCRETE_SOUND_EXTERN( m79amb_discrete ); - -#endif // MAME_RAMTEK_M79AMB_H diff --git a/src/mame/ramtek/m79amb_a.cpp b/src/mame/ramtek/m79amb_a.cpp index ff9f169f6c5..4308292a465 100644 --- a/src/mame/ramtek/m79amb_a.cpp +++ b/src/mame/ramtek/m79amb_a.cpp @@ -1,29 +1,21 @@ // license:BSD-3-Clause -// copyright-holders:Derrick Renaud +// copyright-holders: Derrick Renaud + /************************************************************************ * m79amb Sound System Analog emulation * Nov 2008, Derrick Renaud ************************************************************************/ #include "emu.h" -#include "m79amb.h" -#include "sound/discrete.h" + +#include "m79amb_a.h" + #define TIME_OF_9602(r, c) (0.34 * (r) * (c) * (1.0 + 1.0 / (r))) #define TIME_OF_9602_WITH_DIODE(r, c) (0.3 * (r) * (c)) -/* Discrete Sound Input Nodes */ -#define M79AMB_BOOM_EN NODE_01 -#define M79AMB_THUD_EN NODE_02 -#define M79AMB_SHOT_EN NODE_03 -#define M79AMB_MC_REV_EN NODE_04 -#define M79AMB_MC_CONTROL_EN NODE_05 -#define M79AMB_TANK_TRUCK_JEEP_EN NODE_06 -#define M79AMB_WHISTLE_A_EN NODE_07 -#define M79AMB_WHISTLE_B_EN NODE_08 - -/* Discrete Sound Output Nodes */ +// Discrete Sound Output Nodes #define M79AMB_BOOM_SND NODE_11 #define M79AMB_THUD_SND NODE_12 #define M79AMB_SHOT_SND NODE_13 @@ -32,7 +24,7 @@ #define M79AMB_WHISTLE_A_SND NODE_16 #define M79AMB_WHISTLE_B_SND NODE_17 -/* Parts List - Resistors */ +// Parts List - Resistors #define M79AMB_R2 RES_K(5.6) #define M79AMB_R6 220 #define M79AMB_R9 RES_K(4.7) @@ -83,7 +75,7 @@ #define M79AMB_R84 RES_K(50) #define M79AMB_R86 470 -/* Parts List - Capacitors */ +// Parts List - Capacitors #define M79AMB_C2 CAP_U(39) #define M79AMB_C3 CAP_U(22) #define M79AMB_C6 CAP_U(0.1) @@ -126,14 +118,14 @@ static const discrete_mixer_desc m79amb_final_mix = M79AMB_R81 + RES_2_PARALLEL(M79AMB_R59, M79AMB_R57 + M79AMB_R58), M79AMB_R82 + RES_2_PARALLEL(M79AMB_R69, M79AMB_R67 + M79AMB_R68) }, - {0}, /* no r_nodes */ + {0}, // no r_nodes {M79AMB_C6, M79AMB_C12, M79AMB_C18, M79AMB_C23, M79AMB_C28, M79AMB_C32, M79AMB_C36}, 0, M79AMB_R83 + M79AMB_R84, M79AMB_C37, M79AMB_C42, 0, - 1 /* gain */ + 1 // gain }; DISCRETE_SOUND_START( m79amb_discrete ) @@ -149,90 +141,90 @@ DISCRETE_SOUND_START( m79amb_discrete ) DISCRETE_INPUT_LOGIC(M79AMB_WHISTLE_A_EN) DISCRETE_INPUT_LOGIC(M79AMB_WHISTLE_B_EN) - /* Boom, Thud, Shot sounds need more accurate emulation */ + // Boom, Thud, Shot sounds need more accurate emulation /************************************************ * Boom ************************************************/ DISCRETE_ONESHOT(NODE_20, - M79AMB_BOOM_EN, /* TRIG */ - 1, /* AMPL */ + M79AMB_BOOM_EN, // TRIG + 1, // AMPL TIME_OF_9602_WITH_DIODE(M79AMB_R2, M79AMB_C2), DISC_ONESHOT_REDGE | DISC_ONESHOT_RETRIG | DISC_OUT_ACTIVE_HIGH) DISCRETE_RCDISC2(NODE_21, - NODE_20, /* Q1 base */ - 0, /* Q1 off, C3 discharges */ - M79AMB_R9 + M79AMB_R10, /* discharges through amp/filter circuit */ - 12, /* Q1 on, C3 charges */ - M79AMB_R6, /* Q2 on */ - M79AMB_C3) /* controls amplitude */ + NODE_20, // Q1 base + 0, // Q1 off, C3 discharges + M79AMB_R9 + M79AMB_R10, // discharges through amp/filter circuit + 12, // Q1 on, C3 charges + M79AMB_R6, // Q2 on + M79AMB_C3) // controls amplitude DISCRETE_NOISE(M79AMB_BOOM_SND, - 1, /* ENAB */ - 800, /* FREQ - Guess*/ - NODE_21, /* AMP */ - 0) /* BIAS - fake AC is fine*/ + 1, // ENAB + 800, // FREQ - Guess + NODE_21, // AMP + 0) // BIAS - fake AC is fine /************************************************ * Thud ************************************************/ DISCRETE_ONESHOT(NODE_30, - M79AMB_THUD_EN, /* TRIG */ - 1, /* AMPL */ + M79AMB_THUD_EN, // TRIG + 1, // AMPL TIME_OF_9602_WITH_DIODE(M79AMB_R12, M79AMB_C8), DISC_ONESHOT_REDGE | DISC_ONESHOT_RETRIG | DISC_OUT_ACTIVE_HIGH) DISCRETE_RCDISC2(NODE_31, - NODE_30, /* Q4 base */ - 0, /* Q4 off, C9 discharges */ - M79AMB_R19 + M79AMB_R20, /* discharges through amp/filter circuit */ - 12, /* Q4 on, C9 charges */ - M79AMB_R16, /* Q5 on */ - M79AMB_C9) /* controls amplitude */ + NODE_30, // Q4 base + 0, // Q4 off, C9 discharges + M79AMB_R19 + M79AMB_R20, // discharges through amp/filter circuit + 12, // Q4 on, C9 charges + M79AMB_R16, // Q5 on + M79AMB_C9) // controls amplitude DISCRETE_NOISE(M79AMB_THUD_SND, - 1, /* ENAB */ - 500, /* FREQ - Guess*/ - NODE_31, /* AMP */ - 0) /* BIAS - fake AC is fine*/ + 1, // ENAB + 500, // FREQ - Guess + NODE_31, // AMP + 0) // BIAS - fake AC is fine /************************************************ * Shot ************************************************/ DISCRETE_ONESHOT(NODE_40, - M79AMB_SHOT_EN, /* TRIG */ - 1, /* AMPL */ + M79AMB_SHOT_EN, // TRIG + 1, // AMPL TIME_OF_9602_WITH_DIODE(M79AMB_R22, M79AMB_C14), DISC_ONESHOT_REDGE | DISC_ONESHOT_RETRIG | DISC_OUT_ACTIVE_HIGH) DISCRETE_RCDISC2(NODE_41, - NODE_40, /* Q7 base */ - 0, /* Q7 off, C15 discharges */ - M79AMB_R29 + M79AMB_R30, /* discharges through amp/filter circuit */ - 12, /* Q7 on, C15 charges */ - M79AMB_R26, /* Q8 on */ - M79AMB_C15) /* controls amplitude */ + NODE_40, // Q7 base + 0, // Q7 off, C15 discharges + M79AMB_R29 + M79AMB_R30, // discharges through amp/filter circuit + 12, // Q7 on, C15 charges + M79AMB_R26, // Q8 on + M79AMB_C15) // controls amplitude DISCRETE_NOISE(M79AMB_SHOT_SND, - 1, /* ENAB */ - 1000, /* FREQ - Guess*/ - NODE_41, /* AMP */ - 0) /* BIAS - fake AC is fine*/ + 1, // ENAB + 1000, // FREQ - Guess + NODE_41, // AMP + 0) // BIAS - fake AC is fine /************************************************ * MC ************************************************/ - /* not the best implementation of the pin 5 charge circuit, but it is within tolerance */ + // not the best implementation of the pin 5 charge circuit, but it is within tolerance DISCRETE_RCDISC2(NODE_50, M79AMB_MC_REV_EN, - /* R35 can be ignored on discharge */ - RES_VOLTAGE_DIVIDER(M79AMB_R36 + M79AMB_R37, M79AMB_R38) * 12, /* Q12 on */ - RES_2_PARALLEL(M79AMB_R36 + M79AMB_R37, M79AMB_R38), /* Q12 on */ - 12.0 * RES_VOLTAGE_DIVIDER(M79AMB_R36, M79AMB_R35), /* Q12 off */ - RES_2_PARALLEL(M79AMB_R36, M79AMB_R35) + M79AMB_R37, /* Q12 off */ + // R35 can be ignored on discharge + RES_VOLTAGE_DIVIDER(M79AMB_R36 + M79AMB_R37, M79AMB_R38) * 12, // Q12 on + RES_2_PARALLEL(M79AMB_R36 + M79AMB_R37, M79AMB_R38), // Q12 on + 12.0 * RES_VOLTAGE_DIVIDER(M79AMB_R36, M79AMB_R35), // Q12 off + RES_2_PARALLEL(M79AMB_R36, M79AMB_R35) + M79AMB_R37, // Q12 off M79AMB_C20) - /* cap charge to B+ ratio changes voltage on pin 5 */ - /* (iR36 + iR35 + iR37) * R36||R35||R37 where iR35 = 0/R35 = 0 */ + // cap charge to B+ ratio changes voltage on pin 5 + // (iR36 + iR35 + iR37) * R36||R35||R37 where iR35 = 0/R35 = 0 DISCRETE_TRANSFORM4(NODE_51, 12.0 / M79AMB_R36, NODE_50, M79AMB_R37, RES_3_PARALLEL(M79AMB_R36, M79AMB_R35, M79AMB_R37), "012/+3*") - DISCRETE_566(NODE_52, /* IC U3, pin 4 */ - NODE_51, /* IC U3, pin 5 */ + DISCRETE_566(NODE_52, // IC U3, pin 4 + NODE_51, // IC U3, pin 5 M79AMB_R39, M79AMB_C21, - 12, 0, 12, /* VPOS,VNEG,VCHARGE */ + 12, 0, 12, // VPOS, VNEG, VCHARGE DISC_566_OUT_DC | DISC_566_OUT_TRIANGLE) DISCRETE_CRFILTER(NODE_53, NODE_52, M79AMB_R41 + M79AMB_R42 + M79AMB_R43, M79AMB_C22) @@ -242,13 +234,13 @@ DISCRETE_SOUND_START( m79amb_discrete ) /************************************************ * Tank, Truck, Jeep ************************************************/ - DISCRETE_566(NODE_60, /* IC U4, pin 4 */ - 12.0 * RES_VOLTAGE_DIVIDER(M79AMB_R44, M79AMB_R45), /* IC U5, pin 5 */ + DISCRETE_566(NODE_60, // IC U4, pin 4 + 12.0 * RES_VOLTAGE_DIVIDER(M79AMB_R44, M79AMB_R45), // IC U5, pin 5 M79AMB_R46, M79AMB_C25, - 12, 0, 12, /* VPOS,VNEG,VCHARGE */ + 12, 0, 12, // VPOS, VNEG, VCHARGE DISC_566_OUT_DC | DISC_566_OUT_TRIANGLE) DISCRETE_ONOFF(NODE_61, - M79AMB_TANK_TRUCK_JEEP_EN, /* Q16, Q17 */ + M79AMB_TANK_TRUCK_JEEP_EN, // Q16, Q17 NODE_60) DISCRETE_CRFILTER(NODE_62, NODE_61, M79AMB_R48 + M79AMB_R49, M79AMB_C26) @@ -261,16 +253,16 @@ DISCRETE_SOUND_START( m79amb_discrete ) ************************************************/ DISCRETE_RCDISC2(NODE_70, M79AMB_WHISTLE_A_EN, - RES_VOLTAGE_DIVIDER(M79AMB_R51 + M79AMB_R52, M79AMB_R53) * 12, /* Q15 on */ - RES_2_PARALLEL(M79AMB_R53, M79AMB_R51 + M79AMB_R52), /* Q15 on */ - 12, M79AMB_R51 + M79AMB_R52, /* Q15 off */ + RES_VOLTAGE_DIVIDER(M79AMB_R51 + M79AMB_R52, M79AMB_R53) * 12, // Q15 on + RES_2_PARALLEL(M79AMB_R53, M79AMB_R51 + M79AMB_R52), // Q15 on + 12, M79AMB_R51 + M79AMB_R52, // Q15 off M79AMB_C29) - /* cap charge to B+ ratio changes voltage on pin 5 */ + // cap charge to B+ ratio changes voltage on pin 5 DISCRETE_TRANSFORM3(NODE_71, 12, NODE_70, RES_VOLTAGE_DIVIDER(M79AMB_R51, M79AMB_R52), "01-2*1+") - DISCRETE_566(NODE_72, /* IC U5, pin 4 */ - NODE_71, /* IC U5, pin 5 */ + DISCRETE_566(NODE_72, // IC U5, pin 4 + NODE_71, // IC U5, pin 5 M79AMB_R54, M79AMB_C30, - 12, 0, 12, /* VPOS,VNEG,VCHARGE */ + 12, 0, 12, // VPOS, VNEG, VCHARGE DISC_566_OUT_DC | DISC_566_OUT_TRIANGLE) DISCRETE_CRFILTER(NODE_73, NODE_72, M79AMB_R57 + M79AMB_R58 + M79AMB_R59, M79AMB_C31) @@ -282,16 +274,16 @@ DISCRETE_SOUND_START( m79amb_discrete ) ************************************************/ DISCRETE_RCDISC2(NODE_80, M79AMB_WHISTLE_B_EN, - RES_VOLTAGE_DIVIDER(M79AMB_R61 + M79AMB_R62, M79AMB_R63) * 12, /* Q18 on */ - RES_2_PARALLEL(M79AMB_R63, M79AMB_R61 + M79AMB_R62), /* Q18 on */ - 12, M79AMB_R61 + M79AMB_R62, /* Q18 off */ + RES_VOLTAGE_DIVIDER(M79AMB_R61 + M79AMB_R62, M79AMB_R63) * 12, // Q18 on + RES_2_PARALLEL(M79AMB_R63, M79AMB_R61 + M79AMB_R62), // Q18 on + 12, M79AMB_R61 + M79AMB_R62, // Q18 off M79AMB_C33) - /* cap charge to B+ ratio changes voltage on pin 5 */ + // cap charge to B+ ratio changes voltage on pin 5 DISCRETE_TRANSFORM3(NODE_81, 12, NODE_80, RES_VOLTAGE_DIVIDER(M79AMB_R61, M79AMB_R62), "01-2*1+") - DISCRETE_566(NODE_82, /* IC U5, pin 4 */ - NODE_81, /* IC U5, pin 5 */ + DISCRETE_566(NODE_82, // IC U5, pin 4 + NODE_81, // IC U5, pin 5 M79AMB_R64, M79AMB_C34, - 12, 0, 12, /* VPOS,VNEG,VCHARGE */ + 12, 0, 12, // VPOS, VNEG, VCHARGE DISC_566_OUT_DC | DISC_566_OUT_TRIANGLE) DISCRETE_CRFILTER(NODE_83, NODE_82, M79AMB_R67 + M79AMB_R68 + M79AMB_R69, M79AMB_C35) @@ -301,8 +293,8 @@ DISCRETE_SOUND_START( m79amb_discrete ) /************************************************ * Mixer ************************************************/ - DISCRETE_MIXER7(NODE_90, /* IC U7, pin 6 */ - 1, /* ENAB */ + DISCRETE_MIXER7(NODE_90, // IC U7, pin 6 + 1, // ENAB M79AMB_BOOM_SND, M79AMB_THUD_SND, M79AMB_SHOT_SND, @@ -317,29 +309,3 @@ DISCRETE_SOUND_START( m79amb_discrete ) DISCRETE_OUTPUT(NODE_91, 32000.0/5) DISCRETE_SOUND_END - - -/* the ports are guessed from operation */ -/* the schematics do not show the actual hookup */ - -void m79amb_state::m79amb_8000_w(uint8_t data) -{ - /* these values are not latched */ - /* they are pulsed when the port is addressed */ - /* the discrete system will just trigger from them */ - m_discrete->write(M79AMB_SHOT_EN, data & 0x01); - m_discrete->write(M79AMB_BOOM_EN, data & 0x02); - m_discrete->write(M79AMB_THUD_EN, data & 0x04); -} - -void m79amb_state::m79amb_8003_w(uint8_t data) -{ - /* Self Test goes low on reset and lights LED */ - /* LED goes off on pass */ - m_self_test = BIT(data, 0); - m_discrete->write(M79AMB_MC_REV_EN, data & 0x02); - m_discrete->write(M79AMB_MC_CONTROL_EN, data & 0x04); - m_discrete->write(M79AMB_TANK_TRUCK_JEEP_EN, data & 0x08); - m_discrete->write(M79AMB_WHISTLE_B_EN, data & 0x10); - m_discrete->write(M79AMB_WHISTLE_A_EN, data & 0x20); -} diff --git a/src/mame/ramtek/m79amb_a.h b/src/mame/ramtek/m79amb_a.h new file mode 100644 index 00000000000..4340ad8638b --- /dev/null +++ b/src/mame/ramtek/m79amb_a.h @@ -0,0 +1,30 @@ +// license:BSD-3-Clause +// copyright-holders: Derrick Renaud + +/************************************************************************ + * m79amb Sound System Analog emulation + * Nov 2008, Derrick Renaud + ************************************************************************/ + +#ifndef MAME_RAMTEK_M79AMB_A_H +#define MAME_RAMTEK_M79AMB_A_H + +#pragma once + +#include "sound/discrete.h" + +// discrete sound input nodes + +#define M79AMB_BOOM_EN NODE_01 +#define M79AMB_THUD_EN NODE_02 +#define M79AMB_SHOT_EN NODE_03 +#define M79AMB_MC_REV_EN NODE_04 +#define M79AMB_MC_CONTROL_EN NODE_05 +#define M79AMB_TANK_TRUCK_JEEP_EN NODE_06 +#define M79AMB_WHISTLE_A_EN NODE_07 +#define M79AMB_WHISTLE_B_EN NODE_08 + + +DISCRETE_SOUND_EXTERN( m79amb_discrete ); + +#endif // MAME_RAMTEK_M79AMB_A_H \ No newline at end of file diff --git a/src/mame/taito/grchamp.cpp b/src/mame/taito/grchamp.cpp index 82a47717bfb..f9f66140c14 100644 --- a/src/mame/taito/grchamp.cpp +++ b/src/mame/taito/grchamp.cpp @@ -96,6 +96,7 @@ void grchamp_state::machine_start() { m_digits.resolve(); + m_led0.resolve(); m_soundlatch_data = 0x00; m_soundlatch_flag = false; save_item(NAME(m_cpu0_out)); @@ -198,7 +199,7 @@ void grchamp_state::cpu0_outputs_w(offs_t offset, uint8_t data) /* bit 5: Game Over lamp */ /* bit 6-7: n/c */ machine().bookkeeping().coin_lockout_global_w((data >> 4) & 1); - output().set_value("led0", (~data >> 5) & 1); + m_led0 = (~data >> 5) & 1; break; case 0x0a: /* OUT10 */ diff --git a/src/mame/taito/grchamp.h b/src/mame/taito/grchamp.h index 2f4c582c407..a0123e20634 100644 --- a/src/mame/taito/grchamp.h +++ b/src/mame/taito/grchamp.h @@ -37,7 +37,8 @@ public: m_leftram(*this, "leftram"), m_rightram(*this, "rightram"), m_centerram(*this, "centerram"), - m_digits(*this, "digit%u", 0U) + m_digits(*this, "digit%u", 0U), + m_led0(*this, "led0") { } void grchamp(machine_config &config); @@ -130,6 +131,7 @@ private: required_shared_ptr m_rightram; required_shared_ptr m_centerram; output_finder<8> m_digits; + output_finder<> m_led0; }; /* Discrete Sound Input Nodes */ diff --git a/src/mame/taito/othunder.cpp b/src/mame/taito/othunder.cpp index 840d78a0fb2..53ba13226f0 100644 --- a/src/mame/taito/othunder.cpp +++ b/src/mame/taito/othunder.cpp @@ -342,8 +342,8 @@ void othunder_state::eeprom_w(u8 data) x0000000 eeprom out data */ /* Recoil Piston Motor Status */ - output().set_value("Player1_Recoil_Piston", data & 0x1 ); - output().set_value("Player2_Recoil_Piston", (data & 0x2) >>1 ); + m_recoil_piston[0] = data & 0x1; + m_recoil_piston[1] = (data & 0x2) >> 1; if (data & 4) popmessage("OBPRI SET!"); @@ -572,6 +572,8 @@ GFXDECODE_END void othunder_state::machine_start() { + m_recoil_piston.resolve(); + m_z80bank->configure_entries(0, 4, memregion("audiocpu")->base(), 0x4000); save_item(NAME(m_pan)); diff --git a/src/mame/taito/othunder.h b/src/mame/taito/othunder.h index 16b6e98bbcb..da3cd55c024 100644 --- a/src/mame/taito/othunder.h +++ b/src/mame/taito/othunder.h @@ -40,7 +40,8 @@ public: m_2610_1r(*this, "2610.1r"), m_2610_2l(*this, "2610.2l"), m_2610_2r(*this, "2610.2r"), - m_gfxdecode(*this, "gfxdecode") + m_gfxdecode(*this, "gfxdecode"), + m_recoil_piston(*this, "Player%u_Recoil_Piston", 1U) { } void othunder(machine_config &config); @@ -99,6 +100,8 @@ private: required_device m_2610_2l; required_device m_2610_2r; required_device m_gfxdecode; + + output_finder<2> m_recoil_piston; }; #endif // MAME_TAITO_OTHUNDER_H diff --git a/src/mame/taito/undrfire.cpp b/src/mame/taito/undrfire.cpp index d1ff6bb563b..92a9ba05059 100644 --- a/src/mame/taito/undrfire.cpp +++ b/src/mame/taito/undrfire.cpp @@ -206,6 +206,14 @@ Board contains only 29 ROMs and not much else. #include "cbombers.lh" +void undrfire_state::machine_start() +{ + m_lamp_start.resolve(); + m_gun_recoil.resolve(); + m_lamp.resolve(); + m_wheel_vibration.resolve(); +} + /********************************************************** GAME INPUTS **********************************************************/ @@ -290,10 +298,10 @@ void undrfire_state::motor_control_w(u8 data) ........ x....... P2 gun vibration */ - output().set_value("P1_lamp_start", BIT(data, 4)); //p1 start - output().set_value("P2_lamp_start", BIT(data, 5)); //p2 start - output().set_value("P1_gun_recoil", BIT(data, 6)); //p1 recoil - output().set_value("P2_gun_recoil", BIT(data, 7)); //p2 recoil + m_lamp_start[0] = BIT(data, 4); //p1 start + m_lamp_start[1] = BIT(data, 5); //p2 start + m_gun_recoil[0] = BIT(data, 6); //p1 recoil + m_gun_recoil[1] = BIT(data, 7); //p2 recoil } void undrfire_state::cbombers_cpua_ctrl_w(u32 data) @@ -302,13 +310,10 @@ void undrfire_state::cbombers_cpua_ctrl_w(u32 data) ........ ..xxxxxx Lamp 1-6 enables ........ .x...... Vibration */ - output().set_value("Lamp_1", BIT(data, 0)); - output().set_value("Lamp_2", BIT(data, 1)); - output().set_value("Lamp_3", BIT(data, 2)); - output().set_value("Lamp_4", BIT(data, 3)); - output().set_value("Lamp_5", BIT(data, 4)); - output().set_value("Lamp_6", BIT(data, 5)); - output().set_value("Wheel_vibration", BIT(data, 6)); + for (int i = 0; i < 6; i++) + m_lamp[i] = BIT(data, i); + + m_wheel_vibration = BIT(data, 6); m_subcpu->set_input_line(INPUT_LINE_RESET, BIT(data, 12) ? CLEAR_LINE : ASSERT_LINE); } diff --git a/src/mame/taito/undrfire.h b/src/mame/taito/undrfire.h index 185764a8e1f..d4580137dd1 100644 --- a/src/mame/taito/undrfire.h +++ b/src/mame/taito/undrfire.h @@ -31,13 +31,18 @@ public: m_spritemaphi(*this, "spritemaphi"), m_in_gunx(*this, "GUNX%u", 1U), m_in_guny(*this, "GUNY%u", 1U), - m_io_fake(*this, "FAKE") + m_io_fake(*this, "FAKE"), + m_lamp_start(*this, "P%u_lamp_start", 1U), + m_gun_recoil(*this, "P%u_gun_recoil", 1U), + m_lamp(*this, "Lamp_%", 1U), + m_wheel_vibration(*this, "Wheel_vibration") { } void undrfire(machine_config &config); void cbombers(machine_config &config); protected: + virtual void machine_start() override; virtual void video_start() override; private: @@ -76,6 +81,10 @@ private: optional_ioport_array<2> m_in_gunx; optional_ioport_array<2> m_in_guny; optional_ioport m_io_fake; + output_finder<2> m_lamp_start; + output_finder<2> m_gun_recoil; + output_finder<6> m_lamp; + output_finder<> m_wheel_vibration; void coin_word_w(u8 data); u16 shared_ram_r(offs_t offset); -- cgit v1.2.3