From 2beba4ce73fad917c7159a39939bace54f76494b Mon Sep 17 00:00:00 2001 From: wilbertpol Date: Sun, 20 May 2018 19:27:20 +0200 Subject: =?UTF-8?q?Replace=20set=5Fled=5Fvalue=20and=20set=5Flamp=5Fvalue?= =?UTF-8?q?=20with=20output=5Ffinders.=20=20[Wilbe=E2=80=A6=20(#3592)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Replace set_led_value and set_lamp_value with output_finders. [Wilbert Pol] * segaufo: keep the 2 bit lamp outputs --- src/devices/bus/abckb/abc99.cpp | 24 +-- src/devices/bus/abckb/abc99.h | 1 + src/devices/bus/cbmiec/c1541.cpp | 5 +- src/devices/bus/cbmiec/c1541.h | 1 + src/devices/bus/cbmiec/c1571.cpp | 5 +- src/devices/bus/cbmiec/c1571.h | 1 + src/devices/bus/cbmiec/c1581.cpp | 7 +- src/devices/bus/cbmiec/c1581.h | 1 + src/devices/bus/ieee488/c2031.cpp | 4 +- src/devices/bus/ieee488/c2031.h | 1 + src/devices/bus/ieee488/c2040.cpp | 8 +- src/devices/bus/ieee488/c2040.h | 1 + src/devices/bus/ieee488/c8050.cpp | 9 +- src/devices/bus/ieee488/c8050.h | 1 + src/devices/bus/ieee488/c8280.cpp | 12 +- src/devices/bus/ieee488/c8280.h | 1 + src/devices/bus/ieee488/d9060.cpp | 9 +- src/devices/bus/ieee488/d9060.h | 1 + src/devices/bus/ieee488/hardbox.cpp | 8 +- src/devices/bus/ieee488/hardbox.h | 3 +- src/devices/bus/ieee488/softbox.cpp | 8 +- src/devices/bus/ieee488/softbox.h | 3 +- src/devices/bus/msx_cart/disk.cpp | 10 +- src/devices/bus/msx_cart/disk.h | 2 + src/devices/bus/msx_slot/disk.cpp | 6 +- src/devices/bus/msx_slot/disk.h | 1 + src/devices/bus/pc_kbd/pcat84.cpp | 9 +- src/devices/bus/pc_kbd/pcat84.h | 3 +- src/devices/bus/plus4/c1551.cpp | 5 +- src/devices/bus/plus4/c1551.h | 1 + src/devices/bus/sunkbd/hlekbd.cpp | 22 +-- src/devices/bus/sunkbd/hlekbd.h | 1 + src/devices/machine/amigafdc.cpp | 6 +- src/devices/machine/amigafdc.h | 1 + src/devices/machine/pckeybrd.cpp | 20 +-- src/devices/machine/pckeybrd.h | 1 + src/emu/output.h | 4 - src/mame/audio/copsnrob.cpp | 2 +- src/mame/drivers/amiga.cpp | 2 +- src/mame/drivers/astrcorp.cpp | 42 ++++-- src/mame/drivers/atarifb.cpp | 2 + src/mame/drivers/atarist.cpp | 8 +- src/mame/drivers/atarisy2.cpp | 6 +- src/mame/drivers/baraduke.cpp | 9 +- src/mame/drivers/barata.cpp | 10 +- src/mame/drivers/beta.cpp | 9 +- src/mame/drivers/bfm_sc1.cpp | 33 ++--- src/mame/drivers/bfm_sc2.cpp | 9 +- src/mame/drivers/bfmsys85.cpp | 58 ++++---- src/mame/drivers/big10.cpp | 5 +- src/mame/drivers/bladestl.cpp | 5 +- src/mame/drivers/blitz68k.cpp | 133 +++++++++-------- src/mame/drivers/boxer.cpp | 10 +- src/mame/drivers/bw12.cpp | 4 +- src/mame/drivers/bwidow.cpp | 8 +- src/mame/drivers/cabaret.cpp | 51 ++++--- src/mame/drivers/calomega.cpp | 34 ++--- src/mame/drivers/cardline.cpp | 49 ++++--- src/mame/drivers/cave.cpp | 82 +++++------ src/mame/drivers/cc40.cpp | 60 ++++---- src/mame/drivers/ccastles.cpp | 4 +- src/mame/drivers/chance32.cpp | 57 ++++---- src/mame/drivers/chexx.cpp | 16 +- src/mame/drivers/chsuper.cpp | 59 ++++---- src/mame/drivers/cidelsa.cpp | 11 +- src/mame/drivers/cischeat.cpp | 22 +-- src/mame/drivers/cliffhgr.cpp | 45 +++--- src/mame/drivers/copsnrob.cpp | 2 +- src/mame/drivers/corona.cpp | 41 +++--- src/mame/drivers/cubo.cpp | 2 +- src/mame/drivers/cvs.cpp | 10 +- src/mame/drivers/dacholer.cpp | 94 ++++++------ src/mame/drivers/ddenlovr.cpp | 139 +++++++++--------- src/mame/drivers/didact.cpp | 16 +- src/mame/drivers/djmain.cpp | 14 +- src/mame/drivers/dmv.cpp | 73 +++++----- src/mame/drivers/dynax.cpp | 4 +- src/mame/drivers/elf.cpp | 4 +- src/mame/drivers/eolith.cpp | 7 +- src/mame/drivers/eti660.cpp | 4 +- src/mame/drivers/firetrk.cpp | 16 +- src/mame/drivers/flyball.cpp | 8 +- src/mame/drivers/foodf.cpp | 5 +- src/mame/drivers/funworld.cpp | 16 +- src/mame/drivers/galaga.cpp | 19 +-- src/mame/drivers/galaxian.cpp | 2 +- src/mame/drivers/gaplus.cpp | 5 +- src/mame/drivers/gei.cpp | 48 +++--- src/mame/drivers/goldnpkr.cpp | 43 +++--- src/mame/drivers/goldstar.cpp | 44 +++--- src/mame/drivers/gottlieb.cpp | 7 +- src/mame/drivers/harddriv.cpp | 1 + src/mame/drivers/igs009.cpp | 104 +++++++------ src/mame/drivers/igspoker.cpp | 72 +++++---- src/mame/drivers/isbc.cpp | 59 ++++---- src/mame/drivers/itech32.cpp | 9 +- src/mame/drivers/jackie.cpp | 104 +++++++------ src/mame/drivers/jpmimpct.cpp | 2 +- src/mame/drivers/jubilee.cpp | 49 ++++--- src/mame/drivers/kas89.cpp | 134 +++++++++-------- src/mame/drivers/kenseim.cpp | 41 +++--- src/mame/drivers/konamigx.cpp | 4 +- src/mame/drivers/kopunch.cpp | 4 +- src/mame/drivers/ksys573.cpp | 78 +++++----- src/mame/drivers/kungfur.cpp | 17 ++- src/mame/drivers/lethalj.cpp | 14 +- src/mame/drivers/lockon.cpp | 4 +- src/mame/drivers/lucky74.cpp | 24 +-- src/mame/drivers/magic10.cpp | 55 ++++--- src/mame/drivers/mainevt.cpp | 9 +- src/mame/drivers/majorpkr.cpp | 66 +++++---- src/mame/drivers/marywu.cpp | 11 +- src/mame/drivers/maygayv1.cpp | 48 +++--- src/mame/drivers/mazerbla.cpp | 89 +++++++----- src/mame/drivers/mcr.cpp | 20 +-- src/mame/drivers/mcr3.cpp | 12 +- src/mame/drivers/mephisto_montec.cpp | 29 ++-- src/mame/drivers/merit.cpp | 65 +++++---- src/mame/drivers/meyc8080.cpp | 39 ++--- src/mame/drivers/mgames.cpp | 43 +++--- src/mame/drivers/midzeus.cpp | 38 +++-- src/mame/drivers/miniboy7.cpp | 50 ++++--- src/mame/drivers/missile.cpp | 96 ++++++------ src/mame/drivers/mk1.cpp | 26 ++-- src/mame/drivers/mk2.cpp | 29 ++-- src/mame/drivers/multfish.cpp | 28 ++-- src/mame/drivers/mw18w.cpp | 14 +- src/mame/drivers/namcos22.cpp | 6 +- src/mame/drivers/namcos23.cpp | 151 +++++++++---------- src/mame/drivers/namcos86.cpp | 4 +- src/mame/drivers/norautp.cpp | 24 +-- src/mame/drivers/notechan.cpp | 83 ++++++----- src/mame/drivers/omegrace.cpp | 36 +++-- src/mame/drivers/overdriv.cpp | 3 +- src/mame/drivers/polyplay.cpp | 40 ++--- src/mame/drivers/poolshrk.cpp | 4 +- src/mame/drivers/portrait.cpp | 4 +- src/mame/drivers/quantum.cpp | 9 +- src/mame/drivers/quasar.cpp | 4 +- src/mame/drivers/quizshow.cpp | 15 +- src/mame/drivers/re900.cpp | 64 ++++---- src/mame/drivers/roul.cpp | 35 +++-- src/mame/drivers/runaway.cpp | 3 +- src/mame/drivers/sage2.cpp | 3 +- src/mame/drivers/sderby.cpp | 24 +-- src/mame/drivers/seabattl.cpp | 45 +++--- src/mame/drivers/segae.cpp | 19 ++- src/mame/drivers/segahang.cpp | 4 +- src/mame/drivers/segas16a.cpp | 4 +- src/mame/drivers/segas16b.cpp | 4 +- src/mame/drivers/segas32.cpp | 22 +-- src/mame/drivers/segaufo.cpp | 19 ++- src/mame/drivers/segaxbd.cpp | 68 ++++----- src/mame/drivers/seta.cpp | 16 +- src/mame/drivers/seta2.cpp | 60 ++++---- src/mame/drivers/sfbonus.cpp | 92 ++++++------ src/mame/drivers/sigmab98.cpp | 127 ++++++++-------- src/mame/drivers/skykid.cpp | 6 +- src/mame/drivers/skylncr.cpp | 80 +++++----- src/mame/drivers/sms.cpp | 6 - src/mame/drivers/sms_bootleg.cpp | 3 - src/mame/drivers/smsmcorp.cpp | 51 ++++--- src/mame/drivers/snookr10.cpp | 28 ++-- src/mame/drivers/softbox.cpp | 7 +- src/mame/drivers/spcforce.cpp | 6 +- src/mame/drivers/spoker.cpp | 22 ++- src/mame/drivers/starshp1.cpp | 8 +- src/mame/drivers/subsino2.cpp | 147 ++++++++++--------- src/mame/drivers/suna16.cpp | 12 +- src/mame/drivers/suna8.cpp | 16 +- src/mame/drivers/system16.cpp | 4 +- src/mame/drivers/taito_z.cpp | 4 +- src/mame/drivers/tek405x.cpp | 8 +- src/mame/drivers/tempest.cpp | 13 +- src/mame/drivers/tetrisp2.cpp | 62 ++++---- src/mame/drivers/thedealr.cpp | 52 ++++--- src/mame/drivers/ti74.cpp | 36 +++-- src/mame/drivers/tiki100.cpp | 6 +- src/mame/drivers/tmc1800.cpp | 10 +- src/mame/drivers/tmc2000e.cpp | 4 +- src/mame/drivers/tourtabl.cpp | 13 +- src/mame/drivers/triplhnt.cpp | 8 +- src/mame/drivers/tunhunt.cpp | 6 +- src/mame/drivers/turbo.cpp | 6 +- src/mame/drivers/unico.cpp | 14 +- src/mame/drivers/victory.cpp | 8 +- src/mame/drivers/videopin.cpp | 3 +- src/mame/drivers/videopkr.cpp | 116 ++++++++------- src/mame/drivers/vip.cpp | 8 +- src/mame/drivers/wolfpack.cpp | 3 +- src/mame/includes/ajax.h | 51 ++++--- src/mame/includes/amiga.h | 2 + src/mame/includes/atarifb.h | 83 ++++++----- src/mame/includes/atarist.h | 28 ++-- src/mame/includes/atarisy2.h | 4 + src/mame/includes/baraduke.h | 39 +++-- src/mame/includes/bladestl.h | 40 ++--- src/mame/includes/bw12.h | 103 ++++++------- src/mame/includes/bwidow.h | 27 ++-- src/mame/includes/calomega.h | 8 +- src/mame/includes/cave.h | 180 ++++++++++++----------- src/mame/includes/ccastles.h | 4 +- src/mame/includes/cidelsa.h | 55 +++---- src/mame/includes/cischeat.h | 161 +++++++++++---------- src/mame/includes/copsnrob.h | 4 +- src/mame/includes/cps1.h | 229 +++++++++++++++-------------- src/mame/includes/cvs.h | 146 ++++++++++--------- src/mame/includes/djmain.h | 69 +++++---- src/mame/includes/dynax.h | 185 ++++++++++++------------ src/mame/includes/elf.h | 32 ++-- src/mame/includes/eolith.h | 3 + src/mame/includes/epos.h | 38 +++-- src/mame/includes/eti660.h | 2 + src/mame/includes/firetrk.h | 127 ++++++++-------- src/mame/includes/foodf.h | 4 +- src/mame/includes/funworld.h | 25 ++-- src/mame/includes/galaga.h | 98 +++++++------ src/mame/includes/galaxian.h | 167 +++++++++++---------- src/mame/includes/galaxold.h | 40 ++--- src/mame/includes/gaplus.h | 87 +++++------ src/mame/includes/goldstar.h | 9 +- src/mame/includes/gottlieb.h | 124 ++++++++-------- src/mame/includes/harddriv.h | 1 + src/mame/includes/irobot.h | 5 +- src/mame/includes/itech32.h | 5 +- src/mame/includes/jpmimpct.h | 4 +- src/mame/includes/konamigx.h | 173 +++++++++++----------- src/mame/includes/kopunch.h | 47 +++--- src/mame/includes/lethalj.h | 48 +++--- src/mame/includes/lockon.h | 43 +++--- src/mame/includes/lucky74.h | 53 ++++--- src/mame/includes/mainevt.h | 53 ++++--- src/mame/includes/mcr.h | 17 ++- src/mame/includes/mcr3.h | 13 +- src/mame/includes/mhavoc.h | 48 +++--- src/mame/includes/microtan.h | 56 +++---- src/mame/includes/midzeus.h | 4 - src/mame/includes/msx.h | 2 + src/mame/includes/multfish.h | 54 +++---- src/mame/includes/namcos22.h | 273 ++++++++++++++++++----------------- src/mame/includes/namcos86.h | 54 +++---- src/mame/includes/nitedrvr.h | 4 +- src/mame/includes/norautp.h | 29 ++-- src/mame/includes/overdriv.h | 69 +++++---- src/mame/includes/pmd85.h | 11 +- src/mame/includes/polyplay.h | 49 ++++--- src/mame/includes/poolshrk.h | 5 +- src/mame/includes/portrait.h | 50 ++++--- src/mame/includes/runaway.h | 42 +++--- src/mame/includes/sage2.h | 79 +++++----- src/mame/includes/sderby.h | 41 +++--- src/mame/includes/segahang.h | 35 +++-- src/mame/includes/segas16a.h | 55 +++---- src/mame/includes/segas16b.h | 81 ++++++----- src/mame/includes/segas32.h | 107 +++++++------- src/mame/includes/segaxbd.h | 1 + src/mame/includes/seta.h | 5 + src/mame/includes/seta2.h | 71 +++++---- src/mame/includes/skykid.h | 60 ++++---- src/mame/includes/sms.h | 190 ++++++++++++------------ src/mame/includes/snookr10.h | 41 +++--- src/mame/includes/softbox.h | 31 ++-- src/mame/includes/spcforce.h | 51 ++++--- src/mame/includes/starshp1.h | 5 +- src/mame/includes/suna16.h | 69 ++++----- src/mame/includes/suna8.h | 112 +++++++------- src/mame/includes/system16.h | 195 +++++++++++++------------ src/mame/includes/taito_z.h | 10 +- src/mame/includes/tek405x.h | 69 ++++----- src/mame/includes/tetrisp2.h | 104 ++++++------- src/mame/includes/tiki100.h | 5 +- src/mame/includes/tmc1800.h | 117 ++++++++------- src/mame/includes/tmc2000e.h | 37 ++--- src/mame/includes/triplhnt.h | 5 +- src/mame/includes/tunhunt.h | 5 +- src/mame/includes/turbo.h | 4 +- src/mame/includes/unico.h | 3 + src/mame/includes/victory.h | 8 +- src/mame/includes/videopin.h | 4 +- src/mame/includes/vip.h | 98 +++++++------ src/mame/includes/wolfpack.h | 4 +- src/mame/machine/ajax.cpp | 17 ++- src/mame/machine/amiga.cpp | 5 +- src/mame/machine/atarifb.cpp | 4 +- src/mame/machine/compiskb.cpp | 4 +- src/mame/machine/compiskb.h | 6 +- src/mame/machine/galaxold.cpp | 2 +- src/mame/machine/harddriv.cpp | 5 +- src/mame/machine/irobot.cpp | 4 +- src/mame/machine/mhavoc.cpp | 8 +- src/mame/machine/microtan.cpp | 4 +- src/mame/machine/mmboard.cpp | 4 +- src/mame/machine/mmboard.h | 1 + src/mame/machine/msx.cpp | 5 +- src/mame/machine/nb1413m3.cpp | 14 +- src/mame/machine/nb1413m3.h | 1 + src/mame/machine/nitedrvr.cpp | 4 +- src/mame/machine/pc1512kb.cpp | 6 +- src/mame/machine/pc1512kb.h | 1 + src/mame/machine/pmd85.cpp | 10 +- src/mame/machine/sms.cpp | 20 +-- src/mame/machine/tandy2kb.cpp | 6 +- src/mame/machine/tandy2kb.h | 1 + src/mame/machine/trs80m2kb.cpp | 6 +- src/mame/machine/trs80m2kb.h | 1 + src/mame/machine/v1050kb.cpp | 4 +- src/mame/machine/v1050kb.h | 1 + src/mame/machine/victor9k_fdc.cpp | 7 +- src/mame/machine/victor9k_fdc.h | 1 + src/mame/machine/wangpckb.cpp | 3 +- src/mame/machine/wangpckb.h | 1 + src/mame/machine/xevious.cpp | 4 +- src/mame/video/cischeat.cpp | 12 +- src/mame/video/cps1.cpp | 6 +- src/mame/video/cvs.cpp | 4 +- src/mame/video/epos.cpp | 4 +- 316 files changed, 5563 insertions(+), 4640 deletions(-) diff --git a/src/devices/bus/abckb/abc99.cpp b/src/devices/bus/abckb/abc99.cpp index af0132cc724..49d0e9e7dd9 100644 --- a/src/devices/bus/abckb/abc99.cpp +++ b/src/devices/bus/abckb/abc99.cpp @@ -478,6 +478,7 @@ abc99_device::abc99_device(const machine_config &mconfig, const char *tag, devic m_speaker(*this, "speaker"), m_z14(*this, "Z14"), m_mouseb(*this, "MOUSEB"), + m_led(*this, "led%u", 0U), m_si(1), m_si_en(1), m_so_z2(1), @@ -498,6 +499,7 @@ abc99_device::abc99_device(const machine_config &mconfig, const char *tag, devic void abc99_device::device_start() { + m_led.resolve(); // allocate timers m_serial_timer = timer_alloc(TIMER_SERIAL); m_serial_timer->adjust(MCS48_ALE_CLOCK(XTAL(6'000'000)/3), 0, MCS48_ALE_CLOCK(XTAL(6'000'000)/3)); @@ -573,14 +575,14 @@ WRITE8_MEMBER( abc99_device::z2_led_w ) { if (m_led_en) return; - machine().output().set_led_value(LED_1, BIT(data, 0)); - machine().output().set_led_value(LED_2, BIT(data, 1)); - machine().output().set_led_value(LED_3, BIT(data, 2)); - machine().output().set_led_value(LED_4, BIT(data, 3)); - machine().output().set_led_value(LED_5, BIT(data, 4)); - machine().output().set_led_value(LED_6, BIT(data, 5)); - machine().output().set_led_value(LED_7, BIT(data, 6)); - machine().output().set_led_value(LED_8, BIT(data, 7)); + m_led[LED_1] = BIT(data, 0); + m_led[LED_2] = BIT(data, 1); + m_led[LED_3] = BIT(data, 2); + m_led[LED_4] = BIT(data, 3); + m_led[LED_5] = BIT(data, 4); + m_led[LED_6] = BIT(data, 5); + m_led[LED_7] = BIT(data, 6); + m_led[LED_8] = BIT(data, 7); } @@ -616,9 +618,9 @@ WRITE8_MEMBER( abc99_device::z2_p1_w ) m_t1_z5 = BIT(data, 2); // key LEDs - machine().output().set_led_value(LED_INS, BIT(data, 3)); - machine().output().set_led_value(LED_ALT, BIT(data, 4)); - machine().output().set_led_value(LED_CAPS_LOCK, BIT(data, 5)); + m_led[LED_INS] = BIT(data, 3); + m_led[LED_ALT] = BIT(data, 4); + m_led[LED_CAPS_LOCK] = BIT(data, 5); // speaker output m_speaker->level_w(!BIT(data, 6)); diff --git a/src/devices/bus/abckb/abc99.h b/src/devices/bus/abckb/abc99.h index 5a997fc3858..83682548275 100644 --- a/src/devices/bus/abckb/abc99.h +++ b/src/devices/bus/abckb/abc99.h @@ -97,6 +97,7 @@ private: required_device m_speaker; required_ioport m_z14; required_ioport m_mouseb; + output_finder<11> m_led; int m_si; int m_si_en; diff --git a/src/devices/bus/cbmiec/c1541.cpp b/src/devices/bus/cbmiec/c1541.cpp index 3b04805e683..3352de9ea50 100644 --- a/src/devices/bus/cbmiec/c1541.cpp +++ b/src/devices/bus/cbmiec/c1541.cpp @@ -726,7 +726,7 @@ WRITE8_MEMBER( c1541_device_base::via1_pb_w ) m_ga->stp_w(data & 0x03); // activity LED - machine().output().set_led_value(LED_ACT, BIT(data, 3)); + m_led[LED_ACT] = BIT(data, 3); // density select m_ga->ds_w((data >> 5) & 0x03); @@ -943,6 +943,7 @@ c1541_device_base::c1541_device_base(const machine_config &mconfig, device_type m_via1(*this, M6522_1_TAG), m_ga(*this, C64H156_TAG), m_address(*this, "ADDRESS"), + m_led(*this, "led%u", 0U), m_data_out(1), m_via0_irq(CLEAR_LINE), m_via1_irq(CLEAR_LINE) @@ -1057,6 +1058,8 @@ indus_gt_device::indus_gt_device(const machine_config &mconfig, const char *tag, void c1541_device_base::device_start() { + m_led.resolve(); + // install image callbacks m_ga->set_floppy(m_floppy); diff --git a/src/devices/bus/cbmiec/c1541.h b/src/devices/bus/cbmiec/c1541.h index 488ee4e438b..263f8618e38 100644 --- a/src/devices/bus/cbmiec/c1541.h +++ b/src/devices/bus/cbmiec/c1541.h @@ -93,6 +93,7 @@ private: required_device m_via1; required_device m_ga; required_ioport m_address; + output_finder<2> m_led; // IEC bus int m_data_out; // serial data out diff --git a/src/devices/bus/cbmiec/c1571.cpp b/src/devices/bus/cbmiec/c1571.cpp index 336cc049118..ead261245e4 100644 --- a/src/devices/bus/cbmiec/c1571.cpp +++ b/src/devices/bus/cbmiec/c1571.cpp @@ -459,7 +459,7 @@ WRITE8_MEMBER( c1571_device::via1_pb_w ) m_ga->stp_w(data & 0x03); // TODO actually STP1=0, STP0=!(PB0^PB1), Y0=PB1, Y2=!PB1 // activity LED - machine().output().set_led_value(LED_ACT, BIT(data, 3)); + m_led[LED_ACT] = BIT(data, 3); // density select m_ga->ds_w((data >> 5) & 0x03); @@ -791,6 +791,7 @@ c1571_device::c1571_device(const machine_config &mconfig, device_type type, cons m_ga(*this, C64H156_TAG), m_floppy(*this, C64H156_TAG":0:525qd"), m_address(*this, "ADDRESS"), + m_led(*this, "led%u", 0U), m_1_2mhz(0), m_data_out(1), m_ser_dir(0), @@ -844,6 +845,8 @@ mini_chief_device::mini_chief_device(const machine_config &mconfig, const char * void c1571_device::device_start() { + m_led.resolve(); + // install image callbacks m_ga->set_floppy(m_floppy); //m_fdc->set_floppy(m_floppy); diff --git a/src/devices/bus/cbmiec/c1571.h b/src/devices/bus/cbmiec/c1571.h index 0679dff686b..fa9cab64576 100644 --- a/src/devices/bus/cbmiec/c1571.h +++ b/src/devices/bus/cbmiec/c1571.h @@ -107,6 +107,7 @@ protected: required_device m_ga; required_device m_floppy; required_ioport m_address; + output_finder<2> m_led; // signals int m_1_2mhz; // clock speed diff --git a/src/devices/bus/cbmiec/c1581.cpp b/src/devices/bus/cbmiec/c1581.cpp index f0dad13a58c..569aae45421 100644 --- a/src/devices/bus/cbmiec/c1581.cpp +++ b/src/devices/bus/cbmiec/c1581.cpp @@ -171,10 +171,10 @@ WRITE8_MEMBER( c1581_device::cia_pa_w ) m_floppy->mon_w(BIT(data, 2)); // power led - machine().output().set_led_value(LED_POWER, BIT(data, 5)); + m_led[LED_POWER] = BIT(data, 5); // activity led - machine().output().set_led_value(LED_ACT, BIT(data, 6)); + m_led[LED_ACT] = BIT(data, 6); } READ8_MEMBER( c1581_device::cia_pb_r ) @@ -326,6 +326,7 @@ c1581_device::c1581_device(const machine_config &mconfig, device_type type, cons m_fdc(*this, WD1772_TAG), m_floppy(*this, WD1772_TAG":0:35dd"), m_address(*this, "ADDRESS"), + m_led(*this, "led%u", 0U), m_data_out(0), m_atn_ack(0), m_fast_ser_dir(0), @@ -354,6 +355,8 @@ c1563_device::c1563_device(const machine_config &mconfig, const char *tag, devic void c1581_device::device_start() { + m_led.resolve(); + // state saving save_item(NAME(m_data_out)); save_item(NAME(m_atn_ack)); diff --git a/src/devices/bus/cbmiec/c1581.h b/src/devices/bus/cbmiec/c1581.h index 64c616bad45..3102bd8eadf 100644 --- a/src/devices/bus/cbmiec/c1581.h +++ b/src/devices/bus/cbmiec/c1581.h @@ -82,6 +82,7 @@ private: required_device m_fdc; required_device m_floppy; required_ioport m_address; + output_finder<2> m_led; int m_data_out; // serial data out int m_atn_ack; // attention acknowledge diff --git a/src/devices/bus/ieee488/c2031.cpp b/src/devices/bus/ieee488/c2031.cpp index af6172cb178..b10d14891d5 100644 --- a/src/devices/bus/ieee488/c2031.cpp +++ b/src/devices/bus/ieee488/c2031.cpp @@ -261,7 +261,7 @@ WRITE8_MEMBER( c2031_device::via1_pb_w ) m_ga->stp_w(data & 0x03); // activity LED - machine().output().set_led_value(LED_ACT, BIT(data, 3)); + m_led[LED_ACT] = BIT(data, 3); // density select m_ga->ds_w((data >> 5) & 0x03); @@ -398,6 +398,7 @@ c2031_device::c2031_device(const machine_config &mconfig, const char *tag, devic , m_ga(*this, C64H156_TAG) , m_floppy(*this, C64H156_TAG":0:525ssqd") , m_address(*this, "ADDRESS") + , m_led(*this, "led%u", 0U) , m_nrfd_out(1) , m_ndac_out(1) , m_atna(1) @@ -414,6 +415,7 @@ c2031_device::c2031_device(const machine_config &mconfig, const char *tag, devic void c2031_device::device_start() { + m_led.resolve(); // install image callbacks m_ga->set_floppy(m_floppy); diff --git a/src/devices/bus/ieee488/c2031.h b/src/devices/bus/ieee488/c2031.h index 886db53db5e..e6ac32b478c 100644 --- a/src/devices/bus/ieee488/c2031.h +++ b/src/devices/bus/ieee488/c2031.h @@ -68,6 +68,7 @@ private: required_device m_ga; required_device m_floppy; required_ioport m_address; + output_finder<2> m_led; // IEEE-488 bus int m_nrfd_out; // not ready for data diff --git a/src/devices/bus/ieee488/c2040.cpp b/src/devices/bus/ieee488/c2040.cpp index aee0f5a895c..609cea7cdc2 100644 --- a/src/devices/bus/ieee488/c2040.cpp +++ b/src/devices/bus/ieee488/c2040.cpp @@ -365,13 +365,13 @@ WRITE8_MEMBER( c2040_device::riot1_pb_w ) */ // activity led 1 - machine().output().set_led_value(LED_ACT1, BIT(data, 3)); + m_led[LED_ACT1] = BIT(data, 3); // activity led 0 - machine().output().set_led_value(LED_ACT0, BIT(data, 4)); + m_led[LED_ACT0] = BIT(data, 4); // error led - machine().output().set_led_value(LED_ERR, BIT(data, 5)); + m_led[LED_ERR] = BIT(data, 5); } @@ -650,6 +650,7 @@ c2040_device::c2040_device(const machine_config &mconfig, device_type type, cons m_fdc(*this, FDC_TAG), m_gcr(*this, "gcr"), m_address(*this, "ADDRESS"), + m_led(*this, "led%u", 0U), m_rfdo(1), m_daco(1), m_atna(1), @@ -689,6 +690,7 @@ c4040_device::c4040_device(const machine_config &mconfig, const char *tag, devic void c2040_device::device_start() { + m_led.resolve(); // install image callbacks m_fdc->set_floppy(m_floppy0, m_floppy1); diff --git a/src/devices/bus/ieee488/c2040.h b/src/devices/bus/ieee488/c2040.h index 54da6a00654..db592853b60 100644 --- a/src/devices/bus/ieee488/c2040.h +++ b/src/devices/bus/ieee488/c2040.h @@ -81,6 +81,7 @@ protected: required_device m_fdc; required_memory_region m_gcr; required_ioport m_address; + output_finder<4> m_led; // IEEE-488 bus int m_rfdo; // not ready for data output diff --git a/src/devices/bus/ieee488/c8050.cpp b/src/devices/bus/ieee488/c8050.cpp index c15eebb6c14..714fc6bcbfe 100644 --- a/src/devices/bus/ieee488/c8050.cpp +++ b/src/devices/bus/ieee488/c8050.cpp @@ -415,13 +415,13 @@ WRITE8_MEMBER( c8050_device::riot1_pb_w ) */ // activity led 1 - machine().output().set_led_value(LED_ACT1, BIT(data, 3)); + m_led[LED_ACT1] = BIT(data, 3); // activity led 0 - machine().output().set_led_value(LED_ACT0, BIT(data, 4)); + m_led[LED_ACT0] = BIT(data, 4); // error led - machine().output().set_led_value(LED_ERR, BIT(data, 5)); + m_led[LED_ERR] = BIT(data, 5); } WRITE8_MEMBER( c8050_device::via_pb_w ) @@ -782,6 +782,7 @@ c8050_device::c8050_device(const machine_config &mconfig, device_type type, cons m_floppy1(*this, FDC_TAG ":1"), m_fdc(*this, FDC_TAG), m_address(*this, "ADDRESS"), + m_led(*this, "led%u", 0U), m_rfdo(1), m_daco(1), m_atna(1), @@ -831,6 +832,8 @@ sfd1001_device::sfd1001_device(const machine_config &mconfig, const char *tag, d void c8050_device::device_start() { + m_led.resolve(); + // install image callbacks m_fdc->set_floppy(m_floppy0, m_floppy1); diff --git a/src/devices/bus/ieee488/c8050.h b/src/devices/bus/ieee488/c8050.h index 8a0a3f75935..77fd15b04f3 100644 --- a/src/devices/bus/ieee488/c8050.h +++ b/src/devices/bus/ieee488/c8050.h @@ -72,6 +72,7 @@ protected: optional_device m_floppy1; required_device m_fdc; required_ioport m_address; + output_finder<4> m_led; // IEEE-488 bus int m_rfdo; // not ready for data output diff --git a/src/devices/bus/ieee488/c8280.cpp b/src/devices/bus/ieee488/c8280.cpp index 4a142b625b5..734d506738e 100644 --- a/src/devices/bus/ieee488/c8280.cpp +++ b/src/devices/bus/ieee488/c8280.cpp @@ -269,13 +269,13 @@ WRITE8_MEMBER( c8280_device::riot1_pb_w ) */ // activity led 1 - machine().output().set_led_value(LED_ACT1, BIT(data, 3)); + m_led[LED_ACT1] = BIT(data, 3); // activity led 0 - machine().output().set_led_value(LED_ACT0, BIT(data, 4)); + m_led[LED_ACT0] = BIT(data, 4); // error led - machine().output().set_led_value(LED_ERR, BIT(data, 5)); + m_led[LED_ERR] = BIT(data, 5); } static void c8280_floppies(device_slot_interface &device) @@ -385,7 +385,9 @@ c8280_device::c8280_device(const machine_config &mconfig, const char *tag, devic m_fdc(*this, WD1797_TAG), m_floppy0(*this, WD1797_TAG ":0"), m_floppy1(*this, WD1797_TAG ":1"), - m_address(*this, "ADDRESS"), m_floppy(nullptr), + m_address(*this, "ADDRESS"), + m_floppy(nullptr), + m_led(*this, "led%u", 0U), m_rfdo(1), m_daco(1), m_atna(1), m_ifc(0), m_fk5(0) @@ -399,6 +401,8 @@ c8280_device::c8280_device(const machine_config &mconfig, const char *tag, devic void c8280_device::device_start() { + m_led.resolve(); + // state saving save_item(NAME(m_rfdo)); save_item(NAME(m_daco)); diff --git a/src/devices/bus/ieee488/c8280.h b/src/devices/bus/ieee488/c8280.h index 38309ea1089..76aadff7217 100644 --- a/src/devices/bus/ieee488/c8280.h +++ b/src/devices/bus/ieee488/c8280.h @@ -71,6 +71,7 @@ private: required_device m_floppy1; required_ioport m_address; floppy_image_device *m_floppy; + output_finder<4> m_led; // IEEE-488 bus int m_rfdo; // not ready for data output diff --git a/src/devices/bus/ieee488/d9060.cpp b/src/devices/bus/ieee488/d9060.cpp index 8618dc944cd..a77c2613fec 100644 --- a/src/devices/bus/ieee488/d9060.cpp +++ b/src/devices/bus/ieee488/d9060.cpp @@ -305,13 +305,13 @@ WRITE8_MEMBER( d9060_device_base::riot1_pb_w ) */ // ready led - machine().output().set_led_value(LED_READY, BIT(data, 4)); + m_led[LED_READY] = BIT(data, 4); // power led - machine().output().set_led_value(LED_POWER, BIT(data, 5)); + m_led[LED_POWER] = BIT(data, 5); // error led - machine().output().set_led_value(LED_ERROR, !BIT(data, 5)); + m_led[LED_ERROR] = !BIT(data, 5); } @@ -486,6 +486,7 @@ d9060_device_base::d9060_device_base(const machine_config &mconfig, device_type , m_sasibus(*this, SASIBUS_TAG) , m_sasi_data_out(*this, "sasi_data_out") , m_address(*this, "ADDRESS") + , m_led(*this, "led%u", 0U) , m_rfdo(1) , m_daco(1) , m_atna(1) @@ -523,6 +524,8 @@ d9090_device::d9090_device(const machine_config &mconfig, const char *tag, devic void d9060_device_base::device_start() { + m_led.resolve(); + // state saving save_item(NAME(m_rfdo)); save_item(NAME(m_daco)); diff --git a/src/devices/bus/ieee488/d9060.h b/src/devices/bus/ieee488/d9060.h index d02e0728f72..f1c852745f7 100644 --- a/src/devices/bus/ieee488/d9060.h +++ b/src/devices/bus/ieee488/d9060.h @@ -73,6 +73,7 @@ private: required_device m_sasibus; required_device m_sasi_data_out; required_ioport m_address; + output_finder<3> m_led; // IEEE-488 bus int m_rfdo; // not ready for data output diff --git a/src/devices/bus/ieee488/hardbox.cpp b/src/devices/bus/ieee488/hardbox.cpp index 14a2a9a16d2..f8fabf6a967 100644 --- a/src/devices/bus/ieee488/hardbox.cpp +++ b/src/devices/bus/ieee488/hardbox.cpp @@ -257,9 +257,9 @@ WRITE8_MEMBER( hardbox_device::ppi1_pc_w ) */ - machine().output().set_led_value(LED_A, !BIT(data, 0)); - machine().output().set_led_value(LED_B, !BIT(data, 1)); - machine().output().set_led_value(LED_READY, !BIT(data, 2)); + m_led[LED_A] = BIT(~data, 0); + m_led[LED_B] = BIT(~data, 1); + m_led[LED_READY] = BIT(~data, 2); } @@ -344,6 +344,7 @@ hardbox_device::hardbox_device(const machine_config &mconfig, const char *tag, d , device_ieee488_interface(mconfig, *this) , m_maincpu(*this, Z80_TAG) , m_hdc(*this, CORVUS_HDC_TAG) + , m_led(*this, "led%u", 0U) , m_ifc(0) { } @@ -355,6 +356,7 @@ hardbox_device::hardbox_device(const machine_config &mconfig, const char *tag, d void hardbox_device::device_start() { + m_led.resolve(); } diff --git a/src/devices/bus/ieee488/hardbox.h b/src/devices/bus/ieee488/hardbox.h index 80b1fc0df07..79d3acacb7b 100644 --- a/src/devices/bus/ieee488/hardbox.h +++ b/src/devices/bus/ieee488/hardbox.h @@ -61,13 +61,14 @@ private: enum { - LED_A, + LED_A = 0, LED_B, LED_READY }; required_device m_maincpu; required_device m_hdc; + output_finder<3> m_led; int m_ifc; // Tracks previous state of IEEE-488 IFC line }; diff --git a/src/devices/bus/ieee488/softbox.cpp b/src/devices/bus/ieee488/softbox.cpp index 5d6be33930c..b6b3d67dd01 100644 --- a/src/devices/bus/ieee488/softbox.cpp +++ b/src/devices/bus/ieee488/softbox.cpp @@ -215,9 +215,9 @@ WRITE8_MEMBER( softbox_device::ppi1_pc_w ) */ - machine().output().set_led_value(LED_A, !BIT(data, 0)); - machine().output().set_led_value(LED_B, !BIT(data, 1)); - machine().output().set_led_value(LED_READY, !BIT(data, 2)); + m_led[LED_A] = BIT(~data, 0); + m_led[LED_B] = BIT(~data, 1); + m_led[LED_READY] = BIT(~data, 2); } static DEVICE_INPUT_DEFAULTS_START( terminal ) @@ -324,6 +324,7 @@ softbox_device::softbox_device(const machine_config &mconfig, const char *tag, d , m_maincpu(*this, Z80_TAG) , m_dbrg(*this, COM8116_TAG) , m_hdc(*this, CORVUS_HDC_TAG) + , m_led(*this, "led%u", 0U) , m_ifc(0) { } @@ -335,6 +336,7 @@ softbox_device::softbox_device(const machine_config &mconfig, const char *tag, d void softbox_device::device_start() { + m_led.resolve(); } diff --git a/src/devices/bus/ieee488/softbox.h b/src/devices/bus/ieee488/softbox.h index 74c5f985ae3..9040c9c9853 100644 --- a/src/devices/bus/ieee488/softbox.h +++ b/src/devices/bus/ieee488/softbox.h @@ -64,7 +64,7 @@ private: enum { - LED_A, + LED_A = 0, LED_B, LED_READY }; @@ -72,6 +72,7 @@ private: required_device m_maincpu; required_device m_dbrg; required_device m_hdc; + output_finder<3> m_led; int m_ifc; // Tracks previous state of IEEE-488 IFC line }; diff --git a/src/devices/bus/msx_cart/disk.cpp b/src/devices/bus/msx_cart/disk.cpp index 24dca42fd93..ba4b9f0d04c 100644 --- a/src/devices/bus/msx_cart/disk.cpp +++ b/src/devices/bus/msx_cart/disk.cpp @@ -142,6 +142,7 @@ msx_cart_disk_wd_device::msx_cart_disk_wd_device(const machine_config &mconfig, msx_cart_disk_type1_device::msx_cart_disk_type1_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : msx_cart_disk_wd_device(mconfig, type, tag, owner, clock) + , m_led(*this, "led0") , m_side_control(0) , m_control(0) { @@ -150,6 +151,7 @@ msx_cart_disk_type1_device::msx_cart_disk_type1_device(const machine_config &mco msx_cart_disk_type2_device::msx_cart_disk_type2_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : msx_cart_disk_wd_device(mconfig, type, tag, owner, clock) + , m_led(*this, "led0") , m_control(0) { } @@ -262,6 +264,8 @@ MACHINE_CONFIG_END void msx_cart_disk_type1_device::device_start() { + m_led.resolve(); + save_item(NAME(m_side_control)); save_item(NAME(m_control)); @@ -312,7 +316,7 @@ void msx_cart_disk_type1_device::set_control(uint8_t data) if ((old_m_control ^ m_control) & 0x40) { - machine().output().set_led_value(0, !(m_control & 0x40)); + m_led = BIT(~m_control, 6); } } @@ -418,6 +422,8 @@ WRITE8_MEMBER(msx_cart_disk_type1_device::write_cart) void msx_cart_disk_type2_device::device_start() { + m_led.resolve(); + save_item(NAME(m_control)); machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_disk_type2_device::post_load), this)); @@ -472,7 +478,7 @@ void msx_cart_disk_type2_device::set_control(uint8_t data) if ((old_m_control ^ m_control) & 0x40) { - machine().output().set_led_value(0, !(m_control & 0x40)); + m_led = BIT(~m_control, 6); } } diff --git a/src/devices/bus/msx_cart/disk.h b/src/devices/bus/msx_cart/disk.h index 59f25372e08..8556f807e40 100644 --- a/src/devices/bus/msx_cart/disk.h +++ b/src/devices/bus/msx_cart/disk.h @@ -58,6 +58,7 @@ protected: void post_load(); + output_finder<> m_led; uint8_t m_side_control; uint8_t m_control; @@ -81,6 +82,7 @@ protected: void post_load(); + output_finder<> m_led; uint8_t m_control; void set_control(uint8_t data); diff --git a/src/devices/bus/msx_slot/disk.cpp b/src/devices/bus/msx_slot/disk.cpp index 10a319ca489..39ec248e3f2 100644 --- a/src/devices/bus/msx_slot/disk.cpp +++ b/src/devices/bus/msx_slot/disk.cpp @@ -83,6 +83,7 @@ void msx_slot_disk_device::device_start() msx_slot_wd_disk_device::msx_slot_wd_disk_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : msx_slot_disk_device(mconfig, type, tag, owner, clock) , m_fdc(nullptr) + , m_led(*this, "led0") { } @@ -91,6 +92,7 @@ void msx_slot_wd_disk_device::device_start() { msx_slot_disk_device::device_start(); + m_led.resolve(); m_fdc = owner()->subdevice(m_fdc_tag); if (m_fdc == nullptr) @@ -200,7 +202,7 @@ void msx_slot_disk1_device::set_control(uint8_t data) if ((old_m_control ^ m_control) & 0x40) { - machine().output().set_led_value(0, !(m_control & 0x40)); + m_led = BIT(~m_control, 6); } } @@ -349,7 +351,7 @@ void msx_slot_disk2_device::set_control(uint8_t data) if ((old_m_control ^ m_control) & 0x40) { - machine().output().set_led_value(0, !(m_control & 0x40)); + m_led = BIT(~m_control, 6); } } diff --git a/src/devices/bus/msx_slot/disk.h b/src/devices/bus/msx_slot/disk.h index d619cb1aa25..6b3c4ab055a 100644 --- a/src/devices/bus/msx_slot/disk.h +++ b/src/devices/bus/msx_slot/disk.h @@ -109,6 +109,7 @@ protected: virtual void device_start() override; wd_fdc_analog_device_base *m_fdc; + output_finder<> m_led; }; diff --git a/src/devices/bus/pc_kbd/pcat84.cpp b/src/devices/bus/pc_kbd/pcat84.cpp index 77ee7fd4f27..0b78c126d86 100644 --- a/src/devices/bus/pc_kbd/pcat84.cpp +++ b/src/devices/bus/pc_kbd/pcat84.cpp @@ -343,6 +343,7 @@ ibm_pc_at_84_keyboard_device::ibm_pc_at_84_keyboard_device(const machine_config m_dr(*this, "DR%02u", 0), m_kbdida(*this, "KBDIDA"), m_kbdidb(*this, "KBDIDB"), + m_led(*this, "led%u", 0U), m_db(0), m_cnt(0), m_sense(0), @@ -369,6 +370,8 @@ void ibm_pc_at_84_keyboard_device::device_start() { set_pc_kbdc_device(); + m_led.resolve(); + // state saving save_item(NAME(m_db)); save_item(NAME(m_cnt)); @@ -526,9 +529,9 @@ WRITE8_MEMBER( ibm_pc_at_84_keyboard_device::p2_w ) */ - machine().output().set_led_value(LED_SCROLL, BIT(data, 0)); - machine().output().set_led_value(LED_NUM, BIT(data, 1)); - machine().output().set_led_value(LED_CAPS, BIT(data, 2)); + m_led[LED_SCROLL] = BIT(data, 0); + m_led[LED_NUM] = BIT(data, 1); + m_led[LED_CAPS] = BIT(data, 2); m_pc_kbdc->data_write_from_kb(!BIT(data, 7)); m_pc_kbdc->clock_write_from_kb(!BIT(data, 6)); diff --git a/src/devices/bus/pc_kbd/pcat84.h b/src/devices/bus/pc_kbd/pcat84.h index 8c4baed317b..fbc73172d90 100644 --- a/src/devices/bus/pc_kbd/pcat84.h +++ b/src/devices/bus/pc_kbd/pcat84.h @@ -57,7 +57,7 @@ private: enum { - LED_SCROLL, + LED_SCROLL = 0, LED_NUM, LED_CAPS }; @@ -68,6 +68,7 @@ private: required_ioport_array<16> m_dr; optional_ioport m_kbdida; optional_ioport m_kbdidb; + output_finder<3> m_led; uint8_t m_db; int m_cnt; diff --git a/src/devices/bus/plus4/c1551.cpp b/src/devices/bus/plus4/c1551.cpp index 87dce744732..575f3e65171 100644 --- a/src/devices/bus/plus4/c1551.cpp +++ b/src/devices/bus/plus4/c1551.cpp @@ -109,7 +109,7 @@ WRITE8_MEMBER( c1551_device::port_w ) m_ga->mtr_w(BIT(data, 2)); // activity LED - machine().output().set_led_value(LED_ACT, BIT(data, 3)); + m_led[LED_ACT] = BIT(data, 3); // density select m_ga->ds_w((data >> 5) & 0x03); @@ -416,6 +416,7 @@ c1551_device::c1551_device(const machine_config &mconfig, const char *tag, devic , m_floppy(*this, C64H156_TAG":0:525ssqd") , m_exp(*this, PLUS4_EXPANSION_SLOT_TAG) , m_jp1(*this, "JP1") + , m_led(*this, "led%u", 0U) , m_tcbm_data(0xff) , m_status(1) , m_dav(1) @@ -432,6 +433,8 @@ c1551_device::c1551_device(const machine_config &mconfig, const char *tag, devic void c1551_device::device_start() { + m_led.resolve(); + // allocate timers m_irq_timer = timer_alloc(); m_irq_timer->adjust(attotime::zero, CLEAR_LINE); diff --git a/src/devices/bus/plus4/c1551.h b/src/devices/bus/plus4/c1551.h index 80b4a72ca5c..b79f0fb58eb 100644 --- a/src/devices/bus/plus4/c1551.h +++ b/src/devices/bus/plus4/c1551.h @@ -82,6 +82,7 @@ private: required_device m_floppy; required_device m_exp; required_ioport m_jp1; + output_finder<2> m_led; // TCBM bus uint8_t m_tcbm_data; // data diff --git a/src/devices/bus/sunkbd/hlekbd.cpp b/src/devices/bus/sunkbd/hlekbd.cpp index 616a2cbd66f..a32365fa388 100644 --- a/src/devices/bus/sunkbd/hlekbd.cpp +++ b/src/devices/bus/sunkbd/hlekbd.cpp @@ -753,6 +753,7 @@ hle_device_base::hle_device_base( , m_dips(*this, "DIP") , m_click_timer(nullptr) , m_beeper(*this, "beeper") + , m_led(*this, "led%u", 0U) , m_make_count(0U) , m_rx_state(RX_IDLE) , m_keyclick(0U) @@ -802,6 +803,7 @@ MACHINE_CONFIG_END void hle_device_base::device_start() { + m_led.resolve(); m_click_timer = timer_alloc(CLICK_TIMER_ID); save_item(NAME(m_make_count)); @@ -836,11 +838,11 @@ void hle_device_base::device_reset() output_rxd(1); // start with keyboard LEDs off - machine().output().set_led_value(LED_NUM, 0); - machine().output().set_led_value(LED_COMPOSE, 0); - machine().output().set_led_value(LED_SCROLL, 0); - machine().output().set_led_value(LED_CAPS, 0); - machine().output().set_led_value(LED_KANA, 0); + m_led[LED_NUM] = 0; + m_led[LED_COMPOSE] = 0; + m_led[LED_SCROLL] = 0; + m_led[LED_CAPS] = 0; + m_led[LED_KANA] = 0; // no beep m_click_timer->reset(); @@ -972,11 +974,11 @@ void hle_device_base::received_byte(uint8_t byte) switch (m_rx_state) { case RX_LED: - machine().output().set_led_value(LED_NUM, BIT(byte, 0)); - machine().output().set_led_value(LED_COMPOSE, BIT(byte, 1)); - machine().output().set_led_value(LED_SCROLL, BIT(byte, 2)); - machine().output().set_led_value(LED_CAPS, BIT(byte, 3)); - machine().output().set_led_value(LED_KANA, BIT(byte, 4)); + m_led[LED_NUM] = BIT(byte, 0); + m_led[LED_COMPOSE] = BIT(byte, 1); + m_led[LED_SCROLL] = BIT(byte, 2); + m_led[LED_CAPS] = BIT(byte, 3); + m_led[LED_KANA] = BIT(byte, 4); m_rx_state = RX_IDLE; break; diff --git a/src/devices/bus/sunkbd/hlekbd.h b/src/devices/bus/sunkbd/hlekbd.h index 21caa54dac9..2b4f17217b5 100644 --- a/src/devices/bus/sunkbd/hlekbd.h +++ b/src/devices/bus/sunkbd/hlekbd.h @@ -93,6 +93,7 @@ private: emu_timer *m_click_timer; required_device m_beeper; + output_finder<5> m_led; uint8_t m_make_count; uint8_t m_rx_state; diff --git a/src/devices/machine/amigafdc.cpp b/src/devices/machine/amigafdc.cpp index ce3dc5e7c00..7b065b1ad44 100644 --- a/src/devices/machine/amigafdc.cpp +++ b/src/devices/machine/amigafdc.cpp @@ -24,6 +24,7 @@ amiga_fdc_device::amiga_fdc_device(const machine_config &mconfig, const char *ta m_write_dma(*this), m_write_dskblk(*this), m_write_dsksyn(*this), + m_leds(*this, "led%u", 1U), floppy(nullptr), t_gen(nullptr), dsklen(0), pre_dsklen(0), dsksync(0), dskbyt(0), adkcon(0), dmacon(0), dskpt(0), dma_value(0), dma_state(0) { } @@ -35,6 +36,7 @@ void amiga_fdc_device::device_start() m_write_dma.resolve_safe(); m_write_dskblk.resolve_safe(); m_write_dsksyn.resolve_safe(); + m_leds.resolve(); static const char *names[] = { "0", "1", "2", "3" }; for(int i=0; i != 4; i++) { @@ -440,8 +442,8 @@ void amiga_fdc_device::setup_leds() machine().output().set_value("drive_2_led", drive == 2); machine().output().set_value("drive_3_led", drive == 3); - machine().output().set_led_value(1, drive == 0); /* update internal drive led */ - machine().output().set_led_value(2, drive == 1); /* update external drive led */ + m_leds[0] = drive == 0 ? 1 : 0; // update internal drive led + m_leds[1] = drive == 1 ? 1 : 0; // update external drive led } } diff --git a/src/devices/machine/amigafdc.h b/src/devices/machine/amigafdc.h index 732a024785a..e95e1ed0137 100644 --- a/src/devices/machine/amigafdc.h +++ b/src/devices/machine/amigafdc.h @@ -107,6 +107,7 @@ private: devcb_write16 m_write_dma; devcb_write_line m_write_dskblk; devcb_write_line m_write_dsksyn; + output_finder<2> m_leds; floppy_image_device *floppy; floppy_image_device *floppy_devices[4]; diff --git a/src/devices/machine/pckeybrd.cpp b/src/devices/machine/pckeybrd.cpp index 2ff9f5c7261..b06611f261f 100644 --- a/src/devices/machine/pckeybrd.cpp +++ b/src/devices/machine/pckeybrd.cpp @@ -293,6 +293,7 @@ pc_keyboard_device::pc_keyboard_device(const machine_config &mconfig, device_typ at_keyboard_device::at_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : pc_keyboard_device(mconfig, AT_KEYB, tag, owner, clock), + m_leds(*this, "led%u", 0U), m_scan_code_set(1) { m_type = KEYBOARD_TYPE::AT; @@ -333,6 +334,7 @@ void at_keyboard_device::device_start() save_item(NAME(m_scan_code_set)); save_item(NAME(m_input_state)); pc_keyboard_device::device_start(); + m_leds.resolve(); } void pc_keyboard_device::device_reset() @@ -341,10 +343,6 @@ void pc_keyboard_device::device_reset() m_repeat = 8; m_numlock = 0; m_on = true; - /* set default led state */ - machine().output().set_led_value(2, 0); - machine().output().set_led_value(0, 0); - machine().output().set_led_value(1, 0); m_head = m_tail = 0; queue_insert(0xaa); @@ -355,6 +353,11 @@ void at_keyboard_device::device_reset() { m_input_state = 0; pc_keyboard_device::device_reset(); + + /* set default led state */ + m_leds[2] = 0; + m_leds[0] = 0; + m_leds[1] = 0; } WRITE_LINE_MEMBER(pc_keyboard_device::enable) @@ -783,11 +786,10 @@ WRITE8_MEMBER(at_keyboard_device::write) /* bits: 0 scroll lock, 1 num lock, 2 capslock */ /* led's in same order as my keyboard leds. */ - /* num lock, caps lock, scroll lock */ - machine().output().set_led_value(2, (data & 0x01)); - machine().output().set_led_value(0, ((data & 0x02)>>1)); - machine().output().set_led_value(1, ((data & 0x04)>>2)); - + /* num lock, caps lock, scroll lock */ + m_leds[2] = BIT(data, 0); + m_leds[0] = BIT(data, 1); + m_leds[1] = BIT(data, 2); } break; case 2: diff --git a/src/devices/machine/pckeybrd.h b/src/devices/machine/pckeybrd.h index d890861b4ba..15e5cc92b3a 100644 --- a/src/devices/machine/pckeybrd.h +++ b/src/devices/machine/pckeybrd.h @@ -102,6 +102,7 @@ private: static const int m_scancode_set_2_3[]; static const extended_keyboard_code m_mf2_code[0x10][2]; + output_finder<3> m_leds; int m_scan_code_set; int m_input_state; }; diff --git a/src/emu/output.h b/src/emu/output.h index d766f9dd853..ea7c599678b 100644 --- a/src/emu/output.h +++ b/src/emu/output.h @@ -180,10 +180,6 @@ public: // map a unique ID back to a name const char *id_to_name(u32 id); - // helpers - [[deprecated("string format and hash in critical path")]] void set_led_value(int index, int value) { set_indexed_value("led", index, value ? 1 : 0); } - [[deprecated("string format and hash in critical path")]] void set_lamp_value(int index, int value) { set_indexed_value("lamp", index, value); } - void pause(); void resume(); diff --git a/src/mame/audio/copsnrob.cpp b/src/mame/audio/copsnrob.cpp index 264bf1c57fc..15603b3d9e7 100644 --- a/src/mame/audio/copsnrob.cpp +++ b/src/mame/audio/copsnrob.cpp @@ -691,7 +691,7 @@ DISCRETE_SOUND_END WRITE_LINE_MEMBER(copsnrob_state::one_start_w) { /* One Start */ - m_led = !state; + m_led[0] = state ? 0 :1; } diff --git a/src/mame/drivers/amiga.cpp b/src/mame/drivers/amiga.cpp index 26144756786..274268a398d 100644 --- a/src/mame/drivers/amiga.cpp +++ b/src/mame/drivers/amiga.cpp @@ -964,7 +964,7 @@ WRITE8_MEMBER( cd32_state::akiko_cia_0_port_a_write ) m_cdda->set_output_gain(0, BIT(data, 0) ? 0.0 : 1.0); // bit 1, power led - output().set_led_value(0, BIT(data, 1) ? 0 : 1); + m_power_led = BIT(~data, 1); handle_joystick_cia(data, m_cia_0->read(space, 2)); } diff --git a/src/mame/drivers/astrcorp.cpp b/src/mame/drivers/astrcorp.cpp index 87baae01025..3724894ed27 100644 --- a/src/mame/drivers/astrcorp.cpp +++ b/src/mame/drivers/astrcorp.cpp @@ -59,7 +59,8 @@ public: m_palette(*this, "palette"), m_hopper(*this, "hopper"), m_ticket(*this, "ticket"), - m_spriteram(*this, "spriteram") + m_spriteram(*this, "spriteram"), + m_lamp(*this, "lamp%u", 0U) { } // devices @@ -101,6 +102,11 @@ public: void showhand_map(address_map &map); void skilldrp_map(address_map &map); void speeddrp_map(address_map &map); + +protected: + virtual void machine_start() override; + + output_finder<7> m_lamp; }; /*************************************************************************** @@ -240,17 +246,17 @@ WRITE16_MEMBER(astrocorp_state::showhand_outputs_w) if (ACCESSING_BITS_0_7) { machine().bookkeeping().coin_counter_w(0, (data & 0x0004)); // coin counter - output().set_led_value(0, (data & 0x0008)); // you win + m_lamp[0] = BIT(data, 3); // you win if ((data & 0x0010)) machine().bookkeeping().increment_dispensed_tickets(1); // coin out - output().set_led_value(1, (data & 0x0020)); // coin/hopper jam + m_lamp[1] = BIT(data, 5); // coin/hopper jam } if (ACCESSING_BITS_8_15) { - output().set_led_value(2, (data & 0x0100)); // bet - output().set_led_value(3, (data & 0x0800)); // start - output().set_led_value(4, (data & 0x1000)); // ? select/choose - output().set_led_value(5, (data & 0x2000)); // ? select/choose - output().set_led_value(6, (data & 0x4000)); // look + m_lamp[2] = BIT(data, 8); // bet + m_lamp[3] = BIT(data, 11); // start + m_lamp[4] = BIT(data, 12); // ? select/choose + m_lamp[5] = BIT(data, 13); // ? select/choose + m_lamp[6] = BIT(data, 15); // look } // popmessage("%04X",data); } @@ -280,18 +286,18 @@ WRITE16_MEMBER(astrocorp_state::skilldrp_outputs_w) machine().bookkeeping().coin_counter_w(1, BIT(data, 2)); // key out | m_hopper->motor_w(BIT(data, 3)); // hopper motor? // BIT(data, 4) // hopper? - output().set_led_value(0, BIT(data, 5)); // error lamp (coin/hopper jam: "call attendant") + m_lamp[0] = BIT(data, 5); // error lamp (coin/hopper jam: "call attendant") m_ticket->motor_w(BIT(data, 7)); // ticket motor? } if (ACCESSING_BITS_8_15) { // lamps: - output().set_led_value(1, BIT(data, 8)); // select - output().set_led_value(2, BIT(data, 10)); // take - output().set_led_value(3, BIT(data, 11)); // bet - output().set_led_value(4, BIT(data, 12)); // start - output().set_led_value(5, BIT(data, 14)); // win / test - output().set_led_value(6, BIT(data, 15)); // ticket? + m_lamp[1] = BIT(data, 8); // select + m_lamp[2] = BIT(data, 10); // take + m_lamp[3] = BIT(data, 11); // bet + m_lamp[4] = BIT(data, 12); // start + m_lamp[5] = BIT(data, 14); // win / test + m_lamp[6] = BIT(data, 15); // ticket? } // popmessage("%04X",data); @@ -495,6 +501,12 @@ GFXDECODE_END static const uint16_t showhand_default_eeprom[15] = {0x0001,0x0007,0x000a,0x0003,0x0000,0x0009,0x0003,0x0000,0x0002,0x0001,0x0000,0x0000,0x0000,0x0000,0x0000}; +void astrocorp_state::machine_start() +{ + m_lamp.resolve(); +} + + /* TODO: understand if later hardware uses different parameters (XTAL is almost surely NOT 20 MHz so ...). Also, weirdly enough, there's an unused 6x PAL XTAL according to notes, but VSync = 58,85 Hz? diff --git a/src/mame/drivers/atarifb.cpp b/src/mame/drivers/atarifb.cpp index 0aabcc0c65b..7786b2055fc 100644 --- a/src/mame/drivers/atarifb.cpp +++ b/src/mame/drivers/atarifb.cpp @@ -514,6 +514,8 @@ GFXDECODE_END void atarifb_state::machine_start() { + m_led.resolve(); + save_item(NAME(m_CTRLD)); save_item(NAME(m_sign_x_1)); save_item(NAME(m_sign_x_2)); diff --git a/src/mame/drivers/atarist.cpp b/src/mame/drivers/atarist.cpp index 4e825abfb4a..7c57703c956 100644 --- a/src/mame/drivers/atarist.cpp +++ b/src/mame/drivers/atarist.cpp @@ -626,7 +626,7 @@ WRITE8_MEMBER( st_state::ikbd_port3_w ) */ // caps lock led - output().set_led_value(1, BIT(data, 0)); + m_led = BIT(data, 0); // keyboard row select m_ikbd_keylatch = (m_ikbd_keylatch & 0xff00) | data; @@ -1890,6 +1890,8 @@ void st_state::state_save() void st_state::machine_start() { + m_led.resolve(); + // configure RAM banking configure_memory(); @@ -1952,6 +1954,8 @@ void ste_state::state_save() void ste_state::machine_start() { + m_led.resolve(); + /* configure RAM banking */ configure_memory(); @@ -1990,6 +1994,8 @@ void megaste_state::machine_start() void stbook_state::machine_start() { + m_led.resolve(); + /* configure RAM banking */ address_space &program = m_maincpu->space(AS_PROGRAM); diff --git a/src/mame/drivers/atarisy2.cpp b/src/mame/drivers/atarisy2.cpp index 9a44eb4852b..d3635e65f8d 100644 --- a/src/mame/drivers/atarisy2.cpp +++ b/src/mame/drivers/atarisy2.cpp @@ -199,6 +199,8 @@ MACHINE_START_MEMBER(atarisy2_state,atarisy2) { atarigen_state::machine_start(); + m_led.resolve(); + save_item(NAME(m_interrupt_enable)); save_item(NAME(m_p2portwr_state)); save_item(NAME(m_p2portrd_state)); @@ -333,8 +335,8 @@ READ8_MEMBER(atarisy2_state::switch_6502_r) WRITE8_MEMBER(atarisy2_state::switch_6502_w) { - output().set_led_value(0, data & 0x04); - output().set_led_value(1, data & 0x08); + m_led[0] = BIT(data, 2); + m_led[1] = BIT(data, 3); if (m_tms5220.found()) { data = 12 | ((data >> 5) & 1); diff --git a/src/mame/drivers/baraduke.cpp b/src/mame/drivers/baraduke.cpp index ec556cc3f71..c80d9c4635e 100644 --- a/src/mame/drivers/baraduke.cpp +++ b/src/mame/drivers/baraduke.cpp @@ -154,8 +154,8 @@ READ8_MEMBER(baraduke_state::inputport_r) WRITE8_MEMBER(baraduke_state::baraduke_lamps_w) { - output().set_led_value(0,data & 0x08); - output().set_led_value(1,data & 0x10); + m_lamp[0] = BIT(data, 3); + m_lamp[1] = BIT(data, 4); } WRITE8_MEMBER(baraduke_state::baraduke_irq_ack_w) @@ -372,6 +372,11 @@ static GFXDECODE_START( gfx_baraduke ) GFXDECODE_END +void baraduke_state::machine_start() +{ + m_lamp.resolve(); +} + MACHINE_CONFIG_START(baraduke_state::baraduke) diff --git a/src/mame/drivers/barata.cpp b/src/mame/drivers/barata.cpp index 540f8bf6d68..d385371a1ba 100644 --- a/src/mame/drivers/barata.cpp +++ b/src/mame/drivers/barata.cpp @@ -50,7 +50,8 @@ public: : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") , m_digits(*this, "digit%u", 0U) - { } + , m_lamp(*this, "lamp%u", 0U) + { } DECLARE_WRITE8_MEMBER(fpga_w); DECLARE_WRITE8_MEMBER(port0_w); @@ -60,9 +61,10 @@ public: private: unsigned char row_selection; void fpga_send(unsigned char cmd); - virtual void machine_start() override { m_digits.resolve(); } + virtual void machine_start() override { m_digits.resolve(); m_lamp.resolve(); } required_device m_maincpu; output_finder<4> m_digits; + output_finder<16> m_lamp; }; /************************ @@ -204,12 +206,12 @@ void barata_state::fpga_send(unsigned char cmd) { // logerror("LED: ERASE ALL\n"); for (int i=0; i<16; i++){ - output().set_led_value(i, 1); + m_lamp[i] = 1; } } else { - output().set_led_value(lamp_index, state ? 0 : 1); + m_lamp[lamp_index] = state ? 0 : 1; } default: mode = FPGA_WAITING_FOR_NEW_CMD; diff --git a/src/mame/drivers/beta.cpp b/src/mame/drivers/beta.cpp index 8f3420e7133..c13cb63c4b7 100644 --- a/src/mame/drivers/beta.cpp +++ b/src/mame/drivers/beta.cpp @@ -58,7 +58,8 @@ public: m_speaker(*this, "speaker"), m_eprom(*this, EPROM_TAG), m_q(*this, "Q%u", 6U), - m_digit(*this, "digit%u", 0U) + m_digit(*this, "digit%u", 0U), + m_led(*this, "led%u", 0U) { } DECLARE_INPUT_CHANGED_MEMBER( trigger_reset ); @@ -85,6 +86,7 @@ private: required_device m_eprom; required_ioport_array<4> m_q; output_finder<6> m_digit; + output_finder<2> m_led; /* EPROM state */ int m_eprom_oe; @@ -259,10 +261,10 @@ WRITE8_MEMBER( beta_state::riot_pb_w ) m_speaker->level_w(!BIT(data, 4)); /* address led */ - output().set_led_value(0, BIT(data, 5)); + m_led[0] = BIT(data, 5); /* data led */ - output().set_led_value(1, !BIT(data, 5)); + m_led[1] = !BIT(data, 5); /* EPROM address shift */ if (!BIT(m_old_data, 5) && BIT(data, 5)) @@ -315,6 +317,7 @@ DEVICE_IMAGE_UNLOAD_MEMBER( beta_state, beta_eprom ) void beta_state::machine_start() { m_digit.resolve(); + m_led.resolve(); m_led_refresh_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(beta_state::led_refresh),this)); diff --git a/src/mame/drivers/bfm_sc1.cpp b/src/mame/drivers/bfm_sc1.cpp index 2447d72fbbc..ae205d93435 100644 --- a/src/mame/drivers/bfm_sc1.cpp +++ b/src/mame/drivers/bfm_sc1.cpp @@ -127,7 +127,8 @@ public: m_reels(*this, "reel%u", 0U), m_upd7759(*this, "upd"), m_vfd0(*this, "vfd0"), - m_meters(*this, "meters") + m_meters(*this, "meters"), + m_lamp(*this, "lamp%u", 0U) { } void init_toppoker(); @@ -175,6 +176,7 @@ protected: void save_state(); + virtual void machine_start() override { m_lamp.resolve(); } virtual void machine_reset() override; INTERRUPT_GEN_MEMBER(timer_irq); void sc1_common_init(int reels, int decrypt, int defaultbank); @@ -213,6 +215,7 @@ private: optional_device m_upd7759; optional_device m_vfd0; required_device m_meters; + output_finder<256> m_lamp; }; #define VFD_RESET 0x20 @@ -464,17 +467,13 @@ WRITE8_MEMBER(bfm_sc1_state::mux1latch_w) int input_strobe = data & 0x07; if ( !(data & 0x08) ) { // clock changed to low - int strobe, offset, pattern, i; + int strobe = data & 0x07; + int offset = strobe<<4; - strobe = data & 0x07; - offset = strobe<<4; - pattern = 0x01; - - for ( i = 0; i < 8; i++ ) + for ( int i = 0; i < 8; i++ ) { - output().set_lamp_value(BFM_strcnv[offset ], (m_mux1_datalo & pattern?1:0) ); - output().set_lamp_value(BFM_strcnv[offset+8], (m_mux1_datahi & pattern?1:0) ); - pattern<<=1; + m_lamp[BFM_strcnv[offset ]] = BIT(m_mux1_datalo, i); + m_lamp[BFM_strcnv[offset+8]] = BIT(m_mux1_datahi, i); offset++; } @@ -537,17 +536,13 @@ WRITE8_MEMBER(bfm_sc1_state::mux2latch_w) if ( !(data & 0x08) ) { // clock changed to low - int strobe, offset, pattern, i; - - strobe = data & 0x07; - offset = 128+(strobe<<4); - pattern = 0x01; + int strobe = data & 0x07; + int offset = 128+(strobe<<4); - for ( i = 0; i < 8; i++ ) + for ( int i = 0; i < 8; i++ ) { - output().set_lamp_value(BFM_strcnv[offset ], (m_mux2_datalo & pattern?1:0) ); - output().set_lamp_value(BFM_strcnv[offset+8], (m_mux2_datahi & pattern?1:0) ); - pattern<<=1; + m_lamp[BFM_strcnv[offset ]] = BIT(m_mux2_datalo, i); + m_lamp[BFM_strcnv[offset+8]] = BIT(m_mux2_datahi, i); offset++; } } diff --git a/src/mame/drivers/bfm_sc2.cpp b/src/mame/drivers/bfm_sc2.cpp index b3182485d1d..a771abdbae6 100644 --- a/src/mame/drivers/bfm_sc2.cpp +++ b/src/mame/drivers/bfm_sc2.cpp @@ -205,6 +205,7 @@ public: , m_rombank1(*this, "bank1") , m_ym2413(*this, "ymsnd") , m_meters(*this, "meters") + , m_lamp(*this, "lamp%u", 0U) { for (auto &elem : m_lamps_old) elem = 0; @@ -321,6 +322,7 @@ private: int m_e2data_to_read; uint8_t m_codec_data[256]; uint8_t m_lamps_old[0x20]; + output_finder<256> m_lamp; }; @@ -704,11 +706,11 @@ WRITE8_MEMBER(bfm_sc2_state::mux_output_w) for (i = 0; i < 8; i++) { - int oldbit = m_lamps_old[offset] & (1 << i); - int newbit = data & (1 << i); + int oldbit = BIT(m_lamps_old[offset], i); + int newbit = BIT(data, i); if (oldbit != newbit) - output().set_lamp_value(off + i, newbit != 0); + m_lamp[off + i] = newbit; } m_lamps_old[offset] = data; @@ -2268,6 +2270,7 @@ MACHINE_CONFIG_END void bfm_sc2_state::machine_start() { + m_lamp.resolve(); nvram_device *e2ram = subdevice("e2ram"); if (e2ram != nullptr) e2ram->set_base(m_e2ram, sizeof(m_e2ram)); diff --git a/src/mame/drivers/bfmsys85.cpp b/src/mame/drivers/bfmsys85.cpp index e3233e2ca25..72c4170f021 100644 --- a/src/mame/drivers/bfmsys85.cpp +++ b/src/mame/drivers/bfmsys85.cpp @@ -74,7 +74,8 @@ ___________________________________________________________________________ class bfmsys85_state : public driver_device { public: - bfmsys85_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), + bfmsys85_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_vfd(*this, "vfd"), m_maincpu(*this, "maincpu"), m_reel0(*this, "reel0"), @@ -82,28 +83,14 @@ public: m_reel2(*this, "reel2"), m_reel3(*this, "reel3"), m_acia6850_0(*this, "acia6850_0"), - m_meters(*this, "meters") - { - } + m_meters(*this, "meters"), + m_lamp(*this, "lamp%u", 0U) + { } - int m_mmtr_latch; - int m_triac_latch; - int m_alpha_clock; - int m_irq_status; - 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; } - int m_locked; - int m_is_timer_enabled; - int m_coin_inhibits; - int m_mux_output_strobe; - int m_mux_input_strobe; - int m_mux_input; - uint8_t m_Inputs[64]; - uint8_t m_codec_data[256]; - uint8_t m_sys85_data_line_t; DECLARE_WRITE8_MEMBER(watchdog_w); DECLARE_READ8_MEMBER(irqlatch_r); DECLARE_WRITE8_MEMBER(reel12_w); @@ -122,10 +109,29 @@ public: DECLARE_WRITE_LINE_MEMBER(write_acia_clock); void init_decode(); void init_nodecode(); + INTERRUPT_GEN_MEMBER(timer_irq); + int b85_find_project_string(); + void bfmsys85(machine_config &config); + void memmap(address_map &map); + +protected: virtual void machine_start() override; virtual void machine_reset() override; - INTERRUPT_GEN_MEMBER(timer_irq); - int b85_find_project_string( ); + + int m_mmtr_latch; + int m_triac_latch; + int m_alpha_clock; + int m_irq_status; + int m_optic_pattern; + int m_locked; + int m_is_timer_enabled; + int m_coin_inhibits; + int m_mux_output_strobe; + int m_mux_input_strobe; + int m_mux_input; + uint8_t m_Inputs[64]; + uint8_t m_codec_data[256]; + uint8_t m_sys85_data_line_t; optional_device m_vfd; required_device m_maincpu; required_device m_reel0; @@ -134,8 +140,7 @@ public: required_device m_reel3; required_device m_acia6850_0; required_device m_meters; - void bfmsys85(machine_config &config); - void memmap(address_map &map); + output_finder<256> m_lamp; }; #define MASTER_CLOCK (XTAL(4'000'000)) @@ -310,13 +315,11 @@ READ8_MEMBER(bfmsys85_state::mux_ctrl_r) WRITE8_MEMBER(bfmsys85_state::mux_data_w) { - int pattern = 0x01, i, - off = m_mux_output_strobe<<4; + int off = m_mux_output_strobe<<4; - for ( i = 0; i < 8; i++ ) + for (int i = 0; i < 8; i++ ) { - output().set_lamp_value(off, (data & pattern ? 1 : 0)); - pattern <<= 1; + m_lamp[off] = BIT(data, i); off++; } } @@ -352,6 +355,7 @@ READ8_MEMBER(bfmsys85_state::triac_r) void bfmsys85_state::machine_start() { + m_lamp.resolve(); } // memory map for bellfruit system85 board //////////////////////////////// diff --git a/src/mame/drivers/big10.cpp b/src/mame/drivers/big10.cpp index b9b356e74f7..3f5bccf8add 100644 --- a/src/mame/drivers/big10.cpp +++ b/src/mame/drivers/big10.cpp @@ -73,11 +73,13 @@ public: , m_maincpu(*this, "maincpu") , m_hopper(*this, "hopper") , m_in(*this, "IN%u", 1) + , m_lamp(*this, "lamp") { } void big10(machine_config &config); protected: + virtual void machine_start() override { m_lamp.resolve(); } void main_io(address_map &map); void main_map(address_map &map); @@ -90,6 +92,7 @@ private: required_device m_maincpu; required_device m_hopper; required_ioport_array<6> m_in; + output_finder<> m_lamp; }; @@ -106,7 +109,7 @@ WRITE8_MEMBER(big10_state::mux_w) { m_mux_data = ~data; m_hopper->motor_w(BIT(data, 6)); - machine().output().set_lamp_value(1, BIT(~data, 7)); // maybe a coin counter? + m_lamp = BIT(~data, 7); // maybe a coin counter? } READ8_MEMBER(big10_state::mux_r) diff --git a/src/mame/drivers/bladestl.cpp b/src/mame/drivers/bladestl.cpp index de4b2bcbca7..7f1dbbae00e 100644 --- a/src/mame/drivers/bladestl.cpp +++ b/src/mame/drivers/bladestl.cpp @@ -73,8 +73,8 @@ WRITE8_MEMBER(bladestl_state::bladestl_bankswitch_w) machine().bookkeeping().coin_counter_w(1,data & 0x02); /* bits 2 & 3 = lamps */ - output().set_led_value(0,data & 0x04); - output().set_led_value(1,data & 0x08); + m_lamp[0] = BIT(data, 2); + m_lamp[1] = BIT(data, 3); /* bit 4 = relay (???) */ @@ -285,6 +285,7 @@ GFXDECODE_END void bladestl_state::machine_start() { m_rombank->configure_entries(0, 4, memregion("maincpu")->base(), 0x2000); + m_lamp.resolve(); save_item(NAME(m_spritebank)); save_item(NAME(m_last_track)); diff --git a/src/mame/drivers/blitz68k.cpp b/src/mame/drivers/blitz68k.cpp index 892a1eb07d3..90d58cc85da 100644 --- a/src/mame/drivers/blitz68k.cpp +++ b/src/mame/drivers/blitz68k.cpp @@ -59,35 +59,24 @@ class blitz68k_state : public driver_device { public: blitz68k_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_nvram(*this, "nvram"), - m_frame_buffer(*this, "frame_buffer"), - m_blit_romaddr(*this, "blit_romaddr"), - m_blit_attr1_ram(*this, "blit_attr1_ram"), - m_blit_dst_ram_loword(*this, "blitram_loword"), - m_blit_attr2_ram(*this, "blit_attr2_ram"), - m_blit_dst_ram_hiword(*this, "blitram_hiword"), - m_blit_vregs(*this, "blit_vregs"), - m_blit_transpen(*this, "blit_transpen"), - m_leds0(*this, "leds0"), - m_leds1(*this, "leds1"), - m_leds2(*this, "leds2") , - m_maincpu(*this, "maincpu"), - m_palette(*this, "palette") { } + : driver_device(mconfig, type, tag) + , m_nvram(*this, "nvram") + , m_frame_buffer(*this, "frame_buffer") + , m_blit_romaddr(*this, "blit_romaddr") + , m_blit_attr1_ram(*this, "blit_attr1_ram") + , m_blit_dst_ram_loword(*this, "blitram_loword") + , m_blit_attr2_ram(*this, "blit_attr2_ram") + , m_blit_dst_ram_hiword(*this, "blitram_hiword") + , m_blit_vregs(*this, "blit_vregs") + , m_blit_transpen(*this, "blit_transpen") + , m_leds0(*this, "leds0") + , m_leds1(*this, "leds1") + , m_leds2(*this, "leds2") + , m_maincpu(*this, "maincpu") + , m_palette(*this, "palette") + , m_led(*this, "led%u", 0U) + { } - optional_shared_ptr m_nvram; - std::unique_ptr m_blit_buffer; - optional_shared_ptr m_frame_buffer; - optional_shared_ptr m_blit_romaddr; - optional_shared_ptr m_blit_attr1_ram; - optional_shared_ptr m_blit_dst_ram_loword; - optional_shared_ptr m_blit_attr2_ram; - optional_shared_ptr m_blit_dst_ram_hiword; - optional_shared_ptr m_blit_vregs; - optional_shared_ptr m_blit_transpen; - optional_shared_ptr m_leds0; - optional_shared_ptr m_leds1; - optional_shared_ptr m_leds2; DECLARE_WRITE16_MEMBER(blit_copy_w); DECLARE_READ8_MEMBER(blit_status_r); DECLARE_WRITE8_MEMBER(blit_x_w); @@ -182,8 +171,6 @@ public: uint32_t screen_update_blitz68k_noblit(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); TIMER_DEVICE_CALLBACK_MEMBER(steaser_mcu_sim); MC6845_ON_UPDATE_ADDR_CHANGED(crtc_addr); - required_device m_maincpu; - required_device m_palette; void hermit(machine_config &config); void bankrob(machine_config &config); void cjffruit(machine_config &config); @@ -203,6 +190,26 @@ public: void maxidbl_map(address_map &map); void ramdac_map(address_map &map); void steaser_map(address_map &map); + +protected: + virtual void machine_start() override { m_led.resolve(); } + + optional_shared_ptr m_nvram; + std::unique_ptr m_blit_buffer; + optional_shared_ptr m_frame_buffer; + optional_shared_ptr m_blit_romaddr; + optional_shared_ptr m_blit_attr1_ram; + optional_shared_ptr m_blit_dst_ram_loword; + optional_shared_ptr m_blit_attr2_ram; + optional_shared_ptr m_blit_dst_ram_hiword; + optional_shared_ptr m_blit_vregs; + optional_shared_ptr m_blit_transpen; + optional_shared_ptr m_leds0; + optional_shared_ptr m_leds1; + optional_shared_ptr m_leds2; + required_device m_maincpu; + required_device m_palette; + output_finder<17> m_led; }; /************************************************************************************************************* @@ -869,13 +876,13 @@ WRITE16_MEMBER(blitz68k_state::cjffruit_leds1_w) if (ACCESSING_BITS_8_15) { machine().bookkeeping().coin_counter_w(0, data & 0x0100); // coin in - output().set_led_value(0, data & 0x0200); // win??? + m_led[0] = BIT(data, 9); // win??? // 1 data & 0x0400 // win??? - output().set_led_value(2, data & 0x0800); // small - output().set_led_value(3, data & 0x1000); // big - output().set_led_value(4, data & 0x2000); // take - output().set_led_value(5, data & 0x4000); // double up - output().set_led_value(6, data & 0x8000); // cancel + m_led[2] = BIT(data, 11); // small + m_led[3] = BIT(data, 12); // big + m_led[4] = BIT(data, 13); // take + m_led[5] = BIT(data, 14); // double up + m_led[6] = BIT(data, 15); // cancel show_leds123(); } } @@ -885,14 +892,14 @@ WRITE16_MEMBER(blitz68k_state::cjffruit_leds2_w) data = COMBINE_DATA(m_leds1); if (ACCESSING_BITS_8_15) { - output().set_led_value( 7, data & 0x0100); // start - output().set_led_value( 8, data & 0x0200); // bet - output().set_led_value( 9, data & 0x0400); // hold 5 - output().set_led_value(10, data & 0x0800); // hold 4 - output().set_led_value(11, data & 0x1000); // hold 3 - output().set_led_value(12, data & 0x2000); // hold 2 - output().set_led_value(13, data & 0x4000); // collect - output().set_led_value(14, data & 0x8000); // call attendant + m_led[ 7] = BIT(data, 8); // start + m_led[ 8] = BIT(data, 9); // bet + m_led[ 9] = BIT(data, 10); // hold 5 + m_led[10] = BIT(data, 11); // hold 4 + m_led[11] = BIT(data, 12); // hold 3 + m_led[12] = BIT(data, 13); // hold 2 + m_led[13] = BIT(data, 14); // collect + m_led[14] = BIT(data, 15); // call attendant show_leds123(); } } @@ -902,8 +909,8 @@ WRITE16_MEMBER(blitz68k_state::cjffruit_leds3_w) data = COMBINE_DATA(m_leds2); if (ACCESSING_BITS_8_15) { - output().set_led_value(15, data & 0x0100); // hopper coins? - output().set_led_value(16, data & 0x0400); // coin out? + m_led[15] = BIT(data, 8); // hopper coins? + m_led[16] = BIT(data, 10); // coin out? show_leds123(); } } @@ -1010,13 +1017,13 @@ WRITE16_MEMBER(blitz68k_state::deucesw2_leds1_w) if (ACCESSING_BITS_8_15) { machine().bookkeeping().coin_counter_w(0, data & 0x0100); // coin in - output().set_led_value(0, data & 0x0200); // win??? + m_led[0] = BIT(data, 9); // win??? // 1 data & 0x0400 // win??? - output().set_led_value(2, data & 0x0800); // small - output().set_led_value(3, data & 0x1000); // big - output().set_led_value(4, data & 0x2000); // take - output().set_led_value(5, data & 0x4000); // double up - output().set_led_value(6, data & 0x8000); // cancel + m_led[2] = BIT(data, 11); // small + m_led[3] = BIT(data, 12); // big + m_led[4] = BIT(data, 13); // take + m_led[5] = BIT(data, 14); // double up + m_led[6] = BIT(data, 15); // cancel show_leds123(); } } @@ -1026,14 +1033,14 @@ WRITE16_MEMBER(blitz68k_state::deucesw2_leds2_w) data = COMBINE_DATA(m_leds1); if (ACCESSING_BITS_8_15) { - output().set_led_value( 7, data & 0x0100); // start - output().set_led_value( 8, data & 0x0200); // bet - output().set_led_value( 9, data & 0x0400); // hold 5 - output().set_led_value(10, data & 0x0800); // hold 4 - output().set_led_value(11, data & 0x1000); // hold 3 - output().set_led_value(12, data & 0x2000); // hold 2 - output().set_led_value(13, data & 0x4000); // hold 1 - output().set_led_value(14, data & 0x8000); // call attendant + m_led[ 7] = BIT(data, 8); // start + m_led[ 8] = BIT(data, 9); // bet + m_led[ 9] = BIT(data, 10); // hold 5 + m_led[10] = BIT(data, 11); // hold 4 + m_led[11] = BIT(data, 12); // hold 3 + m_led[12] = BIT(data, 13); // hold 2 + m_led[13] = BIT(data, 14); // hold 1 + m_led[14] = BIT(data, 15); // call attendant show_leds123(); } } @@ -1043,8 +1050,8 @@ WRITE16_MEMBER(blitz68k_state::deucesw2_leds3_w) data = COMBINE_DATA(m_leds2); if (ACCESSING_BITS_8_15) { - output().set_led_value(15, data & 0x0100); // hopper coins? - output().set_led_value(16, data & 0x0400); // coin out? + m_led[15] = BIT(data, 8); // hopper coins? + m_led[16] = BIT(data, 10); // coin out? show_leds123(); } } @@ -1211,7 +1218,7 @@ WRITE16_MEMBER(blitz68k_state::hermit_leds2_w) data = COMBINE_DATA(m_leds1); if (ACCESSING_BITS_8_15) { - output().set_led_value( 7, data & 0x0100); // button + m_led[7] = BIT(data, 8); // button show_leds12(); } } diff --git a/src/mame/drivers/boxer.cpp b/src/mame/drivers/boxer.cpp index f03a24a3337..e51fb80db8e 100644 --- a/src/mame/drivers/boxer.cpp +++ b/src/mame/drivers/boxer.cpp @@ -39,7 +39,9 @@ public: m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), - m_palette(*this, "palette"){ } + m_palette(*this, "palette"), + m_led(*this, "led%u", 0U) + { } void boxer(machine_config &config); @@ -80,6 +82,7 @@ private: required_device m_gfxdecode; required_device m_screen; required_device m_palette; + output_finder<2> m_led; }; /************************************* @@ -330,8 +333,8 @@ WRITE8_MEMBER(boxer_state::crowd_w) WRITE8_MEMBER(boxer_state::led_w) { - output().set_led_value(1, !(data & 1)); - output().set_led_value(0, !(data & 2)); + m_led[1] = BIT(~data, 0); + m_led[0] = BIT(~data, 1); } @@ -470,6 +473,7 @@ GFXDECODE_END void boxer_state::machine_start() { + m_led.resolve(); m_pot_interrupt = timer_alloc(TIMER_POT_INTERRUPT); m_periodic_timer = timer_alloc(TIMER_PERIODIC); diff --git a/src/mame/drivers/bw12.cpp b/src/mame/drivers/bw12.cpp index d94e3ea7f1e..480a23ba66b 100644 --- a/src/mame/drivers/bw12.cpp +++ b/src/mame/drivers/bw12.cpp @@ -129,7 +129,7 @@ void bw12_state::ls259_w(int address, int data) break; case 4: /* CAP LOCK */ - output().set_led_value(0, data); + m_led = data ? 1 : 0; break; case 5: /* MOTOR 0 */ @@ -479,6 +479,8 @@ WRITE_LINE_MEMBER( bw12_state::ay3600_data_ready_w ) void bw12_state::machine_start() { + m_led.resolve(); + /* setup memory banking */ membank("bank1")->configure_entry(0, m_rom->base()); membank("bank1")->configure_entry(1, m_ram->pointer()); diff --git a/src/mame/drivers/bwidow.cpp b/src/mame/drivers/bwidow.cpp index 1e017da6c55..79233cb4191 100644 --- a/src/mame/drivers/bwidow.cpp +++ b/src/mame/drivers/bwidow.cpp @@ -336,8 +336,8 @@ WRITE8_MEMBER(bwidow_state::bwidow_misc_w) */ if (data == m_lastdata) return; - output().set_led_value(0,~data & 0x10); - output().set_led_value(1,~data & 0x20); + m_led[0] = BIT(~data, 4); + m_led[1] = BIT(~data, 5); machine().bookkeeping().coin_counter_w(0, data & 0x01); machine().bookkeeping().coin_counter_w(1, data & 0x02); m_lastdata = data; @@ -346,8 +346,8 @@ WRITE8_MEMBER(bwidow_state::bwidow_misc_w) WRITE8_MEMBER(bwidow_state::spacduel_coin_counter_w) { if (data == m_lastdata) return; - output().set_led_value(0, !BIT(data,5)); // start lamp - output().set_led_value(1, !BIT(data,4)); // select lamp + m_led[0] = BIT(~data, 5); // start lamp + m_led[1] = BIT(~data, 4); // select lamp machine().bookkeeping().coin_lockout_w(0, !BIT(data,3)); machine().bookkeeping().coin_lockout_w(1, !BIT(data,3)); machine().bookkeeping().coin_lockout_w(2, !BIT(data,3)); diff --git a/src/mame/drivers/cabaret.cpp b/src/mame/drivers/cabaret.cpp index d03e1eda02b..ab45d2e3abe 100644 --- a/src/mame/drivers/cabaret.cpp +++ b/src/mame/drivers/cabaret.cpp @@ -35,23 +35,17 @@ class cabaret_state : public driver_device { public: cabaret_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_fg_tile_ram(*this, "fg_tile_ram"), - m_fg_color_ram(*this, "fg_color_ram"), - m_bg_scroll(*this, "bg_scroll"), - m_bg_tile_ram(*this, "bg_tile_ram"), - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + : driver_device(mconfig, type, tag) + , m_fg_tile_ram(*this, "fg_tile_ram") + , m_fg_color_ram(*this, "fg_color_ram") + , m_bg_scroll(*this, "bg_scroll") + , m_bg_tile_ram(*this, "bg_tile_ram") + , m_maincpu(*this, "maincpu") + , m_gfxdecode(*this, "gfxdecode") + , m_palette(*this, "palette") + , m_led(*this, "led6") + { } - required_shared_ptr m_fg_tile_ram; - required_shared_ptr m_fg_color_ram; - required_shared_ptr m_bg_scroll; - required_shared_ptr m_bg_tile_ram; - tilemap_t *m_bg_tilemap; - tilemap_t *m_fg_tilemap; - int m_nmi_enable; - uint8_t m_out[3]; DECLARE_WRITE8_MEMBER(bg_scroll_w); DECLARE_WRITE8_MEMBER(bg_tile_w); DECLARE_WRITE8_MEMBER(fg_tile_w); @@ -63,16 +57,29 @@ public: void init_cabaret(); TILE_GET_INFO_MEMBER(get_bg_tile_info); TILE_GET_INFO_MEMBER(get_fg_tile_info); - virtual void machine_reset() override; - virtual void video_start() override; uint32_t screen_update_cabaret(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(cabaret_interrupt); - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_palette; void cabaret(machine_config &config); void cabaret_map(address_map &map); void cabaret_portmap(address_map &map); + +protected: + virtual void machine_start() override { m_led.resolve(); } + virtual void machine_reset() override; + virtual void video_start() override; + + required_shared_ptr m_fg_tile_ram; + required_shared_ptr m_fg_color_ram; + required_shared_ptr m_bg_scroll; + required_shared_ptr m_bg_tile_ram; + tilemap_t *m_bg_tilemap; + tilemap_t *m_fg_tilemap; + int m_nmi_enable; + uint8_t m_out[3]; + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_palette; + output_finder<> m_led; }; @@ -167,7 +174,7 @@ WRITE8_MEMBER(cabaret_state::nmi_and_coins_w) machine().bookkeeping().coin_counter_w(2, data & 0x08); // key in machine().bookkeeping().coin_counter_w(3, data & 0x10); // coin m_out mech - output().set_led_value(6, data & 0x40); // led for coin m_out / hopper active + m_led = BIT(data, 6); // led for coin m_out / hopper active m_nmi_enable = data; // data & 0x80 // nmi enable? diff --git a/src/mame/drivers/calomega.cpp b/src/mame/drivers/calomega.cpp index 0b1b747e70d..f13d80049bd 100644 --- a/src/mame/drivers/calomega.cpp +++ b/src/mame/drivers/calomega.cpp @@ -788,33 +788,33 @@ WRITE8_MEMBER(calomega_state::pia1_bout_w) WRITE8_MEMBER(calomega_state::lamps_903a_w) { /* First 5 bits of PIA0 port B */ - output().set_lamp_value(1, 1-((data) & 1)); /* L1 (Hold 1) */ - output().set_lamp_value(2, 1-((data >> 1) & 1)); /* L2 (Hold 2) */ - output().set_lamp_value(3, 1-((data >> 2) & 1)); /* L3 (Hold 3) */ - output().set_lamp_value(4, 1-((data >> 3) & 1)); /* L4 (Hold 4) */ - output().set_lamp_value(5, 1-((data >> 4) & 1)); /* L5 (Hold 5) */ + m_lamp[1] = BIT(~data, 0); /* L1 (Hold 1) */ + m_lamp[2] = BIT(~data, 1); /* L2 (Hold 2) */ + m_lamp[3] = BIT(~data, 2); /* L3 (Hold 3) */ + m_lamp[4] = BIT(~data, 3); /* L4 (Hold 4) */ + m_lamp[5] = BIT(~data, 4); /* L5 (Hold 5) */ } WRITE8_MEMBER(calomega_state::lamps_903b_w) { /* First 4 bits of PIA1 port A */ - output().set_lamp_value(6, 1-((data) & 1)); /* L6 (Cancel) */ - output().set_lamp_value(7, 1-((data >> 1) & 1)); /* L7 (Bet) */ - output().set_lamp_value(8, 1-((data >> 2) & 1)); /* L8 (Take) */ - output().set_lamp_value(9, 1-((data >> 3) & 1)); /* L9 (Door?) */ + m_lamp[6] = BIT(~data, 0); /* L6 (Cancel) */ + m_lamp[7] = BIT(~data, 1); /* L7 (Bet) */ + m_lamp[8] = BIT(~data, 2); /* L8 (Take) */ + m_lamp[9] = BIT(~data, 3); /* L9 (Door?) */ } WRITE8_MEMBER(calomega_state::lamps_905_w) { /* Whole 8 bits of PIA0 port B */ - output().set_lamp_value(1, 1-((data) & 1)); /* L1 (Hold 1) */ - output().set_lamp_value(2, 1-((data >> 1) & 1)); /* L2 (Hold 2) */ - output().set_lamp_value(3, 1-((data >> 2) & 1)); /* L3 (Hold 3) */ - output().set_lamp_value(4, 1-((data >> 3) & 1)); /* L4 (Hold 4) */ - output().set_lamp_value(5, 1-((data >> 4) & 1)); /* L5 (Hold 5) */ - output().set_lamp_value(6, 1-((data >> 5) & 1)); /* L6 (unknown) */ - output().set_lamp_value(7, 1-((data >> 6) & 1)); /* L7 (unknown) */ - output().set_lamp_value(8, 1-((data >> 7) & 1)); /* L8 (unknown) */ + m_lamp[1] = BIT(~data, 0); /* L1 (Hold 1) */ + m_lamp[2] = BIT(~data, 1); /* L2 (Hold 2) */ + m_lamp[3] = BIT(~data, 2); /* L3 (Hold 3) */ + m_lamp[4] = BIT(~data, 3); /* L4 (Hold 4) */ + m_lamp[5] = BIT(~data, 4); /* L5 (Hold 5) */ + m_lamp[6] = BIT(~data, 5); /* L6 (unknown) */ + m_lamp[7] = BIT(~data, 6); /* L7 (unknown) */ + m_lamp[8] = BIT(~data, 7); /* L8 (unknown) */ } diff --git a/src/mame/drivers/cardline.cpp b/src/mame/drivers/cardline.cpp index 848ca3213de..cf2f77bec83 100644 --- a/src/mame/drivers/cardline.cpp +++ b/src/mame/drivers/cardline.cpp @@ -36,22 +36,17 @@ class cardline_state : public driver_device { public: - cardline_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + cardline_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_videoram(*this, "videoram"), m_colorram(*this, "colorram"), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), - m_screen(*this, "screen") + m_screen(*this, "screen"), + m_lamp(*this, "lamp%u", 0U) { } - required_shared_ptr m_videoram; - required_shared_ptr m_colorram; - - uint8_t m_video; - uint8_t m_hsync_q; - DECLARE_WRITE8_MEMBER(vram_w); DECLARE_WRITE8_MEMBER(attr_w); DECLARE_WRITE8_MEMBER(video_w); @@ -64,24 +59,34 @@ public: DECLARE_PALETTE_INIT(cardline); - virtual void machine_start() override; - DECLARE_WRITE_LINE_MEMBER(hsync_changed); DECLARE_WRITE_LINE_MEMBER(vsync_changed); MC6845_BEGIN_UPDATE(crtc_begin_update); MC6845_UPDATE_ROW(crtc_update_row); + void cardline(machine_config &config); + void mem_io(address_map &map); + void mem_prg(address_map &map); + +protected: + virtual void machine_start() override; + + required_shared_ptr m_videoram; + required_shared_ptr m_colorram; + + uint8_t m_video; + uint8_t m_hsync_q; + required_device m_maincpu; required_device m_gfxdecode; required_device m_palette; required_device m_screen; - void cardline(machine_config &config); - void mem_io(address_map &map); - void mem_prg(address_map &map); + output_finder<8> m_lamp; }; void cardline_state::machine_start() { + m_lamp.resolve(); m_video = 0; m_hsync_q = 1; for (int i=0; i < 0x2000; i++) @@ -202,14 +207,14 @@ READ8_MEMBER(cardline_state::hsync_r) WRITE8_MEMBER(cardline_state::lamps_w) { /* button lamps 1-8 (collect, card 1-5, bet, start) */ - output().set_lamp_value(5,(data >> 0) & 1); - output().set_lamp_value(0,(data >> 1) & 1); - output().set_lamp_value(1,(data >> 2) & 1); - output().set_lamp_value(2,(data >> 3) & 1); - output().set_lamp_value(3,(data >> 4) & 1); - output().set_lamp_value(4,(data >> 5) & 1); - output().set_lamp_value(6,(data >> 6) & 1); - output().set_lamp_value(7,(data >> 7) & 1); + m_lamp[5] = BIT(data, 0); + m_lamp[0] = BIT(data, 1); + m_lamp[1] = BIT(data, 2); + m_lamp[2] = BIT(data, 3); + m_lamp[3] = BIT(data, 4); + m_lamp[4] = BIT(data, 5); + m_lamp[6] = BIT(data, 6); + m_lamp[7] = BIT(data, 7); } void cardline_state::mem_prg(address_map &map) diff --git a/src/mame/drivers/cave.cpp b/src/mame/drivers/cave.cpp index 653034015b0..ee65013e286 100644 --- a/src/mame/drivers/cave.cpp +++ b/src/mame/drivers/cave.cpp @@ -700,10 +700,10 @@ WRITE16_MEMBER(cave_state::korokoro_leds_w) { COMBINE_DATA(&m_leds[0]); - output().set_led_value(0, data & 0x8000); - output().set_led_value(1, data & 0x4000); - output().set_led_value(2, data & 0x1000); // square button - output().set_led_value(3, data & 0x0800); // round button + m_led[0] = BIT(data, 15); + m_led[1] = BIT(data, 14); + m_led[2] = BIT(data, 12); // square button + m_led[3] = BIT(data, 11); // round button // machine().bookkeeping().coin_lockout_w(1, ~data & 0x0200); // coin lockouts? // machine().bookkeeping().coin_lockout_w(0, ~data & 0x0100); @@ -711,10 +711,10 @@ WRITE16_MEMBER(cave_state::korokoro_leds_w) // machine().bookkeeping().coin_counter_w(1, data & 0x0020); machine().bookkeeping().coin_counter_w(0, data & 0x0010); - output().set_led_value(5, data & 0x0008); - output().set_led_value(6, data & 0x0004); - output().set_led_value(7, data & 0x0002); - output().set_led_value(8, data & 0x0001); + m_led[5] = BIT(data, 3); + m_led[6] = BIT(data, 2); + m_led[7] = BIT(data, 1); + m_led[8] = BIT(data, 0); show_leds(); } @@ -907,17 +907,17 @@ WRITE16_MEMBER(cave_state::ppsatan_out_w) { machine().bookkeeping().coin_counter_w(0, data & 0x0001); - output().set_led_value(0, data & 0x0010); - output().set_led_value(1, data & 0x0020); - output().set_led_value(2, data & 0x0040); - output().set_led_value(3, data & 0x0080); + m_led[0] = BIT(data, 4); + m_led[1] = BIT(data, 5); + m_led[2] = BIT(data, 6); + m_led[3] = BIT(data, 7); } if (ACCESSING_BITS_8_15) { - output().set_led_value(4, data & 0x0100); - output().set_led_value(5, data & 0x0200); - output().set_led_value(6, data & 0x0400); // not tested in service mode - output().set_led_value(7, data & 0x0800); // not tested in service mode + m_led[4] = BIT(data, 8); + m_led[5] = BIT(data, 9); + m_led[6] = BIT(data, 10); // not tested in service mode + m_led[7] = BIT(data, 11); // not tested in service mode m_oki[0]->set_rom_bank((data & 0x8000) >> 15); } @@ -1133,14 +1133,14 @@ WRITE16_MEMBER(cave_state::tjumpman_leds_w) { if (ACCESSING_BITS_0_7) { - output().set_led_value(0, data & 0x0001); // suru - output().set_led_value(1, data & 0x0002); // shinai - output().set_led_value(2, data & 0x0004); // payout - output().set_led_value(3, data & 0x0008); // go - output().set_led_value(4, data & 0x0010); // 1 bet - output().set_led_value(5, data & 0x0020); // medal - m_hopper = data & 0x0040; // hopper - output().set_led_value(6, data & 0x0080); // 3 bet + m_led[0] = BIT(data, 0); // suru + m_led[1] = BIT(data, 1); // shinai + m_led[2] = BIT(data, 2); // payout + m_led[3] = BIT(data, 3); // go + m_led[4] = BIT(data, 4); // 1 bet + m_led[5] = BIT(data, 5); // medal + m_hopper = BIT(data, 6); // hopper + m_led[6] = BIT(data, 7); // 3 bet } // popmessage("led %04X", data); @@ -1179,13 +1179,13 @@ WRITE16_MEMBER(cave_state::pacslot_leds_w) { if (ACCESSING_BITS_0_7) { - output().set_led_value(0, data & 0x0001); // pac-man - output().set_led_value(1, data & 0x0002); // ms. pac-man - output().set_led_value(2, data & 0x0004); // payout - output().set_led_value(3, data & 0x0008); // start - output().set_led_value(4, data & 0x0010); // bet - output().set_led_value(5, data & 0x0020); // medal - m_hopper = data & 0x0040; // hopper + m_led[0] = data & 0x0001; // pac-man + m_led[1] = data & 0x0002; // ms. pac-man + m_led[2] = data & 0x0004; // payout + m_led[3] = data & 0x0008; // start + m_led[4] = data & 0x0010; // bet + m_led[5] = data & 0x0020; // medal + m_hopper = data & 0x0040; // hopper } // popmessage("led %04X", data); @@ -2062,8 +2062,9 @@ GFXDECODE_END ***************************************************************************/ -MACHINE_START_MEMBER(cave_state,cave) +void cave_state::machine_start() { + m_led.resolve(); m_vblank_end_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cave_state::cave_vblank_end), this)); save_item(NAME(m_soundbuf_wptr)); @@ -2101,7 +2102,6 @@ MACHINE_CONFIG_START(cave_state::dfeveron) MCFG_DEVICE_PROGRAM_MAP(dfeveron_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", cave_state, cave_interrupt) - MCFG_MACHINE_START_OVERRIDE(cave_state,cave) MCFG_MACHINE_RESET_OVERRIDE(cave_state,cave) MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") @@ -2142,7 +2142,6 @@ MACHINE_CONFIG_START(cave_state::ddonpach) MCFG_DEVICE_PROGRAM_MAP(ddonpach_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", cave_state, cave_interrupt) - MCFG_MACHINE_START_OVERRIDE(cave_state,cave) MCFG_MACHINE_RESET_OVERRIDE(cave_state,cave) MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") @@ -2182,7 +2181,6 @@ MACHINE_CONFIG_START(cave_state::donpachi) MCFG_DEVICE_PROGRAM_MAP(donpachi_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", cave_state, cave_interrupt) - MCFG_MACHINE_START_OVERRIDE(cave_state,cave) MCFG_MACHINE_RESET_OVERRIDE(cave_state,cave) MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") @@ -2229,7 +2227,6 @@ MACHINE_CONFIG_START(cave_state::esprade) MCFG_DEVICE_PROGRAM_MAP(esprade_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", cave_state, cave_interrupt) - MCFG_MACHINE_START_OVERRIDE(cave_state,cave) MCFG_MACHINE_RESET_OVERRIDE(cave_state,cave) MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") @@ -2269,7 +2266,6 @@ MACHINE_CONFIG_START(cave_state::gaia) MCFG_DEVICE_PROGRAM_MAP(gaia_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", cave_state, cave_interrupt) - MCFG_MACHINE_START_OVERRIDE(cave_state,cave) MCFG_MACHINE_RESET_OVERRIDE(cave_state,cave) MCFG_TIMER_DRIVER_ADD("int_timer", cave_state, cave_vblank_start) @@ -2310,7 +2306,6 @@ MACHINE_CONFIG_START(cave_state::guwange) MCFG_DEVICE_PROGRAM_MAP(guwange_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", cave_state, cave_interrupt) - MCFG_MACHINE_START_OVERRIDE(cave_state,cave) MCFG_MACHINE_RESET_OVERRIDE(cave_state,cave) MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") @@ -2353,7 +2348,6 @@ MACHINE_CONFIG_START(cave_state::hotdogst) MCFG_DEVICE_PROGRAM_MAP(hotdogst_sound_map) MCFG_DEVICE_IO_MAP(hotdogst_sound_portmap) - MCFG_MACHINE_START_OVERRIDE(cave_state,cave) MCFG_MACHINE_RESET_OVERRIDE(cave_state,cave) MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") @@ -2403,7 +2397,6 @@ MACHINE_CONFIG_START(cave_state::korokoro) MCFG_DEVICE_PROGRAM_MAP(korokoro_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", cave_state, cave_interrupt) - MCFG_MACHINE_START_OVERRIDE(cave_state,cave) MCFG_MACHINE_RESET_OVERRIDE(cave_state,cave) MCFG_EEPROM_SERIAL_93C46_8BIT_ADD("eeprom") @@ -2456,7 +2449,6 @@ MACHINE_CONFIG_START(cave_state::mazinger) MCFG_WATCHDOG_ADD("watchdog") MCFG_WATCHDOG_TIME_INIT(attotime::from_seconds(3)) /* a guess, and certainly wrong */ - MCFG_MACHINE_START_OVERRIDE(cave_state,cave) MCFG_MACHINE_RESET_OVERRIDE(cave_state,cave) MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") @@ -2513,7 +2505,6 @@ MACHINE_CONFIG_START(cave_state::metmqstr) MCFG_WATCHDOG_ADD("watchdog") MCFG_WATCHDOG_TIME_INIT(attotime::from_seconds(3)) /* a guess, and certainly wrong */ - MCFG_MACHINE_START_OVERRIDE(cave_state,cave) MCFG_MACHINE_RESET_OVERRIDE(cave_state,cave) /* start with the watchdog armed */ MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") @@ -2569,7 +2560,6 @@ MACHINE_CONFIG_START(cave_state::pacslot) MCFG_WATCHDOG_ADD("watchdog") MCFG_WATCHDOG_TIME_INIT(attotime::from_seconds(3)) /* a guess, and certainly wrong */ - MCFG_MACHINE_START_OVERRIDE(cave_state,cave) MCFG_MACHINE_RESET_OVERRIDE(cave_state,cave) MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") @@ -2629,7 +2619,6 @@ MACHINE_CONFIG_START(cave_state::ppsatan) MCFG_WATCHDOG_ADD("watchdog") MCFG_WATCHDOG_TIME_INIT(attotime::from_seconds(1)) /* a guess, and certainly wrong */ - MCFG_MACHINE_START_OVERRIDE(cave_state,cave) MCFG_MACHINE_RESET_OVERRIDE(cave_state,cave) MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") @@ -2694,7 +2683,6 @@ MACHINE_CONFIG_START(cave_state::pwrinst2) MCFG_DEVICE_PROGRAM_MAP(pwrinst2_sound_map) MCFG_DEVICE_IO_MAP(pwrinst2_sound_portmap) - MCFG_MACHINE_START_OVERRIDE(cave_state,cave) MCFG_MACHINE_RESET_OVERRIDE(cave_state,cave) MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") @@ -2771,7 +2759,6 @@ MACHINE_CONFIG_START(cave_state::sailormn) // MCFG_QUANTUM_TIME(attotime::from_hz(600)) - MCFG_MACHINE_START_OVERRIDE(cave_state,cave) MCFG_MACHINE_RESET_OVERRIDE(cave_state,sailormn) MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") @@ -2829,7 +2816,6 @@ MACHINE_CONFIG_START(cave_state::tekkencw) MCFG_WATCHDOG_ADD("watchdog") MCFG_WATCHDOG_TIME_INIT(attotime::from_seconds(3)) /* a guess, and certainly wrong */ - MCFG_MACHINE_START_OVERRIDE(cave_state,cave) MCFG_MACHINE_RESET_OVERRIDE(cave_state,cave) MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") @@ -2885,7 +2871,6 @@ MACHINE_CONFIG_START(cave_state::tjumpman) MCFG_WATCHDOG_ADD("watchdog") MCFG_WATCHDOG_TIME_INIT(attotime::from_seconds(3)) /* a guess, and certainly wrong */ - MCFG_MACHINE_START_OVERRIDE(cave_state,cave) MCFG_MACHINE_RESET_OVERRIDE(cave_state,cave) MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") @@ -2930,7 +2915,6 @@ MACHINE_CONFIG_START(cave_state::uopoko) MCFG_DEVICE_PROGRAM_MAP(uopoko_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", cave_state, cave_interrupt) - MCFG_MACHINE_START_OVERRIDE(cave_state,cave) MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") MCFG_TIMER_DRIVER_ADD("int_timer", cave_state, cave_vblank_start) diff --git a/src/mame/drivers/cc40.cpp b/src/mame/drivers/cc40.cpp index e5e683433c6..0600fe20fbf 100644 --- a/src/mame/drivers/cc40.cpp +++ b/src/mame/drivers/cc40.cpp @@ -91,38 +91,18 @@ class cc40_state : public driver_device { public: - cc40_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + cc40_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_cart(*this, "cartslot"), m_key_matrix(*this, "IN.%u", 0), - m_battery_inp(*this, "BATTERY") + m_battery_inp(*this, "BATTERY"), + m_lamp(*this, "lamp%u", 0U) { m_sysram[0] = nullptr; m_sysram[1] = nullptr; } - required_device m_maincpu; - required_device m_cart; - required_ioport_array<8> m_key_matrix; - required_ioport m_battery_inp; - - nvram_device *m_nvram[2]; - - memory_region *m_cart_rom; - - u8 m_bus_control; - u8 m_power; - u8 m_banks; - u8 m_clock_control; - u8 m_clock_divider; - u8 m_key_select; - - std::unique_ptr m_sysram[2]; - u16 m_sysram_size[2]; - u16 m_sysram_end[2]; - u16 m_sysram_mask[2]; - void postload(); void init_sysram(int chip, u16 size); void update_lcd_indicator(u8 y, u8 x, int state); @@ -141,14 +121,39 @@ public: DECLARE_READ8_MEMBER(keyboard_r); DECLARE_WRITE8_MEMBER(keyboard_w); - virtual void machine_reset() override; - virtual void machine_start() override; DECLARE_PALETTE_INIT(cc40); DECLARE_INPUT_CHANGED_MEMBER(sysram_size_changed); DECLARE_DEVICE_IMAGE_LOAD_MEMBER(cc40_cartridge); HD44780_PIXEL_UPDATE(cc40_pixel_update); void cc40(machine_config &config); void main_map(address_map &map); + +protected: + virtual void machine_reset() override; + virtual void machine_start() override; + +private: + required_device m_maincpu; + required_device m_cart; + required_ioport_array<8> m_key_matrix; + required_ioport m_battery_inp; + + nvram_device *m_nvram[2]; + + memory_region *m_cart_rom; + + u8 m_bus_control; + u8 m_power; + u8 m_banks; + u8 m_clock_control; + u8 m_clock_divider; + u8 m_key_select; + + std::unique_ptr m_sysram[2]; + u16 m_sysram_size[2]; + u16 m_sysram_end[2]; + u16 m_sysram_mask[2]; + output_finder<80> m_lamp; }; @@ -199,7 +204,7 @@ void cc40_state::update_lcd_indicator(u8 y, u8 x, int state) // ---- raw lcd screen here ---- // under | ERROR v v v v v v _LOW // output# | 60 61 62 63 50 51 52 53 - output().set_lamp_value(y * 10 + x, state); + m_lamp[y * 10 + x] = state ? 1 : 0; } HD44780_PIXEL_UPDATE(cc40_state::cc40_pixel_update) @@ -543,6 +548,7 @@ void cc40_state::postload() void cc40_state::machine_start() { // init + m_lamp.resolve(); std::string region_tag; m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); diff --git a/src/mame/drivers/ccastles.cpp b/src/mame/drivers/ccastles.cpp index 9fa64c913c5..c140dd6b17a 100644 --- a/src/mame/drivers/ccastles.cpp +++ b/src/mame/drivers/ccastles.cpp @@ -188,6 +188,8 @@ void ccastles_state::machine_start() { rectangle visarea; + m_led.resolve(); + /* initialize globals */ m_syncprom = memregion("proms")->base() + 0x000; @@ -250,7 +252,7 @@ WRITE8_MEMBER(ccastles_state::irq_ack_w) WRITE8_MEMBER(ccastles_state::led_w) { - output().set_led_value(offset, ~data & 1); + m_led[offset] = BIT(~data, 0); } diff --git a/src/mame/drivers/chance32.cpp b/src/mame/drivers/chance32.cpp index 78336ebc597..2e359b596c9 100644 --- a/src/mame/drivers/chance32.cpp +++ b/src/mame/drivers/chance32.cpp @@ -31,12 +31,14 @@ class chance32_state : public driver_device { public: - chance32_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + chance32_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_fgram(*this, "fgram"), m_bgram(*this, "bgram"), m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode") { } + m_gfxdecode(*this, "gfxdecode"), + m_lamp(*this, "lamp%u", 0U) + { } DECLARE_WRITE8_MEMBER(chance32_fgram_w) { @@ -54,6 +56,18 @@ public: DECLARE_WRITE8_MEMBER(muxout_w); DECLARE_READ8_MEMBER(mux_r); + TILE_GET_INFO_MEMBER(get_fg_tile_info); + TILE_GET_INFO_MEMBER(get_bg_tile_info); + uint32_t screen_update_chance32(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void chance32(machine_config &config); + void chance32_map(address_map &map); + void chance32_portmap(address_map &map); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + tilemap_t *m_fg_tilemap; tilemap_t *m_bg_tilemap; @@ -61,17 +75,9 @@ public: required_shared_ptr m_bgram; uint8_t mux_data; - TILE_GET_INFO_MEMBER(get_fg_tile_info); - TILE_GET_INFO_MEMBER(get_bg_tile_info); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; - uint32_t screen_update_chance32(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); required_device m_maincpu; required_device m_gfxdecode; - void chance32(machine_config &config); - void chance32_map(address_map &map); - void chance32_portmap(address_map &map); + output_finder<13> m_lamp; }; @@ -173,13 +179,13 @@ WRITE8_MEMBER(chance32_state::muxout_w) if (data & 1) // bit 0 is the mux selector. { - output().set_lamp_value(0, (data >> 1) & 1); /* Lamp 0 - Small / Big */ - output().set_lamp_value(1, (data >> 2) & 1); /* Lamp 1 - Big / Small */ - output().set_lamp_value(2, (data >> 3) & 1); /* Lamp 2 - Hold 5 */ - output().set_lamp_value(3, (data >> 4) & 1); /* Lamp 3 - Hold 4 */ - output().set_lamp_value(4, (data >> 5) & 1); /* Lamp 4 - Hold 3 */ - output().set_lamp_value(5, (data >> 6) & 1); /* Lamp 5 - Hold 2 */ - output().set_lamp_value(6, (data >> 7) & 1); /* Lamp 6 - Hold 1 */ + m_lamp[0] = BIT(data, 1); /* Lamp 0 - Small / Big */ + m_lamp[1] = BIT(data, 2); /* Lamp 1 - Big / Small */ + m_lamp[2] = BIT(data, 3); /* Lamp 2 - Hold 5 */ + m_lamp[3] = BIT(data, 4); /* Lamp 3 - Hold 4 */ + m_lamp[4] = BIT(data, 5); /* Lamp 4 - Hold 3 */ + m_lamp[5] = BIT(data, 6); /* Lamp 5 - Hold 2 */ + m_lamp[6] = BIT(data, 7); /* Lamp 6 - Hold 1 */ logerror("Lamps A: %02x\n", data); } @@ -187,12 +193,12 @@ WRITE8_MEMBER(chance32_state::muxout_w) else { // bit 1 is unknown... - output().set_lamp_value(7, (data >> 2) & 1); /* Lamp 7 - Fever! */ - output().set_lamp_value(8, (data >> 3) & 1); /* Lamp 8 - Cancel */ - output().set_lamp_value(9, (data >> 4) & 1); /* Lamp 9 - D-Up / Take */ - output().set_lamp_value(10, (data >> 5) & 1); /* Lamp 10 - Take / D-Up */ - output().set_lamp_value(11, (data >> 6) & 1); /* Lamp 11 - Deal */ - output().set_lamp_value(12, (data >> 7) & 1); /* Lamp 12 - Bet */ + m_lamp[7] = BIT(data, 2); /* Lamp 7 - Fever! */ + m_lamp[8] = BIT(data, 3); /* Lamp 8 - Cancel */ + m_lamp[9] = BIT(data, 4); /* Lamp 9 - D-Up / Take */ + m_lamp[10] = BIT(data, 5); /* Lamp 10 - Take / D-Up */ + m_lamp[11] = BIT(data, 6); /* Lamp 11 - Deal */ + m_lamp[12] = BIT(data, 7); /* Lamp 12 - Bet */ logerror("Lamps B: %02x\n", data); } @@ -442,6 +448,7 @@ GFXDECODE_END void chance32_state::machine_start() { + m_lamp.resolve(); } void chance32_state::machine_reset() diff --git a/src/mame/drivers/chexx.cpp b/src/mame/drivers/chexx.cpp index 3356d736d79..31dc1d710d9 100644 --- a/src/mame/drivers/chexx.cpp +++ b/src/mame/drivers/chexx.cpp @@ -38,6 +38,8 @@ public: , m_digitalker(*this, "digitalker") , m_aysnd(*this, "aysnd") , m_digits(*this, "digit%u", 0U) + , m_leds(*this, "led%u", 0U) + , m_lamps(*this, "lamp%u", 0U) { } @@ -87,6 +89,8 @@ private: required_device m_digitalker; optional_device m_aysnd; // only faceoffh output_finder<4> m_digits; + output_finder<3> m_leds; + output_finder<2> m_lamps; }; @@ -151,9 +155,9 @@ WRITE_LINE_MEMBER(chexx_state::via_cb2_out) m_digits[3] = patterns[(m_shift >> (8+0)) & 0xf]; // Leds (period being played) - output().set_led_value(0, BIT(m_shift,2)); - output().set_led_value(1, BIT(m_shift,1)); - output().set_led_value(2, BIT(m_shift,0)); + m_leds[0] = BIT(m_shift,2); + m_leds[1] = BIT(m_shift,1); + m_leds[2] = BIT(m_shift,0); // logerror("%s: VIA write CB2 = %02X\n", machine().describe_context(), state); } @@ -190,8 +194,8 @@ void chexx_state::chexx83_map(address_map &map) WRITE8_MEMBER(chexx_state::lamp_w) { m_lamp = data; - output().set_lamp_value(0, BIT(m_lamp,0)); - output().set_lamp_value(1, BIT(m_lamp,1)); + m_lamps[0] = BIT(m_lamp,0); + m_lamps[1] = BIT(m_lamp,1); } WRITE8_MEMBER(chexx_state::ay_w) @@ -262,6 +266,8 @@ INPUT_PORTS_END void chexx_state::machine_start() { m_digits.resolve(); + m_leds.resolve(); + m_lamps.resolve(); } void chexx_state::digitalker_set_bank(uint8_t bank) diff --git a/src/mame/drivers/chsuper.cpp b/src/mame/drivers/chsuper.cpp index 092585caa67..477c3ef0d9e 100644 --- a/src/mame/drivers/chsuper.cpp +++ b/src/mame/drivers/chsuper.cpp @@ -36,39 +36,44 @@ class chsuper_state : public driver_device { public: chsuper_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_gfxdecode(*this, "gfxdecode") + , m_palette(*this, "palette") + , m_lamp(*this, "lamp%u", 0U) + { } DECLARE_WRITE8_MEMBER(chsuper_vram_w); DECLARE_WRITE8_MEMBER(chsuper_outporta_w); DECLARE_WRITE8_MEMBER(chsuper_outportb_w); - int m_tilexor; - uint8_t m_blacklamp; - uint8_t m_redlamp; - std::unique_ptr m_vram; - - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_palette; uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void chsuper(machine_config &config); void chsuper_portmap(address_map &map); void chsuper_prg_map(address_map &map); void ramdac_map(address_map &map); + void init_chsuper3(); + void init_chmpnum(); + void init_chsuper2(); + protected: // driver_device overrides - //virtual void machine_start(); + virtual void machine_start() override { m_lamp.resolve(); } //virtual void machine_reset(); virtual void video_start() override; -public: - void init_chsuper3(); - void init_chmpnum(); - void init_chsuper2(); + + + int m_tilexor; + uint8_t m_blacklamp; + uint8_t m_redlamp; + std::unique_ptr m_vram; + + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_palette; + output_finder<7> m_lamp; }; @@ -152,11 +157,11 @@ WRITE8_MEMBER( chsuper_state::chsuper_vram_w ) WRITE8_MEMBER( chsuper_state::chsuper_outporta_w ) // Port EEh { machine().bookkeeping().coin_counter_w(0, data & 0x01); // Coin counter - output().set_lamp_value(0, (data >> 1) & 1); // Hold 1 / Black (Nero) lamp. + m_lamp[0] = BIT(data, 1); // Hold 1 / Black (Nero) lamp. machine().bookkeeping().coin_counter_w(1, data & 0x04); // Payout / Ticket Out pulse - output().set_lamp_value(1, (data >> 3) & 1); // Hold 2 / Low (Bassa) lamp. + m_lamp[1] = BIT(data, 3); // Hold 2 / Low (Bassa) lamp. // D4: unused... - output().set_lamp_value(5, (data >> 5) & 1); // BET lamp + m_lamp[5] = BIT(data, 5); // BET lamp // D6: ticket motor... // D7: unused... @@ -167,11 +172,11 @@ WRITE8_MEMBER( chsuper_state::chsuper_outporta_w ) // Port EEh if ((m_blacklamp == 1) & (m_redlamp == 1)) // if both are ON... { - output().set_lamp_value(2, 1); // HOLD 3 ON + m_lamp[2] = 1; // HOLD 3 ON } else { - output().set_lamp_value(2, 0); // otherwise HOLD 3 OFF + m_lamp[2] = 0; // otherwise HOLD 3 OFF } } @@ -179,11 +184,11 @@ WRITE8_MEMBER( chsuper_state::chsuper_outportb_w ) // Port EFh { // D0: unknown... // D1: unused... - output().set_lamp_value(3, (data >> 2) & 1); // Hold 4 / High (Alta) lamp. + m_lamp[3] = BIT(data, 2); // Hold 4 / High (Alta) lamp. // D3: unused... // D4: unused... - output().set_lamp_value(4, (data >> 5) & 1); // Hold 5 / Red (Rosso) / Gamble (Raddoppio) lamp. - output().set_lamp_value(6, (data >> 6) & 1); // Start / Gamble (Raddoppio) lamp. + m_lamp[4] = BIT(data, 5); // Hold 5 / Red (Rosso) / Gamble (Raddoppio) lamp. + m_lamp[6] = BIT(data, 6); // Start / Gamble (Raddoppio) lamp. // D7: unused... /* Workaround to get the HOLD 3 lamp line active, @@ -193,11 +198,11 @@ WRITE8_MEMBER( chsuper_state::chsuper_outportb_w ) // Port EFh if ((m_blacklamp == 1) & (m_redlamp == 1)) // if both are ON... { - output().set_lamp_value(2, 1); // Hold 3 ON + m_lamp[2] = 1; // Hold 3 ON } else { - output().set_lamp_value(2, 0); // Hold 3 OFF + m_lamp[2] = 0; // Hold 3 OFF } } diff --git a/src/mame/drivers/cidelsa.cpp b/src/mame/drivers/cidelsa.cpp index e2d051d22b1..4e2aceda284 100644 --- a/src/mame/drivers/cidelsa.cpp +++ b/src/mame/drivers/cidelsa.cpp @@ -114,9 +114,9 @@ WRITE8_MEMBER( cidelsa_state::altair_out1_w ) 7 CONT. M1 */ - output().set_led_value(0, data & 0x08); // 1P - output().set_led_value(1, data & 0x10); // 2P - output().set_led_value(2, data & 0x20); // FIRE + m_led[0] = BIT(data, 3); // 1P + m_led[1] = BIT(data, 4); // 2P + m_led[2] = BIT(data, 5); // FIRE } WRITE8_MEMBER( draco_state::out1_w ) @@ -370,18 +370,21 @@ void cidelsa_state::device_timer(emu_timer &timer, device_timer_id id, int param void cidelsa_state::machine_start() { + m_led.resolve(); + /* register for state saving */ save_item(NAME(m_reset)); } void draco_state::machine_start() { + cidelsa_state::machine_start(); + /* setup COP402 memory banking */ membank("bank1")->configure_entries(0, 2, memregion(COP402N_TAG)->base(), 0x400); membank("bank1")->set_entry(0); /* register for state saving */ - save_item(NAME(m_reset)); save_item(NAME(m_sound)); save_item(NAME(m_psg_latch)); } diff --git a/src/mame/drivers/cischeat.cpp b/src/mame/drivers/cischeat.cpp index 6457a7f5953..da78a439e7c 100644 --- a/src/mame/drivers/cischeat.cpp +++ b/src/mame/drivers/cischeat.cpp @@ -544,15 +544,15 @@ WRITE16_MEMBER(cischeat_state::scudhamm_leds_w) { if (ACCESSING_BITS_8_15) { - output().set_led_value(0, data & 0x0100); // 3 buttons - output().set_led_value(1, data & 0x0200); - output().set_led_value(2, data & 0x0400); + m_led[0] = BIT(data, 8); // 3 buttons + m_led[1] = BIT(data, 9); + m_led[2] = BIT(data, 10); } if (ACCESSING_BITS_0_7) { -// output().set_led_value(3, data & 0x0010); // if we had more leds.. -// output().set_led_value(4, data & 0x0020); + m_led[3] = BIT(data, 4); + m_led[4] = BIT(data, 5); } } @@ -647,10 +647,10 @@ WRITE16_MEMBER(cischeat_state::armchmp2_leds_w) { if (ACCESSING_BITS_8_15) { - output().set_led_value(0, data & 0x0100); - output().set_led_value(1, data & 0x1000); - output().set_led_value(2, data & 0x2000); - output().set_led_value(3, data & 0x4000); + m_led[0] = BIT(data, 8); + m_led[1] = BIT(data, 12); + m_led[2] = BIT(data, 13); + m_led[3] = BIT(data, 14); } if (ACCESSING_BITS_0_7) @@ -694,9 +694,9 @@ WRITE16_MEMBER(cischeat_state::captflag_leds_w) if (ACCESSING_BITS_8_15) { machine().bookkeeping().coin_counter_w(1, data & 0x0100); // coin 2 - output().set_led_value(0, data & 0x0200); // decide + m_led[0] = BIT(data, 8); // decide machine().bookkeeping().coin_counter_w(0, data & 0x0400); // coin 1 - output().set_led_value(1, data & 0x2000); // select + m_led[1] = BIT(data, 13); // select int power = (data & 0x1000); m_captflag_hopper->motor_w(power ? 1 : 0); // prize motor diff --git a/src/mame/drivers/cliffhgr.cpp b/src/mame/drivers/cliffhgr.cpp index 90a2259407f..82ee95de627 100644 --- a/src/mame/drivers/cliffhgr.cpp +++ b/src/mame/drivers/cliffhgr.cpp @@ -94,20 +94,16 @@ class cliffhgr_state : public driver_device { public: cliffhgr_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_laserdisc(*this, "laserdisc"), - m_port_bank(0), - m_phillips_code(0) , - m_maincpu(*this, "maincpu"), - m_discrete(*this, "discrete"), - m_screen(*this, "screen") { } + : driver_device(mconfig, type, tag) + , m_laserdisc(*this, "laserdisc") + , m_port_bank(0) + , m_phillips_code(0) + , m_maincpu(*this, "maincpu") + , m_discrete(*this, "discrete") + , m_screen(*this, "screen") + , m_led(*this, "led0") + { } - required_device m_laserdisc; - - int m_port_bank; - uint32_t m_phillips_code; - - emu_timer *m_irq_timer; DECLARE_WRITE8_MEMBER(cliff_test_led_w); DECLARE_WRITE8_MEMBER(cliff_port_bank_w); DECLARE_READ8_MEMBER(cliff_port_r); @@ -118,15 +114,27 @@ public: DECLARE_WRITE8_MEMBER(cliff_ldwire_w); DECLARE_WRITE8_MEMBER(cliff_sound_overlay_w); void init_cliff(); + TIMER_CALLBACK_MEMBER(cliff_irq_callback); + void cliffhgr(machine_config &config); + void mainmem(address_map &map); + void mainport(address_map &map); + +protected: virtual void machine_start() override; virtual void machine_reset() override; - TIMER_CALLBACK_MEMBER(cliff_irq_callback); + +private: + required_device m_laserdisc; + + int m_port_bank; + uint32_t m_phillips_code; + + emu_timer *m_irq_timer; + required_device m_maincpu; required_device m_discrete; required_device m_screen; - void cliffhgr(machine_config &config); - void mainmem(address_map &map); - void mainport(address_map &map); + output_finder<> m_led; }; @@ -134,7 +142,7 @@ public: WRITE8_MEMBER(cliffhgr_state::cliff_test_led_w) { - output().set_led_value(0, offset ^ 1); + m_led = offset ^ 1; } WRITE8_MEMBER(cliffhgr_state::cliff_port_bank_w) @@ -228,6 +236,7 @@ TIMER_CALLBACK_MEMBER(cliffhgr_state::cliff_irq_callback) void cliffhgr_state::machine_start() { + m_led.resolve(); m_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cliffhgr_state::cliff_irq_callback),this)); } diff --git a/src/mame/drivers/copsnrob.cpp b/src/mame/drivers/copsnrob.cpp index fecc88c4b9b..5cce920e7d4 100644 --- a/src/mame/drivers/copsnrob.cpp +++ b/src/mame/drivers/copsnrob.cpp @@ -79,7 +79,7 @@ WRITE8_MEMBER(copsnrob_state::copsnrob_misc2_w) { m_misc = data & 0x7f; /* Multi Player Start */ - output().set_led_value(1, !((data >> 6) & 0x01)); + m_led[1] = BIT(~data, 6); } diff --git a/src/mame/drivers/corona.cpp b/src/mame/drivers/corona.cpp index d1478070f87..6bfb5cd2077 100644 --- a/src/mame/drivers/corona.cpp +++ b/src/mame/drivers/corona.cpp @@ -324,21 +324,15 @@ class corona_state : public driver_device { public: - corona_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + corona_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_soundcpu(*this, "soundcpu"), m_screen(*this, "screen"), - m_soundlatch(*this, "soundlatch") { } + m_soundlatch(*this, "soundlatch"), + m_lamps(*this, "lamp%u", 0U) + { } - uint8_t m_blitter_x_reg; - uint8_t m_blitter_y_reg; - uint8_t m_blitter_aux_reg; - uint8_t m_blitter_unk_reg; - std::unique_ptr m_videobuf; - uint8_t m_lamp; - uint8_t m_lamp_old; - int m_input_selector; DECLARE_WRITE8_MEMBER(blitter_y_w); DECLARE_WRITE8_MEMBER(blitter_unk_w); DECLARE_WRITE8_MEMBER(blitter_x_w); @@ -356,10 +350,6 @@ public: DECLARE_PALETTE_INIT(corona); uint32_t screen_update_winner(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); uint32_t screen_update_luckyrlt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device m_maincpu; - required_device m_soundcpu; - required_device m_screen; - required_device m_soundlatch; void winner81(machine_config &config); void winner82(machine_config &config); void rcirulet(machine_config &config); @@ -381,6 +371,23 @@ public: void winner82_map(address_map &map); void winner82_sound_cpu_io_map(address_map &map); void winner82_sound_map(address_map &map); + +protected: + virtual void machine_start() override { m_lamps.resolve(); } + + uint8_t m_blitter_x_reg; + uint8_t m_blitter_y_reg; + uint8_t m_blitter_aux_reg; + uint8_t m_blitter_unk_reg; + std::unique_ptr m_videobuf; + uint8_t m_lamp; + uint8_t m_lamp_old; + int m_input_selector; + required_device m_maincpu; + required_device m_soundcpu; + required_device m_screen; + required_device m_soundlatch; + output_finder<256> m_lamps; }; @@ -536,8 +543,8 @@ WRITE8_MEMBER(corona_state::ball_w) { m_lamp = data; - output().set_lamp_value(data, 1); - output().set_lamp_value(m_lamp_old, 0); + m_lamps[data] = 1; + m_lamps[m_lamp_old] = 0; m_lamp_old = m_lamp; } diff --git a/src/mame/drivers/cubo.cpp b/src/mame/drivers/cubo.cpp index cef4569df80..6cad5b206c3 100644 --- a/src/mame/drivers/cubo.cpp +++ b/src/mame/drivers/cubo.cpp @@ -409,7 +409,7 @@ WRITE8_MEMBER( cubo_state::akiko_cia_0_port_a_write ) m_cdda->set_output_gain( 0, ( data & 1 ) ? 0.0 : 1.0 ); /* bit 1 = Power Led on Amiga */ - output().set_led_value(0, (data & 2) ? 0 : 1); + m_power_led = BIT(~data, 1); handle_joystick_cia(data, m_cia_0->read(space, 2)); } diff --git a/src/mame/drivers/cvs.cpp b/src/mame/drivers/cvs.cpp index 6e9c16f84ed..9554c76c9dc 100644 --- a/src/mame/drivers/cvs.cpp +++ b/src/mame/drivers/cvs.cpp @@ -925,8 +925,11 @@ GFXDECODE_END * *************************************/ -MACHINE_START_MEMBER(cvs_state,cvs) + +void cvs_state::machine_start() { + m_lamp.resolve(); + /* allocate memory */ if (m_gfxdecode->gfx(1) != nullptr) m_gfxdecode->gfx(1)->set_source(m_character_ram); @@ -949,7 +952,7 @@ MACHINE_START_MEMBER(cvs_state,cvs) save_item(NAME(m_stars_scroll)); } -MACHINE_RESET_MEMBER(cvs_state,cvs) +void cvs_state::machine_reset() { m_character_banking_mode = 0; m_character_ram_page_start = 0; @@ -984,9 +987,6 @@ MACHINE_CONFIG_START(cvs_state::cvs) //MCFG_S2650_SENSE_INPUT(READLINE(*this, cvs_state, cvs_393hz_clock_r)) MCFG_S2650_SENSE_INPUT(READLINE("tms", tms5110_device, romclk_hack_r)) - MCFG_MACHINE_START_OVERRIDE(cvs_state,cvs) - MCFG_MACHINE_RESET_OVERRIDE(cvs_state,cvs) - /* video hardware */ MCFG_VIDEO_START_OVERRIDE(cvs_state,cvs) diff --git a/src/mame/drivers/dacholer.cpp b/src/mame/drivers/dacholer.cpp index 076b5cd7118..6df11b1e089 100644 --- a/src/mame/drivers/dacholer.cpp +++ b/src/mame/drivers/dacholer.cpp @@ -45,43 +45,18 @@ class dacholer_state : public driver_device { public: dacholer_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this,"maincpu"), - m_audiocpu(*this,"audiocpu"), - m_msm(*this, "msm"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_soundlatch(*this, "soundlatch"), - m_bgvideoram(*this, "bgvideoram"), - m_fgvideoram(*this, "fgvideoram"), - m_spriteram(*this, "spriteram") { } - - /* devices */ - required_device m_maincpu; - required_device m_audiocpu; - optional_device m_msm; - required_device m_gfxdecode; - required_device m_palette; - required_device m_soundlatch; - - /* memory pointers */ - required_shared_ptr m_bgvideoram; - required_shared_ptr m_fgvideoram; - required_shared_ptr m_spriteram; - - /* video-related */ - tilemap_t *m_bg_tilemap; - tilemap_t *m_fg_tilemap; - int m_bg_bank; - uint8_t m_scroll_x; - uint8_t m_scroll_y; - - /* sound-related */ - int m_msm_data; - int m_msm_toggle; - uint8_t m_snd_interrupt_enable; - uint8_t m_music_interrupt_enable; - uint8_t m_snd_ack; + : driver_device(mconfig, type, tag) + , m_maincpu(*this,"maincpu") + , m_audiocpu(*this,"audiocpu") + , m_msm(*this, "msm") + , m_gfxdecode(*this, "gfxdecode") + , m_palette(*this, "palette") + , m_soundlatch(*this, "soundlatch") + , m_bgvideoram(*this, "bgvideoram") + , m_fgvideoram(*this, "fgvideoram") + , m_spriteram(*this, "spriteram") + , m_led(*this, "led%u", 0U) + { } DECLARE_WRITE8_MEMBER(bg_scroll_x_w); DECLARE_WRITE8_MEMBER(bg_scroll_y_w); @@ -97,9 +72,6 @@ public: DECLARE_CUSTOM_INPUT_MEMBER(snd_ack_r); TILE_GET_INFO_MEMBER(get_bg_tile_info); TILE_GET_INFO_MEMBER(get_fg_tile_info); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; DECLARE_PALETTE_INIT(dacholer); uint32_t screen_update_dacholer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(sound_irq); @@ -114,6 +86,42 @@ public: void main_map(address_map &map); void snd_io_map(address_map &map); void snd_map(address_map &map); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + +private: + /* devices */ + required_device m_maincpu; + required_device m_audiocpu; + optional_device m_msm; + required_device m_gfxdecode; + required_device m_palette; + required_device m_soundlatch; + + /* memory pointers */ + required_shared_ptr m_bgvideoram; + required_shared_ptr m_fgvideoram; + required_shared_ptr m_spriteram; + + output_finder<2> m_led; + + /* video-related */ + tilemap_t *m_bg_tilemap; + tilemap_t *m_fg_tilemap; + int m_bg_bank; + uint8_t m_scroll_x; + uint8_t m_scroll_y; + + /* sound-related */ + int m_msm_data; + int m_msm_toggle; + uint8_t m_snd_interrupt_enable; + uint8_t m_music_interrupt_enable; + uint8_t m_snd_ack; + }; TILE_GET_INFO_MEMBER(dacholer_state::get_bg_tile_info) @@ -223,8 +231,8 @@ WRITE8_MEMBER(dacholer_state::coins_w) machine().bookkeeping().coin_counter_w(0, data & 1); machine().bookkeeping().coin_counter_w(1, data & 2); - output().set_led_value(0, data & 4); - output().set_led_value(1, data & 8); + m_led[0] = BIT(data, 2); + m_led[1] = BIT(data, 3); } WRITE8_MEMBER(dacholer_state::main_irq_ack_w) @@ -596,6 +604,8 @@ WRITE_LINE_MEMBER(dacholer_state::adpcm_int) void dacholer_state::machine_start() { + m_led.resolve(); + save_item(NAME(m_bg_bank)); save_item(NAME(m_msm_data)); save_item(NAME(m_msm_toggle)); diff --git a/src/mame/drivers/ddenlovr.cpp b/src/mame/drivers/ddenlovr.cpp index a161e905b00..a3022d7498d 100644 --- a/src/mame/drivers/ddenlovr.cpp +++ b/src/mame/drivers/ddenlovr.cpp @@ -168,73 +168,15 @@ class ddenlovr_state : public dynax_state { public: ddenlovr_state(const machine_config &mconfig, device_type type, const char *tag) - : dynax_state(mconfig, type, tag), - m_protection1(*this, "protection1"), - m_protection2(*this, "protection2"), - m_soundlatch(*this, "soundlatch") { } + : dynax_state(mconfig, type, tag) + , m_protection1(*this, "protection1") + , m_protection2(*this, "protection2") + , m_soundlatch(*this, "soundlatch") + , m_led(*this, "led%u", 0U) + { } void set_blitter_irq(write_line_delegate &&handler) { m_blitter_irq_handler = std::move(handler); } - write_line_delegate m_blitter_irq_handler; - - optional_shared_ptr m_protection1; - optional_shared_ptr m_protection2; - - optional_device m_soundlatch; - - std::unique_ptr m_ddenlovr_pixmap[8]; - - /* blitter (TODO: merge with the dynax.h, where possible) */ - int m_extra_layers; - int m_ddenlovr_dest_layer; - int m_ddenlovr_blit_flip; - int m_ddenlovr_blit_x; - int m_ddenlovr_blit_y; - int m_ddenlovr_blit_address; - int m_ddenlovr_blit_pen; - int m_ddenlovr_blit_pen_mode; - int m_ddenlovr_blitter_irq_flag; - int m_ddenlovr_blitter_irq_enable; - int m_ddenlovr_rect_width; - int m_ddenlovr_rect_height; - int m_ddenlovr_clip_width; - int m_ddenlovr_clip_height; - int m_ddenlovr_line_length; - int m_ddenlovr_clip_ctrl; - int m_ddenlovr_clip_x; - int m_ddenlovr_clip_y; - int m_ddenlovr_scroll[8*2]; - int m_ddenlovr_priority; - int m_ddenlovr_priority2; - int m_ddenlovr_bgcolor; - int m_ddenlovr_bgcolor2; - int m_ddenlovr_layer_enable; - int m_ddenlovr_layer_enable2; - int m_ddenlovr_palette_base[8]; - int m_ddenlovr_palette_mask[8]; - int m_ddenlovr_transparency_pen[8]; - int m_ddenlovr_transparency_mask[8]; - int m_ddenlovr_blit_latch; - int m_ddenlovr_blit_pen_mask; // not implemented - int m_ddenlovr_blit_rom_bits; // usually 8, 16 in hanakanz - const int *m_ddenlovr_blit_commands; - int m_ddenlovr_blit_regs[2]; - - /* ddenlovr misc (TODO: merge with dynax.h, where possible) */ - uint8_t m_palram[0x200]; - int m_okibank; - uint8_t m_prot_val; - uint16_t m_prot_16; - uint16_t m_quiz365_protection[2]; - - uint16_t m_mmpanic_leds; /* A led for each of the 9 buttons */ - uint8_t m_funkyfig_lockout; - uint8_t m_romdata[2]; - int m_palette_index; - uint8_t m_hginga_rombank; - uint8_t m_mjflove_irq_cause; - uint8_t m_daimyojn_palette_sel; - DECLARE_MACHINE_START(ddenlovr); DECLARE_MACHINE_RESET(ddenlovr); DECLARE_VIDEO_START(ddenlovr); @@ -532,6 +474,67 @@ public: void sryudens_map(address_map &map); void sryudens_portmap(address_map &map); void ultrchmp_map(address_map &map); + +protected: + write_line_delegate m_blitter_irq_handler; + + optional_shared_ptr m_protection1; + optional_shared_ptr m_protection2; + optional_device m_soundlatch; + output_finder<2> m_led; + std::unique_ptr m_ddenlovr_pixmap[8]; + + /* blitter (TODO: merge with the dynax.h, where possible) */ + int m_extra_layers; + int m_ddenlovr_dest_layer; + int m_ddenlovr_blit_flip; + int m_ddenlovr_blit_x; + int m_ddenlovr_blit_y; + int m_ddenlovr_blit_address; + int m_ddenlovr_blit_pen; + int m_ddenlovr_blit_pen_mode; + int m_ddenlovr_blitter_irq_flag; + int m_ddenlovr_blitter_irq_enable; + int m_ddenlovr_rect_width; + int m_ddenlovr_rect_height; + int m_ddenlovr_clip_width; + int m_ddenlovr_clip_height; + int m_ddenlovr_line_length; + int m_ddenlovr_clip_ctrl; + int m_ddenlovr_clip_x; + int m_ddenlovr_clip_y; + int m_ddenlovr_scroll[8*2]; + int m_ddenlovr_priority; + int m_ddenlovr_priority2; + int m_ddenlovr_bgcolor; + int m_ddenlovr_bgcolor2; + int m_ddenlovr_layer_enable; + int m_ddenlovr_layer_enable2; + int m_ddenlovr_palette_base[8]; + int m_ddenlovr_palette_mask[8]; + int m_ddenlovr_transparency_pen[8]; + int m_ddenlovr_transparency_mask[8]; + int m_ddenlovr_blit_latch; + int m_ddenlovr_blit_pen_mask; // not implemented + int m_ddenlovr_blit_rom_bits; // usually 8, 16 in hanakanz + const int *m_ddenlovr_blit_commands; + int m_ddenlovr_blit_regs[2]; + + /* ddenlovr misc (TODO: merge with dynax.h, where possible) */ + uint8_t m_palram[0x200]; + int m_okibank; + uint8_t m_prot_val; + uint16_t m_prot_16; + uint16_t m_quiz365_protection[2]; + + uint16_t m_mmpanic_leds; /* A led for each of the 9 buttons */ + uint8_t m_funkyfig_lockout; + uint8_t m_romdata[2]; + int m_palette_index; + uint8_t m_hginga_rombank; + uint8_t m_mjflove_irq_cause; + uint8_t m_daimyojn_palette_sel; + }; VIDEO_START_MEMBER(ddenlovr_state,ddenlovr) @@ -2386,7 +2389,7 @@ WRITE_LINE_MEMBER(ddenlovr_state::mmpanic_blitter_irq) void ddenlovr_state::mmpanic_update_leds() { - output().set_led_value(0, m_mmpanic_leds); + m_led[0] = m_mmpanic_leds; } /* leds 1-8 */ @@ -2409,7 +2412,7 @@ WRITE8_MEMBER(ddenlovr_state::mmpanic_lockout_w) { machine().bookkeeping().coin_counter_w(0, (~data) & 0x01); machine().bookkeeping().coin_lockout_w(0, (~data) & 0x02); - output().set_led_value(1, (~data) & 0x04); + m_led[1] = BIT(~data, 2); } } @@ -3896,7 +3899,7 @@ WRITE8_MEMBER(ddenlovr_state::mjgnight_coincounter_w) { m_prot_val = data; - output().set_led_value(0, data & 0x01); // led? 1 in-game, 0 in service mode / while booting + m_led[0] = BIT(data, 0); // led? 1 in-game, 0 in service mode / while booting machine().bookkeeping().coin_counter_w(0, data & 0x04); // coin-out machine().bookkeeping().coin_counter_w(1, data & 0x08); // coin-in @@ -9573,6 +9576,8 @@ INPUT_PORTS_END MACHINE_START_MEMBER(ddenlovr_state,ddenlovr) { + m_led.resolve(); + save_item(NAME(m_input_sel)); save_item(NAME(m_dsw_sel)); save_item(NAME(m_keyb)); diff --git a/src/mame/drivers/didact.cpp b/src/mame/drivers/didact.cpp index 270dd3af219..223e1ee44a2 100644 --- a/src/mame/drivers/didact.cpp +++ b/src/mame/drivers/didact.cpp @@ -100,15 +100,21 @@ class didact_state : public driver_device , m_lines{ 0, 0, 0, 0 } , m_led(0) , m_rs232(*this, "rs232") + , m_leds(*this, "led%u", 0U) { } + TIMER_DEVICE_CALLBACK_MEMBER(scan_artwork); + +protected: + virtual void machine_start() override { m_leds.resolve(); } + required_ioport_array<5> m_io_lines; uint8_t m_lines[4]; uint8_t m_reset; uint8_t m_shift; uint8_t m_led; optional_device m_rs232; - TIMER_DEVICE_CALLBACK_MEMBER(scan_artwork); + output_finder<2> m_leds; }; @@ -246,7 +252,7 @@ WRITE8_MEMBER( md6802_state::pia2_kbB_w ) WRITE_LINE_MEMBER( md6802_state::pia2_ca2_w ) { LOG("--->%s(%02x) LED is connected through resisitor to +5v so logical 0 will lit it\n", FUNCNAME, state); - output().set_led_value(m_led, !state); + m_leds[m_led] = state ? 0 :1; // Serial Out - needs debug/verification m_rs232->write_txd(state); @@ -415,7 +421,7 @@ READ8_MEMBER( mp68a_state::pia2_kbB_r ) { pb |= 0x80; // Set shift bit (PB7) m_shift = 0; // Reset flip flop - output().set_led_value(m_led, m_shift); + m_leds[m_led] = m_shift ? 1 : 0; LOG("SHIFT is released\n"); } @@ -550,7 +556,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(didact_state::scan_artwork) { LOG("RESET is pressed, resetting the CPU\n"); m_shift = 0; - output().set_led_value(m_led, m_shift); // For mp68a only + m_leds[m_led] = m_shift ? 1 : 0; // For mp68a only if (m_reset == 0) { machine_reset(); @@ -562,7 +568,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(didact_state::scan_artwork) // Poll the artwork SHIFT/* key LOG("%s", !m_shift ? "SHIFT is set\n" : ""); m_shift = 1; - output().set_led_value(m_led, m_shift); // For mp68a only + m_leds[m_led] = m_shift ? 1 : 0; // For mp68a only } else { diff --git a/src/mame/drivers/djmain.cpp b/src/mame/drivers/djmain.cpp index e1e781bcf3d..7ffc70abe05 100644 --- a/src/mame/drivers/djmain.cpp +++ b/src/mame/drivers/djmain.cpp @@ -301,9 +301,9 @@ WRITE32_MEMBER(djmain_state::light_ctrl_2_w) { output().set_value("left-ssr", !!(data & 0x08000000)); // SSR output().set_value("right-ssr", !!(data & 0x08000000)); // SSR - output().set_led_value(0, data & 0x00010000); // 1P START - output().set_led_value(1, data & 0x00020000); // 2P START - output().set_led_value(2, data & 0x00040000); // EFFECT + m_led[0] = BIT(data, 16); // 1P START + m_led[1] = BIT(data, 17); // 2P START + m_led[2] = BIT(data, 18); // EFFECT } } @@ -1351,6 +1351,8 @@ void djmain_state::machine_start() if (m_ata_user_password != nullptr) hdd->set_user_password(m_ata_user_password); + m_led.resolve(); + save_item(NAME(m_sndram_bank)); save_item(NAME(m_pending_vb_int)); save_item(NAME(m_v_ctrl)); @@ -1364,9 +1366,9 @@ void djmain_state::machine_reset() m_sndram_bank = 0; /* reset LEDs */ - output().set_led_value(0, 1); - output().set_led_value(1, 1); - output().set_led_value(2, 1); + m_led[0] = 1; + m_led[1] = 1; + m_led[2] = 1; } diff --git a/src/mame/drivers/dmv.cpp b/src/mame/drivers/dmv.cpp index d51c3bb07c6..52d8de6a3a2 100644 --- a/src/mame/drivers/dmv.cpp +++ b/src/mame/drivers/dmv.cpp @@ -69,36 +69,9 @@ public: , m_slot6(*this, "slot6") , m_slot7(*this, "slot7") , m_slot7a(*this, "slot7a") + , m_led(*this, "led%u", 0U) { } - required_device m_maincpu; - required_device m_screen; - required_device m_hgdc; - required_device m_dmac; - required_device m_pit; - required_device m_fdc; - required_device m_floppy0; - required_device m_floppy1; - required_device m_keyboard; - required_device m_speaker; - required_shared_ptr m_video_ram; - required_device m_palette; - required_memory_region m_ram; - required_memory_region m_bootrom; - required_memory_region m_chargen; - - required_device m_slot1; - required_device m_slot2; - required_device m_slot2a; - required_device m_slot3; - required_device m_slot4; - required_device m_slot5; - required_device m_slot6; - required_device m_slot7; - required_device m_slot7a; - - virtual void machine_start() override; - virtual void machine_reset() override; void update_halt_line(); DECLARE_WRITE8_MEMBER(leds_w); @@ -168,6 +141,43 @@ public: UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels ); UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text ); + void dmv(machine_config &config); + void dmv_io(address_map &map); + void dmv_mem(address_map &map); + void upd7220_map(address_map &map); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + +private: + required_device m_maincpu; + required_device m_screen; + required_device m_hgdc; + required_device m_dmac; + required_device m_pit; + required_device m_fdc; + required_device m_floppy0; + required_device m_floppy1; + required_device m_keyboard; + required_device m_speaker; + required_shared_ptr m_video_ram; + required_device m_palette; + required_memory_region m_ram; + required_memory_region m_bootrom; + required_memory_region m_chargen; + + required_device m_slot1; + required_device m_slot2; + required_device m_slot2a; + required_device m_slot3; + required_device m_slot4; + required_device m_slot5; + required_device m_slot6; + required_device m_slot7; + required_device m_slot7a; + output_finder<9> m_led; + bool m_ramoutdis; int m_switch16; int m_thold7; @@ -180,10 +190,6 @@ public: int m_floppy_motor; int m_busint[8]; int m_irqs[8]; - void dmv(machine_config &config); - void dmv_io(address_map &map); - void dmv_mem(address_map &map); - void upd7220_map(address_map &map); }; WRITE8_MEMBER(dmv_state::tc_set_w) @@ -214,7 +220,7 @@ WRITE8_MEMBER(dmv_state::leds_w) */ for(int i=0; i<8; i++) - output().set_led_value(8-i, BIT(data, i)); + m_led[8-i] = BIT(data, i); } READ8_MEMBER(dmv_state::ramsel_r) @@ -618,6 +624,7 @@ INPUT_PORTS_END void dmv_state::machine_start() { + m_led.resolve(); } void dmv_state::machine_reset() diff --git a/src/mame/drivers/dynax.cpp b/src/mame/drivers/dynax.cpp index cedc763c4e4..91f7c5f1216 100644 --- a/src/mame/drivers/dynax.cpp +++ b/src/mame/drivers/dynax.cpp @@ -886,7 +886,7 @@ READ8_MEMBER(dynax_state::jantouki_blitter_busy_r) WRITE8_MEMBER(dynax_state::jantouki_rombank_w) { membank("bank1")->set_entry(data & 0x0f); - output().set_led_value(0, data & 0x10); // maybe + m_led = BIT(data, 4); // maybe } void dynax_state::jantouki_io_map(address_map &map) @@ -4123,6 +4123,8 @@ INPUT_PORTS_END MACHINE_START_MEMBER(dynax_state,dynax) { + m_led.resolve(); + m_blitter_irq_mask = 1; m_blitter2_irq_mask = 1; diff --git a/src/mame/drivers/elf.cpp b/src/mame/drivers/elf.cpp index a2736a0e55c..fb685c77450 100644 --- a/src/mame/drivers/elf.cpp +++ b/src/mame/drivers/elf.cpp @@ -154,7 +154,7 @@ READ_LINE_MEMBER( elf2_state::ef4_r ) WRITE_LINE_MEMBER( elf2_state::q_w ) { - output().set_led_value(0, state); + m_led = state ? 1 : 0; } READ8_MEMBER( elf2_state::dma_r ) @@ -202,6 +202,8 @@ void elf2_state::machine_start() { address_space &program = m_maincpu->space(AS_PROGRAM); + m_led.resolve(); + /* initialize LED displays */ m_7segs.resolve(); m_led_l->rbi_w(1); diff --git a/src/mame/drivers/eolith.cpp b/src/mame/drivers/eolith.cpp index 7219f3c7f14..af611ded3be 100644 --- a/src/mame/drivers/eolith.cpp +++ b/src/mame/drivers/eolith.cpp @@ -117,6 +117,11 @@ * *************************************/ +void eolith_state::machine_start() +{ + m_led.resolve(); +} + READ32_MEMBER(eolith_state::eolith_custom_r) { /* @@ -136,7 +141,7 @@ WRITE32_MEMBER(eolith_state::systemcontrol_w) { m_buffer = (data & 0x80) >> 7; machine().bookkeeping().coin_counter_w(0, data & m_coin_counter_bit); - output().set_led_value(0, data & 1); + m_led = BIT(data, 0); m_eepromoutport->write(data, 0xff); diff --git a/src/mame/drivers/eti660.cpp b/src/mame/drivers/eti660.cpp index 280d710f5fc..af39813a814 100644 --- a/src/mame/drivers/eti660.cpp +++ b/src/mame/drivers/eti660.cpp @@ -178,7 +178,7 @@ WRITE_LINE_MEMBER( eti660_state::q_w ) m_cti->aoe_w(state); /* PULSE led */ - output().set_led_value(LED_PULSE, state); + m_led[LED_PULSE] = state ? 1 : 0; /* tape output */ m_cassette->output(state ? 1.0 : -1.0); @@ -263,6 +263,8 @@ void eti660_state::machine_reset() void eti660_state::machine_start() { + m_led.resolve(); + save_item(NAME(m_color_ram)); } diff --git a/src/mame/drivers/firetrk.cpp b/src/mame/drivers/firetrk.cpp index 0b476d75245..91607d1c7fb 100644 --- a/src/mame/drivers/firetrk.cpp +++ b/src/mame/drivers/firetrk.cpp @@ -69,16 +69,16 @@ TIMER_DEVICE_CALLBACK_MEMBER(firetrk_state::firetrk_scanline) WRITE8_MEMBER(firetrk_state::firetrk_output_w) { /* BIT0 => START1 LAMP */ - output().set_led_value(0, !(data & 0x01)); + m_led[0] = BIT(~data, 0); /* BIT1 => START2 LAMP */ - output().set_led_value(1, !(data & 0x02)); + m_led[1]= BIT(~data, 1); /* BIT2 => FLASH */ m_flash = data & 0x04; /* BIT3 => TRACK LAMP */ - output().set_led_value(3, !(data & 0x08)); + m_led[3] = BIT(~data, 3); /* BIT4 => ATTRACT */ m_discrete->write(space, FIRETRUCK_ATTRACT_EN, data & 0x10); @@ -86,7 +86,7 @@ WRITE8_MEMBER(firetrk_state::firetrk_output_w) machine().bookkeeping().coin_lockout_w(1, !(data & 0x10)); /* BIT5 => START3 LAMP */ - output().set_led_value(2, !(data & 0x20)); + m_led[2] = BIT(~data, 5); /* BIT6 => UNUSED */ @@ -98,7 +98,7 @@ WRITE8_MEMBER(firetrk_state::firetrk_output_w) WRITE8_MEMBER(firetrk_state::superbug_output_w) { /* BIT0 => START LAMP */ - output().set_led_value(0, offset & 0x01); + m_led[0] = BIT(offset, 0); /* BIT1 => ATTRACT */ m_discrete->write(space, SUPERBUG_ATTRACT_EN, offset & 0x02); @@ -109,17 +109,17 @@ WRITE8_MEMBER(firetrk_state::superbug_output_w) m_flash = offset & 0x04; /* BIT3 => TRACK LAMP */ - output().set_led_value(1, offset & 0x08); + m_led[1] = BIT(offset, 3); } WRITE8_MEMBER(firetrk_state::montecar_output_1_w) { /* BIT0 => START LAMP */ - output().set_led_value(0, !(data & 0x01)); + m_led[0] = BIT(~data, 0); /* BIT1 => TRACK LAMP */ - output().set_led_value(1, !(data & 0x02)); + m_led[1] = BIT(~data, 1); /* BIT2 => ATTRACT */ m_discrete->write(space, MONTECAR_ATTRACT_INV, data & 0x04); diff --git a/src/mame/drivers/flyball.cpp b/src/mame/drivers/flyball.cpp index 220a05a65ed..4f6905e7a79 100644 --- a/src/mame/drivers/flyball.cpp +++ b/src/mame/drivers/flyball.cpp @@ -44,7 +44,8 @@ public: m_screen(*this, "screen"), m_palette(*this, "palette"), m_outlatch(*this, "outlatch"), - m_playfield_ram(*this, "playfield_ram") + m_playfield_ram(*this, "playfield_ram"), + m_lamp(*this, "lamp0") { } void flyball(machine_config &config); @@ -89,6 +90,8 @@ private: /* memory pointers */ required_shared_ptr m_playfield_ram; + output_finder<> m_lamp; + /* video-related */ tilemap_t *m_tmap; uint8_t m_pitcher_vert; @@ -288,7 +291,7 @@ WRITE8_MEMBER(flyball_state::misc_w) WRITE_LINE_MEMBER(flyball_state::lamp_w) { - output().set_led_value(0, state); + m_lamp = state ? 1 : 0; } @@ -431,6 +434,7 @@ void flyball_state::machine_start() m_pot_assert_timer[i] = timer_alloc(TIMER_POT_ASSERT); m_pot_clear_timer = timer_alloc(TIMER_POT_CLEAR); m_quarter_timer = timer_alloc(TIMER_QUARTER); + m_lamp.resolve(); save_item(NAME(m_pitcher_vert)); save_item(NAME(m_pitcher_horz)); diff --git a/src/mame/drivers/foodf.cpp b/src/mame/drivers/foodf.cpp index 9b39ca0cc8e..635f3c90fa9 100644 --- a/src/mame/drivers/foodf.cpp +++ b/src/mame/drivers/foodf.cpp @@ -142,6 +142,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(foodf_state::scanline_update_timer) void foodf_state::machine_start() { atarigen_state::machine_start(); + m_led.resolve(); } @@ -170,8 +171,8 @@ WRITE8_MEMBER(foodf_state::digital_w) if (!(data & 0x08)) video_int_ack_w(space,0,0); - output().set_led_value(0, (data >> 4) & 1); - output().set_led_value(1, (data >> 5) & 1); + m_led[0] = BIT(data, 4); + m_led[1] = BIT(data, 5); machine().bookkeeping().coin_counter_w(0, (data >> 6) & 1); machine().bookkeeping().coin_counter_w(1, (data >> 7) & 1); diff --git a/src/mame/drivers/funworld.cpp b/src/mame/drivers/funworld.cpp index 438764a7fd1..51ec37a9822 100644 --- a/src/mame/drivers/funworld.cpp +++ b/src/mame/drivers/funworld.cpp @@ -1023,17 +1023,17 @@ WRITE8_MEMBER(funworld_state::funworld_lamp_a_w) -x-- ---- Hopper Motor (inverted). x--- ---- HOLD4 lamp. */ - output().set_lamp_value(0, 1-((data >> 1) & 1)); /* Hold1 (inverted) */ - output().set_lamp_value(2, 1-((data >> 1) & 1)); /* Hold3 (inverted, see pinouts) */ + m_lamp[0] = BIT(~data, 1); /* Hold1 (inverted) */ + m_lamp[2] = BIT(~data, 1); /* Hold3 (inverted, see pinouts) */ - output().set_lamp_value(1, 1-((data >> 3) & 1)); /* Hold2 / Low (inverted) */ - output().set_lamp_value(3, (data >> 7) & 1); /* Hold4 / High */ - output().set_lamp_value(5, 1-((data >> 5) & 1)); /* Cancel / Collect (inverted) */ + m_lamp[1] = BIT(~data, 3); /* Hold2 / Low (inverted) */ + m_lamp[3] = BIT(data, 7); /* Hold4 / High */ + m_lamp[5] = BIT(~data, 5); /* Cancel / Collect (inverted) */ machine().bookkeeping().coin_counter_w(0, data & 0x01); /* Credit In counter */ machine().bookkeeping().coin_counter_w(7, data & 0x04); /* Credit Out counter, mapped as coin 8 */ - output().set_lamp_value(7, 1-((data >> 6) & 1)); /* Hopper Motor (inverted) */ + m_lamp[7] = BIT(~data, 6); /* Hopper Motor (inverted) */ // popmessage("Lamps A: %02X", (data ^ 0xff)); } @@ -1047,8 +1047,8 @@ WRITE8_MEMBER(funworld_state::funworld_lamp_b_w) ---- -x-- Unknown (inverted). xxxx x--- Unknown. */ - output().set_lamp_value(4, (data >> 0) & 1); /* Hold5 / Bet */ - output().set_lamp_value(6, (data >> 1) & 1); /* Start / Deal / Draw */ + m_lamp[4] = BIT(data, 0); /* Hold5 / Bet */ + m_lamp[6] = BIT(data, 1); /* Start / Deal / Draw */ // popmessage("Lamps B: %02X", data); } diff --git a/src/mame/drivers/galaga.cpp b/src/mame/drivers/galaga.cpp index 114e4c24642..cb850d3d2e4 100644 --- a/src/mame/drivers/galaga.cpp +++ b/src/mame/drivers/galaga.cpp @@ -762,8 +762,8 @@ CUSTOM_INPUT_MEMBER(digdug_state::shifted_port_r){ return ioport((const char *)p WRITE8_MEMBER(galaga_state::out_0) { - output().set_led_value(1,data & 1); - output().set_led_value(0,data & 2); + m_led[1] = BIT(data, 0); + m_led[0] = BIT(data, 1); machine().bookkeeping().coin_counter_w(1,~data & 4); machine().bookkeeping().coin_counter_w(0,~data & 8); } @@ -810,8 +810,9 @@ TIMER_CALLBACK_MEMBER(galaga_state::cpu3_interrupt_callback) } -MACHINE_START_MEMBER(galaga_state,galaga) +void galaga_state::machine_start() { + m_led.resolve(); /* create the interrupt timer */ m_cpu3_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(galaga_state::cpu3_interrupt_callback),this)); save_item(NAME(m_main_irq_mask)); @@ -819,14 +820,14 @@ MACHINE_START_MEMBER(galaga_state,galaga) save_item(NAME(m_sub2_nmi_mask)); } -MACHINE_RESET_MEMBER(galaga_state,galaga) +void galaga_state::machine_reset() { m_cpu3_interrupt_timer->adjust(m_screen->time_until_pos(64), 64); } MACHINE_RESET_MEMBER(xevious_state,battles) { - MACHINE_RESET_CALL_MEMBER(galaga); + galaga_state::machine_reset(); battles_customio_init(); } @@ -1631,8 +1632,6 @@ MACHINE_CONFIG_START(bosco_state::bosco) MCFG_WATCHDOG_VBLANK_INIT("screen", 8) MCFG_QUANTUM_TIME(attotime::from_hz(6000)) /* 100 CPU slices per frame - an high value to ensure proper */ /* synchronization of the CPUs */ - MCFG_MACHINE_START_OVERRIDE(bosco_state,galaga) - MCFG_MACHINE_RESET_OVERRIDE(bosco_state,galaga) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -1706,8 +1705,6 @@ MACHINE_CONFIG_START(galaga_state::galaga) MCFG_WATCHDOG_VBLANK_INIT("screen", 8) MCFG_QUANTUM_TIME(attotime::from_hz(6000)) /* 100 CPU slices per frame - an high value to ensure proper */ /* synchronization of the CPUs */ - MCFG_MACHINE_START_OVERRIDE(galaga_state,galaga) - MCFG_MACHINE_RESET_OVERRIDE(galaga_state,galaga) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -1812,8 +1809,6 @@ MACHINE_CONFIG_START(xevious_state::xevious) MCFG_WATCHDOG_VBLANK_INIT("screen", 8) MCFG_QUANTUM_TIME(attotime::from_hz(60000)) /* 1000 CPU slices per frame - an high value to ensure proper */ /* synchronization of the CPUs */ - MCFG_MACHINE_START_OVERRIDE(galaga_state,galaga) - MCFG_MACHINE_RESET_OVERRIDE(galaga_state,galaga) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -1929,8 +1924,6 @@ MACHINE_CONFIG_START(digdug_state::digdug) MCFG_QUANTUM_TIME(attotime::from_hz(6000)) /* 100 CPU slices per frame - an high value to ensure proper */ /* synchronization of the CPUs */ - MCFG_MACHINE_START_OVERRIDE(galaga_state,galaga) - MCFG_MACHINE_RESET_OVERRIDE(galaga_state,galaga) MCFG_ATARIVGEAROM_ADD("earom") diff --git a/src/mame/drivers/galaxian.cpp b/src/mame/drivers/galaxian.cpp index 079c59139b6..d019dc3e259 100644 --- a/src/mame/drivers/galaxian.cpp +++ b/src/mame/drivers/galaxian.cpp @@ -720,7 +720,7 @@ WRITE8_MEMBER(galaxian_state::start_lamp_w) { /* offset 0 = 1P START LAMP */ /* offset 1 = 2P START LAMP */ - output().set_led_value(offset, data & 1); + m_lamp[offset] = BIT(data, 0); } diff --git a/src/mame/drivers/gaplus.cpp b/src/mame/drivers/gaplus.cpp index e70ee5a8f85..e8d3f133c61 100644 --- a/src/mame/drivers/gaplus.cpp +++ b/src/mame/drivers/gaplus.cpp @@ -486,8 +486,8 @@ static const char *const gaplus_sample_names[] = WRITE8_MEMBER(gaplus_state::out_lamps0) { - output().set_led_value(0, data & 1); - output().set_led_value(1, data & 2); + m_lamp[0] = BIT(data, 0); + m_lamp[1] = BIT(data, 1); machine().bookkeeping().coin_lockout_global_w(data & 4); machine().bookkeeping().coin_counter_w(0, ~data & 8); } @@ -499,6 +499,7 @@ WRITE8_MEMBER(gaplus_state::out_lamps1) void gaplus_state::machine_start() { + m_lamp.resolve(); m_namcoio0_run_timer = timer_alloc(TIMER_NAMCOIO0_RUN); m_namcoio1_run_timer = timer_alloc(TIMER_NAMCOIO1_RUN); diff --git a/src/mame/drivers/gei.cpp b/src/mame/drivers/gei.cpp index 5f3a38cc471..017101791d4 100644 --- a/src/mame/drivers/gei.cpp +++ b/src/mame/drivers/gei.cpp @@ -86,13 +86,15 @@ class gei_state : public driver_device { public: gei_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_dac(*this, "dac"), - m_ticket(*this, "ticket"), - m_screen(*this, "screen"), - m_signature(*this, "signature"), - m_rombank(*this, "rombank") { } + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_dac(*this, "dac") + , m_ticket(*this, "ticket") + , m_screen(*this, "screen") + , m_signature(*this, "signature") + , m_rombank(*this, "rombank") + , m_lamp(*this, "lamp%u", 0U) + { } uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); @@ -138,6 +140,7 @@ public: void sprtauth_map(address_map &map); void suprpokr_map(address_map &map); protected: + virtual void machine_start() override { m_lamp.resolve(); } virtual void video_start() override; private: @@ -157,6 +160,7 @@ private: required_device m_screen; optional_region_ptr m_signature; optional_memory_bank m_rombank; + output_finder<13> m_lamp; }; @@ -211,24 +215,24 @@ uint32_t gei_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c WRITE8_MEMBER(gei_state::lamps_w) { /* 5 button lamps */ - output().set_led_value(0, BIT(data, 0)); - output().set_led_value(1, BIT(data, 1)); - output().set_led_value(2, BIT(data, 2)); - output().set_led_value(3, BIT(data, 3)); - output().set_led_value(4, BIT(data, 4)); + m_lamp[0] = BIT(data, 0); + m_lamp[1] = BIT(data, 1); + m_lamp[2] = BIT(data, 2); + m_lamp[3] = BIT(data, 3); + m_lamp[4] = BIT(data, 4); /* 3 button lamps for deal, cancel, stand in poker games; lamp order verified in poker and selection self tests */ - output().set_led_value(7, BIT(data, 5)); - output().set_led_value(5, BIT(data, 6)); - output().set_led_value(6, BIT(data, 7)); + m_lamp[7] = BIT(data, 5); + m_lamp[5] = BIT(data, 6); + m_lamp[6] = BIT(data, 7); } WRITE8_MEMBER(gei_state::sound_w) { /* bit 3 - coin lockout, lamp10 in poker / lamp6 in trivia test modes */ machine().bookkeeping().coin_lockout_global_w(BIT(~data, 3)); - output().set_led_value(9, BIT(data, 3)); + m_lamp[9] = BIT(data, 3); /* bit 5 - ticket out in trivia games */ if (m_ticket.found()) @@ -246,13 +250,13 @@ WRITE8_MEMBER(gei_state::sound2_w) /* bit 3,6 - coin lockout, lamp 10 + 11 in selection test mode */ machine().bookkeeping().coin_lockout_w(0, BIT(~data, 3)); machine().bookkeeping().coin_lockout_w(1, BIT(~data, 6)); - output().set_led_value(9, BIT(data, 3)); - output().set_led_value(10, BIT(data, 6)); + m_lamp[9] = BIT(data, 3); + m_lamp[10] = BIT(data, 6); /* bit 4,5 - lamps 12, 13 in selection test mode; 12 lights up if dsw maximum bet = 30 an bet > 15 or if dsw maximum bet = 10 an bet = 10 */ - output().set_led_value(11, BIT(data, 4)); - output().set_led_value(12, BIT(data, 5)); + m_lamp[11] = BIT(data, 4); + m_lamp[12] = BIT(data, 5); /* bit 7 goes directly to the sound amplifier */ m_dac->write(BIT(data, 7)); @@ -261,13 +265,13 @@ WRITE8_MEMBER(gei_state::sound2_w) WRITE8_MEMBER(gei_state::lamps2_w) { /* bit 4 - play/raise button lamp, lamp 9 in poker test mode */ - output().set_led_value(8, BIT(data, 4)); + m_lamp[8] = BIT(data, 4); } WRITE8_MEMBER(gei_state::nmi_w) { /* bit 4 - play/raise button lamp, lamp 9 in selection test mode */ - output().set_led_value(8, BIT(data, 4)); + m_lamp[8] = BIT(data, 4); /* bit 6 enables NMI */ m_nmi_mask = data & 0x40; diff --git a/src/mame/drivers/goldnpkr.cpp b/src/mame/drivers/goldnpkr.cpp index 69abf63ccc9..4a2bf06c6c4 100644 --- a/src/mame/drivers/goldnpkr.cpp +++ b/src/mame/drivers/goldnpkr.cpp @@ -1296,14 +1296,16 @@ class goldnpkr_state : public driver_device { public: - goldnpkr_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + goldnpkr_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_videoram(*this, "videoram"), m_colorram(*this, "colorram"), m_maincpu(*this, "maincpu"), m_discrete(*this, "discrete"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_lamp(*this, "lamp%u", 0U) + { } DECLARE_WRITE8_MEMBER(goldnpkr_videoram_w); DECLARE_WRITE8_MEMBER(goldnpkr_colorram_w); @@ -1377,7 +1379,10 @@ public: void wildcrdb_mcu_map(address_map &map); void witchcrd_falcon_map(address_map &map); void witchcrd_map(address_map &map); + protected: + virtual void machine_start() override { m_lamp.resolve(); } + required_shared_ptr m_videoram; required_shared_ptr m_colorram; @@ -1385,6 +1390,7 @@ protected: optional_device m_discrete; required_device m_gfxdecode; required_device m_palette; + output_finder<5> m_lamp; tilemap_t *m_bg_tilemap; uint8_t m_mux_data; @@ -1394,8 +1400,8 @@ protected: class blitz_state : public goldnpkr_state { public: - blitz_state(const machine_config &mconfig, device_type type, const char *tag) - : goldnpkr_state(mconfig, type, tag), + blitz_state(const machine_config &mconfig, device_type type, const char *tag) : + goldnpkr_state(mconfig, type, tag), m_cpubank(*this, "cpubank"), m_mcu(*this, "mcu"), m_bankdev(*this, "bankdev"), @@ -1403,14 +1409,6 @@ public: m_portc_data(0x0f) { } - required_region_ptr m_cpubank; - - required_device m_mcu; - required_device m_bankdev; - - uint8_t m_cpubank_xor; - uint8_t m_portc_data; - DECLARE_READ8_MEMBER(cpubank_decrypt_r); DECLARE_WRITE8_MEMBER(mcu_command_w); DECLARE_WRITE8_MEMBER(mcu_portb_w); @@ -1418,6 +1416,15 @@ public: void megadpkr(machine_config &config); void megadpkr_banked_map(address_map &map); void megadpkr_map(address_map &map); + +private: + required_region_ptr m_cpubank; + + required_device m_mcu; + required_device m_bankdev; + + uint8_t m_cpubank_xor; + uint8_t m_portc_data; }; @@ -1765,11 +1772,11 @@ WRITE8_MEMBER(goldnpkr_state::lamps_a_w) */ data = data ^ 0xff; - output().set_lamp_value(0, (data) & 1); /* Lamp 0 */ - output().set_lamp_value(1, (data >> 1) & 1); /* Lamp 1 */ - output().set_lamp_value(2, (data >> 2) & 1); /* Lamp 2 */ - output().set_lamp_value(3, (data >> 3) & 1); /* Lamp 3 */ - output().set_lamp_value(4, (data >> 4) & 1); /* Lamp 4 */ + m_lamp[0] = BIT(data, 0); /* Lamp 0 */ + m_lamp[1] = BIT(data, 1); /* Lamp 1 */ + m_lamp[2] = BIT(data, 2); /* Lamp 2 */ + m_lamp[3] = BIT(data, 3); /* Lamp 3 */ + m_lamp[4] = BIT(data, 4); /* Lamp 4 */ machine().bookkeeping().coin_counter_w(0, data & 0x40); /* counter1 */ machine().bookkeeping().coin_counter_w(1, data & 0x80); /* counter2 */ diff --git a/src/mame/drivers/goldstar.cpp b/src/mame/drivers/goldstar.cpp index 8b004ea6d12..00604a845d5 100644 --- a/src/mame/drivers/goldstar.cpp +++ b/src/mame/drivers/goldstar.cpp @@ -303,28 +303,28 @@ WRITE8_MEMBER(goldstar_state::p1_lamps_w) skill98 is like schery97 but doesn't activate bit 0 for stop nfb96, roypok96 and nc96 sets are like schery97 but they don't activate bit 2 for select */ - output().set_lamp_value(0, (data >> 0) & 1); - output().set_lamp_value(1, (data >> 1) & 1); - output().set_lamp_value(2, (data >> 2) & 1); - output().set_lamp_value(3, (data >> 3) & 1); - output().set_lamp_value(4, (data >> 4) & 1); - output().set_lamp_value(5, (data >> 5) & 1); - output().set_lamp_value(6, (data >> 6) & 1); - output().set_lamp_value(7, (data >> 7) & 1); + m_lamp[0] = BIT(data, 0); + m_lamp[1] = BIT(data, 1); + m_lamp[2] = BIT(data, 2); + m_lamp[3] = BIT(data, 3); + m_lamp[4] = BIT(data, 4); + m_lamp[5] = BIT(data, 5); + m_lamp[6] = BIT(data, 6); + m_lamp[7] = BIT(data, 7); // popmessage("p1 lamps: %02X", data); } WRITE8_MEMBER(goldstar_state::p2_lamps_w) { - output().set_lamp_value(8 + 0, (data >> 0) & 1); - output().set_lamp_value(8 + 1, (data >> 1) & 1); - output().set_lamp_value(8 + 2, (data >> 2) & 1); - output().set_lamp_value(8 + 3, (data >> 3) & 1); - output().set_lamp_value(8 + 4, (data >> 4) & 1); - output().set_lamp_value(8 + 5, (data >> 5) & 1); - output().set_lamp_value(8 + 6, (data >> 6) & 1); - output().set_lamp_value(8 + 7, (data >> 7) & 1); + m_lamp[8 + 0] = BIT(data, 0); + m_lamp[8 + 1] = BIT(data, 1); + m_lamp[8 + 2] = BIT(data, 2); + m_lamp[8 + 3] = BIT(data, 3); + m_lamp[8 + 4] = BIT(data, 4); + m_lamp[8 + 5] = BIT(data, 5); + m_lamp[8 + 6] = BIT(data, 6); + m_lamp[8 + 7] = BIT(data, 7); // popmessage("p2 lamps: %02X", data); } @@ -1203,12 +1203,12 @@ WRITE8_MEMBER(unkch_state::unkcm_0x02_w) if (!m_vblank_irq_enable) m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); - output().set_lamp_value(0, (data >> 0) & 1); /* Bet-A / Stop 2 */ - output().set_lamp_value(1, (data >> 1) & 1); /* Start / Stop All */ - output().set_lamp_value(2, (data >> 2) & 1); /* Info / Small / Stop 3 */ - output().set_lamp_value(3, (data >> 3) & 1); /* Big */ - output().set_lamp_value(4, (data >> 4) & 1); /* Bet-B / D-Up */ - output().set_lamp_value(5, (data >> 5) & 1); /* Take / Stop 1 */ + m_lamp[0] = BIT(data, 0); /* Bet-A / Stop 2 */ + m_lamp[1] = BIT(data, 1); /* Start / Stop All */ + m_lamp[2] = BIT(data, 2); /* Info / Small / Stop 3 */ + m_lamp[3] = BIT(data, 3); /* Big */ + m_lamp[4] = BIT(data, 4); /* Bet-B / D-Up */ + m_lamp[5] = BIT(data, 5); /* Take / Stop 1 */ } WRITE8_MEMBER(unkch_state::unkcm_0x03_w) diff --git a/src/mame/drivers/gottlieb.cpp b/src/mame/drivers/gottlieb.cpp index 59922784dce..5cd9c92b59b 100644 --- a/src/mame/drivers/gottlieb.cpp +++ b/src/mame/drivers/gottlieb.cpp @@ -223,6 +223,7 @@ VBlank duration: 1/VSYNC * (16/256) = 1017.6 us void gottlieb_state::machine_start() { + m_led.resolve(); /* register for save states */ save_item(NAME(m_joystick_select)); save_item(NAME(m_track)); @@ -327,9 +328,9 @@ WRITE8_MEMBER(gottlieb_state::reactor_output_w) { general_output_w(space, offset, data & ~0xe0); - output().set_led_value(0, data & 0x20); - output().set_led_value(1, data & 0x40); - output().set_led_value(2, data & 0x80); + m_led[0] = BIT(data, 5); + m_led[1] = BIT(data, 6); + m_led[2] = BIT(data, 7); } WRITE8_MEMBER(gottlieb_state::qbert_output_w) diff --git a/src/mame/drivers/harddriv.cpp b/src/mame/drivers/harddriv.cpp index 4a826e50177..8eb20c3d6a9 100644 --- a/src/mame/drivers/harddriv.cpp +++ b/src/mame/drivers/harddriv.cpp @@ -361,6 +361,7 @@ harddriv_state::harddriv_state(const machine_config &mconfig, device_type type, m_screen(*this, "screen"), m_duartn68681(*this, "duartn68681"), m_adc8(*this, "adc8"), + m_lamp(*this, "lamp%u", 0U), m_hd34010_host_access(0), m_msp_ram(*this, "msp_ram"), m_dsk_ram(nullptr), diff --git a/src/mame/drivers/igs009.cpp b/src/mame/drivers/igs009.cpp index f9b2b3d7a72..ae79c30e21b 100644 --- a/src/mame/drivers/igs009.cpp +++ b/src/mame/drivers/igs009.cpp @@ -42,44 +42,21 @@ class igs009_state : public driver_device { public: igs009_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen"), - m_palette(*this, "palette"), - m_bg_scroll(*this, "bg_scroll"), - m_reel1_ram(*this, "reel1_ram"), - m_reel2_ram(*this, "reel2_ram"), - m_reel3_ram(*this, "reel3_ram"), - m_reel4_ram(*this, "reel4_ram"), - m_bg_scroll2(*this, "bg_scroll2"), - m_fg_tile_ram(*this, "fg_tile_ram"), - m_fg_color_ram(*this, "fg_color_ram") { } - - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_screen; - required_device m_palette; - - required_shared_ptr m_bg_scroll; - required_shared_ptr m_reel1_ram; - required_shared_ptr m_reel2_ram; - required_shared_ptr m_reel3_ram; - required_shared_ptr m_reel4_ram; - required_shared_ptr m_bg_scroll2; - required_shared_ptr m_fg_tile_ram; - required_shared_ptr m_fg_color_ram; - - tilemap_t *m_reel1_tilemap; - tilemap_t *m_reel2_tilemap; - tilemap_t *m_reel3_tilemap; - tilemap_t *m_reel4_tilemap; - tilemap_t *m_fg_tilemap; - int m_video_enable; - int m_nmi_enable; - int m_hopper; - uint8_t m_out[3]; - uint8_t m_igs_magic[2]; + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_gfxdecode(*this, "gfxdecode") + , m_screen(*this, "screen") + , m_palette(*this, "palette") + , m_bg_scroll(*this, "bg_scroll") + , m_reel1_ram(*this, "reel1_ram") + , m_reel2_ram(*this, "reel2_ram") + , m_reel3_ram(*this, "reel3_ram") + , m_reel4_ram(*this, "reel4_ram") + , m_bg_scroll2(*this, "bg_scroll2") + , m_fg_tile_ram(*this, "fg_tile_ram") + , m_fg_color_ram(*this, "fg_color_ram") + , m_led(*this, "led%u", 0U) + { } DECLARE_WRITE8_MEMBER(reel1_ram_w); DECLARE_WRITE8_MEMBER(reel2_ram_w); @@ -112,9 +89,6 @@ public: void init_jingbell(); void init_jingbelli(); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; DECLARE_VIDEO_START(gp98); uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); @@ -123,6 +97,37 @@ public: void gp98_portmap(address_map &map); void jingbell_map(address_map &map); void jingbell_portmap(address_map &map); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_screen; + required_device m_palette; + + required_shared_ptr m_bg_scroll; + required_shared_ptr m_reel1_ram; + required_shared_ptr m_reel2_ram; + required_shared_ptr m_reel3_ram; + required_shared_ptr m_reel4_ram; + required_shared_ptr m_bg_scroll2; + required_shared_ptr m_fg_tile_ram; + required_shared_ptr m_fg_color_ram; + output_finder<7> m_led; + + tilemap_t *m_reel1_tilemap; + tilemap_t *m_reel2_tilemap; + tilemap_t *m_reel3_tilemap; + tilemap_t *m_reel4_tilemap; + tilemap_t *m_fg_tilemap; + int m_video_enable; + int m_nmi_enable; + int m_hopper; + uint8_t m_out[3]; + uint8_t m_igs_magic[2]; }; @@ -403,7 +408,7 @@ WRITE8_MEMBER(igs009_state::nmi_and_coins_w) machine().bookkeeping().coin_counter_w(2, data & 0x08); // key in machine().bookkeeping().coin_counter_w(3, data & 0x10); // coin out mech - output().set_led_value(6, data & 0x40); // led for coin out / m_hopper active + m_led[6] = BIT(data, 6); // led for coin out / m_hopper active m_nmi_enable = data; // data & 0x80 // nmi enable? @@ -413,8 +418,8 @@ WRITE8_MEMBER(igs009_state::nmi_and_coins_w) WRITE8_MEMBER(igs009_state::video_and_leds_w) { - output().set_led_value(4, data & 0x01); // start? - output().set_led_value(5, data & 0x04); // l_bet? + m_led[4] = BIT(data, 0); // start? + m_led[5] = BIT(data, 2); // l_bet? m_video_enable = data & 0x40; m_hopper = (~data)& 0x80; @@ -425,10 +430,10 @@ WRITE8_MEMBER(igs009_state::video_and_leds_w) WRITE8_MEMBER(igs009_state::leds_w) { - output().set_led_value(0, data & 0x01); // stop_1 - output().set_led_value(1, data & 0x02); // stop_2 - output().set_led_value(2, data & 0x04); // stop_3 - output().set_led_value(3, data & 0x08); // stop + m_led[0] = BIT(data, 0); // stop_1 + m_led[1] = BIT(data, 1); // stop_2 + m_led[2] = BIT(data, 2); // stop_3 + m_led[3] = BIT(data, 3); // stop // data & 0x10? m_out[2] = data; @@ -796,6 +801,9 @@ GFXDECODE_END void igs009_state::machine_start() { + m_led.resolve(); + + save_item(NAME(m_video_enable)); save_item(NAME(m_nmi_enable)); save_item(NAME(m_hopper)); diff --git a/src/mame/drivers/igspoker.cpp b/src/mame/drivers/igspoker.cpp index 736fbc20eb7..d78f2520ecd 100644 --- a/src/mame/drivers/igspoker.cpp +++ b/src/mame/drivers/igspoker.cpp @@ -83,29 +83,17 @@ class igspoker_state : public driver_device { public: igspoker_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_bg_tile_ram(*this, "bg_tile_ram"), - m_fg_tile_ram(*this, "fg_tile_ram"), - m_fg_color_ram(*this, "fg_color_ram"), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen"), - m_palette(*this, "palette"){ } - - required_device m_maincpu; - optional_shared_ptr m_bg_tile_ram; - required_shared_ptr m_fg_tile_ram; - required_shared_ptr m_fg_color_ram; - required_device m_gfxdecode; - required_device m_screen; - required_device m_palette; - int m_nmi_enable; - int m_bg_enable; - int m_hopper; - tilemap_t *m_fg_tilemap; - tilemap_t *m_bg_tilemap; - uint8_t m_out[3]; - uint8_t m_protection_res; + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_bg_tile_ram(*this, "bg_tile_ram") + , m_fg_tile_ram(*this, "fg_tile_ram") + , m_fg_color_ram(*this, "fg_color_ram") + , m_gfxdecode(*this, "gfxdecode") + , m_screen(*this, "screen") + , m_palette(*this, "palette") + , m_led(*this, "led0") + , m_lamp(*this, "lamp%u", 0U) + { } DECLARE_READ8_MEMBER(igs_irqack_r); DECLARE_WRITE8_MEMBER(igs_irqack_w); @@ -132,8 +120,6 @@ public: void init_kungfu(); TILE_GET_INFO_MEMBER(get_bg_tile_info); TILE_GET_INFO_MEMBER(get_fg_tile_info); - virtual void machine_reset() override; - virtual void video_start() override; DECLARE_VIDEO_START(cpokerpk); uint32_t screen_update_igs_video(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); uint32_t screen_update_cpokerpk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); @@ -149,6 +135,28 @@ public: void igspoker_io_map(address_map &map); void igspoker_prg_map(address_map &map); void number10_io_map(address_map &map); + +protected: + virtual void machine_start() override { m_led.resolve(); m_lamp.resolve(); } + virtual void machine_reset() override; + virtual void video_start() override; + + required_device m_maincpu; + optional_shared_ptr m_bg_tile_ram; + required_shared_ptr m_fg_tile_ram; + required_shared_ptr m_fg_color_ram; + required_device m_gfxdecode; + required_device m_screen; + required_device m_palette; + output_finder<> m_led; + output_finder<7> m_lamp; + int m_nmi_enable; + int m_bg_enable; + int m_hopper; + tilemap_t *m_fg_tilemap; + tilemap_t *m_bg_tilemap; + uint8_t m_out[3]; + uint8_t m_protection_res; }; @@ -265,7 +273,7 @@ WRITE8_MEMBER(igspoker_state::igs_nmi_and_coins_w) machine().bookkeeping().coin_counter_w(2, data & 0x08); // key in machine().bookkeeping().coin_counter_w(3, data & 0x10); // coin m_out mech - output().set_led_value(6, data & 0x20); // led for coin m_out / m_hopper active + m_led = BIT(data, 5); // led for coin m_out / m_hopper active m_nmi_enable = data & 0x80; // nmi enable? #if VERBOSE @@ -303,12 +311,12 @@ WRITE8_MEMBER(igspoker_state::igs_lamps_w) ---x ---- Hold5 lamp. xx-- ---- one pulse once bet amount allows start. */ - output().set_lamp_value(1, (data >> 1) & 1); /* Lamp 1 - HOLD 1 */ - output().set_lamp_value(2, (data >> 5) & 1); /* Lamp 2 - HOLD 2 */ - output().set_lamp_value(3, (data >> 4) & 1); /* Lamp 3 - HOLD 3 */ - output().set_lamp_value(4, (data >> 3) & 1); /* Lamp 4 - HOLD 4 */ - output().set_lamp_value(5, (data >> 2) & 1); /* Lamp 5 - HOLD 5 */ - output().set_lamp_value(6, (data & 1)); /* Lamp 6 - START */ + m_lamp[1] = BIT(data, 1); /* Lamp 1 - HOLD 1 */ + m_lamp[2] = BIT(data, 5); /* Lamp 2 - HOLD 2 */ + m_lamp[3] = BIT(data, 4); /* Lamp 3 - HOLD 3 */ + m_lamp[4] = BIT(data, 3); /* Lamp 4 - HOLD 4 */ + m_lamp[5] = BIT(data, 2); /* Lamp 5 - HOLD 5 */ + m_lamp[6] = BIT(data, 0); /* Lamp 6 - START */ m_hopper = (~data)& 0x80; diff --git a/src/mame/drivers/isbc.cpp b/src/mame/drivers/isbc.cpp index fd2111aa35c..c84c0dafbe6 100644 --- a/src/mame/drivers/isbc.cpp +++ b/src/mame/drivers/isbc.cpp @@ -37,31 +37,19 @@ class isbc_state : public driver_device { public: isbc_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_uart8251(*this, "uart8251"), - m_uart8274(*this, "uart8274"), - m_pic_0(*this, "pic_0"), - m_pic_1(*this, "pic_1"), - m_centronics(*this, "centronics"), - m_cent_status_in(*this, "cent_status_in"), - m_statuslatch(*this, "statuslatch"), - m_bios(*this, "user1"), - m_biosram(*this, "biosram") - { - } - - required_device m_maincpu; - optional_device m_uart8251; -// optional_device m_uart8274; - optional_device m_uart8274; - required_device m_pic_0; - optional_device m_pic_1; - optional_device m_centronics; - optional_device m_cent_status_in; - optional_device m_statuslatch; - optional_memory_region m_bios; - optional_shared_ptr m_biosram; + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_uart8251(*this, "uart8251") + , m_uart8274(*this, "uart8274") + , m_pic_0(*this, "pic_0") + , m_pic_1(*this, "pic_1") + , m_centronics(*this, "centronics") + , m_cent_status_in(*this, "cent_status_in") + , m_statuslatch(*this, "statuslatch") + , m_bios(*this, "user1") + , m_biosram(*this, "biosram") + , m_led(*this, "led%u", 0U) + { } DECLARE_WRITE_LINE_MEMBER(write_centronics_ack); @@ -99,7 +87,22 @@ public: void rpc86_io(address_map &map); void rpc86_mem(address_map &map); protected: - void machine_reset() override; + virtual void machine_start() override { m_led.resolve(); } + virtual void machine_reset() override; + + required_device m_maincpu; + optional_device m_uart8251; +// optional_device m_uart8274; + optional_device m_uart8274; + required_device m_pic_0; + optional_device m_pic_1; + optional_device m_centronics; + optional_device m_cent_status_in; + optional_device m_statuslatch; + optional_memory_region m_bios; + optional_shared_ptr m_biosram; + output_finder<2> m_led; + private: bool m_upperen; offs_t m_megabyte_page; @@ -337,12 +340,12 @@ WRITE_LINE_MEMBER(isbc_state::bus_intr_out2_w) WRITE_LINE_MEMBER(isbc_state::led_ds1_w) { - machine().output().set_led_value(0, !state); + m_led[0] = state ? 0 : 1; } WRITE_LINE_MEMBER(isbc_state::led_ds3_w) { - machine().output().set_led_value(1, !state); + m_led[1] = state ? 0 : 1; } WRITE_LINE_MEMBER(isbc_state::megabyte_select_w) diff --git a/src/mame/drivers/itech32.cpp b/src/mame/drivers/itech32.cpp index d6b2b620300..529797d2f6f 100644 --- a/src/mame/drivers/itech32.cpp +++ b/src/mame/drivers/itech32.cpp @@ -448,6 +448,7 @@ WRITE16_MEMBER(itech32_state::int1_ack_w) void itech32_state::machine_start() { membank("soundbank")->configure_entries(0, 256, memregion("soundcpu")->base() + 0x10000, 0x4000); + m_led.resolve(); save_item(NAME(m_vint_state)); save_item(NAME(m_xint_state)); @@ -741,9 +742,9 @@ WRITE8_MEMBER(itech32_state::drivedge_portb_out) /* bit 4 controls the ticket dispenser */ /* bit 5 controls the coin counter */ /* bit 6 controls the diagnostic sound LED */ - output().set_led_value(1, BIT(data, 0)); - output().set_led_value(2, BIT(data, 1)); - output().set_led_value(3, BIT(data, 2)); + m_led[1] = BIT(data, 0); + m_led[2] = BIT(data, 1); + m_led[3] = BIT(data, 2); m_ticket->motor_w(BIT(data, 4)); machine().bookkeeping().coin_counter_w(0, BIT(data, 5)); } @@ -751,7 +752,7 @@ WRITE8_MEMBER(itech32_state::drivedge_portb_out) WRITE_LINE_MEMBER(itech32_state::drivedge_turbo_light) { - output().set_led_value(0, state); + m_led[0] = state ? 1 : 0; } diff --git a/src/mame/drivers/jackie.cpp b/src/mame/drivers/jackie.cpp index 199fa905b2b..7d4cf919578 100644 --- a/src/mame/drivers/jackie.cpp +++ b/src/mame/drivers/jackie.cpp @@ -58,43 +58,21 @@ class jackie_state : public driver_device { public: jackie_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this,"maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen"), - m_palette(*this, "palette"), - m_bg_scroll2(*this, "bg_scroll2"), - m_bg_scroll(*this, "bg_scroll"), - m_reel1_ram(*this, "reel1_ram"), - m_reel2_ram(*this, "reel2_ram"), - m_reel3_ram(*this, "reel3_ram"), - m_fg_tile_ram(*this, "fg_tile_ram"), - m_fg_color_ram(*this, "fg_color_ram") { } - - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_screen; - required_device m_palette; - - required_shared_ptr m_bg_scroll2; - required_shared_ptr m_bg_scroll; - required_shared_ptr m_reel1_ram; - required_shared_ptr m_reel2_ram; - required_shared_ptr m_reel3_ram; - required_shared_ptr m_fg_tile_ram; - required_shared_ptr m_fg_color_ram; - - int m_exp_bank; - tilemap_t *m_fg_tilemap; - tilemap_t *m_reel1_tilemap; - tilemap_t *m_reel2_tilemap; - tilemap_t *m_reel3_tilemap; - int m_irq_enable; - int m_nmi_enable; - int m_bg_enable; - int m_hopper; - uint8_t m_out[3]; - uint16_t m_unk_reg[3][5]; + : driver_device(mconfig, type, tag) + , m_maincpu(*this,"maincpu") + , m_gfxdecode(*this, "gfxdecode") + , m_screen(*this, "screen") + , m_palette(*this, "palette") + , m_bg_scroll2(*this, "bg_scroll2") + , m_bg_scroll(*this, "bg_scroll") + , m_reel1_ram(*this, "reel1_ram") + , m_reel2_ram(*this, "reel2_ram") + , m_reel3_ram(*this, "reel3_ram") + , m_fg_tile_ram(*this, "fg_tile_ram") + , m_fg_color_ram(*this, "fg_color_ram") + , m_led(*this, "led") + , m_lamp(*this, "lamp%u", 0U) + { } DECLARE_WRITE8_MEMBER(fg_tile_w); DECLARE_WRITE8_MEMBER(fg_color_w); @@ -126,15 +104,44 @@ public: TILE_GET_INFO_MEMBER(get_reel3_tile_info); void init_jackie(); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_DEVICE_CALLBACK_MEMBER(irq); void jackie(machine_config &config); void jackie_io_map(address_map &map); void jackie_prg_map(address_map &map); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_screen; + required_device m_palette; + + required_shared_ptr m_bg_scroll2; + required_shared_ptr m_bg_scroll; + required_shared_ptr m_reel1_ram; + required_shared_ptr m_reel2_ram; + required_shared_ptr m_reel3_ram; + required_shared_ptr m_fg_tile_ram; + required_shared_ptr m_fg_color_ram; + output_finder<> m_led; + output_finder<7> m_lamp; + + int m_exp_bank; + tilemap_t *m_fg_tilemap; + tilemap_t *m_reel1_tilemap; + tilemap_t *m_reel2_tilemap; + tilemap_t *m_reel3_tilemap; + int m_irq_enable; + int m_nmi_enable; + int m_bg_enable; + int m_hopper; + uint8_t m_out[3]; + uint16_t m_unk_reg[3][5]; }; @@ -271,6 +278,9 @@ uint32_t jackie_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap void jackie_state::machine_start() { + m_led.resolve(); + m_lamp.resolve(); + save_item(NAME(m_exp_bank)); // save_item(NAME(m_irq_enable)); //always 1? save_item(NAME(m_nmi_enable)); @@ -330,7 +340,7 @@ WRITE8_MEMBER(jackie_state::nmi_and_coins_w) machine().bookkeeping().coin_counter_w(2, data & 0x08); // key in machine().bookkeeping().coin_counter_w(3, data & 0x10); // coin m_out mech - output().set_led_value(6, data & 0x20); // led for coin m_out / m_hopper active + m_led = BIT(data, 5); // led for coin m_out / m_hopper active m_exp_bank = (data & 0x02) ? 1 : 0; // expram bank number m_nmi_enable = data & 0x80; // nmi enable? @@ -352,12 +362,12 @@ WRITE8_MEMBER(jackie_state::lamps_w) ---- -x-- Hold5 lamp. ---- ---x Start lamp. */ - output().set_lamp_value(1, (data >> 1) & 1); /* Lamp 1 - HOLD 1 */ - output().set_lamp_value(2, (data >> 5) & 1); /* Lamp 2 - HOLD 2 */ - output().set_lamp_value(3, (data >> 4) & 1); /* Lamp 3 - HOLD 3 */ - output().set_lamp_value(4, (data >> 3) & 1); /* Lamp 4 - HOLD 4 */ - output().set_lamp_value(5, (data >> 2) & 1); /* Lamp 5 - HOLD 5 */ - output().set_lamp_value(6, (data & 1)); /* Lamp 6 - START */ + m_lamp[1] = BIT(data, 1); /* Lamp 1 - HOLD 1 */ + m_lamp[2] = BIT(data, 5); /* Lamp 2 - HOLD 2 */ + m_lamp[3] = BIT(data, 4); /* Lamp 3 - HOLD 3 */ + m_lamp[4] = BIT(data, 3); /* Lamp 4 - HOLD 4 */ + m_lamp[5] = BIT(data, 2); /* Lamp 5 - HOLD 5 */ + m_lamp[6] = BIT(data, 0); /* Lamp 6 - START */ m_hopper = (~data)& 0x80; diff --git a/src/mame/drivers/jpmimpct.cpp b/src/mame/drivers/jpmimpct.cpp index c88b3a3a831..5ac682f9b23 100644 --- a/src/mame/drivers/jpmimpct.cpp +++ b/src/mame/drivers/jpmimpct.cpp @@ -516,7 +516,7 @@ void jpmimpct_state::jpm_draw_lamps(int data, int lamp_strobe) for (i=0; i<16; i++) { m_Lamps[16*(m_lamp_strobe+i)] = data & 1; - output().set_lamp_value((16*lamp_strobe)+i, (m_Lamps[(16*lamp_strobe)+i])); + m_lamp_output[(16*lamp_strobe)+i] = m_Lamps[(16*lamp_strobe)+i]; data = data >> 1; } } diff --git a/src/mame/drivers/jubilee.cpp b/src/mame/drivers/jubilee.cpp index 522674440b0..b5e5e815892 100644 --- a/src/mame/drivers/jubilee.cpp +++ b/src/mame/drivers/jubilee.cpp @@ -207,32 +207,39 @@ class jubilee_state : public driver_device { public: - jubilee_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + jubilee_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_videoram(*this, "videoworkram"), m_colorram(*this, "colorram"), m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode") { } + m_gfxdecode(*this, "gfxdecode"), + m_lamp(*this, "lamp%u", 0U) + { } - uint8_t mux_sel; - uint8_t muxlamps; - - required_shared_ptr m_videoram; - required_shared_ptr m_colorram; - tilemap_t *m_bg_tilemap; DECLARE_WRITE8_MEMBER(jubileep_videoram_w); DECLARE_WRITE8_MEMBER(jubileep_colorram_w); DECLARE_WRITE8_MEMBER(unk_w); DECLARE_READ8_MEMBER(mux_port_r); TILE_GET_INFO_MEMBER(get_bg_tile_info); - virtual void video_start() override; uint32_t screen_update_jubileep(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(jubileep_interrupt); - required_device m_maincpu; - required_device m_gfxdecode; void jubileep(machine_config &config); void jubileep_cru_map(address_map &map); void jubileep_map(address_map &map); + +protected: + virtual void machine_start() override { m_lamp.resolve(); } + virtual void video_start() override; + + uint8_t mux_sel; + uint8_t muxlamps; + + required_shared_ptr m_videoram; + required_shared_ptr m_colorram; + tilemap_t *m_bg_tilemap; + required_device m_maincpu; + required_device m_gfxdecode; + output_finder<9> m_lamp; }; @@ -411,19 +418,19 @@ WRITE8_MEMBER(jubilee_state::unk_w) { if (muxlamps == 1) { - output().set_lamp_value(0, (data & 1)); /* lamp */ + m_lamp[0] = BIT(data, 0); /* lamp */ logerror("CRU: LAAAAAAMP 0 write to address %04x: %d\n", offset<<1, data & 1); // popmessage("LAMP 0"); } if (muxlamps == 2) { - output().set_lamp_value(3, (data & 1)); /* lamp */ + m_lamp[3] = BIT(data, 0); /* lamp */ logerror("CRU: LAAAAAAMP 3 write to address %04x: %d\n", offset<<1, data & 1); // popmessage("LAMP 3"); } if (muxlamps == 3) { - output().set_lamp_value(6, (data & 1)); /* lamp */ + m_lamp[6] = BIT(data, 0); /* lamp */ logerror("CRU: LAAAAAAMP 6 write to address %04x: %d\n", offset<<1, data & 1); // popmessage("LAMP 6"); } @@ -433,19 +440,19 @@ WRITE8_MEMBER(jubilee_state::unk_w) { if (muxlamps == 1) { - output().set_lamp_value(1, (data & 1)); /* lamp */ + m_lamp[1] = BIT(data, 0); /* lamp */ logerror("CRU: LAAAAAAMP 1 write to address %04x: %d\n", offset<<1, data & 1); // popmessage("LAMP 1"); } if (muxlamps == 2) { - output().set_lamp_value(4, (data & 1)); /* lamp */ + m_lamp[4] = BIT(data, 0); /* lamp */ logerror("CRU: LAAAAAAMP 4 write to address %04x: %d\n", offset<<1, data & 1); // popmessage("LAMP 4"); } if (muxlamps == 3) { - output().set_lamp_value(7, (data & 1)); /* lamp */ + m_lamp[7] = BIT(data, 0); /* lamp */ logerror("CRU: LAAAAAAMP 7 write to address %04x: %d\n", offset<<1, data & 1); // popmessage("LAMP 7"); } @@ -455,19 +462,19 @@ WRITE8_MEMBER(jubilee_state::unk_w) { if (muxlamps == 1) { - output().set_lamp_value(2, (data & 1)); /* lamp */ + m_lamp[2] = BIT(data, 0); /* lamp */ logerror("CRU: LAAAAAAMP 2 write to address %04x: %d\n", offset<<1, data & 1); // popmessage("LAMP 2"); } if (muxlamps == 2) { - output().set_lamp_value(5, (data & 1)); /* lamp */ + m_lamp[5] = BIT(data, 0); /* lamp */ logerror("CRU: LAAAAAAMP 5 write to address %04x: %d\n", offset<<1, data & 1); // popmessage("LAMP 5"); } if (muxlamps == 3) { - output().set_lamp_value(8, (data & 1)); /* lamp */ + m_lamp[8] = BIT(data, 0); /* lamp */ logerror("CRU: LAAAAAAMP 8 write to address %04x: %d\n", offset<<1, data & 1); // popmessage("LAMP 8"); } diff --git a/src/mame/drivers/kas89.cpp b/src/mame/drivers/kas89.cpp index 675df3ddd29..b78e750ebee 100644 --- a/src/mame/drivers/kas89.cpp +++ b/src/mame/drivers/kas89.cpp @@ -208,8 +208,8 @@ class kas89_state : public driver_device { public: - kas89_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + kas89_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), m_v9938(*this, "v9938"), @@ -222,9 +222,31 @@ public: m_pl6(*this, "PL6"), m_svc(*this, "SVC"), m_dsw(*this, "DSW"), - m_unk(*this, "UNK") + m_unk(*this, "UNK"), + m_lamp(*this, "lamp%u", 0U) { } + DECLARE_WRITE8_MEMBER(mux_w); + DECLARE_READ8_MEMBER(mux_r); + DECLARE_WRITE8_MEMBER(control_w); + DECLARE_WRITE8_MEMBER(sound_comm_w); + DECLARE_WRITE8_MEMBER(int_ack_w); + DECLARE_WRITE8_MEMBER(led_mux_data_w); + DECLARE_WRITE8_MEMBER(led_mux_select_w); + void init_kas89(); + TIMER_DEVICE_CALLBACK_MEMBER(kas89_nmi_cb); + TIMER_DEVICE_CALLBACK_MEMBER(kas89_sound_nmi_cb); + void kas89(machine_config &config); + void audio_io(address_map &map); + void audio_map(address_map &map); + void kas89_io(address_map &map); + void kas89_map(address_map &map); + + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + uint8_t m_mux_data; uint8_t m_main_nmi_enable; @@ -245,24 +267,7 @@ public: required_ioport m_svc; required_ioport m_dsw; required_ioport m_unk; - - DECLARE_WRITE8_MEMBER(mux_w); - DECLARE_READ8_MEMBER(mux_r); - DECLARE_WRITE8_MEMBER(control_w); - DECLARE_WRITE8_MEMBER(sound_comm_w); - DECLARE_WRITE8_MEMBER(int_ack_w); - DECLARE_WRITE8_MEMBER(led_mux_data_w); - DECLARE_WRITE8_MEMBER(led_mux_select_w); - void init_kas89(); - virtual void machine_start() override; - virtual void machine_reset() override; - TIMER_DEVICE_CALLBACK_MEMBER(kas89_nmi_cb); - TIMER_DEVICE_CALLBACK_MEMBER(kas89_sound_nmi_cb); - void kas89(machine_config &config); - void audio_io(address_map &map); - void audio_map(address_map &map); - void kas89_io(address_map &map); - void kas89_map(address_map &map); + output_finder<37> m_lamp; }; @@ -272,7 +277,8 @@ public: void kas89_state::machine_start() { - output().set_lamp_value(37, 0); /* turning off the operator led */ + m_lamp.resolve(); + m_lamp[37] = 0; /* turning off the operator led */ } void kas89_state::machine_reset() @@ -309,7 +315,7 @@ READ8_MEMBER(kas89_state::mux_r) case 0x20: return m_pl6->read(); case 0x40: { - output().set_lamp_value(37, 1 - ((m_svc->read() >> 5) & 1)); /* Operator Key LAMP */ + m_lamp[37] = BIT(~m_svc->read(), 5); /* Operator Key LAMP */ return m_svc->read(); } case 0x80: return m_dsw->read(); /* Polled at $162a through NMI routine */ @@ -375,7 +381,7 @@ WRITE8_MEMBER(kas89_state::sound_comm_w) uint8_t i; for ( i = 0; i < 37; i++ ) { - output().set_lamp_value(i, 0); /* All roulette LEDs OFF */ + m_lamp[i] = 0; /* All roulette LEDs OFF */ } } @@ -421,7 +427,7 @@ WRITE8_MEMBER(kas89_state::led_mux_select_w) uint8_t i; for ( i = 0; i < 37; i++ ) { - output().set_lamp_value(i, 0); /* All LEDs OFF */ + m_lamp[i] = 0; /* All LEDs OFF */ } switch(data) @@ -430,69 +436,69 @@ WRITE8_MEMBER(kas89_state::led_mux_select_w) { for ( i = 0; i < 37; i++ ) { - output().set_lamp_value(i, 0); /* All LEDs OFF */ + m_lamp[i] = 0; /* All LEDs OFF */ } } case 0x01: { - output().set_lamp_value(11, (m_leds_mux_data >> 0) & 1); /* Number 11 LED */ - output().set_lamp_value(36, (m_leds_mux_data >> 1) & 1); /* Number 36 LED */ - output().set_lamp_value(13, (m_leds_mux_data >> 2) & 1); /* Number 13 LED */ - output().set_lamp_value(27, (m_leds_mux_data >> 3) & 1); /* Number 27 LED */ - output().set_lamp_value(06, (m_leds_mux_data >> 4) & 1); /* Number 6 LED */ - output().set_lamp_value(34, (m_leds_mux_data >> 5) & 1); /* Number 34 LED */ - output().set_lamp_value(17, (m_leds_mux_data >> 6) & 1); /* Number 17 LED */ - output().set_lamp_value(25, (m_leds_mux_data >> 7) & 1); /* Number 25 LED */ + m_lamp[11] = BIT(m_leds_mux_data, 0); /* Number 11 LED */ + m_lamp[36] = BIT(m_leds_mux_data, 1); /* Number 36 LED */ + m_lamp[13] = BIT(m_leds_mux_data, 2); /* Number 13 LED */ + m_lamp[27] = BIT(m_leds_mux_data, 3); /* Number 27 LED */ + m_lamp[06] = BIT(m_leds_mux_data, 4); /* Number 6 LED */ + m_lamp[34] = BIT(m_leds_mux_data, 5); /* Number 34 LED */ + m_lamp[17] = BIT(m_leds_mux_data, 6); /* Number 17 LED */ + m_lamp[25] = BIT(m_leds_mux_data, 7); /* Number 25 LED */ break; } case 0x02: { - output().set_lamp_value( 2, (m_leds_mux_data >> 0) & 1); /* Number 2 LED */ - output().set_lamp_value(21, (m_leds_mux_data >> 1) & 1); /* Number 21 LED */ - output().set_lamp_value( 4, (m_leds_mux_data >> 2) & 1); /* Number 4 LED */ - output().set_lamp_value(19, (m_leds_mux_data >> 3) & 1); /* Number 19 LED */ - output().set_lamp_value(15, (m_leds_mux_data >> 4) & 1); /* Number 15 LED */ - output().set_lamp_value(32, (m_leds_mux_data >> 5) & 1); /* Number 32 LED */ - output().set_lamp_value( 0, (m_leds_mux_data >> 6) & 1); /* Number 0 LED */ - output().set_lamp_value(26, (m_leds_mux_data >> 7) & 1); /* Number 26 LED */ + m_lamp[ 2] = BIT(m_leds_mux_data, 0); /* Number 2 LED */ + m_lamp[21] = BIT(m_leds_mux_data, 1); /* Number 21 LED */ + m_lamp[ 4] = BIT(m_leds_mux_data, 2); /* Number 4 LED */ + m_lamp[19] = BIT(m_leds_mux_data, 3); /* Number 19 LED */ + m_lamp[15] = BIT(m_leds_mux_data, 4); /* Number 15 LED */ + m_lamp[32] = BIT(m_leds_mux_data, 5); /* Number 32 LED */ + m_lamp[ 0] = BIT(m_leds_mux_data, 6); /* Number 0 LED */ + m_lamp[26] = BIT(m_leds_mux_data, 7); /* Number 26 LED */ break; } case 0x04: { - output().set_lamp_value( 3, (m_leds_mux_data >> 0) & 1); /* Number 3 LED */ - output().set_lamp_value(35, (m_leds_mux_data >> 1) & 1); /* Number 35 LED */ - output().set_lamp_value(12, (m_leds_mux_data >> 2) & 1); /* Number 12 LED */ - output().set_lamp_value(28, (m_leds_mux_data >> 3) & 1); /* Number 28 LED */ - output().set_lamp_value( 7, (m_leds_mux_data >> 4) & 1); /* Number 7 LED */ - output().set_lamp_value(29, (m_leds_mux_data >> 5) & 1); /* Number 29 LED */ - output().set_lamp_value(18, (m_leds_mux_data >> 6) & 1); /* Number 18 LED */ + m_lamp[ 3] = BIT(m_leds_mux_data, 0); /* Number 3 LED */ + m_lamp[35] = BIT(m_leds_mux_data, 1); /* Number 35 LED */ + m_lamp[12] = BIT(m_leds_mux_data, 2); /* Number 12 LED */ + m_lamp[28] = BIT(m_leds_mux_data, 3); /* Number 28 LED */ + m_lamp[ 7] = BIT(m_leds_mux_data, 4); /* Number 7 LED */ + m_lamp[29] = BIT(m_leds_mux_data, 5); /* Number 29 LED */ + m_lamp[18] = BIT(m_leds_mux_data, 6); /* Number 18 LED */ break; } case 0x08: { - output().set_lamp_value(22, (m_leds_mux_data >> 0) & 1); /* Number 22 LED */ - output().set_lamp_value( 9, (m_leds_mux_data >> 1) & 1); /* Number 9 LED */ - output().set_lamp_value(31, (m_leds_mux_data >> 2) & 1); /* Number 31 LED */ - output().set_lamp_value(14, (m_leds_mux_data >> 3) & 1); /* Number 14 LED */ - output().set_lamp_value(20, (m_leds_mux_data >> 4) & 1); /* Number 20 LED */ - output().set_lamp_value( 1, (m_leds_mux_data >> 5) & 1); /* Number 1 LED */ - output().set_lamp_value(33, (m_leds_mux_data >> 6) & 1); /* Number 33 LED */ + m_lamp[22] = BIT(m_leds_mux_data, 0); /* Number 22 LED */ + m_lamp[ 9] = BIT(m_leds_mux_data, 1); /* Number 9 LED */ + m_lamp[31] = BIT(m_leds_mux_data, 2); /* Number 31 LED */ + m_lamp[14] = BIT(m_leds_mux_data, 3); /* Number 14 LED */ + m_lamp[20] = BIT(m_leds_mux_data, 4); /* Number 20 LED */ + m_lamp[ 1] = BIT(m_leds_mux_data, 5); /* Number 1 LED */ + m_lamp[33] = BIT(m_leds_mux_data, 6); /* Number 33 LED */ break; } case 0x10: { - output().set_lamp_value(16, (m_leds_mux_data >> 0) & 1); /* Number 16 LED */ - output().set_lamp_value(24, (m_leds_mux_data >> 1) & 1); /* Number 24 LED */ - output().set_lamp_value( 5, (m_leds_mux_data >> 2) & 1); /* Number 5 LED */ - output().set_lamp_value(10, (m_leds_mux_data >> 3) & 1); /* Number 10 LED */ - output().set_lamp_value(23, (m_leds_mux_data >> 4) & 1); /* Number 23 LED */ - output().set_lamp_value( 8, (m_leds_mux_data >> 5) & 1); /* Number 8 LED */ - output().set_lamp_value(30, (m_leds_mux_data >> 6) & 1); /* Number 30 LED */ + m_lamp[16] = BIT(m_leds_mux_data, 0); /* Number 16 LED */ + m_lamp[24] = BIT(m_leds_mux_data, 1); /* Number 24 LED */ + m_lamp[ 5] = BIT(m_leds_mux_data, 2); /* Number 5 LED */ + m_lamp[10] = BIT(m_leds_mux_data, 3); /* Number 10 LED */ + m_lamp[23] = BIT(m_leds_mux_data, 4); /* Number 23 LED */ + m_lamp[ 8] = BIT(m_leds_mux_data, 5); /* Number 8 LED */ + m_lamp[30] = BIT(m_leds_mux_data, 6); /* Number 30 LED */ break; } @@ -500,7 +506,7 @@ WRITE8_MEMBER(kas89_state::led_mux_select_w) { for ( i = 0; i < 37; i++ ) { - output().set_lamp_value(i, 1); /* All LEDs ON */ + m_lamp[i] = 1; /* All LEDs ON */ } } } diff --git a/src/mame/drivers/kenseim.cpp b/src/mame/drivers/kenseim.cpp index 4d3fb7fd972..f2eb082396d 100644 --- a/src/mame/drivers/kenseim.cpp +++ b/src/mame/drivers/kenseim.cpp @@ -149,8 +149,8 @@ GND | 20 class kenseim_state : public cps_state { public: - kenseim_state(const machine_config &mconfig, device_type type, const char *tag) - : cps_state(mconfig, type, tag), + kenseim_state(const machine_config &mconfig, device_type type, const char *tag) : + cps_state(mconfig, type, tag), m_to_68k_cmd_low(0), m_to_68k_cmd_d9(0), m_to_68k_cmd_req(0), @@ -158,8 +158,8 @@ public: m_from68k_ack(0), m_from68k_st4(0), m_from68k_st3(0), - m_from68k_st2(0) - + m_from68k_st2(0), + m_lamp(*this, "lamp%u", 1U) { for (int i = 0; i < 6; i++) { @@ -224,35 +224,40 @@ public: WRITE8_MEMBER(mb8936_portb_w); // maybe molesb output? (6-bits?) WRITE8_MEMBER(mb8936_portf_w); // maybe strobe output? + + DECLARE_CUSTOM_INPUT_MEMBER(kenseim_cmd_1234_r); + DECLARE_CUSTOM_INPUT_MEMBER(kenseim_cmd_5678_r); + DECLARE_CUSTOM_INPUT_MEMBER(kenseim_cmd_9_r); + DECLARE_CUSTOM_INPUT_MEMBER(kenseim_cmd_req_r); + DECLARE_CUSTOM_INPUT_MEMBER(kenseim_cmd_LVm_r); + + void set_leds(uint32_t ledstates); + + void kenseim(machine_config &config); + void kenseim_io_map(address_map &map); + void kenseim_map(address_map &map); + +protected: + virtual void machine_start() override { cps_state::machine_start(); m_lamp.resolve(); } + +private: uint8_t m_to_68k_cmd_low; uint8_t m_to_68k_cmd_d9; uint8_t m_to_68k_cmd_req; uint8_t m_to_68k_cmd_LVm; - int m_from68k_ack; int m_from68k_st4; int m_from68k_st3; int m_from68k_st2; - - DECLARE_CUSTOM_INPUT_MEMBER(kenseim_cmd_1234_r); - DECLARE_CUSTOM_INPUT_MEMBER(kenseim_cmd_5678_r); - DECLARE_CUSTOM_INPUT_MEMBER(kenseim_cmd_9_r); - DECLARE_CUSTOM_INPUT_MEMBER(kenseim_cmd_req_r); - DECLARE_CUSTOM_INPUT_MEMBER(kenseim_cmd_LVm_r); - - void set_leds(uint32_t ledstates); int m_led_latch; int m_led_serial_data; int m_led_clock; int mole_state_a[6]; int mole_state_b[6]; - - void kenseim(machine_config &config); - void kenseim_io_map(address_map &map); - void kenseim_map(address_map &map); + output_finder<20> m_lamp; }; @@ -263,7 +268,7 @@ public: void kenseim_state::set_leds(uint32_t ledstates) { for (int i=0; i<20; i++) - output().set_lamp_value(i+1, ((ledstates & (1 << i)) != 0)); + m_lamp[i] = BIT(ledstates, i); } // could be wrong diff --git a/src/mame/drivers/konamigx.cpp b/src/mame/drivers/konamigx.cpp index a34811342e4..3971fd667bc 100644 --- a/src/mame/drivers/konamigx.cpp +++ b/src/mame/drivers/konamigx.cpp @@ -978,7 +978,7 @@ WRITE32_MEMBER(konamigx_state::type4_prot_w) // cabinet lamps for type 1 games WRITE32_MEMBER(konamigx_state::type1_cablamps_w) { - output().set_led_value(0, (data>>24)&1); + m_lamp = BIT(data, 24); } /**********************************************************************************/ @@ -3727,6 +3727,8 @@ ROM_END MACHINE_START_MEMBER(konamigx_state,konamigx) { + m_lamp.resolve(); + save_item(NAME(m_sound_ctrl)); save_item(NAME(m_sound_intck)); diff --git a/src/mame/drivers/kopunch.cpp b/src/mame/drivers/kopunch.cpp index 2055477e1a7..dd6e52f4405 100644 --- a/src/mame/drivers/kopunch.cpp +++ b/src/mame/drivers/kopunch.cpp @@ -117,7 +117,7 @@ READ8_MEMBER(kopunch_state::sensors2_r) WRITE8_MEMBER(kopunch_state::lamp_w) { - output().set_led_value(0, ~data & 0x80); + m_lamp = BIT(~data, 7); } WRITE8_MEMBER(kopunch_state::coin_w) @@ -222,6 +222,8 @@ GFXDECODE_END void kopunch_state::machine_start() { + m_lamp.resolve(); + // zerofill m_gfxbank = 0; m_scrollx = 0; diff --git a/src/mame/drivers/ksys573.cpp b/src/mame/drivers/ksys573.cpp index c8abab8703e..44dbbf5d0ed 100644 --- a/src/mame/drivers/ksys573.cpp +++ b/src/mame/drivers/ksys573.cpp @@ -376,29 +376,32 @@ class ksys573_state : public driver_device { public: ksys573_state( const machine_config &mconfig, device_type type, const char *tag ) : - driver_device( mconfig, type, tag ), - m_analog0(*this, "analog0" ), - m_analog1(*this, "analog1" ), - m_analog2(*this, "analog2" ), - m_analog3(*this, "analog3" ), - m_pads(*this, "PADS" ), - m_psxirq(*this, "maincpu:irq" ), - m_ata(*this, "ata" ), + driver_device(mconfig, type, tag), + m_pads(*this, "PADS"), + m_analog0(*this, "analog0"), + m_analog1(*this, "analog1"), + m_analog2(*this, "analog2"), + m_analog3(*this, "analog3"), + m_psxirq(*this, "maincpu:irq"), + m_ata(*this, "ata"), m_h8_response(*this, "h8_response"), - m_maincpu(*this, "maincpu" ), - m_ram(*this, "maincpu:ram" ), - m_flashbank(*this, "flashbank" ), - m_out1(*this, "OUT1" ), - m_out2(*this, "OUT2" ), - m_cd(*this, "CD" ), - m_upd4701(*this, "upd4701" ), - m_stage(*this, "STAGE" ), - m_gunx(*this, "GUNX" ), - m_sensor(*this, "SENSOR" ), - m_encoder(*this, "ENCODER" ), - m_gunmania_id(*this, "gunmania_id" ) - { - } + m_maincpu(*this, "maincpu"), + m_ram(*this, "maincpu:ram"), + m_flashbank(*this, "flashbank"), + m_out1(*this, "OUT1"), + m_out2(*this, "OUT2"), + m_cd(*this, "CD"), + m_upd4701(*this, "upd4701"), + m_stage(*this, "STAGE"), + m_gunx(*this, "GUNX"), + m_sensor(*this, "SENSOR"), + m_encoder(*this, "ENCODER"), + m_gunmania_id(*this, "gunmania_id"), + m_lamp(*this, "lamp%u", 0U) + { } + + double m_pad_position[ 6 ]; + optional_ioport m_pads; DECLARE_CUSTOM_INPUT_MEMBER( gn845pwbb_read ); DECLARE_CUSTOM_INPUT_MEMBER( gunmania_tank_shutter_sensor ); @@ -461,12 +464,6 @@ public: void cdrom_dma_read( uint32_t *ram, uint32_t n_address, int32_t n_size ); void cdrom_dma_write( uint32_t *ram, uint32_t n_address, int32_t n_size ); void sys573_vblank( screen_device &screen, bool vblank_state ); - double m_pad_position[ 6 ]; - required_ioport m_analog0; - required_ioport m_analog1; - required_ioport m_analog2; - required_ioport m_analog3; - optional_ioport m_pads; void gtfrk10mb(machine_config &config); void ddr(machine_config &config); @@ -530,8 +527,14 @@ public: void konami573a_map(address_map &map); void konami573d_map(address_map &map); protected: + virtual void machine_start() override { m_lamp.resolve(); } virtual void driver_start() override; + required_ioport m_analog0; + required_ioport m_analog1; + required_ioport m_analog2; + required_ioport m_analog3; + private: inline void ATTR_PRINTF( 3,4 ) verboselog( int n_level, const char *s_fmt, ... ); void update_disc(); @@ -598,6 +601,7 @@ private: optional_ioport m_sensor; optional_ioport m_encoder; optional_device m_gunmania_id; + output_finder<2> m_lamp; }; void ATTR_PRINTF( 3,4 ) ksys573_state::verboselog( int n_level, const char *s_fmt, ... ) @@ -1173,11 +1177,11 @@ WRITE8_MEMBER( ksys573_state::ddr_output_callback ) break; case 17: - output().set_led_value( 0, !data ); // start 1 + m_lamp[0] = data ? 0 : 1; // start 1 break; case 18: - output().set_led_value( 1, !data ); // start 2 + m_lamp[1] = data ? 0 : 1; // start 2 break; case 20: @@ -1229,12 +1233,12 @@ WRITE_LINE_MEMBER( ksys573_state::gtrfrks_lamps_b6 ) WRITE_LINE_MEMBER( ksys573_state::gtrfrks_lamps_b5 ) { - output().set_led_value( 0, state ); // start left + m_lamp[0] = state ? 1 : 0; // start left } WRITE_LINE_MEMBER( ksys573_state::gtrfrks_lamps_b4 ) { - output().set_led_value( 1, state ); // start right + m_lamp[1] = state ? 1 : 0; // start right } /* ddr solo */ @@ -1271,7 +1275,7 @@ WRITE8_MEMBER( ksys573_state::ddrsolo_output_callback ) break; case 20: - output().set_led_value( 0, !data ); // start + m_lamp[0] = data ? 0 : 1; // start break; case 21: @@ -1340,7 +1344,7 @@ WRITE8_MEMBER( ksys573_state::drmn_output_callback ) case 13: // drmn2+ case 21: // drmn - output().set_led_value( 0, data ); // start + m_lamp[0] = data ? 1 : 0; // start break; case 14: // drmn2+ @@ -1490,7 +1494,7 @@ WRITE_LINE_MEMBER( ksys573_state::dmx_lamps_b0 ) WRITE_LINE_MEMBER( ksys573_state::dmx_lamps_b1 ) { - output().set_led_value( 1, state ); // start 1p + m_lamp[1] = state ? 1 : 0; // start 1p } WRITE_LINE_MEMBER( ksys573_state::dmx_lamps_b2 ) @@ -1505,7 +1509,7 @@ WRITE_LINE_MEMBER( ksys573_state::dmx_lamps_b3 ) WRITE_LINE_MEMBER( ksys573_state::dmx_lamps_b4 ) { - output().set_led_value( 0, state ); // start 2p + m_lamp[0] = state ? 1 : 0; // start 2p } WRITE_LINE_MEMBER( ksys573_state::dmx_lamps_b5 ) @@ -1719,7 +1723,7 @@ WRITE8_MEMBER( ksys573_state::mamboagg_output_callback ) WRITE_LINE_MEMBER( ksys573_state::mamboagg_lamps_b3 ) { - output().set_led_value( 0, state ); // start 1p + m_lamp[0] = state ? 1 : 0; // start 1p } WRITE_LINE_MEMBER( ksys573_state::mamboagg_lamps_b4 ) diff --git a/src/mame/drivers/kungfur.cpp b/src/mame/drivers/kungfur.cpp index 64da5c4d854..54fcdfddf5d 100644 --- a/src/mame/drivers/kungfur.cpp +++ b/src/mame/drivers/kungfur.cpp @@ -68,12 +68,13 @@ mae(forward), migi(right), ushiro(back), hidari(left) class kungfur_state : public driver_device { public: - kungfur_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + kungfur_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_adpcm1(*this, "adpcm1"), m_adpcm2(*this, "adpcm2"), - m_digits(*this, "digit%u", 0U) + m_digits(*this, "digit%u", 0U), + m_lamp(*this, "lamp%u", 0U) { } DECLARE_WRITE8_MEMBER(kungfur_output_w); @@ -101,6 +102,7 @@ private: required_device m_adpcm1; required_device m_adpcm2; output_finder<14> m_digits; + output_finder<8> m_lamp; }; @@ -137,13 +139,13 @@ WRITE8_MEMBER(kungfur_state::kungfur_output_w) if ((data & 7) == 6) { for (u8 i = 0; i < 5; i++) - output().set_lamp_value(i, BIT(m_latch[2], i)); + m_lamp[i] = BIT(m_latch[2], i); } // d7: game-over lamp, d3-d4: marquee lamps - output().set_lamp_value(5, BIT(data, 7)); - output().set_lamp_value(6, BIT(data, 3)); - output().set_lamp_value(7, BIT(data, 4)); + m_lamp[5] = BIT(data, 7); + m_lamp[6] = BIT(data, 3); + m_lamp[7] = BIT(data, 4); // d5: N/C? // d6: coincounter @@ -278,6 +280,7 @@ INPUT_PORTS_END void kungfur_state::machine_start() { m_digits.resolve(); + m_lamp.resolve(); save_item(NAME(m_control)); save_item(NAME(m_latch)); diff --git a/src/mame/drivers/lethalj.cpp b/src/mame/drivers/lethalj.cpp index 995d8ec1841..4759b12892f 100644 --- a/src/mame/drivers/lethalj.cpp +++ b/src/mame/drivers/lethalj.cpp @@ -178,16 +178,16 @@ WRITE16_MEMBER(lethalj_state::ripribit_control_w) { machine().bookkeeping().coin_counter_w(0, BIT(data, 0)); m_ticket->motor_w(BIT(data, 1)); - output().set_lamp_value(0, BIT(data, 2)); + m_lamp[0] = BIT(data, 2); } WRITE16_MEMBER(lethalj_state::cfarm_control_w) { m_ticket->motor_w(BIT(data, 0)); - output().set_lamp_value(0, BIT(data, 2)); - output().set_lamp_value(1, BIT(data, 3)); - output().set_lamp_value(2, BIT(data, 4)); + m_lamp[0] = BIT(data, 2); + m_lamp[1] = BIT(data, 3); + m_lamp[2] = BIT(data, 4); machine().bookkeeping().coin_counter_w(0, BIT(data, 7)); } @@ -195,9 +195,9 @@ WRITE16_MEMBER(lethalj_state::cfarm_control_w) WRITE16_MEMBER(lethalj_state::cclownz_control_w) { m_ticket->motor_w(BIT(data, 0)); - output().set_lamp_value(0, BIT(data, 2)); - output().set_lamp_value(1, BIT(data, 4)); - output().set_lamp_value(2, BIT(data, 5)); + m_lamp[0] = BIT(data, 2); + m_lamp[1] = BIT(data, 4); + m_lamp[2] = BIT(data, 5); machine().bookkeeping().coin_counter_w(0, BIT(data, 6)); } diff --git a/src/mame/drivers/lockon.cpp b/src/mame/drivers/lockon.cpp index c30a45225af..41f4a1621b6 100644 --- a/src/mame/drivers/lockon.cpp +++ b/src/mame/drivers/lockon.cpp @@ -419,7 +419,7 @@ WRITE8_MEMBER(lockon_state::ym2203_out_b) machine().bookkeeping().coin_counter_w(2, data & 0x20); /* 'Lock-On' lamp */ - output().set_led_value(1, !(data & 0x10)); + m_lamp[1] = BIT(~data, 4); } /************************************* @@ -430,6 +430,8 @@ WRITE8_MEMBER(lockon_state::ym2203_out_b) void lockon_state::machine_start() { + m_lamp.resolve(); + save_item(NAME(m_ground_ctrl)); save_item(NAME(m_scroll_h)); save_item(NAME(m_scroll_v)); diff --git a/src/mame/drivers/lucky74.cpp b/src/mame/drivers/lucky74.cpp index e790e3c94a6..d5cb1c8285e 100644 --- a/src/mame/drivers/lucky74.cpp +++ b/src/mame/drivers/lucky74.cpp @@ -878,10 +878,10 @@ WRITE8_MEMBER(lucky74_state::lamps_a_w) ---- xx-- BIG + SMALL (need to be individualized) */ - output().set_lamp_value(8, (data >> 0) & 1); /* D-UP */ - output().set_lamp_value(9, (data >> 1) & 1); /* TAKE SCORE */ - output().set_lamp_value(10, (data >> 2) & 1); /* BIG */ - output().set_lamp_value(11, (data >> 3) & 1); /* SMALL */ + m_lamp[8] = BIT(data, 0); /* D-UP */ + m_lamp[9] = BIT(data, 1); /* TAKE SCORE */ + m_lamp[10] = BIT(data, 2); /* BIG */ + m_lamp[11] = BIT(data, 3); /* SMALL */ } WRITE8_MEMBER(lucky74_state::lamps_b_w) @@ -898,14 +898,14 @@ WRITE8_MEMBER(lucky74_state::lamps_b_w) x--- ---- CANCEL (should lit start too?) */ - output().set_lamp_value(0, (data >> 0) & 1); /* HOLD1 */ - output().set_lamp_value(1, (data >> 1) & 1); /* HOLD2 */ - output().set_lamp_value(2, (data >> 2) & 1); /* HOLD3 */ - output().set_lamp_value(3, (data >> 3) & 1); /* HOLD4 */ - output().set_lamp_value(4, (data >> 4) & 1); /* HOLD5 */ - output().set_lamp_value(5, (data >> 5) & 1); /* BET */ - output().set_lamp_value(6, ((data >> 6) & 1)|((data >> 7) & 1)); /* START */ - output().set_lamp_value(7, (data >> 7) & 1); /* CANCEL */ + m_lamp[0] = BIT(data, 0); /* HOLD1 */ + m_lamp[1] = BIT(data, 1); /* HOLD2 */ + m_lamp[2] = BIT(data, 2); /* HOLD3 */ + m_lamp[3] = BIT(data, 3); /* HOLD4 */ + m_lamp[4] = BIT(data, 4); /* HOLD5 */ + m_lamp[5] = BIT(data, 5); /* BET */ + m_lamp[6] = BIT(data, 6) | BIT(data, 7); /* START */ + m_lamp[7] = BIT(data, 7); /* CANCEL */ } diff --git a/src/mame/drivers/magic10.cpp b/src/mame/drivers/magic10.cpp index fe9fe162930..14d6fe77b4c 100644 --- a/src/mame/drivers/magic10.cpp +++ b/src/mame/drivers/magic10.cpp @@ -110,25 +110,18 @@ class magic10_state : public driver_device { public: - magic10_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + magic10_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_layer0_videoram(*this, "layer0_videoram"), m_layer1_videoram(*this, "layer1_videoram"), m_layer2_videoram(*this, "layer2_videoram"), m_vregs(*this, "vregs"), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_lamp(*this, "lamp%u", 0U) + { } - tilemap_t *m_layer0_tilemap; - tilemap_t *m_layer1_tilemap; - tilemap_t *m_layer2_tilemap; - required_shared_ptr m_layer0_videoram; - required_shared_ptr m_layer1_videoram; - required_shared_ptr m_layer2_videoram; - int m_layer2_offset[2]; - required_shared_ptr m_vregs; - uint16_t m_magic102_ret; DECLARE_WRITE16_MEMBER(layer0_videoram_w); DECLARE_WRITE16_MEMBER(layer1_videoram_w); DECLARE_WRITE16_MEMBER(layer2_videoram_w); @@ -145,11 +138,7 @@ public: TILE_GET_INFO_MEMBER(get_layer0_tile_info); TILE_GET_INFO_MEMBER(get_layer1_tile_info); TILE_GET_INFO_MEMBER(get_layer2_tile_info); - virtual void video_start() override; uint32_t screen_update_magic10(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_palette; void magic102(machine_config &config); void magic10a(machine_config &config); void magic10(machine_config &config); @@ -160,6 +149,24 @@ public: void magic10_map(address_map &map); void magic10a_map(address_map &map); void sgsafari_map(address_map &map); + +protected: + virtual void machine_start() override { m_lamp.resolve(); } + virtual void video_start() override; + + tilemap_t *m_layer0_tilemap; + tilemap_t *m_layer1_tilemap; + tilemap_t *m_layer2_tilemap; + required_shared_ptr m_layer0_videoram; + required_shared_ptr m_layer1_videoram; + required_shared_ptr m_layer2_videoram; + int m_layer2_offset[2]; + required_shared_ptr m_vregs; + uint16_t m_magic102_ret; + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_palette; + output_finder<9> m_lamp; }; @@ -300,14 +307,14 @@ WRITE16_MEMBER(magic10_state::magic10_out_w) // popmessage("lamps: %02X", data); - output().set_lamp_value(1, (data & 1)); /* Lamp 1 - HOLD 1 */ - output().set_lamp_value(2, (data >> 1) & 1); /* Lamp 2 - HOLD 2 */ - output().set_lamp_value(3, (data >> 2) & 1); /* Lamp 3 - HOLD 3 */ - output().set_lamp_value(4, (data >> 3) & 1); /* Lamp 4 - HOLD 4 */ - output().set_lamp_value(5, (data >> 4) & 1); /* Lamp 5 - HOLD 5 */ - output().set_lamp_value(6, (data >> 5) & 1); /* Lamp 6 - START */ - output().set_lamp_value(7, (data >> 6) & 1); /* Lamp 7 - PLAY (BET/TAKE/CANCEL) */ - output().set_lamp_value(8, (data >> 8) & 1); /* Lamp 8 - PAYOUT/SUPERGAME */ + m_lamp[1] = BIT(data, 0); /* Lamp 1 - HOLD 1 */ + m_lamp[2] = BIT(data, 1); /* Lamp 2 - HOLD 2 */ + m_lamp[3] = BIT(data, 2); /* Lamp 3 - HOLD 3 */ + m_lamp[4] = BIT(data, 3); /* Lamp 4 - HOLD 4 */ + m_lamp[5] = BIT(data, 4); /* Lamp 5 - HOLD 5 */ + m_lamp[6] = BIT(data, 5); /* Lamp 6 - START */ + m_lamp[7] = BIT(data, 6); /* Lamp 7 - PLAY (BET/TAKE/CANCEL) */ + m_lamp[8] = BIT(data, 8); /* Lamp 8 - PAYOUT/SUPERGAME */ machine().bookkeeping().coin_counter_w(0, data & 0x400); } diff --git a/src/mame/drivers/mainevt.cpp b/src/mame/drivers/mainevt.cpp index b4733986c33..c71f85dc7d9 100644 --- a/src/mame/drivers/mainevt.cpp +++ b/src/mame/drivers/mainevt.cpp @@ -72,10 +72,10 @@ WRITE8_MEMBER(mainevt_state::mainevt_coin_w) { machine().bookkeeping().coin_counter_w(0, data & 0x10); machine().bookkeeping().coin_counter_w(1, data & 0x20); - output().set_led_value(0, data & 0x01); - output().set_led_value(1, data & 0x02); - output().set_led_value(2, data & 0x04); - output().set_led_value(3, data & 0x08); + m_led[0] = BIT(data, 0); + m_led[1] = BIT(data, 1); + m_led[2] = BIT(data, 2); + m_led[3] = BIT(data, 3); } WRITE8_MEMBER(mainevt_state::mainevt_sh_irqtrigger_w) @@ -388,6 +388,7 @@ WRITE8_MEMBER(mainevt_state::volume_callback) void mainevt_state::machine_start() { + m_led.resolve(); m_rombank->configure_entries(0, 4, memregion("maincpu")->base(), 0x2000); save_item(NAME(m_nmi_enable)); diff --git a/src/mame/drivers/majorpkr.cpp b/src/mame/drivers/majorpkr.cpp index dc3f819b01a..8f5af0ea6c4 100644 --- a/src/mame/drivers/majorpkr.cpp +++ b/src/mame/drivers/majorpkr.cpp @@ -472,27 +472,16 @@ class majorpkr_state : public driver_device { public: - majorpkr_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + majorpkr_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_gfxdecode(*this, "gfxdecode"), m_palette_bank(*this, "palette_bank"), m_vram_bank(*this, "vram_bank"), m_rom_bank(*this, "rom_bank"), m_fg_vram(*this, "fg_vram"), - m_bg_vram(*this, "bg_vram") { } - - required_device m_gfxdecode; - required_device m_palette_bank; - required_device m_vram_bank; - - required_memory_bank m_rom_bank; - required_shared_ptr m_fg_vram; - required_shared_ptr m_bg_vram; - - tilemap_t *m_bg_tilemap, *m_fg_tilemap; - - int m_mux_data; - int m_flip_state; + m_bg_vram(*this, "bg_vram"), + m_lamp(*this, "lamp%u", 0U) + { } DECLARE_WRITE8_MEMBER(rom_bank_w); DECLARE_WRITE8_MEMBER(palette_bank_w); @@ -509,13 +498,30 @@ public: void init_majorpkr(); TILE_GET_INFO_MEMBER(bg_get_tile_info); TILE_GET_INFO_MEMBER(fg_get_tile_info); - virtual void video_start() override; uint32_t screen_update_majorpkr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void majorpkr(machine_config &config); void map(address_map &map); void palettebanks(address_map &map); void portmap(address_map &map); void vrambanks(address_map &map); + +protected: + virtual void machine_start() override { m_lamp.resolve(); } + virtual void video_start() override; + + required_device m_gfxdecode; + required_device m_palette_bank; + required_device m_vram_bank; + + required_memory_bank m_rom_bank; + required_shared_ptr m_fg_vram; + required_shared_ptr m_bg_vram; + + tilemap_t *m_bg_tilemap, *m_fg_tilemap; + + int m_mux_data; + int m_flip_state; + output_finder<13> m_lamp; }; @@ -678,13 +684,13 @@ WRITE8_MEMBER(majorpkr_state::lamps_a_w) -x-- ---- Small lamp. x--- ---- Unknown. */ - output().set_lamp_value(0, (data) & 1); // Lamp 0: Hold 1. - output().set_lamp_value(1, (data >> 1) & 1); // Lamp 1: Hold 2. - output().set_lamp_value(2, (data >> 2) & 1); // Lamp 2: Hold 3. - output().set_lamp_value(3, (data >> 3) & 1); // Lamp 3: Hold 4. - output().set_lamp_value(4, (data >> 4) & 1); // Lamp 4: Hold 5. - output().set_lamp_value(5, (data >> 5) & 1); // Lamp 5: Big or Small (need identification). - output().set_lamp_value(6, (data >> 6) & 1); // Lamp 6: Big or Small (need identification). + m_lamp[0] = BIT(data, 0); // Lamp 0: Hold 1. + m_lamp[1] = BIT(data, 1); // Lamp 1: Hold 2. + m_lamp[2] = BIT(data, 2); // Lamp 2: Hold 3. + m_lamp[3] = BIT(data, 3); // Lamp 3: Hold 4. + m_lamp[4] = BIT(data, 4); // Lamp 4: Hold 5. + m_lamp[5] = BIT(data, 5); // Lamp 5: Big or Small (need identification). + m_lamp[6] = BIT(data, 6); // Lamp 6: Big or Small (need identification). if (data & 0x80) logerror("Lamps A: Write to 13h: %02x\n", data); @@ -704,12 +710,12 @@ WRITE8_MEMBER(majorpkr_state::lamps_b_w) --x- ---- Fever lamp. xx-- ---- Unknown. */ - output().set_lamp_value(7, (data) & 1); // Lamp 7: Bet. - output().set_lamp_value(8, (data >> 1) & 1); // Lamp 8: Draw. - output().set_lamp_value(9, (data >> 2) & 1); // Lamp 9: Cancel. - output().set_lamp_value(10, (data >> 3) & 1); // Lamp 10: Take. - output().set_lamp_value(11, (data >> 4) & 1); // Lamp 11: D-UP. - output().set_lamp_value(12, (data >> 5) & 1); // Lamp 12: Fever. + m_lamp[7] = BIT(data, 0); // Lamp 7: Bet. + m_lamp[8] = BIT(data, 1); // Lamp 8: Draw. + m_lamp[9] = BIT(data, 2); // Lamp 9: Cancel. + m_lamp[10] = BIT(data, 3); // Lamp 10: Take. + m_lamp[11] = BIT(data, 4); // Lamp 11: D-UP. + m_lamp[12] = BIT(data, 5); // Lamp 12: Fever. if (data & 0xc0) logerror("Lamps B: Write to 14h: %02x\n", data); diff --git a/src/mame/drivers/marywu.cpp b/src/mame/drivers/marywu.cpp index f61ca605e92..42e8d0f7556 100644 --- a/src/mame/drivers/marywu.cpp +++ b/src/mame/drivers/marywu.cpp @@ -30,6 +30,7 @@ public: marywu_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , m_digits(*this, "digit%u", 0U) + , m_led(*this, "led%u", 0U) { } DECLARE_WRITE8_MEMBER(display_7seg_data_w); @@ -46,6 +47,7 @@ private: uint8_t m_selected_7seg_module; virtual void machine_start() override; output_finder<32> m_digits; + output_finder<30> m_led; }; static INPUT_PORTS_START( marywu ) @@ -109,21 +111,21 @@ INPUT_PORTS_END WRITE8_MEMBER( marywu_state::ay1_port_a_w ) { for (uint8_t i=0; i<8; i++){ - output().set_led_value(i, (data & (1 << i)) ? 1 : 0); + m_led[i] = BIT(data, i); } } WRITE8_MEMBER( marywu_state::ay1_port_b_w ) { for (uint8_t i=0; i<8; i++){ - output().set_led_value(i+8, (data & (1 << i)) ? 1 : 0); + m_led[i+8] = BIT(data, i); } } WRITE8_MEMBER( marywu_state::ay2_port_a_w ) { for (uint8_t i=0; i<8; i++){ - output().set_led_value(i+16, (data & (1 << i)) ? 1 : 0); + m_led[i+16] = BIT(data, i); } } @@ -131,7 +133,7 @@ WRITE8_MEMBER( marywu_state::ay2_port_b_w ) { for (uint8_t i=0; i<6; i++){ /* we only have 30 LEDs. The last 2 bits in this port are unused. */ - output().set_led_value(i+24, (data & (1 << i)) ? 1 : 0); + m_led[i+24] = BIT(data, i); } } @@ -179,6 +181,7 @@ void marywu_state::io_map(address_map &map) void marywu_state::machine_start() { m_digits.resolve(); + m_led.resolve(); } MACHINE_CONFIG_START(marywu_state::marywu) diff --git a/src/mame/drivers/maygayv1.cpp b/src/mame/drivers/maygayv1.cpp index 65366bca4f0..cbe8b4a55ed 100644 --- a/src/mame/drivers/maygayv1.cpp +++ b/src/mame/drivers/maygayv1.cpp @@ -212,27 +212,16 @@ struct i82716_t class maygayv1_state : public driver_device { public: - maygayv1_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + maygayv1_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_soundcpu(*this, "soundcpu"), m_upd7759(*this, "upd"), m_duart68681(*this, "duart68681"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_lamp(*this, "lamp%u", 0U) + { } - required_device m_maincpu; - required_device m_soundcpu; - required_device m_upd7759; - required_device m_duart68681; - required_device m_palette; - - int m_lamp_strobe; - int m_old_lamp_strobe; - int m_vsync_latch_preset; - uint8_t m_p1; - uint8_t m_p3; - int m_d68681_val; - i82716_t m_i82716; DECLARE_WRITE16_MEMBER(i82716_w); DECLARE_READ16_MEMBER(i82716_r); DECLARE_WRITE16_MEMBER(write_odd); @@ -246,9 +235,6 @@ public: DECLARE_WRITE8_MEMBER(lamp_data_w); DECLARE_READ8_MEMBER(kbd_r); void init_screenpl(); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; uint32_t screen_update_maygayv1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); DECLARE_WRITE_LINE_MEMBER(screen_vblank_maygayv1); DECLARE_WRITE8_MEMBER(data_from_i8031); @@ -260,6 +246,27 @@ public: void sound_data(address_map &map); void sound_io(address_map &map); void sound_prg(address_map &map); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + +private: + required_device m_maincpu; + required_device m_soundcpu; + required_device m_upd7759; + required_device m_duart68681; + required_device m_palette; + + int m_lamp_strobe; + int m_old_lamp_strobe; + int m_vsync_latch_preset; + uint8_t m_p1; + uint8_t m_p3; + int m_d68681_val; + i82716_t m_i82716; + output_finder<8 * 256> m_lamp; }; @@ -534,7 +541,7 @@ WRITE8_MEMBER( maygayv1_state::lamp_data_w ) for (int i = 0; i < 8; i++) { - output().set_lamp_value((8*m_lamp_strobe)+i, ((data & (1 << i)) !=0)); + m_lamp[(8*m_lamp_strobe)+i] = BIT(data, i); } m_old_lamp_strobe = m_lamp_strobe; } @@ -852,6 +859,7 @@ WRITE8_MEMBER(maygayv1_state::b_writ) void maygayv1_state::machine_start() { + m_lamp.resolve(); i82716_t &i82716 = m_i82716; i82716.dram = std::make_unique(0x80000/2); // ??? i82716.line_buf = std::make_unique(512); diff --git a/src/mame/drivers/mazerbla.cpp b/src/mame/drivers/mazerbla.cpp index bd9cbeeca9d..2c15a1c383d 100644 --- a/src/mame/drivers/mazerbla.cpp +++ b/src/mame/drivers/mazerbla.cpp @@ -123,37 +123,15 @@ class mazerbla_state : public driver_device { public: mazerbla_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_subcpu(*this, "sub"), - m_vcu(*this,"vcu"), - m_screen(*this, "screen"), - m_soundlatch(*this, "soundlatch") - { } - - /* devices */ - required_device m_maincpu; - required_device m_subcpu; - required_device m_vcu; - required_device m_screen; - optional_device m_soundlatch; - - uint8_t m_port02_status; - uint32_t m_gfx_rom_bank; /* graphics ROMs are banked */ - - double m_weights_r[2]; - double m_weights_g[3]; - double m_weights_b[3]; - - /* misc */ - uint8_t m_ls670_0[4]; - uint8_t m_ls670_1[4]; - - uint8_t m_zpu_int_vector; - - uint8_t m_bcd_7445; - - uint8_t m_vsb_ls273; + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_subcpu(*this, "sub") + , m_vcu(*this,"vcu") + , m_screen(*this, "screen") + , m_soundlatch(*this, "soundlatch") + , m_led(*this, "led%u", 0U) + , m_lamp(*this, "lamp%u", 0U) + { } DECLARE_WRITE8_MEMBER(cfb_rom_bank_sel_w); DECLARE_WRITE8_MEMBER(cfb_zpu_int_req_set_w); @@ -173,9 +151,6 @@ public: DECLARE_WRITE8_MEMBER(gg_led_ctrl_w); void init_mazerbla(); void init_greatgun(); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; DECLARE_PALETTE_INIT(mazerbla); uint32_t screen_update_mazerbla(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); DECLARE_WRITE_LINE_MEMBER(screen_vblank); @@ -194,6 +169,37 @@ public: void mazerbla_cpu3_map(address_map &map); void mazerbla_io_map(address_map &map); void mazerbla_map(address_map &map); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + + /* devices */ + required_device m_maincpu; + required_device m_subcpu; + required_device m_vcu; + required_device m_screen; + optional_device m_soundlatch; + output_finder<3> m_led; + output_finder<2> m_lamp; + + uint8_t m_port02_status; + uint32_t m_gfx_rom_bank; /* graphics ROMs are banked */ + + double m_weights_r[2]; + double m_weights_g[3]; + double m_weights_b[3]; + + /* misc */ + uint8_t m_ls670_0[4]; + uint8_t m_ls670_1[4]; + + uint8_t m_zpu_int_vector; + + uint8_t m_bcd_7445; + + uint8_t m_vsb_ls273; }; @@ -396,7 +402,7 @@ WRITE8_MEMBER(mazerbla_state::zpu_led_w) { /* 0x6e - reset (offset = 0)*/ /* 0x6f - set */ - output().set_led_value(0, offset & 1); + m_led[0] = BIT(offset, 0); } WRITE8_MEMBER(mazerbla_state::zpu_lamps_w) @@ -404,8 +410,8 @@ WRITE8_MEMBER(mazerbla_state::zpu_lamps_w) /* bit 4 = /LAMP0 */ /* bit 5 = /LAMP1 */ - /*output().set_led_value(0, (data & 0x10) >> 4);*/ - /*output().set_led_value(1, (data & 0x20) >> 4);*/ + /*m_lamp[0] = BIT(data, 4);*/ + /*m_lamp[1] = BIT(data, 5);*/ } WRITE8_MEMBER(mazerbla_state::zpu_coin_counter_w) @@ -417,13 +423,13 @@ WRITE8_MEMBER(mazerbla_state::zpu_coin_counter_w) WRITE8_MEMBER(mazerbla_state::cfb_led_w) { /* bit 7 - led on */ - output().set_led_value(2, BIT(data, 7)); + m_led[2] = BIT(data, 7); } WRITE8_MEMBER(mazerbla_state::gg_led_ctrl_w) { /* bit 0, bit 1 - led on */ - output().set_led_value(1, BIT(data, 0)); + m_led[1] = BIT(data, 0); } @@ -438,7 +444,7 @@ WRITE8_MEMBER(mazerbla_state::vsb_ls273_audio_control_w) m_vsb_ls273 = data; /* bit 5 - led on */ - output().set_led_value(1, BIT(data, 5)); + m_led[1] = BIT(data, 5); } WRITE8_MEMBER(mazerbla_state::sound_int_clear_w) @@ -921,6 +927,9 @@ INTERRUPT_GEN_MEMBER(mazerbla_state::sound_interrupt) void mazerbla_state::machine_start() { + m_led.resolve(); + m_lamp.resolve(); + membank("bank1")->configure_entries(0, 256, memregion("sub2")->base() + 0x10000, 0x2000); save_item(NAME(m_port02_status)); diff --git a/src/mame/drivers/mcr.cpp b/src/mame/drivers/mcr.cpp index 34fd485fcdc..797a881082e 100644 --- a/src/mame/drivers/mcr.cpp +++ b/src/mame/drivers/mcr.cpp @@ -414,24 +414,24 @@ READ8_MEMBER(mcr_dpoker_state::ip0_r) WRITE8_MEMBER(mcr_dpoker_state::lamps1_w) { // cpanel button lamps (white) - output().set_lamp_value(0, data >> 0 & 1); // hold 1 - output().set_lamp_value(1, data >> 4 & 1); // hold 2 - output().set_lamp_value(2, data >> 5 & 1); // hold 3 - output().set_lamp_value(3, data >> 6 & 1); // hold 4 - output().set_lamp_value(4, data >> 7 & 1); // hold 5 - output().set_lamp_value(5, data >> 1 & 1); // deal - output().set_lamp_value(6, data >> 2 & 1); // cancel - output().set_lamp_value(7, data >> 3 & 1); // stand + m_lamp[0] = BIT(data, 0); // hold 1 + m_lamp[1] = BIT(data, 4); // hold 2 + m_lamp[2] = BIT(data, 5); // hold 3 + m_lamp[3] = BIT(data, 6); // hold 4 + m_lamp[4] = BIT(data, 7); // hold 5 + m_lamp[5] = BIT(data, 1); // deal + m_lamp[6] = BIT(data, 2); // cancel + m_lamp[7] = BIT(data, 3); // stand } WRITE8_MEMBER(mcr_dpoker_state::lamps2_w) { // d5: button lamp: service or change - output().set_lamp_value(8, data >> 5 & 1); + m_lamp[8] = BIT(data, 5); // d0-d4: marquee lamps: coin 1 to 5 --> output lamps 9 to 13 for (int i = 0; i < 5; i++) - output().set_lamp_value(9 + i, data >> i & 1); + m_lamp[9 + i] = BIT(data, i); // d6, d7: unused? } diff --git a/src/mame/drivers/mcr3.cpp b/src/mame/drivers/mcr3.cpp index 3af3f26e2ef..97361f7a30a 100644 --- a/src/mame/drivers/mcr3.cpp +++ b/src/mame/drivers/mcr3.cpp @@ -319,9 +319,9 @@ WRITE8_MEMBER(mcr3_state::powerdrv_op5_w) /* bit 3 -> J1-10 = lamp 1 */ /* bit 2 -> J1-8 = lamp 2 */ /* bit 1 -> J1-6 = lamp 3 */ - output().set_led_value(0, (data >> 3) & 1); - output().set_led_value(1, (data >> 2) & 1); - output().set_led_value(2, (data >> 1) & 1); + m_lamp[0] = BIT(data, 3); + m_lamp[1] = BIT(data, 2); + m_lamp[2] = BIT(data, 1); /* remaining bits go to standard connections */ mcrmono_control_port_w(space, offset, data); @@ -362,9 +362,9 @@ WRITE8_MEMBER(mcr3_state::stargrds_op5_w) /* bit 2 controls light #0 */ /* bit 3 controls light #1 */ /* bit 4 controls light #2 */ - output().set_led_value(0, (data >> 2) & 1); - output().set_led_value(1, (data >> 3) & 1); - output().set_led_value(2, (data >> 4) & 1); + m_lamp[0] = BIT(data, 2); + m_lamp[1] = BIT(data, 3); + m_lamp[2] = BIT(data, 4); /* remaining bits go to standard connections */ mcrmono_control_port_w(space, offset, data); diff --git a/src/mame/drivers/mephisto_montec.cpp b/src/mame/drivers/mephisto_montec.cpp index 4caa897e95f..cb92c2162ac 100644 --- a/src/mame/drivers/mephisto_montec.cpp +++ b/src/mame/drivers/mephisto_montec.cpp @@ -41,6 +41,7 @@ public: , m_beeper(*this, "beeper") , m_keys(*this, "KEY.%u", 0) , m_digits(*this, "digit%u", 0U) + , m_led(*this, "led%u", 0U) { } @@ -85,6 +86,7 @@ private: required_device m_beeper; optional_ioport_array<2> m_keys; output_finder<8> m_digits; + output_finder<116> m_led; uint8_t m_lcd_mux; uint8_t m_input_mux; @@ -104,6 +106,7 @@ private: void mephisto_montec_state::machine_start() { m_digits.resolve(); + m_led.resolve(); save_item(NAME(m_lcd_mux)); save_item(NAME(m_input_mux)); @@ -133,7 +136,7 @@ WRITE8_MEMBER(mephisto_montec_state::montec_led_w) for(int i=0; i<4; i++) for(int j=0; j<4; j++) if (BIT(data, i)) - output().set_led_value(100 + i * 4 + j, BIT(data, 4 + j) ? 0 : 1); + m_led[100 + i * 4 + j] = BIT(data, 4 + j); } @@ -228,9 +231,9 @@ WRITE8_MEMBER(mephisto_montec_state::megaiv_led_w) { if (!BIT(m_leds_mux, i)) { - output().set_led_value(100 + i, BIT(data, 0) | BIT(data, 1)); - output().set_led_value(0 + i, BIT(data, 2) | BIT(data, 3)); - output().set_led_value(8 + i, BIT(data, 4) | BIT(data, 5)); + m_led[100 + i] = BIT(data, 0) | BIT(data, 1); + m_led[0 + i] = BIT(data, 2) | BIT(data, 3); + m_led[8 + i] = BIT(data, 4) | BIT(data, 5); } } } @@ -299,9 +302,9 @@ WRITE8_MEMBER(mephisto_montec_state::smondial_board_mux_w) for (int i=0; i<8; i++) { - if (m_leds_mux & 0x03) output().set_led_value(100 + i, BIT(m_smondial_board_mux, i) ? 0 : 1); - if (m_leds_mux & 0x0c) output().set_led_value( 8 + i, BIT(m_smondial_board_mux, i) ? 0 : 1); - if (m_leds_mux & 0x30) output().set_led_value( 0 + i, BIT(m_smondial_board_mux, i) ? 0 : 1); + if (m_leds_mux & 0x03) m_led[100 + i] = BIT(~m_smondial_board_mux, i); + if (m_leds_mux & 0x0c) m_led[ 8 + i] = BIT(~m_smondial_board_mux, i); + if (m_leds_mux & 0x30) m_led[ 0 + i] = BIT(~m_smondial_board_mux, i); } } @@ -336,9 +339,9 @@ WRITE8_MEMBER(mephisto_montec_state::mondial2_input_mux_w) { if (!BIT(leds_data, i)) { - if (data & 0x10) output().set_led_value(100 + i, 1); - if (data & 0x20) output().set_led_value( 8 + i, 1); - if (data & 0x40) output().set_led_value( 0 + i, 1); + if (data & 0x10) m_led[100 + i] = 1; + if (data & 0x20) m_led[ 8 + i] = 1; + if (data & 0x40) m_led[ 0 + i] = 1; } } @@ -360,9 +363,9 @@ TIMER_DEVICE_CALLBACK_MEMBER(mephisto_montec_state::refresh_leds) { for (int i=0; i<8; i++) { - output().set_led_value(0 + i, 0); - output().set_led_value(8 + i, 0); - output().set_led_value(100 + i, 0); + m_led[0 + i] = 0; + m_led[8 + i] = 0; + m_led[100 + i] = 0; } } diff --git a/src/mame/drivers/merit.cpp b/src/mame/drivers/merit.cpp index 3f2e7983c0d..41287f781b9 100644 --- a/src/mame/drivers/merit.cpp +++ b/src/mame/drivers/merit.cpp @@ -90,23 +90,16 @@ class merit_state : public driver_device { public: merit_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_ram_attr(*this, "raattr"), - m_ram_video(*this, "ravideo"), - m_backup_ram(*this, "backup_ram"), - m_maincpu(*this, "maincpu"), - m_screen(*this, "screen") { } + : driver_device(mconfig, type, tag) + , m_ram_attr(*this, "raattr") + , m_ram_video(*this, "ravideo") + , m_backup_ram(*this, "backup_ram") + , m_maincpu(*this, "maincpu") + , m_screen(*this, "screen") + , m_led(*this, "led%u", 0U) + { } void dodge_nvram_init(nvram_device &nvram, void *base, size_t size); - pen_t m_pens[NUM_PENS]; - required_shared_ptr m_ram_attr; - required_shared_ptr m_ram_video; - std::unique_ptr m_ram_palette; - uint8_t m_lscnblk; - int m_extra_video_bank_bit; - int m_question_address; - int m_decryption_key; - optional_shared_ptr m_backup_ram; DECLARE_READ8_MEMBER(questions_r); DECLARE_WRITE8_MEMBER(low_offset_w); DECLARE_WRITE8_MEMBER(med_offset_w); @@ -127,12 +120,9 @@ public: void init_key_0(); void init_key_2(); void init_dtrvwz5(); - virtual void machine_start() override; DECLARE_MACHINE_START(casino5); MC6845_BEGIN_UPDATE(crtc_begin_update); MC6845_UPDATE_ROW(crtc_update_row); - required_device m_maincpu; - required_device m_screen; void misdraw(machine_config &config); void couple(machine_config &config); void phrcraze(machine_config &config); @@ -158,11 +148,28 @@ public: void trvwhiz_io_map(address_map &map); void trvwhiz_map(address_map &map); void trvwhziv_map(address_map &map); + +protected: + virtual void machine_start() override; + + pen_t m_pens[NUM_PENS]; + required_shared_ptr m_ram_attr; + required_shared_ptr m_ram_video; + std::unique_ptr m_ram_palette; + uint8_t m_lscnblk; + int m_extra_video_bank_bit; + int m_question_address; + int m_decryption_key; + optional_shared_ptr m_backup_ram; + required_device m_maincpu; + required_device m_screen; + output_finder<10> m_led; }; void merit_state::machine_start() { + m_led.resolve(); m_question_address = 0; m_ram_palette = std::make_unique(RAM_PALETTE_SIZE); @@ -339,24 +346,24 @@ WRITE_LINE_MEMBER(merit_state::hsync_changed) WRITE8_MEMBER(merit_state::led1_w) { /* 5 button lamps player 1 */ - output().set_led_value(0,~data & 0x01); - output().set_led_value(1,~data & 0x02); - output().set_led_value(2,~data & 0x04); - output().set_led_value(3,~data & 0x08); - output().set_led_value(4,~data & 0x10); + m_led[0] = BIT(~data, 0); + m_led[1] = BIT(~data, 1); + m_led[2] = BIT(~data, 2); + m_led[3] = BIT(~data, 3); + m_led[4] = BIT(~data, 4); } WRITE8_MEMBER(merit_state::led2_w) { /* 5 button lamps player 2 */ - output().set_led_value(5,~data & 0x01); - output().set_led_value(6,~data & 0x02); - output().set_led_value(7,~data & 0x04); - output().set_led_value(8,~data & 0x08); - output().set_led_value(9,~data & 0x10); + m_led[5] = BIT(~data, 0); + m_led[6] = BIT(~data, 1); + m_led[7] = BIT(~data, 2); + m_led[8] = BIT(~data, 3); + m_led[9] = BIT(~data, 4); /* coin counter */ - machine().bookkeeping().coin_counter_w(0,0x80-(data & 0x80)); + machine().bookkeeping().coin_counter_w(0, BIT(~data, 7)); } WRITE8_MEMBER(merit_state::misc_w) diff --git a/src/mame/drivers/meyc8080.cpp b/src/mame/drivers/meyc8080.cpp index 54b3f4a2770..6092d9180c1 100644 --- a/src/mame/drivers/meyc8080.cpp +++ b/src/mame/drivers/meyc8080.cpp @@ -78,12 +78,9 @@ public: , m_videoram_2(*this, "vram2") , m_maincpu(*this, "maincpu") , m_dac(*this, "dac") + , m_lamp(*this, "lamp%u", 0U) { } - required_shared_ptr m_videoram_0; - required_shared_ptr m_videoram_1; - required_shared_ptr m_videoram_2; - DECLARE_WRITE8_MEMBER(lights_1_w); DECLARE_WRITE8_MEMBER(lights_2_w); DECLARE_WRITE8_MEMBER(counters_w); @@ -92,10 +89,18 @@ public: DECLARE_WRITE8_MEMBER(meyc8080_dac_3_w); DECLARE_WRITE8_MEMBER(meyc8080_dac_4_w); uint32_t screen_update_meyc8080(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - required_device m_maincpu; - required_device m_dac; void meyc8080(machine_config &config); void meyc8080_map(address_map &map); + +protected: + virtual void machine_start() override { m_lamp.resolve(); } + + required_shared_ptr m_videoram_0; + required_shared_ptr m_videoram_1; + required_shared_ptr m_videoram_2; + required_device m_maincpu; + required_device m_dac; + output_finder<11> m_lamp; }; @@ -185,11 +190,11 @@ WRITE8_MEMBER(meyc8080_state::lights_1_w) xxxx ---- Seems unused... */ - output().set_lamp_value(0, (data) & 1); /* Lamp 0 */ - output().set_lamp_value(1, (data >> 1) & 1); /* Lamp 1 */ - output().set_lamp_value(2, (data >> 2) & 1); /* Lamp 2 */ - output().set_lamp_value(3, (data >> 3) & 1); /* Lamp 3 */ - output().set_lamp_value(4, (data >> 4) & 1); /* Lamp 4 */ + m_lamp[0] = BIT(data, 0); /* Lamp 0 */ + m_lamp[1] = BIT(data, 1); /* Lamp 1 */ + m_lamp[2] = BIT(data, 2); /* Lamp 2 */ + m_lamp[3] = BIT(data, 3); /* Lamp 3 */ + m_lamp[4] = BIT(data, 4); /* Lamp 4 */ logerror("lights 1: %02x\n", data); } @@ -232,13 +237,13 @@ WRITE8_MEMBER(meyc8080_state::lights_2_w) xxx- ---- Unknown. */ - output().set_lamp_value(5, (data) & 1); /* Lamp 5 */ - output().set_lamp_value(6, (data >> 1) & 1); /* Lamp 6 */ - output().set_lamp_value(7, (data >> 2) & 1); /* Lamp 7 */ - output().set_lamp_value(8, (data >> 3) & 1); /* Lamp 8 */ - output().set_lamp_value(9, (data >> 4) & 1); /* Lamp 9 */ + m_lamp[5] = BIT(data, 0); /* Lamp 5 */ + m_lamp[6] = BIT(data, 1); /* Lamp 6 */ + m_lamp[7] = BIT(data, 2); /* Lamp 7 */ + m_lamp[8] = BIT(data, 3); /* Lamp 8 */ + m_lamp[9] = BIT(data, 4); /* Lamp 9 */ - output().set_lamp_value(10, (data >> 5) & 1); /* Lamp 10 (Game-Over) */ + m_lamp[10] = BIT(data, 5); /* Lamp 10 (Game-Over) */ logerror("lights 2: %02x\n", data); } diff --git a/src/mame/drivers/mgames.cpp b/src/mame/drivers/mgames.cpp index 88cbab619ae..e69101cc0a0 100644 --- a/src/mame/drivers/mgames.cpp +++ b/src/mame/drivers/mgames.cpp @@ -225,16 +225,15 @@ class mgames_state : public driver_device { public: - mgames_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + mgames_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_video(*this, "video"), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_lamp(*this, "lamp%u", 0U) + { } - uint8_t m_output[8]; - required_shared_ptr m_video; - int m_mixdata; DECLARE_READ8_MEMBER(mixport_r); DECLARE_WRITE8_MEMBER(outport0_w); DECLARE_WRITE8_MEMBER(outport1_w); @@ -244,14 +243,22 @@ public: DECLARE_WRITE8_MEMBER(outport5_w); DECLARE_WRITE8_MEMBER(outport6_w); DECLARE_WRITE8_MEMBER(outport7_w); - virtual void video_start() override; DECLARE_PALETTE_INIT(mgames); uint32_t screen_update_mgames(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void mgames(machine_config &config); + void main_map(address_map &map); + +protected: + virtual void machine_start() override { m_lamp.resolve(); } + virtual void video_start() override; + + uint8_t m_output[8]; + required_shared_ptr m_video; + int m_mixdata; required_device m_maincpu; required_device m_gfxdecode; required_device m_palette; - void mgames(machine_config &config); - void main_map(address_map &map); + output_finder<10> m_lamp; }; @@ -349,8 +356,8 @@ READ8_MEMBER(mgames_state::mixport_r) WRITE8_MEMBER(mgames_state::outport0_w) { - output().set_lamp_value(1, (data & 1)); /* Lamp 1 - BET */ - output().set_lamp_value(5, (data >> 1) & 1); /* Lamp 5 - HOLD 1 */ + m_lamp[1] = BIT(data, 0); /* Lamp 1 - BET */ + m_lamp[5] = BIT(data, 1); /* Lamp 5 - HOLD 1 */ m_output[0] = data; popmessage("outport0 : %02X %02X %02X %02X %02X %02X %02X %02X", m_output[0], m_output[1], m_output[2], m_output[3], m_output[4], m_output[5], m_output[6], m_output[7]); @@ -370,8 +377,8 @@ WRITE8_MEMBER(mgames_state::outport0_w) WRITE8_MEMBER(mgames_state::outport1_w) { - output().set_lamp_value(2, (data & 1)); /* Lamp 2 - DEAL */ - output().set_lamp_value(6, (data >> 1) & 1); /* Lamp 6 - HOLD 2 */ + m_lamp[2] = BIT(data, 0); /* Lamp 2 - DEAL */ + m_lamp[6] = BIT(data, 1); /* Lamp 6 - HOLD 2 */ m_output[1] = data; popmessage("outport1 : %02X %02X %02X %02X %02X %02X %02X %02X", m_output[0], m_output[1], m_output[2], m_output[3], m_output[4], m_output[5], m_output[6], m_output[7]); @@ -391,8 +398,8 @@ WRITE8_MEMBER(mgames_state::outport1_w) WRITE8_MEMBER(mgames_state::outport2_w) { - output().set_lamp_value(3, (data & 1)); /* Lamp 3 - CANCEL */ - output().set_lamp_value(7, (data >> 1) & 1); /* Lamp 7 - HOLD 3 */ + m_lamp[3] = BIT(data, 0); /* Lamp 3 - CANCEL */ + m_lamp[7] = BIT(data, 1); /* Lamp 7 - HOLD 3 */ m_output[2] = data; popmessage("outport2 : %02X %02X %02X %02X %02X %02X %02X %02X", m_output[0], m_output[1], m_output[2], m_output[3], m_output[4], m_output[5], m_output[6], m_output[7]); @@ -412,8 +419,8 @@ WRITE8_MEMBER(mgames_state::outport2_w) WRITE8_MEMBER(mgames_state::outport3_w) { - output().set_lamp_value(4, (data & 1)); /* Lamp 4 - STAND */ - output().set_lamp_value(8, (data >> 1) & 1); /* Lamp 8 - HOLD 4 */ + m_lamp[4] = BIT(data, 0); /* Lamp 4 - STAND */ + m_lamp[8] = BIT(data, 1); /* Lamp 8 - HOLD 4 */ m_output[3] = data; popmessage("outport3 : %02X %02X %02X %02X %02X %02X %02X %02X", m_output[0], m_output[1], m_output[2], m_output[3], m_output[4], m_output[5], m_output[6], m_output[7]); @@ -433,7 +440,7 @@ WRITE8_MEMBER(mgames_state::outport3_w) WRITE8_MEMBER(mgames_state::outport4_w) { - output().set_lamp_value(9, (data >> 1) & 1); /* Lamp 9 - HOLD 5 */ + m_lamp[9] = BIT(data, 1); /* Lamp 9 - HOLD 5 */ m_output[4] = data; popmessage("outport4 : %02X %02X %02X %02X %02X %02X %02X %02X", m_output[0], m_output[1], m_output[2], m_output[3], m_output[4], m_output[5], m_output[6], m_output[7]); diff --git a/src/mame/drivers/midzeus.cpp b/src/mame/drivers/midzeus.cpp index a56dccab475..4a85bf3cbd3 100644 --- a/src/mame/drivers/midzeus.cpp +++ b/src/mame/drivers/midzeus.cpp @@ -70,17 +70,36 @@ class midzeus2_state : public midzeus_state { public: midzeus2_state(const machine_config &mconfig, device_type type, const char *tag) - : midzeus_state(mconfig, type, tag), m_zeus(*this, "zeus2") { } - required_device m_zeus; + : midzeus_state(mconfig, type, tag) + , m_zeus(*this, "zeus2") + , m_led(*this, "led%u", 0U) + , m_lamp(*this, "lamp%u", 0U) + { } DECLARE_WRITE_LINE_MEMBER(zeus_irq); DECLARE_READ32_MEMBER(zeus2_timekeeper_r); DECLARE_WRITE32_MEMBER(zeus2_timekeeper_w); + DECLARE_READ32_MEMBER(crusnexo_leds_r); + DECLARE_WRITE32_MEMBER(crusnexo_leds_w); void thegrid(machine_config &config); void crusnexo(machine_config &config); void midzeus2(machine_config &config); void zeus2_map(address_map &map); + void init_crusnexo(); + void init_thegrid(); + +protected: + virtual void machine_start() override + { + MACHINE_START_CALL_MEMBER(midzeus); + m_led.resolve(); + m_lamp.resolve(); + } + private: + required_device m_zeus; + output_finder<32> m_led; + output_finder<8> m_lamp; }; @@ -411,14 +430,14 @@ WRITE32_MEMBER(midzeus_state::disk_asic_jr_w) * *************************************/ -READ32_MEMBER(midzeus_state::crusnexo_leds_r) +READ32_MEMBER(midzeus2_state::crusnexo_leds_r) { /* reads appear to just be for synchronization */ return ~0; } -WRITE32_MEMBER(midzeus_state::crusnexo_leds_w) +WRITE32_MEMBER(midzeus2_state::crusnexo_leds_w) { int bit, led; @@ -429,7 +448,7 @@ WRITE32_MEMBER(midzeus_state::crusnexo_leds_w) case 1: /* controls lamps */ for (bit = 0; bit < 8; bit++) - output().set_lamp_value(bit, (data >> bit) & 1); + m_lamp[bit] = BIT(data, bit); break; case 2: /* sets state of selected LEDs */ @@ -443,7 +462,7 @@ WRITE32_MEMBER(midzeus_state::crusnexo_leds_w) for (bit = 0; bit < 3; bit++) if ((crusnexo_leds_select & (1 << bit)) == 0) for (led = 0; led < 8; led++) - output().set_led_value(bit * 8 + led, (~data >> led) & 1); + m_led[bit * 8 + led] = BIT(~data, led); break; case 3: /* selects which set of LEDs we are addressing */ @@ -1314,7 +1333,6 @@ MACHINE_CONFIG_START(midzeus2_state::midzeus2) MCFG_DEVICE_PROGRAM_MAP(zeus2_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", midzeus2_state, display_irq) - MCFG_MACHINE_START_OVERRIDE(midzeus2_state,midzeus) MCFG_MACHINE_RESET_OVERRIDE(midzeus2_state,midzeus) MCFG_NVRAM_ADD_1FILL("nvram") @@ -1681,15 +1699,15 @@ void midzeus_state::init_invasn() } -void midzeus_state::init_crusnexo() +void midzeus2_state::init_crusnexo() { membank("bank1")->configure_entries(0, 3, memregion("user2")->base(), 0x400000*4); - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x9b0004, 0x9b0007, read32_delegate(FUNC(midzeus_state::crusnexo_leds_r),this), write32_delegate(FUNC(midzeus_state::crusnexo_leds_w),this)); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x9b0004, 0x9b0007, read32_delegate(FUNC(midzeus2_state::crusnexo_leds_r),this), write32_delegate(FUNC(midzeus2_state::crusnexo_leds_w),this)); m_maincpu->space(AS_PROGRAM).install_write_handler (0x8d0009, 0x8d000a, write32_delegate(FUNC(midzeus_state::keypad_select_w),this)); } -void midzeus_state::init_thegrid() +void midzeus2_state::init_thegrid() { membank("bank1")->configure_entries(0, 3, memregion("user2")->base(), 0x400000*4); m_maincpu->space(AS_PROGRAM).install_read_handler(0x8c0000, 0x8c0001, read32_delegate(FUNC(midzeus_state::trackball_r), this)); diff --git a/src/mame/drivers/miniboy7.cpp b/src/mame/drivers/miniboy7.cpp index e1c066f0a89..4ad97fc26e9 100644 --- a/src/mame/drivers/miniboy7.cpp +++ b/src/mame/drivers/miniboy7.cpp @@ -150,8 +150,8 @@ class miniboy7_state : public driver_device { public: - miniboy7_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + miniboy7_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_videoram_a(*this, "videoram_a"), m_colorram_a(*this, "colorram_a"), m_videoram_b(*this, "videoram_b"), @@ -163,8 +163,27 @@ public: m_dsw2(*this, "DSW2"), m_maincpu(*this, "maincpu"), m_palette(*this, "palette"), - m_gfxdecode(*this, "gfxdecode") { } + m_gfxdecode(*this, "gfxdecode"), + m_lamp(*this, "lamp%u", 0U) + { } + DECLARE_WRITE8_MEMBER(ay_pa_w); + DECLARE_WRITE8_MEMBER(ay_pb_w); + DECLARE_READ8_MEMBER(pia_pb_r); + DECLARE_WRITE_LINE_MEMBER(pia_ca2_w); + + int get_color_offset(uint8_t tile, uint8_t attr, int ra, int px); + MC6845_UPDATE_ROW(crtc_update_row); + DECLARE_PALETTE_INIT(miniboy7); + + void miniboy7(machine_config &config); + void miniboy7_map(address_map &map); + +protected: + virtual void machine_start() override { m_lamp.resolve(); } + virtual void machine_reset() override; + +private: required_shared_ptr m_videoram_a; required_shared_ptr m_colorram_a; required_shared_ptr m_videoram_b; @@ -177,21 +196,8 @@ public: required_device m_maincpu; required_device m_palette; required_device m_gfxdecode; + output_finder<5> m_lamp; - DECLARE_WRITE8_MEMBER(ay_pa_w); - DECLARE_WRITE8_MEMBER(ay_pb_w); - DECLARE_READ8_MEMBER(pia_pb_r); - DECLARE_WRITE_LINE_MEMBER(pia_ca2_w); - - void machine_reset() override; - - int get_color_offset(uint8_t tile, uint8_t attr, int ra, int px); - MC6845_UPDATE_ROW(crtc_update_row); - DECLARE_PALETTE_INIT(miniboy7); - - void miniboy7(machine_config &config); - void miniboy7_map(address_map &map); -private: uint8_t m_ay_pb; int m_gpri; }; @@ -308,11 +314,11 @@ WRITE8_MEMBER(miniboy7_state::ay_pa_w) data = data ^ 0xff; -// output().set_lamp_value(0, (data) & 1); // [----x] -// output().set_lamp_value(1, (data >> 1) & 1); // [---x-] -// output().set_lamp_value(2, (data >> 2) & 1); // [--x--] -// output().set_lamp_value(3, (data >> 3) & 1); // [-x---] -// output().set_lamp_value(4, (data >> 4) & 1); // [x----] +// m_lamp[0] = BIT(data, 0); // [----x] +// m_lamp[1] = BIT(data, 1); // [---x-] +// m_lamp[2] = BIT(data, 2); // [--x--] +// m_lamp[3] = BIT(data, 3); // [-x---] +// m_lamp[4] = BIT(data, 4); // [x----] machine().bookkeeping().coin_counter_w(0, data & 0x40); // counter diff --git a/src/mame/drivers/missile.cpp b/src/mame/drivers/missile.cpp index 0d0ea8e9cbe..210f31039bd 100644 --- a/src/mame/drivers/missile.cpp +++ b/src/mame/drivers/missile.cpp @@ -361,47 +361,24 @@ class missile_state : public driver_device { public: missile_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this,"maincpu"), - m_videoram(*this, "videoram"), - m_watchdog(*this, "watchdog"), - m_pokey(*this, "pokey"), - m_in0(*this, "IN0"), - m_in1(*this, "IN1"), - m_r10(*this, "R10"), - m_r8(*this, "R8"), - m_track0_x(*this, "TRACK0_X"), - m_track0_y(*this, "TRACK0_Y"), - m_track1_x(*this, "TRACK1_X"), - m_track1_y(*this, "TRACK1_Y"), - m_screen(*this, "screen"), - m_palette(*this, "palette") + : driver_device(mconfig, type, tag) + , m_maincpu(*this,"maincpu") + , m_videoram(*this, "videoram") + , m_watchdog(*this, "watchdog") + , m_pokey(*this, "pokey") + , m_in0(*this, "IN0") + , m_in1(*this, "IN1") + , m_r10(*this, "R10") + , m_r8(*this, "R8") + , m_track0_x(*this, "TRACK0_X") + , m_track0_y(*this, "TRACK0_Y") + , m_track1_x(*this, "TRACK1_X") + , m_track1_y(*this, "TRACK1_Y") + , m_screen(*this, "screen") + , m_palette(*this, "palette") + , m_led(*this, "led%u", 0U) { } - required_device m_maincpu; - required_shared_ptr m_videoram; - required_device m_watchdog; - optional_device m_pokey; - required_ioport m_in0; - required_ioport m_in1; - required_ioport m_r10; - required_ioport m_r8; - required_ioport m_track0_x; - required_ioport m_track0_y; - required_ioport m_track1_x; - required_ioport m_track1_y; - required_device m_screen; - required_device m_palette; - - const uint8_t *m_mainrom; - const uint8_t *m_writeprom; - emu_timer *m_irq_timer; - emu_timer *m_cpu_timer; - uint8_t m_irq_state; - uint8_t m_ctrld; - uint8_t m_flipscreen; - uint64_t m_madsel_lastcycles; - DECLARE_WRITE8_MEMBER(missile_w); DECLARE_READ8_MEMBER(missile_r); DECLARE_WRITE8_MEMBER(bootleg_w); @@ -409,8 +386,6 @@ public: DECLARE_CUSTOM_INPUT_MEMBER(get_vblank); void init_missilem(); void init_suprmatk(); - virtual void machine_start() override; - virtual void machine_reset() override; uint32_t screen_update_missile(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); inline int scanline_to_v(int scanline); @@ -428,6 +403,35 @@ public: void missilea(machine_config &config); void bootleg_main_map(address_map &map); void main_map(address_map &map); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + + required_device m_maincpu; + required_shared_ptr m_videoram; + required_device m_watchdog; + optional_device m_pokey; + required_ioport m_in0; + required_ioport m_in1; + required_ioport m_r10; + required_ioport m_r8; + required_ioport m_track0_x; + required_ioport m_track0_y; + required_ioport m_track1_x; + required_ioport m_track1_y; + required_device m_screen; + required_device m_palette; + output_finder<2> m_led; + + const uint8_t *m_mainrom; + const uint8_t *m_writeprom; + emu_timer *m_irq_timer; + emu_timer *m_cpu_timer; + uint8_t m_irq_state; + uint8_t m_ctrld; + uint8_t m_flipscreen; + uint64_t m_madsel_lastcycles; }; @@ -529,6 +533,8 @@ TIMER_CALLBACK_MEMBER(missile_state::adjust_cpu_speed) void missile_state::machine_start() { + m_led.resolve(); + /* initialize globals */ m_mainrom = memregion("maincpu")->base(); m_writeprom = memregion("proms")->base(); @@ -742,8 +748,8 @@ WRITE8_MEMBER(missile_state::missile_w) machine().bookkeeping().coin_counter_w(0, data & 0x20); machine().bookkeeping().coin_counter_w(1, data & 0x10); machine().bookkeeping().coin_counter_w(2, data & 0x08); - output().set_led_value(1, ~data & 0x04); - output().set_led_value(0, ~data & 0x02); + m_led[1] = BIT(~data, 2); + m_led[0] = BIT(~data, 1); m_ctrld = data & 1; } @@ -855,8 +861,8 @@ WRITE8_MEMBER(missile_state::bootleg_w) machine().bookkeeping().coin_counter_w(0, data & 0x20); machine().bookkeeping().coin_counter_w(1, data & 0x10); machine().bookkeeping().coin_counter_w(2, data & 0x08); - output().set_led_value(1, ~data & 0x04); - output().set_led_value(0, ~data & 0x02); + m_led[1] = BIT(~data, 2); + m_led[0] = BIT(~data, 1); m_ctrld = data & 1; } diff --git a/src/mame/drivers/mk1.cpp b/src/mame/drivers/mk1.cpp index 3fa55f278ee..3a5fd2ca9a2 100644 --- a/src/mame/drivers/mk1.cpp +++ b/src/mame/drivers/mk1.cpp @@ -55,7 +55,8 @@ public: : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") , m_digits(*this, "digit%u", 0U) - { } + , m_led(*this, "led%u", 0U) + { } DECLARE_READ8_MEMBER(mk1_f8_r); DECLARE_WRITE8_MEMBER(mk1_f8_w); @@ -64,12 +65,16 @@ public: void mk1(machine_config &config); void mk1_io(address_map &map); void mk1_mem(address_map &map); + +protected: + virtual void machine_start() override; + private: uint8_t m_f8[2]; - uint8_t m_led[4]; - virtual void machine_start() override; + uint8_t m_led_data[4]; required_device m_maincpu; output_finder<4> m_digits; + output_finder<4> m_led; }; @@ -106,10 +111,10 @@ WRITE8_MEMBER( mk1_state::mk1_f8_w ) /* 0 is high and allows also input */ m_f8[offset] = data; - if ( ! ( m_f8[1] & 1 ) ) m_led[0] = bitswap<8>( m_f8[0],2,1,3,4,5,6,7,0 ); - if ( ! ( m_f8[1] & 2 ) ) m_led[1] = bitswap<8>( m_f8[0],2,1,3,4,5,6,7,0 ); - if ( ! ( m_f8[1] & 4 ) ) m_led[2] = bitswap<8>( m_f8[0],2,1,3,4,5,6,7,0 ); - if ( ! ( m_f8[1] & 8 ) ) m_led[3] = bitswap<8>( m_f8[0],2,1,3,4,5,6,7,0 ); + if ( ! ( m_f8[1] & 1 ) ) m_led_data[0] = bitswap<8>( m_f8[0],2,1,3,4,5,6,7,0 ); + if ( ! ( m_f8[1] & 2 ) ) m_led_data[1] = bitswap<8>( m_f8[0],2,1,3,4,5,6,7,0 ); + if ( ! ( m_f8[1] & 4 ) ) m_led_data[2] = bitswap<8>( m_f8[0],2,1,3,4,5,6,7,0 ); + if ( ! ( m_f8[1] & 8 ) ) m_led_data[3] = bitswap<8>( m_f8[0],2,1,3,4,5,6,7,0 ); } void mk1_state::mk1_mem(address_map &map) @@ -166,9 +171,9 @@ TIMER_DEVICE_CALLBACK_MEMBER(mk1_state::mk1_update_leds) { for (int i = 0; i < 4; i++) { - m_digits[i] = m_led[i] >> 1; - output().set_led_value(i, m_led[i] & 0x01); - m_led[i] = 0; + m_digits[i] = m_led_data[i] >> 1; + m_led[i] = m_led_data[i] & 0x01; + m_led_data[i] = 0; } } @@ -176,6 +181,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(mk1_state::mk1_update_leds) void mk1_state::machine_start() { m_digits.resolve(); + m_led.resolve(); } diff --git a/src/mame/drivers/mk2.cpp b/src/mame/drivers/mk2.cpp index 54e927a93fa..6b76efccfac 100644 --- a/src/mame/drivers/mk2.cpp +++ b/src/mame/drivers/mk2.cpp @@ -69,6 +69,7 @@ public: , m_speaker(*this, "speaker") , m_miot(*this, "miot") , m_digits(*this, "digit%u", 0U) + , m_led(*this, "led%u", 0U) { } DECLARE_READ8_MEMBER(mk2_read_a); @@ -78,13 +79,16 @@ public: TIMER_DEVICE_CALLBACK_MEMBER(update_leds); void mk2(machine_config &config); void mk2_mem(address_map &map); -private: - uint8_t m_led[5]; +protected: virtual void machine_start() override; + +private: + uint8_t m_led_data[5]; required_device m_maincpu; required_device m_speaker; required_device m_miot; output_finder<6> m_digits; + output_finder<4> m_led; }; @@ -129,25 +133,26 @@ TIMER_DEVICE_CALLBACK_MEMBER(mk2_state::update_leds) int i; for (i=0; i<4; i++) - m_digits[i] = m_led[i]; + m_digits[i] = m_led_data[i]; - output().set_led_value(0, BIT(m_led[4], 3)); - output().set_led_value(1, BIT(m_led[4], 5)); - output().set_led_value(2, BIT(m_led[4], 4)); - output().set_led_value(3, BIT(m_led[4], 4) ? 0 : 1); + m_led[0] = BIT(m_led_data[4], 3); + m_led[1] = BIT(m_led_data[4], 5); + m_led[2] = BIT(m_led_data[4], 4); + m_led[3] = BIT(~m_led_data[4], 4); - m_led[0]= m_led[1]= m_led[2]= m_led[3]= m_led[4]= 0; + m_led_data[0] = m_led_data[1] = m_led_data[2] = m_led_data[3] = m_led_data[4] = 0; } void mk2_state::machine_start() { m_digits.resolve(); + m_led.resolve(); } READ8_MEMBER( mk2_state::mk2_read_a ) { - int data=0xff; - int help=ioport("BLACK")->read() | ioport("WHITE")->read(); // looks like white and black keys are the same! + int data = 0xff; + int help = ioport("BLACK")->read() | ioport("WHITE")->read(); // looks like white and black keys are the same! switch (m_miot->portb_out_get()&0x7) { @@ -173,7 +178,7 @@ WRITE8_MEMBER( mk2_state::mk2_write_a ) { uint8_t temp = m_miot->portb_out_get(); - m_led[temp & 3] |= data; + m_led_data[temp & 3] |= data; } @@ -188,7 +193,7 @@ WRITE8_MEMBER( mk2_state::mk2_write_b ) if ((data & 0x06) == 0x06) m_speaker->level_w(BIT(data, 0)); - m_led[4]|=data; + m_led_data[4] |= data; m_maincpu->set_input_line(M6502_IRQ_LINE, (data & 0x80) ? CLEAR_LINE : ASSERT_LINE ); } diff --git a/src/mame/drivers/multfish.cpp b/src/mame/drivers/multfish.cpp index 33301361e23..d0282e6cc42 100644 --- a/src/mame/drivers/multfish.cpp +++ b/src/mame/drivers/multfish.cpp @@ -846,14 +846,14 @@ WRITE8_MEMBER(igrosoft_gamble_state::igrosoft_gamble_lamps1_w) -X-- ---- Start Lamp 34A X--- ---- Bet/Double Lamp 29B */ - output().set_lamp_value(1, ((data) & 1)); /* Hold 1 Lamp */ - output().set_lamp_value(2, ((data >> 1) & 1)); /* Hold 2 Lamp */ - output().set_lamp_value(3, ((data >> 2) & 1)); /* Hold 3 Lamp */ - output().set_lamp_value(4, ((data >> 3) & 1)); /* Hold 4 Lamp */ - output().set_lamp_value(5, ((data >> 4) & 1)); /* Hold 5 Lamp */ - output().set_lamp_value(8, ((data >> 5) & 1)); /* Help Lamp */ - output().set_lamp_value(6, ((data >> 6) & 1)); /* Start Lamp */ - output().set_lamp_value(0, ((data >> 7) & 1)); /* Bet/Double Lamp */ + m_lamp[1] = BIT(data, 0); /* Hold 1 Lamp */ + m_lamp[2] = BIT(data, 1); /* Hold 2 Lamp */ + m_lamp[3] = BIT(data, 2); /* Hold 3 Lamp */ + m_lamp[4] = BIT(data, 3); /* Hold 4 Lamp */ + m_lamp[5] = BIT(data, 4); /* Hold 5 Lamp */ + m_lamp[8] = BIT(data, 5); /* Help Lamp */ + m_lamp[6] = BIT(data, 6); /* Start Lamp */ + m_lamp[0] = BIT(data, 7); /* Bet/Double Lamp */ } WRITE8_MEMBER(igrosoft_gamble_state::igrosoft_gamble_lamps2_w) @@ -866,10 +866,10 @@ WRITE8_MEMBER(igrosoft_gamble_state::igrosoft_gamble_lamps2_w) ---- -X-- Maxbet Lamp 30B ---X ---- Upper Lamp Green 25B (Demo Mode) */ - output().set_lamp_value(9, ((data) & 1)); /* Payout Lamp */ - output().set_lamp_value(12, ((data >> 1) & 1)); /* Upper Lamp Yellow */ - output().set_lamp_value(7, ((data >> 2) & 1)); /* Maxbet Lamp */ - output().set_lamp_value(10, ((data >> 4) & 1)); /* Upper Lamp Green */ + m_lamp[9] = BIT(data, 0); /* Payout Lamp */ + m_lamp[12] = BIT(data, 1); /* Upper Lamp Yellow */ + m_lamp[7] = BIT(data, 2); /* Maxbet Lamp */ + m_lamp[10] = BIT(data, 4); /* Upper Lamp Green */ } WRITE8_MEMBER(igrosoft_gamble_state::igrosoft_gamble_lamps3_w) @@ -879,7 +879,7 @@ WRITE8_MEMBER(igrosoft_gamble_state::igrosoft_gamble_lamps3_w) 7654 3210 ---- --X- Upper Lamp Red 26B (Service Mode) */ - output().set_lamp_value(11, ((data >> 1) & 1)); /* Upper Lamp Red */ + m_lamp[11] = BIT(data, 1); /* Upper Lamp Red */ } WRITE8_MEMBER(igrosoft_gamble_state::igrosoft_gamble_counters_w) @@ -1010,6 +1010,8 @@ GFXDECODE_END void igrosoft_gamble_state::machine_start() { + m_lamp.resolve(); + save_item(NAME(m_disp_enable)); save_item(NAME(m_rambk)); } diff --git a/src/mame/drivers/mw18w.cpp b/src/mame/drivers/mw18w.cpp index 98fc967333d..7d4418bfc7c 100644 --- a/src/mame/drivers/mw18w.cpp +++ b/src/mame/drivers/mw18w.cpp @@ -26,10 +26,11 @@ To diagnose game, turn on service mode and: class mw18w_state : public driver_device { public: - mw18w_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + mw18w_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), - m_digits(*this, "digit%u", 0U) + m_digits(*this, "digit%u", 0U), + m_lamp(*this, "lamp%u", 0U) { } DECLARE_WRITE8_MEMBER(mw18w_sound0_w); @@ -42,9 +43,10 @@ public: void mw18w_map(address_map &map); void mw18w_portmap(address_map &map); private: - virtual void machine_start() override { m_digits.resolve(); } + virtual void machine_start() override { m_digits.resolve(); m_lamp.resolve(); } required_device m_maincpu; output_finder<10> m_digits; + output_finder<81> m_lamp; }; @@ -72,7 +74,7 @@ WRITE8_MEMBER(mw18w_state::mw18w_sound1_w) // d6: bell sound // d7: backdrop lamp dim control - output().set_lamp_value(80, data >> 7 & 1); + m_lamp[80] = BIT(data, 7); } WRITE8_MEMBER(mw18w_state::mw18w_lamps_w) @@ -85,7 +87,7 @@ WRITE8_MEMBER(mw18w_state::mw18w_lamps_w) // refresh lamp status for (int i = 0; i < 5; i++) - output().set_lamp_value(col * 10 + i, rows >> i & 1); + m_lamp[col * 10 + i] = BIT(rows, i); /* lamps info: diff --git a/src/mame/drivers/namcos22.cpp b/src/mame/drivers/namcos22.cpp index 75c5578da43..50a49166320 100644 --- a/src/mame/drivers/namcos22.cpp +++ b/src/mame/drivers/namcos22.cpp @@ -1703,7 +1703,7 @@ WRITE16_MEMBER(namcos22_state::namcos22_cpuleds_w) // on system 22: two rows of 4 red leds // on super system 22: GYRGYRGY green/yellow/red for (int i = 0; i < 8; i++) - output().set_lamp_value(i, (~data << i & 0x80) ? 0 : 1); + m_cpuled[i] = (~data << i & 0x80) ? 0 : 1; } WRITE32_MEMBER(namcos22_state::namcos22s_chipselect_w) @@ -2985,7 +2985,7 @@ WRITE8_MEMBER(namcos22_state::propcycle_mcu_port5_w) // bit 1 = fan // bit 2 = button light output().set_value("fan0", data & 1); - output().set_led_value(0, data & 2); + m_led = BIT(data, 1); } void namcos22_state::propcycl_io_map(address_map &map) @@ -3744,6 +3744,8 @@ void namcos22_state::machine_reset() void namcos22_state::machine_start() { + m_led.resolve(); + m_cpuled.resolve(); m_slave_simulation_active = false; m_portbits[0] = 0xffff; m_portbits[1] = 0xffff; diff --git a/src/mame/drivers/namcos23.cpp b/src/mame/drivers/namcos23.cpp index e95bdcca138..0ec63e58996 100644 --- a/src/mame/drivers/namcos23.cpp +++ b/src/mame/drivers/namcos23.cpp @@ -1406,8 +1406,8 @@ struct render_t class namcos23_state : public driver_device { public: - namcos23_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + namcos23_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_subcpu(*this, "subcpu"), m_adc(*this, "subcpu:adc"), @@ -1430,82 +1430,16 @@ public: m_screen(*this, "screen"), m_palette(*this, "palette"), m_generic_paletteram_32(*this, "paletteram"), - m_adc_ports(*this, "ADC.%u", 0) + m_adc_ports(*this, "ADC.%u", 0), + m_lamp(*this, "lamp%u", 0U) { } - required_device m_maincpu; - required_device m_subcpu; - required_device m_adc; - optional_device m_iocpu; - required_device m_rtc; - required_device m_settings; - required_shared_ptr m_mainram; - required_shared_ptr m_shared_ram; - required_shared_ptr m_gammaram; - required_shared_ptr m_charram; - required_shared_ptr m_textram; - optional_shared_ptr m_czattr; - optional_device m_gmen_sh2; - optional_shared_ptr m_gmen_sh2_shared; - required_device m_gfxdecode; - optional_ioport m_lightx; - optional_ioport m_lighty; - required_ioport m_p1; - required_ioport m_p2; - required_device m_screen; - required_device m_palette; - required_shared_ptr m_generic_paletteram_32; - optional_ioport_array<4> m_adc_ports; - - c404_t m_c404; - c361_t m_c361; - c417_t m_c417; - c412_t m_c412; - c421_t m_c421; - c422_t m_c422; render_t m_render; - - tilemap_t *m_bgtilemap; - uint8_t m_jvssense; - int32_t m_has_jvsio; - uint32_t m_main_irqcause; - bool m_ctl_vbl_active; - uint8_t m_ctl_led; - uint16_t m_ctl_inp_buffer[2]; - bool m_subcpu_running; - uint32_t m_c435_address; - uint32_t m_c435_size; - const uint32_t *m_ptrom; const uint16_t *m_tmlrom; const uint8_t *m_tmhrom; const uint8_t *m_texrom; uint32_t m_tileid_mask; uint32_t m_tile_mask; - uint32_t m_ptrom_limit; - - int m_vblank_count; - -// It may only be 128 -// At 0x1e bytes per slot, rounded up to 0x20, that's 0x1000 to 0x2000 bytes. -// That fits pretty much anywhere, including inside a IC -// No idea at that point if it's CPU-reachable. DMA's probably more efficient anyway. - -// Matrices are stored in signed 2.14 fixed point -// Vectors are stored in signed 10.14 fixed point - - int16_t m_matrices[256][9]; - int32_t m_vectors[256][3]; - int32_t m_light_vector[3]; - uint16_t m_scaling; - int32_t m_spv[3]; - int16_t m_spm[3]; - - uint16_t m_c435_buffer[256]; - int m_c435_buffer_pos; - - uint8_t m_sub_porta; - uint8_t m_sub_portb; - uint8_t m_tssio_port_4; void update_main_interrupts(uint32_t cause); void update_mixer(); @@ -1560,8 +1494,6 @@ public: TILE_GET_INFO_MEMBER(TextTilemapGetInfo); DECLARE_VIDEO_START(s23); DECLARE_MACHINE_RESET(gmen); - virtual void machine_start() override; - virtual void machine_reset() override; uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(interrupt); TIMER_CALLBACK_MEMBER(c361_timer_cb); @@ -1613,6 +1545,79 @@ public: void s23iobrdiomap(address_map &map); void s23iobrdmap(address_map &map); void timecrs2iobrdmap(address_map &map); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + + required_device m_maincpu; + required_device m_subcpu; + required_device m_adc; + optional_device m_iocpu; + required_device m_rtc; + required_device m_settings; + required_shared_ptr m_mainram; + required_shared_ptr m_shared_ram; + required_shared_ptr m_gammaram; + required_shared_ptr m_charram; + required_shared_ptr m_textram; + optional_shared_ptr m_czattr; + optional_device m_gmen_sh2; + optional_shared_ptr m_gmen_sh2_shared; + required_device m_gfxdecode; + optional_ioport m_lightx; + optional_ioport m_lighty; + required_ioport m_p1; + required_ioport m_p2; + required_device m_screen; + required_device m_palette; + required_shared_ptr m_generic_paletteram_32; + optional_ioport_array<4> m_adc_ports; + + c404_t m_c404; + c361_t m_c361; + c417_t m_c417; + c412_t m_c412; + c421_t m_c421; + c422_t m_c422; + + tilemap_t *m_bgtilemap; + uint8_t m_jvssense; + int32_t m_has_jvsio; + uint32_t m_main_irqcause; + bool m_ctl_vbl_active; + uint8_t m_ctl_led; + uint16_t m_ctl_inp_buffer[2]; + bool m_subcpu_running; + uint32_t m_c435_address; + uint32_t m_c435_size; + const uint32_t *m_ptrom; + uint32_t m_ptrom_limit; + + int m_vblank_count; + +// It may only be 128 +// At 0x1e bytes per slot, rounded up to 0x20, that's 0x1000 to 0x2000 bytes. +// That fits pretty much anywhere, including inside a IC +// No idea at that point if it's CPU-reachable. DMA's probably more efficient anyway. + +// Matrices are stored in signed 2.14 fixed point +// Vectors are stored in signed 10.14 fixed point + + int16_t m_matrices[256][9]; + int32_t m_vectors[256][3]; + int32_t m_light_vector[3]; + uint16_t m_scaling; + int32_t m_spv[3]; + int16_t m_spm[3]; + + uint16_t m_c435_buffer[256]; + int m_c435_buffer_pos; + + uint8_t m_sub_porta; + uint8_t m_sub_portb; + uint8_t m_tssio_port_4; + output_finder<8> m_lamp; }; @@ -2792,7 +2797,7 @@ WRITE16_MEMBER(namcos23_state::ctl_w) if(m_ctl_led != (data & 0xff)) { m_ctl_led = data & 0xff; for(int i = 0; i < 8; i++) - output().set_lamp_value(i, (~data<> 0) & 1); /* CHANGE CARD lamp */ - output().set_lamp_value(1, (data >> 1) & 1); /* SAVE / HALF GAMBLE lamp */ - output().set_lamp_value(2, (data >> 2) & 1); /* HOLD 1 lamp */ - output().set_lamp_value(3, (data >> 3) & 1); /* HOLD 2 lamp */ - output().set_lamp_value(4, (data >> 4) & 1); /* HOLD 3 lamp */ - output().set_lamp_value(5, (data >> 5) & 1); /* HOLD 4 lamp */ - output().set_lamp_value(6, (data >> 6) & 1); /* HOLD 5 lamp */ - output().set_lamp_value(7, (data >> 7) & 1); /* CANCEL lamp */ + m_lamp[0] = BIT(data, 0); /* CHANGE CARD lamp */ + m_lamp[1] = BIT(data, 1); /* SAVE / HALF GAMBLE lamp */ + m_lamp[2] = BIT(data, 2); /* HOLD 1 lamp */ + m_lamp[3] = BIT(data, 3); /* HOLD 2 lamp */ + m_lamp[4] = BIT(data, 4); /* HOLD 3 lamp */ + m_lamp[5] = BIT(data, 5); /* HOLD 4 lamp */ + m_lamp[6] = BIT(data, 6); /* HOLD 5 lamp */ + m_lamp[7] = BIT(data, 7); /* CANCEL lamp */ // popmessage("lamps: %02x", data); } @@ -672,8 +672,8 @@ WRITE8_MEMBER(norautp_state::soundlamps_w) xxxx ---- * Discrete Sound Lines. */ - output().set_lamp_value(8, (data >> 0) & 1); /* DEAL / DRAW lamp */ - output().set_lamp_value(9, (data >> 1) & 1); /* BET / COLLECT lamp */ + m_lamp[8] = BIT(data, 0); /* DEAL / DRAW lamp */ + m_lamp[9] = BIT(data, 1); /* BET / COLLECT lamp */ /* the 4 MSB are for discrete sound */ m_discrete->write(space, NORAUTP_SND_EN, (data >> 7) & 0x01); @@ -697,8 +697,8 @@ WRITE8_MEMBER(norautp_state::counterlamps_w) -x-- ---- + Coin counter related. x--- ---- + DEFLECT (always activated). */ - output().set_lamp_value(10, (data >> 0) & 1); /* HI lamp */ - output().set_lamp_value(11, (data >> 1) & 1); /* LO lamp */ + m_lamp[10] = BIT(data, 0); /* HI lamp */ + m_lamp[11] = BIT(data, 1); /* LO lamp */ machine().bookkeeping().coin_counter_w(0, data & 0x10); /* Coin1/3 counter */ machine().bookkeeping().coin_counter_w(1, data & 0x20); /* Coin2 counter */ diff --git a/src/mame/drivers/notechan.cpp b/src/mame/drivers/notechan.cpp index a295191841a..7e748f66b52 100644 --- a/src/mame/drivers/notechan.cpp +++ b/src/mame/drivers/notechan.cpp @@ -302,13 +302,12 @@ class notechan_state : public driver_device { public: - notechan_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + notechan_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), - m_oki(*this, "oki") { } - - required_device m_maincpu; - required_device m_oki; + m_oki(*this, "oki"), + m_lamp(*this, "lamp%u", 0U) + { } DECLARE_WRITE8_MEMBER(out_f8_w); DECLARE_WRITE8_MEMBER(out_f9_w); @@ -317,6 +316,14 @@ public: void notechan(machine_config &config); void notechan_map(address_map &map); void notechan_port_map(address_map &map); + +protected: + virtual void machine_start() override { m_lamp.resolve(); } + +private: + required_device m_maincpu; + required_device m_oki; + output_finder<32> m_lamp; }; @@ -348,28 +355,28 @@ void notechan_state::notechan_port_map(address_map &map) WRITE8_MEMBER(notechan_state::out_f8_w) { - output().set_lamp_value(0, data & 1 ); - output().set_lamp_value(1, data >> 1 & 1); - output().set_lamp_value(2, data >> 2 & 1); - output().set_lamp_value(3, data >> 3 & 1); - output().set_lamp_value(4, data >> 4 & 1); - output().set_lamp_value(5, data >> 5 & 1); - output().set_lamp_value(6, data >> 6 & 1); - output().set_lamp_value(7, data >> 7 & 1); + m_lamp[0] = BIT(data, 0); + m_lamp[1] = BIT(data, 1); + m_lamp[2] = BIT(data, 2); + m_lamp[3] = BIT(data, 3); + m_lamp[4] = BIT(data, 4); + m_lamp[5] = BIT(data, 5); + m_lamp[6] = BIT(data, 6); + m_lamp[7] = BIT(data, 7); logerror("Output %02X to $F8\n", data); } WRITE8_MEMBER(notechan_state::out_f9_w) { - output().set_lamp_value(8, data & 1 ); - output().set_lamp_value(9, data >> 1 & 1); - output().set_lamp_value(10, data >> 2 & 1); - output().set_lamp_value(11, data >> 3 & 1); - output().set_lamp_value(12, data >> 4 & 1); - output().set_lamp_value(13, data >> 5 & 1); - output().set_lamp_value(14, data >> 6 & 1); - output().set_lamp_value(15, data >> 7 & 1); + m_lamp[8] = BIT(data, 0); + m_lamp[9] = BIT(data, 1); + m_lamp[10] = BIT(data, 2); + m_lamp[11] = BIT(data, 3); + m_lamp[12] = BIT(data, 4); + m_lamp[13] = BIT(data, 5); + m_lamp[14] = BIT(data, 6); + m_lamp[15] = BIT(data, 7); logerror("Output %02X to $F9\n", data); } @@ -378,28 +385,28 @@ WRITE8_MEMBER(notechan_state::out_fa_w) { m_oki->set_rom_bank(BIT(data, 5)); - output().set_lamp_value(16, data & 1 ); - output().set_lamp_value(17, data >> 1 & 1); - output().set_lamp_value(18, data >> 2 & 1); - output().set_lamp_value(19, data >> 3 & 1); - output().set_lamp_value(20, data >> 4 & 1); - output().set_lamp_value(21, data >> 5 & 1); - output().set_lamp_value(22, data >> 6 & 1); - output().set_lamp_value(23, data >> 7 & 1); + m_lamp[16] = BIT(data, 0); + m_lamp[17] = BIT(data, 1); + m_lamp[18] = BIT(data, 2); + m_lamp[19] = BIT(data, 3); + m_lamp[20] = BIT(data, 4); + m_lamp[21] = BIT(data, 5); + m_lamp[22] = BIT(data, 6); + m_lamp[23] = BIT(data, 7); logerror("Output %02X to $FA\n", data); } WRITE8_MEMBER(notechan_state::out_ff_w) { - output().set_lamp_value(24, data & 1 ); - output().set_lamp_value(25, data >> 1 & 1); - output().set_lamp_value(26, data >> 2 & 1); - output().set_lamp_value(27, data >> 3 & 1); - output().set_lamp_value(28, data >> 4 & 1); - output().set_lamp_value(29, data >> 5 & 1); - output().set_lamp_value(30, data >> 6 & 1); - output().set_lamp_value(31, data >> 7 & 1); + m_lamp[24] = BIT(data, 0); + m_lamp[25] = BIT(data, 1); + m_lamp[26] = BIT(data, 2); + m_lamp[27] = BIT(data, 3); + m_lamp[28] = BIT(data, 4); + m_lamp[29] = BIT(data, 5); + m_lamp[30] = BIT(data, 6); + m_lamp[31] = BIT(data, 7); logerror("Output %02X to $FF\n", data); } diff --git a/src/mame/drivers/omegrace.cpp b/src/mame/drivers/omegrace.cpp index fa946231a37..4a9950e1e62 100644 --- a/src/mame/drivers/omegrace.cpp +++ b/src/mame/drivers/omegrace.cpp @@ -233,28 +233,34 @@ class omegrace_state : public driver_device { public: omegrace_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_audiocpu(*this, "audiocpu"), - m_dvg(*this, "dvg"), - m_soundlatch(*this, "soundlatch") { } - - required_device m_maincpu; - required_device m_audiocpu; - required_device m_dvg; - required_device m_soundlatch; + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_audiocpu(*this, "audiocpu") + , m_dvg(*this, "dvg") + , m_soundlatch(*this, "soundlatch") + , m_led(*this, "led%u", 0U) + { } DECLARE_READ8_MEMBER(omegrace_vg_go_r); DECLARE_READ8_MEMBER(omegrace_spinner1_r); DECLARE_WRITE8_MEMBER(omegrace_leds_w); DECLARE_WRITE8_MEMBER(omegrace_soundlatch_w); void init_omegrace(); - virtual void machine_reset() override; void omegrace(machine_config &config); void main_map(address_map &map); void port_map(address_map &map); void sound_map(address_map &map); void sound_port(address_map &map); + +protected: + virtual void machine_start() override { m_led.resolve(); } + virtual void machine_reset() override; + + required_device m_maincpu; + required_device m_audiocpu; + required_device m_dvg; + required_device m_soundlatch; + output_finder<4> m_led; }; @@ -337,10 +343,10 @@ WRITE8_MEMBER(omegrace_state::omegrace_leds_w) machine().bookkeeping().coin_counter_w(1,data & 0x02); /* bits 2 to 5 are the start leds (4 and 5 cocktail only) */ - output().set_led_value(0,~data & 0x04); - output().set_led_value(1,~data & 0x08); - output().set_led_value(2,~data & 0x10); - output().set_led_value(3,~data & 0x20); + m_led[0] = BIT(~data, 2); + m_led[1] = BIT(~data, 3); + m_led[2] = BIT(~data, 4); + m_led[3] = BIT(~data, 5); /* bit 6 flips screen (not supported) */ } diff --git a/src/mame/drivers/overdriv.cpp b/src/mame/drivers/overdriv.cpp index b61f90efee0..21c64078ef4 100644 --- a/src/mame/drivers/overdriv.cpp +++ b/src/mame/drivers/overdriv.cpp @@ -108,7 +108,7 @@ WRITE16_MEMBER(overdriv_state::cpuA_ctrl_w) /* bit 1 is clear during service mode - function unknown */ - output().set_led_value(0, data & 0x08); + m_led = BIT(data, 3); machine().bookkeeping().coin_counter_w(0, data & 0x10); machine().bookkeeping().coin_counter_w(1, data & 0x20); @@ -300,6 +300,7 @@ INPUT_PORTS_END void overdriv_state::machine_start() { + m_led.resolve(); m_objdma_end_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(overdriv_state::objdma_end_cb), this)); save_item(NAME(m_cpuB_ctrl)); diff --git a/src/mame/drivers/polyplay.cpp b/src/mame/drivers/polyplay.cpp index 1764734f1e3..b9618c19055 100644 --- a/src/mame/drivers/polyplay.cpp +++ b/src/mame/drivers/polyplay.cpp @@ -190,38 +190,38 @@ WRITE8_MEMBER(polyplay_state::pio_portb_w) switch (lightState) { case 0: - output().set_lamp_value(1, 1); - output().set_lamp_value(2, 0); - output().set_lamp_value(3, 0); - output().set_lamp_value(4, 0); + m_lamp[1] = 1; + m_lamp[2] = 0; + m_lamp[3] = 0; + m_lamp[4] = 0; break; case 1: - output().set_lamp_value(1, 0); - output().set_lamp_value(2, 1); - output().set_lamp_value(3, 0); - output().set_lamp_value(4, 0); + m_lamp[1] = 0; + m_lamp[2] = 1; + m_lamp[3] = 0; + m_lamp[4] = 0; break; case 2: - output().set_lamp_value(1, 0); - output().set_lamp_value(2, 0); - output().set_lamp_value(3, 1); - output().set_lamp_value(4, 0); + m_lamp[1] = 0; + m_lamp[2] = 0; + m_lamp[3] = 1; + m_lamp[4] = 0; break; case 3: - output().set_lamp_value(1, 0); - output().set_lamp_value(2, 0); - output().set_lamp_value(3, 0); - output().set_lamp_value(4, 1); + m_lamp[1] = 0; + m_lamp[2] = 0; + m_lamp[3] = 0; + m_lamp[4] = 1; break; default: - output().set_lamp_value(1, 0); - output().set_lamp_value(2, 0); - output().set_lamp_value(3, 0); - output().set_lamp_value(4, 0); + m_lamp[1] = 0; + m_lamp[2] = 0; + m_lamp[3] = 0; + m_lamp[4] = 0; break; } } diff --git a/src/mame/drivers/poolshrk.cpp b/src/mame/drivers/poolshrk.cpp index 7b1902b9cc4..0e50f9d70e7 100644 --- a/src/mame/drivers/poolshrk.cpp +++ b/src/mame/drivers/poolshrk.cpp @@ -58,9 +58,9 @@ WRITE8_MEMBER(poolshrk_state::da_latch_w) WRITE8_MEMBER(poolshrk_state::led_w) { if (offset & 2) - output().set_led_value(0, offset & 1); + m_led[0] = BIT(offset, 0); if (offset & 4) - output().set_led_value(1, offset & 1); + m_led[1] = BIT(offset, 0); } diff --git a/src/mame/drivers/portrait.cpp b/src/mame/drivers/portrait.cpp index e5489f87faa..d2fa51e7077 100644 --- a/src/mame/drivers/portrait.cpp +++ b/src/mame/drivers/portrait.cpp @@ -105,8 +105,8 @@ WRITE8_MEMBER(portrait_state::ctrl_w) machine().bookkeeping().coin_counter_w(2, data & 0x04); /* the 2 lamps near the camera */ - output().set_led_value(0, data & 0x08); - output().set_led_value(1, data & 0x40); + m_lamp[0] = BIT(data, 3); + m_lamp[1] = BIT(data, 6); /* shows the black and white photo from the camera */ output().set_value("photo", (data >> 7) & 1); diff --git a/src/mame/drivers/quantum.cpp b/src/mame/drivers/quantum.cpp index b47836cbba6..be50f4ef35f 100644 --- a/src/mame/drivers/quantum.cpp +++ b/src/mame/drivers/quantum.cpp @@ -66,12 +66,14 @@ public: quantum_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), - m_avg(*this, "avg") + m_avg(*this, "avg"), + m_led(*this, "led%u", 0U) { } void quantum(machine_config &config); protected: + virtual void machine_start() override { m_led.resolve(); } DECLARE_READ16_MEMBER(trackball_r); DECLARE_WRITE16_MEMBER(led_w); DECLARE_READ8_MEMBER(input_1_r); @@ -81,6 +83,7 @@ protected: private: required_device m_maincpu; required_device m_avg; + output_finder<2> m_led; }; @@ -130,8 +133,8 @@ WRITE16_MEMBER(quantum_state::led_w) /* bit 3 = select second trackball for cocktail mode? */ /* bits 4 and 5 are LED controls */ - output().set_led_value(0, data & 0x10); - output().set_led_value(1, data & 0x20); + m_led[0] = BIT(data, 4); + m_led[1] = BIT(data, 5); /* bits 6 and 7 flip screen */ m_avg->set_flip_x (data & 0x40); diff --git a/src/mame/drivers/quasar.cpp b/src/mame/drivers/quasar.cpp index 350d5e08657..72c6d3aa250 100644 --- a/src/mame/drivers/quasar.cpp +++ b/src/mame/drivers/quasar.cpp @@ -281,7 +281,7 @@ INTERRUPT_GEN_MEMBER(quasar_state::quasar_interrupt) MACHINE_START_MEMBER(quasar_state,quasar) { - MACHINE_START_CALL_MEMBER(cvs); + cvs_state::machine_start(); /* register state save */ save_item(NAME(m_effectcontrol)); @@ -291,7 +291,7 @@ MACHINE_START_MEMBER(quasar_state,quasar) MACHINE_RESET_MEMBER(quasar_state,quasar) { - MACHINE_RESET_CALL_MEMBER(cvs); + cvs_state::machine_reset(); m_effectcontrol = 0; m_page = 0; diff --git a/src/mame/drivers/quizshow.cpp b/src/mame/drivers/quizshow.cpp index 4c736e2cf87..1f9a7d7b697 100644 --- a/src/mame/drivers/quizshow.cpp +++ b/src/mame/drivers/quizshow.cpp @@ -45,7 +45,8 @@ public: m_dac(*this, "dac"), m_main_ram(*this, "main_ram"), m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen") + m_screen(*this, "screen"), + m_lamp(*this, "lamp%u", 0U) { } DECLARE_CUSTOM_INPUT_MEMBER(tape_headpos_r); @@ -54,6 +55,7 @@ public: void quizshow(machine_config &config); protected: + virtual void machine_start() override { m_lamp.resolve(); } virtual void machine_reset() override; virtual void video_start() override; void mem_map(address_map &map); @@ -79,6 +81,7 @@ private: required_shared_ptr m_main_ram; required_device m_gfxdecode; required_device m_screen; + output_finder<11> m_lamp; tilemap_t *m_tilemap; uint32_t m_clocks; @@ -143,7 +146,7 @@ WRITE8_MEMBER(quizshow_state::lamps1_w) { // d0-d3: P1 answer button lamps for (int i = 0; i < 4; i++) - output().set_lamp_value(i, data >> i & 1); + m_lamp[i] = BIT(data, i); // d4-d7: N/C } @@ -152,7 +155,7 @@ WRITE8_MEMBER(quizshow_state::lamps2_w) { // d0-d3: P2 answer button lamps for (int i = 0; i < 4; i++) - output().set_lamp_value(i + 4, data >> i & 1); + m_lamp[i + 4] = BIT(data, i); // d4-d7: N/C } @@ -160,8 +163,8 @@ WRITE8_MEMBER(quizshow_state::lamps2_w) WRITE8_MEMBER(quizshow_state::lamps3_w) { // d0-d1: start button lamps - output().set_lamp_value(8, data >> 0 & 1); - output().set_lamp_value(9, data >> 1 & 1); + m_lamp[8] = BIT(data, 0); + m_lamp[9] = BIT(data, 1); // d2-d3: unused? (chip is shared with tape_control_w) // d4-d7: N/C @@ -170,7 +173,7 @@ WRITE8_MEMBER(quizshow_state::lamps3_w) WRITE8_MEMBER(quizshow_state::tape_control_w) { // d2: enable user category select (changes tape head position) - output().set_lamp_value(10, data >> 2 & 1); + m_lamp[10] = BIT(data, 2); m_category_enable = (data & 0xc) == 0xc; // d3: tape motor diff --git a/src/mame/drivers/re900.cpp b/src/mame/drivers/re900.cpp index 4956972a295..23725d49acf 100644 --- a/src/mame/drivers/re900.cpp +++ b/src/mame/drivers/re900.cpp @@ -91,22 +91,12 @@ class re900_state : public driver_device { public: - re900_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + re900_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), - m_rom(*this, "rom") { } - - required_device m_maincpu; - - required_shared_ptr m_rom; - - // re900 specific - uint8_t m_psg_pa; - uint8_t m_psg_pb; - uint8_t m_mux_data; - uint8_t m_ledant; - uint8_t m_player; - uint8_t m_stat_a; + m_rom(*this, "rom"), + m_lamp(*this, "lamp%u", 0U) + { } // common DECLARE_READ8_MEMBER(rom_r); @@ -124,6 +114,22 @@ public: void bs94(machine_config &config); void mem_io(address_map &map); void mem_prg(address_map &map); + +protected: + virtual void machine_start() override { m_lamp.resolve(); } + + required_device m_maincpu; + + required_shared_ptr m_rom; + + // re900 specific + uint8_t m_psg_pa; + uint8_t m_psg_pb; + uint8_t m_mux_data; + uint8_t m_ledant; + uint8_t m_player; + uint8_t m_stat_a; + output_finder<84> m_lamp; }; @@ -135,12 +141,12 @@ READ8_MEMBER(re900_state::re_psg_portA_r) { if ((ioport("IN0")->read() & 0x01) == 0) { - output().set_lamp_value(0,1); // Operator Key ON + m_lamp[0] = 1; // Operator Key ON } else { - output().set_lamp_value(0,0); // Operator Key OFF + m_lamp[0] = 0; // Operator Key OFF } return ioport("IN0")->read(); @@ -152,18 +158,18 @@ READ8_MEMBER(re900_state::re_psg_portB_r) logerror("llamada a re_psg_portB_r\n"); /* This is a hack to select the active player due to Keyboard size restrictions */ - output().set_lamp_value(m_player,1); + m_lamp[m_player] = 1; if (ioport("IN_S")->read()) { if (!m_stat_a) { - output().set_lamp_value(1, 0); - output().set_lamp_value(2, 0); - output().set_lamp_value(3, 0); - output().set_lamp_value(4, 0); - output().set_lamp_value(5, 0); - output().set_lamp_value(6, 0); + m_lamp[1] = 0; + m_lamp[2] = 0; + m_lamp[3] = 0; + m_lamp[4] = 0; + m_lamp[5] = 0; + m_lamp[6] = 0; m_player++; if (m_player == 7) @@ -171,7 +177,7 @@ READ8_MEMBER(re900_state::re_psg_portB_r) m_player = 1; } - output().set_lamp_value(m_player, 1); /* It shows active player via layout buttons */ + m_lamp[m_player] = 1; /* It shows active player via layout buttons */ m_stat_a = 1; } } @@ -220,11 +226,11 @@ WRITE8_MEMBER(re900_state::re_mux_port_B_w) if (data == 0x7f) { - output().set_lamp_value(20 + led, 1); + m_lamp[20 + led] = 1; if (led != m_ledant) { - output().set_lamp_value(20 + m_ledant, 0); + m_lamp[20 + m_ledant] = 0; m_ledant = led; } } @@ -232,8 +238,8 @@ WRITE8_MEMBER(re900_state::re_mux_port_B_w) WRITE8_MEMBER(re900_state::cpu_port_0_w) { -// output().set_lamp_value(7,1 ^ ( (data >> 4) & 1)); /* Cont. Sal */ -// output().set_lamp_value(8,1 ^ ( (data >> 5) & 1)); /* Cont. Ent */ +// m_lamp[7] = 1 ^ ( (data >> 4) & 1); /* Cont. Sal */ +// m_lamp[8] = 1 ^ ( (data >> 5) & 1); /* Cont. Ent */ } WRITE8_MEMBER(re900_state::watchdog_reset_w) diff --git a/src/mame/drivers/roul.cpp b/src/mame/drivers/roul.cpp index beaa7ca16cb..2bc63699af9 100644 --- a/src/mame/drivers/roul.cpp +++ b/src/mame/drivers/roul.cpp @@ -76,26 +76,19 @@ Stephh's notes (based on the game Z80 code and some tests) : class roul_state : public driver_device { public: - roul_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + roul_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_soundcpu(*this, "soundcpu"), - m_soundlatch(*this, "soundlatch") { } - - required_device m_maincpu; - required_device m_soundcpu; - required_device m_soundlatch; - - uint8_t m_reg[0x10]; - std::unique_ptr m_videobuf; - uint8_t m_lamp_old; + m_soundlatch(*this, "soundlatch"), + m_lamp(*this, "lamp%u", 0U) + { } DECLARE_READ8_MEMBER(blitter_status_r); DECLARE_WRITE8_MEMBER(blitter_cmd_w); DECLARE_WRITE8_MEMBER(sound_latch_w); DECLARE_WRITE8_MEMBER(ball_w); - virtual void video_start() override; DECLARE_PALETTE_INIT(roul); uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); @@ -104,6 +97,20 @@ public: void roul_map(address_map &map); void sound_cpu_io_map(address_map &map); void sound_map(address_map &map); + +protected: + virtual void machine_start() override { m_lamp.resolve(); } + virtual void video_start() override; + +private: + required_device m_maincpu; + required_device m_soundcpu; + required_device m_soundlatch; + output_finder<256> m_lamp; + + uint8_t m_reg[0x10]; + std::unique_ptr m_videobuf; + uint8_t m_lamp_old; }; @@ -199,8 +206,8 @@ WRITE8_MEMBER(roul_state::ball_w) { int lamp = data; - output().set_lamp_value(data, 1); - output().set_lamp_value(m_lamp_old, 0); + m_lamp[data] = 1; + m_lamp[m_lamp_old] = 0; m_lamp_old = lamp; } diff --git a/src/mame/drivers/runaway.cpp b/src/mame/drivers/runaway.cpp index 09a2551944f..ee67e5847f7 100644 --- a/src/mame/drivers/runaway.cpp +++ b/src/mame/drivers/runaway.cpp @@ -38,6 +38,7 @@ TIMER_CALLBACK_MEMBER(runaway_state::interrupt_callback) void runaway_state::machine_start() { + m_led.resolve(); m_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(runaway_state::interrupt_callback),this)); } @@ -72,7 +73,7 @@ READ8_MEMBER(runaway_state::runaway_pot_r) WRITE8_MEMBER(runaway_state::runaway_led_w) { - output().set_led_value(offset, ~data & 1); + m_led[offset] = BIT(~data, 0); } diff --git a/src/mame/drivers/sage2.cpp b/src/mame/drivers/sage2.cpp index 3bb12fd6104..1ba2b6f544d 100644 --- a/src/mame/drivers/sage2.cpp +++ b/src/mame/drivers/sage2.cpp @@ -306,7 +306,7 @@ WRITE8_MEMBER( sage2_state::ppi1_pc_w ) m_pic->ir7_w(BIT(data, 2)); // processor LED - output().set_led_value(0, BIT(data, 3)); + m_led = BIT(data, 3); // centronics m_centronics->write_strobe(BIT(data, 4)); @@ -379,6 +379,7 @@ DEVICE_INPUT_DEFAULTS_END void sage2_state::machine_start() { + m_led.resolve(); address_space &program = m_maincpu->space(AS_PROGRAM); program.install_rom(0x000000, 0x001fff, 0x07e000, m_rom->base()); // Avoid the 68000 reading from lalaland in its reset handler } diff --git a/src/mame/drivers/sderby.cpp b/src/mame/drivers/sderby.cpp index 7cb8d6d5cc3..d93080fa35a 100644 --- a/src/mame/drivers/sderby.cpp +++ b/src/mame/drivers/sderby.cpp @@ -206,9 +206,9 @@ WRITE16_MEMBER(sderby_state::sderby_out_w) x--- ---- End of Race lamp. */ - output().set_lamp_value(1, (data & 1)); /* Lamp 1 - START */ - output().set_lamp_value(2, (data >> 1) & 1); /* Lamp 2 - BET */ - output().set_lamp_value(3, (data >> 15) & 1); /* Lamp 3 - END OF RACE */ + m_lamp[1] = BIT(data, 0); /* Lamp 1 - START */ + m_lamp[2] = BIT(data, 1); /* Lamp 2 - BET */ + m_lamp[3] = BIT(data, 15); /* Lamp 3 - END OF RACE */ machine().bookkeeping().coin_counter_w(0, data & 0x2000); } @@ -251,13 +251,13 @@ WRITE16_MEMBER(sderby_state::scmatto_out_w) --x- ---- Coin counter. */ - output().set_lamp_value(1, (data & 1)); /* Lamp 1 - HOLD 1 */ - output().set_lamp_value(2, (data >> 1) & 1); /* Lamp 2 - HOLD 2 */ - output().set_lamp_value(3, (data >> 2) & 1); /* Lamp 3 - HOLD 3 */ - output().set_lamp_value(4, (data >> 3) & 1); /* Lamp 4 - HOLD 4 */ - output().set_lamp_value(5, (data >> 4) & 1); /* Lamp 5 - HOLD 5 */ - output().set_lamp_value(6, (data >> 5) & 1); /* Lamp 6 - START */ - output().set_lamp_value(7, (data >> 6) & 1); /* Lamp 7 - BET */ + m_lamp[1] = BIT(data, 0); /* Lamp 1 - HOLD 1 */ + m_lamp[2] = BIT(data, 1); /* Lamp 2 - HOLD 2 */ + m_lamp[3] = BIT(data, 2); /* Lamp 3 - HOLD 3 */ + m_lamp[4] = BIT(data, 3); /* Lamp 4 - HOLD 4 */ + m_lamp[5] = BIT(data, 4); /* Lamp 5 - HOLD 5 */ + m_lamp[6] = BIT(data, 5); /* Lamp 6 - START */ + m_lamp[7] = BIT(data, 6); /* Lamp 7 - BET */ machine().bookkeeping().coin_counter_w(0, data & 0x2000); } @@ -287,8 +287,8 @@ WRITE16_MEMBER(sderby_state::roulette_out_w) ---- x--- Unknown (always activated). */ - output().set_lamp_value(1, (data & 1)); /* Lamp 1 - START */ - output().set_lamp_value(2, (data >> 1) & 1); /* Lamp 2 - BET */ + m_lamp[1] = BIT(data, 0); /* Lamp 1 - START */ + m_lamp[2] = BIT(data, 1); /* Lamp 2 - BET */ } diff --git a/src/mame/drivers/seabattl.cpp b/src/mame/drivers/seabattl.cpp index d36f801a8ab..9c68c1dbf38 100644 --- a/src/mame/drivers/seabattl.cpp +++ b/src/mame/drivers/seabattl.cpp @@ -57,20 +57,9 @@ public: m_collision(0), m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), - m_palette(*this, "palette") - { - } - - required_device m_maincpu; - required_shared_ptr m_videoram; - required_shared_ptr m_colorram; - required_shared_ptr m_objram; - required_device_array m_digits; - required_device m_s2636; - output_finder<6> m_7segs; - - tilemap_t *m_bg_tilemap; - bitmap_ind16 m_collision_bg; + m_palette(*this, "palette"), + m_lamp(*this, "lamp0") + { } TILE_GET_INFO_MEMBER(get_bg_tile_info); DECLARE_WRITE8_MEMBER(seabattl_videoram_w); @@ -88,19 +77,35 @@ public: INTERRUPT_GEN_MEMBER(seabattl_interrupt); + DECLARE_PALETTE_INIT(seabattl); + uint32_t screen_update_seabattl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void seabattl(machine_config &config); + void seabattl_data_map(address_map &map); + void seabattl_map(address_map &map); + +protected: virtual void machine_start() override; virtual void machine_reset() override; virtual void video_start() override; - DECLARE_PALETTE_INIT(seabattl); - uint32_t screen_update_seabattl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + +private: + required_device m_maincpu; + required_shared_ptr m_videoram; + required_shared_ptr m_colorram; + required_shared_ptr m_objram; + required_device_array m_digits; + required_device m_s2636; + output_finder<6> m_7segs; + + tilemap_t *m_bg_tilemap; + bitmap_ind16 m_collision_bg; + bool m_waveenable; uint8_t m_collision; required_device m_gfxdecode; required_device m_screen; required_device m_palette; - void seabattl(machine_config &config); - void seabattl_data_map(address_map &map); - void seabattl_map(address_map &map); + output_finder<> m_lamp; }; @@ -286,7 +291,7 @@ WRITE8_MEMBER(seabattl_state::seabattl_control_w) // bit 4: lamp // bit 5: enable wave machine().bookkeeping().coin_counter_w(0, BIT(data, 2)); - output().set_lamp_value(0, BIT(data,4)); + m_lamp = BIT(data,4); m_waveenable = BIT(data, 5); } diff --git a/src/mame/drivers/segae.cpp b/src/mame/drivers/segae.cpp index 910645c4968..4197babb7a5 100644 --- a/src/mame/drivers/segae.cpp +++ b/src/mame/drivers/segae.cpp @@ -315,12 +315,9 @@ GND 8A 8B GND class systeme_state : public driver_device { -protected: - virtual void machine_start() override; - public: - systeme_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + systeme_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_vdp1(*this, "vdp1"), m_vdp2(*this, "vdp2"), @@ -328,7 +325,9 @@ public: m_maincpu_region(*this, "maincpu"), m_bank1(*this, "bank1"), m_bank0d(*this, "bank0d"), - m_bank1d(*this, "bank1d") { } + m_bank1d(*this, "bank1d"), + m_lamp(*this, "lamp0") + { } DECLARE_WRITE8_MEMBER(bank_write); DECLARE_WRITE8_MEMBER(coin_counters_write); @@ -353,6 +352,10 @@ public: void systeme_map(address_map &map); void vdp1_map(address_map &map); void vdp2_map(address_map &map); + +protected: + virtual void machine_start() override; + private: // Devices required_device m_maincpu; @@ -364,6 +367,7 @@ private: required_memory_bank m_bank1; optional_memory_bank m_bank0d; optional_memory_bank m_bank1d; + output_finder<> m_lamp; // Analog input related uint8_t m_port_select; @@ -447,12 +451,13 @@ WRITE8_MEMBER(systeme_state::coin_counters_write) { machine().bookkeeping().coin_counter_w(0, BIT(data, 0)); machine().bookkeeping().coin_counter_w(1, BIT(data, 1)); // only one counter used in most games? - machine().output().set_lamp_value(0, BIT(data, 2)); // used only by hangonjr? + m_lamp = BIT(data, 2); // used only by hangonjr? } void systeme_state::machine_start() { + m_lamp.resolve(); membank("vdp1_bank")->configure_entries(0, 2, m_vram[0], 0x4000); membank("vdp2_bank")->configure_entries(0, 2, m_vram[1], 0x4000); m_bank1->configure_entries(0, 16, m_maincpu_region->base() + 0x10000, 0x4000); diff --git a/src/mame/drivers/segahang.cpp b/src/mame/drivers/segahang.cpp index ccf5a7c8932..20a750d950d 100644 --- a/src/mame/drivers/segahang.cpp +++ b/src/mame/drivers/segahang.cpp @@ -70,8 +70,8 @@ WRITE8_MEMBER( segahang_state::video_lamps_w ) m_segaic16vid->set_display_enable(data & 0x10); // bits 2 & 3: control the lamps - output().set_led_value(1, data & 0x08); - output().set_led_value(0, data & 0x04); + m_lamp[1] = BIT(data, 3); + m_lamp[0] = BIT(data, 2); // bits 0 & 1: update coin counters machine().bookkeeping().coin_counter_w(1, data & 0x02); diff --git a/src/mame/drivers/segas16a.cpp b/src/mame/drivers/segas16a.cpp index 801fcb80b0e..c8efe5fee28 100644 --- a/src/mame/drivers/segas16a.cpp +++ b/src/mame/drivers/segas16a.cpp @@ -184,8 +184,8 @@ WRITE8_MEMBER( segas16a_state::misc_control_w ) // bits 2 & 3: control the lamps, allowing for overrides if (((m_video_control ^ data) & 0x0c) && !m_lamp_changed_w.isnull()) m_lamp_changed_w(m_video_control ^ data, data); - output().set_led_value(1, data & 0x08); - output().set_led_value(0, data & 0x04); + m_lamp[1] = BIT(data, 3); + m_lamp[0] = BIT(data, 2); m_video_control = data; diff --git a/src/mame/drivers/segas16b.cpp b/src/mame/drivers/segas16b.cpp index 10d0ba89b8a..44192a0b9db 100644 --- a/src/mame/drivers/segas16b.cpp +++ b/src/mame/drivers/segas16b.cpp @@ -1113,8 +1113,8 @@ WRITE16_MEMBER( segas16b_state::standard_io_w ) m_sprites->set_flip(data & 0x40); if (!m_disable_screen_blanking) m_segaic16vid->set_display_enable(data & 0x20); - output().set_led_value(1, data & 0x08); - output().set_led_value(0, data & 0x04); + m_lamp[1] = BIT(data, 3); + m_lamp[0] = BIT(data, 2); machine().bookkeeping().coin_counter_w(1, data & 0x02); machine().bookkeeping().coin_counter_w(0, data & 0x01); return; diff --git a/src/mame/drivers/segas32.cpp b/src/mame/drivers/segas32.cpp index 7bae5b81b88..596be93af90 100644 --- a/src/mame/drivers/segas32.cpp +++ b/src/mame/drivers/segas32.cpp @@ -642,6 +642,7 @@ void segas32_upd7725_state::device_start() void segas32_cd_state::device_start() { common_start(0); + m_lamp.resolve(); } void sega_multi32_state::device_start() @@ -2443,13 +2444,13 @@ segas32_upd7725_state::segas32_upd7725_state(const machine_config &mconfig, cons WRITE8_MEMBER(segas32_cd_state::lamps1_w) { for (int i = 0; i < 8; i++) - machine().output().set_lamp_value(i, BIT(data, i)); + m_lamp[i] = BIT(data, i); } WRITE8_MEMBER(segas32_cd_state::lamps2_w) { for (int i = 0; i < 8; i++) - machine().output().set_lamp_value(8 + i, BIT(data, i)); + m_lamp[8 + i] = BIT(data, i); } WRITE_LINE_MEMBER(segas32_cd_state::scsi_irq_w) @@ -2507,6 +2508,7 @@ DEFINE_DEVICE_TYPE(SEGA_S32_CD_DEVICE, segas32_cd_state, "segas32_pcb_cd", "Sega segas32_cd_state::segas32_cd_state(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : segas32_state(mconfig, SEGA_S32_CD_DEVICE, tag, owner, clock) + , m_lamp(*this, "lamp%u", 0U) { } @@ -5393,11 +5395,11 @@ void segas32_new_state::init_arescue() m_slavepcb->init_arescue(0); m_dual_pcb_comms = std::make_unique(0x1000/2); - m_mainpcb->m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x810000, 0x810fff, read16_delegate(FUNC(segas32_new_state::dual_pcb_comms_r),this), write16_delegate(FUNC(segas32_new_state::dual_pcb_comms_w),this)); - m_mainpcb->m_maincpu->space(AS_PROGRAM).install_read_handler(0x818000, 0x818003, read16_delegate(FUNC(segas32_new_state::dual_pcb_masterslave),this)); + m_mainpcb->maincpu()->space(AS_PROGRAM).install_readwrite_handler(0x810000, 0x810fff, read16_delegate(FUNC(segas32_new_state::dual_pcb_comms_r),this), write16_delegate(FUNC(segas32_new_state::dual_pcb_comms_w),this)); + m_mainpcb->maincpu()->space(AS_PROGRAM).install_read_handler(0x818000, 0x818003, read16_delegate(FUNC(segas32_new_state::dual_pcb_masterslave),this)); - m_slavepcb->m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x810000, 0x810fff, read16_delegate(FUNC(segas32_new_state::dual_pcb_comms_r),this), write16_delegate(FUNC(segas32_new_state::dual_pcb_comms_w),this)); - m_slavepcb->m_maincpu->space(AS_PROGRAM).install_read_handler(0x818000, 0x818003, read16_delegate(FUNC(segas32_new_state::dual_pcb_slave),this)); + m_slavepcb->maincpu()->space(AS_PROGRAM).install_readwrite_handler(0x810000, 0x810fff, read16_delegate(FUNC(segas32_new_state::dual_pcb_comms_r),this), write16_delegate(FUNC(segas32_new_state::dual_pcb_comms_w),this)); + m_slavepcb->maincpu()->space(AS_PROGRAM).install_read_handler(0x818000, 0x818003, read16_delegate(FUNC(segas32_new_state::dual_pcb_slave),this)); } void segas32_new_state::init_f1en() { @@ -5407,11 +5409,11 @@ void segas32_new_state::init_f1en() { m_dual_pcb_comms = std::make_unique(0x1000/2); memset(m_dual_pcb_comms.get(), 0xff, 0x1000 / 2); - m_mainpcb->m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x810000, 0x810fff, read16_delegate(FUNC(segas32_new_state::dual_pcb_comms_r),this), write16_delegate(FUNC(segas32_new_state::dual_pcb_comms_w),this)); - m_mainpcb->m_maincpu->space(AS_PROGRAM).install_read_handler(0x818000, 0x818003, read16_delegate(FUNC(segas32_new_state::dual_pcb_masterslave),this)); + m_mainpcb->maincpu()->space(AS_PROGRAM).install_readwrite_handler(0x810000, 0x810fff, read16_delegate(FUNC(segas32_new_state::dual_pcb_comms_r),this), write16_delegate(FUNC(segas32_new_state::dual_pcb_comms_w),this)); + m_mainpcb->maincpu()->space(AS_PROGRAM).install_read_handler(0x818000, 0x818003, read16_delegate(FUNC(segas32_new_state::dual_pcb_masterslave),this)); - m_slavepcb->m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x810000, 0x810fff, read16_delegate(FUNC(segas32_new_state::dual_pcb_comms_r),this), write16_delegate(FUNC(segas32_new_state::dual_pcb_comms_w),this)); - m_slavepcb->m_maincpu->space(AS_PROGRAM).install_read_handler(0x818000, 0x818003, read16_delegate(FUNC(segas32_new_state::dual_pcb_slave),this)); + m_slavepcb->maincpu()->space(AS_PROGRAM).install_readwrite_handler(0x810000, 0x810fff, read16_delegate(FUNC(segas32_new_state::dual_pcb_comms_r),this), write16_delegate(FUNC(segas32_new_state::dual_pcb_comms_w),this)); + m_slavepcb->maincpu()->space(AS_PROGRAM).install_read_handler(0x818000, 0x818003, read16_delegate(FUNC(segas32_new_state::dual_pcb_slave),this)); } void segas32_new_state::init_f1lap() diff --git a/src/mame/drivers/segaufo.cpp b/src/mame/drivers/segaufo.cpp index c248b6d6bf3..81e31adac30 100644 --- a/src/mame/drivers/segaufo.cpp +++ b/src/mame/drivers/segaufo.cpp @@ -83,7 +83,8 @@ public: m_io2(*this, "io2"), m_upd(*this, "upd"), m_counters(*this, "counter%u", 0U), - m_digits(*this, "digit%u", 0U) + m_digits(*this, "digit%u", 0U), + m_lamp(*this, "lamp%u", 0U) { } void ufomini(machine_config &config); @@ -145,6 +146,7 @@ private: optional_device m_upd; output_finder<2 * 4> m_counters; output_finder<2> m_digits; + output_finder<28> m_lamp; }; @@ -293,7 +295,7 @@ WRITE8_MEMBER(ufo_state::cp_lamps_w) // d0-d3: p1/p2 button lamps // other bits: ? for (int i = 0; i < 4; i++) - output().set_lamp_value(i, ~data >> i & 1); + m_lamp[i] = BIT(~data, i); } WRITE8_MEMBER(ufo_state::cp_digits_w) @@ -332,8 +334,8 @@ WRITE8_MEMBER(ufo_state::ufo_lamps_w) // 11 = red, red // 01 = green, red // 10 = red, green - output().set_lamp_value(10, data & 3); - output().set_lamp_value(11, data >> 2 & 3); + m_lamp[10] = data & 0x03; + m_lamp[11] = (data >> 2) & 0x03; // d4,d5: ? // d6,d7: coincounters @@ -400,7 +402,7 @@ WRITE8_MEMBER(ufo_state::ex_cp_lamps_w) { // d0,d1,d4,d5: p1/p2 button lamps for (int i = 0; i < 4; i++) - output().set_lamp_value(i, ~data >> ((i&1) + (i&2) * 2) & 1); + m_lamp[i] = BIT(~data, ((i&1) + (i&2) * 2)); // d2,d3,d6,d7: p1/p2 coincounters for (int i = 0; i < 4; i++) @@ -431,7 +433,7 @@ WRITE8_MEMBER(ufo_state::ex_ufo800_lamps_w) // d0-d4: 5 red leds on ufo // other bits: ? for (int i = 0; i < 5; i++) - output().set_lamp_value(10 + i, data >> i & 1); + m_lamp[10 + i] = BIT(data, i); } /* 315-5338A */ @@ -442,13 +444,13 @@ WRITE8_MEMBER(ufo_state::ex_ufo21_lamps1_w) // d1-d6 are the 6 red leds on each ufo // d7: ? for (int i = 1; i < 7; i++) - output().set_lamp_value(10 + i, data >> i & 1); + m_lamp[10 + i] = BIT(data, i); } WRITE8_MEMBER(ufo_state::ex_ufo21_lamps2_w) { for (int i = 1; i < 7; i++) - output().set_lamp_value(20 + i, data >> i & 1); + m_lamp[20 + i] = BIT(data, i); } WRITE8_MEMBER(ufo_state::ex_upd_start_w) @@ -747,6 +749,7 @@ void ufo_state::machine_start() { m_counters.resolve(); m_digits.resolve(); + m_lamp.resolve(); // init/zerofill/register for savestates static const float motor_speeds[4] = diff --git a/src/mame/drivers/segaxbd.cpp b/src/mame/drivers/segaxbd.cpp index 38aafc5c7ed..7c695f20413 100644 --- a/src/mame/drivers/segaxbd.cpp +++ b/src/mame/drivers/segaxbd.cpp @@ -39,7 +39,7 @@ Royal Ascot (C) Sega 1991 dumped, but very likely incomplete Super Monaco GP (C) Sega 1989 Thunder Blade (C) Sega 1987 -* denotes not dumped. There are also several revisions of the above games not dumper either. +* denotes not dumped. There are also several revisions of the above games not dumped either. Main Board ---------- @@ -283,34 +283,35 @@ segaxbd_state::segaxbd_state(const machine_config &mconfig, const char *tag, dev } segaxbd_state::segaxbd_state(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, type, tag, owner, clock), - m_maincpu(*this, "maincpu"), - m_subcpu(*this, "subcpu"), - m_soundcpu(*this, "soundcpu"), - m_soundcpu2(*this, "soundcpu2"), - m_mcu(*this, "mcu"), - m_watchdog(*this, "watchdog"), - m_cmptimer_1(*this, "cmptimer_main"), - m_sprites(*this, "sprites"), - m_segaic16vid(*this, "segaic16vid"), - m_segaic16road(*this, "segaic16road"), - m_soundlatch(*this, "soundlatch"), - m_subram0(*this, "subram0"), - m_road_priority(1), - m_scanline_timer(nullptr), - m_timer_irq_state(0), - m_vblank_irq_state(0), - m_pc_0(0), - m_loffire_sync(nullptr), - m_lastsurv_mux(0), - m_paletteram(*this, "paletteram"), - m_gprider_hack(false), - m_palette_entries(0), - m_screen(*this, "screen"), - m_palette(*this, "palette"), - m_io0_porta(*this, "IO0PORTA"), - m_adc_ports(*this, "ADC%u", 0), - m_mux_ports(*this, "MUX%u", 0) + : device_t(mconfig, type, tag, owner, clock) + , m_maincpu(*this, "maincpu") + , m_subcpu(*this, "subcpu") + , m_soundcpu(*this, "soundcpu") + , m_soundcpu2(*this, "soundcpu2") + , m_mcu(*this, "mcu") + , m_watchdog(*this, "watchdog") + , m_cmptimer_1(*this, "cmptimer_main") + , m_sprites(*this, "sprites") + , m_segaic16vid(*this, "segaic16vid") + , m_segaic16road(*this, "segaic16road") + , m_soundlatch(*this, "soundlatch") + , m_subram0(*this, "subram0") + , m_road_priority(1) + , m_scanline_timer(nullptr) + , m_timer_irq_state(0) + , m_vblank_irq_state(0) + , m_pc_0(0) + , m_loffire_sync(nullptr) + , m_lastsurv_mux(0) + , m_paletteram(*this, "paletteram") + , m_gprider_hack(false) + , m_palette_entries(0) + , m_screen(*this, "screen") + , m_palette(*this, "palette") + , m_io0_porta(*this, "IO0PORTA") + , m_adc_ports(*this, "ADC%u", 0) + , m_mux_ports(*this, "MUX%u", 0) + , m_lamp(*this, "lamp%u", 0U) { memset(m_adc_reverse, 0, sizeof(m_adc_reverse)); palette_init(); @@ -322,6 +323,7 @@ void segaxbd_state::device_start() if(!m_segaic16road->started()) throw device_missing_dependencies(); + m_lamp.resolve(); // point globals to allocated memory regions m_segaic16road->segaic16_roadram_0 = reinterpret_cast(memshare("roadram")->ptr()); @@ -733,10 +735,10 @@ void segaxbd_state::generic_iochip0_lamps_w(uint8_t data) // d6: danger lamp // in clone aburner, lamps work only in testmode? - machine().output().set_lamp_value(0, (data >> 5) & 0x01); - machine().output().set_lamp_value(1, (data >> 6) & 0x01); - machine().output().set_lamp_value(2, (data >> 1) & 0x01); - machine().output().set_lamp_value(3, (data >> 2) & 0x01); + m_lamp[0] = BIT(data, 5); + m_lamp[1] = BIT(data, 6); + m_lamp[2] = BIT(data, 1); + m_lamp[3] = BIT(data, 2); } diff --git a/src/mame/drivers/seta.cpp b/src/mame/drivers/seta.cpp index 76b5e104105..b80348ac3c5 100644 --- a/src/mame/drivers/seta.cpp +++ b/src/mame/drivers/seta.cpp @@ -2371,6 +2371,11 @@ void seta_state::drgnunit_map(address_map &map) The Roulette ***************************************************************************/ +MACHINE_START_MEMBER(setaroul_state, setaroul) +{ + m_leds.resolve(); +} + // Coin drop MACHINE_RESET_MEMBER(setaroul_state, setaroul) { @@ -2489,8 +2494,8 @@ WRITE8_MEMBER(setaroul_state::led_w) { m_led = data; - output().set_led_value(0, data & 0x01); // pay out (hop.c in input test, touch '1') - output().set_led_value(1, data & 0x02); // call attendant (cal.o in input test, touch '9') + m_leds[0] = BIT(data, 0); // pay out (hop.c in input test, touch '1') + m_leds[1] = BIT(data, 1); // call attendant (cal.o in input test, touch '9') // // data & 0x10 // hopper divider (divider in input test, touch '10') // data & 0x80 // video enable? @@ -2641,7 +2646,7 @@ WRITE16_MEMBER(seta_state::magspeed_lights_w) COMBINE_DATA( &m_magspeed_lights[offset] ); for (int i = 0; i < 16; i++) - output().set_led_value(offset * 16 + i, BIT(m_magspeed_lights[offset], i)); + m_leds[offset * 16 + i] = BIT(m_magspeed_lights[offset], i); // popmessage("%04X %04X %04X", m_magspeed_lights[0], m_magspeed_lights[1], m_magspeed_lights[2]); } @@ -8520,6 +8525,7 @@ MACHINE_CONFIG_START(setaroul_state::setaroul) MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", setaroul_state, interrupt, "screen", 0, 1) MCFG_WATCHDOG_ADD("watchdog") + MCFG_MACHINE_START_OVERRIDE(setaroul_state, setaroul) MCFG_MACHINE_RESET_OVERRIDE(setaroul_state, setaroul) MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) @@ -9034,6 +9040,8 @@ MACHINE_CONFIG_END Magical Speed ***************************************************************************/ +MACHINE_START_MEMBER(seta_state,magspeed){ m_leds.resolve(); } + /* magspeed: lev 2 by vblank, lev 4 by timer */ MACHINE_CONFIG_START(seta_state::magspeed) @@ -9044,6 +9052,8 @@ MACHINE_CONFIG_START(seta_state::magspeed) MCFG_WATCHDOG_ADD("watchdog") + MCFG_MACHINE_START_OVERRIDE(seta_state, magspeed) + MCFG_DEVICE_ADD("pit", PIT8254, 0) // uPD71054C MCFG_PIT8253_CLK0(16000000/2/8) MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, seta_state, pit_out0)) diff --git a/src/mame/drivers/seta2.cpp b/src/mame/drivers/seta2.cpp index 36c04a0f6b5..4d404082ae4 100644 --- a/src/mame/drivers/seta2.cpp +++ b/src/mame/drivers/seta2.cpp @@ -428,13 +428,13 @@ WRITE16_MEMBER(seta2_state::reelquak_leds_w) { if (ACCESSING_BITS_0_7) { - output().set_led_value(0, data & 0x0001 ); // start - output().set_led_value(1, data & 0x0002 ); // small - output().set_led_value(2, data & 0x0004 ); // bet - output().set_led_value(3, data & 0x0008 ); // big - output().set_led_value(4, data & 0x0010 ); // double up - output().set_led_value(5, data & 0x0020 ); // collect - output().set_led_value(6, data & 0x0040 ); // bet cancel + m_led[0] = BIT(data, 0); // start + m_led[1] = BIT(data, 1); // small + m_led[2] = BIT(data, 2); // bet + m_led[3] = BIT(data, 3); // big + m_led[4] = BIT(data, 4); // double up + m_led[5] = BIT(data, 5); // collect + m_led[6] = BIT(data, 6); // bet cancel } if (ACCESSING_BITS_8_15) { @@ -556,9 +556,9 @@ WRITE16_MEMBER(staraudi_state::staraudi_lamps1_w) COMBINE_DATA(&m_lamps1); if (ACCESSING_BITS_0_7) { - output().set_led_value(0, data & 0x0001 ); // Lamp 1 | - output().set_led_value(1, data & 0x0002 ); // Lamp 2 |- Camera Lamps - output().set_led_value(2, data & 0x0004 ); // Lamp 3 | + m_led[0] = BIT(data, 0); // Lamp 1 | + m_led[1] = BIT(data, 1); // Lamp 2 |- Camera Lamps + m_led[2] = BIT(data, 2); // Lamp 3 | // data & 0x0008 ); // Degauss } staraudi_debug_outputs(); @@ -570,8 +570,8 @@ WRITE16_MEMBER(staraudi_state::staraudi_lamps2_w) if (ACCESSING_BITS_0_7) { // data & 0x0020 ); // ? Always On - output().set_led_value(3, data & 0x0040 ); // 2P Switch Lamp - output().set_led_value(4, data & 0x0080 ); // 1P Switch Lamp + m_led[3] = BIT(data, 6); // 2P Switch Lamp + m_led[4] = BIT(data, 7); // 1P Switch Lamp } staraudi_debug_outputs(); } @@ -651,14 +651,14 @@ WRITE16_MEMBER(seta2_state::telpacfl_lamp1_w) { if (ACCESSING_BITS_0_7) { - output().set_lamp_value(0, data & 0x0001 ); // - output().set_lamp_value(1, data & 0x0002 ); // - output().set_lamp_value(2, data & 0x0004 ); // - output().set_lamp_value(3, data & 0x0008 ); // - output().set_lamp_value(4, data & 0x0010 ); // - output().set_lamp_value(5, data & 0x0020 ); // - output().set_lamp_value(6, data & 0x0040 ); // - output().set_lamp_value(7, data & 0x0080 ); // + m_lamp[0] = BIT(data, 0); // + m_lamp[1] = BIT(data, 1); // + m_lamp[2] = BIT(data, 2); // + m_lamp[3] = BIT(data, 3); // + m_lamp[4] = BIT(data, 4); // + m_lamp[5] = BIT(data, 5); // + m_lamp[6] = BIT(data, 6); // + m_lamp[7] = BIT(data, 7); // } // popmessage("LAMP1 %04X", data); @@ -668,9 +668,9 @@ WRITE16_MEMBER(seta2_state::telpacfl_lamp2_w) { if (ACCESSING_BITS_0_7) { - output().set_lamp_value( 8, data & 0x0001 ); // on/off lamp (throughout) - output().set_lamp_value( 9, data & 0x0002 ); // bet lamp - output().set_lamp_value(10, data & 0x0004 ); // payout lamp + m_lamp[8] = BIT(data, 0); // on/off lamp (throughout) + m_lamp[9] = BIT(data, 1); // bet lamp + m_lamp[10] = BIT(data, 2); // payout lamp m_dispenser->motor_w( data & 0x0008 ); // coin out motor machine().bookkeeping().coin_counter_w(0, data & 0x0010); // coin out counter // data & 0x0020 ); // on credit increase @@ -993,14 +993,14 @@ WRITE16_MEMBER(seta2_state::funcube_leds_w) { *m_funcube_leds = data; - output().set_led_value(0, (~data) & 0x01 ); // win lamp (red) - output().set_led_value(1, (~data) & 0x02 ); // win lamp (green) + m_led[0] = BIT(~data, 0); // win lamp (red) + m_led[1] = BIT(~data, 1); // win lamp (green) // Set in a moving pattern: 0111 -> 1011 -> 1101 -> 1110 - output().set_led_value(2, (~data) & 0x10 ); - output().set_led_value(3, (~data) & 0x20 ); - output().set_led_value(4, (~data) & 0x40 ); - output().set_led_value(5, (~data) & 0x80 ); + m_led[2] = BIT(~data, 4); + m_led[3] = BIT(~data, 5); + m_led[4] = BIT(~data, 6); + m_led[5] = BIT(~data, 7); funcube_debug_outputs(); } @@ -1023,7 +1023,7 @@ WRITE16_MEMBER(seta2_state::funcube_outputs_w) // Bit 1: high on pay out // Bit 3: low after coining up, blinks on pay out - output().set_led_value(6, (~data) & 0x08 ); + m_led[6] = BIT(~data, 3); funcube_debug_outputs(); } diff --git a/src/mame/drivers/sfbonus.cpp b/src/mame/drivers/sfbonus.cpp index 65ac67f2b56..6ee05fbe6e3 100644 --- a/src/mame/drivers/sfbonus.cpp +++ b/src/mame/drivers/sfbonus.cpp @@ -286,8 +286,8 @@ MH86171 Color Palette RAMDAC class sfbonus_state : public driver_device { public: - sfbonus_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + sfbonus_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), @@ -297,34 +297,9 @@ public: m_2801_regs(*this, "2801_regs"), m_2c01_regs(*this, "2c01_regs"), m_3000_regs(*this, "3000_regs"), - m_3800_regs(*this, "3800_regs") - { - } - - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_palette; - - required_shared_ptr m_nvram; - required_shared_ptr m_1800_regs; - required_shared_ptr m_vregs; - required_shared_ptr m_2801_regs; - required_shared_ptr m_2c01_regs; - required_shared_ptr m_3000_regs; - required_shared_ptr m_3800_regs; - - std::unique_ptr m_temp_reel_bitmap; - tilemap_t *m_tilemap; - tilemap_t *m_reel_tilemap; - tilemap_t *m_reel2_tilemap; - tilemap_t *m_reel3_tilemap; - tilemap_t *m_reel4_tilemap; - std::unique_ptr m_tilemap_ram; - std::unique_ptr m_reel_ram; - std::unique_ptr m_reel2_ram; - std::unique_ptr m_reel3_ram; - std::unique_ptr m_reel4_ram; - std::unique_ptr m_videoram; + m_3800_regs(*this, "3800_regs"), + m_lamp(*this, "lamp%u", 0U) + { } DECLARE_WRITE8_MEMBER(sfbonus_videoram_w); DECLARE_WRITE8_MEMBER(sfbonus_bank_w); @@ -467,14 +442,43 @@ public: TILE_GET_INFO_MEMBER(get_sfbonus_reel2_tile_info); TILE_GET_INFO_MEMBER(get_sfbonus_reel3_tile_info); TILE_GET_INFO_MEMBER(get_sfbonus_reel4_tile_info); - virtual void machine_reset() override; - virtual void video_start() override; void draw_reel_layer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int category); uint32_t screen_update_sfbonus(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void sfbonus(machine_config &config); void ramdac_map(address_map &map); void sfbonus_io(address_map &map); void sfbonus_map(address_map &map); + +protected: + virtual void machine_start() override { m_lamp.resolve(); } + virtual void machine_reset() override; + virtual void video_start() override; + + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_palette; + + required_shared_ptr m_nvram; + required_shared_ptr m_1800_regs; + required_shared_ptr m_vregs; + required_shared_ptr m_2801_regs; + required_shared_ptr m_2c01_regs; + required_shared_ptr m_3000_regs; + required_shared_ptr m_3800_regs; + + std::unique_ptr m_temp_reel_bitmap; + tilemap_t *m_tilemap; + tilemap_t *m_reel_tilemap; + tilemap_t *m_reel2_tilemap; + tilemap_t *m_reel3_tilemap; + tilemap_t *m_reel4_tilemap; + std::unique_ptr m_tilemap_ram; + std::unique_ptr m_reel_ram; + std::unique_ptr m_reel2_ram; + std::unique_ptr m_reel3_ram; + std::unique_ptr m_reel4_ram; + std::unique_ptr m_videoram; + output_finder<6> m_lamp; }; @@ -1189,22 +1193,22 @@ uint32_t sfbonus_state::screen_update_sfbonus(screen_device &screen, bitmap_ind1 || (ipt == INPUT_PORTS_NAME(amcoe2_poker))) { // based on pirpok2 - output().set_lamp_value(0, (m_1800_regs[6] & 0x1) >> 0); - output().set_lamp_value(1, (m_1800_regs[6] & 0x4) >> 2); - output().set_lamp_value(2, (m_1800_regs[5] & 0x4) >> 2); - output().set_lamp_value(3, (m_1800_regs[5] & 0x1) >> 0); - output().set_lamp_value(4, (m_1800_regs[4] & 0x4) >> 2); - output().set_lamp_value(5, (m_1800_regs[4] & 0x1) >> 0); + m_lamp[0] = BIT(m_1800_regs[6], 0); + m_lamp[1] = BIT(m_1800_regs[6], 2); + m_lamp[2] = BIT(m_1800_regs[5], 2); + m_lamp[3] = BIT(m_1800_regs[5], 0); + m_lamp[4] = BIT(m_1800_regs[4], 2); + m_lamp[5] = BIT(m_1800_regs[4], 0); } else if ((ipt == INPUT_PORTS_NAME(amcoe1_reels3)) || (ipt == INPUT_PORTS_NAME(amcoe1_reels4)) || (ipt == INPUT_PORTS_NAME(amcoe1_poker))) { - output().set_lamp_value(0, (m_1800_regs[0] & 0x2) >> 1); - output().set_lamp_value(1, (m_1800_regs[4] & 0x2) >> 1); - output().set_lamp_value(2, (m_1800_regs[3] & 0x2) >> 1); - output().set_lamp_value(3, (m_1800_regs[6] & 0x4) >> 2); - output().set_lamp_value(4, (m_1800_regs[4] & 0x4) >> 2); - output().set_lamp_value(5, (m_1800_regs[3] & 0x4) >> 2); + m_lamp[0] = BIT(m_1800_regs[0], 1); + m_lamp[1] = BIT(m_1800_regs[4], 1); + m_lamp[2] = BIT(m_1800_regs[3], 1); + m_lamp[3] = BIT(m_1800_regs[6], 2); + m_lamp[4] = BIT(m_1800_regs[4], 2); + m_lamp[5] = BIT(m_1800_regs[3], 2); } return 0; diff --git a/src/mame/drivers/sigmab98.cpp b/src/mame/drivers/sigmab98.cpp index 7ce5e6f91a0..055e8801348 100644 --- a/src/mame/drivers/sigmab98.cpp +++ b/src/mame/drivers/sigmab98.cpp @@ -149,48 +149,10 @@ public: m_nvram(*this, "nvram"), m_spriteram(*this, "spriteram"), m_vregs(*this, "vregs"), - m_vtable(*this, "vtable") + m_vtable(*this, "vtable"), + m_led(*this, "led%u", 0U) { } - // Required devices - required_device m_maincpu; - required_device m_screen; - required_device m_palette; - required_device m_gfxdecode; - // Optional devices - optional_device m_buffered_spriteram; // not on sammymdl? - optional_device m_nvramdev; // battery backed RAM (should be required, but dashhero breaks with it) - optional_device m_eeprom; - optional_device m_hopper; - optional_device m_hopper_small; - optional_device m_hopper_large; - // Shared pointers - required_shared_ptr m_nvram; - optional_shared_ptr m_spriteram; // optional as some games allocate it themselves (due to banking) - optional_shared_ptr m_vregs; // optional as some games allocate it themselves (due to banking) - optional_shared_ptr m_vtable; // optional as some games allocate it themselves (due to banking) - - std::vector m_paletteram; - - std::unique_ptr m_sprite_bitmap; - bool new_sprite_chip; // KY-10510 has a slightly different sprite format than KY-3211 - - uint8_t m_reg; - uint8_t m_rombank; - uint8_t m_reg2; - uint8_t m_rambank; - - uint8_t m_vblank_vector; - uint8_t m_timer0_vector; - uint8_t m_timer1_vector; - - uint8_t m_c0; - uint8_t m_c4; - uint8_t m_c6; - uint8_t m_c8; - uint8_t m_vblank; - uint8_t m_out[3]; - DECLARE_WRITE8_MEMBER(gegege_regs_w); DECLARE_READ8_MEMBER(gegege_regs_r); DECLARE_WRITE8_MEMBER(gegege_regs2_w); @@ -284,7 +246,6 @@ public: DECLARE_MACHINE_RESET(sigmab98); DECLARE_MACHINE_RESET(sammymdl); - virtual void video_start() override; uint32_t screen_update_sigmab98(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); DECLARE_WRITE_LINE_MEMBER(screen_vblank_sammymdl); INTERRUPT_GEN_MEMBER(sigmab98_vblank_interrupt); @@ -318,6 +279,50 @@ public: void pyenaget_io(address_map &map); void tdoboon_io(address_map &map); void tdoboon_map(address_map &map); + +protected: + virtual void machine_start() override { m_led.resolve(); } + virtual void video_start() override; + + // Required devices + required_device m_maincpu; + required_device m_screen; + required_device m_palette; + required_device m_gfxdecode; + // Optional devices + optional_device m_buffered_spriteram; // not on sammymdl? + optional_device m_nvramdev; // battery backed RAM (should be required, but dashhero breaks with it) + optional_device m_eeprom; + optional_device m_hopper; + optional_device m_hopper_small; + optional_device m_hopper_large; + // Shared pointers + required_shared_ptr m_nvram; + optional_shared_ptr m_spriteram; // optional as some games allocate it themselves (due to banking) + optional_shared_ptr m_vregs; // optional as some games allocate it themselves (due to banking) + optional_shared_ptr m_vtable; // optional as some games allocate it themselves (due to banking) + output_finder<8> m_led; + + std::vector m_paletteram; + + std::unique_ptr m_sprite_bitmap; + bool new_sprite_chip; // KY-10510 has a slightly different sprite format than KY-3211 + + uint8_t m_reg; + uint8_t m_rombank; + uint8_t m_reg2; + uint8_t m_rambank; + + uint8_t m_vblank_vector; + uint8_t m_timer0_vector; + uint8_t m_timer1_vector; + + uint8_t m_c0; + uint8_t m_c4; + uint8_t m_c6; + uint8_t m_c8; + uint8_t m_vblank; + uint8_t m_out[3]; }; @@ -959,7 +964,7 @@ WRITE8_MEMBER(sigmab98_state::eeprom_w) // 10 led? WRITE8_MEMBER(sigmab98_state::c4_w) { - output().set_led_value(0, (data & 0x10)); + m_led[0] = BIT(data, 4); m_c4 = data; show_outputs(); @@ -980,8 +985,8 @@ WRITE8_MEMBER(sigmab98_state::c6_w) if ((data & 0x08) && !(m_c6 & 0x08)) m_buffered_spriteram->copy(); - output().set_led_value(1, data & 0x10); - output().set_led_value(2, data & 0x20); + m_led[1] = BIT(data, 4); + m_led[2] = BIT(data, 5); m_c6 = data; show_outputs(); @@ -1202,10 +1207,10 @@ WRITE8_MEMBER(lufykzku_state::lufykzku_c6_w) // machine().bookkeeping().coin_counter_w(2, data & 0x02); // (unused coin in) machine().bookkeeping().coin_counter_w(0, data & 0x04); // medal in machine().bookkeeping().coin_counter_w(3, data & 0x08); // medal out - output().set_led_value(0, data & 0x10); // button led -// output().set_led_value(1, data & 0x20); // (unused button led) -// output().set_led_value(2, data & 0x40); // (unused button led) -// output().set_led_value(3, data & 0x80); // (unused button led) + m_led[0] = BIT(data, 4); // button led +// m_led[1] = BIT(data, 5); // (unused button led) +// m_led[2] = BIT(data, 6); // (unused button led) +// m_led[3] = BIT(data, 7); // (unused button led) m_c6 = data; show_outputs(); @@ -1446,7 +1451,7 @@ READ8_MEMBER(sigmab98_state::sammymdl_leds_r) } WRITE8_MEMBER(sigmab98_state::sammymdl_leds_w) { - output().set_led_value(0, data & 0x01); // button + m_led[0] = BIT(data, 0); // button m_out[1] = data; show_3_outputs(); @@ -1778,10 +1783,10 @@ void sigmab98_state::gocowboy_map(address_map &map) WRITE8_MEMBER(sigmab98_state::gocowboy_leds_w) { - output().set_led_value(0, data & 0x01); // button - output().set_led_value(1, data & 0x02); // coin lockout? (after coining up, but not for service coin) - output().set_led_value(2, data & 0x04); // ? long after a prize is not collected - output().set_led_value(3, data & 0x08); // ? "don't forget the large prizes" + m_led[0] = BIT(data, 0); // button + m_led[1] = BIT(data, 1); // coin lockout? (after coining up, but not for service coin) + m_led[2] = BIT(data, 2); // ? long after a prize is not collected + m_led[3] = BIT(data, 3); // ? "don't forget the large prizes" // 10 hopper enable? // 20 hopper motor on (active low)? @@ -2006,14 +2011,14 @@ WRITE8_MEMBER(sigmab98_state::haekaka_b000_w) WRITE8_MEMBER(sigmab98_state::haekaka_leds_w) { // All used - output().set_led_value(0, data & 0x01); - output().set_led_value(1, data & 0x02); - output().set_led_value(2, data & 0x04); - output().set_led_value(3, data & 0x08); - output().set_led_value(4, data & 0x10); - output().set_led_value(5, data & 0x20); - output().set_led_value(6, data & 0x40); - output().set_led_value(7, data & 0x80); + m_led[0] = BIT(data, 0); + m_led[1] = BIT(data, 1); + m_led[2] = BIT(data, 2); + m_led[3] = BIT(data, 3); + m_led[4] = BIT(data, 4); + m_led[5] = BIT(data, 5); + m_led[6] = BIT(data, 6); + m_led[7] = BIT(data, 7); m_out[1] = data; show_3_outputs(); diff --git a/src/mame/drivers/skykid.cpp b/src/mame/drivers/skykid.cpp index ff7e35f3386..d87fee84ae8 100644 --- a/src/mame/drivers/skykid.cpp +++ b/src/mame/drivers/skykid.cpp @@ -62,8 +62,8 @@ READ8_MEMBER(skykid_state::inputport_r) WRITE8_MEMBER(skykid_state::skykid_led_w) { - output().set_led_value(0,data & 0x08); - output().set_led_value(1,data & 0x10); + m_led[0] = BIT(data, 3); + m_led[1] = BIT(data, 4); } WRITE8_MEMBER(skykid_state::skykid_subreset_w) @@ -95,6 +95,8 @@ WRITE8_MEMBER(skykid_state::skykid_irq_2_ctrl_w) void skykid_state::machine_start() { + m_led.resolve(); + /* configure the banks */ membank("bank1")->configure_entries(0, 2, memregion("maincpu")->base() + 0x10000, 0x2000); diff --git a/src/mame/drivers/skylncr.cpp b/src/mame/drivers/skylncr.cpp index 48d9b3c83f7..697db06f3b8 100644 --- a/src/mame/drivers/skylncr.cpp +++ b/src/mame/drivers/skylncr.cpp @@ -137,8 +137,8 @@ class skylncr_state : public driver_device { public: - skylncr_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + skylncr_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_videoram(*this, "videoram"), m_colorram(*this, "colorram"), m_reeltiles_1_ram(*this, "reeltiles_1_ram"), @@ -156,29 +156,9 @@ public: m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), - m_hopper(*this, "hopper") { } - - tilemap_t *m_tmap; - required_shared_ptr m_videoram; - required_shared_ptr m_colorram; - required_shared_ptr m_reeltiles_1_ram; - required_shared_ptr m_reeltiles_2_ram; - required_shared_ptr m_reeltiles_3_ram; - required_shared_ptr m_reeltiles_4_ram; - required_shared_ptr m_reeltileshigh_1_ram; - required_shared_ptr m_reeltileshigh_2_ram; - required_shared_ptr m_reeltileshigh_3_ram; - required_shared_ptr m_reeltileshigh_4_ram; - tilemap_t *m_reel_1_tilemap; - tilemap_t *m_reel_2_tilemap; - tilemap_t *m_reel_3_tilemap; - tilemap_t *m_reel_4_tilemap; - required_shared_ptr m_reelscroll1; - required_shared_ptr m_reelscroll2; - required_shared_ptr m_reelscroll3; - required_shared_ptr m_reelscroll4; - uint8_t m_nmi_enable; - bool m_mbutrfly_prot; + m_hopper(*this, "hopper"), + m_lamp(*this, "lamp%u", 0U) + { } DECLARE_WRITE8_MEMBER(skylncr_videoram_w); DECLARE_WRITE8_MEMBER(skylncr_colorram_w); @@ -207,13 +187,8 @@ public: TILE_GET_INFO_MEMBER(get_reel_2_tile_info); TILE_GET_INFO_MEMBER(get_reel_3_tile_info); TILE_GET_INFO_MEMBER(get_reel_4_tile_info); - virtual void video_start() override; uint32_t screen_update_skylncr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(skylncr_vblank_interrupt); - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_palette; - required_device m_hopper; void neraidou(machine_config &config); void sstar97(machine_config &config); void bdream97(machine_config &config); @@ -225,6 +200,37 @@ public: void mem_map_skylncr(address_map &map); void ramdac2_map(address_map &map); void ramdac_map(address_map &map); + +protected: + virtual void machine_start() override { m_lamp.resolve(); } + virtual void video_start() override; + + tilemap_t *m_tmap; + required_shared_ptr m_videoram; + required_shared_ptr m_colorram; + required_shared_ptr m_reeltiles_1_ram; + required_shared_ptr m_reeltiles_2_ram; + required_shared_ptr m_reeltiles_3_ram; + required_shared_ptr m_reeltiles_4_ram; + required_shared_ptr m_reeltileshigh_1_ram; + required_shared_ptr m_reeltileshigh_2_ram; + required_shared_ptr m_reeltileshigh_3_ram; + required_shared_ptr m_reeltileshigh_4_ram; + tilemap_t *m_reel_1_tilemap; + tilemap_t *m_reel_2_tilemap; + tilemap_t *m_reel_3_tilemap; + tilemap_t *m_reel_4_tilemap; + required_shared_ptr m_reelscroll1; + required_shared_ptr m_reelscroll2; + required_shared_ptr m_reelscroll3; + required_shared_ptr m_reelscroll4; + uint8_t m_nmi_enable; + bool m_mbutrfly_prot; + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_palette; + required_device m_hopper; + output_finder<8> m_lamp; }; @@ -429,13 +435,13 @@ WRITE8_MEMBER(skylncr_state::skylncr_nmi_enable_w) WRITE8_MEMBER(skylncr_state::mbutrfly_prot_w) { - machine().output().set_lamp_value(1, BIT(data, 0)); // Slot Stop 2 - machine().output().set_lamp_value(2, BIT(data, 1)); // Slot Stop 1 - machine().output().set_lamp_value(3, BIT(data, 2)); // Take - machine().output().set_lamp_value(4, BIT(data, 3)); // Bet - machine().output().set_lamp_value(5, BIT(data, 4)); // Slot Stop 3 - machine().output().set_lamp_value(6, BIT(data, 5)); // Start - machine().output().set_lamp_value(7, BIT(data, 6)); // Payout + m_lamp[1] = BIT(data, 0); // Slot Stop 2 + m_lamp[2] = BIT(data, 1); // Slot Stop 1 + m_lamp[3] = BIT(data, 2); // Take + m_lamp[4] = BIT(data, 3); // Bet + m_lamp[5] = BIT(data, 4); // Slot Stop 3 + m_lamp[6] = BIT(data, 5); // Start + m_lamp[7] = BIT(data, 6); // Payout m_mbutrfly_prot = BIT(data, 7); } diff --git a/src/mame/drivers/sms.cpp b/src/mame/drivers/sms.cpp index 490a34432dc..c04d8c80250 100644 --- a/src/mame/drivers/sms.cpp +++ b/src/mame/drivers/sms.cpp @@ -494,9 +494,6 @@ INPUT_PORTS_END MACHINE_CONFIG_START(sms_state::sms_base) - MCFG_MACHINE_START_OVERRIDE(sms_state,sms) - MCFG_MACHINE_RESET_OVERRIDE(sms_state,sms) - /* basic machine hardware */ SPEAKER(config, "mono").front_center(); @@ -949,9 +946,6 @@ MACHINE_CONFIG_START(sms_state::gamegear) MCFG_QUANTUM_TIME(attotime::from_hz(60)) - MCFG_MACHINE_START_OVERRIDE(sms_state,sms) - MCFG_MACHINE_RESET_OVERRIDE(sms_state,sms) - /* video hardware */ MCFG_SCREEN_ADD("screen", LCD) MCFG_SCREEN_GG_RAW_PARAMS(MASTER_CLOCK_GG/6) diff --git a/src/mame/drivers/sms_bootleg.cpp b/src/mame/drivers/sms_bootleg.cpp index aca12490c20..e71a40ee39c 100644 --- a/src/mame/drivers/sms_bootleg.cpp +++ b/src/mame/drivers/sms_bootleg.cpp @@ -281,9 +281,6 @@ MACHINE_CONFIG_START(smsbootleg_state::sms_supergame) MCFG_QUANTUM_TIME(attotime::from_hz(60)) - MCFG_MACHINE_START_OVERRIDE(sms_state,sms) - MCFG_MACHINE_RESET_OVERRIDE(sms_state,sms) - /* sound hardware */ SPEAKER(config, "mono").front_center(); diff --git a/src/mame/drivers/smsmcorp.cpp b/src/mame/drivers/smsmcorp.cpp index ade4e98837e..b3d81843332 100644 --- a/src/mame/drivers/smsmcorp.cpp +++ b/src/mame/drivers/smsmcorp.cpp @@ -227,15 +227,13 @@ U145 1Brown PAL14H4CN class smsmfg_state : public driver_device { public: - smsmfg_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + smsmfg_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), - m_screen(*this, "screen") { } + m_screen(*this, "screen"), + m_lamp(*this, "lamp%u", 0U) + { } - uint8_t m_communication_port[4]; - uint8_t m_communication_port_status; - bitmap_ind16 m_bitmap; - uint8_t m_vid_regs[7]; DECLARE_WRITE8_MEMBER(bankswitch_w); DECLARE_READ8_MEMBER(link_r); DECLARE_WRITE8_MEMBER(link_w); @@ -246,18 +244,26 @@ public: DECLARE_READ8_MEMBER(ppi0_c_r); DECLARE_WRITE8_MEMBER(ppi0_a_w); DECLARE_WRITE8_MEMBER(ppi0_b_w); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; DECLARE_MACHINE_START(sureshot); uint32_t screen_update_sms(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device m_maincpu; - required_device m_screen; void sureshot(machine_config &config); void sms(machine_config &config); void sms_map(address_map &map); void sub_map(address_map &map); void sureshot_map(address_map &map); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + + uint8_t m_communication_port[4]; + uint8_t m_communication_port_status; + bitmap_ind16 m_bitmap; + uint8_t m_vid_regs[7]; + required_device m_maincpu; + required_device m_screen; + output_finder<10> m_lamp; }; @@ -409,20 +415,20 @@ READ8_MEMBER(smsmfg_state::ppi0_c_r) WRITE8_MEMBER(smsmfg_state::ppi0_a_w) { //popmessage("Lamps: %d %d %d %d %d %d %d", BIT(data,7), BIT(data,6), BIT(data,5), BIT(data,4), BIT(data,3), BIT(data,2), BIT(data,1) ); - output().set_lamp_value(0, !BIT(data,7)); /* Display Light 1 */ - output().set_lamp_value(1, !BIT(data,6)); /* Display Light 2 */ - output().set_lamp_value(2, !BIT(data,5)); /* Display Light 3 */ - output().set_lamp_value(3, !BIT(data,4)); /* Display Light 4 */ - output().set_lamp_value(4, !BIT(data,3)); /* Display Light 5 */ - output().set_lamp_value(5, !BIT(data,2)); /* Bet Light */ - output().set_lamp_value(6, !BIT(data,1)); /* Deal Light */ - output().set_lamp_value(7, !BIT(data,0)); /* Draw Light */ + m_lamp[0] = BIT(~data, 7); /* Display Light 1 */ + m_lamp[1] = BIT(~data, 6); /* Display Light 2 */ + m_lamp[2] = BIT(~data, 5); /* Display Light 3 */ + m_lamp[3] = BIT(~data, 4); /* Display Light 4 */ + m_lamp[4] = BIT(~data, 3); /* Display Light 5 */ + m_lamp[5] = BIT(~data, 2); /* Bet Light */ + m_lamp[6] = BIT(~data, 1); /* Deal Light */ + m_lamp[7] = BIT(~data, 0); /* Draw Light */ } WRITE8_MEMBER(smsmfg_state::ppi0_b_w) { - output().set_lamp_value(8, !BIT(data,7)); /* Stand Light */ - output().set_lamp_value(9, !BIT(data,6)); /* Cancel Light */ + m_lamp[8] = BIT(~data, 7); /* Stand Light */ + m_lamp[9] = BIT(~data, 6); /* Cancel Light */ machine().bookkeeping().coin_counter_w(0, BIT(data,1)); machine().bookkeeping().coin_lockout_w(0, BIT(data,5)); @@ -524,6 +530,7 @@ void smsmfg_state::sub_map(address_map &map) void smsmfg_state::machine_start() { + m_lamp.resolve(); membank("bank1")->configure_entries(0, 16, memregion("questions")->base(), 0x4000); save_item(NAME(m_communication_port_status)); diff --git a/src/mame/drivers/snookr10.cpp b/src/mame/drivers/snookr10.cpp index d61b2e2dd92..2413e11431d 100644 --- a/src/mame/drivers/snookr10.cpp +++ b/src/mame/drivers/snookr10.cpp @@ -698,13 +698,13 @@ WRITE8_MEMBER(snookr10_state::output_port_0_w) m_bit4 = m_outporth & 1; m_bit5 = (m_outporth >> 1) & 1; - output().set_lamp_value(0, m_bit5); /* Lamp 0 - START */ - output().set_lamp_value(1, m_bit2); /* Lamp 1 - CANCEL */ - output().set_lamp_value(2, m_bit0); /* Lamp 2 - STOP1 */ - output().set_lamp_value(3, m_bit1); /* Lamp 3 - STOP2 */ - output().set_lamp_value(4, m_bit0); /* Lamp 4 - STOP3 */ - output().set_lamp_value(5, m_bit3); /* Lamp 5 - STOP4 */ - output().set_lamp_value(6, m_bit4); /* Lamp 6 - STOP5 */ + m_lamp[0] = m_bit5; /* Lamp 0 - START */ + m_lamp[1] = m_bit2; /* Lamp 1 - CANCEL */ + m_lamp[2] = m_bit0; /* Lamp 2 - STOP1 */ + m_lamp[3] = m_bit1; /* Lamp 3 - STOP2 */ + m_lamp[4] = m_bit0; /* Lamp 4 - STOP3 */ + m_lamp[5] = m_bit3; /* Lamp 5 - STOP4 */ + m_lamp[6] = m_bit4; /* Lamp 6 - STOP5 */ machine().bookkeeping().coin_counter_w(0, data & 0x01); /* Coin in */ machine().bookkeeping().coin_counter_w(1, data & 0x10); /* Key in */ @@ -739,13 +739,13 @@ WRITE8_MEMBER(snookr10_state::output_port_1_w) m_bit4 = data & 1; m_bit5 = (data >> 1) & 1; - output().set_lamp_value(0, m_bit5); /* Lamp 0 - START */ - output().set_lamp_value(1, m_bit2); /* Lamp 1 - CANCEL */ - output().set_lamp_value(2, m_bit0); /* Lamp 2 - STOP1 */ - output().set_lamp_value(3, m_bit1); /* Lamp 3 - STOP2 */ - output().set_lamp_value(4, m_bit0); /* Lamp 4 - STOP3 */ - output().set_lamp_value(5, m_bit3); /* Lamp 5 - STOP4 */ - output().set_lamp_value(6, m_bit4); /* Lamp 6 - STOP5 */ + m_lamp[0] = m_bit5; /* Lamp 0 - START */ + m_lamp[1] = m_bit2; /* Lamp 1 - CANCEL */ + m_lamp[2] = m_bit0; /* Lamp 2 - STOP1 */ + m_lamp[3] = m_bit1; /* Lamp 3 - STOP2 */ + m_lamp[4] = m_bit0; /* Lamp 4 - STOP3 */ + m_lamp[5] = m_bit3; /* Lamp 5 - STOP4 */ + m_lamp[6] = m_bit4; /* Lamp 6 - STOP5 */ } diff --git a/src/mame/drivers/softbox.cpp b/src/mame/drivers/softbox.cpp index a77112d5c1b..0bb5a31ed14 100644 --- a/src/mame/drivers/softbox.cpp +++ b/src/mame/drivers/softbox.cpp @@ -295,9 +295,9 @@ WRITE8_MEMBER( softbox_state::ppi1_pc_w ) */ - output().set_led_value(LED_A, !BIT(data, 0)); - output().set_led_value(LED_B, !BIT(data, 1)); - output().set_led_value(LED_READY, !BIT(data, 2)); + m_led[LED_A] = BIT(~data, 0); + m_led[LED_B] = BIT(~data, 1); + m_led[LED_READY] = BIT(~data, 2); } static DEVICE_INPUT_DEFAULTS_START( terminal ) @@ -321,6 +321,7 @@ DEVICE_INPUT_DEFAULTS_END void softbox_state::machine_start() { + m_led.resolve(); } diff --git a/src/mame/drivers/spcforce.cpp b/src/mame/drivers/spcforce.cpp index 32176f944c8..db064b9d2ba 100644 --- a/src/mame/drivers/spcforce.cpp +++ b/src/mame/drivers/spcforce.cpp @@ -48,6 +48,8 @@ TODO: void spcforce_state::machine_start() { + m_lamp.resolve(); + save_item(NAME(m_sn76496_latch)); save_item(NAME(m_sn76496_select)); save_item(NAME(m_sn1_ready)); @@ -108,9 +110,9 @@ WRITE8_MEMBER(spcforce_state::soundtrigger_w) WRITE8_MEMBER(spcforce_state::misc_outputs_w) { - machine().output().set_lamp_value(0, BIT(data, 0)); // 1P start lamp + m_lamp[0] = BIT(data, 0); // 1P start lamp machine().bookkeeping().coin_counter_w(0, BIT(data, 1)); - machine().output().set_lamp_value(1, BIT(data, 2)); // 2P start lamp + m_lamp[1] = BIT(data, 2); // 2P start lamp machine().bookkeeping().coin_counter_w(1, BIT(data, 3)); } diff --git a/src/mame/drivers/spoker.cpp b/src/mame/drivers/spoker.cpp index c891c5dbbe7..26c6e4f12fa 100644 --- a/src/mame/drivers/spoker.cpp +++ b/src/mame/drivers/spoker.cpp @@ -49,7 +49,9 @@ public: m_palette(*this, "palette"), m_bg_tile_ram(*this, "bg_tile_ram"), m_fg_tile_ram(*this, "fg_tile_ram"), - m_fg_color_ram(*this, "fg_color_ram") { } + m_fg_color_ram(*this, "fg_color_ram"), + m_led(*this, "led%u", 0U) + { } required_device m_maincpu; required_device m_gfxdecode; @@ -63,6 +65,8 @@ public: required_shared_ptr m_fg_color_ram; tilemap_t *m_fg_tilemap; + output_finder<7> m_led; + // common int m_nmi_ack; uint8_t m_out[3]; @@ -185,7 +189,7 @@ WRITE8_MEMBER(spoker_state::nmi_and_coins_w) machine().bookkeeping().coin_counter_w(2, data & 0x08); // key in machine().bookkeeping().coin_counter_w(3, data & 0x10); // coin out mech - output().set_led_value(6, data & 0x40); // led for coin out / hopper active + m_led[6] = BIT(data, 6); // led for coin out / hopper active if(((m_nmi_ack & 0x80) == 0) && data & 0x80) m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); @@ -198,8 +202,8 @@ WRITE8_MEMBER(spoker_state::nmi_and_coins_w) WRITE8_MEMBER(spoker_state::video_and_leds_w) { - output().set_led_value(4, data & 0x01); // start? - output().set_led_value(5, data & 0x04); // l_bet? + m_led[4] = BIT(data, 0); // start? + m_led[5] = BIT(data, 2); // l_bet? m_video_enable = data & 0x40; m_hopper = (~data)& 0x80; @@ -210,10 +214,10 @@ WRITE8_MEMBER(spoker_state::video_and_leds_w) WRITE8_MEMBER(spoker_state::leds_w) { - output().set_led_value(0, data & 0x01); // stop_1 - output().set_led_value(1, data & 0x02); // stop_2 - output().set_led_value(2, data & 0x04); // stop_3 - output().set_led_value(3, data & 0x08); // stop + m_led[0] = BIT(data, 0); // stop_1 + m_led[1] = BIT(data, 1); // stop_2 + m_led[2] = BIT(data, 2); // stop_3 + m_led[3] = BIT(data, 3); // stop // data & 0x10? m_out[2] = data; @@ -578,6 +582,8 @@ GFXDECODE_END void spoker_state::machine_start() { + m_led.resolve(); + save_item(NAME(m_nmi_ack)); save_item(NAME(m_out)); save_item(NAME(m_video_enable)); diff --git a/src/mame/drivers/starshp1.cpp b/src/mame/drivers/starshp1.cpp index cf2521bcf32..8bb81955048 100644 --- a/src/mame/drivers/starshp1.cpp +++ b/src/mame/drivers/starshp1.cpp @@ -151,7 +151,7 @@ WRITE_LINE_MEMBER(starshp1_state::mux_w) WRITE_LINE_MEMBER(starshp1_state::led_w) { - output().set_led_value(0, !state); + m_led = state ? 0 : 1; } @@ -178,6 +178,12 @@ void starshp1_state::starshp1_map(address_map &map) } +void starshp1_state::machine_start() +{ + m_led.resolve(); +} + + static INPUT_PORTS_START( starshp1 ) PORT_START("SYSTEM") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) diff --git a/src/mame/drivers/subsino2.cpp b/src/mame/drivers/subsino2.cpp index a3894fad3c8..463a9de11a2 100644 --- a/src/mame/drivers/subsino2.cpp +++ b/src/mame/drivers/subsino2.cpp @@ -86,29 +86,18 @@ class subsino2_state : public driver_device { public: subsino2_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_outputs16(*this, "outputs16"), - m_outputs(*this, "outputs"), - m_maincpu(*this, "maincpu"), - m_oki(*this, "oki"), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen"), - m_palette(*this, "palette"), - m_hopper(*this, "hopper") { } + : driver_device(mconfig, type, tag) + , m_outputs16(*this, "outputs16") + , m_outputs(*this, "outputs") + , m_maincpu(*this, "maincpu") + , m_oki(*this, "oki") + , m_gfxdecode(*this, "gfxdecode") + , m_screen(*this, "screen") + , m_palette(*this, "palette") + , m_hopper(*this, "hopper") + , m_led(*this, "led%u", 0U) + { } - layer_t m_layers[2]; - uint8_t m_ss9601_byte_lo; - uint8_t m_ss9601_byte_lo2; - std::unique_ptr m_ss9601_reelrams[2]; - std::unique_ptr m_reelbitmap; - uint8_t m_ss9601_scrollctrl; - uint8_t m_ss9601_tilesize; - uint8_t m_ss9601_disable; - uint8_t m_dsw_mask; - optional_shared_ptr m_outputs16; - optional_shared_ptr m_outputs; - uint16_t m_bishjan_sound; - uint16_t m_bishjan_input; DECLARE_WRITE8_MEMBER(ss9601_byte_lo_w); DECLARE_WRITE8_MEMBER(ss9601_byte_lo2_w); DECLARE_WRITE8_MEMBER(ss9601_videoram_0_hi_w); @@ -176,12 +165,6 @@ public: DECLARE_VIDEO_START(subsino2); uint32_t screen_update_subsino2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(am188em_int0_irq); - required_device m_maincpu; - optional_device m_oki; - required_device m_gfxdecode; - required_device m_screen; - required_device m_palette; - optional_device m_hopper; void bishjan(machine_config &config); void saklove(machine_config &config); @@ -204,6 +187,32 @@ public: void xplan_io(address_map &map); void xplan_map(address_map &map); void xtrain_io(address_map &map); + +protected: + virtual void machine_start() override { m_led.resolve(); } + + layer_t m_layers[2]; + uint8_t m_ss9601_byte_lo; + uint8_t m_ss9601_byte_lo2; + std::unique_ptr m_ss9601_reelrams[2]; + std::unique_ptr m_reelbitmap; + uint8_t m_ss9601_scrollctrl; + uint8_t m_ss9601_tilesize; + uint8_t m_ss9601_disable; + uint8_t m_dsw_mask; + optional_shared_ptr m_outputs16; + optional_shared_ptr m_outputs; + uint16_t m_bishjan_sound; + uint16_t m_bishjan_input; + + required_device m_maincpu; + optional_device m_oki; + required_device m_gfxdecode; + required_device m_screen; + required_device m_palette; + optional_device m_hopper; + output_finder<9> m_led; + private: inline void ss9601_get_tile_info(layer_t *l, tile_data &tileinfo, tilemap_memory_index tile_index); }; @@ -988,20 +997,20 @@ WRITE16_MEMBER(subsino2_state::new2001_outputs_w) case 0: if (ACCESSING_BITS_8_15) { - output().set_led_value(0, data & 0x4000); // record? - output().set_led_value(1, data & 0x2000); // shoot now - output().set_led_value(2, data & 0x1000); // double - output().set_led_value(3, data & 0x0800); // black/red + m_led[0] = BIT(data, 14); // record? + m_led[1] = BIT(data, 13); // shoot now + m_led[2] = BIT(data, 12); // double + m_led[3] = BIT(data, 11); // black/red } if (ACCESSING_BITS_0_7) { - output().set_led_value(4, data & 0x0080); // start - output().set_led_value(5, data & 0x0040); // take - output().set_led_value(6, data & 0x0020); // black/red + m_led[4] = BIT(data, 7); // start + m_led[5] = BIT(data, 6); // take + m_led[6] = BIT(data, 5); // black/red machine().bookkeeping().coin_counter_w(0, data & 0x0010); // coin in / key in - output().set_led_value(7, data & 0x0004); // ? - output().set_led_value(8, data & 0x0002); // ? + m_led[7] = BIT(data, 2); // ? + m_led[8] = BIT(data, 1); // ? } break; } @@ -1083,15 +1092,15 @@ WRITE16_MEMBER(subsino2_state::humlan_outputs_w) case 0: if (ACCESSING_BITS_8_15) { - output().set_led_value(5, data & 0x2000); // big or small - output().set_led_value(4, data & 0x0400); // double - output().set_led_value(3, data & 0x0200); // big or small - output().set_led_value(2, data & 0x0100); // bet + m_led[5] = BIT(data, 13); // big or small + m_led[4] = BIT(data, 10); // double + m_led[3] = BIT(data, 9); // big or small + m_led[2] = BIT(data, 8); // bet } if (ACCESSING_BITS_0_7) { - output().set_led_value(1, data & 0x0080); // take - output().set_led_value(0, data & 0x0040); // start + m_led[1] = BIT(data, 7); // take + m_led[0] = BIT(data, 6); // start machine().bookkeeping().coin_counter_w(1, data & 0x0004); // key in machine().bookkeeping().coin_counter_w(0, data & 0x0002); // coin in } @@ -1122,21 +1131,21 @@ WRITE8_MEMBER(subsino2_state::expcard_outputs_w) break; case 1: // C - output().set_led_value(0, data & 0x02); // raise + m_led[0] = BIT(data, 1); // raise break; case 2: // B - output().set_led_value(1, data & 0x04); // hold 4 / small & hold 5 / big ? - output().set_led_value(2, data & 0x08); // hold 1 / bet - output().set_led_value(3, data & 0x10); // hold 2 / take ? - output().set_led_value(4, data & 0x20); // hold 3 / double up ? + m_led[1] = BIT(data, 2); // hold 4 / small & hold 5 / big ? + m_led[2] = BIT(data, 3); // hold 1 / bet + m_led[3] = BIT(data, 4); // hold 2 / take ? + m_led[4] = BIT(data, 5); // hold 3 / double up ? break; case 3: // A machine().bookkeeping().coin_counter_w(0, data & 0x01 ); // coin in machine().bookkeeping().coin_counter_w(1, data & 0x02 ); // key in - output().set_led_value(5, data & 0x10); // start + m_led[5] = BIT(data, 4); // start break; } @@ -1161,11 +1170,11 @@ WRITE8_MEMBER(subsino2_state::mtrain_outputs_w) break; case 1: - output().set_led_value(0, data & 0x01); // stop reel? - output().set_led_value(1, data & 0x02); // stop reel? (double or take) - output().set_led_value(2, data & 0x04); // start all - output().set_led_value(3, data & 0x08); // bet / stop all - output().set_led_value(4, data & 0x20); // stop reel? (double or take) + m_led[0] = BIT(data, 0); // stop reel? + m_led[1] = BIT(data, 1); // stop reel? (double or take) + m_led[2] = BIT(data, 2); // start all + m_led[3] = BIT(data, 3); // bet / stop all + m_led[4] = BIT(data, 5); // stop reel? (double or take) break; case 2: @@ -1376,22 +1385,22 @@ WRITE8_MEMBER(subsino2_state::xplan_outputs_w) break; case 1: - output().set_led_value(0, data & 0x02); // raise + m_led[0] = BIT(data, 1); // raise break; case 2: // B - output().set_led_value(1, data & 0x04); // hold 1 / big ? - output().set_led_value(2, data & 0x08); // hold 5 / bet - output().set_led_value(3, data & 0x10); // hold 4 ? - output().set_led_value(4, data & 0x20); // hold 2 / double up - output().set_led_value(5, data & 0x40); // hold 3 / small ? + m_led[1] = BIT(data, 2); // hold 1 / big ? + m_led[2] = BIT(data, 3); // hold 5 / bet + m_led[3] = BIT(data, 4); // hold 4 ? + m_led[4] = BIT(data, 5); // hold 2 / double up + m_led[5] = BIT(data, 6); // hold 3 / small ? break; case 3: // A machine().bookkeeping().coin_counter_w(0, data & 0x01 ); machine().bookkeeping().coin_counter_w(1, data & 0x02 ); - output().set_led_value(6, data & 0x10); // start / take + m_led[6] = BIT(data, 4); // start / take break; } @@ -1480,23 +1489,23 @@ WRITE8_MEMBER(subsino2_state::xtrain_outputs_w) break; case 1: // C - output().set_led_value(0, data & 0x02); // re-double - output().set_led_value(1, data & 0x04); // half double + m_led[0] = BIT(data, 1); // re-double + m_led[1] = BIT(data, 2); // half double break; case 2: // B - output().set_led_value(2, data & 0x02); // hold 3 / small - output().set_led_value(3, data & 0x04); // hold 2 / big - output().set_led_value(4, data & 0x08); // bet - output().set_led_value(5, data & 0x10); // hold1 / take - output().set_led_value(6, data & 0x20); // double up + m_led[2] = BIT(data, 1); // hold 3 / small + m_led[3] = BIT(data, 2); // hold 2 / big + m_led[4] = BIT(data, 3); // bet + m_led[5] = BIT(data, 4); // hold1 / take + m_led[6] = BIT(data, 5); // double up break; case 3: // A machine().bookkeeping().coin_counter_w(0, data & 0x01 ); // coin in machine().bookkeeping().coin_counter_w(1, data & 0x02 ); // key in - output().set_led_value(7, data & 0x10); // start + m_led[7] = BIT(data, 4); // start break; } diff --git a/src/mame/drivers/suna16.cpp b/src/mame/drivers/suna16.cpp index 7b7a83ab1d8..380dba6b320 100644 --- a/src/mame/drivers/suna16.cpp +++ b/src/mame/drivers/suna16.cpp @@ -59,10 +59,10 @@ WRITE16_MEMBER(suna16_state::bssoccer_leds_w) { if (ACCESSING_BITS_0_7) { - output().set_led_value(0, data & 0x01); - output().set_led_value(1, data & 0x02); - output().set_led_value(2, data & 0x04); - output().set_led_value(3, data & 0x08); + m_led[0] = BIT(data, 0); + m_led[1] = BIT(data, 1); + m_led[2] = BIT(data, 2); + m_led[3] = BIT(data, 3); machine().bookkeeping().coin_counter_w(0, data & 0x10); } if (data & ~0x1f) logerror("CPU#0 PC %06X - Leds unknown bits: %04X\n", m_maincpu->pc(), data); @@ -74,8 +74,8 @@ WRITE16_MEMBER(suna16_state::uballoon_leds_w) if (ACCESSING_BITS_0_7) { machine().bookkeeping().coin_counter_w(0, data & 0x01); - output().set_led_value(0, data & 0x02); - output().set_led_value(1, data & 0x04); + m_led[0] = BIT(data, 1); + m_led[1] = BIT(data, 2); } if (data & ~0x07) logerror("CPU#0 PC %06X - Leds unknown bits: %04X\n", m_maincpu->pc(), data); } diff --git a/src/mame/drivers/suna8.cpp b/src/mame/drivers/suna8.cpp index 7f59326ea06..ba2f772a7d8 100644 --- a/src/mame/drivers/suna8.cpp +++ b/src/mame/drivers/suna8.cpp @@ -708,8 +708,8 @@ WRITE8_MEMBER(suna8_state::brickzn_rombank_w) */ WRITE8_MEMBER(suna8_state::brickzn_leds_w) { - output().set_led_value(0, data & 0x01); - output().set_led_value(1, data & 0x02); + m_led[0] = BIT(data, 0); + m_led[1] = BIT(data, 1); machine().bookkeeping().coin_counter_w(0, data & 0x04); logerror("CPU #0 - PC %04X: leds = %02X\n",m_maincpu->pc(),data); @@ -922,8 +922,8 @@ WRITE8_MEMBER(suna8_state::hardhea2_flipscreen_w) WRITE8_MEMBER(suna8_state::hardhea2_leds_w) { - output().set_led_value(0, data & 0x01); - output().set_led_value(1, data & 0x02); + m_led[0] = BIT(data, 0); + m_led[1] = BIT(data, 1); machine().bookkeeping().coin_counter_w(0, data & 0x04); if (data & ~0x07) logerror("CPU #0 - PC %04X: unknown leds bits: %02X\n",m_maincpu->pc(),data); } @@ -1079,8 +1079,8 @@ WRITE8_MEMBER(suna8_state::starfigh_spritebank_w) */ WRITE8_MEMBER(suna8_state::starfigh_leds_w) { - output().set_led_value(0, data & 0x01); - output().set_led_value(1, data & 0x02); + m_led[0] = BIT(data, 0); + m_led[1] = BIT(data, 1); machine().bookkeeping().coin_counter_w(0, data & 0x04); m_gfxbank = (data & 0x08) ? 4 : 0; if (data & ~0x0f) logerror("CPU #0 - PC %04X: unknown leds bits: %02X\n",m_maincpu->pc(),data); @@ -1194,8 +1194,8 @@ WRITE8_MEMBER(suna8_state::suna8_wram_w) */ WRITE8_MEMBER(suna8_state::sparkman_rombank_w) { - output().set_led_value(0, data & 0x01); - output().set_led_value(1, data & 0x02); + m_led[0] = BIT(data, 0); + m_led[1] = BIT(data, 1); if (data & ~0x03) logerror("CPU #0 - PC %04X: unknown leds bits: %02X\n",m_maincpu->pc(),data); diff --git a/src/mame/drivers/system16.cpp b/src/mame/drivers/system16.cpp index 34f94c8d96c..90d4e055e7f 100644 --- a/src/mame/drivers/system16.cpp +++ b/src/mame/drivers/system16.cpp @@ -174,8 +174,8 @@ WRITE16_MEMBER(segas1x_bootleg_state::sys16_coinctrl_w) { m_coinctrl = data & 0xff; m_refreshenable = m_coinctrl & 0x20; - output().set_led_value(1, m_coinctrl & 0x08); - output().set_led_value(0, m_coinctrl & 0x04); + m_led[1] = BIT(m_coinctrl, 3); + m_led[0] = BIT(m_coinctrl, 2); machine().bookkeeping().coin_counter_w(1, m_coinctrl & 0x02); machine().bookkeeping().coin_counter_w(0, m_coinctrl & 0x01); /* bit 6 is also used (1 most of the time; 0 in dduxbl, sdi, wb3; diff --git a/src/mame/drivers/taito_z.cpp b/src/mame/drivers/taito_z.cpp index a31f050cf1e..bb84029bc7a 100644 --- a/src/mame/drivers/taito_z.cpp +++ b/src/mame/drivers/taito_z.cpp @@ -1306,8 +1306,8 @@ WRITE16_MEMBER(taitoz_state::chasehq_cpua_ctrl_w) { cpua_ctrl_w(space, offset, data, mem_mask); - output().set_lamp_value(0, (m_cpua_ctrl & 0x20) ? 1 : 0); - output().set_lamp_value(1, (m_cpua_ctrl & 0x40) ? 1 : 0); + m_lamp[0] = BIT(m_cpua_ctrl, 5); + m_lamp[1] = BIT(m_cpua_ctrl, 6); } WRITE16_MEMBER(taitoz_state::dblaxle_cpua_ctrl_w) diff --git a/src/mame/drivers/tek405x.cpp b/src/mame/drivers/tek405x.cpp index f935e28df21..fd50c8a1e20 100644 --- a/src/mame/drivers/tek405x.cpp +++ b/src/mame/drivers/tek405x.cpp @@ -622,9 +622,9 @@ WRITE8_MEMBER( tek4051_state::kb_pia_pb_w ) */ // lamps - output().set_led_value(1, !BIT(data, 5)); - output().set_led_value(2, !BIT(data, 6)); - output().set_led_value(3, !BIT(data, 7)); + m_lamp[1] = BIT(~data, 5); + m_lamp[2] = BIT(~data, 6); + m_lamp[3] = BIT(~data, 7); // end or identify m_gpib->eoi_w(!BIT(data, 4)); @@ -958,6 +958,8 @@ WRITE_LINE_MEMBER( tek4051_state::write_acia_clock ) void tek4051_state::machine_start() { + m_lamp.resolve(); + address_space &program = m_maincpu->space(AS_PROGRAM); // configure RAM diff --git a/src/mame/drivers/tempest.cpp b/src/mame/drivers/tempest.cpp index 8661512f3c1..627581c4ba8 100644 --- a/src/mame/drivers/tempest.cpp +++ b/src/mame/drivers/tempest.cpp @@ -298,8 +298,8 @@ static constexpr XTAL CLOCK_3KHZ = MASTER_CLOCK / 4096; class tempest_state : public driver_device { public: - tempest_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + tempest_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_mathbox(*this, "mathbox"), m_watchdog(*this, "watchdog"), @@ -310,7 +310,8 @@ public: m_buttons_p1(*this, TEMPEST_BUTTONS_P1_TAG), m_buttons_p2(*this, TEMPEST_BUTTONS_P2_TAG), m_in1(*this, "IN1/DSW0"), - m_in2(*this, "IN2") + m_in2(*this, "IN2"), + m_led(*this, "led%u", 0U) { } DECLARE_CUSTOM_INPUT_MEMBER(tempest_knob_r); @@ -343,6 +344,7 @@ private: required_ioport m_buttons_p2; required_ioport m_in1; required_ioport m_in2; + output_finder<2> m_led; uint8_t m_player_select; }; @@ -350,6 +352,7 @@ private: void tempest_state::machine_start() { + m_led.resolve(); save_item(NAME(m_player_select)); } @@ -410,8 +413,8 @@ READ8_MEMBER(tempest_state::input_port_2_bit_r) WRITE8_MEMBER(tempest_state::tempest_led_w) { - output().set_led_value(0, ~data & 0x02); - output().set_led_value(1, ~data & 0x01); + m_led[0] = BIT(~data, 1); + m_led[1] = BIT(~data, 0); /* FLIP is bit 0x04 */ m_player_select = data & 0x04; } diff --git a/src/mame/drivers/tetrisp2.cpp b/src/mame/drivers/tetrisp2.cpp index 7e7fa8a0777..871335793ca 100644 --- a/src/mame/drivers/tetrisp2.cpp +++ b/src/mame/drivers/tetrisp2.cpp @@ -343,10 +343,10 @@ WRITE16_MEMBER(tetrisp2_state::nndmseal_coincounter_w) } if (ACCESSING_BITS_8_15) { - output().set_led_value(0, data & 0x1000 ); // + - output().set_led_value(1, data & 0x2000 ); // - - output().set_led_value(2, data & 0x4000 ); // Cancel - output().set_led_value(3, data & 0x8000 ); // OK + m_led[0] = BIT(data, 12); // + + m_led[1] = BIT(data, 13); // - + m_led[2] = BIT(data, 14); // Cancel + m_led[3] = BIT(data, 15); // OK } // popmessage("%04x",data); } @@ -595,20 +595,20 @@ WRITE16_MEMBER(stepstag_state::stepstag_neon_w) // 1f60, 1c60, 0790, 0490, 0b60, 0860, 1390, 1090, 1f60, 1c60, 1390, 1090, 0b60, 0860, 0790, 0490, ... if (ACCESSING_BITS_0_7) { - output().set_led_value(32, data & 0x0000); // Spot Lights? - output().set_led_value(33, data & 0x0010); - output().set_led_value(34, data & 0x0020); - output().set_led_value(35, data & 0x0040); + m_led[32] = 0; //data & 0x0000; // Spot Lights? + m_led[33] = BIT(data, 4); + m_led[34] = BIT(data, 5); + m_led[35] = BIT(data, 6); } if (ACCESSING_BITS_8_15) { - output().set_led_value(40, data & 0x0100); // - output().set_led_value(41, data & 0x0200); + m_led[40] = BIT(data, 8); + m_led[41] = BIT(data, 9); - output().set_led_value(42, data & 0x0400); - output().set_led_value(43, data & 0x0800); - output().set_led_value(44, data & 0x1000); + m_led[42] = BIT(data, 10); + m_led[43] = BIT(data, 11); + m_led[44] = BIT(data, 12); } } @@ -616,22 +616,22 @@ WRITE16_MEMBER(stepstag_state::stepstag_step_leds_w) { if (ACCESSING_BITS_0_7) { - output().set_led_value( 0, data & 0x0001); // P2 Front-Left - output().set_led_value( 1, data & 0x0002); // P2 Front-Right - output().set_led_value( 2, data & 0x0004); // P2 Left - output().set_led_value( 3, data & 0x0008); // P2 Right - output().set_led_value( 4, data & 0x0010); // P2 Back-Left - output().set_led_value( 5, data & 0x0020); // P2 Back-Right + m_led[0] = BIT(data, 0); // P2 Front-Left + m_led[1] = BIT(data, 1); // P2 Front-Right + m_led[2] = BIT(data, 2); // P2 Left + m_led[3] = BIT(data, 3); // P2 Right + m_led[4] = BIT(data, 4); // P2 Back-Left + m_led[5] = BIT(data, 5); // P2 Back-Right } if (ACCESSING_BITS_8_15) { - output().set_led_value( 6, data & 0x0100); // P1 Front-Left - output().set_led_value( 7, data & 0x0200); // P1 Front-Right - output().set_led_value( 8, data & 0x0400); // P1 Left - output().set_led_value( 9, data & 0x0800); // P1 Right - output().set_led_value(10, data & 0x1000); // P1 Back-Left - output().set_led_value(11, data & 0x2000); // P1 Back-Right + m_led[6] = BIT(data, 8); // P1 Front-Left + m_led[7] = BIT(data, 9); // P1 Front-Right + m_led[8] = BIT(data, 10); // P1 Left + m_led[9] = BIT(data, 11); // P1 Right + m_led[10] = BIT(data, 12); // P1 Back-Left + m_led[11] = BIT(data, 13); // P1 Back-Right } } @@ -639,12 +639,12 @@ WRITE16_MEMBER(stepstag_state::stepstag_button_leds_w) { if (ACCESSING_BITS_8_15) { - output().set_led_value(17, data & 0x0100); // P2 Start - output().set_led_value(18, data & 0x0200); // P2 Left - output().set_led_value(19, data & 0x0400); // P2 Right - output().set_led_value(20, data & 0x1000); // P1 Start - output().set_led_value(21, data & 0x2000); // P1 Left - output().set_led_value(22, data & 0x4000); // P1 Right + m_led[17] = BIT(data, 8); // P2 Start + m_led[18] = BIT(data, 9); // P2 Left + m_led[19] = BIT(data, 10); // P2 Right + m_led[20] = BIT(data, 12); // P1 Start + m_led[21] = BIT(data, 13); // P1 Left + m_led[22] = BIT(data, 14); // P1 Right } } diff --git a/src/mame/drivers/thedealr.cpp b/src/mame/drivers/thedealr.cpp index a1b7bd1b582..f59797fca4b 100644 --- a/src/mame/drivers/thedealr.cpp +++ b/src/mame/drivers/thedealr.cpp @@ -42,20 +42,15 @@ class thedealr_state : public driver_device { public: - thedealr_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + thedealr_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_subcpu(*this, "subcpu"), m_seta001(*this, "spritegen"), - m_palette(*this, "palette") + m_palette(*this, "palette"), + m_led(*this, "led%u", 0U) { } - // devices - required_device m_maincpu; - required_device m_subcpu; - required_device m_seta001; - required_device m_palette; - // IOX DECLARE_READ8_MEMBER(iox_r); DECLARE_WRITE8_MEMBER(iox_w); @@ -68,8 +63,6 @@ public: DECLARE_WRITE8_MEMBER(unk_w); // machine - DECLARE_MACHINE_START(thedealr); - DECLARE_MACHINE_RESET(thedealr); TIMER_DEVICE_CALLBACK_MEMBER(thedealr_interrupt); // video @@ -79,6 +72,18 @@ public: void thedealr(machine_config &config); void thedealr(address_map &map); void thedealr_sub(address_map &map); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + +private: + // devices + required_device m_maincpu; + required_device m_subcpu; + required_device m_seta001; + required_device m_palette; + output_finder<8> m_led; }; /*************************************************************************** @@ -135,7 +140,7 @@ void thedealr_state::iox_reset() m_iox_coins = 0x00; } -MACHINE_RESET_MEMBER(thedealr_state,thedealr) +void thedealr_state::machine_reset() { iox_reset(); } @@ -160,14 +165,14 @@ WRITE8_MEMBER(thedealr_state::iox_w) { case 0x20: // leds m_iox_leds = data; - output().set_led_value(0, data & 0x01); // bet - output().set_led_value(1, data & 0x02); // deal - output().set_led_value(2, data & 0x04); - output().set_led_value(3, data & 0x08); - output().set_led_value(4, data & 0x10); // hold 1-5? - output().set_led_value(5, data & 0x20); - output().set_led_value(6, data & 0x40); - output().set_led_value(7, data & 0x80); + m_led[0] = BIT(data, 0); // bet + m_led[1] = BIT(data, 1); // deal + m_led[2] = BIT(data, 2); + m_led[3] = BIT(data, 3); + m_led[4] = BIT(data, 4); // hold 1-5? + m_led[5] = BIT(data, 5); + m_led[6] = BIT(data, 6); + m_led[7] = BIT(data, 7); break; case 0x40: // coin counters @@ -506,8 +511,10 @@ GFXDECODE_END ***************************************************************************/ -MACHINE_START_MEMBER(thedealr_state,thedealr) +void thedealr_state::machine_start() { + m_led.resolve(); + save_item(NAME(m_iox_status)); save_item(NAME(m_iox_ret)); save_item(NAME(m_iox_cmd)); @@ -546,9 +553,6 @@ MACHINE_CONFIG_START(thedealr_state::thedealr) MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode") - MCFG_MACHINE_RESET_OVERRIDE(thedealr_state,thedealr) - MCFG_MACHINE_START_OVERRIDE(thedealr_state,thedealr) - // video hardware MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) diff --git a/src/mame/drivers/ti74.cpp b/src/mame/drivers/ti74.cpp index 72ad93d5b11..64099334700 100644 --- a/src/mame/drivers/ti74.cpp +++ b/src/mame/drivers/ti74.cpp @@ -85,22 +85,15 @@ class ti74_state : public driver_device { public: - ti74_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + ti74_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_cart(*this, "cartslot"), m_key_matrix(*this, "IN.%u", 0), - m_battery_inp(*this, "BATTERY") + m_battery_inp(*this, "BATTERY"), + m_lamp(*this, "lamp%u", 0U) { } - required_device m_maincpu; - required_device m_cart; - required_ioport_array<8> m_key_matrix; - required_ioport m_battery_inp; - - u8 m_key_select; - u8 m_power; - void update_lcd_indicator(u8 y, u8 x, int state); void update_battery_status(int state); @@ -108,8 +101,6 @@ public: DECLARE_WRITE8_MEMBER(keyboard_w); DECLARE_WRITE8_MEMBER(bankswitch_w); - virtual void machine_reset() override; - virtual void machine_start() override; DECLARE_PALETTE_INIT(ti74); DECLARE_INPUT_CHANGED_MEMBER(battery_status_changed); DECLARE_DEVICE_IMAGE_LOAD_MEMBER(ti74_cartridge); @@ -118,6 +109,21 @@ public: void ti74(machine_config &config); void ti95(machine_config &config); void main_map(address_map &map); + +protected: + virtual void machine_reset() override; + virtual void machine_start() override; + +private: + required_device m_maincpu; + required_device m_cart; + required_ioport_array<8> m_key_matrix; + required_ioport m_battery_inp; + + u8 m_key_select; + u8 m_power; + + output_finder<80> m_lamp; }; @@ -174,7 +180,7 @@ void ti74_state::update_lcd_indicator(u8 y, u8 x, int state) // above | _LOW _ERROR 2nd INV ALPHA LC INS DEGRAD HEX OCT I/O // screen- | _P{70} <{71} RUN{3} // area . SYS{4} - output().set_lamp_value(y * 10 + x, state); + m_lamp[y * 10 + x] = state ? 1 : 0; } HD44780_PIXEL_UPDATE(ti74_state::ti74_pixel_update) @@ -492,6 +498,8 @@ void ti74_state::machine_reset() void ti74_state::machine_start() { + m_lamp.resolve(); + if (m_cart->exists()) m_maincpu->space(AS_PROGRAM).install_read_handler(0x4000, 0xbfff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); diff --git a/src/mame/drivers/tiki100.cpp b/src/mame/drivers/tiki100.cpp index 5c80a87e575..fbd5398666c 100644 --- a/src/mame/drivers/tiki100.cpp +++ b/src/mame/drivers/tiki100.cpp @@ -281,10 +281,10 @@ WRITE8_MEMBER( tiki100_state::system_w ) if (floppy) floppy->mon_w(!BIT(data, 6)); /* GRAFIKK key led */ - output().set_led_value(1, BIT(data, 5)); + m_led[1] = BIT(data, 5); /* LOCK key led */ - output().set_led_value(2, BIT(data, 7)); + m_led[2] = BIT(data, 7); /* bankswitch */ m_rome = BIT(data, 2); @@ -671,6 +671,8 @@ WRITE_LINE_MEMBER( tiki100_state::busrq_w ) void tiki100_state::machine_start() { + m_led.resolve(); + /* allocate video RAM */ m_video_ram.allocate(TIKI100_VIDEORAM_SIZE); diff --git a/src/mame/drivers/tmc1800.cpp b/src/mame/drivers/tmc1800.cpp index 7e9031ab823..2d1039fce4e 100644 --- a/src/mame/drivers/tmc1800.cpp +++ b/src/mame/drivers/tmc1800.cpp @@ -553,7 +553,7 @@ WRITE_LINE_MEMBER( tmc2000_state::q_w ) m_cti->aoe_w(state); /* set Q led status */ - output().set_led_value(1, state); + m_led[1] = state ? 1 : 0; /* tape output */ m_cassette->output(state ? 1.0 : -1.0); @@ -598,7 +598,7 @@ WRITE_LINE_MEMBER( nano_state::q_w ) m_cti->aoe_w(state); /* set Q led status */ - output().set_led_value(1, state); + m_led[1] = state ? 1 : 0; /* tape output */ m_cassette->output(state ? 1.0 : -1.0); @@ -636,12 +636,12 @@ void osc1000b_state::machine_reset() void tmc2000_state::machine_start() { - uint16_t addr; + m_led.resolve(); m_colorram.allocate(TMC2000_COLORRAM_SIZE); // randomize color RAM contents - for (addr = 0; addr < TMC2000_COLORRAM_SIZE; addr++) + for (uint16_t addr = 0; addr < TMC2000_COLORRAM_SIZE; addr++) { m_colorram[addr] = machine().rand() & 0xff; } @@ -677,6 +677,8 @@ void nano_state::device_timer(emu_timer &timer, device_timer_id id, int param, v void nano_state::machine_start() { + m_led.resolve(); + /* register for state saving */ save_item(NAME(m_keylatch)); } diff --git a/src/mame/drivers/tmc2000e.cpp b/src/mame/drivers/tmc2000e.cpp index f61cf359fbd..0dfde634fda 100644 --- a/src/mame/drivers/tmc2000e.cpp +++ b/src/mame/drivers/tmc2000e.cpp @@ -243,7 +243,7 @@ WRITE_LINE_MEMBER( tmc2000e_state::q_w ) m_cti->aoe_w(state); // set Q led status - output().set_led_value(1, state); + m_led[1] = state ? 1 : 0; // tape out m_cassette->output(state ? -1.0 : +1.0); @@ -264,6 +264,8 @@ WRITE8_MEMBER( tmc2000e_state::dma_w ) void tmc2000e_state::machine_start() { + m_led.resolve(); + /* register for state saving */ save_item(NAME(m_cdp1864_efx)); save_item(NAME(m_keylatch)); diff --git a/src/mame/drivers/tourtabl.cpp b/src/mame/drivers/tourtabl.cpp index b475b3d12fd..e66ddf6d3f0 100644 --- a/src/mame/drivers/tourtabl.cpp +++ b/src/mame/drivers/tourtabl.cpp @@ -23,12 +23,14 @@ class tourtabl_state : public driver_device public: tourtabl_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu") + m_maincpu(*this, "maincpu"), + m_led(*this, "led%u", 0U) { } void tourtabl(machine_config &config); protected: + virtual void machine_start() override { m_led.resolve(); } DECLARE_WRITE8_MEMBER(tourtabl_led_w); DECLARE_READ16_MEMBER(tourtabl_read_input_port); DECLARE_READ8_MEMBER(tourtabl_get_databus_contents); @@ -36,6 +38,7 @@ protected: private: required_device m_maincpu; + output_finder<4> m_led; }; @@ -44,10 +47,10 @@ private: WRITE8_MEMBER(tourtabl_state::tourtabl_led_w) { - output().set_led_value(0, data & 0x40); /* start 1 */ - output().set_led_value(1, data & 0x20); /* start 2 */ - output().set_led_value(2, data & 0x10); /* start 4 */ - output().set_led_value(3, data & 0x80); /* select game */ + m_led[0] = BIT(data, 6); /* start 1 */ + m_led[1] = BIT(data, 5); /* start 2 */ + m_led[2] = BIT(data, 4); /* start 4 */ + m_led[3] = BIT(data, 7); /* select game */ machine().bookkeeping().coin_lockout_global_w(!(data & 0x80)); } diff --git a/src/mame/drivers/triplhnt.cpp b/src/mame/drivers/triplhnt.cpp index 77e69d755ed..8ef6c856027 100644 --- a/src/mame/drivers/triplhnt.cpp +++ b/src/mame/drivers/triplhnt.cpp @@ -51,7 +51,7 @@ WRITE_LINE_MEMBER(triplhnt_state::sprite_bank_w) WRITE_LINE_MEMBER(triplhnt_state::lamp1_w) { - output().set_led_value(0, state); + m_lamp = state ? 1 : 0; } @@ -114,6 +114,12 @@ READ8_MEMBER(triplhnt_state::da_latch_r) } +void triplhnt_state::machine_start() +{ + m_lamp.resolve(); +} + + void triplhnt_state::triplhnt_map(address_map &map) { map.global_mask(0x7fff); diff --git a/src/mame/drivers/tunhunt.cpp b/src/mame/drivers/tunhunt.cpp index 86c8f90952e..a8595c3d64c 100644 --- a/src/mame/drivers/tunhunt.cpp +++ b/src/mame/drivers/tunhunt.cpp @@ -72,9 +72,9 @@ WRITE8_MEMBER(tunhunt_state::control_w) */ m_control = data; - machine().bookkeeping().coin_counter_w(0,data&0x01 ); - machine().bookkeeping().coin_counter_w(1,data&0x02 ); - output().set_led_value(0, data&0x40 ); /* start */ + machine().bookkeeping().coin_counter_w(0, BIT(data, 0)); + machine().bookkeeping().coin_counter_w(1, BIT(data, 1)); + m_led = BIT(data , 6); /* start */ } diff --git a/src/mame/drivers/turbo.cpp b/src/mame/drivers/turbo.cpp index ef175948410..81c95edb4c6 100644 --- a/src/mame/drivers/turbo.cpp +++ b/src/mame/drivers/turbo.cpp @@ -299,7 +299,7 @@ WRITE8_MEMBER(turbo_state::subroc3d_ppi0b_w) /* bit 4 = FLIP (not really flip, just offset) */ machine().bookkeeping().coin_counter_w(0, data & 0x01); machine().bookkeeping().coin_counter_w(1, data & 0x02); - output().set_led_value(0, data & 0x04); + m_lamp = BIT(data, 2); m_subroc3d_flip = (data >> 4) & 1; } @@ -346,7 +346,7 @@ WRITE8_MEMBER(turbo_state::buckrog_ppi1c_w) m_buckrog_obch = data & 0x07; machine().bookkeeping().coin_counter_w(0, data & 0x10); machine().bookkeeping().coin_counter_w(1, data & 0x20); - output().set_led_value(0, data & 0x40); + m_lamp = BIT(data, 6); } @@ -416,7 +416,7 @@ WRITE_LINE_MEMBER(turbo_state::coin_meter_2_w) WRITE_LINE_MEMBER(turbo_state::start_lamp_w) { - machine().output().set_led_value(0, state); + m_lamp = state ? 1 : 0; } diff --git a/src/mame/drivers/unico.cpp b/src/mame/drivers/unico.cpp index 21cb34f7419..d0c93fcb952 100644 --- a/src/mame/drivers/unico.cpp +++ b/src/mame/drivers/unico.cpp @@ -96,8 +96,8 @@ WRITE16_MEMBER(zeropnt_state::zeropnt_sound_bank_w) memcpy(dst + 0x20000, src, 0x20000); machine().bookkeeping().coin_counter_w(0,data & 0x1000); - output().set_led_value(0,data & 0x0800); // Start 1 - output().set_led_value(1,data & 0x0400); // Start 2 + m_led[0] = BIT(data, 11); // Start 1 + m_led[1] = BIT(data, 10); // Start 2 } } @@ -192,8 +192,8 @@ WRITE32_MEMBER(zeropnt2_state::zeropnt2_leds_w) if (ACCESSING_BITS_16_23) { machine().bookkeeping().coin_counter_w(0,data & 0x00010000); - output().set_led_value(0,data & 0x00800000); // Start 1 - output().set_led_value(1,data & 0x00400000); // Start 2 + m_led[0] = BIT(data, 23); // Start 1 + m_led[1] = BIT(data, 22); // Start 2 } } @@ -565,6 +565,12 @@ GFXDECODE_END ***************************************************************************/ +void unico_state::machine_start() +{ + m_led.resolve(); +} + + /*************************************************************************** Burglar X ***************************************************************************/ diff --git a/src/mame/drivers/victory.cpp b/src/mame/drivers/victory.cpp index de111899849..316580bb4c7 100644 --- a/src/mame/drivers/victory.cpp +++ b/src/mame/drivers/victory.cpp @@ -112,10 +112,10 @@ WRITE8_MEMBER(victory_state::lamp_control_w) { - output().set_led_value(0, data & 0x80); - output().set_led_value(1, data & 0x40); - output().set_led_value(2, data & 0x20); - output().set_led_value(3, data & 0x10); + m_lamp[0] = BIT(data, 7); + m_lamp[1] = BIT(data, 6); + m_lamp[2] = BIT(data, 5); + m_lamp[3] = BIT(data, 4); } diff --git a/src/mame/drivers/videopin.cpp b/src/mame/drivers/videopin.cpp index efcbc042a82..5e8c66b2e4f 100644 --- a/src/mame/drivers/videopin.cpp +++ b/src/mame/drivers/videopin.cpp @@ -81,6 +81,7 @@ TIMER_CALLBACK_MEMBER(videopin_state::interrupt_callback) void videopin_state::machine_start() { + m_led.resolve(); m_interrupt_timer = timer_alloc(TIMER_INTERRUPT); save_item(NAME(m_time_pushed)); @@ -156,7 +157,7 @@ WRITE8_MEMBER(videopin_state::led_w) output().set_value(matrix[i][3], (data >> 3) & 1); if (i == 7) - output().set_led_value(0, data & 8); /* start button */ + m_led = BIT(data, 3); /* start button */ m_maincpu->set_input_line(0, CLEAR_LINE); } diff --git a/src/mame/drivers/videopkr.cpp b/src/mame/drivers/videopkr.cpp index 6d91c5ca464..e01d639e441 100644 --- a/src/mame/drivers/videopkr.cpp +++ b/src/mame/drivers/videopkr.cpp @@ -311,42 +311,9 @@ public: , m_dac(*this, "dac") , m_gfxdecode(*this, "gfxdecode") , m_digits(*this, "digit%u", 0U) + , m_lamp(*this, "lamp%u", 0U) { } - uint8_t m_data_ram[0x100]; - uint8_t m_video_ram[0x0400]; - uint8_t m_color_ram[0x0400]; - uint16_t m_p1; - uint16_t m_p2; - uint8_t m_t0_latch; - uint16_t m_n_offs; - uint8_t m_vp_sound_p2; - uint8_t m_p24_data; - uint8_t m_sound_latch; - uint8_t m_baby_latch; - uint8_t m_sound_ant; - uint8_t m_dc_4020; - uint8_t m_dc_40103; - uint8_t m_te_40103; - uint8_t m_ld_40103; - uint8_t m_ant_jckp; - uint8_t m_jckp; - uint8_t m_ant_cio; - uint8_t m_c_io; - uint8_t m_hp_1; - uint8_t m_hp_2; - uint8_t m_bell; - uint8_t m_aux3; - uint8_t m_dvrt; - unsigned long m_count0; - unsigned long m_count1; - unsigned long m_count2; - unsigned long m_count3; - unsigned long m_count4; - uint8_t m_sbp0; - uint8_t m_sbp2; - uint8_t m_sbp3; - tilemap_t *m_bg_tilemap; DECLARE_READ8_MEMBER(videopkr_io_r); DECLARE_WRITE8_MEMBER(videopkr_io_w); DECLARE_READ8_MEMBER(videopkr_p1_data_r); @@ -368,8 +335,6 @@ public: DECLARE_READ8_MEMBER(baby_sound_p3_r); DECLARE_WRITE8_MEMBER(baby_sound_p3_w); TILE_GET_INFO_MEMBER(get_bg_tile_info); - virtual void machine_start() override; - virtual void video_start() override; DECLARE_PALETTE_INIT(videopkr); DECLARE_VIDEO_START(vidadcba); DECLARE_PALETTE_INIT(babypkr); @@ -377,11 +342,6 @@ public: uint32_t screen_update_videopkr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_DEVICE_CALLBACK_MEMBER(sound_t1_callback); void count_7dig(unsigned long data, uint8_t index); - required_device m_maincpu; - required_device m_soundcpu; - required_device m_dac; - required_device m_gfxdecode; - output_finder<28> m_digits; void babypkr(machine_config &config); void videodad(machine_config &config); void videopkr(machine_config &config); @@ -396,6 +356,51 @@ public: void i8051_sound_port(address_map &map); void i8751_io_port(address_map &map); void i8751_map(address_map &map); + +protected: + virtual void machine_start() override; + virtual void video_start() override; + + uint8_t m_data_ram[0x100]; + uint8_t m_video_ram[0x0400]; + uint8_t m_color_ram[0x0400]; + uint16_t m_p1; + uint16_t m_p2; + uint8_t m_t0_latch; + uint16_t m_n_offs; + uint8_t m_vp_sound_p2; + uint8_t m_p24_data; + uint8_t m_sound_latch; + uint8_t m_baby_latch; + uint8_t m_sound_ant; + uint8_t m_dc_4020; + uint8_t m_dc_40103; + uint8_t m_te_40103; + uint8_t m_ld_40103; + uint8_t m_ant_jckp; + uint8_t m_jckp; + uint8_t m_ant_cio; + uint8_t m_c_io; + uint8_t m_hp_1; + uint8_t m_hp_2; + uint8_t m_bell; + uint8_t m_aux3; + uint8_t m_dvrt; + unsigned long m_count0; + unsigned long m_count1; + unsigned long m_count2; + unsigned long m_count3; + unsigned long m_count4; + uint8_t m_sbp0; + uint8_t m_sbp2; + uint8_t m_sbp3; + tilemap_t *m_bg_tilemap; + required_device m_maincpu; + required_device m_soundcpu; + required_device m_dac; + required_device m_gfxdecode; + output_finder<28> m_digits; + output_finder<14> m_lamp; }; @@ -690,14 +695,14 @@ WRITE8_MEMBER(videopkr_state::videopkr_io_w) case 0xef: /* Port 2.4 */ { - output().set_lamp_value(0, (data & 1)); /* L_1 */ - output().set_lamp_value(1, ((data >> 1)& 1)); /* L_2 */ - output().set_lamp_value(2, ((data >> 2) & 1)); /* L_3 */ - output().set_lamp_value(3, ((data >> 3) & 1)); /* L_4 */ - output().set_lamp_value(4, ((data >> 4) & 1)); /* Coin */ - output().set_lamp_value(5, ((data >> 5) & 1)); /* Hopper_1 */ - output().set_lamp_value(6, ((data >> 6) & 1)); /* Hopper_2 */ - output().set_lamp_value(7, ((data >> 7) & 1)); /* Diverter */ + m_lamp[0] = BIT(data, 0); /* L_1 */ + m_lamp[1] = BIT(data, 1); /* L_2 */ + m_lamp[2] = BIT(data, 2); /* L_3 */ + m_lamp[3] = BIT(data, 3); /* L_4 */ + m_lamp[4] = BIT(data, 4); /* Coin */ + m_lamp[5] = BIT(data, 5); /* Hopper_1 */ + m_lamp[6] = BIT(data, 6); /* Hopper_2 */ + m_lamp[7] = BIT(data, 7); /* Diverter */ m_p24_data = data; m_hp_1 = (~m_p24_data >> 6) & 1; m_hp_2 = (~m_p24_data >> 5) & 1; @@ -727,12 +732,12 @@ WRITE8_MEMBER(videopkr_state::videopkr_p1_data_w) { m_p1 = data; - output().set_lamp_value(8, (data & 1)); /* Aux_0 - Jackpot mech. counter (Baby Games)*/ - output().set_lamp_value(9, ((data >> 1) & 1)); /* Aux_1 - */ - output().set_lamp_value(10, ((data >> 2) & 1)); /* Aux_2 - */ - output().set_lamp_value(11, ((data >> 3) & 1)); /* Aux_3 - */ - output().set_lamp_value(12, ((data >> 4) & 1)); /* Aux_4 - Bell */ - output().set_lamp_value(13, ((data >> 5) & 1)); /* Aux_5 - /CIO */ + m_lamp[8] = BIT(data, 0); /* Aux_0 - Jackpot mech. counter (Baby Games)*/ + m_lamp[9] = BIT(data, 1); /* Aux_1 - */ + m_lamp[10] = BIT(data, 2); /* Aux_2 - */ + m_lamp[11] = BIT(data, 3); /* Aux_3 - */ + m_lamp[12] = BIT(data, 4); /* Aux_4 - Bell */ + m_lamp[13] = BIT(data, 5); /* Aux_5 - /CIO */ m_jckp = m_p1 & 1; @@ -1245,6 +1250,7 @@ GFXDECODE_END void videopkr_state::machine_start() { m_digits.resolve(); + m_lamp.resolve(); m_vp_sound_p2 = 0xff; /* default P2 latch value */ m_sound_latch = 0xff; /* default sound data latch value */ m_p24_data = 0xff; diff --git a/src/mame/drivers/vip.cpp b/src/mame/drivers/vip.cpp index cedb5734e80..5772120998a 100644 --- a/src/mame/drivers/vip.cpp +++ b/src/mame/drivers/vip.cpp @@ -464,7 +464,7 @@ READ_LINE_MEMBER( vip_state::ef1_r ) READ_LINE_MEMBER( vip_state::ef2_r ) { - output().set_led_value(LED_TAPE, m_cassette->input() > 0); + m_led[LED_TAPE] = m_cassette->input() > 0 ? 1 : 0; return (m_cassette->input() < 0) ? ASSERT_LINE : CLEAR_LINE; } @@ -485,7 +485,7 @@ WRITE_LINE_MEMBER( vip_state::q_w ) m_beeper->write(machine().dummy_space(), NODE_01, state); // Q led - output().set_led_value(LED_Q, state); + m_led[LED_Q] = state ? 1 : 0; // tape output m_cassette->output(state ? 1.0 : -1.0); @@ -621,8 +621,10 @@ void vip_state::machine_start() ram[addr] = machine().rand() & 0xff; } + m_led.resolve(); + // turn on power LED - output().set_led_value(LED_POWER, 1); + m_led[LED_POWER] = 1; // reset sound m_beeper->write(machine().dummy_space(), NODE_01, 0); diff --git a/src/mame/drivers/wolfpack.cpp b/src/mame/drivers/wolfpack.cpp index 37ad2034e7f..98ba5d0d435 100644 --- a/src/mame/drivers/wolfpack.cpp +++ b/src/mame/drivers/wolfpack.cpp @@ -43,6 +43,7 @@ TIMER_CALLBACK_MEMBER(wolfpack_state::periodic_callback) void wolfpack_state::machine_start() { + m_led.resolve(); m_periodic_timer = timer_alloc(TIMER_PERIODIC); } @@ -117,7 +118,7 @@ WRITE8_MEMBER(wolfpack_state::attract_w) WRITE8_MEMBER(wolfpack_state::credit_w) { - output().set_led_value(0, !(data & 1)); + m_led = BIT(~data, 0); } diff --git a/src/mame/includes/ajax.h b/src/mame/includes/ajax.h index 05731e392c8..4a154060a04 100644 --- a/src/mame/includes/ajax.h +++ b/src/mame/includes/ajax.h @@ -12,8 +12,8 @@ class ajax_state : public driver_device { public: - ajax_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + ajax_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), m_subcpu(*this, "sub"), @@ -24,7 +24,31 @@ public: m_k051960(*this, "k051960"), m_k051316(*this, "k051316"), m_palette(*this, "palette"), - m_soundlatch(*this, "soundlatch") { } + m_soundlatch(*this, "soundlatch"), + m_lamp(*this, "lamp%u", 0U) + { } + + DECLARE_WRITE8_MEMBER(sound_bank_w); + DECLARE_READ8_MEMBER(ls138_f10_r); + DECLARE_WRITE8_MEMBER(ls138_f10_w); + DECLARE_WRITE8_MEMBER(bankswitch_2_w); + DECLARE_WRITE8_MEMBER(bankswitch_w); + DECLARE_WRITE8_MEMBER(lamps_w); + DECLARE_WRITE8_MEMBER(k007232_extvol_w); + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_WRITE8_MEMBER(volume_callback0); + DECLARE_WRITE8_MEMBER(volume_callback1); + K051316_CB_MEMBER(zoom_callback); + K052109_CB_MEMBER(tile_callback); + K051960_CB_MEMBER(sprite_callback); + void ajax(machine_config &config); + void ajax_main_map(address_map &map); + void ajax_sound_map(address_map &map); + void ajax_sub_map(address_map &map); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; /* video-related */ uint8_t m_priority; @@ -44,24 +68,5 @@ public: required_device m_k051316; required_device m_palette; required_device m_soundlatch; - - DECLARE_WRITE8_MEMBER(sound_bank_w); - DECLARE_READ8_MEMBER(ls138_f10_r); - DECLARE_WRITE8_MEMBER(ls138_f10_w); - DECLARE_WRITE8_MEMBER(bankswitch_2_w); - DECLARE_WRITE8_MEMBER(bankswitch_w); - DECLARE_WRITE8_MEMBER(lamps_w); - DECLARE_WRITE8_MEMBER(k007232_extvol_w); - virtual void machine_start() override; - virtual void machine_reset() override; - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_WRITE8_MEMBER(volume_callback0); - DECLARE_WRITE8_MEMBER(volume_callback1); - K051316_CB_MEMBER(zoom_callback); - K052109_CB_MEMBER(tile_callback); - K051960_CB_MEMBER(sprite_callback); - void ajax(machine_config &config); - void ajax_main_map(address_map &map); - void ajax_sound_map(address_map &map); - void ajax_sub_map(address_map &map); + output_finder<8> m_lamp; }; diff --git a/src/mame/includes/amiga.h b/src/mame/includes/amiga.h index 63e5fc79375..3d2f3eb90e4 100644 --- a/src/mame/includes/amiga.h +++ b/src/mame/includes/amiga.h @@ -332,6 +332,7 @@ public: m_p2_mouse_x(*this, "p2_mouse_x"), m_p2_mouse_y(*this, "p2_mouse_y"), m_hvpos(*this, "HVPOS"), + m_power_led(*this, "power_led"), m_chip_ram_mask(0), m_cia_0_irq(0), m_cia_1_irq(0), @@ -595,6 +596,7 @@ protected: optional_ioport m_p2_mouse_y; optional_ioport m_hvpos; + output_finder<> m_power_led; memory_array m_chip_ram; uint32_t m_chip_ram_mask; diff --git a/src/mame/includes/atarifb.h b/src/mame/includes/atarifb.h index c7327c47130..5d6e812d010 100644 --- a/src/mame/includes/atarifb.h +++ b/src/mame/includes/atarifb.h @@ -21,8 +21,8 @@ class atarifb_state : public driver_device { public: - atarifb_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + atarifb_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_alphap1_videoram(*this, "p1_videoram"), m_alphap2_videoram(*this, "p2_videoram"), m_field_videoram(*this, "field_videoram"), @@ -32,7 +32,47 @@ public: m_discrete(*this, "discrete"), m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), - m_palette(*this, "palette"){ } + m_palette(*this, "palette"), + m_led(*this, "led%u", 0U) + { } + + DECLARE_WRITE8_MEMBER(atarifb_out1_w); + DECLARE_WRITE8_MEMBER(atarifb4_out1_w); + DECLARE_WRITE8_MEMBER(abaseb_out1_w); + DECLARE_WRITE8_MEMBER(soccer_out1_w); + DECLARE_WRITE8_MEMBER(atarifb_out2_w); + DECLARE_WRITE8_MEMBER(soccer_out2_w); + DECLARE_WRITE8_MEMBER(atarifb_out3_w); + DECLARE_READ8_MEMBER(atarifb_in0_r); + DECLARE_READ8_MEMBER(atarifb_in2_r); + DECLARE_READ8_MEMBER(atarifb4_in0_r); + DECLARE_READ8_MEMBER(atarifb4_in2_r); + DECLARE_WRITE8_MEMBER(atarifb_alpha1_videoram_w); + DECLARE_WRITE8_MEMBER(atarifb_alpha2_videoram_w); + DECLARE_WRITE8_MEMBER(atarifb_field_videoram_w); + TILE_GET_INFO_MEMBER(alpha1_get_tile_info); + TILE_GET_INFO_MEMBER(alpha2_get_tile_info); + TILE_GET_INFO_MEMBER(field_get_tile_info); + DECLARE_PALETTE_INIT(atarifb); + uint32_t screen_update_atarifb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + uint32_t screen_update_abaseb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + uint32_t screen_update_soccer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void get_tile_info_common( tile_data &tileinfo, tilemap_memory_index tile_index, uint8_t *alpha_videoram ); + void draw_playfield_and_alpha( bitmap_ind16 &bitmap, const rectangle &cliprect, int playfield_x_offset, int playfield_y_offset ); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int gfx, int is_soccer ); + void atarifb4(machine_config &config); + void atarifb(machine_config &config); + void soccer(machine_config &config); + void abaseb(machine_config &config); + void abaseb_map(address_map &map); + void atarifb4_map(address_map &map); + void atarifb_map(address_map &map); + void soccer_map(address_map &map); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; /* video-related */ required_shared_ptr m_alphap1_videoram; @@ -70,42 +110,7 @@ public: required_device m_gfxdecode; required_device m_screen; required_device m_palette; - - DECLARE_WRITE8_MEMBER(atarifb_out1_w); - DECLARE_WRITE8_MEMBER(atarifb4_out1_w); - DECLARE_WRITE8_MEMBER(abaseb_out1_w); - DECLARE_WRITE8_MEMBER(soccer_out1_w); - DECLARE_WRITE8_MEMBER(atarifb_out2_w); - DECLARE_WRITE8_MEMBER(soccer_out2_w); - DECLARE_WRITE8_MEMBER(atarifb_out3_w); - DECLARE_READ8_MEMBER(atarifb_in0_r); - DECLARE_READ8_MEMBER(atarifb_in2_r); - DECLARE_READ8_MEMBER(atarifb4_in0_r); - DECLARE_READ8_MEMBER(atarifb4_in2_r); - DECLARE_WRITE8_MEMBER(atarifb_alpha1_videoram_w); - DECLARE_WRITE8_MEMBER(atarifb_alpha2_videoram_w); - DECLARE_WRITE8_MEMBER(atarifb_field_videoram_w); - TILE_GET_INFO_MEMBER(alpha1_get_tile_info); - TILE_GET_INFO_MEMBER(alpha2_get_tile_info); - TILE_GET_INFO_MEMBER(field_get_tile_info); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; - DECLARE_PALETTE_INIT(atarifb); - uint32_t screen_update_atarifb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_abaseb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_soccer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void get_tile_info_common( tile_data &tileinfo, tilemap_memory_index tile_index, uint8_t *alpha_videoram ); - void draw_playfield_and_alpha( bitmap_ind16 &bitmap, const rectangle &cliprect, int playfield_x_offset, int playfield_y_offset ); - void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int gfx, int is_soccer ); - void atarifb4(machine_config &config); - void atarifb(machine_config &config); - void soccer(machine_config &config); - void abaseb(machine_config &config); - void abaseb_map(address_map &map); - void atarifb4_map(address_map &map); - void atarifb_map(address_map &map); - void soccer_map(address_map &map); + output_finder<2> m_led; }; /*----------- defined in audio/atarifb.c -----------*/ diff --git a/src/mame/includes/atarist.h b/src/mame/includes/atarist.h index 6910ad20956..15c3930ada0 100644 --- a/src/mame/includes/atarist.h +++ b/src/mame/includes/atarist.h @@ -122,7 +122,8 @@ public: m_ikbd_joy(1), m_monochrome(1), m_palette(*this, "palette"), - m_screen(*this, "screen") + m_screen(*this, "screen"), + m_led(*this, "led1") { } required_device m_maincpu; @@ -155,10 +156,6 @@ public: optional_ioport m_mousey; optional_ioport m_config; - void machine_start() override; - - void video_start() override; - uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); // video @@ -344,6 +341,10 @@ public: void st_map(address_map &map); protected: virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + virtual void machine_start() override; + virtual void video_start() override; + + output_finder<> m_led; }; class megast_state : public st_state @@ -375,10 +376,6 @@ public: optional_device m_lmc1992; - void machine_start() override; - - void video_start() override; - DECLARE_READ8_MEMBER( shifter_base_low_r ); DECLARE_WRITE8_MEMBER( shifter_base_low_w ); DECLARE_READ8_MEMBER( shifter_counter_r ); @@ -443,6 +440,8 @@ public: void ste_map(address_map &map); protected: virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + virtual void machine_start() override; + virtual void video_start() override; }; class megaste_state : public ste_state @@ -452,14 +451,15 @@ public: : ste_state(mconfig, type, tag) { } - void machine_start() override; - DECLARE_READ16_MEMBER( cache_r ); DECLARE_WRITE16_MEMBER( cache_w ); uint16_t m_cache; void megaste(machine_config &config); void megaste_map(address_map &map); + +protected: + virtual void machine_start() override; }; class stbook_state : public ste_state @@ -472,15 +472,15 @@ public: required_ioport m_sw400; - void machine_start() override; - void video_start() override; - DECLARE_READ16_MEMBER( config_r ); DECLARE_WRITE16_MEMBER( lcd_control_w ); DECLARE_WRITE8_MEMBER( psg_pa_w ); DECLARE_READ8_MEMBER( mfp_gpio_r ); void stbook_map(address_map &map); +protected: + virtual void machine_start() override; + virtual void video_start() override; }; #endif // MAME_INCLUDES_ATARI_ST_H diff --git a/src/mame/includes/atarisy2.h b/src/mame/includes/atarisy2.h index b274be89577..cd47a987cd5 100644 --- a/src/mame/includes/atarisy2.h +++ b/src/mame/includes/atarisy2.h @@ -35,6 +35,7 @@ public: , m_tms5220(*this, "tms") , m_rombank(*this, "rombank%u", 1U) , m_slapstic(*this, "slapstic") + , m_led(*this, "led%u", 0U) { } required_device m_maincpu; @@ -126,4 +127,7 @@ public: void main_map(address_map &map); void sound_map(address_map &map); void vrambank_map(address_map &map); + +protected: + output_finder<2> m_led; }; diff --git a/src/mame/includes/baraduke.h b/src/mame/includes/baraduke.h index acfa09b85f8..de97d34805a 100644 --- a/src/mame/includes/baraduke.h +++ b/src/mame/includes/baraduke.h @@ -14,23 +14,10 @@ public: m_mcu(*this, "mcu"), m_cus30(*this, "namco"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_lamp(*this, "lamp%u", 0U) + { } - int m_inputport_selected; - int m_counter; - required_shared_ptr m_spriteram; - required_shared_ptr m_videoram; - required_shared_ptr m_textram; - required_device m_maincpu; - required_device m_mcu; - required_device m_cus30; - required_device m_gfxdecode; - required_device m_palette; - tilemap_t *m_tx_tilemap; - tilemap_t *m_bg_tilemap[2]; - int m_xscroll[2]; - int m_yscroll[2]; - int m_copy_sprites; DECLARE_WRITE8_MEMBER(inputport_select_w); DECLARE_READ8_MEMBER(inputport_r); DECLARE_WRITE8_MEMBER(baraduke_lamps_w); @@ -61,4 +48,24 @@ public: void baraduke_map(address_map &map); void mcu_map(address_map &map); void mcu_port_map(address_map &map); + +protected: + virtual void machine_start() override; + + int m_inputport_selected; + int m_counter; + required_shared_ptr m_spriteram; + required_shared_ptr m_videoram; + required_shared_ptr m_textram; + required_device m_maincpu; + required_device m_mcu; + required_device m_cus30; + required_device m_gfxdecode; + required_device m_palette; + tilemap_t *m_tx_tilemap; + tilemap_t *m_bg_tilemap[2]; + int m_xscroll[2]; + int m_yscroll[2]; + int m_copy_sprites; + output_finder<2> m_lamp; }; diff --git a/src/mame/includes/bladestl.h b/src/mame/includes/bladestl.h index 2dd3ba6c750..10db44d8301 100644 --- a/src/mame/includes/bladestl.h +++ b/src/mame/includes/bladestl.h @@ -31,7 +31,28 @@ public: m_gfxdecode(*this, "gfxdecode"), m_soundlatch(*this, "soundlatch"), m_trackball(*this, "TRACKBALL.%u", 0), - m_rombank(*this, "rombank") { } + m_rombank(*this, "rombank"), + m_lamp(*this, "lamp%u", 0U) + { } + + /* devices */ + DECLARE_READ8_MEMBER(trackball_r); + DECLARE_WRITE8_MEMBER(bladestl_bankswitch_w); + DECLARE_WRITE8_MEMBER(bladestl_port_B_w); + DECLARE_READ8_MEMBER(bladestl_speech_busy_r); + DECLARE_WRITE8_MEMBER(bladestl_speech_ctrl_w); + DECLARE_PALETTE_INIT(bladestl); + uint32_t screen_update_bladestl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_DEVICE_CALLBACK_MEMBER(bladestl_scanline); + K007342_CALLBACK_MEMBER(bladestl_tile_callback); + K007420_CALLBACK_MEMBER(bladestl_sprite_callback); + void bladestl(machine_config &config); + void main_map(address_map &map); + void sound_map(address_map &map); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; required_device m_maincpu; required_device m_audiocpu; @@ -54,20 +75,5 @@ public: /* misc */ int m_last_track[4]; - /* devices */ - DECLARE_READ8_MEMBER(trackball_r); - DECLARE_WRITE8_MEMBER(bladestl_bankswitch_w); - DECLARE_WRITE8_MEMBER(bladestl_port_B_w); - DECLARE_READ8_MEMBER(bladestl_speech_busy_r); - DECLARE_WRITE8_MEMBER(bladestl_speech_ctrl_w); - virtual void machine_start() override; - virtual void machine_reset() override; - DECLARE_PALETTE_INIT(bladestl); - uint32_t screen_update_bladestl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_DEVICE_CALLBACK_MEMBER(bladestl_scanline); - K007342_CALLBACK_MEMBER(bladestl_tile_callback); - K007420_CALLBACK_MEMBER(bladestl_sprite_callback); - void bladestl(machine_config &config); - void main_map(address_map &map); - void sound_map(address_map &map); + output_finder<2> m_lamp; }; diff --git a/src/mame/includes/bw12.h b/src/mame/includes/bw12.h index 6a10d8db569..d8e9d9e525e 100644 --- a/src/mame/includes/bw12.h +++ b/src/mame/includes/bw12.h @@ -38,26 +38,61 @@ class bw12_state : public driver_device { public: bw12_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_pia(*this, PIA6821_TAG), - m_sio(*this, Z80SIO_TAG), - m_fdc(*this, UPD765_TAG), - m_kbc(*this, AY3600PRO002_TAG), - m_crtc(*this, MC6845_TAG), - m_pit(*this, PIT8253_TAG), - m_palette(*this, "palette"), - m_centronics(*this, CENTRONICS_TAG), - m_ram(*this, RAM_TAG), - m_floppy0(*this, UPD765_TAG ":1:525dd"), - m_floppy1(*this, UPD765_TAG ":2:525dd"), - m_floppy_timer(*this, FLOPPY_TIMER_TAG), - m_rom(*this, Z80_TAG), - m_char_rom(*this, "chargen"), - m_video_ram(*this, "video_ram"), - m_modifiers(*this, "MODIFIERS") + : driver_device(mconfig, type, tag) + , m_maincpu(*this, Z80_TAG) + , m_pia(*this, PIA6821_TAG) + , m_sio(*this, Z80SIO_TAG) + , m_fdc(*this, UPD765_TAG) + , m_kbc(*this, AY3600PRO002_TAG) + , m_crtc(*this, MC6845_TAG) + , m_pit(*this, PIT8253_TAG) + , m_palette(*this, "palette") + , m_centronics(*this, CENTRONICS_TAG) + , m_ram(*this, RAM_TAG) + , m_floppy0(*this, UPD765_TAG ":1:525dd") + , m_floppy1(*this, UPD765_TAG ":2:525dd") + , m_floppy_timer(*this, FLOPPY_TIMER_TAG) + , m_rom(*this, Z80_TAG) + , m_char_rom(*this, "chargen") + , m_video_ram(*this, "video_ram") + , m_modifiers(*this, "MODIFIERS") + , m_led(*this, "led0") { } + void bankswitch(); + void floppy_motor_off(); + void set_floppy_motor_off_timer(); + void ls259_w(int address, int data); + + DECLARE_READ8_MEMBER( ls259_r ); + DECLARE_WRITE8_MEMBER( ls259_w ); + DECLARE_READ8_MEMBER( pia_pa_r ); + DECLARE_WRITE_LINE_MEMBER( pia_cb2_w ); + DECLARE_WRITE_LINE_MEMBER( pit_out2_w ); + DECLARE_READ_LINE_MEMBER( ay3600_shift_r ); + DECLARE_READ_LINE_MEMBER( ay3600_control_r ); + DECLARE_WRITE_LINE_MEMBER( ay3600_data_ready_w ); + MC6845_UPDATE_ROW( crtc_update_row ); + + TIMER_DEVICE_CALLBACK_MEMBER(floppy_motor_off_tick); + DECLARE_WRITE_LINE_MEMBER(pit_out0_w); + DECLARE_FLOPPY_FORMATS( bw12_floppy_formats ); + DECLARE_FLOPPY_FORMATS( bw14_floppy_formats ); + + DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); + DECLARE_WRITE_LINE_MEMBER(write_centronics_fault); + DECLARE_WRITE_LINE_MEMBER(write_centronics_perror); + + void common(machine_config &config); + void bw14(machine_config &config); + void bw12(machine_config &config); + void bw12_io(address_map &map); + void bw12_mem(address_map &map); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + required_device m_maincpu; required_device m_pia; required_device m_sio; @@ -75,24 +110,7 @@ public: required_memory_region m_char_rom; required_shared_ptr m_video_ram; required_ioport m_modifiers; - - virtual void machine_start() override; - virtual void machine_reset() override; - - void bankswitch(); - void floppy_motor_off(); - void set_floppy_motor_off_timer(); - void ls259_w(int address, int data); - - DECLARE_READ8_MEMBER( ls259_r ); - DECLARE_WRITE8_MEMBER( ls259_w ); - DECLARE_READ8_MEMBER( pia_pa_r ); - DECLARE_WRITE_LINE_MEMBER( pia_cb2_w ); - DECLARE_WRITE_LINE_MEMBER( pit_out2_w ); - DECLARE_READ_LINE_MEMBER( ay3600_shift_r ); - DECLARE_READ_LINE_MEMBER( ay3600_control_r ); - DECLARE_WRITE_LINE_MEMBER( ay3600_data_ready_w ); - MC6845_UPDATE_ROW( crtc_update_row ); + output_finder<> m_led; /* memory state */ int m_bank; @@ -110,23 +128,10 @@ public: int m_motor_on; int m_motor0; int m_motor1; - TIMER_DEVICE_CALLBACK_MEMBER(floppy_motor_off_tick); - DECLARE_WRITE_LINE_MEMBER(pit_out0_w); - DECLARE_FLOPPY_FORMATS( bw12_floppy_formats ); - DECLARE_FLOPPY_FORMATS( bw14_floppy_formats ); - DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); - DECLARE_WRITE_LINE_MEMBER(write_centronics_fault); - DECLARE_WRITE_LINE_MEMBER(write_centronics_perror); int m_centronics_busy; int m_centronics_fault; int m_centronics_perror; - - void common(machine_config &config); - void bw14(machine_config &config); - void bw12(machine_config &config); - void bw12_io(address_map &map); - void bw12_mem(address_map &map); }; #endif diff --git a/src/mame/includes/bwidow.h b/src/mame/includes/bwidow.h index 224f1ae1bb4..db9ff2b4173 100644 --- a/src/mame/includes/bwidow.h +++ b/src/mame/includes/bwidow.h @@ -12,23 +12,20 @@ class bwidow_state : public driver_device { public: bwidow_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu"), - m_in3(*this, "IN3"), - m_in4(*this, "IN4"), - m_dsw2(*this, "DSW2") { } + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_in3(*this, "IN3") + , m_in4(*this, "IN4") + , m_dsw2(*this, "DSW2") + , m_led(*this, "led%u", 0U) + { } - int m_lastdata; DECLARE_READ8_MEMBER(spacduel_IN3_r); DECLARE_READ8_MEMBER(bwidowp_in_r); DECLARE_WRITE8_MEMBER(bwidow_misc_w); DECLARE_WRITE8_MEMBER(spacduel_coin_counter_w); DECLARE_WRITE8_MEMBER(irq_ack_w); DECLARE_CUSTOM_INPUT_MEMBER(clock_r); - required_device m_maincpu; - optional_ioport m_in3; - optional_ioport m_in4; - optional_ioport m_dsw2; void spacduel(machine_config &config); void gravitar(machine_config &config); void bwidowp(machine_config &config); @@ -39,6 +36,16 @@ public: void bwidow_map(address_map &map); void bwidowp_map(address_map &map); void spacduel_map(address_map &map); + +protected: + virtual void machine_start() override { m_led.resolve(); } + + int m_lastdata; + required_device m_maincpu; + optional_ioport m_in3; + optional_ioport m_in4; + optional_ioport m_dsw2; + output_finder<2> m_led; }; #endif // MAME_INCLUDES_BWIDOW_H diff --git a/src/mame/includes/calomega.h b/src/mame/includes/calomega.h index 76b22fc8536..93241317ecb 100644 --- a/src/mame/includes/calomega.h +++ b/src/mame/includes/calomega.h @@ -21,9 +21,9 @@ public: m_in0_2(*this, "IN0-2"), m_in0_3(*this, "IN0-3"), m_frq(*this, "FRQ"), - m_sw2(*this, "SW2") - { - } + m_sw2(*this, "SW2"), + m_lamp(*this, "lamp%u", 0U) + { } DECLARE_WRITE8_MEMBER(calomega_videoram_w); DECLARE_WRITE8_MEMBER(calomega_colorram_w); @@ -63,6 +63,7 @@ public: void sys905_map(address_map &map); void sys906_map(address_map &map); protected: + virtual void machine_start() override { m_lamp.resolve(); } virtual void video_start() override; private: @@ -82,6 +83,7 @@ private: optional_ioport m_in0_3; optional_ioport m_frq; optional_ioport m_sw2; + output_finder<10> m_lamp; uint8_t m_tx_line; int m_s903_mux_data; diff --git a/src/mame/includes/cave.h b/src/mame/includes/cave.h index 3bae5ccb4c9..834041f0fc8 100644 --- a/src/mame/includes/cave.h +++ b/src/mame/includes/cave.h @@ -67,27 +67,9 @@ public: , m_gfxdecode(*this, "gfxdecode") , m_screen(*this, "screen") , m_palette(*this, "palette") - , m_soundlatch(*this, "soundlatch") { } - - /* memory pointers */ - optional_shared_ptr_array m_videoregs; - optional_shared_ptr_array m_vram; - optional_shared_ptr_array m_vctrl; - optional_shared_ptr_array m_spriteram; - optional_shared_ptr_array m_paletteram; - - /* memory regions */ - optional_memory_region_array<4> m_spriteregion; - optional_memory_region_array<4> m_tileregion; - optional_memory_region_array<2> m_okiregion; - optional_memory_region m_z80region; - optional_memory_bank m_z80bank; - optional_memory_bank_array<2> m_okibank_lo; - optional_memory_bank_array<2> m_okibank_hi; - - /* video-related */ - std::unique_ptr m_sprite[4]; - sprite_cave *m_sprite_table[4][MAX_PRIORITY][MAX_SPRITE_NUM + 1]; + , m_soundlatch(*this, "soundlatch") + , m_led(*this, "led%u", 0U) + { } struct { @@ -102,71 +84,6 @@ public: void (cave_state::*m_get_sprite_info)(int chip); void (cave_state::*m_sprite_draw)(int chip, int priority); - tilemap_t *m_tilemap[4]; - int m_tiledim[4]; - int m_old_tiledim[4]; - - bitmap_ind16 m_sprite_zbuf; - uint16_t m_sprite_zbuf_baseval; - - int m_num_sprites[4]; - - int m_spriteram_bank[4]; - int m_spriteram_bank_delay[4]; - - std::unique_ptr m_palette_map[4]; - - int m_layers_offs_x; - int m_layers_offs_y; - int m_row_effect_offs_n; - int m_row_effect_offs_f; - int m_background_pen; - - int m_spritetype[2]; - int m_kludge; - emu_timer *m_vblank_end_timer; - - - /* misc */ - int m_time_vblank_irq; - uint8_t m_irq_level; - uint8_t m_vblank_irq; - uint8_t m_sound_irq; - uint8_t m_unknown_irq; - uint8_t m_agallet_vblank_irq; - - /* sound related */ - int m_soundbuf_wptr; - int m_soundbuf_rptr; - uint8_t m_soundbuf_data[32]; - bool m_soundbuf_empty; - //uint8_t m_sound_flag1; - //uint8_t m_sound_flag2; - - /* game specific */ - // sailormn - int m_sailormn_tilebank; - // korokoro - uint16_t m_leds[2]; - int m_hopper; - // ppsatan - uint16_t m_ppsatan_io_mux; - - /* devices */ - required_device m_maincpu; - optional_device m_audiocpu; - optional_device_array m_oki; - required_device m_int_timer; - optional_device m_int_timer_left; - optional_device m_int_timer_right; - optional_device m_eeprom; - required_device m_gfxdecode; - required_device m_screen; - required_device m_palette; - optional_device m_soundlatch; - - int m_rasflag; - int m_old_rasflag; DECLARE_READ16_MEMBER(cave_irq_cause_r); DECLARE_READ8_MEMBER(soundflags_r); DECLARE_READ16_MEMBER(soundflags_ack_r); @@ -223,7 +140,6 @@ public: void init_ppsatan(); TILE_GET_INFO_MEMBER(sailormn_get_tile_info_2); template TILE_GET_INFO_MEMBER(get_tile_info); - DECLARE_MACHINE_START(cave); DECLARE_MACHINE_RESET(cave); DECLARE_MACHINE_RESET(sailormn); DECLARE_VIDEO_START(cave_2_layers); @@ -314,6 +230,96 @@ public: void tekkencw_map(address_map &map); void tjumpman_map(address_map &map); void uopoko_map(address_map &map); +protected: + virtual void machine_start() override; + + /* memory pointers */ + optional_shared_ptr_array m_videoregs; + optional_shared_ptr_array m_vram; + optional_shared_ptr_array m_vctrl; + optional_shared_ptr_array m_spriteram; + optional_shared_ptr_array m_paletteram; + + /* memory regions */ + optional_memory_region_array<4> m_spriteregion; + optional_memory_region_array<4> m_tileregion; + optional_memory_region_array<2> m_okiregion; + optional_memory_region m_z80region; + optional_memory_bank m_z80bank; + optional_memory_bank_array<2> m_okibank_lo; + optional_memory_bank_array<2> m_okibank_hi; + + /* video-related */ + std::unique_ptr m_sprite[4]; + sprite_cave *m_sprite_table[4][MAX_PRIORITY][MAX_SPRITE_NUM + 1]; + + tilemap_t *m_tilemap[4]; + int m_tiledim[4]; + int m_old_tiledim[4]; + + bitmap_ind16 m_sprite_zbuf; + uint16_t m_sprite_zbuf_baseval; + + int m_num_sprites[4]; + + int m_spriteram_bank[4]; + int m_spriteram_bank_delay[4]; + + std::unique_ptr m_palette_map[4]; + + int m_layers_offs_x; + int m_layers_offs_y; + int m_row_effect_offs_n; + int m_row_effect_offs_f; + int m_background_pen; + + int m_spritetype[2]; + int m_kludge; + emu_timer *m_vblank_end_timer; + + + /* misc */ + int m_time_vblank_irq; + uint8_t m_irq_level; + uint8_t m_vblank_irq; + uint8_t m_sound_irq; + uint8_t m_unknown_irq; + uint8_t m_agallet_vblank_irq; + + /* sound related */ + int m_soundbuf_wptr; + int m_soundbuf_rptr; + uint8_t m_soundbuf_data[32]; + bool m_soundbuf_empty; + //uint8_t m_sound_flag1; + //uint8_t m_sound_flag2; + + /* game specific */ + // sailormn + int m_sailormn_tilebank; + // korokoro + uint16_t m_leds[2]; + int m_hopper; + // ppsatan + uint16_t m_ppsatan_io_mux; + + /* devices */ + required_device m_maincpu; + optional_device m_audiocpu; + optional_device_array m_oki; + required_device m_int_timer; + optional_device m_int_timer_left; + optional_device m_int_timer_right; + optional_device m_eeprom; + required_device m_gfxdecode; + required_device m_screen; + required_device m_palette; + optional_device m_soundlatch; + output_finder<9> m_led; + + int m_rasflag; + int m_old_rasflag; + private: inline void tilemap_draw( int chip, screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, uint32_t flags, uint32_t priority, uint32_t priority2, int GFX ); void set_pens(int chip); diff --git a/src/mame/includes/ccastles.h b/src/mame/includes/ccastles.h index 680a412426f..a7ba5ce2dc8 100644 --- a/src/mame/includes/ccastles.h +++ b/src/mame/includes/ccastles.h @@ -26,7 +26,8 @@ public: m_spriteram(*this, "spriteram"), m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), - m_palette(*this, "palette") + m_palette(*this, "palette"), + m_led(*this, "led%u", 0U) { } DECLARE_CUSTOM_INPUT_MEMBER(get_vblank); @@ -72,6 +73,7 @@ private: required_device m_gfxdecode; required_device m_screen; required_device m_palette; + output_finder<2> m_led; /* video-related */ const uint8_t *m_syncprom; diff --git a/src/mame/includes/cidelsa.h b/src/mame/includes/cidelsa.h index ac5468c86e5..e9c4f81c6f3 100644 --- a/src/mame/includes/cidelsa.h +++ b/src/mame/includes/cidelsa.h @@ -49,16 +49,9 @@ public: : driver_device(mconfig, type, tag) , m_maincpu(*this, CDP1802_TAG) , m_vis(*this, CDP1869_TAG) + , m_led(*this, "led%u", 0U) { } - required_device m_maincpu; - required_device m_vis; - - virtual void machine_start() override; - virtual void machine_reset() override; - - virtual void video_start() override; - DECLARE_WRITE8_MEMBER( cdp1869_w ); DECLARE_WRITE8_MEMBER( destryer_out1_w ); DECLARE_WRITE8_MEMBER( altair_out1_w ); @@ -73,17 +66,6 @@ public: CDP1869_CHAR_RAM_WRITE_MEMBER(cidelsa_charram_w); CDP1869_PCB_READ_MEMBER(cidelsa_pcb_r); - // cpu state - int m_reset; - - // video state - int m_cdp1802_q; - int m_cdp1869_pcb; - - uint8_t *m_pageram; - std::unique_ptr m_pcbram; - std::unique_ptr m_charram; - void destryera(machine_config &config); void altair(machine_config &config); void destryer(machine_config &config); @@ -95,8 +77,28 @@ public: void destryer_io_map(address_map &map); void destryer_map(address_map &map); void destryera_map(address_map &map); + protected: virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + virtual void machine_start() override; + virtual void machine_reset() override; + + virtual void video_start() override; + + required_device m_maincpu; + required_device m_vis; + output_finder<3> m_led; + + // cpu state + int m_reset; + + // video state + int m_cdp1802_q; + int m_cdp1869_pcb; + + uint8_t *m_pageram; + std::unique_ptr m_pcbram; + std::unique_ptr m_charram; }; class draco_state : public cidelsa_state @@ -107,10 +109,6 @@ public: m_psg(*this, AY8910_TAG) { } - required_device m_psg; - - virtual void machine_start() override; - DECLARE_READ8_MEMBER( sound_in_r ); DECLARE_READ8_MEMBER( psg_r ); DECLARE_WRITE8_MEMBER( sound_bankswitch_w ); @@ -123,15 +121,20 @@ public: CDP1869_CHAR_RAM_WRITE_MEMBER(draco_charram_w); CDP1869_PCB_READ_MEMBER(draco_pcb_r); - // sound state - int m_sound; - int m_psg_latch; void draco(machine_config &config); void draco_video(machine_config &config); void draco_io_map(address_map &map); void draco_map(address_map &map); void draco_page_ram(address_map &map); void draco_sound_map(address_map &map); + +protected: + virtual void machine_start() override; + + required_device m_psg; + // sound state + int m_sound; + int m_psg_latch; }; #endif // MAME_INCLUDES_CIDELSA_H diff --git a/src/mame/includes/cischeat.h b/src/mame/includes/cischeat.h index 0e76df53df2..a309d7b95a9 100644 --- a/src/mame/includes/cischeat.h +++ b/src/mame/includes/cischeat.h @@ -15,56 +15,36 @@ class cischeat_state : public driver_device { public: cischeat_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_tmap(*this, "scroll%u", 0), - m_ram(*this, "ram"), - m_roadram(*this, "roadram.%u", 0), - m_f1gpstr2_ioready(*this, "ioready"), - m_maincpu(*this, "maincpu"), - m_cpu1(*this, "cpu1"), - m_cpu2(*this, "cpu2"), - m_cpu3(*this, "cpu3"), - m_cpu5(*this, "cpu5"), - m_soundcpu(*this, "soundcpu"), - m_screen(*this, "screen"), - m_watchdog(*this, "watchdog"), - m_oki1(*this, "oki1"), - m_oki2(*this, "oki2"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_soundlatch(*this, "soundlatch"), - m_soundlatch2(*this, "soundlatch2"), - m_captflag_hopper(*this, "hopper"), - m_captflag_motor_left(*this, "motor_left"), - m_captflag_motor_right(*this, "motor_right"), - m_oki1_bank(*this, "oki1_bank"), - m_oki2_bank(*this, "oki2_bank") - { - for (int side = 0; side < 2; ++side) - m_captflag_motor_command[side] = m_captflag_motor_pos[side] = 0; - m_captflag_leds = 0; - } - - optional_device_array m_tmap; - required_shared_ptr m_ram; - optional_shared_ptr_array m_roadram; - optional_shared_ptr m_f1gpstr2_ioready; - - uint16_t *m_objectram; - uint16_t m_active_layers; - - int m_prev; - int m_armold; - uint16_t m_scudhamm_motor_command; - int m_ip_select; - uint16_t m_wildplt_output; - uint8_t m_drawmode_table[16]; - int m_debugsprites; - int m_show_unknown; - uint16_t *m_spriteram; - - uint8_t m_motor_value; - uint8_t m_io_value; + : driver_device(mconfig, type, tag) + , m_tmap(*this, "scroll%u", 0) + , m_ram(*this, "ram") + , m_roadram(*this, "roadram.%u", 0) + , m_f1gpstr2_ioready(*this, "ioready") + , m_maincpu(*this, "maincpu") + , m_cpu1(*this, "cpu1") + , m_cpu2(*this, "cpu2") + , m_cpu3(*this, "cpu3") + , m_cpu5(*this, "cpu5") + , m_soundcpu(*this, "soundcpu") + , m_screen(*this, "screen") + , m_watchdog(*this, "watchdog") + , m_oki1(*this, "oki1") + , m_oki2(*this, "oki2") + , m_gfxdecode(*this, "gfxdecode") + , m_palette(*this, "palette") + , m_soundlatch(*this, "soundlatch") + , m_soundlatch2(*this, "soundlatch2") + , m_captflag_hopper(*this, "hopper") + , m_captflag_motor_left(*this, "motor_left") + , m_captflag_motor_right(*this, "motor_right") + , m_oki1_bank(*this, "oki1_bank") + , m_oki2_bank(*this, "oki2_bank") + , m_led(*this, "led%u", 0U) + { + for (int side = 0; side < 2; ++side) + m_captflag_motor_command[side] = m_captflag_motor_pos[side] = 0; + m_captflag_leds = 0; + } DECLARE_WRITE16_MEMBER(scudhamm_motor_command_w); DECLARE_WRITE16_MEMBER(scudhamm_leds_w); @@ -105,7 +85,6 @@ public: void init_cischeat(); void init_bigrun(); void init_f1gpstar(); - virtual void video_start() override; uint32_t screen_update_bigrun(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); uint32_t screen_update_scudhamm(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); uint32_t screen_update_cischeat(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); @@ -119,40 +98,14 @@ public: void cischeat_draw_sprites(bitmap_ind16 &bitmap , const rectangle &cliprect, int priority1, int priority2); void bigrun_draw_sprites(bitmap_ind16 &bitmap , const rectangle &cliprect, int priority1, int priority2); void cischeat_untangle_sprites(const char *region); - optional_device m_maincpu; // some are called cpu1 - optional_device m_cpu1; - optional_device m_cpu2; - optional_device m_cpu3; - optional_device m_cpu5; - optional_device m_soundcpu; - required_device m_screen; - optional_device m_watchdog; - required_device m_oki1; - required_device m_oki2; - required_device m_gfxdecode; - required_device m_palette; - optional_device m_soundlatch; - optional_device m_soundlatch2; - - // captflag - optional_device m_captflag_hopper; - - optional_device m_captflag_motor_left; - optional_device m_captflag_motor_right; - uint16_t m_captflag_motor_command[2]; - uint16_t m_captflag_motor_pos[2]; DECLARE_WRITE16_MEMBER(captflag_motor_command_right_w); DECLARE_WRITE16_MEMBER(captflag_motor_command_left_w); void captflag_motor_move(int side, uint16_t data); DECLARE_CUSTOM_INPUT_MEMBER(captflag_motor_busy_r); DECLARE_CUSTOM_INPUT_MEMBER(captflag_motor_pos_r); - - optional_memory_bank m_oki1_bank; - optional_memory_bank m_oki2_bank; DECLARE_WRITE16_MEMBER(captflag_oki_bank_w); - uint16_t m_captflag_leds; DECLARE_WRITE16_MEMBER(captflag_leds_w); void init_captflag(); @@ -186,4 +139,58 @@ public: void f1gpstr2_sound_map(address_map &map); void scudhamm_map(address_map &map); void wildplt_map(address_map &map); + +protected: + virtual void machine_start() override { m_led.resolve(); } + virtual void video_start() override; + + optional_device_array m_tmap; + required_shared_ptr m_ram; + optional_shared_ptr_array m_roadram; + optional_shared_ptr m_f1gpstr2_ioready; + + uint16_t *m_objectram; + uint16_t m_active_layers; + + int m_prev; + int m_armold; + uint16_t m_scudhamm_motor_command; + int m_ip_select; + uint16_t m_wildplt_output; + uint8_t m_drawmode_table[16]; + int m_debugsprites; + int m_show_unknown; + uint16_t *m_spriteram; + + uint8_t m_motor_value; + uint8_t m_io_value; + + optional_device m_maincpu; // some are called cpu1 + optional_device m_cpu1; + optional_device m_cpu2; + optional_device m_cpu3; + optional_device m_cpu5; + optional_device m_soundcpu; + required_device m_screen; + optional_device m_watchdog; + required_device m_oki1; + required_device m_oki2; + required_device m_gfxdecode; + required_device m_palette; + optional_device m_soundlatch; + optional_device m_soundlatch2; + + // captflag + optional_device m_captflag_hopper; + + optional_device m_captflag_motor_left; + optional_device m_captflag_motor_right; + uint16_t m_captflag_motor_command[2]; + uint16_t m_captflag_motor_pos[2]; + + optional_memory_bank m_oki1_bank; + optional_memory_bank m_oki2_bank; + + uint16_t m_captflag_leds; + output_finder<5> m_led; }; diff --git a/src/mame/includes/copsnrob.h b/src/mame/includes/copsnrob.h index aaef2afbab3..2c5d63ace35 100644 --- a/src/mame/includes/copsnrob.h +++ b/src/mame/includes/copsnrob.h @@ -31,7 +31,7 @@ public: m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), m_palette(*this, "palette"), - m_led(*this, "led") + m_led(*this, "led%u", 0U) { } void copsnrob(machine_config &config); @@ -66,7 +66,7 @@ private: required_device m_screen; required_device m_palette; - output_finder<> m_led; + output_finder<2> m_led; }; #endif // MAME_INCLUDES_COPSNROB_H diff --git a/src/mame/includes/cps1.h b/src/mame/includes/cps1.h index 51ec10adafb..b1637030620 100644 --- a/src/mame/includes/cps1.h +++ b/src/mame/includes/cps1.h @@ -100,8 +100,8 @@ struct CPS1config class cps_state : public driver_device { public: - cps_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + cps_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_mainram(*this, "mainram"), m_gfxram(*this, "gfxram"), m_cps_a_regs(*this, "cps_a_regs"), @@ -131,118 +131,10 @@ public: m_soundlatch2(*this, "soundlatch2"), m_decrypted_opcodes(*this, "decrypted_opcodes"), m_region_key(*this, "key"), - m_region_stars(*this, "stars") + m_region_stars(*this, "stars"), + m_led_cboard(*this, "led_cboard%u", 0U) { } - /* memory pointers */ - // cps1 - optional_shared_ptr m_mainram; - required_shared_ptr m_gfxram; - required_shared_ptr m_cps_a_regs; - required_shared_ptr m_cps_b_regs; - uint16_t * m_scroll1; - uint16_t * m_scroll2; - uint16_t * m_scroll3; - uint16_t * m_obj; - uint16_t * m_other; - std::unique_ptr m_buffered_obj; - optional_shared_ptr m_qsound_sharedram1; - optional_shared_ptr m_qsound_sharedram2; - std::unique_ptr m_decrypt_kabuki; - // cps2 - optional_shared_ptr m_objram1; - optional_shared_ptr m_objram2; - optional_shared_ptr m_output; - - optional_ioport m_io_in0; - optional_ioport m_io_in1; - std::unique_ptr m_cps2_buffered_obj; - // game-specific - std::unique_ptr m_gigaman2_dummyqsound_ram; - uint16_t sf2ceblp_prot; - - /* video-related */ - tilemap_t *m_bg_tilemap[3]; - int m_scanline1; - int m_scanline2; - int m_scancalls; - - int m_scroll1x; - int m_scroll1y; - int m_scroll2x; - int m_scroll2y; - int m_scroll3x; - int m_scroll3y; - - int m_stars_enabled[2]; /* Layer enabled [Y/N] */ - int m_stars1x; - int m_stars1y; - int m_stars2x; - int m_stars2y; - int m_last_sprite_offset; /* Offset of the last sprite */ - int m_cps2_last_sprite_offset; /* Offset of the last sprite */ - int m_pri_ctrl; /* Sprite layer priorities */ - int m_objram_bank; - - /* misc */ - int m_readpaddle; // pzloop2 - int m_cps2networkpresent; - int m_cps2digitalvolumelevel; - int m_cps2disabledigitalvolume; - emu_timer *m_digital_volume_timer; - int m_cps2_dial_type; - int m_ecofghtr_dial_direction0; - int m_ecofghtr_dial_direction1; - int m_ecofghtr_dial_last0; - int m_ecofghtr_dial_last1; - - - /* fcrash sound hw */ - int m_sample_buffer1; - int m_sample_buffer2; - int m_sample_select1; - int m_sample_select2; - - /* video config (never changed after video_start) */ - const struct CPS1config *m_game_config; - int m_scroll_size; - int m_obj_size; - int m_cps2_obj_size; - int m_other_size; - int m_palette_align; - int m_palette_size; - int m_stars_rom_size; - uint8_t m_empty_tile[32*32]; - int m_cps_version; - - /* fcrash video config */ - uint8_t m_layer_enable_reg; - uint8_t m_layer_mask_reg[4]; - int m_layer_scroll1x_offset; - int m_layer_scroll2x_offset; - int m_layer_scroll3x_offset; - int m_sprite_base; - int m_sprite_list_end_marker; - int m_sprite_x_offset; - std::unique_ptr m_bootleg_sprite_ram; - std::unique_ptr m_bootleg_work_ram; - - /* devices */ - required_device m_maincpu; - optional_device m_audiocpu; - optional_device m_oki; - optional_device m_m48t35; - optional_device m_msm_1; // fcrash - optional_device m_msm_2; // fcrash - required_device m_gfxdecode; - required_device m_screen; - required_device m_palette; - optional_device m_soundlatch; - optional_device m_soundlatch2; - optional_shared_ptr m_decrypted_opcodes; - optional_memory_region m_region_key; - optional_memory_region m_region_stars; - DECLARE_READ16_MEMBER(cps1_hack_dsw_r); DECLARE_READ16_MEMBER(cps1_in1_r); DECLARE_READ16_MEMBER(cps1_in2_r); @@ -463,6 +355,119 @@ public: void sound_map(address_map &map); void sub_map(address_map &map); void varthb_map(address_map &map); + +protected: + virtual void machine_start() override { m_led_cboard.resolve(); } + + /* memory pointers */ + // cps1 + optional_shared_ptr m_mainram; + required_shared_ptr m_gfxram; + required_shared_ptr m_cps_a_regs; + required_shared_ptr m_cps_b_regs; + uint16_t * m_scroll1; + uint16_t * m_scroll2; + uint16_t * m_scroll3; + uint16_t * m_obj; + uint16_t * m_other; + std::unique_ptr m_buffered_obj; + optional_shared_ptr m_qsound_sharedram1; + optional_shared_ptr m_qsound_sharedram2; + std::unique_ptr m_decrypt_kabuki; + // cps2 + optional_shared_ptr m_objram1; + optional_shared_ptr m_objram2; + optional_shared_ptr m_output; + + optional_ioport m_io_in0; + optional_ioport m_io_in1; + std::unique_ptr m_cps2_buffered_obj; + // game-specific + std::unique_ptr m_gigaman2_dummyqsound_ram; + uint16_t sf2ceblp_prot; + + /* video-related */ + tilemap_t *m_bg_tilemap[3]; + int m_scanline1; + int m_scanline2; + int m_scancalls; + + int m_scroll1x; + int m_scroll1y; + int m_scroll2x; + int m_scroll2y; + int m_scroll3x; + int m_scroll3y; + + int m_stars_enabled[2]; /* Layer enabled [Y/N] */ + int m_stars1x; + int m_stars1y; + int m_stars2x; + int m_stars2y; + int m_last_sprite_offset; /* Offset of the last sprite */ + int m_cps2_last_sprite_offset; /* Offset of the last sprite */ + int m_pri_ctrl; /* Sprite layer priorities */ + int m_objram_bank; + + /* misc */ + int m_readpaddle; // pzloop2 + int m_cps2networkpresent; + int m_cps2digitalvolumelevel; + int m_cps2disabledigitalvolume; + emu_timer *m_digital_volume_timer; + int m_cps2_dial_type; + int m_ecofghtr_dial_direction0; + int m_ecofghtr_dial_direction1; + int m_ecofghtr_dial_last0; + int m_ecofghtr_dial_last1; + + + /* fcrash sound hw */ + int m_sample_buffer1; + int m_sample_buffer2; + int m_sample_select1; + int m_sample_select2; + + /* video config (never changed after video_start) */ + const struct CPS1config *m_game_config; + int m_scroll_size; + int m_obj_size; + int m_cps2_obj_size; + int m_other_size; + int m_palette_align; + int m_palette_size; + int m_stars_rom_size; + uint8_t m_empty_tile[32*32]; + int m_cps_version; + + /* fcrash video config */ + uint8_t m_layer_enable_reg; + uint8_t m_layer_mask_reg[4]; + int m_layer_scroll1x_offset; + int m_layer_scroll2x_offset; + int m_layer_scroll3x_offset; + int m_sprite_base; + int m_sprite_list_end_marker; + int m_sprite_x_offset; + std::unique_ptr m_bootleg_sprite_ram; + std::unique_ptr m_bootleg_work_ram; + + /* devices */ + required_device m_maincpu; + optional_device m_audiocpu; + optional_device m_oki; + optional_device m_m48t35; + optional_device m_msm_1; // fcrash + optional_device m_msm_2; // fcrash + required_device m_gfxdecode; + required_device m_screen; + required_device m_palette; + optional_device m_soundlatch; + optional_device m_soundlatch2; + optional_shared_ptr m_decrypted_opcodes; + optional_memory_region m_region_key; + optional_memory_region m_region_stars; + output_finder<3> m_led_cboard; }; /*----------- defined in drivers/cps1.c -----------*/ diff --git a/src/mame/includes/cvs.h b/src/mame/includes/cvs.h index b36f0b89159..2fe961b5603 100644 --- a/src/mame/includes/cvs.h +++ b/src/mame/includes/cvs.h @@ -25,76 +25,28 @@ class cvs_state : public driver_device { public: cvs_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_video_ram(*this, "video_ram"), - m_bullet_ram(*this, "bullet_ram"), - m_cvs_4_bit_dac_data(*this, "4bit_dac"), - m_tms5110_ctl_data(*this, "tms5110_ctl"), - m_dac3_state(*this, "dac3_state"), - m_maincpu(*this, "maincpu"), - m_audiocpu(*this, "audiocpu"), - m_speechcpu(*this, "speechcpu"), - m_dac2(*this, "dac2"), - m_dac3(*this, "dac3"), - m_tms5110(*this, "tms"), - m_s2636_0(*this, "s2636_0"), - m_s2636_1(*this, "s2636_1"), - m_s2636_2(*this, "s2636_2"), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen"), - m_palette(*this, "palette"), - m_soundlatch(*this, "soundlatch") - { - } + : driver_device(mconfig, type, tag) + , m_video_ram(*this, "video_ram") + , m_bullet_ram(*this, "bullet_ram") + , m_cvs_4_bit_dac_data(*this, "4bit_dac") + , m_tms5110_ctl_data(*this, "tms5110_ctl") + , m_dac3_state(*this, "dac3_state") + , m_maincpu(*this, "maincpu") + , m_audiocpu(*this, "audiocpu") + , m_speechcpu(*this, "speechcpu") + , m_dac2(*this, "dac2") + , m_dac3(*this, "dac3") + , m_tms5110(*this, "tms") + , m_s2636_0(*this, "s2636_0") + , m_s2636_1(*this, "s2636_1") + , m_s2636_2(*this, "s2636_2") + , m_gfxdecode(*this, "gfxdecode") + , m_screen(*this, "screen") + , m_palette(*this, "palette") + , m_soundlatch(*this, "soundlatch") + , m_lamp(*this, "lamp%u", 0U) + { } - /* memory pointers */ - required_shared_ptr m_video_ram; - required_shared_ptr m_bullet_ram; - optional_shared_ptr m_cvs_4_bit_dac_data; - optional_shared_ptr m_tms5110_ctl_data; - optional_shared_ptr m_dac3_state; - - /* video-related */ - struct cvs_star m_stars[CVS_MAX_STARS]; - bitmap_ind16 m_collision_background; - bitmap_ind16 m_background_bitmap; - bitmap_ind16 m_scrolled_collision_background; - int m_collision_register; - int m_total_stars; - int m_stars_on; - uint8_t m_scroll_reg; - int m_stars_scroll; - - /* misc */ - int m_s2650_flag; - emu_timer *m_cvs_393hz_timer; - uint8_t m_cvs_393hz_clock; - - uint8_t m_character_banking_mode; - uint16_t m_character_ram_page_start; - uint16_t m_speech_rom_bit_address; - - /* devices */ - required_device m_maincpu; - optional_device m_audiocpu; - optional_device m_speechcpu; - optional_device m_dac2; - optional_device m_dac3; - optional_device m_tms5110; - optional_device m_s2636_0; - optional_device m_s2636_1; - optional_device m_s2636_2; - required_device m_gfxdecode; - required_device m_screen; - required_device m_palette; - optional_device m_soundlatch; - - /* memory */ - uint8_t m_color_ram[0x400]; - uint8_t m_palette_ram[0x10]; - uint8_t m_character_ram[3 * 0x800]; /* only half is used, but - by allocating twice the amount, - we can use the same gfx_layout */ DECLARE_READ_LINE_MEMBER(speech_rom_read_bit); DECLARE_WRITE_LINE_MEMBER(write_s2650_flag); DECLARE_WRITE_LINE_MEMBER(cvs_slave_cpu_interrupt); @@ -127,8 +79,6 @@ public: void init_hero(); void init_superbik(); void init_hunchbaka(); - DECLARE_MACHINE_START(cvs); - DECLARE_MACHINE_RESET(cvs); DECLARE_VIDEO_START(cvs); DECLARE_PALETTE_INIT(cvs); uint32_t screen_update_cvs(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); @@ -145,4 +95,58 @@ public: void cvs_main_cpu_io_map(address_map &map); void cvs_main_cpu_map(address_map &map); void cvs_speech_cpu_map(address_map &map); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + + /* memory pointers */ + required_shared_ptr m_video_ram; + required_shared_ptr m_bullet_ram; + optional_shared_ptr m_cvs_4_bit_dac_data; + optional_shared_ptr m_tms5110_ctl_data; + optional_shared_ptr m_dac3_state; + + /* video-related */ + struct cvs_star m_stars[CVS_MAX_STARS]; + bitmap_ind16 m_collision_background; + bitmap_ind16 m_background_bitmap; + bitmap_ind16 m_scrolled_collision_background; + int m_collision_register; + int m_total_stars; + int m_stars_on; + uint8_t m_scroll_reg; + int m_stars_scroll; + + /* misc */ + int m_s2650_flag; + emu_timer *m_cvs_393hz_timer; + uint8_t m_cvs_393hz_clock; + + uint8_t m_character_banking_mode; + uint16_t m_character_ram_page_start; + uint16_t m_speech_rom_bit_address; + + /* devices */ + required_device m_maincpu; + optional_device m_audiocpu; + optional_device m_speechcpu; + optional_device m_dac2; + optional_device m_dac3; + optional_device m_tms5110; + optional_device m_s2636_0; + optional_device m_s2636_1; + optional_device m_s2636_2; + required_device m_gfxdecode; + required_device m_screen; + required_device m_palette; + optional_device m_soundlatch; + output_finder<3> m_lamp; + + /* memory */ + uint8_t m_color_ram[0x400]; + uint8_t m_palette_ram[0x10]; + uint8_t m_character_ram[3 * 0x800]; /* only half is used, but + by allocating twice the amount, + we can use the same gfx_layout */ }; diff --git a/src/mame/includes/djmain.h b/src/mame/includes/djmain.h index 1b12630bb82..bc81dec7218 100644 --- a/src/mame/includes/djmain.h +++ b/src/mame/includes/djmain.h @@ -9,38 +9,20 @@ class djmain_state : public driver_device { public: djmain_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_obj_ram(*this, "obj_ram"), - m_maincpu(*this, "maincpu"), - m_k056832(*this, "k056832"), - m_k055555(*this, "k055555"), - m_ata(*this, "ata"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_turntable(*this, {"TT1", "TT2"}), - m_sndram(*this, "sndram") + : driver_device(mconfig, type, tag) + , m_obj_ram(*this, "obj_ram") + , m_maincpu(*this, "maincpu") + , m_k056832(*this, "k056832") + , m_k055555(*this, "k055555") + , m_ata(*this, "ata") + , m_gfxdecode(*this, "gfxdecode") + , m_palette(*this, "palette") + , m_turntable(*this, {"TT1", "TT2"}) + , m_sndram(*this, "sndram") + , m_led(*this, "led%u", 0U) { } - required_shared_ptr m_obj_ram; - required_device m_maincpu; - required_device m_k056832; - required_device m_k055555; - required_device m_ata; - required_device m_gfxdecode; - required_device m_palette; - optional_ioport_array<2> m_turntable; - required_shared_ptr m_sndram; - - int m_sndram_bank; - int m_turntable_select; - uint8_t m_turntable_last_pos[2]; - uint16_t m_turntable_pos[2]; - uint8_t m_pending_vb_int; - uint16_t m_v_ctrl; - uint32_t m_obj_regs[0xa0/4]; - const uint8_t *m_ata_user_password; - const uint8_t *m_ata_master_password; DECLARE_WRITE32_MEMBER(sndram_bank_w); DECLARE_READ32_MEMBER(sndram_r); DECLARE_WRITE32_MEMBER(sndram_w); @@ -70,9 +52,6 @@ public: void init_bmcompm2(); void init_bmcorerm(); void init_bmclubmx(); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; uint32_t screen_update_djmain(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(vb_interrupt); DECLARE_WRITE_LINE_MEMBER(ide_interrupt); @@ -86,4 +65,30 @@ public: void maincpu_djmaina(address_map &map); void maincpu_djmainj(address_map &map); void maincpu_djmainu(address_map &map); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + + required_shared_ptr m_obj_ram; + required_device m_maincpu; + required_device m_k056832; + required_device m_k055555; + required_device m_ata; + required_device m_gfxdecode; + required_device m_palette; + optional_ioport_array<2> m_turntable; + required_shared_ptr m_sndram; + output_finder<3> m_led; + + int m_sndram_bank; + int m_turntable_select; + uint8_t m_turntable_last_pos[2]; + uint16_t m_turntable_pos[2]; + uint8_t m_pending_vb_int; + uint16_t m_v_ctrl; + uint32_t m_obj_regs[0xa0/4]; + const uint8_t *m_ata_user_password; + const uint8_t *m_ata_master_password; }; diff --git a/src/mame/includes/dynax.h b/src/mame/includes/dynax.h index 1bc90064d8e..398357b6703 100644 --- a/src/mame/includes/dynax.h +++ b/src/mame/includes/dynax.h @@ -38,100 +38,11 @@ public: , m_gfx_region6(*this, "gfx6") , m_gfx_region7(*this, "gfx7") , m_gfx_region8(*this, "gfx8") + , m_led(*this, "led0") { } - /* devices */ - required_device m_maincpu; - optional_device m_soundcpu; - optional_device m_oki; - optional_device m_msm; - optional_device m_screen; - required_device m_palette; - optional_device m_bankdev; - optional_device m_mainlatch; - optional_device m_mainirq; - optional_device m_soundirq; - optional_device m_soundlatch; - optional_region_ptr m_gfx_region1; - optional_region_ptr m_gfx_region2; - optional_region_ptr m_gfx_region3; - optional_region_ptr m_gfx_region4; - optional_region_ptr m_gfx_region5; - optional_region_ptr m_gfx_region6; - optional_region_ptr m_gfx_region7; - optional_region_ptr m_gfx_region8; - - memory_region * m_gfxregions[8]; - - // up to 8 layers, 2 images per layer (interleaved on screen) - std::unique_ptr m_pixmap[8][2]; - - /* irq */ typedef void (dynax_state::*irq_func)(); // some games trigger IRQ at blitter end, some don't - irq_func m_update_irq_func; - bool m_blitter_irq; - bool m_blitter_irq_mask; - bool m_blitter2_irq; - bool m_blitter2_irq_mask; - - /* blitters */ - int m_blit_scroll_x; - int m_blit2_scroll_x; - int m_blit_scroll_y; - int m_blit2_scroll_y; - int m_blit_wrap_enable; - int m_blit2_wrap_enable; - int m_blit_x; - int m_blit_y; - int m_blit2_x; - int m_blit2_y; - int m_blit_src; - int m_blit2_src; - int m_blit_romregion; - int m_blit2_romregion; - int m_blit_dest; - int m_blit2_dest; - int m_blit_pen; - int m_blit2_pen; - int m_blit_palbank; - int m_blit2_palbank; - int m_blit_palettes; - int m_blit2_palettes; - int m_layer_enable; - int m_blit_backpen; - - int m_hanamai_layer_half; - int m_hnoridur_layer_half2; - - int m_extra_scroll_x; - int m_extra_scroll_y; - int m_flipscreen; - - int m_layer_layout; - - const int *m_priority_table; - int m_hanamai_priority; - - /* input */ - uint8_t m_input_sel; - uint8_t m_dsw_sel; - uint8_t m_keyb; - uint8_t m_coins; - uint8_t m_hopper; - - /* misc */ - uint8_t m_palette_ram[16*256*2]; - int m_palbank; - int m_msm5205next; - int m_resetkludge; - int m_toggle; - int m_toggle_cpu1; - int m_rombank; - uint8_t m_tenkai_p5_val; - int m_tenkai_6c; - int m_tenkai_70; - uint8_t m_gekisha_val[2]; DECLARE_WRITE8_MEMBER(dynax_vblank_ack_w); DECLARE_WRITE_LINE_MEMBER(blitter_ack_w); @@ -358,4 +269,98 @@ public: void yarunara_banked_map(address_map &map); void yarunara_io_map(address_map &map); void yarunara_mem_map(address_map &map); + +protected: + /* devices */ + required_device m_maincpu; + optional_device m_soundcpu; + optional_device m_oki; + optional_device m_msm; + optional_device m_screen; + required_device m_palette; + optional_device m_bankdev; + optional_device m_mainlatch; + optional_device m_mainirq; + optional_device m_soundirq; + optional_device m_soundlatch; + optional_region_ptr m_gfx_region1; + optional_region_ptr m_gfx_region2; + optional_region_ptr m_gfx_region3; + optional_region_ptr m_gfx_region4; + optional_region_ptr m_gfx_region5; + optional_region_ptr m_gfx_region6; + optional_region_ptr m_gfx_region7; + optional_region_ptr m_gfx_region8; + output_finder<> m_led; + + memory_region * m_gfxregions[8]; + + // up to 8 layers, 2 images per layer (interleaved on screen) + std::unique_ptr m_pixmap[8][2]; + + /* irq */ + irq_func m_update_irq_func; + bool m_blitter_irq; + bool m_blitter_irq_mask; + bool m_blitter2_irq; + bool m_blitter2_irq_mask; + + /* blitters */ + int m_blit_scroll_x; + int m_blit2_scroll_x; + int m_blit_scroll_y; + int m_blit2_scroll_y; + int m_blit_wrap_enable; + int m_blit2_wrap_enable; + int m_blit_x; + int m_blit_y; + int m_blit2_x; + int m_blit2_y; + int m_blit_src; + int m_blit2_src; + int m_blit_romregion; + int m_blit2_romregion; + int m_blit_dest; + int m_blit2_dest; + int m_blit_pen; + int m_blit2_pen; + int m_blit_palbank; + int m_blit2_palbank; + int m_blit_palettes; + int m_blit2_palettes; + int m_layer_enable; + int m_blit_backpen; + + int m_hanamai_layer_half; + int m_hnoridur_layer_half2; + + int m_extra_scroll_x; + int m_extra_scroll_y; + int m_flipscreen; + + int m_layer_layout; + + const int *m_priority_table; + int m_hanamai_priority; + + /* input */ + uint8_t m_input_sel; + uint8_t m_dsw_sel; + uint8_t m_keyb; + uint8_t m_coins; + uint8_t m_hopper; + + /* misc */ + uint8_t m_palette_ram[16*256*2]; + int m_palbank; + int m_msm5205next; + int m_resetkludge; + int m_toggle; + int m_toggle_cpu1; + int m_rombank; + uint8_t m_tenkai_p5_val; + int m_tenkai_6c; + int m_tenkai_70; + uint8_t m_gekisha_val[2]; + }; diff --git a/src/mame/includes/elf.h b/src/mame/includes/elf.h index 7d0f089651e..b1879a5d006 100644 --- a/src/mame/includes/elf.h +++ b/src/mame/includes/elf.h @@ -36,20 +36,9 @@ public: , m_ram(*this, RAM_TAG) , m_special(*this, "SPECIAL") , m_7segs(*this, "digit%u", 0U) + , m_led(*this, "led0") { } - required_device m_maincpu; - required_device m_vdc; - required_device m_kb; - required_device m_led_l; - required_device m_led_h; - required_device m_cassette; - required_device m_ram; - required_ioport m_special; - output_finder<2> m_7segs; - - virtual void machine_start() override; - DECLARE_READ8_MEMBER( dispon_r ); DECLARE_READ8_MEMBER( data_r ); DECLARE_WRITE8_MEMBER( data_w ); @@ -65,11 +54,26 @@ public: template DECLARE_WRITE8_MEMBER( digit_w ) { m_7segs[N] = data; } DECLARE_QUICKLOAD_LOAD_MEMBER( elf ); - // display state - uint8_t m_data; void elf2(machine_config &config); void elf2_io(address_map &map); void elf2_mem(address_map &map); + +protected: + virtual void machine_start() override; + + required_device m_maincpu; + required_device m_vdc; + required_device m_kb; + required_device m_led_l; + required_device m_led_h; + required_device m_cassette; + required_device m_ram; + required_ioport m_special; + output_finder<2> m_7segs; + output_finder<> m_led; + + // display state + uint8_t m_data; }; #endif diff --git a/src/mame/includes/eolith.h b/src/mame/includes/eolith.h index 616a5da4f4d..74161a7f567 100644 --- a/src/mame/includes/eolith.h +++ b/src/mame/includes/eolith.h @@ -20,6 +20,7 @@ public: , m_in0(*this, "IN0") , m_penxport(*this, "PEN_X_P%u", 1) , m_penyport(*this, "PEN_Y_P%u", 1) + , m_led(*this, "led0") , m_sndbank(*this, "sound_bank") { } @@ -60,6 +61,7 @@ public: void sound_io_map(address_map &map); void sound_prg_map(address_map &map); protected: + virtual void machine_start() override; // shared with eolith16.cpp, vegaeo.cpp optional_ioport m_eepromoutport; @@ -77,6 +79,7 @@ private: optional_ioport m_in0; // klondkp doesn't have it optional_ioport_array<2> m_penxport; optional_ioport_array<2> m_penyport; + output_finder<> m_led; optional_memory_bank m_sndbank; diff --git a/src/mame/includes/epos.h b/src/mame/includes/epos.h index df5ce02a6a9..f2a5e1ee623 100644 --- a/src/mame/includes/epos.h +++ b/src/mame/includes/epos.h @@ -9,25 +9,15 @@ class epos_state : public driver_device { public: - epos_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + epos_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_videoram(*this, "videoram"), m_inputs(*this, { "INPUTS", "INPUTS2" }), m_maincpu(*this, "maincpu"), - m_palette(*this, "palette") + m_palette(*this, "palette"), + m_led(*this, "led%u", 0U) { } - /* memory pointers */ - required_shared_ptr m_videoram; - optional_ioport_array<2> m_inputs; - - /* video-related */ - uint8_t m_palette_bank; - - /* misc */ - int m_counter; - int m_input_multiplex; - bool m_ay_porta_multiplex; DECLARE_WRITE8_MEMBER(dealer_decrypt_rom); DECLARE_WRITE8_MEMBER(port_1_w); DECLARE_READ8_MEMBER(i8255_porta_r); @@ -42,12 +32,28 @@ public: DECLARE_PALETTE_INIT(epos); uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); void set_pal_color( uint8_t offset, uint8_t data ); - required_device m_maincpu; - required_device m_palette; void epos(machine_config &config); void dealer(machine_config &config); void dealer_io_map(address_map &map); void dealer_map(address_map &map); void epos_io_map(address_map &map); void epos_map(address_map &map); + +protected: + virtual void machine_start() override { m_led.resolve(); } + + /* memory pointers */ + required_shared_ptr m_videoram; + optional_ioport_array<2> m_inputs; + + /* video-related */ + uint8_t m_palette_bank; + + /* misc */ + int m_counter; + int m_input_multiplex; + bool m_ay_porta_multiplex; + required_device m_maincpu; + required_device m_palette; + output_finder<2> m_led; }; diff --git a/src/mame/includes/eti660.h b/src/mame/includes/eti660.h index b0d68695ac2..cf0eb5f78b3 100644 --- a/src/mame/includes/eti660.h +++ b/src/mame/includes/eti660.h @@ -36,6 +36,7 @@ public: , m_cassette(*this, "cassette") , m_io_keyboard(*this, "KEY.%u", 0) , m_special(*this, "SPECIAL") + , m_led(*this, "led%u", 0U) { } DECLARE_READ8_MEMBER( pia_r ); @@ -64,6 +65,7 @@ private: required_device m_cassette; required_ioport_array<4> m_io_keyboard; required_ioport m_special; + output_finder<2> m_led; virtual void machine_start() override; virtual void machine_reset() override; diff --git a/src/mame/includes/firetrk.h b/src/mame/includes/firetrk.h index b5e533cef40..fa8c3aa638f 100644 --- a/src/mame/includes/firetrk.h +++ b/src/mame/includes/firetrk.h @@ -39,67 +39,30 @@ class firetrk_state : public driver_device { public: firetrk_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_watchdog(*this, "watchdog"), - m_discrete(*this, "discrete"), - m_alpha_num_ram(*this, "alpha_num_ram"), - m_playfield_ram(*this, "playfield_ram"), - m_scroll_y(*this, "scroll_y"), - m_scroll_x(*this, "scroll_x"), - m_car_rot(*this, "car_rot"), - m_blink(*this, "blink"), - m_drone_x(*this, "drone_x"), - m_drone_y(*this, "drone_y"), - m_drone_rot(*this, "drone_rot"), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen"), - m_palette(*this, "palette"), - m_bit_0(*this, "BIT_0"), - m_bit_6(*this, "BIT_6"), - m_bit_7(*this, "BIT_7"), - m_dips(*this, {"DIP_0", "DIP_1"}), - m_steer(*this, {"STEER_1", "STEER_2"}) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_watchdog(*this, "watchdog") + , m_discrete(*this, "discrete") + , m_alpha_num_ram(*this, "alpha_num_ram") + , m_playfield_ram(*this, "playfield_ram") + , m_scroll_y(*this, "scroll_y") + , m_scroll_x(*this, "scroll_x") + , m_car_rot(*this, "car_rot") + , m_blink(*this, "blink") + , m_drone_x(*this, "drone_x") + , m_drone_y(*this, "drone_y") + , m_drone_rot(*this, "drone_rot") + , m_gfxdecode(*this, "gfxdecode") + , m_screen(*this, "screen") + , m_palette(*this, "palette") + , m_bit_0(*this, "BIT_0") + , m_bit_6(*this, "BIT_6") + , m_bit_7(*this, "BIT_7") + , m_dips(*this, {"DIP_0", "DIP_1"}) + , m_steer(*this, {"STEER_1", "STEER_2"}) + , m_led(*this, "led%u", 0U) { } - required_device m_maincpu; - required_device m_watchdog; - required_device m_discrete; - required_shared_ptr m_alpha_num_ram; - required_shared_ptr m_playfield_ram; - required_shared_ptr m_scroll_y; - required_shared_ptr m_scroll_x; - required_shared_ptr m_car_rot; - optional_shared_ptr m_blink; - optional_shared_ptr m_drone_x; - optional_shared_ptr m_drone_y; - optional_shared_ptr m_drone_rot; - required_device m_gfxdecode; - required_device m_screen; - required_device m_palette; - - optional_ioport m_bit_0; - optional_ioport m_bit_6; - optional_ioport m_bit_7; - required_ioport_array<2> m_dips; - optional_ioport_array<2> m_steer; - - uint8_t m_in_service_mode; - uint32_t m_dial[2]; - uint8_t m_steer_dir[2]; - uint8_t m_steer_flag[2]; - uint8_t m_gear; - - uint8_t m_flash; - uint8_t m_crash[2]; - uint8_t m_skid[2]; - bitmap_ind16 m_helper1; - bitmap_ind16 m_helper2; - uint32_t m_color1_mask; - uint32_t m_color2_mask; - tilemap_t *m_tilemap1; - tilemap_t *m_tilemap2; - DECLARE_WRITE8_MEMBER(firetrk_output_w); DECLARE_WRITE8_MEMBER(superbug_output_w); DECLARE_WRITE8_MEMBER(montecar_output_1_w); @@ -127,8 +90,6 @@ public: TILE_GET_INFO_MEMBER(firetrk_get_tile_info2); TILE_GET_INFO_MEMBER(superbug_get_tile_info2); TILE_GET_INFO_MEMBER(montecar_get_tile_info2); - virtual void machine_reset() override; - virtual void video_start() override; DECLARE_PALETTE_INIT(firetrk); DECLARE_VIDEO_START(superbug); DECLARE_VIDEO_START(montecar); @@ -157,6 +118,50 @@ public: void firetrk_map(address_map &map); void montecar_map(address_map &map); void superbug_map(address_map &map); + +protected: + virtual void machine_start() override { m_led.resolve(); } + virtual void machine_reset() override; + virtual void video_start() override; + + required_device m_maincpu; + required_device m_watchdog; + required_device m_discrete; + required_shared_ptr m_alpha_num_ram; + required_shared_ptr m_playfield_ram; + required_shared_ptr m_scroll_y; + required_shared_ptr m_scroll_x; + required_shared_ptr m_car_rot; + optional_shared_ptr m_blink; + optional_shared_ptr m_drone_x; + optional_shared_ptr m_drone_y; + optional_shared_ptr m_drone_rot; + required_device m_gfxdecode; + required_device m_screen; + required_device m_palette; + + optional_ioport m_bit_0; + optional_ioport m_bit_6; + optional_ioport m_bit_7; + required_ioport_array<2> m_dips; + optional_ioport_array<2> m_steer; + output_finder<4> m_led; + + uint8_t m_in_service_mode; + uint32_t m_dial[2]; + uint8_t m_steer_dir[2]; + uint8_t m_steer_flag[2]; + uint8_t m_gear; + + uint8_t m_flash; + uint8_t m_crash[2]; + uint8_t m_skid[2]; + bitmap_ind16 m_helper1; + bitmap_ind16 m_helper2; + uint32_t m_color1_mask; + uint32_t m_color2_mask; + tilemap_t *m_tilemap1; + tilemap_t *m_tilemap2; }; diff --git a/src/mame/includes/foodf.h b/src/mame/includes/foodf.h index a143498f1f5..6aadfca6f27 100644 --- a/src/mame/includes/foodf.h +++ b/src/mame/includes/foodf.h @@ -21,7 +21,8 @@ public: atarigen_state(mconfig, type, tag), m_nvram(*this, "nvram"), m_playfield_tilemap(*this, "playfield"), - m_spriteram(*this, "spriteram") + m_spriteram(*this, "spriteram"), + m_led(*this, "led%u", 0U) { } void foodf(machine_config &config); @@ -52,6 +53,7 @@ private: uint8_t m_playfield_flip; required_shared_ptr m_spriteram; + output_finder<2> m_led; }; #endif // MAME_INCLUDES_FOODF_H diff --git a/src/mame/includes/funworld.h b/src/mame/includes/funworld.h index 0c39ac93bdd..7bc574e8422 100644 --- a/src/mame/includes/funworld.h +++ b/src/mame/includes/funworld.h @@ -3,17 +3,16 @@ class funworld_state : public driver_device { public: - funworld_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + funworld_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_videoram(*this, "videoram"), m_colorram(*this, "colorram"), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_lamp(*this, "lamp%u", 0U) + { } - required_shared_ptr m_videoram; - required_shared_ptr m_colorram; - tilemap_t *m_bg_tilemap; DECLARE_READ8_MEMBER(questions_r); DECLARE_WRITE8_MEMBER(question_bank_w); DECLARE_WRITE8_MEMBER(funworld_videoram_w); @@ -44,9 +43,6 @@ public: DECLARE_MACHINE_START(lunapark); DECLARE_MACHINE_RESET(lunapark); uint32_t screen_update_funworld(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_palette; void royalcd1(machine_config &config); void royalcd2(machine_config &config); void fw1stpal(machine_config &config); @@ -71,4 +67,15 @@ public: void magicrd2_map(address_map &map); void saloon_map(address_map &map); void witchryl_map(address_map &map); + +protected: + virtual void machine_start() override { m_lamp.resolve(); } + + required_shared_ptr m_videoram; + required_shared_ptr m_colorram; + tilemap_t *m_bg_tilemap; + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_palette; + output_finder<8> m_lamp; }; diff --git a/src/mame/includes/galaga.h b/src/mame/includes/galaga.h index f26e6602349..e0fdfed6046 100644 --- a/src/mame/includes/galaga.h +++ b/src/mame/includes/galaga.h @@ -15,19 +15,56 @@ class galaga_state : public driver_device { public: galaga_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_videoram(*this, "videoram"), - m_galaga_ram1(*this, "galaga_ram1"), - m_galaga_ram2(*this, "galaga_ram2"), - m_galaga_ram3(*this, "galaga_ram3"), - m_videolatch(*this, "videolatch"), - m_maincpu(*this, "maincpu"), - m_subcpu(*this, "sub"), - m_subcpu2(*this, "sub2"), - m_namco_sound(*this, "namco"), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen"), - m_palette(*this, "palette") { } + : driver_device(mconfig, type, tag) + , m_videoram(*this, "videoram") + , m_galaga_ram1(*this, "galaga_ram1") + , m_galaga_ram2(*this, "galaga_ram2") + , m_galaga_ram3(*this, "galaga_ram3") + , m_videolatch(*this, "videolatch") + , m_maincpu(*this, "maincpu") + , m_subcpu(*this, "sub") + , m_subcpu2(*this, "sub2") + , m_namco_sound(*this, "namco") + , m_gfxdecode(*this, "gfxdecode") + , m_screen(*this, "screen") + , m_palette(*this, "palette") + , m_led(*this, "led%u", 0U) + { } + + DECLARE_READ8_MEMBER(bosco_dsw_r); + DECLARE_WRITE_LINE_MEMBER(flip_screen_w); + DECLARE_WRITE_LINE_MEMBER(irq1_clear_w); + DECLARE_WRITE_LINE_MEMBER(irq2_clear_w); + DECLARE_WRITE_LINE_MEMBER(nmion_w); + DECLARE_WRITE8_MEMBER(galaga_videoram_w); + DECLARE_WRITE_LINE_MEMBER(gatsbee_bank_w); + DECLARE_WRITE8_MEMBER(out_0); + DECLARE_WRITE8_MEMBER(out_1); + DECLARE_READ8_MEMBER(namco_52xx_rom_r); + DECLARE_READ8_MEMBER(namco_52xx_si_r); + void init_galaga(); + void init_gatsbee(); + TILEMAP_MAPPER_MEMBER(tilemap_scan); + TILE_GET_INFO_MEMBER(get_tile_info); + DECLARE_VIDEO_START(galaga); + DECLARE_PALETTE_INIT(galaga); + uint32_t screen_update_galaga(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_WRITE_LINE_MEMBER(screen_vblank_galaga); + DECLARE_WRITE_LINE_MEMBER(vblank_irq); + TIMER_CALLBACK_MEMBER(cpu3_interrupt_callback); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ); + void draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect ); + void galaga(machine_config &config); + void gatsbee(machine_config &config); + void galagab(machine_config &config); + void dzigzag_mem4(address_map &map); + void galaga_map(address_map &map); + void galaga_mem4(address_map &map); + void gatsbee_main_map(address_map &map); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; /* memory pointers */ optional_shared_ptr m_videoram; @@ -42,6 +79,7 @@ public: required_device m_gfxdecode; required_device m_screen; required_device m_palette; + output_finder<2> m_led; emu_timer *m_cpu3_interrupt_timer; /* machine state */ @@ -61,31 +99,7 @@ public: uint8_t m_main_irq_mask; uint8_t m_sub_irq_mask; uint8_t m_sub2_nmi_mask; - DECLARE_READ8_MEMBER(bosco_dsw_r); - DECLARE_WRITE_LINE_MEMBER(flip_screen_w); - DECLARE_WRITE_LINE_MEMBER(irq1_clear_w); - DECLARE_WRITE_LINE_MEMBER(irq2_clear_w); - DECLARE_WRITE_LINE_MEMBER(nmion_w); - DECLARE_WRITE8_MEMBER(galaga_videoram_w); - DECLARE_WRITE_LINE_MEMBER(gatsbee_bank_w); - DECLARE_WRITE8_MEMBER(out_0); - DECLARE_WRITE8_MEMBER(out_1); - DECLARE_READ8_MEMBER(namco_52xx_rom_r); - DECLARE_READ8_MEMBER(namco_52xx_si_r); - void init_galaga(); - void init_gatsbee(); - TILEMAP_MAPPER_MEMBER(tilemap_scan); - TILE_GET_INFO_MEMBER(get_tile_info); - DECLARE_MACHINE_START(galaga); - DECLARE_MACHINE_RESET(galaga); - DECLARE_VIDEO_START(galaga); - DECLARE_PALETTE_INIT(galaga); - uint32_t screen_update_galaga(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_WRITE_LINE_MEMBER(screen_vblank_galaga); - DECLARE_WRITE_LINE_MEMBER(vblank_irq); - TIMER_CALLBACK_MEMBER(cpu3_interrupt_callback); - void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ); - void draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect ); + struct star { uint16_t x,y; @@ -93,13 +107,7 @@ public: }; static struct star m_star_seed_tab[]; - void galaga(machine_config &config); - void gatsbee(machine_config &config); - void galagab(machine_config &config); - void dzigzag_mem4(address_map &map); - void galaga_map(address_map &map); - void galaga_mem4(address_map &map); - void gatsbee_main_map(address_map &map); + }; DISCRETE_SOUND_EXTERN( galaga_discrete ); diff --git a/src/mame/includes/galaxian.h b/src/mame/includes/galaxian.h index adf89b226f9..c3f7f3ca56c 100644 --- a/src/mame/includes/galaxian.h +++ b/src/mame/includes/galaxian.h @@ -40,65 +40,26 @@ class galaxian_state : public driver_device { public: galaxian_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_audiocpu(*this, "audiocpu"), - m_audio2(*this, "audio2"), - m_dac(*this, "dac"), - m_ay8910(*this, "8910.%u", 0), - m_ay8910_cclimber(*this, "cclimber_audio:aysnd"), - m_digitalker(*this, "digitalker"), - m_ppi8255(*this, "ppi8255_%u", 0), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen"), - m_palette(*this, "palette"), - m_soundlatch(*this, "soundlatch"), - m_fake_select(*this, "FAKE_SELECT"), - m_tenspot_game_dsw(*this, {"IN2_GAME0", "IN2_GAME1", "IN2_GAME2", "IN2_GAME3", "IN2_GAME4", "IN2_GAME5", "IN2_GAME6", "IN2_GAME7", "IN2_GAME8", "IN2_GAME9"}), - m_spriteram(*this, "spriteram"), - m_videoram(*this, "videoram"), - m_decrypted_opcodes(*this, "decrypted_opcodes") { } - - required_device m_maincpu; - optional_device m_audiocpu; - optional_device m_audio2; - optional_device m_dac; - optional_device_array m_ay8910; - optional_device m_ay8910_cclimber; - optional_device m_digitalker; - optional_device_array m_ppi8255; - required_device m_gfxdecode; - required_device m_screen; - required_device m_palette; - optional_device m_soundlatch; - - optional_ioport m_fake_select; - optional_ioport_array<10> m_tenspot_game_dsw; - - required_shared_ptr m_spriteram; - required_shared_ptr m_videoram; - optional_shared_ptr m_decrypted_opcodes; - - int m_bullets_base; - int m_sprites_base; - int m_numspritegens; - int m_counter_74ls161[2]; - int m_direction[2]; - uint8_t m_gmgalax_selected_game; - uint8_t m_zigzag_ay8910_latch; - uint8_t m_kingball_speech_dip; - uint8_t m_kingball_sound; - uint8_t m_mshuttle_ay8910_cs; - uint16_t m_protection_state; - uint8_t m_protection_result; - uint8_t m_konami_sound_control; - uint8_t m_sfx_sample_control; - uint8_t m_moonwar_port_select; - uint8_t m_irq_enabled; - int m_irq_line; - int m_tenspot_current_game; - uint8_t m_frogger_adjust; - uint8_t m_sfx_tilemap; + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_audiocpu(*this, "audiocpu") + , m_audio2(*this, "audio2") + , m_dac(*this, "dac") + , m_ay8910(*this, "8910.%u", 0) + , m_ay8910_cclimber(*this, "cclimber_audio:aysnd") + , m_digitalker(*this, "digitalker") + , m_ppi8255(*this, "ppi8255_%u", 0) + , m_gfxdecode(*this, "gfxdecode") + , m_screen(*this, "screen") + , m_palette(*this, "palette") + , m_soundlatch(*this, "soundlatch") + , m_fake_select(*this, "FAKE_SELECT") + , m_tenspot_game_dsw(*this, {"IN2_GAME0", "IN2_GAME1", "IN2_GAME2", "IN2_GAME3", "IN2_GAME4", "IN2_GAME5", "IN2_GAME6", "IN2_GAME7", "IN2_GAME8", "IN2_GAME9"}) + , m_spriteram(*this, "spriteram") + , m_videoram(*this, "videoram") + , m_decrypted_opcodes(*this, "decrypted_opcodes") + , m_lamp(*this, "lamp%u", 0U) + { } /* video extension callbacks */ typedef void (galaxian_state::*galaxian_extend_tile_info_func)(uint16_t *code, uint8_t *color, uint8_t attrib, uint8_t x); @@ -106,26 +67,6 @@ public: typedef void (galaxian_state::*galaxian_draw_bullet_func)(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y); typedef void (galaxian_state::*galaxian_draw_background_func)(bitmap_rgb32 &bitmap, const rectangle &cliprect); - galaxian_extend_tile_info_func m_extend_tile_info_ptr; - galaxian_extend_sprite_info_func m_extend_sprite_info_ptr; - galaxian_draw_bullet_func m_draw_bullet_ptr; - galaxian_draw_background_func m_draw_background_ptr; - - tilemap_t *m_bg_tilemap; - uint8_t m_flipscreen_x; - uint8_t m_flipscreen_y; - uint8_t m_background_enable; - uint8_t m_background_red; - uint8_t m_background_green; - uint8_t m_background_blue; - uint32_t m_star_rng_origin; - uint32_t m_star_rng_origin_frame; - rgb_t m_star_color[64]; - std::unique_ptr m_stars; - uint8_t m_stars_enabled; - uint8_t m_stars_blink_state; - rgb_t m_bullet_color[8]; - uint8_t m_gfxbank[5]; DECLARE_WRITE8_MEMBER(galaxian_videoram_w); DECLARE_WRITE8_MEMBER(galaxian_objram_w); DECLARE_WRITE8_MEMBER(galaxian_flip_screen_x_w); @@ -269,7 +210,6 @@ public: void init_victoryc(); void init_victorycb(); TILE_GET_INFO_MEMBER(bg_get_tile_info); - virtual void video_start() override; DECLARE_PALETTE_INIT(galaxian); DECLARE_PALETTE_INIT(moonwar); void tenspot_set_game_bank(int bank, int from_game); @@ -422,4 +362,71 @@ public: void turpins_sound_map(address_map &map); void turtles_map(address_map &map); void zigzag_map(address_map &map); + +protected: + virtual void machine_start() override { m_lamp.resolve(); } + virtual void video_start() override; + + required_device m_maincpu; + optional_device m_audiocpu; + optional_device m_audio2; + optional_device m_dac; + optional_device_array m_ay8910; + optional_device m_ay8910_cclimber; + optional_device m_digitalker; + optional_device_array m_ppi8255; + required_device m_gfxdecode; + required_device m_screen; + required_device m_palette; + optional_device m_soundlatch; + + optional_ioport m_fake_select; + optional_ioport_array<10> m_tenspot_game_dsw; + + required_shared_ptr m_spriteram; + required_shared_ptr m_videoram; + optional_shared_ptr m_decrypted_opcodes; + output_finder<2> m_lamp; + + int m_bullets_base; + int m_sprites_base; + int m_numspritegens; + int m_counter_74ls161[2]; + int m_direction[2]; + uint8_t m_gmgalax_selected_game; + uint8_t m_zigzag_ay8910_latch; + uint8_t m_kingball_speech_dip; + uint8_t m_kingball_sound; + uint8_t m_mshuttle_ay8910_cs; + uint16_t m_protection_state; + uint8_t m_protection_result; + uint8_t m_konami_sound_control; + uint8_t m_sfx_sample_control; + uint8_t m_moonwar_port_select; + uint8_t m_irq_enabled; + int m_irq_line; + int m_tenspot_current_game; + uint8_t m_frogger_adjust; + uint8_t m_sfx_tilemap; + + galaxian_extend_tile_info_func m_extend_tile_info_ptr; + galaxian_extend_sprite_info_func m_extend_sprite_info_ptr; + galaxian_draw_bullet_func m_draw_bullet_ptr; + galaxian_draw_background_func m_draw_background_ptr; + + tilemap_t *m_bg_tilemap; + uint8_t m_flipscreen_x; + uint8_t m_flipscreen_y; + uint8_t m_background_enable; + uint8_t m_background_red; + uint8_t m_background_green; + uint8_t m_background_blue; + uint32_t m_star_rng_origin; + uint32_t m_star_rng_origin_frame; + rgb_t m_star_color[64]; + std::unique_ptr m_stars; + uint8_t m_stars_enabled; + uint8_t m_stars_blink_state; + rgb_t m_bullet_color[8]; + uint8_t m_gfxbank[5]; }; diff --git a/src/mame/includes/galaxold.h b/src/mame/includes/galaxold.h index 754a70921cc..fb70548a0e5 100644 --- a/src/mame/includes/galaxold.h +++ b/src/mame/includes/galaxold.h @@ -30,24 +30,24 @@ class galaxold_state : public driver_device { public: galaxold_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_audiocpu(*this, "audiocpu"), - m_7474_9m_1(*this, "7474_9m_1"), - m_7474_9m_2(*this, "7474_9m_2"), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen"), - m_palette(*this, "palette"), - m_videoram(*this,"videoram"), - m_spriteram(*this,"spriteram"), - m_spriteram2(*this,"spriteram2"), - m_attributesram(*this,"attributesram"), - m_bulletsram(*this,"bulletsram"), - m_rockclim_videoram(*this,"rockclim_vram"), - m_racknrol_tiles_bank(*this,"racknrol_tbank"), - m_leftclip(2) - { - } + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_audiocpu(*this, "audiocpu") + , m_7474_9m_1(*this, "7474_9m_1") + , m_7474_9m_2(*this, "7474_9m_2") + , m_gfxdecode(*this, "gfxdecode") + , m_screen(*this, "screen") + , m_palette(*this, "palette") + , m_videoram(*this,"videoram") + , m_spriteram(*this,"spriteram") + , m_spriteram2(*this,"spriteram2") + , m_attributesram(*this,"attributesram") + , m_bulletsram(*this,"bulletsram") + , m_rockclim_videoram(*this,"rockclim_vram") + , m_racknrol_tiles_bank(*this,"racknrol_tbank") + , m_led(*this, "led%u", 0U) + , m_leftclip(2) + { } /* devices */ required_device m_maincpu; @@ -66,6 +66,7 @@ public: optional_shared_ptr m_bulletsram; optional_shared_ptr m_rockclim_videoram; optional_shared_ptr m_racknrol_tiles_bank; + output_finder<2> m_led; int m_irq_line; uint8_t m__4in1_bank; @@ -323,6 +324,9 @@ public: void scrambler_map(address_map &map); void spcwarp(address_map &map); void tazzmang(address_map &map); + +protected: + virtual void machine_start() override { m_led.resolve(); } }; #define galaxold_coin_counter_0_w galaxold_coin_counter_w diff --git a/src/mame/includes/gaplus.h b/src/mame/includes/gaplus.h index c45f4c9efd0..8c36493ff90 100644 --- a/src/mame/includes/gaplus.h +++ b/src/mame/includes/gaplus.h @@ -30,45 +30,20 @@ public: }; gaplus_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_subcpu(*this, "sub"), - m_subcpu2(*this, "sub2"), - m_namco_15xx(*this, "namco"), - m_samples(*this, "samples") , - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen"), - m_palette(*this, "palette"), - m_customio_3(*this,"customio_3"), - m_videoram(*this,"videoram"), - m_spriteram(*this,"spriteram") { } - - required_device m_maincpu; - required_device m_subcpu; - required_device m_subcpu2; - required_device m_namco_15xx; - required_device m_samples; - required_device m_gfxdecode; - required_device m_screen; - required_device m_palette; - namco58xx_device *m_namco58xx; - namco56xx_device *m_namco56xx; - - required_shared_ptr m_customio_3; - required_shared_ptr m_videoram; - required_shared_ptr m_spriteram; - - int m_type; - - tilemap_t *m_bg_tilemap; - uint8_t m_starfield_control[4]; - int m_total_stars; - struct star m_stars[MAX_STARS]; - uint8_t m_main_irq_mask; - uint8_t m_sub_irq_mask; - uint8_t m_sub2_irq_mask; - emu_timer *m_namcoio0_run_timer; - emu_timer *m_namcoio1_run_timer; + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_subcpu(*this, "sub") + , m_subcpu2(*this, "sub2") + , m_namco_15xx(*this, "namco") + , m_samples(*this, "samples") + , m_gfxdecode(*this, "gfxdecode") + , m_screen(*this, "screen") + , m_palette(*this, "palette") + , m_customio_3(*this,"customio_3") + , m_videoram(*this,"videoram") + , m_spriteram(*this,"spriteram") + , m_lamp(*this, "lamp%u", 0U) + { } DECLARE_WRITE8_MEMBER(irq_1_ctrl_w); DECLARE_WRITE8_MEMBER(irq_2_ctrl_w); @@ -85,9 +60,6 @@ public: void init_gaplus(); void init_gaplusd(); void init_galaga3(); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; DECLARE_PALETTE_INIT(gaplus); TILEMAP_MAPPER_MEMBER(tilemap_scan); @@ -112,4 +84,35 @@ public: void cpu3_map(address_map &map); protected: virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + + required_device m_maincpu; + required_device m_subcpu; + required_device m_subcpu2; + required_device m_namco_15xx; + required_device m_samples; + required_device m_gfxdecode; + required_device m_screen; + required_device m_palette; + namco58xx_device *m_namco58xx; + namco56xx_device *m_namco56xx; + + required_shared_ptr m_customio_3; + required_shared_ptr m_videoram; + required_shared_ptr m_spriteram; + output_finder<2> m_lamp; + + int m_type; + + tilemap_t *m_bg_tilemap; + uint8_t m_starfield_control[4]; + int m_total_stars; + struct star m_stars[MAX_STARS]; + uint8_t m_main_irq_mask; + uint8_t m_sub_irq_mask; + uint8_t m_sub2_irq_mask; + emu_timer *m_namcoio0_run_timer; + emu_timer *m_namcoio1_run_timer; }; diff --git a/src/mame/includes/goldstar.h b/src/mame/includes/goldstar.h index f7780fe120a..ef92e7e262a 100644 --- a/src/mame/includes/goldstar.h +++ b/src/mame/includes/goldstar.h @@ -22,9 +22,9 @@ public: m_reel3_scroll(*this, "reel3_scroll"), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") - { - } + m_palette(*this, "palette"), + m_lamp(*this, "lamp%u", 0U) + { } DECLARE_WRITE8_MEMBER(protection_w); DECLARE_READ8_MEMBER(protection_r); @@ -80,7 +80,9 @@ public: void wcat3_map(address_map &map); void wcherry_map(address_map &map); void wcherry_readwriteport(address_map &map); + protected: + virtual void machine_start() override { m_lamp.resolve(); } TILE_GET_INFO_MEMBER(get_goldstar_fg_tile_info); TILE_GET_INFO_MEMBER(get_cherrym_fg_tile_info); TILE_GET_INFO_MEMBER(get_goldstar_reel1_tile_info); @@ -118,6 +120,7 @@ protected: required_device m_maincpu; required_device m_gfxdecode; required_device m_palette; + output_finder<16> m_lamp; }; diff --git a/src/mame/includes/gottlieb.h b/src/mame/includes/gottlieb.h index a7ca9e6128e..8f1fa1eac4a 100644 --- a/src/mame/includes/gottlieb.h +++ b/src/mame/includes/gottlieb.h @@ -37,66 +37,24 @@ public: }; gottlieb_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_laserdisc(*this, "laserdisc"), - m_r1_sound(*this, "r1sound"), - m_r2_sound(*this, "r2sound"), - m_knocker_sample(*this, "knocker_sam"), - m_videoram(*this, "videoram"), - m_charram(*this, "charram"), - m_spriteram(*this, "spriteram"), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen"), - m_palette(*this, "palette"), - m_generic_paletteram_8(*this, "paletteram"), - m_track_x(*this, "TRACKX"), - m_track_y(*this, "TRACKY") + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_laserdisc(*this, "laserdisc") + , m_r1_sound(*this, "r1sound") + , m_r2_sound(*this, "r2sound") + , m_knocker_sample(*this, "knocker_sam") + , m_videoram(*this, "videoram") + , m_charram(*this, "charram") + , m_spriteram(*this, "spriteram") + , m_gfxdecode(*this, "gfxdecode") + , m_screen(*this, "screen") + , m_palette(*this, "palette") + , m_generic_paletteram_8(*this, "paletteram") + , m_track_x(*this, "TRACKX") + , m_track_y(*this, "TRACKY") + , m_led(*this, "led%u", 0U) { } - // devices - required_device m_maincpu; - optional_device m_laserdisc; - optional_device m_r1_sound; - optional_device m_r2_sound; - optional_device m_knocker_sample; - - required_shared_ptr m_videoram; - required_shared_ptr m_charram; - required_shared_ptr m_spriteram; - - required_device m_gfxdecode; - required_device m_screen; - required_device m_palette; - required_shared_ptr m_generic_paletteram_8; - - optional_ioport m_track_x; - optional_ioport m_track_y; - - uint8_t m_knocker_prev; - uint8_t m_joystick_select; - uint8_t m_track[2]; - emu_timer *m_laserdisc_bit_timer; - emu_timer *m_laserdisc_philips_timer; - uint8_t m_laserdisc_select; - uint8_t m_laserdisc_status; - uint16_t m_laserdisc_philips_code; - std::unique_ptr m_laserdisc_audio_buffer; - uint16_t m_laserdisc_audio_address; - int16_t m_laserdisc_last_samples[2]; - attotime m_laserdisc_last_time; - attotime m_laserdisc_last_clock; - uint8_t m_laserdisc_zero_seen; - uint8_t m_laserdisc_audio_bits; - uint8_t m_laserdisc_audio_bit_count; - uint8_t m_gfxcharlo; - uint8_t m_gfxcharhi; - uint8_t m_background_priority; - uint8_t m_spritebank; - uint8_t m_transparent0; - tilemap_t *m_bg_tilemap; - double m_weights[4]; - void qbert_knocker(uint8_t knock); DECLARE_WRITE8_MEMBER(gottlieb_analog_reset_w); @@ -125,9 +83,6 @@ public: void init_qbertqub(); TILE_GET_INFO_MEMBER(get_bg_tile_info); TILE_GET_INFO_MEMBER(get_screwloo_bg_tile_info); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; DECLARE_VIDEO_START(screwloo); uint32_t screen_update_gottlieb(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(gottlieb_interrupt); @@ -155,5 +110,52 @@ public: void gottlieb_map(address_map &map); void reactor_map(address_map &map); protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + + // devices + required_device m_maincpu; + optional_device m_laserdisc; + optional_device m_r1_sound; + optional_device m_r2_sound; + optional_device m_knocker_sample; + + required_shared_ptr m_videoram; + required_shared_ptr m_charram; + required_shared_ptr m_spriteram; + + required_device m_gfxdecode; + required_device m_screen; + required_device m_palette; + required_shared_ptr m_generic_paletteram_8; + + optional_ioport m_track_x; + optional_ioport m_track_y; + output_finder<3> m_led; // only used by reactor + + uint8_t m_knocker_prev; + uint8_t m_joystick_select; + uint8_t m_track[2]; + emu_timer *m_laserdisc_bit_timer; + emu_timer *m_laserdisc_philips_timer; + uint8_t m_laserdisc_select; + uint8_t m_laserdisc_status; + uint16_t m_laserdisc_philips_code; + std::unique_ptr m_laserdisc_audio_buffer; + uint16_t m_laserdisc_audio_address; + int16_t m_laserdisc_last_samples[2]; + attotime m_laserdisc_last_time; + attotime m_laserdisc_last_clock; + uint8_t m_laserdisc_zero_seen; + uint8_t m_laserdisc_audio_bits; + uint8_t m_laserdisc_audio_bit_count; + uint8_t m_gfxcharlo; + uint8_t m_gfxcharhi; + uint8_t m_background_priority; + uint8_t m_spritebank; + uint8_t m_transparent0; + tilemap_t *m_bg_tilemap; + double m_weights[4]; }; diff --git a/src/mame/includes/harddriv.h b/src/mame/includes/harddriv.h index caaf899a893..6b21e733012 100644 --- a/src/mame/includes/harddriv.h +++ b/src/mame/includes/harddriv.h @@ -301,6 +301,7 @@ protected: optional_device m_screen; optional_device m_duartn68681; required_device m_adc8; + output_finder<3> m_lamp; uint8_t m_hd34010_host_access; diff --git a/src/mame/includes/irobot.h b/src/mame/includes/irobot.h index 37f5c3ea008..1514978db80 100644 --- a/src/mame/includes/irobot.h +++ b/src/mame/includes/irobot.h @@ -41,7 +41,8 @@ public: m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), m_palette(*this, "palette"), - m_pokey(*this, "pokey%u", 1U) + m_pokey(*this, "pokey%u", 1U), + m_led(*this, "led%u", 0U) { } void init_irobot(); @@ -49,6 +50,7 @@ public: void irobot(machine_config &config); protected: + virtual void machine_start() override { m_led.resolve(); } virtual void machine_reset() override; virtual void video_start() override; void irobot_map(address_map &map); @@ -117,6 +119,7 @@ private: required_device m_screen; required_device m_palette; required_device_array m_pokey; + output_finder<2> m_led; }; #endif // MAME_INCLUDES_IROBOT_H diff --git a/src/mame/includes/itech32.h b/src/mame/includes/itech32.h index 6ad5cadac4e..1f147141344 100644 --- a/src/mame/includes/itech32.h +++ b/src/mame/includes/itech32.h @@ -37,7 +37,9 @@ public: m_drivedge_zbuf_control(*this, "drivedge_zctl"), m_tms1_boot(*this, "tms1_boot"), m_tms1_ram(*this, "tms1_ram"), - m_tms2_ram(*this, "tms2_ram") { } + m_tms2_ram(*this, "tms2_ram"), + m_led(*this, "led%u", 0U) + { } required_device m_maincpu; @@ -56,6 +58,7 @@ public: optional_shared_ptr m_tms1_boot; optional_shared_ptr m_tms1_ram; optional_shared_ptr m_tms2_ram; + output_finder<4> m_led; void nvram_init(nvram_device &nvram, void *base, size_t length); diff --git a/src/mame/includes/jpmimpct.h b/src/mame/includes/jpmimpct.h index 3fc55f7dc44..6bde694bd20 100644 --- a/src/mame/includes/jpmimpct.h +++ b/src/mame/includes/jpmimpct.h @@ -76,7 +76,8 @@ public: , m_reel5(*this, "reel5") , m_meters(*this, "meters") , m_digits(*this, "digit%u", 0U) - { } + , m_lamp_output(*this, "lamp%u", 0U) + { } 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; } @@ -156,4 +157,5 @@ private: optional_device m_reel5; required_device m_meters; output_finder<300> m_digits; + output_finder<256> m_lamp_output; }; diff --git a/src/mame/includes/konamigx.h b/src/mame/includes/konamigx.h index 26bf9f7a790..3ef4a65f967 100644 --- a/src/mame/includes/konamigx.h +++ b/src/mame/includes/konamigx.h @@ -20,66 +20,40 @@ class konamigx_state : public driver_device { public: konamigx_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this,"maincpu"), - m_soundcpu(*this, "soundcpu"), - m_dasp(*this, "dasp"), - m_k053252(*this, "k053252"), - m_k055673(*this, "k055673"), - m_k055555(*this, "k055555"), - m_k056832(*this, "k056832"), - m_k054338(*this, "k054338"), - m_k056800(*this, "k056800"), - m_k054539_1(*this,"k054539_1"), - m_k054539_2(*this,"k054539_2"), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen"), - m_palette(*this, "palette"), - m_workram(*this,"workram"), - m_psacram(*this,"psacram"), - m_subpaletteram32(*this,"subpaletteram"), - m_k053936_0_ctrl(*this,"k053936_0_ctrl",32), - m_k053936_0_linectrl(*this,"k053936_0_line",32), - m_k053936_0_ctrl_16(*this,"k053936_0_ct16",16), - m_k053936_0_linectrl_16(*this,"k053936_0_li16",16), - m_konamigx_type3_psac2_bank(*this,"psac2_bank"), - m_generic_paletteram_32(*this, "paletteram"), - m_an0(*this, "AN0"), - m_an1(*this, "AN1"), - m_light0_x(*this, "LIGHT0_X"), - m_light0_y(*this, "LIGHT0_Y"), - m_light1_x(*this, "LIGHT1_X"), - m_light1_y(*this, "LIGHT1_Y"), - m_eepromout(*this, "EEPROMOUT"), - m_use_68020_post_clock_hack(0) - { } - - required_device m_maincpu; - optional_device m_soundcpu; - optional_device m_dasp; - required_device m_k053252; - required_device m_k055673; - required_device m_k055555; - required_device m_k056832; - optional_device m_k054338; - optional_device m_k056800; - optional_device m_k054539_1; - optional_device m_k054539_2; - optional_device m_gfxdecode; - required_device m_screen; - required_device m_palette; - - optional_shared_ptr m_workram; - optional_shared_ptr m_psacram; - optional_shared_ptr m_subpaletteram32; - optional_shared_ptr m_k053936_0_ctrl; - optional_shared_ptr m_k053936_0_linectrl; - optional_shared_ptr m_k053936_0_ctrl_16; - optional_shared_ptr m_k053936_0_linectrl_16; - optional_shared_ptr m_konamigx_type3_psac2_bank; - optional_shared_ptr m_generic_paletteram_32; - - optional_ioport m_an0, m_an1, m_light0_x, m_light0_y, m_light1_x, m_light1_y, m_eepromout; + : driver_device(mconfig, type, tag) + , m_maincpu(*this,"maincpu") + , m_soundcpu(*this, "soundcpu") + , m_dasp(*this, "dasp") + , m_k053252(*this, "k053252") + , m_k055673(*this, "k055673") + , m_k055555(*this, "k055555") + , m_k056832(*this, "k056832") + , m_k054338(*this, "k054338") + , m_k056800(*this, "k056800") + , m_k054539_1(*this, "k054539_1") + , m_k054539_2(*this, "k054539_2") + , m_gfxdecode(*this, "gfxdecode") + , m_screen(*this, "screen") + , m_palette(*this, "palette") + , m_workram(*this, "workram") + , m_psacram(*this, "psacram") + , m_subpaletteram32(*this, "subpaletteram") + , m_k053936_0_ctrl(*this, "k053936_0_ctrl", 32) + , m_k053936_0_linectrl(*this, "k053936_0_line", 32) + , m_k053936_0_ctrl_16(*this, "k053936_0_ct16", 16) + , m_k053936_0_linectrl_16(*this, "k053936_0_li16", 16) + , m_konamigx_type3_psac2_bank(*this, "psac2_bank") + , m_generic_paletteram_32(*this, "paletteram") + , m_an0(*this, "AN0") + , m_an1(*this, "AN1") + , m_light0_x(*this, "LIGHT0_X") + , m_light0_y(*this, "LIGHT0_Y") + , m_light1_x(*this, "LIGHT1_X") + , m_light1_y(*this, "LIGHT1_Y") + , m_eepromout(*this, "EEPROMOUT") + , m_use_68020_post_clock_hack(0) + , m_lamp(*this, "lamp0") + { } DECLARE_WRITE32_MEMBER(esc_w); DECLARE_WRITE32_MEMBER(eeprom_w); @@ -187,6 +161,59 @@ public: inline int K055555GX_decode_inpri(int c18); int K055555GX_decode_vmixcolor(int layer, int *color); + void init_posthack(); + void konamigx_6bpp(machine_config &config); + void gxtype4(machine_config &config); + void gxtype4_vsn(machine_config &config); + void racinfrc(machine_config &config); + void gxtype4sd2(machine_config &config); + void konamigx_bios(machine_config &config); + void gxtype3(machine_config &config); + void opengolf(machine_config &config); + void winspike(machine_config &config); + void le2(machine_config &config); + void konamigx(machine_config &config); + void dragoonj(machine_config &config); + void salmndr2(machine_config &config); + void tbyahhoo(machine_config &config); + void gokuparo(machine_config &config); + void sexyparo(machine_config &config); + void gx_base_memmap(address_map &map); + void gx_type1_map(address_map &map); + void gx_type2_map(address_map &map); + void gx_type3_map(address_map &map); + void gx_type4_map(address_map &map); + void gxsndmap(address_map &map); + void gxtmsmap(address_map &map); + +protected: + required_device m_maincpu; + optional_device m_soundcpu; + optional_device m_dasp; + required_device m_k053252; + required_device m_k055673; + required_device m_k055555; + required_device m_k056832; + optional_device m_k054338; + optional_device m_k056800; + optional_device m_k054539_1; + optional_device m_k054539_2; + optional_device m_gfxdecode; + required_device m_screen; + required_device m_palette; + + optional_shared_ptr m_workram; + optional_shared_ptr m_psacram; + optional_shared_ptr m_subpaletteram32; + optional_shared_ptr m_k053936_0_ctrl; + optional_shared_ptr m_k053936_0_linectrl; + optional_shared_ptr m_k053936_0_ctrl_16; + optional_shared_ptr m_k053936_0_linectrl_16; + optional_shared_ptr m_konamigx_type3_psac2_bank; + optional_shared_ptr m_generic_paletteram_32; + + optional_ioport m_an0, m_an1, m_light0_x, m_light0_y, m_light1_x, m_light1_y, m_eepromout; + uint8_t m_sound_ctrl; uint8_t m_sound_intck; uint32_t m_fantjour_dma[8]; @@ -259,32 +286,8 @@ public: int m_konamigx_type3_psac2_actual_bank; //int m_konamigx_type3_psac2_actual_last_bank = 0; - - void init_posthack(); int m_use_68020_post_clock_hack; - void konamigx_6bpp(machine_config &config); - void gxtype4(machine_config &config); - void gxtype4_vsn(machine_config &config); - void racinfrc(machine_config &config); - void gxtype4sd2(machine_config &config); - void konamigx_bios(machine_config &config); - void gxtype3(machine_config &config); - void opengolf(machine_config &config); - void winspike(machine_config &config); - void le2(machine_config &config); - void konamigx(machine_config &config); - void dragoonj(machine_config &config); - void salmndr2(machine_config &config); - void tbyahhoo(machine_config &config); - void gokuparo(machine_config &config); - void sexyparo(machine_config &config); - void gx_base_memmap(address_map &map); - void gx_type1_map(address_map &map); - void gx_type2_map(address_map &map); - void gx_type3_map(address_map &map); - void gx_type4_map(address_map &map); - void gxsndmap(address_map &map); - void gxtmsmap(address_map &map); + output_finder<> m_lamp; }; // Sprite Callbacks diff --git a/src/mame/includes/kopunch.h b/src/mame/includes/kopunch.h index 76cbcd84489..e3d4f8d39b7 100644 --- a/src/mame/includes/kopunch.h +++ b/src/mame/includes/kopunch.h @@ -10,27 +10,14 @@ class kopunch_state : public driver_device { public: kopunch_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_vram_fg(*this, "vram_fg"), - m_vram_bg(*this, "vram_bg") + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_gfxdecode(*this, "gfxdecode") + , m_vram_fg(*this, "vram_fg") + , m_vram_bg(*this, "vram_bg") + , m_lamp(*this, "lamp0") { } - /* devices */ - required_device m_maincpu; - required_device m_gfxdecode; - - /* memory pointers */ - required_shared_ptr m_vram_fg; - required_shared_ptr m_vram_bg; - - /* video-related */ - tilemap_t *m_bg_tilemap; - tilemap_t *m_fg_tilemap; - uint8_t m_gfxbank; - uint8_t m_scrollx; - DECLARE_READ8_MEMBER(sensors1_r); DECLARE_READ8_MEMBER(sensors2_r); DECLARE_WRITE8_MEMBER(lamp_w); @@ -50,9 +37,27 @@ public: DECLARE_PALETTE_INIT(kopunch); uint32_t screen_update_kopunch(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - virtual void machine_start() override; - virtual void video_start() override; void kopunch(machine_config &config); void kopunch_io_map(address_map &map); void kopunch_map(address_map &map); + +protected: + virtual void machine_start() override; + virtual void video_start() override; + + /* devices */ + required_device m_maincpu; + required_device m_gfxdecode; + + /* memory pointers */ + required_shared_ptr m_vram_fg; + required_shared_ptr m_vram_bg; + + output_finder<> m_lamp; + + /* video-related */ + tilemap_t *m_bg_tilemap; + tilemap_t *m_fg_tilemap; + uint8_t m_gfxbank; + uint8_t m_scrollx; }; diff --git a/src/mame/includes/lethalj.h b/src/mame/includes/lethalj.h index be98fb58805..32d840c7e32 100644 --- a/src/mame/includes/lethalj.h +++ b/src/mame/includes/lethalj.h @@ -23,8 +23,8 @@ public: TIMER_GEN_EXT1_INT }; - lethalj_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , + lethalj_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu"), m_screen(*this, "screen"), m_ticket(*this, "ticket"), @@ -32,27 +32,10 @@ public: m_light0_x(*this, "LIGHT0_X"), m_light0_y(*this, "LIGHT0_Y"), m_light1_x(*this, "LIGHT1_X"), - m_light1_y(*this, "LIGHT1_Y") + m_light1_y(*this, "LIGHT1_Y"), + m_lamp(*this, "lamp%u", 0U) { } - required_device m_maincpu; - required_device m_screen; - required_device m_ticket; - optional_ioport m_paddle; - optional_ioport m_light0_x; - optional_ioport m_light0_y; - optional_ioport m_light1_x; - optional_ioport m_light1_y; - - emu_timer *m_gen_ext1_int_timer; - uint16_t m_blitter_data[8]; - std::unique_ptr m_screenram; - uint8_t m_vispage; - uint16_t *m_blitter_base; - int m_blitter_rows; - uint16_t m_gunx; - uint16_t m_guny; - uint8_t m_blank_palette; DECLARE_WRITE16_MEMBER(ripribit_control_w); DECLARE_WRITE16_MEMBER(cfarm_control_w); DECLARE_WRITE16_MEMBER(cclownz_control_w); @@ -63,7 +46,6 @@ public: void init_cfarm(); void init_ripribit(); void init_cclownz(); - virtual void video_start() override; inline void get_crosshair_xy(int player, int *x, int *y); TMS340X0_SCANLINE_IND16_CB_MEMBER(scanline_update); @@ -71,7 +53,29 @@ public: void gameroom(machine_config &config); void lethalj_map(address_map &map); protected: + virtual void machine_start() override { m_lamp.resolve(); } virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + virtual void video_start() override; + + required_device m_maincpu; + required_device m_screen; + required_device m_ticket; + optional_ioport m_paddle; + optional_ioport m_light0_x; + optional_ioport m_light0_y; + optional_ioport m_light1_x; + optional_ioport m_light1_y; + output_finder<3> m_lamp; + + emu_timer *m_gen_ext1_int_timer; + uint16_t m_blitter_data[8]; + std::unique_ptr m_screenram; + uint8_t m_vispage; + uint16_t *m_blitter_base; + int m_blitter_rows; + uint16_t m_gunx; + uint16_t m_guny; + uint8_t m_blank_palette; }; #endif // MAME_INCLUDES_LETHALJ_H diff --git a/src/mame/includes/lockon.h b/src/mame/includes/lockon.h index a016410984e..f99585fa116 100644 --- a/src/mame/includes/lockon.h +++ b/src/mame/includes/lockon.h @@ -25,26 +25,28 @@ class lockon_state : public driver_device { public: lockon_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_char_ram(*this, "char_ram"), - m_hud_ram(*this, "hud_ram"), - m_scene_ram(*this, "scene_ram"), - m_ground_ram(*this, "ground_ram"), - m_object_ram(*this, "object_ram"), - m_maincpu(*this, "maincpu"), - m_audiocpu(*this, "audiocpu"), - m_ground(*this, "ground"), - m_object(*this, "object"), - m_watchdog(*this, "watchdog"), - m_f2203_1l(*this, "f2203.1l"), - m_f2203_2l(*this, "f2203.2l"), - m_f2203_3l(*this, "f2203.3l"), - m_f2203_1r(*this, "f2203.1r"), - m_f2203_2r(*this, "f2203.2r"), - m_f2203_3r(*this, "f2203.3r"), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen"), - m_palette(*this, "palette") { } + : driver_device(mconfig, type, tag) + , m_char_ram(*this, "char_ram") + , m_hud_ram(*this, "hud_ram") + , m_scene_ram(*this, "scene_ram") + , m_ground_ram(*this, "ground_ram") + , m_object_ram(*this, "object_ram") + , m_maincpu(*this, "maincpu") + , m_audiocpu(*this, "audiocpu") + , m_ground(*this, "ground") + , m_object(*this, "object") + , m_watchdog(*this, "watchdog") + , m_f2203_1l(*this, "f2203.1l") + , m_f2203_2l(*this, "f2203.2l") + , m_f2203_3l(*this, "f2203.3l") + , m_f2203_1r(*this, "f2203.1r") + , m_f2203_2r(*this, "f2203.2r") + , m_f2203_3r(*this, "f2203.3r") + , m_gfxdecode(*this, "gfxdecode") + , m_screen(*this, "screen") + , m_palette(*this, "palette") + , m_lamp(*this, "lamp%u", 0U) + { } void lockon(machine_config &config); @@ -106,6 +108,7 @@ private: required_device m_gfxdecode; required_device m_screen; required_device m_palette; + output_finder<2> m_lamp; DECLARE_READ16_MEMBER(lockon_crtc_r); DECLARE_WRITE16_MEMBER(lockon_crtc_w); diff --git a/src/mame/includes/lucky74.h b/src/mame/includes/lucky74.h index 478b1934be4..327acd90a94 100644 --- a/src/mame/includes/lucky74.h +++ b/src/mame/includes/lucky74.h @@ -5,30 +5,18 @@ class lucky74_state : public driver_device { public: - lucky74_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + lucky74_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_fg_videoram(*this, "fg_videoram"), m_fg_colorram(*this, "fg_colorram"), m_bg_videoram(*this, "bg_videoram"), m_bg_colorram(*this, "bg_colorram"), m_maincpu(*this, "maincpu"), m_msm(*this, "msm"), - m_gfxdecode(*this, "gfxdecode") { } + m_gfxdecode(*this, "gfxdecode"), + m_lamp(*this, "lamp%u", 0U) + { } - uint8_t m_ym2149_portb; - uint8_t m_usart_8251; - uint8_t m_copro_sm7831; - int m_adpcm_pos; - int m_adpcm_end; - int m_adpcm_data; - uint8_t m_adpcm_reg[6]; - uint8_t m_adpcm_busy_line; - required_shared_ptr m_fg_videoram; - required_shared_ptr m_fg_colorram; - required_shared_ptr m_bg_videoram; - required_shared_ptr m_bg_colorram; - tilemap_t *m_fg_tilemap; - tilemap_t *m_bg_tilemap; DECLARE_READ8_MEMBER(custom_09R81P_port_r); DECLARE_WRITE8_MEMBER(custom_09R81P_port_w); DECLARE_READ8_MEMBER(usart_8251_r); @@ -44,17 +32,36 @@ public: DECLARE_WRITE8_MEMBER(lamps_b_w); TILE_GET_INFO_MEMBER(get_fg_tile_info); TILE_GET_INFO_MEMBER(get_bg_tile_info); - virtual void video_start() override; - virtual void machine_reset() override; - virtual void sound_start() override; DECLARE_PALETTE_INIT(lucky74); uint32_t screen_update_lucky74(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(nmi_interrupt); DECLARE_WRITE_LINE_MEMBER(lucky74_adpcm_int); - required_device m_maincpu; - required_device m_msm; - required_device m_gfxdecode; void lucky74(machine_config &config); void lucky74_map(address_map &map); void lucky74_portmap(address_map &map); + +protected: + virtual void machine_start() override { m_lamp.resolve(); } + virtual void video_start() override; + virtual void machine_reset() override; + virtual void sound_start() override; + + uint8_t m_ym2149_portb; + uint8_t m_usart_8251; + uint8_t m_copro_sm7831; + int m_adpcm_pos; + int m_adpcm_end; + int m_adpcm_data; + uint8_t m_adpcm_reg[6]; + uint8_t m_adpcm_busy_line; + required_shared_ptr m_fg_videoram; + required_shared_ptr m_fg_colorram; + required_shared_ptr m_bg_videoram; + required_shared_ptr m_bg_colorram; + tilemap_t *m_fg_tilemap; + tilemap_t *m_bg_tilemap; + required_device m_maincpu; + required_device m_msm; + required_device m_gfxdecode; + output_finder<12> m_lamp; }; diff --git a/src/mame/includes/mainevt.h b/src/mame/includes/mainevt.h index 746379e6a09..ab3c7fec9e1 100644 --- a/src/mame/includes/mainevt.h +++ b/src/mame/includes/mainevt.h @@ -16,28 +16,16 @@ class mainevt_state : public driver_device { public: mainevt_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_audiocpu(*this, "audiocpu"), - m_upd7759(*this, "upd"), - m_k007232(*this, "k007232"), - m_k052109(*this, "k052109"), - m_k051960(*this, "k051960"), - m_rombank(*this, "rombank") { } - - /* misc */ - int m_nmi_enable; - uint8_t m_sound_irq_mask; - - /* devices */ - required_device m_maincpu; - required_device m_audiocpu; - optional_device m_upd7759; - required_device m_k007232; - required_device m_k052109; - required_device m_k051960; - - required_memory_bank m_rombank; + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_audiocpu(*this, "audiocpu") + , m_upd7759(*this, "upd") + , m_k007232(*this, "k007232") + , m_k052109(*this, "k052109") + , m_k051960(*this, "k051960") + , m_rombank(*this, "rombank") + , m_led(*this, "led%u", 0U) + { } DECLARE_WRITE8_MEMBER(dv_nmienable_w); DECLARE_WRITE8_MEMBER(mainevt_bankswitch_w); @@ -50,8 +38,6 @@ public: DECLARE_WRITE8_MEMBER(k052109_051960_w); DECLARE_READ8_MEMBER(mainevt_sh_busy_r); DECLARE_WRITE8_MEMBER(dv_sh_bankswitch_w); - virtual void machine_start() override; - virtual void machine_reset() override; uint32_t screen_update_mainevt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); uint32_t screen_update_dv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(mainevt_interrupt); @@ -69,4 +55,23 @@ public: void devstors_sound_map(address_map &map); void mainevt_map(address_map &map); void mainevt_sound_map(address_map &map); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + + /* misc */ + int m_nmi_enable; + uint8_t m_sound_irq_mask; + + /* devices */ + required_device m_maincpu; + required_device m_audiocpu; + optional_device m_upd7759; + required_device m_k007232; + required_device m_k052109; + required_device m_k051960; + + required_memory_bank m_rombank; + output_finder<4> m_led; }; diff --git a/src/mame/includes/mcr.h b/src/mame/includes/mcr.h index 260144a4c2f..6c4126c51b8 100644 --- a/src/mame/includes/mcr.h +++ b/src/mame/includes/mcr.h @@ -24,8 +24,8 @@ class mcr_state : public driver_device { public: - mcr_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + mcr_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_spriteram(*this, "spriteram"), m_videoram(*this, "videoram"), @@ -136,10 +136,12 @@ private: class mcr_dpoker_state : public mcr_state { public: - mcr_dpoker_state(const machine_config &mconfig, device_type type, const char *tag) - : mcr_state(mconfig, type, tag), + mcr_dpoker_state(const machine_config &mconfig, device_type type, const char *tag) : + mcr_state(mconfig, type, tag), m_coin_in_timer(*this, "coinin"), - m_hopper_timer(*this, "hopper") {} + m_hopper_timer(*this, "hopper"), + m_lamp(*this, "lamp%u", 0U) + { } DECLARE_READ8_MEMBER(ip0_r); DECLARE_WRITE8_MEMBER(lamps1_w); @@ -155,12 +157,17 @@ public: void init_dpoker(); void mcr_90009_dp(machine_config &config); + +protected: + virtual void machine_start() override { mcr_state::machine_start(); m_lamp.resolve(); } + private: uint8_t m_coin_status; uint8_t m_output; required_device m_coin_in_timer; required_device m_hopper_timer; + output_finder<14> m_lamp; }; class mcr_nflfoot_state : public mcr_state diff --git a/src/mame/includes/mcr3.h b/src/mame/includes/mcr3.h index e2084d51956..27da1c42072 100644 --- a/src/mame/includes/mcr3.h +++ b/src/mame/includes/mcr3.h @@ -14,11 +14,12 @@ class mcr3_state : public mcr_state { public: mcr3_state(const machine_config &mconfig, device_type type, const char *tag) - : mcr_state(mconfig, type, tag), - m_spyhunt_alpharam(*this, "spyhunt_alpha"), - m_maxrpm_adc(*this, "adc"), - m_lamplatch(*this, "lamplatch"), - m_screen(*this, "screen") + : mcr_state(mconfig, type, tag) + , m_spyhunt_alpharam(*this, "spyhunt_alpha") + , m_maxrpm_adc(*this, "adc") + , m_lamplatch(*this, "lamplatch") + , m_screen(*this, "screen") + , m_lamp(*this, "lamp%u", 0U) { } DECLARE_WRITE8_MEMBER(mcr3_videoram_w); @@ -72,6 +73,7 @@ public: void spyhunt_map(address_map &map); void spyhunt_portmap(address_map &map); protected: + virtual void machine_start() override { m_lamp.resolve(); } virtual void video_start() override; private: @@ -79,6 +81,7 @@ private: optional_device m_maxrpm_adc; optional_device m_lamplatch; required_device m_screen; + output_finder<3> m_lamp; uint8_t m_latched_input; uint8_t m_maxrpm_adc_control; diff --git a/src/mame/includes/mhavoc.h b/src/mame/includes/mhavoc.h index aeb386bb605..c579a2a58c6 100644 --- a/src/mame/includes/mhavoc.h +++ b/src/mame/includes/mhavoc.h @@ -22,29 +22,15 @@ class mhavoc_state : public driver_device { public: - mhavoc_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + mhavoc_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_zram0(*this, "zram0"), m_zram1(*this, "zram1"), m_alpha(*this, "alpha"), - m_gamma(*this, "gamma"){ } + m_gamma(*this, "gamma"), + m_lamp(*this, "lamp%u", 0U) + { } - required_shared_ptr m_zram0; - required_shared_ptr m_zram1; - required_device m_alpha; - optional_device m_gamma; - uint8_t m_alpha_data; - uint8_t m_alpha_rcvd; - uint8_t m_alpha_xmtd; - uint8_t m_gamma_data; - uint8_t m_gamma_rcvd; - uint8_t m_gamma_xmtd; - uint8_t m_player_1; - uint8_t m_alpha_irq_clock; - uint8_t m_alpha_irq_clock_enable; - uint8_t m_gamma_irq_clock; - uint8_t m_has_gamma_cpu; - uint8_t m_speech_write_buffer; DECLARE_READ8_MEMBER(dual_pokey_r); DECLARE_WRITE8_MEMBER(dual_pokey_w); DECLARE_WRITE8_MEMBER(mhavoc_alpha_irq_ack_w); @@ -70,8 +56,6 @@ public: DECLARE_CUSTOM_INPUT_MEMBER(alpha_xmtd_r); DECLARE_CUSTOM_INPUT_MEMBER(clock_r); void init_mhavocrv(); - virtual void machine_start() override; - virtual void machine_reset() override; TIMER_CALLBACK_MEMBER(delayed_gamma_w); TIMER_DEVICE_CALLBACK_MEMBER(mhavoc_cpu_irq_clock); void alphaone(machine_config &config); @@ -80,4 +64,26 @@ public: void alpha_map(address_map &map); void alphaone_map(address_map &map); void gamma_map(address_map &map); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + + required_shared_ptr m_zram0; + required_shared_ptr m_zram1; + required_device m_alpha; + optional_device m_gamma; + output_finder<2> m_lamp; + uint8_t m_alpha_data; + uint8_t m_alpha_rcvd; + uint8_t m_alpha_xmtd; + uint8_t m_gamma_data; + uint8_t m_gamma_rcvd; + uint8_t m_gamma_xmtd; + uint8_t m_player_1; + uint8_t m_alpha_irq_clock; + uint8_t m_alpha_irq_clock_enable; + uint8_t m_gamma_irq_clock; + uint8_t m_has_gamma_cpu; + uint8_t m_speech_write_buffer; }; diff --git a/src/mame/includes/microtan.h b/src/mame/includes/microtan.h index 69a220f6165..83818e913f8 100644 --- a/src/mame/includes/microtan.h +++ b/src/mame/includes/microtan.h @@ -30,32 +30,17 @@ public: TIMER_PULSE_NMI }; - microtan_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + microtan_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_videoram(*this, "videoram"), m_maincpu(*this, "maincpu"), m_cassette(*this, "cassette"), m_via6522_0(*this, "via6522_0"), m_via6522_1(*this, "via6522_1"), - m_gfxdecode(*this, "gfxdecode") + m_gfxdecode(*this, "gfxdecode"), + m_led(*this, "led%u", 0U) { } - required_shared_ptr m_videoram; - uint8_t m_chunky_graphics; - std::unique_ptr m_chunky_buffer; - uint8_t m_keypad_column; - uint8_t m_keyboard_ascii; - emu_timer *m_timer; - int m_via_0_irq_line; - int m_via_1_irq_line; - int m_kbd_irq_line; - uint8_t m_keyrows[10]; - int m_lastrow; - int m_mask; - int m_key; - int m_repeat; - int m_repeater; - tilemap_t *m_bg_tilemap; DECLARE_READ8_MEMBER(microtan_sound_r); DECLARE_WRITE8_MEMBER(microtan_sound_w); DECLARE_READ8_MEMBER(microtan_bffx_r); @@ -63,8 +48,6 @@ public: DECLARE_WRITE8_MEMBER(microtan_videoram_w); void init_microtan(); TILE_GET_INFO_MEMBER(get_bg_tile_info); - virtual void machine_reset() override; - virtual void video_start() override; uint32_t screen_update_microtan(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(microtan_interrupt); TIMER_CALLBACK_MEMBER(microtan_read_cassette); @@ -80,11 +63,6 @@ public: DECLARE_WRITE_LINE_MEMBER(via_1_out_cb2); DECLARE_WRITE_LINE_MEMBER(via_0_irq); DECLARE_WRITE_LINE_MEMBER(via_1_irq); - required_device m_maincpu; - required_device m_cassette; - required_device m_via6522_0; - required_device m_via6522_1; - required_device m_gfxdecode; uint8_t read_dsw(); void microtan_set_irq_line(); void store_key(int key); @@ -99,7 +77,33 @@ public: void microtan(machine_config &config); void microtan_map(address_map &map); protected: + virtual void machine_start() override { m_led.resolve(); } + virtual void machine_reset() override; + virtual void video_start() override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + + required_shared_ptr m_videoram; + uint8_t m_chunky_graphics; + std::unique_ptr m_chunky_buffer; + uint8_t m_keypad_column; + uint8_t m_keyboard_ascii; + emu_timer *m_timer; + int m_via_0_irq_line; + int m_via_1_irq_line; + int m_kbd_irq_line; + uint8_t m_keyrows[10]; + int m_lastrow; + int m_mask; + int m_key; + int m_repeat; + int m_repeater; + tilemap_t *m_bg_tilemap; + required_device m_maincpu; + required_device m_cassette; + required_device m_via6522_0; + required_device m_via6522_1; + required_device m_gfxdecode; + output_finder<2> m_led; }; #endif // MAME_INCLUDES_MICROTAN_H diff --git a/src/mame/includes/midzeus.h b/src/mame/includes/midzeus.h index d4a19a0fc9c..dfe022dc98e 100644 --- a/src/mame/includes/midzeus.h +++ b/src/mame/includes/midzeus.h @@ -49,8 +49,6 @@ public: DECLARE_WRITE32_MEMBER(disk_asic_w); DECLARE_READ32_MEMBER(disk_asic_jr_r); DECLARE_WRITE32_MEMBER(disk_asic_jr_w); - DECLARE_READ32_MEMBER(crusnexo_leds_r); - DECLARE_WRITE32_MEMBER(crusnexo_leds_w); DECLARE_READ32_MEMBER(firewire_r); DECLARE_WRITE32_MEMBER(firewire_w); DECLARE_READ32_MEMBER(tms32031_control_r); @@ -68,8 +66,6 @@ public: DECLARE_READ32_MEMBER(trackball_r); void init_invasn(); void init_mk4(); - void init_thegrid(); - void init_crusnexo(); DECLARE_MACHINE_START(midzeus); DECLARE_MACHINE_RESET(midzeus); DECLARE_VIDEO_START(midzeus); diff --git a/src/mame/includes/msx.h b/src/mame/includes/msx.h index f3ab7d3b635..bc846957773 100644 --- a/src/mame/includes/msx.h +++ b/src/mame/includes/msx.h @@ -131,6 +131,7 @@ public: , m_io_mouse0(*this, "MOUSE0") , m_io_mouse1(*this, "MOUSE1") , m_io_key(*this, {"KEY0", "KEY1", "KEY2", "KEY3", "KEY4", "KEY5"}) + , m_led(*this, "led%u", 0U) , m_psg_b(0) , m_rtc_latch(0) , m_kanji_latch(0) @@ -497,6 +498,7 @@ private: required_ioport m_io_mouse0; required_ioport m_io_mouse1; required_ioport_array<6> m_io_key; + output_finder<3> m_led; /* PSG */ int m_psg_b; diff --git a/src/mame/includes/multfish.h b/src/mame/includes/multfish.h index 8c23221d004..6f28bc5b0fd 100644 --- a/src/mame/includes/multfish.h +++ b/src/mame/includes/multfish.h @@ -16,31 +16,17 @@ class igrosoft_gamble_state : public driver_device { public: - igrosoft_gamble_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + igrosoft_gamble_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_m48t35(*this, "m48t35" ), m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), m_palette(*this, "palette"), - m_hopper(*this, "hopper") - { - } + m_hopper(*this, "hopper"), + m_lamp(*this, "lamp%u", 0U) + { } - /* Video related */ - - int m_disp_enable; - int m_xor_paltype; - int m_xor_palette; - - tilemap_t *m_tilemap; - tilemap_t *m_reel_tilemap; - - /* Misc related */ - - uint8_t m_rambk; - - uint8_t m_vid[igrosoft_gamble_VIDRAM_SIZE]; DECLARE_WRITE8_MEMBER(igrosoft_gamble_vid_w); DECLARE_WRITE8_MEMBER(igrosoft_gamble_bank_w); DECLARE_READ8_MEMBER(bankedram_r); @@ -81,21 +67,39 @@ public: void init_crzmon2ent(); TILE_GET_INFO_MEMBER(get_igrosoft_gamble_tile_info); TILE_GET_INFO_MEMBER(get_igrosoft_gamble_reel_tile_info); + uint32_t screen_update_igrosoft_gamble(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void rollfr(machine_config &config); + void igrosoft_gamble(machine_config &config); + void igrosoft_gamble_map(address_map &map); + void igrosoft_gamble_portmap(address_map &map); + void rollfr_portmap(address_map &map); + +protected: virtual void machine_start() override; virtual void machine_reset() override; virtual void video_start() override; - uint32_t screen_update_igrosoft_gamble(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + /* Video related */ + + int m_disp_enable; + int m_xor_paltype; + int m_xor_palette; + + tilemap_t *m_tilemap; + tilemap_t *m_reel_tilemap; + + /* Misc related */ + + uint8_t m_rambk; + + uint8_t m_vid[igrosoft_gamble_VIDRAM_SIZE]; required_device m_maincpu; required_device m_m48t35; required_device m_gfxdecode; required_device m_screen; required_device m_palette; required_device m_hopper; - void rollfr(machine_config &config); - void igrosoft_gamble(machine_config &config); - void igrosoft_gamble_map(address_map &map); - void igrosoft_gamble_portmap(address_map &map); - void rollfr_portmap(address_map &map); + output_finder<13> m_lamp; }; diff --git a/src/mame/includes/namcos22.h b/src/mame/includes/namcos22.h index d8a312c2d29..425867a770a 100644 --- a/src/mame/includes/namcos22.h +++ b/src/mame/includes/namcos22.h @@ -174,129 +174,54 @@ class namcos22_state : public driver_device { public: namcos22_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_master(*this, "master"), - m_slave(*this, "slave"), - m_mcu(*this, "mcu"), - m_iomcu(*this, "iomcu"), - m_spriteram(*this, "spriteram"), - m_shareram(*this, "shareram"), - m_eeprom(*this, "eeprom"), - m_pSlaveExternalRAM(*this, "slaveextram"), - m_pMasterExternalRAM(*this, "masterextram"), - m_paletteram(*this, "paletteram"), - m_cgram(*this, "cgram"), - m_textram(*this, "textram"), - m_polygonram(*this, "polygonram"), - m_mixer(*this, "video_mixer"), - m_gamma_proms(*this, "gamma_proms"), - m_vics_data(*this, "vics_data"), - m_vics_control(*this, "vics_control"), - m_czattr(*this, "czattr"), - m_tilemapattr(*this, "tilemapattr"), - m_czram(*this, "czram"), - m_motor_timer(*this, "motor_timer"), - m_pc_pedal_interrupt(*this, "pc_p_int"), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen"), - m_palette(*this, "palette"), - m_adc_ports(*this, "ADC.%u", 0), - m_p1(*this, "P1"), - m_p2(*this, "P2"), - m_mcup5a(*this, "MCUP5A"), - m_mcup5b(*this, "MCUP5B") + : driver_device(mconfig, type, tag) + , m_spriteram(*this, "spriteram") + , m_czattr(*this, "czattr") + , m_czram(*this, "czram") + , m_gfxdecode(*this, "gfxdecode") + , m_palette(*this, "palette") + , m_maincpu(*this, "maincpu") + , m_master(*this, "master") + , m_slave(*this, "slave") + , m_mcu(*this, "mcu") + , m_iomcu(*this, "iomcu") + , m_shareram(*this, "shareram") + , m_eeprom(*this, "eeprom") + , m_pSlaveExternalRAM(*this, "slaveextram") + , m_pMasterExternalRAM(*this, "masterextram") + , m_paletteram(*this, "paletteram") + , m_cgram(*this, "cgram") + , m_textram(*this, "textram") + , m_polygonram(*this, "polygonram") + , m_mixer(*this, "video_mixer") + , m_gamma_proms(*this, "gamma_proms") + , m_vics_data(*this, "vics_data") + , m_vics_control(*this, "vics_control") + , m_tilemapattr(*this, "tilemapattr") + , m_motor_timer(*this, "motor_timer") + , m_pc_pedal_interrupt(*this, "pc_p_int") + , m_screen(*this, "screen") + , m_adc_ports(*this, "ADC.%u", 0) + , m_p1(*this, "P1") + , m_p2(*this, "P2") + , m_mcup5a(*this, "MCUP5A") + , m_mcup5b(*this, "MCUP5B") + , m_led(*this, "led") + , m_cpuled(*this, "cpuled%u", 0U) { } - required_device m_maincpu; - required_device m_master; - required_device m_slave; - required_device m_mcu; - optional_device m_iomcu; optional_shared_ptr m_spriteram; - required_shared_ptr m_shareram; - required_device m_eeprom; - required_shared_ptr m_pSlaveExternalRAM; - required_shared_ptr m_pMasterExternalRAM; - required_shared_ptr m_paletteram; - required_shared_ptr m_cgram; - required_shared_ptr m_textram; - required_shared_ptr m_polygonram; - required_shared_ptr m_mixer; - optional_region_ptr m_gamma_proms; - optional_shared_ptr m_vics_data; - optional_shared_ptr m_vics_control; optional_shared_ptr m_czattr; - required_shared_ptr m_tilemapattr; optional_shared_ptr m_czram; - optional_device m_motor_timer; - optional_device m_pc_pedal_interrupt; required_device m_gfxdecode; - required_device m_screen; required_device m_palette; - optional_ioport_array<8> m_adc_ports; - optional_ioport m_p1; - optional_ioport m_p2; - optional_ioport m_mcup5a; - optional_ioport m_mcup5b; - - uint8_t m_syscontrol[0x20]; - bool m_dsp_irq_enabled; - emu_timer *m_ar_tb_interrupt[2]; - uint16_t m_dsp_master_bioz; - std::unique_ptr m_pointram; - uint32_t m_old_coin_state; - uint32_t m_credits1; - uint32_t m_credits2; - uint32_t m_point_address; - uint32_t m_point_data; - uint16_t m_SerialDataSlaveToMasterNext; - uint16_t m_SerialDataSlaveToMasterCurrent; - int m_RenderBufSize; - uint16_t m_RenderBufData[NAMCOS22_MAX_RENDER_CMD_SEQ]; - uint16_t m_portbits[2]; - int m_irq_state; - namcos22_dsp_upload_state m_dsp_upload_state; - int m_UploadDestIdx; - uint32_t m_alpinesa_protection; - int m_motor_status; - int m_p4; - uint16_t m_su_82; - uint16_t m_keycus_id; - uint16_t m_keycus_rng; - int m_gametype; - int m_is_ss22; - int m_chipselect; - int m_spot_enable; - int m_spot_read_address; - int m_spot_write_address; - std::unique_ptr m_spotram; - std::unique_ptr m_banked_czram[4]; - std::unique_ptr m_recalc_czram[4]; - uint32_t m_cz_was_written[4]; - int m_cz_adjust; - namcos22_renderer *m_poly; + int m_poly_translucency; uint16_t *m_texture_tilemap; std::unique_ptr m_texture_tileattr; uint8_t *m_texture_tiledata; std::unique_ptr m_texture_ayx_to_pixel; - uint16_t m_dspram_bank; - uint16_t m_dspram16_latch; - bool m_slave_simulation_active; - int32_t m_absolute_priority; - int32_t m_objectshift; - uint16_t m_PrimitiveID; - float m_viewmatrix[4][4]; - uint8_t m_LitSurfaceInfo[NAMCOS22_MAX_LIT_SURFACES]; - int32_t m_SurfaceNormalFormat; - unsigned m_LitSurfaceCount; - unsigned m_LitSurfaceIndex; - int m_pointrom_size; - int32_t *m_pointrom; - std::unique_ptr m_dirtypal; - std::unique_ptr m_mix_bitmap; - tilemap_t *m_bgtilemap; - + std::unique_ptr m_recalc_czram[4]; + int m_is_ss22; int m_mixer_flags; int m_fog_r; int m_fog_g; @@ -305,28 +230,14 @@ public: int m_fog_g_per_cztype[4]; int m_fog_b_per_cztype[4]; uint32_t m_fog_colormask; - int m_poly_fade_r; - int m_poly_fade_g; - int m_poly_fade_b; - int m_poly_fade_enabled; int m_screen_fade_r; int m_screen_fade_g; int m_screen_fade_b; int m_screen_fade_factor; - int m_spot_limit; - int m_poly_translucency; - int m_text_palbase; - - float m_camera_zoom; - float m_camera_vx; - float m_camera_vy; - float m_camera_vw; - float m_camera_vh; - float m_camera_lx; // unit vector for light direction - float m_camera_ly; // " - float m_camera_lz; // " - int m_camera_ambient; // 0.0..1.0 - int m_camera_power; // 0.0..1.0 + int m_poly_fade_r; + int m_poly_fade_g; + int m_poly_fade_b; + int m_poly_fade_enabled; DECLARE_WRITE32_MEMBER(namcos22s_czram_w); DECLARE_READ32_MEMBER(namcos22s_czram_r); @@ -486,9 +397,6 @@ public: void init_alpinesa(); TILE_GET_INFO_MEMBER(get_text_tile_info); - virtual void machine_reset() override; - virtual void machine_start() override; - virtual void video_start() override; DECLARE_MACHINE_START(adillor); uint32_t screen_update_namcos22s(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); uint32_t screen_update_namcos22(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); @@ -532,4 +440,103 @@ public: void slave_dsp_io(address_map &map); void slave_dsp_program(address_map &map); void timecris_am(address_map &map); + +protected: + virtual void machine_reset() override; + virtual void machine_start() override; + virtual void video_start() override; + + required_device m_maincpu; + required_device m_master; + required_device m_slave; + required_device m_mcu; + optional_device m_iomcu; + required_shared_ptr m_shareram; + required_device m_eeprom; + required_shared_ptr m_pSlaveExternalRAM; + required_shared_ptr m_pMasterExternalRAM; + required_shared_ptr m_paletteram; + required_shared_ptr m_cgram; + required_shared_ptr m_textram; + required_shared_ptr m_polygonram; + required_shared_ptr m_mixer; + optional_region_ptr m_gamma_proms; + optional_shared_ptr m_vics_data; + optional_shared_ptr m_vics_control; + required_shared_ptr m_tilemapattr; + optional_device m_motor_timer; + optional_device m_pc_pedal_interrupt; + required_device m_screen; + optional_ioport_array<8> m_adc_ports; + optional_ioport m_p1; + optional_ioport m_p2; + optional_ioport m_mcup5a; + optional_ioport m_mcup5b; + output_finder<> m_led; + output_finder<8> m_cpuled; + + uint8_t m_syscontrol[0x20]; + bool m_dsp_irq_enabled; + emu_timer *m_ar_tb_interrupt[2]; + uint16_t m_dsp_master_bioz; + std::unique_ptr m_pointram; + uint32_t m_old_coin_state; + uint32_t m_credits1; + uint32_t m_credits2; + uint32_t m_point_address; + uint32_t m_point_data; + uint16_t m_SerialDataSlaveToMasterNext; + uint16_t m_SerialDataSlaveToMasterCurrent; + int m_RenderBufSize; + uint16_t m_RenderBufData[NAMCOS22_MAX_RENDER_CMD_SEQ]; + uint16_t m_portbits[2]; + int m_irq_state; + namcos22_dsp_upload_state m_dsp_upload_state; + int m_UploadDestIdx; + uint32_t m_alpinesa_protection; + int m_motor_status; + int m_p4; + uint16_t m_su_82; + uint16_t m_keycus_id; + uint16_t m_keycus_rng; + int m_gametype; + int m_chipselect; + int m_spot_enable; + int m_spot_read_address; + int m_spot_write_address; + std::unique_ptr m_spotram; + std::unique_ptr m_banked_czram[4]; + uint32_t m_cz_was_written[4]; + int m_cz_adjust; + namcos22_renderer *m_poly; + uint16_t m_dspram_bank; + uint16_t m_dspram16_latch; + bool m_slave_simulation_active; + int32_t m_absolute_priority; + int32_t m_objectshift; + uint16_t m_PrimitiveID; + float m_viewmatrix[4][4]; + uint8_t m_LitSurfaceInfo[NAMCOS22_MAX_LIT_SURFACES]; + int32_t m_SurfaceNormalFormat; + unsigned m_LitSurfaceCount; + unsigned m_LitSurfaceIndex; + int m_pointrom_size; + int32_t *m_pointrom; + std::unique_ptr m_dirtypal; + std::unique_ptr m_mix_bitmap; + tilemap_t *m_bgtilemap; + + int m_spot_limit; + int m_text_palbase; + + float m_camera_zoom; + float m_camera_vx; + float m_camera_vy; + float m_camera_vw; + float m_camera_vh; + float m_camera_lx; // unit vector for light direction + float m_camera_ly; // " + float m_camera_lz; // " + int m_camera_ambient; // 0.0..1.0 + int m_camera_power; // 0.0..1.0 }; diff --git a/src/mame/includes/namcos86.h b/src/mame/includes/namcos86.h index 21703cdbe82..42b04197f79 100644 --- a/src/mame/includes/namcos86.h +++ b/src/mame/includes/namcos86.h @@ -18,29 +18,8 @@ public: , m_rthunder_videoram2(*this, "videoram2") , m_rthunder_spriteram(*this, "spriteram") , m_user1_ptr(*this, "user1") - { - } - - required_device m_cpu1; - required_device m_cpu2; - required_device m_watchdog; - required_device m_cus30; - required_device m_gfxdecode; - required_device m_palette; - required_shared_ptr m_rthunder_videoram1; - required_shared_ptr m_rthunder_videoram2; - required_shared_ptr m_rthunder_spriteram; - optional_region_ptr m_user1_ptr; - - uint8_t *m_spriteram; - int m_wdog; - int m_tilebank; - int m_xscroll[4]; - int m_yscroll[4]; - tilemap_t *m_bg_tilemap[4]; - int m_backcolor; - const uint8_t *m_tile_address_prom; - int m_copy_sprites; + , m_led(*this, "led%u", 0U) + { } DECLARE_WRITE8_MEMBER(bankswitch1_w); DECLARE_WRITE8_MEMBER(bankswitch1_ext_w); @@ -71,8 +50,6 @@ public: TILE_GET_INFO_MEMBER(get_tile_info3); void init_namco86(); - virtual void machine_start() override; - virtual void video_start() override; DECLARE_PALETTE_INIT(namcos86); uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); @@ -98,6 +75,33 @@ public: void rthunder_mcu_map(address_map &map); void wndrmomo_cpu2_map(address_map &map); void wndrmomo_mcu_map(address_map &map); + +protected: + virtual void machine_start() override; + virtual void video_start() override; + + required_device m_cpu1; + required_device m_cpu2; + required_device m_watchdog; + required_device m_cus30; + required_device m_gfxdecode; + required_device m_palette; + required_shared_ptr m_rthunder_videoram1; + required_shared_ptr m_rthunder_videoram2; + required_shared_ptr m_rthunder_spriteram; + optional_region_ptr m_user1_ptr; + output_finder<2> m_led; + + uint8_t *m_spriteram; + int m_wdog; + int m_tilebank; + int m_xscroll[4]; + int m_yscroll[4]; + tilemap_t *m_bg_tilemap[4]; + int m_backcolor; + const uint8_t *m_tile_address_prom; + int m_copy_sprites; + private: inline void get_tile_info(tile_data &tileinfo,int tile_index,int layer,uint8_t *vram); void set_scroll(int layer); diff --git a/src/mame/includes/nitedrvr.h b/src/mame/includes/nitedrvr.h index e4151e6dc94..6b6a7112fc7 100644 --- a/src/mame/includes/nitedrvr.h +++ b/src/mame/includes/nitedrvr.h @@ -32,7 +32,8 @@ public: m_maincpu(*this, "maincpu"), m_discrete(*this, "discrete"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") + m_palette(*this, "palette"), + m_led(*this, "led") { } void nitedrvr(machine_config &config); @@ -80,6 +81,7 @@ private: required_device m_discrete; required_device m_gfxdecode; required_device m_palette; + output_finder<> m_led; }; /*----------- defined in audio/nitedrvr.c -----------*/ diff --git a/src/mame/includes/norautp.h b/src/mame/includes/norautp.h index e0c40389045..672d1f73133 100644 --- a/src/mame/includes/norautp.h +++ b/src/mame/includes/norautp.h @@ -18,16 +18,17 @@ class norautp_state : public driver_device { public: - norautp_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , + norautp_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_ppi8255(*this, "ppi8255_%u", 0), m_discrete(*this, "discrete"), m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_lamp(*this, "lamp%u", 0U) + { } - std::unique_ptr m_np_vram; DECLARE_WRITE_LINE_MEMBER(ppi2_obf_w); TIMER_CALLBACK_MEMBER(ppi2_ack); DECLARE_READ8_MEMBER(test2_r); @@ -37,15 +38,8 @@ public: void init_ssa(); void init_enc(); void init_deb(); - virtual void video_start() override; DECLARE_PALETTE_INIT(norautp); uint32_t screen_update_norautp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device m_maincpu; - required_device_array m_ppi8255; - required_device m_discrete; - required_device m_gfxdecode; - required_device m_screen; - required_device m_palette; void noraut_base(machine_config &config); void kimble(machine_config &config); void kimbldhl(machine_config &config); @@ -75,6 +69,19 @@ public: void norautxp_portmap(address_map &map); void nortest1_map(address_map &map); void ssjkrpkr_map(address_map &map); + +protected: + virtual void machine_start() override { m_lamp.resolve(); } + virtual void video_start() override; + + std::unique_ptr m_np_vram; + required_device m_maincpu; + required_device_array m_ppi8255; + required_device m_discrete; + required_device m_gfxdecode; + required_device m_screen; + required_device m_palette; + output_finder<12> m_lamp; }; /*----------- defined in audio/norautp.c -----------*/ diff --git a/src/mame/includes/overdriv.h b/src/mame/includes/overdriv.h index de6a1f2ba0f..7d7c6e8da10 100644 --- a/src/mame/includes/overdriv.h +++ b/src/mame/includes/overdriv.h @@ -18,37 +18,19 @@ class overdriv_state : public driver_device { public: overdriv_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_subcpu(*this, "sub"), - m_audiocpu(*this, "audiocpu"), - m_k051316_1(*this, "k051316_1"), - m_k051316_2(*this, "k051316_2"), - m_k053246(*this, "k053246"), - m_k053251(*this, "k053251"), - m_k053252(*this, "k053252"), - m_screen(*this, "screen") + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_subcpu(*this, "sub") + , m_audiocpu(*this, "audiocpu") + , m_k051316_1(*this, "k051316_1") + , m_k051316_2(*this, "k051316_2") + , m_k053246(*this, "k053246") + , m_k053251(*this, "k053251") + , m_k053252(*this, "k053252") + , m_screen(*this, "screen") + , m_led(*this, "led0") { } - /* video-related */ - int m_zoom_colorbase[2]; - int m_road_colorbase[2]; - int m_sprite_colorbase; - emu_timer *m_objdma_end_timer; - - /* misc */ - uint16_t m_cpuB_ctrl; - - /* devices */ - required_device m_maincpu; - required_device m_subcpu; - required_device m_audiocpu; - required_device m_k051316_1; - required_device m_k051316_2; - required_device m_k053246; - required_device m_k053251; - required_device m_k053252; - required_device m_screen; DECLARE_WRITE16_MEMBER(eeprom_w); DECLARE_WRITE16_MEMBER(cpuA_ctrl_w); DECLARE_READ16_MEMBER(cpuB_ctrl_r); @@ -60,12 +42,9 @@ public: DECLARE_WRITE16_MEMBER(objdma_w); TIMER_CALLBACK_MEMBER(objdma_end_cb); - virtual void machine_start() override; - virtual void machine_reset() override; uint32_t screen_update_overdriv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); //INTERRUPT_GEN_MEMBER(cpuB_interrupt); TIMER_DEVICE_CALLBACK_MEMBER(overdriv_cpuA_scanline); - int m_fake_timer; K051316_CB_MEMBER(zoom_callback_1); K051316_CB_MEMBER(zoom_callback_2); @@ -75,4 +54,30 @@ public: void overdriv_master_map(address_map &map); void overdriv_slave_map(address_map &map); void overdriv_sound_map(address_map &map); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + + /* video-related */ + int m_zoom_colorbase[2]; + int m_road_colorbase[2]; + int m_sprite_colorbase; + emu_timer *m_objdma_end_timer; + + /* misc */ + uint16_t m_cpuB_ctrl; + + /* devices */ + required_device m_maincpu; + required_device m_subcpu; + required_device m_audiocpu; + required_device m_k051316_1; + required_device m_k051316_2; + required_device m_k053246; + required_device m_k053251; + required_device m_k053252; + required_device m_screen; + output_finder<> m_led; + int m_fake_timer; }; diff --git a/src/mame/includes/pmd85.h b/src/mame/includes/pmd85.h index cbc4c75651e..8d72c8df857 100644 --- a/src/mame/includes/pmd85.h +++ b/src/mame/includes/pmd85.h @@ -24,8 +24,8 @@ public: TIMER_CASSETTE }; - pmd85_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + pmd85_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_ram(*this, RAM_TAG), m_cassette(*this, "cassette"), @@ -53,7 +53,9 @@ public: m_bank15(*this, "bank15"), m_bank16(*this, "bank16"), m_io_dsw0(*this, "DSW0"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_led(*this, "led%u", 0U) + { } uint8_t m_rom_module_present; uint8_t m_ppi_port_outputs[4][3]; @@ -124,6 +126,8 @@ public: void pmd85_io_map(address_map &map); void pmd85_mem(address_map &map); protected: + virtual void machine_start() override { m_led.resolve(); } + required_device m_maincpu; required_device m_ram; required_device m_cassette; @@ -153,6 +157,7 @@ protected: optional_ioport m_io_dsw0; ioport_port *m_io_port[16]; required_device m_palette; + output_finder<3> m_led; void pmd851_update_memory(); void pmd852a_update_memory(); diff --git a/src/mame/includes/polyplay.h b/src/mame/includes/polyplay.h index 1f217a50cf3..70c6bd37cac 100644 --- a/src/mame/includes/polyplay.h +++ b/src/mame/includes/polyplay.h @@ -19,8 +19,8 @@ class polyplay_state : public driver_device { public: - polyplay_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + polyplay_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_videoram(*this, "videoram"), m_characterram(*this, "characterram"), m_maincpu(*this, Z80CPU_TAG), @@ -31,18 +31,9 @@ public: m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), m_speaker1(*this, "speaker1"), - m_speaker2(*this, "speaker2") { } - - required_shared_ptr m_videoram; - required_shared_ptr m_characterram; - - required_device m_maincpu; - required_device m_z80ctc; - required_device m_z80pio; - optional_device m_z80sio; - required_ioport m_in0_port; - required_device m_gfxdecode; - required_device m_palette; + m_speaker2(*this, "speaker2"), + m_lamp(*this, "lamp%u", 0U) + { } INTERRUPT_GEN_MEMBER(nmi_handler); @@ -58,14 +49,6 @@ public: DECLARE_INPUT_CHANGED_MEMBER(input_changed); - /* audio */ - uint8_t m_flipflop1; - uint8_t m_flipflop2; - required_device m_speaker1; - required_device m_speaker2; - - /* video */ - virtual void video_start() override; DECLARE_WRITE8_MEMBER(polyplay_characterram_w); DECLARE_PALETTE_INIT(polyplay); uint32_t screen_update_polyplay(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); @@ -75,6 +58,28 @@ public: void polyplay_io_zrepp(address_map &map); void polyplay_mem_zre(address_map &map); void polyplay_mem_zrepp(address_map &map); + +protected: + virtual void machine_start() override { m_lamp.resolve(); } + virtual void video_start() override; + + required_shared_ptr m_videoram; + required_shared_ptr m_characterram; + + required_device m_maincpu; + required_device m_z80ctc; + required_device m_z80pio; + optional_device m_z80sio; + required_ioport m_in0_port; + required_device m_gfxdecode; + required_device m_palette; + + /* audio */ + uint8_t m_flipflop1; + uint8_t m_flipflop2; + required_device m_speaker1; + required_device m_speaker2; + output_finder<5> m_lamp; }; #endif // MAME_INCLUDES_POLYPLAY_H diff --git a/src/mame/includes/poolshrk.h b/src/mame/includes/poolshrk.h index bc2029c8d31..5bef83a8f04 100644 --- a/src/mame/includes/poolshrk.h +++ b/src/mame/includes/poolshrk.h @@ -27,7 +27,8 @@ public: m_discrete(*this, "discrete"), m_playfield_ram(*this, "playfield_ram"), m_hpos_ram(*this, "hpos_ram"), - m_vpos_ram(*this, "vpos_ram") + m_vpos_ram(*this, "vpos_ram"), + m_led(*this, "led%u", 0U) { } void init_poolshrk(); @@ -51,6 +52,7 @@ protected: uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); virtual void video_start() override; void poolshrk_cpu_map(address_map &map); + virtual void machine_start() override { m_led.resolve(); } private: required_device m_maincpu; @@ -62,6 +64,7 @@ private: required_shared_ptr m_playfield_ram; required_shared_ptr m_hpos_ram; required_shared_ptr m_vpos_ram; + output_finder<2> m_led; tilemap_t* m_bg_tilemap; int m_da_latch; diff --git a/src/mame/includes/portrait.h b/src/mame/includes/portrait.h index 1212ea0546e..76556dde845 100644 --- a/src/mame/includes/portrait.h +++ b/src/mame/includes/portrait.h @@ -6,27 +6,16 @@ class portrait_state : public driver_device { public: portrait_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_tms(*this, "tms"), - m_bgvideoram(*this, "bgvideoram"), - m_fgvideoram(*this, "fgvideoram"), - m_spriteram(*this, "spriteram") { } - - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_palette; - required_device m_tms; - - required_shared_ptr m_bgvideoram; - required_shared_ptr m_fgvideoram; - required_shared_ptr m_spriteram; - - int m_scroll; - tilemap_t *m_foreground; - tilemap_t *m_background; + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_gfxdecode(*this, "gfxdecode") + , m_palette(*this, "palette") + , m_tms(*this, "tms") + , m_bgvideoram(*this, "bgvideoram") + , m_fgvideoram(*this, "fgvideoram") + , m_spriteram(*this, "spriteram") + , m_lamp(*this, "lamp%u", 0U) + { } DECLARE_WRITE8_MEMBER(ctrl_w); DECLARE_WRITE8_MEMBER(positive_scroll_w); @@ -37,7 +26,6 @@ public: TILE_GET_INFO_MEMBER(get_bg_tile_info); TILE_GET_INFO_MEMBER(get_fg_tile_info); - virtual void video_start() override; DECLARE_PALETTE_INIT(portrait); uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); @@ -46,4 +34,22 @@ public: void portrait(machine_config &config); void portrait_map(address_map &map); void portrait_sound_map(address_map &map); + +protected: + virtual void machine_start() override { m_lamp.resolve(); } + virtual void video_start() override; + + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_palette; + required_device m_tms; + + required_shared_ptr m_bgvideoram; + required_shared_ptr m_fgvideoram; + required_shared_ptr m_spriteram; + output_finder<2> m_lamp; + + int m_scroll; + tilemap_t *m_foreground; + tilemap_t *m_background; }; diff --git a/src/mame/includes/runaway.h b/src/mame/includes/runaway.h index 87a33b920f1..2535986af53 100644 --- a/src/mame/includes/runaway.h +++ b/src/mame/includes/runaway.h @@ -6,19 +6,16 @@ class runaway_state : public driver_device { public: runaway_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_video_ram(*this, "video_ram"), - m_sprite_ram(*this, "sprite_ram"), - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen"), - m_palette(*this, "palette") { } + : driver_device(mconfig, type, tag) + , m_video_ram(*this, "video_ram") + , m_sprite_ram(*this, "sprite_ram") + , m_maincpu(*this, "maincpu") + , m_gfxdecode(*this, "gfxdecode") + , m_screen(*this, "screen") + , m_palette(*this, "palette") + , m_led(*this, "led%u", 0U) + { } - emu_timer *m_interrupt_timer; - required_shared_ptr m_video_ram; - required_shared_ptr m_sprite_ram; - tilemap_t *m_bg_tilemap; - int m_tile_bank; DECLARE_READ8_MEMBER(runaway_input_r); DECLARE_WRITE8_MEMBER(runaway_led_w); DECLARE_WRITE8_MEMBER(runaway_irq_ack_w); @@ -28,18 +25,27 @@ public: DECLARE_READ8_MEMBER(runaway_pot_r); TILE_GET_INFO_MEMBER(runaway_get_tile_info); TILE_GET_INFO_MEMBER(qwak_get_tile_info); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; DECLARE_VIDEO_START(qwak); uint32_t screen_update_runaway(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); uint32_t screen_update_qwak(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_CALLBACK_MEMBER(interrupt_callback); + void qwak(machine_config &config); + void runaway(machine_config &config); + void runaway_map(address_map &map); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + + emu_timer *m_interrupt_timer; + required_shared_ptr m_video_ram; + required_shared_ptr m_sprite_ram; + tilemap_t *m_bg_tilemap; + int m_tile_bank; required_device m_maincpu; required_device m_gfxdecode; required_device m_screen; required_device m_palette; - void qwak(machine_config &config); - void runaway(machine_config &config); - void runaway_map(address_map &map); + output_finder<2> m_led; }; diff --git a/src/mame/includes/sage2.h b/src/mame/includes/sage2.h index 463255ff862..5542a6716ec 100644 --- a/src/mame/includes/sage2.h +++ b/src/mame/includes/sage2.h @@ -29,23 +29,48 @@ class sage2_state : public driver_device { public: sage2_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, M68000_TAG), - m_pic(*this, I8259_TAG), - m_usart0(*this, I8251_0_TAG), - m_usart1(*this, I8251_1_TAG), - m_fdc(*this, UPD765_TAG), - m_ram(*this, RAM_TAG), - m_rom(*this, M68000_TAG), - m_floppy0(*this, UPD765_TAG ":0"), - m_floppy1(*this, UPD765_TAG ":1"), - m_floppy(nullptr), - m_centronics(*this, CENTRONICS_TAG), - m_ieee488(*this, IEEE488_TAG), - m_fdc_int(0), - m_fdie(0) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, M68000_TAG) + , m_pic(*this, I8259_TAG) + , m_usart0(*this, I8251_0_TAG) + , m_usart1(*this, I8251_1_TAG) + , m_fdc(*this, UPD765_TAG) + , m_ram(*this, RAM_TAG) + , m_rom(*this, M68000_TAG) + , m_floppy0(*this, UPD765_TAG ":0") + , m_floppy1(*this, UPD765_TAG ":1") + , m_floppy(nullptr) + , m_centronics(*this, CENTRONICS_TAG) + , m_ieee488(*this, IEEE488_TAG) + , m_fdc_int(0) + , m_fdie(0) + , m_led(*this, "led0") { } + void update_fdc_int(); + + DECLARE_READ16_MEMBER(rom_r); + DECLARE_WRITE_LINE_MEMBER( br1_w ); + DECLARE_WRITE_LINE_MEMBER( br2_w ); + DECLARE_WRITE8_MEMBER( ppi0_pc_w ); + DECLARE_READ8_MEMBER( ppi1_pb_r ); + DECLARE_WRITE8_MEMBER( ppi1_pc_w ); + + DECLARE_WRITE_LINE_MEMBER( fdc_irq ); + + DECLARE_WRITE_LINE_MEMBER(write_centronics_ack); + DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); + DECLARE_WRITE_LINE_MEMBER(write_centronics_perror); + DECLARE_WRITE_LINE_MEMBER(write_centronics_select); + DECLARE_WRITE_LINE_MEMBER(write_centronics_fault); + void sage2(machine_config &config); + void sage2_mem(address_map &map); + void init_sage2(); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + required_device m_maincpu; required_device m_pic; required_device m_usart0; @@ -59,35 +84,13 @@ public: required_device m_centronics; required_device m_ieee488; - virtual void machine_start() override; - virtual void machine_reset() override; - - void update_fdc_int(); - - DECLARE_READ16_MEMBER(rom_r); - DECLARE_WRITE_LINE_MEMBER( br1_w ); - DECLARE_WRITE_LINE_MEMBER( br2_w ); - DECLARE_WRITE8_MEMBER( ppi0_pc_w ); - DECLARE_READ8_MEMBER( ppi1_pb_r ); - DECLARE_WRITE8_MEMBER( ppi1_pc_w ); - - DECLARE_WRITE_LINE_MEMBER( fdc_irq ); - // floppy state int m_fdc_int; int m_fdie; - void init_sage2(); int m_centronics_busy; int m_centronics_perror; int m_centronics_select; int m_centronics_fault; - - DECLARE_WRITE_LINE_MEMBER(write_centronics_ack); - DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); - DECLARE_WRITE_LINE_MEMBER(write_centronics_perror); - DECLARE_WRITE_LINE_MEMBER(write_centronics_select); - DECLARE_WRITE_LINE_MEMBER(write_centronics_fault); - void sage2(machine_config &config); - void sage2_mem(address_map &map); + output_finder<> m_led; }; diff --git a/src/mame/includes/sderby.h b/src/mame/includes/sderby.h index 4fbe0a49258..2f59f662640 100644 --- a/src/mame/includes/sderby.h +++ b/src/mame/includes/sderby.h @@ -3,26 +3,18 @@ class sderby_state : public driver_device { public: - sderby_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + sderby_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_videoram(*this, "videoram"), m_md_videoram(*this, "md_videoram"), m_fg_videoram(*this, "fg_videoram"), m_spriteram(*this, "spriteram"), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_lamp(*this, "lamp%u", 0U) + { } - required_shared_ptr m_videoram; - required_shared_ptr m_md_videoram; - required_shared_ptr m_fg_videoram; - required_shared_ptr m_spriteram; - - tilemap_t *m_tilemap; - tilemap_t *m_md_tilemap; - tilemap_t *m_fg_tilemap; - - uint16_t m_scroll[6]; DECLARE_READ16_MEMBER(sderby_input_r); DECLARE_READ16_MEMBER(sderbya_input_r); DECLARE_READ16_MEMBER(roulette_input_r); @@ -38,13 +30,9 @@ public: TILE_GET_INFO_MEMBER(get_sderby_tile_info); TILE_GET_INFO_MEMBER(get_sderby_md_tile_info); TILE_GET_INFO_MEMBER(get_sderby_fg_tile_info); - virtual void video_start() override; uint32_t screen_update_sderby(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); uint32_t screen_update_pmroulet(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,int codeshift); - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_palette; void spacewin(machine_config &config); void sderbya(machine_config &config); void pmroulet(machine_config &config); @@ -57,4 +45,23 @@ public: void sderbya_map(address_map &map); void shinygld_map(address_map &map); void spacewin_map(address_map &map); + +protected: + virtual void machine_start() override { m_lamp.resolve(); } + virtual void video_start() override; + + required_shared_ptr m_videoram; + required_shared_ptr m_md_videoram; + required_shared_ptr m_fg_videoram; + required_shared_ptr m_spriteram; + + tilemap_t *m_tilemap; + tilemap_t *m_md_tilemap; + tilemap_t *m_fg_tilemap; + + uint16_t m_scroll[6]; + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_palette; + output_finder<8> m_lamp; }; diff --git a/src/mame/includes/segahang.h b/src/mame/includes/segahang.h index aa6c1b235af..9547dbf3379 100644 --- a/src/mame/includes/segahang.h +++ b/src/mame/includes/segahang.h @@ -24,22 +24,23 @@ class segahang_state : public sega_16bit_common_base public: // construction/destruction segahang_state(const machine_config &mconfig, device_type type, const char *tag) - : sega_16bit_common_base(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_subcpu(*this, "subcpu"), - m_soundcpu(*this, "soundcpu"), - m_mcu(*this, "mcu"), - m_i8255_1(*this, "i8255_1"), - m_i8255_2(*this, "i8255_2"), - m_sprites(*this, "sprites"), - m_segaic16vid(*this, "segaic16vid"), - m_segaic16road(*this, "segaic16road"), - m_soundlatch(*this, "soundlatch"), - m_workram(*this, "workram"), - m_sharrier_video(false), - m_adc_select(0), - m_adc_ports(*this, {"ADC0", "ADC1", "ADC2", "ADC3"}), - m_decrypted_opcodes(*this, "decrypted_opcodes") + : sega_16bit_common_base(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_subcpu(*this, "subcpu") + , m_soundcpu(*this, "soundcpu") + , m_mcu(*this, "mcu") + , m_i8255_1(*this, "i8255_1") + , m_i8255_2(*this, "i8255_2") + , m_sprites(*this, "sprites") + , m_segaic16vid(*this, "segaic16vid") + , m_segaic16road(*this, "segaic16road") + , m_soundlatch(*this, "soundlatch") + , m_workram(*this, "workram") + , m_sharrier_video(false) + , m_adc_select(0) + , m_adc_ports(*this, {"ADC0", "ADC1", "ADC2", "ADC3"}) + , m_decrypted_opcodes(*this, "decrypted_opcodes") + , m_lamp(*this, "lamp%u", 0U) { } // PPI read/write callbacks @@ -112,6 +113,7 @@ protected: // driver overrides virtual void video_start() override; + virtual void machine_start() override { m_lamp.resolve(); } virtual void machine_reset() override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; @@ -142,4 +144,5 @@ protected: optional_ioport_array<4> m_adc_ports; bool m_shadow; optional_shared_ptr m_decrypted_opcodes; + output_finder<2> m_lamp; }; diff --git a/src/mame/includes/segas16a.h b/src/mame/includes/segas16a.h index b120a12a853..e10eb923192 100644 --- a/src/mame/includes/segas16a.h +++ b/src/mame/includes/segas16a.h @@ -29,31 +29,32 @@ class segas16a_state : public sega_16bit_common_base public: // construction/destruction segas16a_state(const machine_config &mconfig, device_type type, const char *tag) - : sega_16bit_common_base(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_soundcpu(*this, "soundcpu"), - m_mcu(*this, "mcu"), - m_i8255(*this, "i8255"), - m_ymsnd(*this, "ymsnd"), - m_n7751(*this, "n7751"), - m_n7751_i8243(*this, "n7751_8243"), - m_nvram(*this, "nvram"), - m_watchdog(*this, "watchdog"), - m_segaic16vid(*this, "segaic16vid"), - m_soundlatch(*this, "soundlatch"), - m_sprites(*this, "sprites"), - m_cxdio(*this, "cxdio"), - m_workram(*this, "nvram"), - m_sound_decrypted_opcodes(*this, "sound_decrypted_opcodes"), - m_video_control(0), - m_mcu_control(0), - m_n7751_command(0), - m_n7751_rom_address(0), - m_last_buttons1(0), - m_last_buttons2(0), - m_read_port(0), - m_mj_input_num(0), - m_mj_inputs(*this, {"MJ0", "MJ1", "MJ2", "MJ3", "MJ4", "MJ5"}) + : sega_16bit_common_base(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_soundcpu(*this, "soundcpu") + , m_mcu(*this, "mcu") + , m_i8255(*this, "i8255") + , m_ymsnd(*this, "ymsnd") + , m_n7751(*this, "n7751") + , m_n7751_i8243(*this, "n7751_8243") + , m_nvram(*this, "nvram") + , m_watchdog(*this, "watchdog") + , m_segaic16vid(*this, "segaic16vid") + , m_soundlatch(*this, "soundlatch") + , m_sprites(*this, "sprites") + , m_cxdio(*this, "cxdio") + , m_workram(*this, "nvram") + , m_sound_decrypted_opcodes(*this, "sound_decrypted_opcodes") + , m_video_control(0) + , m_mcu_control(0) + , m_n7751_command(0) + , m_n7751_rom_address(0) + , m_last_buttons1(0) + , m_last_buttons2(0) + , m_read_port(0) + , m_mj_input_num(0) + , m_mj_inputs(*this, {"MJ0", "MJ1", "MJ2", "MJ3", "MJ4", "MJ5"}) + , m_lamp(*this, "lamp%u", 0U) { } // PPI read/write callbacks @@ -131,6 +132,7 @@ protected: // driver overrides virtual void video_start() override; + virtual void machine_start() override { m_lamp.resolve(); } virtual void machine_reset() override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; @@ -182,6 +184,7 @@ protected: uint8_t m_read_port; uint8_t m_mj_input_num; optional_ioport_array<6> m_mj_inputs; + output_finder<2> m_lamp; }; class afighter_16a_analog_state : public segas16a_state @@ -198,7 +201,7 @@ public: DECLARE_CUSTOM_INPUT_MEMBER(afighter_handl_left_r); DECLARE_CUSTOM_INPUT_MEMBER(afighter_handl_right_r); - protected: +protected: required_ioport m_accel; required_ioport m_steer; }; diff --git a/src/mame/includes/segas16b.h b/src/mame/includes/segas16b.h index 2f27137784a..a26960bd4e7 100644 --- a/src/mame/includes/segas16b.h +++ b/src/mame/includes/segas16b.h @@ -28,43 +28,44 @@ class segas16b_state : public sega_16bit_common_base public: // construction/destruction segas16b_state(const machine_config &mconfig, device_type type, const char *tag) - : sega_16bit_common_base(mconfig, type, tag), - m_mapper(*this, "mapper"), - m_maincpu(*this, "maincpu"), - m_soundcpu(*this, "soundcpu"), - m_mcu(*this, "mcu"), - m_ym2151(*this, "ym2151"), - m_ym2413(*this, "ym2413"), - m_upd7759(*this, "upd"), - m_multiplier(*this, "multiplier"), - m_cmptimer_1(*this, "cmptimer_1"), - m_cmptimer_2(*this, "cmptimer_2"), - m_nvram(*this, "nvram"), - m_sprites(*this, "sprites"), - m_segaic16vid(*this, "segaic16vid"), - m_soundlatch(*this, "soundlatch"), - m_cxdio(*this, "cxdio"), - m_upd4701a(*this, {"upd4701a1", "upd4701a2"}), - m_workram(*this, "workram"), - m_romboard(ROM_BOARD_INVALID), - m_tilemap_type(segaic16_video_device::TILEMAP_16B), - m_disable_screen_blanking(false), - m_i8751_initial_config(nullptr), - m_atomicp_sound_divisor(0), - m_atomicp_sound_count(0), - m_hwc_input_value(0), - m_hwc_monitor(*this, "MONITOR"), - m_hwc_left(*this, "LEFT"), - m_hwc_right(*this, "RIGHT"), - m_mj_input_num(0), - m_mj_last_val(0), - m_mj_inputs(*this, {"MJ0", "MJ1", "MJ2", "MJ3", "MJ4", "MJ5"}), - m_spritepalbase(0x400), - m_gfxdecode(*this, "gfxdecode"), - m_sound_decrypted_opcodes(*this, "sound_decrypted_opcodes"), - m_decrypted_opcodes(*this, "decrypted_opcodes"), - m_bootleg_scroll(*this, "bootleg_scroll"), - m_bootleg_page(*this, "bootleg_page") + : sega_16bit_common_base(mconfig, type, tag) + , m_mapper(*this, "mapper") + , m_maincpu(*this, "maincpu") + , m_soundcpu(*this, "soundcpu") + , m_mcu(*this, "mcu") + , m_ym2151(*this, "ym2151") + , m_ym2413(*this, "ym2413") + , m_upd7759(*this, "upd") + , m_multiplier(*this, "multiplier") + , m_cmptimer_1(*this, "cmptimer_1") + , m_cmptimer_2(*this, "cmptimer_2") + , m_nvram(*this, "nvram") + , m_sprites(*this, "sprites") + , m_segaic16vid(*this, "segaic16vid") + , m_soundlatch(*this, "soundlatch") + , m_cxdio(*this, "cxdio") + , m_upd4701a(*this, {"upd4701a1", "upd4701a2"}) + , m_workram(*this, "workram") + , m_romboard(ROM_BOARD_INVALID) + , m_tilemap_type(segaic16_video_device::TILEMAP_16B) + , m_disable_screen_blanking(false) + , m_i8751_initial_config(nullptr) + , m_atomicp_sound_divisor(0) + , m_atomicp_sound_count(0) + , m_hwc_input_value(0) + , m_hwc_monitor(*this, "MONITOR") + , m_hwc_left(*this, "LEFT") + , m_hwc_right(*this, "RIGHT") + , m_mj_input_num(0) + , m_mj_last_val(0) + , m_mj_inputs(*this, {"MJ0", "MJ1", "MJ2", "MJ3", "MJ4", "MJ5"}) + , m_spritepalbase(0x400) + , m_gfxdecode(*this, "gfxdecode") + , m_sound_decrypted_opcodes(*this, "sound_decrypted_opcodes") + , m_decrypted_opcodes(*this, "decrypted_opcodes") + , m_bootleg_scroll(*this, "bootleg_scroll") + , m_bootleg_page(*this, "bootleg_page") + , m_lamp(*this, "lamp%u", 0U) { } // memory mapping @@ -197,6 +198,7 @@ protected: // device overrides virtual void video_start() override; + virtual void machine_start() override { m_lamp.resolve(); } virtual void machine_reset() override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; @@ -222,7 +224,7 @@ protected: DECLARE_READ16_MEMBER( sjryuko_custom_io_r ); DECLARE_WRITE16_MEMBER( sjryuko_custom_io_w ); - protected: +protected: // devices optional_device m_mapper; required_device m_maincpu; @@ -270,8 +272,7 @@ protected: optional_shared_ptr m_decrypted_opcodes; optional_shared_ptr m_bootleg_scroll; optional_shared_ptr m_bootleg_page; - - + output_finder<2> m_lamp; }; class afighter_16b_analog_state : public segas16b_state diff --git a/src/mame/includes/segas32.h b/src/mame/includes/segas32.h index 3ae63918c3a..9dcbca0e44a 100644 --- a/src/mame/includes/segas32.h +++ b/src/mame/includes/segas32.h @@ -23,29 +23,6 @@ class segas32_state : public device_t public: segas32_state(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - required_shared_ptr m_z80_shared_ram; - optional_shared_ptr m_system32_workram; - required_shared_ptr m_system32_videoram; - required_shared_ptr m_system32_spriteram; - optional_shared_ptr_array m_system32_paletteram; - - required_device m_maincpu; - required_device m_soundcpu; - optional_device m_multipcm; - required_device m_gfxdecode; - required_device m_screen; - required_device m_palette; - - required_device m_irq_timer_0; - required_device m_irq_timer_1; - optional_device m_s32comm; - - required_region_ptr m_sprite_region; - required_memory_region m_maincpu_region; - required_memory_bank m_soundrom_bank; - optional_memory_bank m_multipcm_bank_hi; - optional_memory_bank m_multipcm_bank_lo; - typedef void (segas32_state::*sys32_output_callback)(int which, uint16_t data); struct layer_info @@ -69,34 +46,6 @@ public: uint8_t bank; }; - uint8_t m_v60_irq_control[0x10]; - timer_device *m_v60_irq_timer[2]; - uint8_t m_sound_irq_control[4]; - uint8_t m_sound_irq_input; - uint8_t m_sound_dummy_value; - uint16_t m_sound_bank; - sys32_output_callback m_sw1_output; - sys32_output_callback m_sw2_output; - sys32_output_callback m_sw3_output; - std::unique_ptr m_system32_protram; - uint16_t m_system32_displayenable[2]; - uint16_t m_system32_tilebank_external; - uint16_t m_arescue_dsp_io[6]; - uint8_t m_is_multi32; - struct cache_entry *m_cache_head; - struct layer_info m_layer_data[11]; - uint16_t m_mixer_control[2][0x40]; - std::unique_ptr m_solid_0000; - std::unique_ptr m_solid_ffff; - uint8_t m_sprite_render_count; - uint8_t m_sprite_control_latched[8]; - uint8_t m_sprite_control[8]; - std::unique_ptr m_spriteram_32bit; - typedef void (segas32_state::*prot_vblank_func)(); - prot_vblank_func m_system32_prot_vblank; - int m_print_count; - emu_timer *m_vblank_end_int_timer; - emu_timer *m_update_sprites_timer; DECLARE_WRITE16_MEMBER(sonic_level_load_protection); DECLARE_READ16_MEMBER(brival_protection_r); DECLARE_WRITE16_MEMBER(brival_protection_w); @@ -208,6 +157,7 @@ public: void clear_sound_irq(int which); void darkedge_fd1149_vblank(); void f1lap_fd1149_vblank(); + cpu_device* maincpu() { return m_maincpu; } void init_alien3(void); void init_arescue(int m_hasdsp); @@ -255,6 +205,58 @@ protected: virtual void device_add_mconfig(machine_config &config) override; virtual void device_start() override; virtual void device_reset() override; + + required_shared_ptr m_z80_shared_ram; + optional_shared_ptr m_system32_workram; + required_shared_ptr m_system32_videoram; + required_shared_ptr m_system32_spriteram; + optional_shared_ptr_array m_system32_paletteram; + + required_device m_maincpu; + required_device m_soundcpu; + optional_device m_multipcm; + required_device m_gfxdecode; + required_device m_screen; + required_device m_palette; + + required_device m_irq_timer_0; + required_device m_irq_timer_1; + optional_device m_s32comm; + + required_region_ptr m_sprite_region; + required_memory_region m_maincpu_region; + required_memory_bank m_soundrom_bank; + optional_memory_bank m_multipcm_bank_hi; + optional_memory_bank m_multipcm_bank_lo; + + uint8_t m_v60_irq_control[0x10]; + timer_device *m_v60_irq_timer[2]; + uint8_t m_sound_irq_control[4]; + uint8_t m_sound_irq_input; + uint8_t m_sound_dummy_value; + uint16_t m_sound_bank; + sys32_output_callback m_sw1_output; + sys32_output_callback m_sw2_output; + sys32_output_callback m_sw3_output; + std::unique_ptr m_system32_protram; + uint16_t m_system32_displayenable[2]; + uint16_t m_system32_tilebank_external; + uint16_t m_arescue_dsp_io[6]; + uint8_t m_is_multi32; + struct cache_entry *m_cache_head; + struct layer_info m_layer_data[11]; + uint16_t m_mixer_control[2][0x40]; + std::unique_ptr m_solid_0000; + std::unique_ptr m_solid_ffff; + uint8_t m_sprite_render_count; + uint8_t m_sprite_control_latched[8]; + uint8_t m_sprite_control[8]; + std::unique_ptr m_spriteram_32bit; + typedef void (segas32_state::*prot_vblank_func)(); + prot_vblank_func m_system32_prot_vblank; + int m_print_count; + emu_timer *m_vblank_end_int_timer; + emu_timer *m_update_sprites_timer; }; class segas32_regular_state : public segas32_state @@ -347,6 +349,9 @@ protected: virtual void device_add_mconfig(machine_config &config) override; virtual void device_start() override; // virtual void device_reset() override; + +private: + output_finder<16> m_lamp; }; class sega_multi32_state : public segas32_state diff --git a/src/mame/includes/segaxbd.h b/src/mame/includes/segaxbd.h index a8306d44247..c47d227b230 100644 --- a/src/mame/includes/segaxbd.h +++ b/src/mame/includes/segaxbd.h @@ -153,6 +153,7 @@ protected: required_ioport m_io0_porta; optional_ioport_array<8> m_adc_ports; optional_ioport_array<4> m_mux_ports; + output_finder<4> m_lamp; protected: virtual void device_start() override; diff --git a/src/mame/includes/seta.h b/src/mame/includes/seta.h index cef9c7e4a6c..8c12dd7dd23 100644 --- a/src/mame/includes/seta.h +++ b/src/mame/includes/seta.h @@ -64,6 +64,7 @@ public: m_vctrl(*this,"vctrl_%u", 0), m_paletteram(*this,"paletteram%u", 1), m_subbank(*this,"subbank"), + m_leds(*this,"led%u", 0U), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette") { } @@ -95,6 +96,8 @@ public: optional_memory_bank m_subbank; + output_finder<48> m_leds; + required_device m_gfxdecode; required_device m_palette; @@ -202,6 +205,7 @@ public: DECLARE_PALETTE_INIT(gundhara); DECLARE_PALETTE_INIT(jjsquawk); DECLARE_MACHINE_START(keroppi); + DECLARE_MACHINE_START(magspeed); DECLARE_VIDEO_START(oisipuzl_2_layers); uint32_t screen_update_seta_no_layers(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); uint32_t screen_update_seta(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); @@ -360,6 +364,7 @@ public: DECLARE_WRITE16_MEMBER(spritectrl_w); + DECLARE_MACHINE_START(setaroul); DECLARE_MACHINE_RESET(setaroul); DECLARE_VIDEO_START(setaroul_1_layer); diff --git a/src/mame/includes/seta2.h b/src/mame/includes/seta2.h index 7e2f1239a98..39574b24600 100644 --- a/src/mame/includes/seta2.h +++ b/src/mame/includes/seta2.h @@ -19,8 +19,8 @@ class seta2_state : public driver_device { public: - seta2_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + seta2_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this,"maincpu"), m_sub(*this,"sub"), m_gfxdecode(*this, "gfxdecode"), @@ -39,37 +39,11 @@ public: m_tileram(*this, "tileram", 0), m_vregs(*this, "vregs", 0), m_funcube_outputs(*this, "funcube_outputs"), - m_funcube_leds(*this, "funcube_leds") + m_funcube_leds(*this, "funcube_leds"), + m_led(*this, "led%u", 0U), + m_lamp(*this, "lamp%u", 0U) { } - required_device m_maincpu; - optional_device m_sub; - required_device m_gfxdecode; - required_device m_screen; - required_device m_palette; - - optional_device m_tmp68301; - optional_device m_oki; - optional_device m_eeprom; - optional_device m_flash; - optional_device m_rtc; - optional_device m_dispenser; - - optional_shared_ptr m_nvram; - optional_shared_ptr m_spriteram; - optional_shared_ptr m_tileram; - optional_shared_ptr m_vregs; - optional_shared_ptr m_funcube_outputs; - optional_shared_ptr m_funcube_leds; - - int m_xoffset; - int m_yoffset; - int m_keyboard_row; - std::unique_ptr m_buffered_spriteram; - - uint64_t m_funcube_coin_start_cycles; - uint8_t m_funcube_hopper_motor; - DECLARE_WRITE16_MEMBER(spriteram16_word_w); DECLARE_READ16_MEMBER(spriteram16_word_r); DECLARE_WRITE16_MEMBER(vregs_w); @@ -116,7 +90,6 @@ public: DECLARE_MACHINE_START(funcube); DECLARE_MACHINE_RESET(funcube); - virtual void video_start() override; DECLARE_VIDEO_START(yoffset); DECLARE_VIDEO_START(xoffset); DECLARE_VIDEO_START(xoffset1); @@ -164,6 +137,40 @@ public: void reelquak_map(address_map &map); void samshoot_map(address_map &map); void telpacfl_map(address_map &map); + +protected: + virtual void machine_start() override { m_led.resolve(); m_lamp.resolve(); } + virtual void video_start() override; + + required_device m_maincpu; + optional_device m_sub; + required_device m_gfxdecode; + required_device m_screen; + required_device m_palette; + + optional_device m_tmp68301; + optional_device m_oki; + optional_device m_eeprom; + optional_device m_flash; + optional_device m_rtc; + optional_device m_dispenser; + + optional_shared_ptr m_nvram; + optional_shared_ptr m_spriteram; + optional_shared_ptr m_tileram; + optional_shared_ptr m_vregs; + optional_shared_ptr m_funcube_outputs; + optional_shared_ptr m_funcube_leds; + output_finder<7> m_led; + output_finder<11> m_lamp; + + int m_xoffset; + int m_yoffset; + int m_keyboard_row; + std::unique_ptr m_buffered_spriteram; + + uint64_t m_funcube_coin_start_cycles; + uint8_t m_funcube_hopper_motor; }; diff --git a/src/mame/includes/skykid.h b/src/mame/includes/skykid.h index 0159bb118f9..ef3705ad870 100644 --- a/src/mame/includes/skykid.h +++ b/src/mame/includes/skykid.h @@ -7,32 +7,18 @@ class skykid_state : public driver_device { public: skykid_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_videoram(*this, "videoram"), - m_textram(*this, "textram"), - m_spriteram(*this, "spriteram"), - m_maincpu(*this, "maincpu"), - m_mcu(*this, "mcu"), - m_cus30(*this, "namco"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + : driver_device(mconfig, type, tag) + , m_videoram(*this, "videoram") + , m_textram(*this, "textram") + , m_spriteram(*this, "spriteram") + , m_maincpu(*this, "maincpu") + , m_mcu(*this, "mcu") + , m_cus30(*this, "namco") + , m_gfxdecode(*this, "gfxdecode") + , m_palette(*this, "palette") + , m_led(*this, "led%u", 0U) + { } - uint8_t m_inputport_selected; - required_shared_ptr m_videoram; - required_shared_ptr m_textram; - required_shared_ptr m_spriteram; - required_device m_maincpu; - required_device m_mcu; - required_device m_cus30; - required_device m_gfxdecode; - required_device m_palette; - tilemap_t *m_bg_tilemap; - tilemap_t *m_tx_tilemap; - uint8_t m_priority; - uint16_t m_scroll_x; - uint16_t m_scroll_y; - uint8_t m_main_irq_mask; - uint8_t m_mcu_irq_mask; DECLARE_WRITE8_MEMBER(inputport_select_w); DECLARE_READ8_MEMBER(inputport_r); DECLARE_WRITE8_MEMBER(skykid_led_w); @@ -52,8 +38,6 @@ public: TILEMAP_MAPPER_MEMBER(tx_tilemap_scan); TILE_GET_INFO_MEMBER(tx_get_tile_info); TILE_GET_INFO_MEMBER(bg_get_tile_info); - virtual void machine_start() override; - virtual void video_start() override; DECLARE_PALETTE_INIT(skykid); uint32_t screen_update_skykid(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); DECLARE_WRITE_LINE_MEMBER(vblank_irq); @@ -62,4 +46,26 @@ public: void mcu_map(address_map &map); void mcu_port_map(address_map &map); void skykid_map(address_map &map); + +protected: + virtual void machine_start() override; + virtual void video_start() override; + + uint8_t m_inputport_selected; + required_shared_ptr m_videoram; + required_shared_ptr m_textram; + required_shared_ptr m_spriteram; + required_device m_maincpu; + required_device m_mcu; + required_device m_cus30; + required_device m_gfxdecode; + required_device m_palette; + output_finder<2> m_led; + tilemap_t *m_bg_tilemap; + tilemap_t *m_tx_tilemap; + uint8_t m_priority; + uint16_t m_scroll_x; + uint16_t m_scroll_y; + uint8_t m_main_irq_mask; + uint8_t m_mcu_irq_mask; }; diff --git a/src/mame/includes/sms.h b/src/mame/includes/sms.h index 3c635f9ddcf..381778ab431 100644 --- a/src/mame/includes/sms.h +++ b/src/mame/includes/sms.h @@ -70,6 +70,102 @@ public: m_store_cart_selection_data(0) { } + void store_post_load(); + void store_select_cart(uint8_t data); + + DECLARE_READ8_MEMBER(read_0000); + DECLARE_READ8_MEMBER(read_4000); + DECLARE_READ8_MEMBER(read_8000); + DECLARE_READ8_MEMBER(read_ram); + DECLARE_WRITE8_MEMBER(write_ram); + DECLARE_WRITE8_MEMBER(write_cart); + + DECLARE_READ8_MEMBER(sms_mapper_r); + DECLARE_WRITE8_MEMBER(sms_mapper_w); + DECLARE_WRITE8_MEMBER(sms_mem_control_w); + DECLARE_WRITE8_MEMBER(sms_io_control_w); + DECLARE_READ8_MEMBER(sms_count_r); + DECLARE_READ8_MEMBER(sms_input_port_dc_r); + DECLARE_READ8_MEMBER(sms_input_port_dd_r); + DECLARE_READ8_MEMBER(gg_input_port_00_r); + DECLARE_READ8_MEMBER(sg1000m3_peripheral_r); + DECLARE_WRITE8_MEMBER(sg1000m3_peripheral_w); + DECLARE_READ8_MEMBER(gg_sio_r); + DECLARE_WRITE8_MEMBER(gg_sio_w); + DECLARE_WRITE8_MEMBER(gg_psg_stereo_w); + DECLARE_WRITE8_MEMBER(gg_psg_w); + DECLARE_WRITE8_MEMBER(sms_psg_w); + DECLARE_READ8_MEMBER(smsj_audio_control_r); + DECLARE_WRITE8_MEMBER(smsj_audio_control_w); + DECLARE_WRITE8_MEMBER(smsj_ym2413_register_port_w); + DECLARE_WRITE8_MEMBER(smsj_ym2413_data_port_w); + DECLARE_READ8_MEMBER(sms_sscope_r); + DECLARE_WRITE8_MEMBER(sms_sscope_w); + + DECLARE_WRITE_LINE_MEMBER(sms_pause_callback); + DECLARE_WRITE_LINE_MEMBER(sms_csync_callback); + DECLARE_WRITE_LINE_MEMBER(sms_ctrl1_th_input); + DECLARE_WRITE_LINE_MEMBER(sms_ctrl2_th_input); + DECLARE_WRITE_LINE_MEMBER(gg_ext_th_input); + DECLARE_READ32_MEMBER(sms_pixel_color); + + void init_sg1000m3(); + void init_gamegear(); + void init_gamegeaj(); + void init_sms1krfm(); + void init_sms1kr(); + void init_smskr(); + void init_smsj(); + void init_sms1(); + void init_sms(); + DECLARE_VIDEO_START(gamegear); + DECLARE_VIDEO_RESET(gamegear); + DECLARE_VIDEO_START(sms1); + DECLARE_VIDEO_RESET(sms1); + + uint32_t screen_update_sms(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + uint32_t screen_update_sms1(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + uint32_t screen_update_gamegear(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + void screen_gg_sms_mode_scaling(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + DECLARE_WRITE_LINE_MEMBER(screen_vblank_sms1); + + void sms_base(machine_config &config); + void sms_ntsc_base(machine_config &config); + void sms_pal_base(machine_config &config); + void sms_paln_base(machine_config &config); + void sms_br_base(machine_config &config); + void sms3_br(machine_config &config); + void sg1000m3(machine_config &config); + void smsj(machine_config &config); + void sms1_paln(machine_config &config); + void sms1_ntsc(machine_config &config); + void gamegear(machine_config &config); + void sms3_paln(machine_config &config); + void sms1_pal(machine_config &config); + void sms2_pal(machine_config &config); + void sms2_kr(machine_config &config); + void sms1_br(machine_config &config); + void sms2_ntsc(machine_config &config); + void sms1_kr(machine_config &config); + void gg_io(address_map &map); + void sg1000m3_io(address_map &map); + void sms1_mem(address_map &map); + void sms_io(address_map &map); + void sms_mem(address_map &map); + void smsj_io(address_map &map); + void smskr_io(address_map &map); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + uint8_t read_bus(address_space &space, unsigned int bank, uint16_t base_addr, uint16_t offset); + void setup_bios(); + void setup_media_slots(); + void setup_enabled_slots(); + void lphaser_hcount_latch(); + void sms_get_inputs(); + void smsj_set_audio_control(uint8_t data); + // devices required_device m_maincpu; required_device m_vdp; @@ -168,100 +264,6 @@ public: sega8_card_slot_device *m_cards[16]; uint8_t m_store_control; uint8_t m_store_cart_selection_data; - void store_post_load(); - void store_select_cart(uint8_t data); - - DECLARE_READ8_MEMBER(read_0000); - DECLARE_READ8_MEMBER(read_4000); - DECLARE_READ8_MEMBER(read_8000); - DECLARE_READ8_MEMBER(read_ram); - DECLARE_WRITE8_MEMBER(write_ram); - DECLARE_WRITE8_MEMBER(write_cart); - - DECLARE_READ8_MEMBER(sms_mapper_r); - DECLARE_WRITE8_MEMBER(sms_mapper_w); - DECLARE_WRITE8_MEMBER(sms_mem_control_w); - DECLARE_WRITE8_MEMBER(sms_io_control_w); - DECLARE_READ8_MEMBER(sms_count_r); - DECLARE_READ8_MEMBER(sms_input_port_dc_r); - DECLARE_READ8_MEMBER(sms_input_port_dd_r); - DECLARE_READ8_MEMBER(gg_input_port_00_r); - DECLARE_READ8_MEMBER(sg1000m3_peripheral_r); - DECLARE_WRITE8_MEMBER(sg1000m3_peripheral_w); - DECLARE_READ8_MEMBER(gg_sio_r); - DECLARE_WRITE8_MEMBER(gg_sio_w); - DECLARE_WRITE8_MEMBER(gg_psg_stereo_w); - DECLARE_WRITE8_MEMBER(gg_psg_w); - DECLARE_WRITE8_MEMBER(sms_psg_w); - DECLARE_READ8_MEMBER(smsj_audio_control_r); - DECLARE_WRITE8_MEMBER(smsj_audio_control_w); - DECLARE_WRITE8_MEMBER(smsj_ym2413_register_port_w); - DECLARE_WRITE8_MEMBER(smsj_ym2413_data_port_w); - DECLARE_READ8_MEMBER(sms_sscope_r); - DECLARE_WRITE8_MEMBER(sms_sscope_w); - - DECLARE_WRITE_LINE_MEMBER(sms_pause_callback); - DECLARE_WRITE_LINE_MEMBER(sms_csync_callback); - DECLARE_WRITE_LINE_MEMBER(sms_ctrl1_th_input); - DECLARE_WRITE_LINE_MEMBER(sms_ctrl2_th_input); - DECLARE_WRITE_LINE_MEMBER(gg_ext_th_input); - DECLARE_READ32_MEMBER(sms_pixel_color); - - void init_sg1000m3(); - void init_gamegear(); - void init_gamegeaj(); - void init_sms1krfm(); - void init_sms1kr(); - void init_smskr(); - void init_smsj(); - void init_sms1(); - void init_sms(); - DECLARE_MACHINE_START(sms); - DECLARE_MACHINE_RESET(sms); - DECLARE_VIDEO_START(gamegear); - DECLARE_VIDEO_RESET(gamegear); - DECLARE_VIDEO_START(sms1); - DECLARE_VIDEO_RESET(sms1); - - uint32_t screen_update_sms(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - uint32_t screen_update_sms1(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - uint32_t screen_update_gamegear(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - void screen_gg_sms_mode_scaling(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - DECLARE_WRITE_LINE_MEMBER(screen_vblank_sms1); - - void sms_base(machine_config &config); - void sms_ntsc_base(machine_config &config); - void sms_pal_base(machine_config &config); - void sms_paln_base(machine_config &config); - void sms_br_base(machine_config &config); - void sms3_br(machine_config &config); - void sg1000m3(machine_config &config); - void smsj(machine_config &config); - void sms1_paln(machine_config &config); - void sms1_ntsc(machine_config &config); - void gamegear(machine_config &config); - void sms3_paln(machine_config &config); - void sms1_pal(machine_config &config); - void sms2_pal(machine_config &config); - void sms2_kr(machine_config &config); - void sms1_br(machine_config &config); - void sms2_ntsc(machine_config &config); - void sms1_kr(machine_config &config); - void gg_io(address_map &map); - void sg1000m3_io(address_map &map); - void sms1_mem(address_map &map); - void sms_io(address_map &map); - void sms_mem(address_map &map); - void smsj_io(address_map &map); - void smskr_io(address_map &map); -protected: - uint8_t read_bus(address_space &space, unsigned int bank, uint16_t base_addr, uint16_t offset); - void setup_bios(); - void setup_media_slots(); - void setup_enabled_slots(); - void lphaser_hcount_latch(); - void sms_get_inputs(); - void smsj_set_audio_control(uint8_t data); }; class smssdisp_state : public sms_state diff --git a/src/mame/includes/snookr10.h b/src/mame/includes/snookr10.h index 1eebbf56b4c..5516b806d95 100644 --- a/src/mame/includes/snookr10.h +++ b/src/mame/includes/snookr10.h @@ -3,24 +3,15 @@ class snookr10_state : public driver_device { public: - snookr10_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + snookr10_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_videoram(*this, "videoram"), m_colorram(*this, "colorram"), m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode") { } + m_gfxdecode(*this, "gfxdecode"), + m_lamp(*this, "lamp%u", 0U) + { } - int m_outportl; - int m_outporth; - int m_bit0; - int m_bit1; - int m_bit2; - int m_bit3; - int m_bit4; - int m_bit5; - required_shared_ptr m_videoram; - required_shared_ptr m_colorram; - tilemap_t *m_bg_tilemap; DECLARE_READ8_MEMBER(dsw_port_1_r); DECLARE_READ8_MEMBER(port2000_8_r); DECLARE_WRITE8_MEMBER(output_port_0_w); @@ -30,15 +21,12 @@ public: TILE_GET_INFO_MEMBER(get_bg_tile_info); TILE_GET_INFO_MEMBER(apple10_get_bg_tile_info); TILE_GET_INFO_MEMBER(crystalc_get_bg_tile_info); - virtual void video_start() override; DECLARE_PALETTE_INIT(snookr10); DECLARE_VIDEO_START(apple10); DECLARE_VIDEO_START(crystalc); DECLARE_PALETTE_INIT(apple10); DECLARE_PALETTE_INIT(crystalc); uint32_t screen_update_snookr10(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device m_maincpu; - required_device m_gfxdecode; void apple10(machine_config &config); void snookr10(machine_config &config); void crystalc(machine_config &config); @@ -46,4 +34,23 @@ public: void crystalc_map(address_map &map); void snookr10_map(address_map &map); void tenballs_map(address_map &map); + +protected: + virtual void machine_start() override { m_lamp.resolve(); } + virtual void video_start() override; + + int m_outportl; + int m_outporth; + int m_bit0; + int m_bit1; + int m_bit2; + int m_bit3; + int m_bit4; + int m_bit5; + required_shared_ptr m_videoram; + required_shared_ptr m_colorram; + tilemap_t *m_bg_tilemap; + required_device m_maincpu; + required_device m_gfxdecode; + output_finder<7> m_lamp; }; diff --git a/src/mame/includes/softbox.h b/src/mame/includes/softbox.h index 4a8faa8869e..59ae7cae07c 100644 --- a/src/mame/includes/softbox.h +++ b/src/mame/includes/softbox.h @@ -26,21 +26,14 @@ class softbox_state : public driver_device { public: softbox_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_dbrg(*this, COM8116_TAG), - m_ieee(*this, IEEE488_TAG), - m_hdc(*this, CORVUS_HDC_TAG) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, Z80_TAG) + , m_dbrg(*this, COM8116_TAG) + , m_ieee(*this, IEEE488_TAG) + , m_hdc(*this, CORVUS_HDC_TAG) + , m_led(*this, "led%u", 0U) { } - required_device m_maincpu; - required_device m_dbrg; - required_device m_ieee; - required_device m_hdc; - - virtual void machine_start() override; - virtual void device_reset_after_children() override; - // device_ieee488_interface overrides virtual void ieee488_ifc(int state); @@ -56,7 +49,7 @@ public: enum { - LED_A, + LED_A = 0, LED_B, LED_READY }; @@ -65,6 +58,16 @@ public: void softbox_io(address_map &map); void softbox_mem(address_map &map); int m_ifc; // Tracks previous state of IEEE-488 IFC line + +protected: + virtual void machine_start() override; + virtual void device_reset_after_children() override; + + required_device m_maincpu; + required_device m_dbrg; + required_device m_ieee; + required_device m_hdc; + output_finder<3> m_led; }; #endif diff --git a/src/mame/includes/spcforce.h b/src/mame/includes/spcforce.h index ff11d74ed8e..378288412ef 100644 --- a/src/mame/includes/spcforce.h +++ b/src/mame/includes/spcforce.h @@ -5,8 +5,8 @@ class spcforce_state : public driver_device { public: - spcforce_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + spcforce_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), m_gfxdecode(*this, "gfxdecode"), @@ -16,26 +16,9 @@ public: m_sn3(*this, "sn3"), m_scrollram(*this, "scrollram"), m_videoram(*this, "videoram"), - m_colorram(*this, "colorram") { } - - required_device m_maincpu; - required_device m_audiocpu; - required_device m_gfxdecode; - required_device m_palette; - required_device m_sn1; - required_device m_sn2; - required_device m_sn3; - - required_shared_ptr m_scrollram; - required_shared_ptr m_videoram; - required_shared_ptr m_colorram; - - int m_sn76496_latch; - int m_sn76496_select; - int m_sn1_ready; - int m_sn2_ready; - int m_sn3_ready; - uint8_t m_irq_mask; + m_colorram(*this, "colorram"), + m_lamp(*this, "lamp%u", 0U) + { } DECLARE_WRITE8_MEMBER(SN76496_latch_w); DECLARE_READ8_MEMBER(SN76496_select_r); @@ -50,7 +33,6 @@ public: DECLARE_WRITE_LINE_MEMBER(flip_screen_w); DECLARE_WRITE_LINE_MEMBER(unknown_w); - virtual void machine_start() override; DECLARE_PALETTE_INIT(spcforce); uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); @@ -60,4 +42,27 @@ public: void spcforce(machine_config &config); void spcforce_map(address_map &map); void spcforce_sound_map(address_map &map); + +protected: + virtual void machine_start() override; + + required_device m_maincpu; + required_device m_audiocpu; + required_device m_gfxdecode; + required_device m_palette; + required_device m_sn1; + required_device m_sn2; + required_device m_sn3; + + required_shared_ptr m_scrollram; + required_shared_ptr m_videoram; + required_shared_ptr m_colorram; + output_finder<2> m_lamp; + + int m_sn76496_latch; + int m_sn76496_select; + int m_sn1_ready; + int m_sn2_ready; + int m_sn3_ready; + uint8_t m_irq_mask; }; diff --git a/src/mame/includes/starshp1.h b/src/mame/includes/starshp1.h index d666e9db81d..c2ec5b00067 100644 --- a/src/mame/includes/starshp1.h +++ b/src/mame/includes/starshp1.h @@ -58,7 +58,8 @@ public: m_discrete(*this, "discrete"), m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), - m_palette(*this, "palette") + m_palette(*this, "palette"), + m_led(*this, "led0") { } DECLARE_CUSTOM_INPUT_MEMBER(starshp1_analog_r); @@ -66,6 +67,7 @@ public: void starshp1(machine_config &config); protected: + virtual void machine_start() override; DECLARE_WRITE8_MEMBER(starshp1_collision_reset_w); DECLARE_WRITE8_MEMBER(starshp1_analog_in_w); DECLARE_WRITE_LINE_MEMBER(ship_explode_w); @@ -136,6 +138,7 @@ private: required_device m_gfxdecode; required_device m_screen; required_device m_palette; + output_finder<> m_led; }; /*----------- defined in audio/starshp1.c -----------*/ diff --git a/src/mame/includes/suna16.h b/src/mame/includes/suna16.h index 95dbfde6b0f..27316675be4 100644 --- a/src/mame/includes/suna16.h +++ b/src/mame/includes/suna16.h @@ -9,41 +9,21 @@ class suna16_state : public driver_device { public: suna16_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this,"maincpu"), - m_pcm1(*this,"pcm1"), - m_pcm2(*this,"pcm2"), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen"), - m_palette(*this, "palette"), - m_soundlatch(*this, "soundlatch"), - m_spriteram(*this, "spriteram"), - m_spriteram2(*this, "spriteram2"), - m_bank1(*this, "bank1"), - m_bank2(*this, "bank2") - - + : driver_device(mconfig, type, tag) + , m_maincpu(*this,"maincpu") + , m_pcm1(*this,"pcm1") + , m_pcm2(*this,"pcm2") + , m_gfxdecode(*this, "gfxdecode") + , m_screen(*this, "screen") + , m_palette(*this, "palette") + , m_soundlatch(*this, "soundlatch") + , m_spriteram(*this, "spriteram") + , m_spriteram2(*this, "spriteram2") + , m_bank1(*this, "bank1") + , m_bank2(*this, "bank2") + , m_led(*this, "led%u", 0U) { } - required_device m_maincpu; - optional_device m_pcm1; - optional_device m_pcm2; - required_device m_gfxdecode; - required_device m_screen; - required_device m_palette; - required_device m_soundlatch; - - required_shared_ptr m_spriteram; - optional_shared_ptr m_spriteram2; - - optional_memory_bank m_bank1; - optional_memory_bank m_bank2; - - - std::unique_ptr m_paletteram; - int m_color_bank; - uint8_t m_prot; - // common DECLARE_WRITE16_MEMBER(soundlatch_w); DECLARE_READ16_MEMBER(paletteram_r); @@ -100,4 +80,27 @@ public: void uballoon_pcm_1_io_map(address_map &map); void uballoon_pcm_1_map(address_map &map); void uballoon_sound_map(address_map &map); + +protected: + virtual void machine_start() override { m_led.resolve(); } + + required_device m_maincpu; + optional_device m_pcm1; + optional_device m_pcm2; + required_device m_gfxdecode; + required_device m_screen; + required_device m_palette; + required_device m_soundlatch; + + required_shared_ptr m_spriteram; + optional_shared_ptr m_spriteram2; + + optional_memory_bank m_bank1; + optional_memory_bank m_bank2; + + output_finder<4> m_led; + + std::unique_ptr m_paletteram; + int m_color_bank; + uint8_t m_prot; }; diff --git a/src/mame/includes/suna8.h b/src/mame/includes/suna8.h index 71b6c65da34..73b5e002b33 100644 --- a/src/mame/includes/suna8.h +++ b/src/mame/includes/suna8.h @@ -11,8 +11,8 @@ class suna8_state : public driver_device { public: - suna8_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + suna8_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this,"maincpu"), m_hardhead_ip(*this, "hardhead_ip"), m_spriteram(*this, "spriteram"), @@ -29,40 +29,9 @@ public: m_bank1(*this, "bank1"), m_bank1d(*this, "bank1d"), m_prot_opcode_toggle(0), - m_remap_sound(0) - { } - - required_device m_maincpu; - optional_shared_ptr m_hardhead_ip; - optional_shared_ptr m_spriteram; - optional_shared_ptr m_wram; - optional_shared_ptr m_banked_paletteram; - required_device m_audiocpu; - optional_device m_samples; - required_device m_gfxdecode; - required_device m_screen; - required_device m_palette; - required_device m_soundlatch; - required_device m_soundlatch2; - optional_memory_bank m_bank0d; - required_memory_bank m_bank1; - optional_memory_bank m_bank1d; - - uint8_t m_rombank; - uint8_t m_rombank_latch; - uint8_t m_spritebank; - uint8_t m_palettebank; - uint8_t m_paletteram_enab; - uint8_t m_prot2; - uint8_t m_prot2_prev; - - uint8_t m_protection_val; - uint8_t m_nmi_enable; - uint8_t m_spritebank_latch; - uint8_t m_write_disable; - uint8_t m_prot_opcode_toggle; - uint8_t m_remap_sound; - uint8_t* m_decrypt; + m_remap_sound(0), + m_led(*this, "led%u", 0U) + { } enum GFXBANK_TYPE_T { @@ -70,23 +39,6 @@ public: GFXBANK_TYPE_BRICKZN, GFXBANK_TYPE_STARFIGH } m_gfxbank_type; - uint8_t m_gfxbank; - - bool m_has_text; // has text sprites (older games) - - // samples - std::unique_ptr m_samplebuf; - int m_sample, m_play; - int m_numsamples; - -#if TILEMAPS - tilemap_t *m_bg_tilemap; - int m_tiles; - int m_trombank; - int m_page; - - TILE_GET_INFO_MEMBER(get_tile_info); -#endif DECLARE_READ8_MEMBER(hardhead_protection_r); DECLARE_WRITE8_MEMBER(hardhead_protection_w); @@ -202,4 +154,58 @@ public: void rranger_sound_map(address_map &map); void sparkman_map(address_map &map); void starfigh_map(address_map &map); + +protected: + virtual void machine_start() override { m_led.resolve(); } + + required_device m_maincpu; + optional_shared_ptr m_hardhead_ip; + optional_shared_ptr m_spriteram; + optional_shared_ptr m_wram; + optional_shared_ptr m_banked_paletteram; + required_device m_audiocpu; + optional_device m_samples; + required_device m_gfxdecode; + required_device m_screen; + required_device m_palette; + required_device m_soundlatch; + required_device m_soundlatch2; + optional_memory_bank m_bank0d; + required_memory_bank m_bank1; + optional_memory_bank m_bank1d; + + uint8_t m_rombank; + uint8_t m_rombank_latch; + uint8_t m_spritebank; + uint8_t m_palettebank; + uint8_t m_paletteram_enab; + uint8_t m_prot2; + uint8_t m_prot2_prev; + + uint8_t m_protection_val; + uint8_t m_nmi_enable; + uint8_t m_spritebank_latch; + uint8_t m_write_disable; + uint8_t m_prot_opcode_toggle; + uint8_t m_remap_sound; + uint8_t* m_decrypt; + + uint8_t m_gfxbank; + + bool m_has_text; // has text sprites (older games) + + // samples + std::unique_ptr m_samplebuf; + int m_sample, m_play; + int m_numsamples; + +#if TILEMAPS + tilemap_t *m_bg_tilemap; + int m_tiles; + int m_trombank; + int m_page; + + TILE_GET_INFO_MEMBER(get_tile_info); +#endif + output_finder<2> m_led; }; diff --git a/src/mame/includes/system16.h b/src/mame/includes/system16.h index 23747d6d08e..aa165d847e3 100644 --- a/src/mame/includes/system16.h +++ b/src/mame/includes/system16.h @@ -32,103 +32,9 @@ public: , m_soundlatch(*this, "soundlatch") , m_adpcm_select(*this, "adpcm_select") , m_decrypted_opcodes(*this, "decrypted_opcodes") + , m_led(*this, "led%u", 0U) { } - required_shared_ptr m_textram; - optional_shared_ptr m_bg0_tileram; - optional_shared_ptr m_bg1_tileram; - optional_shared_ptr m_tileram; - optional_shared_ptr m_goldnaxeb2_bgpage; - optional_shared_ptr m_goldnaxeb2_fgpage; - - optional_memory_region m_sprites_region; - optional_memory_region m_soundcpu_region; - optional_memory_bank m_soundbank; - optional_memory_bank m_okibank; - - optional_device m_sprites; - - uint16_t m_coinctrl; - - /* game specific */ - int m_passht4b_io1_val; - int m_passht4b_io2_val; - int m_passht4b_io3_val; - - int m_beautyb_unkx; - - int m_shinobl_kludge; - - int m_eswat_tilebank0; - - - /* video-related */ - tilemap_t *m_background[2]; - tilemap_t *m_foreground[2]; - tilemap_t *m_text_layer; - tilemap_t *m_bg_tilemaps[2]; - tilemap_t *m_text_tilemap; - double m_weights[2][3][6]; - - int m_spritebank_type; - int m_back_yscroll; - int m_fore_yscroll; - int m_text_yscroll; - - int m_bg1_trans; // alien syn + sys18 - - int m_tile_bank[2]; - int m_bg_page[2][4]; - int m_fg_page[2][4]; - - uint16_t m_datsu_page[4]; - - int m_old_bg_page[2][4]; - int m_old_fg_page[2][4]; - int m_old_tile_bank[2]; - - int m_bg_scrollx; - int m_bg_scrolly; - int m_fg_scrollx; - int m_fg_scrolly; - uint16_t m_tilemapselect; - - int m_textlayer_lo_min; - int m_textlayer_lo_max; - int m_textlayer_hi_min; - int m_textlayer_hi_max; - - int m_tilebank_switch; - - - /* sound-related */ - int m_sample_buffer; - int m_sample_select; - - uint8_t *m_soundbank_ptr; /* Pointer to currently selected portion of ROM */ - - /* sys18 */ - uint8_t *m_sound_bank; - uint16_t *m_splittab_bg_x; - uint16_t *m_splittab_bg_y; - uint16_t *m_splittab_fg_x; - uint16_t *m_splittab_fg_y; - int m_sound_info[4*2]; - int m_refreshenable; - int m_system18; - - uint8_t *m_decrypted_region; // goldnaxeb1 & bayrouteb1 - - /* devices */ - required_device m_maincpu; - optional_device m_soundcpu; - optional_device m_msm; - optional_device m_upd7759; - required_device m_gfxdecode; - optional_device m_soundlatch; - optional_device m_adpcm_select; - optional_shared_ptr m_decrypted_opcodes; - DECLARE_WRITE16_MEMBER(sound_command_nmi_w); DECLARE_WRITE16_MEMBER(sound_command_irq_w); DECLARE_READ8_MEMBER(sound_command_irq_r); @@ -289,4 +195,103 @@ public: void tturfbl_sound_io_map(address_map &map); void tturfbl_sound_map(address_map &map); void wb3bbl_map(address_map &map); + +protected: + virtual void machine_start() override { m_led.resolve(); } + + required_shared_ptr m_textram; + optional_shared_ptr m_bg0_tileram; + optional_shared_ptr m_bg1_tileram; + optional_shared_ptr m_tileram; + optional_shared_ptr m_goldnaxeb2_bgpage; + optional_shared_ptr m_goldnaxeb2_fgpage; + + optional_memory_region m_sprites_region; + optional_memory_region m_soundcpu_region; + optional_memory_bank m_soundbank; + optional_memory_bank m_okibank; + + optional_device m_sprites; + + uint16_t m_coinctrl; + + /* game specific */ + int m_passht4b_io1_val; + int m_passht4b_io2_val; + int m_passht4b_io3_val; + + int m_beautyb_unkx; + + int m_shinobl_kludge; + + int m_eswat_tilebank0; + + + /* video-related */ + tilemap_t *m_background[2]; + tilemap_t *m_foreground[2]; + tilemap_t *m_text_layer; + tilemap_t *m_bg_tilemaps[2]; + tilemap_t *m_text_tilemap; + double m_weights[2][3][6]; + + int m_spritebank_type; + int m_back_yscroll; + int m_fore_yscroll; + int m_text_yscroll; + + int m_bg1_trans; // alien syn + sys18 + + int m_tile_bank[2]; + int m_bg_page[2][4]; + int m_fg_page[2][4]; + + uint16_t m_datsu_page[4]; + + int m_old_bg_page[2][4]; + int m_old_fg_page[2][4]; + int m_old_tile_bank[2]; + + int m_bg_scrollx; + int m_bg_scrolly; + int m_fg_scrollx; + int m_fg_scrolly; + uint16_t m_tilemapselect; + + int m_textlayer_lo_min; + int m_textlayer_lo_max; + int m_textlayer_hi_min; + int m_textlayer_hi_max; + + int m_tilebank_switch; + + + /* sound-related */ + int m_sample_buffer; + int m_sample_select; + + uint8_t *m_soundbank_ptr; /* Pointer to currently selected portion of ROM */ + + /* sys18 */ + uint8_t *m_sound_bank; + uint16_t *m_splittab_bg_x; + uint16_t *m_splittab_bg_y; + uint16_t *m_splittab_fg_x; + uint16_t *m_splittab_fg_y; + int m_sound_info[4*2]; + int m_refreshenable; + int m_system18; + + uint8_t *m_decrypted_region; // goldnaxeb1 & bayrouteb1 + + /* devices */ + required_device m_maincpu; + optional_device m_soundcpu; + optional_device m_msm; + optional_device m_upd7759; + required_device m_gfxdecode; + optional_device m_soundlatch; + optional_device m_adpcm_select; + optional_shared_ptr m_decrypted_opcodes; + output_finder<2> m_led; }; diff --git a/src/mame/includes/taito_z.h b/src/mame/includes/taito_z.h index 6b79c8fc58d..180641613f9 100644 --- a/src/mame/includes/taito_z.h +++ b/src/mame/includes/taito_z.h @@ -19,8 +19,8 @@ class taitoz_state : public driver_device { public: - taitoz_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + taitoz_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_spriteram(*this, "spriteram"), m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), @@ -35,7 +35,9 @@ public: m_tc0510nio(*this, "tc0510nio"), m_tc0140syt(*this, "tc0140syt"), m_gfxdecode(*this, "gfxdecode"), - m_steer(*this, "STEER") { } + m_steer(*this, "STEER"), + m_lamp(*this, "lamp%u", 0U) + { } DECLARE_CUSTOM_INPUT_MEMBER(taitoz_pedal_r); @@ -55,6 +57,7 @@ public: void init_bshark(); protected: + virtual void machine_start() override { m_lamp.resolve(); } virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; private: @@ -91,6 +94,7 @@ private: optional_device m_tc0140syt; // bshark & spacegun miss the CPUs which shall use TC0140 required_device m_gfxdecode; optional_ioport m_steer; + output_finder<2> m_lamp; DECLARE_WRITE16_MEMBER(cpua_ctrl_w); DECLARE_WRITE16_MEMBER(bshark_cpua_ctrl_w); diff --git a/src/mame/includes/tek405x.h b/src/mame/includes/tek405x.h index 3c6835fd487..805ab42c1b2 100644 --- a/src/mame/includes/tek405x.h +++ b/src/mame/includes/tek405x.h @@ -51,26 +51,9 @@ public: m_rom(*this, MC6800_TAG), m_bsofl_rom(*this, "020_0147_00"), m_bscom_rom(*this, "021_0188_00"), - m_special(*this, "SPECIAL") - { - } - - required_device m_maincpu; - required_device m_gpib_pia; - required_device m_com_pia; - required_device m_acia; - required_device m_acia_clock; - required_device m_gpib; - required_device m_speaker; - required_device m_ram; - required_memory_region m_rom; - required_memory_region m_bsofl_rom; - required_memory_region m_bscom_rom; - required_ioport m_special; - - virtual void machine_start() override; - - virtual void video_start() override; + m_special(*this, "SPECIAL"), + m_lamp(*this, "lamp%u", 0U) + { } void bankswitch(uint8_t data); void update_irq(); @@ -122,6 +105,28 @@ public: DECLARE_WRITE_LINE_MEMBER( acia_irq_w ); DECLARE_WRITE_LINE_MEMBER( write_acia_clock ); + TIMER_DEVICE_CALLBACK_MEMBER(keyboard_tick); + void tek4051(machine_config &config); + void tek4051_mem(address_map &map); + +protected: + virtual void machine_start() override; + virtual void video_start() override; + + required_device m_maincpu; + required_device m_gpib_pia; + required_device m_com_pia; + required_device m_acia; + required_device m_acia_clock; + required_device m_gpib; + required_device m_speaker; + required_device m_ram; + required_memory_region m_rom; + required_memory_region m_bsofl_rom; + required_memory_region m_bscom_rom; + required_ioport m_special; + output_finder<4> m_lamp; + // interrupts int m_x_pia_irqa; int m_x_pia_irqb; @@ -143,28 +148,26 @@ public: // GPIB int m_talk; - TIMER_DEVICE_CALLBACK_MEMBER(keyboard_tick); - void tek4051(machine_config &config); - void tek4051_mem(address_map &map); }; class tek4052_state : public driver_device { public: - tek4052_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, AM2901A_TAG), - m_ram(*this, RAM_TAG) - { } + tek4052_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, AM2901A_TAG), + m_ram(*this, RAM_TAG) + { } - required_device m_maincpu; - required_device m_ram; + void tek4052(machine_config &config); + void tek4052_mem(address_map &map); +protected: virtual void machine_start() override; - virtual void video_start() override; - void tek4052(machine_config &config); - void tek4052_mem(address_map &map); + + required_device m_maincpu; + required_device m_ram; }; #endif // MAME_INCLUDES_TEK405X_H diff --git a/src/mame/includes/tetrisp2.h b/src/mame/includes/tetrisp2.h index 6a1fd83576c..2f54773adc0 100644 --- a/src/mame/includes/tetrisp2.h +++ b/src/mame/includes/tetrisp2.h @@ -31,57 +31,10 @@ public: m_palette(*this, "palette"), m_sub_palette(*this, "sub_palette"), m_paletteram(*this, "paletteram"), - m_sub_paletteram(*this, "sub_paletteram") + m_sub_paletteram(*this, "sub_paletteram"), + m_led(*this, "led%u", 0U) { } - required_device m_maincpu; - optional_device m_subcpu; - - required_shared_ptr m_spriteram; - optional_shared_ptr m_spriteram2; - - uint16_t m_systemregs[0x10]; - required_shared_ptr m_vram_fg; - required_shared_ptr m_vram_bg; - required_shared_ptr m_vram_rot; - required_shared_ptr m_nvram; - required_shared_ptr m_scroll_fg; - required_shared_ptr m_scroll_bg; - required_shared_ptr m_rotregs; - std::unique_ptr m_priority; - optional_shared_ptr m_rocknms_sub_priority; - optional_shared_ptr m_rocknms_sub_vram_rot; - optional_shared_ptr m_rocknms_sub_vram_fg; - optional_shared_ptr m_rocknms_sub_vram_bg; - optional_shared_ptr m_rocknms_sub_scroll_fg; - optional_shared_ptr m_rocknms_sub_scroll_bg; - optional_shared_ptr m_rocknms_sub_rotregs; - required_device m_gfxdecode; - optional_device m_sub_gfxdecode; - required_device m_palette; - optional_device m_sub_palette; - required_shared_ptr m_paletteram; - optional_shared_ptr m_sub_paletteram; - - uint16_t m_rocknms_sub_systemregs[0x10]; - uint16_t m_rockn_protectdata; - uint16_t m_rockn_adpcmbank; - uint16_t m_rockn_soundvolume; - emu_timer *m_rockn_timer_l4; - emu_timer *m_rockn_timer_sub_l4; - emu_timer *m_rockn_timer_l1; - emu_timer *m_rockn_timer_sub_l1; - int m_bank_lo; - int m_bank_hi; - uint16_t m_rocknms_main2sub; - uint16_t m_rocknms_sub2main; - int m_flipscreen_old; - tilemap_t *m_tilemap_bg; - tilemap_t *m_tilemap_fg; - tilemap_t *m_tilemap_rot; - tilemap_t *m_tilemap_sub_bg; - tilemap_t *m_tilemap_sub_fg; - tilemap_t *m_tilemap_sub_rot; DECLARE_WRITE16_MEMBER(rockn_systemregs_w); DECLARE_WRITE16_MEMBER(rocknms_sub_systemregs_w); DECLARE_READ16_MEMBER(rockn_adpcmbank_r); @@ -149,6 +102,59 @@ public: void rocknms_main_map(address_map &map); void rocknms_sub_map(address_map &map); void tetrisp2_map(address_map &map); + +protected: + virtual void machine_start() override { m_led.resolve(); } + + required_device m_maincpu; + optional_device m_subcpu; + + required_shared_ptr m_spriteram; + optional_shared_ptr m_spriteram2; + + uint16_t m_systemregs[0x10]; + required_shared_ptr m_vram_fg; + required_shared_ptr m_vram_bg; + required_shared_ptr m_vram_rot; + required_shared_ptr m_nvram; + required_shared_ptr m_scroll_fg; + required_shared_ptr m_scroll_bg; + required_shared_ptr m_rotregs; + std::unique_ptr m_priority; + optional_shared_ptr m_rocknms_sub_priority; + optional_shared_ptr m_rocknms_sub_vram_rot; + optional_shared_ptr m_rocknms_sub_vram_fg; + optional_shared_ptr m_rocknms_sub_vram_bg; + optional_shared_ptr m_rocknms_sub_scroll_fg; + optional_shared_ptr m_rocknms_sub_scroll_bg; + optional_shared_ptr m_rocknms_sub_rotregs; + required_device m_gfxdecode; + optional_device m_sub_gfxdecode; + required_device m_palette; + optional_device m_sub_palette; + required_shared_ptr m_paletteram; + optional_shared_ptr m_sub_paletteram; + output_finder<45> m_led; + + uint16_t m_rocknms_sub_systemregs[0x10]; + uint16_t m_rockn_protectdata; + uint16_t m_rockn_adpcmbank; + uint16_t m_rockn_soundvolume; + emu_timer *m_rockn_timer_l4; + emu_timer *m_rockn_timer_sub_l4; + emu_timer *m_rockn_timer_l1; + emu_timer *m_rockn_timer_sub_l1; + int m_bank_lo; + int m_bank_hi; + uint16_t m_rocknms_main2sub; + uint16_t m_rocknms_sub2main; + int m_flipscreen_old; + tilemap_t *m_tilemap_bg; + tilemap_t *m_tilemap_fg; + tilemap_t *m_tilemap_rot; + tilemap_t *m_tilemap_sub_bg; + tilemap_t *m_tilemap_sub_fg; + tilemap_t *m_tilemap_sub_rot; }; class stepstag_state : public tetrisp2_state diff --git a/src/mame/includes/tiki100.h b/src/mame/includes/tiki100.h index 35861655818..101e1c4fd3f 100644 --- a/src/mame/includes/tiki100.h +++ b/src/mame/includes/tiki100.h @@ -63,7 +63,8 @@ public: m_st_io(*this, "ST"), m_palette(*this, "palette"), m_rome(1), - m_vire(1) + m_vire(1), + m_led(*this, "led%u", 0U) { } uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); @@ -149,6 +150,8 @@ protected: // serial state bool m_st; + + output_finder<3> m_led; }; #endif // MAME_INCLUDES_TIKI100_H diff --git a/src/mame/includes/tmc1800.h b/src/mame/includes/tmc1800.h index eb46a663523..7fabc43512c 100644 --- a/src/mame/includes/tmc1800.h +++ b/src/mame/includes/tmc1800.h @@ -26,24 +26,24 @@ class tmc1800_base_state : public driver_device { public: tmc1800_base_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, CDP1802_TAG), - m_cassette(*this, "cassette"), - m_rom(*this, CDP1802_TAG), - m_run(*this, "RUN"), - m_ram(*this, RAM_TAG), - m_beeper(*this, "beeper") + : driver_device(mconfig, type, tag) + , m_maincpu(*this, CDP1802_TAG) + , m_cassette(*this, "cassette") + , m_rom(*this, CDP1802_TAG) + , m_run(*this, "RUN") + , m_ram(*this, RAM_TAG) + , m_beeper(*this, "beeper") { } + DECLARE_QUICKLOAD_LOAD_MEMBER( tmc1800 ); +protected: required_device m_maincpu; required_device m_cassette; required_memory_region m_rom; required_ioport m_run; required_device m_ram; optional_device m_beeper; - - DECLARE_QUICKLOAD_LOAD_MEMBER( tmc1800 ); }; class tmc1800_state : public tmc1800_base_state @@ -55,15 +55,10 @@ public: }; tmc1800_state(const machine_config &mconfig, device_type type, const char *tag) - : tmc1800_base_state(mconfig, type, tag), - m_vdc(*this, CDP1861_TAG) + : tmc1800_base_state(mconfig, type, tag) + , m_vdc(*this, CDP1861_TAG) { } - required_device m_vdc; - - virtual void machine_start() override; - virtual void machine_reset() override; - DECLARE_WRITE8_MEMBER( keylatch_w ); DECLARE_READ8_MEMBER( dispon_r ); DECLARE_WRITE8_MEMBER( dispoff_w ); @@ -72,16 +67,21 @@ public: DECLARE_READ_LINE_MEMBER( ef3_r ); DECLARE_WRITE_LINE_MEMBER( q_w ); - /* keyboard state */ - int m_keylatch; /* key latch */ void init_tmc1800(); void tmc1800(machine_config &config); void tmc1800_video(machine_config &config); void tmc1800_io_map(address_map &map); void tmc1800_map(address_map &map); + protected: + virtual void machine_start() override; + virtual void machine_reset() override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + + required_device m_vdc; + /* keyboard state */ + int m_keylatch; /* key latch */ }; class osc1000b_state : public tmc1800_base_state @@ -92,9 +92,6 @@ public: { } - virtual void machine_start() override; - virtual void machine_reset() override; - uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); DECLARE_WRITE8_MEMBER( keylatch_w ); @@ -103,31 +100,30 @@ public: DECLARE_READ_LINE_MEMBER( ef3_r ); DECLARE_WRITE_LINE_MEMBER( q_w ); - /* keyboard state */ - int m_keylatch; void osc1000b(machine_config &config); void osc1000b_video(machine_config &config); void osc1000b_io_map(address_map &map); void osc1000b_map(address_map &map); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + + /* keyboard state */ + int m_keylatch; }; class tmc2000_state : public tmc1800_base_state { public: tmc2000_state(const machine_config &mconfig, device_type type, const char *tag) - : tmc1800_base_state(mconfig, type, tag), - m_cti(*this, CDP1864_TAG), - m_colorram(*this, "color_ram"), - m_key_row(*this, {"Y0", "Y1", "Y2", "Y3", "Y4", "Y5", "Y6", "Y7"}) + : tmc1800_base_state(mconfig, type, tag) + , m_cti(*this, CDP1864_TAG) + , m_colorram(*this, "color_ram") + , m_key_row(*this, {"Y0", "Y1", "Y2", "Y3", "Y4", "Y5", "Y6", "Y7"}) + , m_led(*this, "led%u", 0U) { } - required_device m_cti; - optional_shared_ptr m_colorram; - required_ioport_array<8> m_key_row; - - virtual void machine_start() override; - virtual void machine_reset() override; - DECLARE_WRITE8_MEMBER( keylatch_w ); DECLARE_WRITE8_MEMBER( bankswitch_w ); DECLARE_READ_LINE_MEMBER( clear_r ); @@ -142,6 +138,20 @@ public: void bankswitch(); + void tmc2000(machine_config &config); + void tmc2000_video(machine_config &config); + void tmc2000_io_map(address_map &map); + void tmc2000_map(address_map &map); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + + required_device m_cti; + optional_shared_ptr m_colorram; + required_ioport_array<8> m_key_row; + output_finder<2> m_led; + // memory int m_rac; int m_roc; @@ -151,32 +161,20 @@ public: /* keyboard state */ int m_keylatch; - void tmc2000(machine_config &config); - void tmc2000_video(machine_config &config); - void tmc2000_io_map(address_map &map); - void tmc2000_map(address_map &map); }; class nano_state : public tmc1800_base_state { public: nano_state(const machine_config &mconfig, device_type type, const char *tag) - : tmc1800_base_state(mconfig, type, tag), - m_cti(*this, CDP1864_TAG), - m_ny0(*this, "NY0"), - m_ny1(*this, "NY1"), - m_monitor(*this, "MONITOR") + : tmc1800_base_state(mconfig, type, tag) + , m_cti(*this, CDP1864_TAG) + , m_ny0(*this, "NY0") + , m_ny1(*this, "NY1") + , m_monitor(*this, "MONITOR") + , m_led(*this, "led%u", 0U) { } - required_device m_cti; - required_ioport m_ny0; - required_ioport m_ny1; - required_ioport m_monitor; - - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; - virtual void machine_start() override; - virtual void machine_reset() override; - enum { TIMER_ID_EF4 @@ -191,12 +189,23 @@ public: DECLARE_INPUT_CHANGED_MEMBER( run_pressed ); DECLARE_INPUT_CHANGED_MEMBER( monitor_pressed ); - /* keyboard state */ - int m_keylatch; /* key latch */ void nano(machine_config &config); void nano_video(machine_config &config); void nano_io_map(address_map &map); void nano_map(address_map &map); + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + virtual void machine_start() override; + virtual void machine_reset() override; + + required_device m_cti; + required_ioport m_ny0; + required_ioport m_ny1; + required_ioport m_monitor; + output_finder<2> m_led; + /* keyboard state */ + int m_keylatch; /* key latch */ }; #endif diff --git a/src/mame/includes/tmc2000e.h b/src/mame/includes/tmc2000e.h index e77ce889452..781f2197be8 100644 --- a/src/mame/includes/tmc2000e.h +++ b/src/mame/includes/tmc2000e.h @@ -22,25 +22,16 @@ class tmc2000e_state : public driver_device { public: tmc2000e_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, CDP1802_TAG), - m_cti(*this, CDP1864_TAG), - m_cassette(*this, "cassette"), - m_colorram(*this, "colorram"), - m_key_row(*this, {"Y0", "Y1", "Y2", "Y3", "Y4", "Y5", "Y6", "Y7"}), - m_run(*this, "RUN") + : driver_device(mconfig, type, tag) + , m_maincpu(*this, CDP1802_TAG) + , m_cti(*this, CDP1864_TAG) + , m_cassette(*this, "cassette") + , m_colorram(*this, "colorram") + , m_key_row(*this, {"Y0", "Y1", "Y2", "Y3", "Y4", "Y5", "Y6", "Y7"}) + , m_run(*this, "RUN") + , m_led(*this, "led%u", 0U) { } - required_device m_maincpu; - required_device m_cti; - required_device m_cassette; - required_shared_ptr m_colorram; - required_ioport_array<8> m_key_row; - required_ioport m_run; - - virtual void machine_start() override; - virtual void machine_reset() override; - DECLARE_READ8_MEMBER( vismac_r ); DECLARE_WRITE8_MEMBER( vismac_w ); DECLARE_READ8_MEMBER( floppy_r ); @@ -69,6 +60,18 @@ public: void tmc2000e(machine_config &config); void tmc2000e_io_map(address_map &map); void tmc2000e_map(address_map &map); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + + required_device m_maincpu; + required_device m_cti; + required_device m_cassette; + required_shared_ptr m_colorram; + required_ioport_array<8> m_key_row; + required_ioport m_run; + output_finder<2> m_led; }; #endif diff --git a/src/mame/includes/triplhnt.h b/src/mame/includes/triplhnt.h index 074eb640f86..3f0b5de52ed 100644 --- a/src/mame/includes/triplhnt.h +++ b/src/mame/includes/triplhnt.h @@ -47,7 +47,8 @@ public: m_vpos_ram(*this, "vpos_ram"), m_hpos_ram(*this, "hpos_ram"), m_orga_ram(*this, "orga_ram"), - m_code_ram(*this, "code_ram") + m_code_ram(*this, "code_ram"), + m_lamp(*this, "lamp0") { } void init_triplhnt(); @@ -75,6 +76,7 @@ protected: void set_collision(int code); virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + virtual void machine_start() override; void triplhnt_map(address_map &map); private: @@ -92,6 +94,7 @@ private: required_shared_ptr m_hpos_ram; required_shared_ptr m_orga_ram; required_shared_ptr m_code_ram; + output_finder<> m_lamp; uint8_t m_cmos[16]; uint8_t m_da_latch; diff --git a/src/mame/includes/tunhunt.h b/src/mame/includes/tunhunt.h index c8ec1f281ec..1023c7d8ea8 100644 --- a/src/mame/includes/tunhunt.h +++ b/src/mame/includes/tunhunt.h @@ -19,7 +19,8 @@ public: m_workram(*this, "workram"), m_videoram(*this, "videoram"), m_spriteram(*this, "spriteram"), - m_generic_paletteram_8(*this, "paletteram") + m_generic_paletteram_8(*this, "paletteram"), + m_led(*this, "led0") { } void tunhunt(machine_config &config); @@ -36,6 +37,7 @@ protected: TILE_GET_INFO_MEMBER(get_fg_tile_info); + virtual void machine_start() override { m_led.resolve(); } virtual void video_start() override; DECLARE_PALETTE_INIT(tunhunt); @@ -57,6 +59,7 @@ private: required_shared_ptr m_videoram; required_shared_ptr m_spriteram; required_shared_ptr m_generic_paletteram_8; + output_finder<> m_led; uint8_t m_control; tilemap_t *m_fg_tilemap; diff --git a/src/mame/includes/turbo.h b/src/mame/includes/turbo.h index e14e4f89ea1..e8b3cb3b0e8 100644 --- a/src/mame/includes/turbo.h +++ b/src/mame/includes/turbo.h @@ -41,6 +41,7 @@ public: , m_gfxdecode(*this, "gfxdecode") , m_screen(*this, "screen") , m_digits(*this, "digit%u", 0U) + , m_lamp(*this, "lamp") { } private: @@ -67,9 +68,10 @@ private: required_device m_gfxdecode; required_device m_screen; output_finder<32> m_digits; + output_finder<> m_lamp; std::unique_ptr m_buckrog_bitmap_ram; - virtual void machine_start() override { m_digits.resolve(); } + virtual void machine_start() override { m_digits.resolve(); m_lamp.resolve(); } /* machine states */ uint8_t m_i8279_scanlines; diff --git a/src/mame/includes/unico.h b/src/mame/includes/unico.h index 500e836d57c..8bf66dfbe35 100644 --- a/src/mame/includes/unico.h +++ b/src/mame/includes/unico.h @@ -15,6 +15,7 @@ public: unico_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_palette(*this, "palette"), + m_led(*this, "led%u", 0U), m_maincpu(*this, "maincpu"), m_oki(*this, "oki"), m_gfxdecode(*this, "gfxdecode"), @@ -34,6 +35,7 @@ protected: DECLARE_WRITE16_MEMBER(burglarx_sound_bank_w); TILE_GET_INFO_MEMBER(get_tile_info); + virtual void machine_start() override; virtual void video_start() override; uint32_t screen_update_unico(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void unico_draw_sprites(screen_device &screen, bitmap_ind16 &bitmap,const rectangle &cliprect); @@ -41,6 +43,7 @@ protected: void burglarx_map(address_map &map); required_device m_palette; + output_finder<2> m_led; private: std::unique_ptr m_vram; diff --git a/src/mame/includes/victory.h b/src/mame/includes/victory.h index 0db8f44943c..a1c107bbd4f 100644 --- a/src/mame/includes/victory.h +++ b/src/mame/includes/victory.h @@ -33,9 +33,9 @@ public: m_screen(*this, "screen"), m_palette(*this, "palette"), m_videoram(*this, "videoram"), - m_charram(*this, "charram") - { - } + m_charram(*this, "charram"), + m_lamp(*this, "lamp%u", 0U) + { } void victory(machine_config &config); @@ -61,6 +61,7 @@ protected: void update_background(); void update_foreground(); + virtual void machine_start() override { m_lamp.resolve(); } virtual void video_start() override; void victory_audio(machine_config &config); void main_io_map(address_map &map); @@ -89,6 +90,7 @@ private: required_shared_ptr m_videoram; required_shared_ptr m_charram; + output_finder<4> m_lamp; uint16_t m_paletteram[0x40]; std::unique_ptr m_bgbitmap; diff --git a/src/mame/includes/videopin.h b/src/mame/includes/videopin.h index 31049b7fa07..adf911badd6 100644 --- a/src/mame/includes/videopin.h +++ b/src/mame/includes/videopin.h @@ -37,7 +37,8 @@ public: m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), m_palette(*this, "palette"), - m_video_ram(*this, "video_ram") + m_video_ram(*this, "video_ram"), + m_led(*this, "led0") { } void videopin(machine_config &config); @@ -74,6 +75,7 @@ private: required_device m_palette; required_shared_ptr m_video_ram; + output_finder<> m_led; attotime m_time_pushed; attotime m_time_released; diff --git a/src/mame/includes/vip.h b/src/mame/includes/vip.h index 1a1fdd01cc0..f90aedaacec 100644 --- a/src/mame/includes/vip.h +++ b/src/mame/includes/vip.h @@ -24,51 +24,35 @@ class vip_state : public driver_device { public: vip_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, CDP1802_TAG), - m_vdc(*this, CDP1861_TAG), - m_cassette(*this, "cassette"), - m_beeper(*this, DISCRETE_TAG), - m_byteio(*this, VIP_BYTEIO_PORT_TAG), - m_exp(*this, VIP_EXPANSION_SLOT_TAG), - m_ram(*this, RAM_TAG), - m_rom(*this, CDP1802_TAG), - m_chip8(*this, "chip8"), - m_chip8x(*this, "chip8x"), - m_run(*this, "RUN"), - m_keypad(*this, "KEYPAD"), - m_io_beeper(*this, "BEEPER"), - m_8000(1), - m_vdc_int(CLEAR_LINE), - m_vdc_dma_out(CLEAR_LINE), - m_vdc_ef1(CLEAR_LINE), - m_exp_int(CLEAR_LINE), - m_exp_dma_out(CLEAR_LINE), - m_exp_dma_in(CLEAR_LINE), - m_byteio_ef3(CLEAR_LINE), - m_byteio_ef4(CLEAR_LINE), - m_exp_ef1(CLEAR_LINE), - m_exp_ef3(CLEAR_LINE), - m_exp_ef4(CLEAR_LINE) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, CDP1802_TAG) + , m_vdc(*this, CDP1861_TAG) + , m_cassette(*this, "cassette") + , m_beeper(*this, DISCRETE_TAG) + , m_byteio(*this, VIP_BYTEIO_PORT_TAG) + , m_exp(*this, VIP_EXPANSION_SLOT_TAG) + , m_ram(*this, RAM_TAG) + , m_rom(*this, CDP1802_TAG) + , m_chip8(*this, "chip8") + , m_chip8x(*this, "chip8x") + , m_run(*this, "RUN") + , m_keypad(*this, "KEYPAD") + , m_io_beeper(*this, "BEEPER") + , m_8000(1) + , m_vdc_int(CLEAR_LINE) + , m_vdc_dma_out(CLEAR_LINE) + , m_vdc_ef1(CLEAR_LINE) + , m_exp_int(CLEAR_LINE) + , m_exp_dma_out(CLEAR_LINE) + , m_exp_dma_in(CLEAR_LINE) + , m_byteio_ef3(CLEAR_LINE) + , m_byteio_ef4(CLEAR_LINE) + , m_exp_ef1(CLEAR_LINE) + , m_exp_ef3(CLEAR_LINE) + , m_exp_ef4(CLEAR_LINE) + , m_led(*this, "led%u", 0U) { } - required_device m_maincpu; - required_device m_vdc; - required_device m_cassette; - required_device m_beeper; - required_device m_byteio; - required_device m_exp; - required_device m_ram; - required_memory_region m_rom; - required_memory_region m_chip8; - required_memory_region m_chip8x; - required_ioport m_run; - required_ioport m_keypad; - required_ioport m_io_beeper; - - virtual void machine_start() override; - virtual void machine_reset() override; - uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); void update_interrupts(); @@ -102,6 +86,29 @@ public: DECLARE_INPUT_CHANGED_MEMBER( beeper_w ); DECLARE_QUICKLOAD_LOAD_MEMBER( vip ); + void vp111(machine_config &config); + void vip(machine_config &config); + void vip_io(address_map &map); + void vip_mem(address_map &map); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + + required_device m_maincpu; + required_device m_vdc; + required_device m_cassette; + required_device m_beeper; + required_device m_byteio; + required_device m_exp; + required_device m_ram; + required_memory_region m_rom; + required_memory_region m_chip8; + required_memory_region m_chip8x; + required_ioport m_run; + required_ioport m_keypad; + required_ioport m_io_beeper; + // memory state int m_8000; @@ -123,10 +130,7 @@ public: // expansion state uint8_t m_byteio_data; - void vp111(machine_config &config); - void vip(machine_config &config); - void vip_io(address_map &map); - void vip_mem(address_map &map); + output_finder<3> m_led; }; #endif diff --git a/src/mame/includes/wolfpack.h b/src/mame/includes/wolfpack.h index d170a712296..663e3c1edfc 100644 --- a/src/mame/includes/wolfpack.h +++ b/src/mame/includes/wolfpack.h @@ -28,7 +28,8 @@ public: m_s14001a(*this, "speech"), m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), - m_palette(*this, "palette") + m_palette(*this, "palette"), + m_led(*this, "led0") { } DECLARE_CUSTOM_INPUT_MEMBER(dial_r); @@ -88,6 +89,7 @@ private: required_device m_gfxdecode; required_device m_screen; required_device m_palette; + output_finder<> m_led; bool m_collision; unsigned m_current_index; diff --git a/src/mame/machine/ajax.cpp b/src/mame/machine/ajax.cpp index d79a19b3477..c278cc7b3cc 100644 --- a/src/mame/machine/ajax.cpp +++ b/src/mame/machine/ajax.cpp @@ -79,14 +79,14 @@ WRITE8_MEMBER(ajax_state::bankswitch_w) WRITE8_MEMBER(ajax_state::lamps_w) { - output().set_led_value(1, data & 0x02); /* super weapon lamp */ - output().set_led_value(2, data & 0x04); /* power up lamps */ - output().set_led_value(5, data & 0x04); /* power up lamps */ - output().set_led_value(0, data & 0x20); /* start lamp */ - output().set_led_value(3, data & 0x40); /* game over lamps */ - output().set_led_value(6, data & 0x40); /* game over lamps */ - output().set_led_value(4, data & 0x80); /* game over lamps */ - output().set_led_value(7, data & 0x80); /* game over lamps */ + m_lamp[1] = BIT(data, 1); /* super weapon lamp */ + m_lamp[2] = BIT(data, 2); /* power up lamps */ + m_lamp[5] = BIT(data, 2); /* power up lamps */ + m_lamp[0] = BIT(data, 5); /* start lamp */ + m_lamp[3] = BIT(data, 6); /* game over lamps */ + m_lamp[6] = BIT(data, 6); /* game over lamps */ + m_lamp[4] = BIT(data, 7); /* game over lamps */ + m_lamp[7] = BIT(data, 7); /* game over lamps */ } /* ajax_ls138_f10: @@ -199,6 +199,7 @@ void ajax_state::machine_start() uint8_t *MAIN = memregion("maincpu")->base(); uint8_t *SUB = memregion("sub")->base(); + m_lamp.resolve(); membank("mainbank")->configure_entries(0, 4, &MAIN[0x00000], 0x2000); membank("mainbank")->configure_entries(4, 8, &MAIN[0x10000], 0x2000); membank("subbank")->configure_entries(0, 9, &SUB[0x00000], 0x2000); diff --git a/src/mame/machine/amiga.cpp b/src/mame/machine/amiga.cpp index fffa5566d0b..feb3c25c4ff 100644 --- a/src/mame/machine/amiga.cpp +++ b/src/mame/machine/amiga.cpp @@ -151,6 +151,8 @@ constexpr XTAL amiga_state::CLK_E_NTSC; void amiga_state::machine_start() { + m_power_led.resolve(); + // add callback for RESET instruction m_maincpu->set_reset_callback(write_line_delegate(FUNC(amiga_state::m68k_reset), this)); @@ -1097,8 +1099,7 @@ WRITE8_MEMBER( amiga_state::cia_0_port_a_write ) m_overlay->set_bank(BIT(data, 0)); // bit 1, power led - output().set_led_value(0, !BIT(data, 1)); - output().set_value("power_led", !BIT(data, 1)); + m_power_led = BIT(~data, 1); } WRITE_LINE_MEMBER( amiga_state::cia_0_irq ) diff --git a/src/mame/machine/atarifb.cpp b/src/mame/machine/atarifb.cpp index 5917fb05ef1..5ab2efca34f 100644 --- a/src/mame/machine/atarifb.cpp +++ b/src/mame/machine/atarifb.cpp @@ -76,8 +76,8 @@ WRITE8_MEMBER(atarifb_state::soccer_out1_w) m_discrete->write(space, ATARIFB_ATTRACT_EN, data & 0x10); // Attract m_discrete->write(space, ATARIFB_NOISE_EN, data & 0x04); // Noise Enable / Kicker -// output().set_led_value(0, data & 0x10); // !!!!!!!!!! Is this correct???? - output().set_led_value(1, data & 0x80); +// m_led[0] = BIT(data, 4); // !!!!!!!!!! Is this correct???? + m_led[1] = BIT(data, 7); } diff --git a/src/mame/machine/compiskb.cpp b/src/mame/machine/compiskb.cpp index 5bd963fde4c..765cef9582d 100644 --- a/src/mame/machine/compiskb.cpp +++ b/src/mame/machine/compiskb.cpp @@ -228,7 +228,7 @@ compis_keyboard_device::compis_keyboard_device(const machine_config &mconfig, co m_y(*this, "Y%u", 1), m_special(*this, "SPECIAL"), m_out_tx_handler(*this), - m_bus(0xff), + m_led_caps(*this, "led_caps"), m_keylatch(0) { } @@ -297,7 +297,7 @@ WRITE8_MEMBER( compis_keyboard_device::bus_w ) m_speaker->level_w(BIT(data, 5)); // LEDs - machine().output().set_led_value(LED_CAPS, BIT(data, 6)); + m_led_caps = BIT(data, 6); // serial data out m_out_tx_handler(BIT(data, 7)); diff --git a/src/mame/machine/compiskb.h b/src/mame/machine/compiskb.h index 86d3b154577..3d13cb2fcbb 100644 --- a/src/mame/machine/compiskb.h +++ b/src/mame/machine/compiskb.h @@ -51,16 +51,12 @@ protected: virtual ioport_constructor device_input_ports() const override; private: - enum - { - LED_CAPS - }; - required_device m_maincpu; required_device m_speaker; required_ioport_array<9> m_y; required_ioport m_special; devcb_write_line m_out_tx_handler; + output_finder<> m_led_caps; uint8_t m_bus; uint8_t m_keylatch; diff --git a/src/mame/machine/galaxold.cpp b/src/mame/machine/galaxold.cpp index a63108c52ec..f8fab4ba017 100644 --- a/src/mame/machine/galaxold.cpp +++ b/src/mame/machine/galaxold.cpp @@ -109,7 +109,7 @@ WRITE8_MEMBER(galaxold_state::galaxold_coin_counter_2_w) WRITE8_MEMBER(galaxold_state::galaxold_leds_w) { - output().set_led_value(offset,data & 1); + m_led[offset] = BIT(data, 0); } READ8_MEMBER(galaxold_state::scramblb_protection_1_r) diff --git a/src/mame/machine/harddriv.cpp b/src/mame/machine/harddriv.cpp index 25cb9753f95..817ed77db22 100644 --- a/src/mame/machine/harddriv.cpp +++ b/src/mame/machine/harddriv.cpp @@ -37,6 +37,7 @@ void harddriv_state::device_start() { + m_lamp.resolve(); //atarigen_state::machine_start(); /* predetermine memory regions */ @@ -415,11 +416,11 @@ WRITE16_MEMBER( harddriv_state::hd68k_nwr_w ) break; case 2: /* LC1 */ // used for seat locking on harddriv - machine().output().set_led_value(1, data); + m_lamp[1] = data; break; case 3: /* LC2 */ // used for "abort" button lamp - machine().output().set_led_value(2, data); + m_lamp[2] = data; break; case 4: /* ZP1 */ m_m68k_zp1 = data; diff --git a/src/mame/machine/irobot.cpp b/src/mame/machine/irobot.cpp index 1d12f901c8a..c16cba0571d 100644 --- a/src/mame/machine/irobot.cpp +++ b/src/mame/machine/irobot.cpp @@ -140,8 +140,8 @@ WRITE8_MEMBER(irobot_state::irobot_rom_banksel_w) membank("bank1")->set_base(&RAM[0x1A000]); break; } - output().set_led_value(0,data & 0x10); - output().set_led_value(1,data & 0x20); + m_led[0] = BIT(data, 4); + m_led[1] = BIT(data, 5); } TIMER_CALLBACK_MEMBER(irobot_state::scanline_callback) diff --git a/src/mame/machine/mhavoc.cpp b/src/mame/machine/mhavoc.cpp index 81a4b93db40..3c075767ed9 100644 --- a/src/mame/machine/mhavoc.cpp +++ b/src/mame/machine/mhavoc.cpp @@ -66,6 +66,8 @@ WRITE8_MEMBER(mhavoc_state::mhavoc_gamma_irq_ack_w) void mhavoc_state::machine_start() { + m_lamp.resolve(); + save_item(NAME(m_alpha_data)); save_item(NAME(m_alpha_rcvd)); save_item(NAME(m_alpha_xmtd)); @@ -269,17 +271,17 @@ WRITE8_MEMBER(mhavoc_state::mhavoc_out_0_w) /* this is the unpopulated processor in the corner of the pcb farthest from the quad pokey, not used on shipping boards */ /* Bit 0 = Roller light (Blinks on fatal errors) */ - output().set_led_value(0, data & 0x01); + m_lamp[0] = BIT(data, 0); } WRITE8_MEMBER(mhavoc_state::alphaone_out_0_w) { /* Bit 5 = P2 lamp */ - output().set_led_value(0, ~data & 0x20); + m_lamp[0] = BIT(~data, 5); /* Bit 4 = P1 lamp */ - output().set_led_value(1, ~data & 0x10); + m_lamp[1] = BIT(~data, 4); /* Bit 1 = right coin counter */ machine().bookkeeping().coin_counter_w(1, data & 0x02); diff --git a/src/mame/machine/microtan.cpp b/src/mame/machine/microtan.cpp index bc7e02e8ab8..07acc1cdc21 100644 --- a/src/mame/machine/microtan.cpp +++ b/src/mame/machine/microtan.cpp @@ -358,7 +358,7 @@ INTERRUPT_GEN_MEMBER(microtan_state::microtan_interrupt) m_lastrow = row; /* CapsLock LED */ if( row == 3 && chg == 0x80 ) - output().set_led_value(1, (m_keyrows[3] & 0x80) ? 0 : 1); + m_led[1] = BIT(~m_keyrows[3], 7); if (newvar & chg) /* key(s) pressed ? */ { @@ -514,7 +514,7 @@ void microtan_state::machine_reset() { m_keyrows[i] = ioport(keynames[i-1])->read(); } - output().set_led_value(1, (m_keyrows[3] & 0x80) ? 0 : 1); + m_led[1] = BIT(~m_keyrows[3], 7); } image_verify_result microtan_state::microtan_verify_snapshot(uint8_t *data, int size) diff --git a/src/mame/machine/mmboard.cpp b/src/mame/machine/mmboard.cpp index 0ceef258991..55d237aff54 100644 --- a/src/mame/machine/mmboard.cpp +++ b/src/mame/machine/mmboard.cpp @@ -204,6 +204,7 @@ ioport_constructor mephisto_buttons_board_device::device_input_ports() const mephisto_board_device::mephisto_board_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, type, tag, owner, clock) , m_sensors(*this, "IN.%u", 0) + , m_led(*this, "led%u", 0U) , m_disable_leds(false) { } @@ -231,6 +232,7 @@ mephisto_buttons_board_device::mephisto_buttons_board_device(const machine_confi void mephisto_board_device::device_start() { + m_led.resolve(); m_leds_update_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mephisto_board_device::leds_update_callback), this)); m_leds_refresh_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mephisto_board_device::leds_refresh_callback), this)); m_leds_update_timer->adjust(attotime::from_hz(60), 0, attotime::from_hz(60)); @@ -268,7 +270,7 @@ TIMER_CALLBACK_MEMBER(mephisto_board_device::leds_refresh_callback) for (int j=0; j<8; j++) { if (!m_disable_leds) - machine().output().set_led_value(i*8 + j, (m_leds_state[i*8 + j] > 1) ? 1 : 0); + m_led[i*8 + j] = (m_leds_state[i*8 + j] > 1) ? 1 : 0; if (m_leds_state[i*8 + j]) m_leds_state[i*8 + j]--; diff --git a/src/mame/machine/mmboard.h b/src/mame/machine/mmboard.h index ec3e4cdd9dc..b0c612a2681 100644 --- a/src/mame/machine/mmboard.h +++ b/src/mame/machine/mmboard.h @@ -65,6 +65,7 @@ protected: private: required_ioport_array<8> m_sensors; + output_finder<256> m_led; emu_timer * m_leds_update_timer; emu_timer * m_leds_refresh_timer; bool m_disable_leds; diff --git a/src/mame/machine/msx.cpp b/src/mame/machine/msx.cpp index 28daab967be..4f07d97e20d 100644 --- a/src/mame/machine/msx.cpp +++ b/src/mame/machine/msx.cpp @@ -58,6 +58,7 @@ void msx_state::machine_reset() void msx_state::machine_start() { + m_led.resolve(); m_port_c_old = 0xff; for (device_t &device : device_iterator(*this)) @@ -295,7 +296,7 @@ WRITE8_MEMBER(msx_state::msx_psg_port_b_w) { /* Arabic or kana mode led */ if ( (data ^ m_psg_b) & 0x80) - output().set_led_value(2, !(data & 0x80) ); + m_led[2] = BIT(~data, 7); if ( (m_psg_b ^ data) & 0x10) { @@ -349,7 +350,7 @@ WRITE8_MEMBER( msx_state::msx_ppi_port_c_w ) /* caps lock */ if ( BIT(m_port_c_old ^ data, 6) ) - output().set_led_value(1, !BIT(data, 6) ); + m_led[1] = BIT(~data, 6); /* key click */ if ( BIT(m_port_c_old ^ data, 7) ) diff --git a/src/mame/machine/nb1413m3.cpp b/src/mame/machine/nb1413m3.cpp index f5602e5f64e..2145a56b72e 100644 --- a/src/mame/machine/nb1413m3.cpp +++ b/src/mame/machine/nb1413m3.cpp @@ -24,8 +24,8 @@ Memo: DEFINE_DEVICE_TYPE(NB1413M3, nb1413m3_device, "nb1413m3", "NB1413 Mahjong Custom") -nb1413m3_device::nb1413m3_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, NB1413M3, tag, owner, clock), +nb1413m3_device::nb1413m3_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, NB1413M3, tag, owner, clock), m_maincpu(*this, "^maincpu"), m_sndromrgntag("voice"), m_sndrombank1(0), @@ -42,7 +42,8 @@ nb1413m3_device::nb1413m3_device(const machine_config &mconfig, const char *tag, m_gfxradr_l(0), m_gfxradr_h(0), m_gfxrombank(0), - m_outcoin_enable(0) + m_outcoin_enable(0), + m_led(*this, "led0") { } @@ -53,6 +54,7 @@ nb1413m3_device::nb1413m3_device(const machine_config &mconfig, const char *tag, void nb1413m3_device::device_start() { + m_led.resolve(); m_timer_cb = timer_alloc(TIMER_CB); m_timer_cb->adjust(attotime::zero); @@ -599,7 +601,7 @@ WRITE8_MEMBER( nb1413m3_device::outcoin_w ) break; } - machine().output().set_led_value(2, m_outcoin_flag); // out coin + m_led = m_outcoin_flag; // out coin } WRITE8_MEMBER( nb1413m3_device::vcrctrl_w ) @@ -607,11 +609,11 @@ WRITE8_MEMBER( nb1413m3_device::vcrctrl_w ) if (data & 0x08) { popmessage(" ** VCR CONTROL ** "); - machine().output().set_led_value(2, 1); + m_led = 1; } else { - machine().output().set_led_value(2, 0); + m_led = 0; } } diff --git a/src/mame/machine/nb1413m3.h b/src/mame/machine/nb1413m3.h index 7732cfc8dbb..3c2c8001edf 100644 --- a/src/mame/machine/nb1413m3.h +++ b/src/mame/machine/nb1413m3.h @@ -189,6 +189,7 @@ private: int m_gfxrombank; int m_outcoin_enable; emu_timer *m_timer_cb; + output_finder<> m_led; TIMER_CALLBACK_MEMBER( timer_callback ); }; diff --git a/src/mame/machine/nitedrvr.cpp b/src/mame/machine/nitedrvr.cpp index a7e97f5832c..437f393dc2b 100644 --- a/src/mame/machine/nitedrvr.cpp +++ b/src/mame/machine/nitedrvr.cpp @@ -227,7 +227,7 @@ D5 = Spare (Not used) WRITE8_MEMBER(nitedrvr_state::nitedrvr_out1_w) { - output().set_led_value(0, data & 0x10); + m_led = BIT(data, 4); m_crash_en = data & 0x01; @@ -274,6 +274,8 @@ TIMER_DEVICE_CALLBACK_MEMBER(nitedrvr_state::nitedrvr_crash_toggle_callback) void nitedrvr_state::machine_start() { + m_led.resolve(); + save_item(NAME(m_gear)); save_item(NAME(m_track)); save_item(NAME(m_steering_buf)); diff --git a/src/mame/machine/pc1512kb.cpp b/src/mame/machine/pc1512kb.cpp index 54fec692b1a..fd158211230 100644 --- a/src/mame/machine/pc1512kb.cpp +++ b/src/mame/machine/pc1512kb.cpp @@ -204,6 +204,7 @@ pc1512_keyboard_device::pc1512_keyboard_device(const machine_config &mconfig, co m_maincpu(*this, I8048_TAG), m_joy(*this, "joy"), m_y(*this, "Y%u", 1), + m_led(*this, "led%u", 0U), m_write_clock(*this), m_write_data(*this), m_data_in(1), @@ -222,6 +223,7 @@ pc1512_keyboard_device::pc1512_keyboard_device(const machine_config &mconfig, co void pc1512_keyboard_device::device_start() { + m_led.resolve(); // allocate timers m_reset_timer = timer_alloc(); @@ -440,10 +442,10 @@ WRITE8_MEMBER( pc1512_keyboard_device::kb_p2_w ) m_write_clock(BIT(data, 1)); // CAPS LOCK - machine().output().set_led_value(LED_CAPS, BIT(data, 2)); + m_led[LED_CAPS] = BIT(data, 2); // NUM LOCK - machine().output().set_led_value(LED_NUM, BIT(data, 3)); + m_led[LED_NUM] = BIT(data, 3); // keyboard row m_kb_y = (((data >> 4) & 0x07) << 8) | (m_kb_y & 0xff); diff --git a/src/mame/machine/pc1512kb.h b/src/mame/machine/pc1512kb.h index 2789c998b32..903a98ba1bf 100644 --- a/src/mame/machine/pc1512kb.h +++ b/src/mame/machine/pc1512kb.h @@ -79,6 +79,7 @@ private: required_device m_joy; required_ioport_array<11> m_y; + output_finder<2> m_led; devcb_write_line m_write_clock; devcb_write_line m_write_data; diff --git a/src/mame/machine/pmd85.cpp b/src/mame/machine/pmd85.cpp index 1c3fa6c9d41..40b4b21752b 100644 --- a/src/mame/machine/pmd85.cpp +++ b/src/mame/machine/pmd85.cpp @@ -17,7 +17,7 @@ #include "machine/pit8253.h" -enum {PMD85_LED_1, PMD85_LED_2, PMD85_LED_3}; +enum {PMD85_LED_1 = 0, PMD85_LED_2, PMD85_LED_3}; enum {PMD85_1, PMD85_2, PMD85_2A, PMD85_2B, PMD85_3, ALFA, MATO, C2717}; @@ -257,8 +257,8 @@ WRITE8_MEMBER(pmd85_state::pmd85_ppi_0_portb_w) WRITE8_MEMBER(pmd85_state::pmd85_ppi_0_portc_w) { m_ppi_port_outputs[0][2] = data; - output().set_led_value(PMD85_LED_2, (data & 0x08) ? 1 : 0); - output().set_led_value(PMD85_LED_3, (data & 0x04) ? 1 : 0); + m_led[PMD85_LED_2] = BIT(data, 3); + m_led[PMD85_LED_3] = BIT(data, 2); } /******************************************************************************* @@ -290,8 +290,8 @@ READ8_MEMBER(pmd85_state::mato_ppi_0_portc_r) WRITE8_MEMBER(pmd85_state::mato_ppi_0_portc_w) { m_ppi_port_outputs[0][2] = data; - output().set_led_value(PMD85_LED_2, BIT(data, 3)); - output().set_led_value(PMD85_LED_3, BIT(data, 2)); + m_led[PMD85_LED_2] = BIT(data, 3); + m_led[PMD85_LED_3] = BIT(data, 2); } /******************************************************************************* diff --git a/src/mame/machine/sms.cpp b/src/mame/machine/sms.cpp index 2bc272e842a..12e9e66596e 100644 --- a/src/mame/machine/sms.cpp +++ b/src/mame/machine/sms.cpp @@ -306,7 +306,7 @@ WRITE_LINE_MEMBER(sms_state::sms_csync_callback) { m_rapid_read_state = 0x00; // Power LED remains lit again - output().set_led_value(0, 1); + m_led_pwr = 1; } } } @@ -1023,7 +1023,7 @@ void sms_state::setup_bios() } } -MACHINE_START_MEMBER(sms_state,sms) +void sms_state::machine_start() { m_led_pwr.resolve(); @@ -1119,7 +1119,7 @@ MACHINE_START_MEMBER(sms_state,sms) m_cartslot->save_ram(); } -MACHINE_RESET_MEMBER(sms_state,sms) +void sms_state::machine_reset() { if (m_is_smsj) { @@ -1134,7 +1134,7 @@ MACHINE_RESET_MEMBER(sms_state,sms) m_rapid_last_dc = 0xff; m_rapid_last_dd = 0xff; // Power LED remains lit again - output().set_led_value(0, 1); + m_led_pwr = 1; } if (!m_is_mark_iii) @@ -1254,7 +1254,7 @@ void sms_state::init_sg1000m3() m_is_mark_iii = 1; m_has_jpn_sms_cart_slot = 1; // turn on the Power LED - output().set_led_value(0, 1); + m_led_pwr = 1; } @@ -1268,7 +1268,7 @@ void sms_state::init_sms1() { m_has_bios_full = 1; // turn on the Power LED - output().set_led_value(0, 1); + m_led_pwr = 1; } @@ -1279,7 +1279,7 @@ void sms_state::init_smsj() m_ioctrl_region_is_japan = 1; m_has_jpn_sms_cart_slot = 1; // turn on the Power LED - output().set_led_value(0, 1); + m_led_pwr = 1; } @@ -1289,7 +1289,7 @@ void sms_state::init_sms1kr() m_ioctrl_region_is_japan = 1; m_has_jpn_sms_cart_slot = 1; // turn on the Power LED - output().set_led_value(0, 1); + m_led_pwr = 1; } @@ -1312,7 +1312,7 @@ void sms_state::init_gamegear() m_is_gamegear = 1; m_has_bios_0400 = 1; // turn on the Power LED - output().set_led_value(0, 1); + m_led_pwr = 1; } @@ -1322,7 +1322,7 @@ void sms_state::init_gamegeaj() m_has_bios_0400 = 1; m_ioctrl_region_is_japan = 1; // turn on the Power LED - output().set_led_value(0, 1); + m_led_pwr = 1; } diff --git a/src/mame/machine/tandy2kb.cpp b/src/mame/machine/tandy2kb.cpp index 2872e5dd87d..9c11fbeb046 100644 --- a/src/mame/machine/tandy2kb.cpp +++ b/src/mame/machine/tandy2kb.cpp @@ -210,6 +210,7 @@ tandy2k_keyboard_device::tandy2k_keyboard_device(const machine_config &mconfig, device_t(mconfig, TANDY2K_KEYBOARD, tag, owner, clock), m_maincpu(*this, I8048_TAG), m_y(*this, "Y%u", 0), + m_led(*this, "led%u", 0U), m_write_clock(*this), m_write_data(*this), m_keylatch(0xffff), @@ -225,6 +226,7 @@ tandy2k_keyboard_device::tandy2k_keyboard_device(const machine_config &mconfig, void tandy2k_keyboard_device::device_start() { + m_led.resolve(); // resolve callbacks m_write_clock.resolve_safe(); m_write_data.resolve_safe(); @@ -369,8 +371,8 @@ WRITE8_MEMBER( tandy2k_keyboard_device::kb_p2_w ) m_keylatch = ((data & 0x0f) << 8) | (m_keylatch & 0xff); // led output - machine().output().set_led_value(LED_2, !BIT(data, 4)); - machine().output().set_led_value(LED_1, !BIT(data, 5)); + m_led[LED_2] = BIT(~data, 4); + m_led[LED_1] = BIT(~data, 5); // keyboard clock int clock = BIT(data, 6); diff --git a/src/mame/machine/tandy2kb.h b/src/mame/machine/tandy2kb.h index f6a6f1e24eb..ecc9c16cf81 100644 --- a/src/mame/machine/tandy2kb.h +++ b/src/mame/machine/tandy2kb.h @@ -73,6 +73,7 @@ private: required_device m_maincpu; required_ioport_array<12> m_y; + output_finder<2> m_led; devcb_write_line m_write_clock; devcb_write_line m_write_data; diff --git a/src/mame/machine/trs80m2kb.cpp b/src/mame/machine/trs80m2kb.cpp index f69dcc4b0f0..09a7a7d1592 100644 --- a/src/mame/machine/trs80m2kb.cpp +++ b/src/mame/machine/trs80m2kb.cpp @@ -211,6 +211,7 @@ trs80m2_keyboard_device::trs80m2_keyboard_device(const machine_config &mconfig, device_t(mconfig, TRS80M2_KEYBOARD, tag, owner, clock), m_maincpu(*this, I8021_TAG), m_y(*this, "Y%u", 0), + m_led(*this, "led%u", 0U), m_write_clock(*this), m_busy(1), m_data(1), @@ -225,6 +226,7 @@ trs80m2_keyboard_device::trs80m2_keyboard_device(const machine_config &mconfig, void trs80m2_keyboard_device::device_start() { + m_led.resolve(); // resolve callbacks m_write_clock.resolve_safe(); @@ -321,8 +323,8 @@ WRITE8_MEMBER( trs80m2_keyboard_device::kb_p1_w ) m_clk = clk; } - machine().output().set_led_value(LED_0, BIT(data, 2)); - machine().output().set_led_value(LED_1, BIT(data, 4)); + m_led[LED_0] = BIT(data, 2); + m_led[LED_1] = BIT(data, 4); } diff --git a/src/mame/machine/trs80m2kb.h b/src/mame/machine/trs80m2kb.h index 29ff764f31c..2859bdbf1ce 100644 --- a/src/mame/machine/trs80m2kb.h +++ b/src/mame/machine/trs80m2kb.h @@ -68,6 +68,7 @@ private: required_device m_maincpu; required_ioport_array<12> m_y; + output_finder<2> m_led; devcb_write_line m_write_clock; diff --git a/src/mame/machine/v1050kb.cpp b/src/mame/machine/v1050kb.cpp index af29f0441fc..c3720032620 100644 --- a/src/mame/machine/v1050kb.cpp +++ b/src/mame/machine/v1050kb.cpp @@ -290,6 +290,7 @@ v1050_keyboard_device::v1050_keyboard_device(const machine_config &mconfig, cons m_discrete(*this, DISCRETE_TAG), m_y(*this, "Y%u", 0), m_out_tx_handler(*this), + m_led(*this, "led0"), m_keylatch(0) { } @@ -301,6 +302,7 @@ v1050_keyboard_device::v1050_keyboard_device(const machine_config &mconfig, cons void v1050_keyboard_device::device_start() { + m_led.resolve(); // state saving save_item(NAME(m_keylatch)); } @@ -376,7 +378,7 @@ WRITE8_MEMBER( v1050_keyboard_device::kb_p2_w ) */ // led output - machine().output().set_led_value(0, BIT(data, 5)); + m_led = BIT(data, 5); // speaker output m_discrete->write(space, NODE_01, BIT(data, 6)); diff --git a/src/mame/machine/v1050kb.h b/src/mame/machine/v1050kb.h index 231a135b48e..96172ba33ff 100644 --- a/src/mame/machine/v1050kb.h +++ b/src/mame/machine/v1050kb.h @@ -58,6 +58,7 @@ private: required_device m_discrete; required_ioport_array<12> m_y; devcb_write_line m_out_tx_handler; + output_finder<> m_led; uint8_t m_keylatch; diff --git a/src/mame/machine/victor9k_fdc.cpp b/src/mame/machine/victor9k_fdc.cpp index 89909e3237f..c5af61c9060 100644 --- a/src/mame/machine/victor9k_fdc.cpp +++ b/src/mame/machine/victor9k_fdc.cpp @@ -216,6 +216,7 @@ victor_9000_fdc_device::victor_9000_fdc_device(const machine_config &mconfig, co m_floppy0(*this, I8048_TAG":0"), m_floppy1(*this, I8048_TAG":1"), m_gcr_rom(*this, "gcr"), + m_led(*this, "led%u", 0U), m_da(0), m_da0(0), m_da1(0), @@ -260,6 +261,8 @@ victor_9000_fdc_device::victor_9000_fdc_device(const machine_config &mconfig, co void victor_9000_fdc_device::device_start() { + m_led.resolve(); + // resolve callbacks m_irq_cb.resolve_safe(); m_syn_cb.resolve_safe(); @@ -892,10 +895,10 @@ WRITE8_MEMBER( victor_9000_fdc_device::via6_pa_w ) */ // LED, drive A - machine().output().set_led_value(LED_A, BIT(data, 0)); + m_led[LED_A] = BIT(data, 0); // LED, drive B - machine().output().set_led_value(LED_B, BIT(data, 2)); + m_led[LED_B] = BIT(data, 2); bool sync = false; diff --git a/src/mame/machine/victor9k_fdc.h b/src/mame/machine/victor9k_fdc.h index 7987bc30f0c..942c8038ac4 100644 --- a/src/mame/machine/victor9k_fdc.h +++ b/src/mame/machine/victor9k_fdc.h @@ -132,6 +132,7 @@ private: required_device m_floppy0; required_device m_floppy1; required_memory_region m_gcr_rom; + output_finder<2> m_led; void update_stepper_motor(floppy_image_device *floppy, int stp, int old_st, int st); void update_spindle_motor(floppy_image_device *floppy, emu_timer *t_tach, bool start, bool stop, bool sel, uint8_t &da); diff --git a/src/mame/machine/wangpckb.cpp b/src/mame/machine/wangpckb.cpp index 62fec62a771..59a4cbf0cf4 100644 --- a/src/mame/machine/wangpckb.cpp +++ b/src/mame/machine/wangpckb.cpp @@ -371,6 +371,7 @@ wangpc_keyboard_device::wangpc_keyboard_device(const machine_config &mconfig, co m_maincpu(*this, I8051_TAG), m_y(*this, "Y%u", 0), m_txd_handler(*this), + m_led(*this, "led%u", 0U), m_keylatch(0), m_rxd(1) { @@ -533,7 +534,7 @@ WRITE8_MEMBER( wangpc_keyboard_device::kb_p1_w ) for (int i = 0; i < 6; i++) { - machine().output().set_led_value(i, !BIT(data, i)); + m_led[i] = BIT(~data, i); } //if (LOG) logerror("P1 %02x\n", data); diff --git a/src/mame/machine/wangpckb.h b/src/mame/machine/wangpckb.h index 02a4e803896..d22fb31e08d 100644 --- a/src/mame/machine/wangpckb.h +++ b/src/mame/machine/wangpckb.h @@ -81,6 +81,7 @@ private: required_device m_maincpu; required_ioport_array<16> m_y; devcb_write_line m_txd_handler; + output_finder<6> m_led; uint8_t m_keylatch; int m_rxd; diff --git a/src/mame/machine/xevious.cpp b/src/mame/machine/xevious.cpp index 8ec4ce970d6..1bd65aa5937 100644 --- a/src/mame/machine/xevious.cpp +++ b/src/mame/machine/xevious.cpp @@ -138,8 +138,8 @@ WRITE8_MEMBER( xevious_state::battles_customio_data3_w ) WRITE8_MEMBER( xevious_state::battles_CPU4_coin_w ) { - output().set_led_value(0,data & 0x02); // Start 1 - output().set_led_value(1,data & 0x01); // Start 2 + m_led[0] = BIT(data, 1); // Start 1 + m_led[1] = BIT(data, 0); // Start 2 machine().bookkeeping().coin_counter_w(0,data & 0x20); machine().bookkeeping().coin_counter_w(1,data & 0x10); diff --git a/src/mame/video/cischeat.cpp b/src/mame/video/cischeat.cpp index 7ef507da847..de2267328e5 100644 --- a/src/mame/video/cischeat.cpp +++ b/src/mame/video/cischeat.cpp @@ -132,8 +132,8 @@ WRITE16_MEMBER(cischeat_state::leds_out_w) { machine().bookkeeping().coin_counter_w(0, data & 0x01); machine().bookkeeping().coin_counter_w(1, data & 0x02); - output().set_led_value(0, data & 0x10); // start button - output().set_led_value(1, data & 0x20); // ? + m_led[0] = BIT(data, 4); // start button + m_led[1] = BIT(data, 5); // ? } } @@ -148,7 +148,7 @@ WRITE16_MEMBER(cischeat_state::motor_out_w) { // motor (seat?) if (ACCESSING_BITS_0_7) - output().set_led_value(2, (data & 0xff) != m_motor_value ? 1 : 0); + m_led[2] = (data & 0xff) != m_motor_value ? 1 : 0; m_motor_value = data & 0xff; } @@ -249,10 +249,10 @@ WRITE16_MEMBER(cischeat_state::f1gpstar_motor_w) { machine().bookkeeping().coin_counter_w(0, data & 0x01); machine().bookkeeping().coin_counter_w(1, data & 0x02); - output().set_led_value(0, data & 0x04); // start button - output().set_led_value(1, data & 0x20); // ? + m_led[0] = BIT(data, 2); // start button + m_led[1] = BIT(data, 5); // ? // wheel | seat motor - output().set_led_value(2, ((data >> 3) | (data >> 4)) & 1 ); + m_led[2] = BIT(data, 3) | BIT(data, 4); } } diff --git a/src/mame/video/cps1.cpp b/src/mame/video/cps1.cpp index 24420e6d8dc..d623581d9a9 100644 --- a/src/mame/video/cps1.cpp +++ b/src/mame/video/cps1.cpp @@ -1855,9 +1855,9 @@ WRITE16_MEMBER(cps_state::cps1_cps_b_w) if (m_game_config->cpsb_value == 0x0402) // Mercs (CN2 connector) { machine().bookkeeping().coin_lockout_w(2, ~data & 0x01); - output().set_led_value(0, data & 0x02); - output().set_led_value(1, data & 0x04); - output().set_led_value(2, data & 0x08); + m_led_cboard[0] = BIT(data, 1); + m_led_cboard[1] = BIT(data, 2); + m_led_cboard[2] = BIT(data, 3); } else // kod, captcomm, knights { diff --git a/src/mame/video/cvs.cpp b/src/mame/video/cvs.cpp index 824573f2ccc..5e0d38640a0 100644 --- a/src/mame/video/cvs.cpp +++ b/src/mame/video/cvs.cpp @@ -90,8 +90,8 @@ WRITE8_MEMBER(cvs_state::cvs_video_fx_w) if (data & 0x04) logerror(" SCREEN ROTATE\n"); if (data & 0x08) logerror(" SHADE BRIGHTER TO LEFT\n"); - output().set_led_value(1, data & 0x10); /* lamp 1 */ - output().set_led_value(2, data & 0x20); /* lamp 2 */ + m_lamp[1] = BIT(data, 4); /* lamp 1 */ + m_lamp[2] = BIT(data, 5); /* lamp 2 */ if (data & 0x40) logerror(" SHADE BRIGHTER TO BOTTOM\n"); if (data & 0x80) logerror(" SHADE BRIGHTER TO TOP\n"); diff --git a/src/mame/video/epos.cpp b/src/mame/video/epos.cpp index 60876258a72..b722033d4b9 100644 --- a/src/mame/video/epos.cpp +++ b/src/mame/video/epos.cpp @@ -70,8 +70,8 @@ WRITE8_MEMBER(epos_state::port_1_w) D4-D7 - unused */ - output().set_led_value(0, (data >> 0) & 0x01); - output().set_led_value(1, (data >> 1) & 0x01); + m_led[0] = BIT(data, 0); + m_led[1] = BIT(data, 1); machine().bookkeeping().coin_counter_w(0, (data >> 2) & 0x01); -- cgit v1.2.3